Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
phpdts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nemo Ma
phpdts
Commits
9101f97f
Commit
9101f97f
authored
Jun 12, 2025
by
Nemo Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix: Secondary Menu
parent
1e131866
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
8 deletions
+86
-8
doc/etc/20241218_fix_secondary_menu_bug.txt
doc/etc/20241218_fix_secondary_menu_bug.txt
+66
-0
include/game/item.main.php
include/game/item.main.php
+5
-1
include/game/item.tool.php
include/game/item.tool.php
+12
-5
include/game/item.weapon_mod.php
include/game/item.weapon_mod.php
+3
-2
No files found.
doc/etc/20241218_fix_secondary_menu_bug.txt
0 → 100644
View file @
9101f97f
修复时间:2024年12月18日
问题描述:
用户报告所有使用后会进入二级菜单的物品(如毒药、灵魂宝石、祝福宝石、残响兵器、超臆想时空等)使用后都不会进入二级菜单逻辑。这是item.func拆分重构后出现的问题。
问题分析:
1. 在旧版本的item.func.old中,这些物品的处理逻辑设置了$cmd变量后就结束了,二级菜单能正常显示。
2. 在新的拆分架构中,这些物品被分散到不同的文件中处理:
- 毒药、残响兵器、超臆想时空 -> item.tool.php
- 灵魂宝石、祝福宝石 -> item.weapon_mod.php
3. 问题的根源是在item.main.php的最后(第237行),它总是强制设置$mode = 'command',覆盖了二级菜单的设置。
修复方案:
1. 修改item.main.php,在设置$mode = 'command'之前检查是否已经设置了$cmd变量,如果设置了就不要覆盖mode。
2. 在各个子处理文件中添加global $cmd声明,确保$cmd变量能被正确设置。
具体修改:
1. include/game/item.main.php (第233-238行):
修改前:
```php
// 检查成就
include_once GAME_ROOT.'./include/game/achievement.func.php';
check_item_achievement_rev($name,$i,$ie,$is,$ik,$isk);
$mode = 'command';
return;
```
修改后:
```php
// 检查成就
include_once GAME_ROOT.'./include/game/achievement.func.php';
check_item_achievement_rev($name,$i,$ie,$is,$ik,$isk);
// 只有在没有设置二级菜单时才设置为command模式
global $cmd;
if (empty($cmd)) {
$mode = 'command';
}
return;
```
2. include/game/item.tool.php:
- 残响兵器处理(第58行):添加global $cmd, $mode;
- 超臆想时空处理(第73行):添加global $cmd, $mode;
- 毒药处理(第88行):添加global $cmd, $mode;
3. include/game/item.weapon_mod.php:
- 灵魂宝石/祝福宝石处理(第234行):添加global $cmd, $mode;
修复逻辑:
通过这些修改,当物品需要显示二级菜单时:
1. 子处理函数设置$cmd变量并return
2. 控制权回到item.main.php
3. item.main.php检查$cmd是否为空,如果不为空则不设置$mode = 'command'
4. 二级菜单正常显示
测试建议:
1. 测试毒药的二级菜单是否正常显示
2. 测试灵魂宝石和祝福宝石的强化菜单是否正常显示
3. 测试残响兵器和超臆想时空的命名菜单是否正常显示
4. 测试■DeathNote■的特殊菜单是否正常显示
include/game/item.main.php
View file @
9101f97f
...
...
@@ -234,6 +234,10 @@ function itemuse($itmn,&$data=NULL) {
include_once
GAME_ROOT
.
'./include/game/achievement.func.php'
;
check_item_achievement_rev
(
$name
,
$i
,
$ie
,
$is
,
$ik
,
$isk
);
$mode
=
'command'
;
// 只有在没有设置二级菜单时才设置为command模式
global
$cmd
;
if
(
empty
(
$cmd
))
{
$mode
=
'command'
;
}
return
;
}
include/game/item.tool.php
View file @
9101f97f
...
...
@@ -56,39 +56,45 @@ function item_tool($itmn, &$data) {
}
return
;
}
elseif
(
$itm
==
'残响兵器'
)
{
global
$cmd
,
$mode
;
foreach
(
Array
(
'wep'
,
'arb'
,
'arh'
,
'ara'
,
'arf'
,
'art'
)
as
$val
)
{
// 全局变量已在extract中处理
}
for
(
$i
=
1
;
$i
<=
6
;
$i
++
)
{
// 全局变量已在extract中处理
}
include
template
(
'nametag'
);
$cmd
=
ob_get_contents
();
ob_clean
();
// 不要设置mode,让二级菜单显示
return
;
}
elseif
(
$itm
==
'超臆想时空'
)
{
global
$cmd
,
$mode
;
foreach
(
Array
(
'wep'
,
'arb'
,
'arh'
,
'ara'
,
'arf'
,
'art'
)
as
$val
)
{
// 全局变量已在extract中处理
}
for
(
$i
=
1
;
$i
<=
6
;
$i
++
)
{
// 全局变量已在extract中处理
}
include
template
(
'supernametag'
);
$cmd
=
ob_get_contents
();
ob_clean
();
// 不要设置mode,让二级菜单显示
return
;
}
elseif
(
$itm
==
'毒药'
)
{
global
$cmd
,
$mode
;
for
(
$i
=
1
;
$i
<=
6
;
$i
++
)
{
// 全局变量已在extract中处理
}
include
template
(
'poison'
);
$cmd
=
ob_get_contents
();
ob_clean
();
// 不要设置mode,让二级菜单显示
return
;
}
elseif
(
$itm
==
'探测器电池'
)
{
$flag
=
false
;
...
...
@@ -162,6 +168,7 @@ function item_tool($itmn, &$data) {
$log
.=
"你的武器已经安装了消音器。<br>"
;
}
}
elseif
(
$itm
==
'■DeathNote■'
)
{
global
$mode
;
$mode
=
'deathnote'
;
$log
.=
'你翻开了■DeathNote■<br>'
;
return
;
...
...
include/game/item.weapon_mod.php
View file @
9101f97f
...
...
@@ -231,7 +231,7 @@ function item_weapon_mod($itmn, &$data) {
}
$itms
--
;
}
elseif
(
$itm
==
'『灵魂宝石』'
||
$itm
==
'『祝福宝石』'
)
{
//global $cmd
;
global
$cmd
,
$mode
;
//码语行人,$club==21的时候不能使用宝石
if
(
$club
==
21
)
{
$log
.=
"<span class=
\"
yellow
\"
>突然,你的眼前出现了扭曲的字符!</span><br>"
;
...
...
@@ -257,7 +257,8 @@ function item_weapon_mod($itmn, &$data) {
$log
.=
'唔?你的包裹里没有可以强化的装备,是不是没有脱下来呢?DA☆ZE<br><br>'
;
}
else
{
$log
.=
"宝石在你的手上发出异样的光芒,似乎有个奇怪的女声在你耳边说道<span class=
\"
yellow
\"
>
\"
我是从天界来的凯丽
\"
</span>."
;
}
}
// 不要设置mode,让二级菜单显示
return
;
}
elseif
(
$itm
==
'水果刀'
)
{
$flag
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment