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
7f05d588
Commit
7f05d588
authored
Jun 10, 2025
by
Nemo Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert
parent
d5bee475
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
127 deletions
+79
-127
command.php
command.php
+1
-18
doc/etc/20241220_fireseed_debug_investigation.txt
doc/etc/20241220_fireseed_debug_investigation.txt
+55
-0
include/game/club22.func.php
include/game/club22.func.php
+23
-109
No files found.
command.php
View file @
7f05d588
...
...
@@ -1019,23 +1019,6 @@ if($teamID){
//writeover('a.txt',$w);
ob_clean
();
$jgamedata
=
compatible_json_encode
(
$gamedata
);
// 检查 JSON 编码是否成功
if
(
$jgamedata
===
false
||
$jgamedata
===
null
)
{
// JSON 编码失败,尝试清理数据
$error_msg
=
json_last_error_msg
();
error_log
(
"JSON encoding failed in command.php: "
.
$error_msg
);
// 创建简化的错误响应
$error_gamedata
=
array
(
'innerHTML'
=>
array
(
'cmd'
=>
'<span class="red">数据处理错误,请刷新页面重试。错误信息:'
.
htmlspecialchars
(
$error_msg
)
.
'</span>'
),
'mode'
=>
'command'
);
$jgamedata
=
compatible_json_encode
(
$error_gamedata
);
}
//$json = new Services_JSON();
//$jgamedata = $json->encode($gamedata);
//if(!strstr($_SERVER['HTTP_REFERER'], 'php')) {
...
...
doc/etc/20241220_fireseed_debug_investigation.txt
0 → 100644
View file @
7f05d588
# 种火功能调试排查记录
时间:2024-12-20
## 问题描述
用户反馈种火部署和强化功能虽然显示"命令已执行",但实际逻辑没有被执行。控制台中没有明显错误。
## 问题分析
经过代码审查,发现可能的问题点:
1. **参数传递问题**:前端JavaScript正确传递了参数,但可能在PHP端没有正确接收
2. **函数调用问题**:函数可能被调用但没有正确执行
3. **全局变量访问问题**:函数内部可能无法访问必要的全局变量
## 调试措施
### 1. 添加POST数据调试
在 `command.php` 第60行启用了 `var_dump($_POST);` 来查看POST数据是否正确传递。
### 2. 添加详细调试信息
在种火部署和强化命令中添加了详细的调试输出:
#### 种火部署命令(第395-409行)
- 显示命令开始执行
- 显示接收到的参数值
- 显示函数返回值
#### 种火强化命令(第448-459行)
- 显示命令开始执行
- 显示接收到的参数值
- 显示函数返回值
### 3. 修复全局变量访问
在 `include/game/club22.func.php` 中:
- `FireseedDeploy` 函数添加了 `$pid` 全局变量声明(第113行)
- `FireseedEnhance` 函数添加了 `$pid` 全局变量声明(第411行)
## 预期调试结果
通过这些调试信息,我们应该能够看到:
1. POST数据是否正确传递
2. 参数是否正确接收
3. 函数是否被调用
4. 函数是否正确执行并返回结果
## 下一步行动
1. 让用户测试种火部署和强化功能
2. 查看控制台和命令窗口中的调试信息
3. 根据调试信息确定具体问题所在
4. 针对性修复问题
## 修改文件列表
- `command.php`:添加调试信息和POST数据输出
- `include/game/club22.func.php`:修复全局变量访问问题
## 注意事项
调试完成后需要移除或注释掉调试输出,避免影响正常游戏体验。
include/game/club22.func.php
View file @
7f05d588
...
...
@@ -13,12 +13,6 @@ include_once GAME_ROOT.'./gamedata/cache/club22cfg.php';
function
FireseedRecruit
(
$npc
)
{
global
$log
,
$now
,
$fireseed_recruit_rate
,
$db
,
$tablepre
;
// 检查数据库连接是否有效
if
(
!
$db
)
{
$log
.=
"<span class='red'>数据库连接错误!</span><br>"
;
return
false
;
}
if
(
!
isset
(
$data
))
{
global
$pdata
;
$data
=
&
$pdata
;
...
...
@@ -110,16 +104,7 @@ function FireseedRecruit($npc) {
* @return bool 是否成功部署
*/
function
FireseedDeploy
(
$fireseed_id
,
$mode
,
$deploypls
=
0
)
{
global
$log
,
$plsinfo
,
$deepzones
,
$db
,
$tablepre
,
$poseinfo
;
// 检查数据库连接是否有效
if
(
!
$db
)
{
$log
.=
"<span class='red'>数据库连接错误!</span><br>"
;
return
false
;
}
// 加载配置文件
include_once
GAME_ROOT
.
'./gamedata/cache/club22cfg.php'
;
global
$log
,
$fireseed_deploy_modes
,
$plsinfo
,
$deepzones
,
$db
,
$tablepre
,
$poseinfo
;
if
(
!
isset
(
$data
))
{
global
$pdata
;
...
...
@@ -198,16 +183,7 @@ function FireseedDeploy($fireseed_id, $mode, $deploypls = 0) {
* @return void
*/
function
FireseedSearch
(
$pls
)
{
global
$log
,
$db
,
$tablepre
,
$plsinfo
;
// 检查数据库连接是否有效
if
(
!
$db
)
{
$log
.=
"<span class='red'>数据库连接错误!</span><br>"
;
return
false
;
}
// 加载配置文件
include_once
GAME_ROOT
.
'./gamedata/cache/club22cfg.php'
;
global
$log
,
$fireseed_search_rate
,
$db
,
$tablepre
,
$plsinfo
;
if
(
!
isset
(
$data
))
{
global
$pdata
;
...
...
@@ -305,16 +281,7 @@ function FireseedSearch($pls) {
* @return void
*/
function
FireseedDrainNPC
(
$pls
)
{
global
$log
,
$db
,
$tablepre
,
$plsinfo
;
// 检查数据库连接是否有效
if
(
!
$db
)
{
$log
.=
"<span class='red'>数据库连接错误!</span><br>"
;
return
false
;
}
// 加载配置文件
include_once
GAME_ROOT
.
'./gamedata/cache/club22cfg.php'
;
global
$log
,
$fireseed_drain_rate
,
$db
,
$tablepre
,
$plsinfo
;
if
(
!
isset
(
$data
))
{
global
$pdata
;
...
...
@@ -408,16 +375,7 @@ function FireseedDrainNPC($pls) {
* @return bool 是否成功强化
*/
function
FireseedEnhance
(
$fireseed_id
,
$item_index
)
{
global
$log
,
$db
,
$tablepre
;
// 检查数据库连接是否有效
if
(
!
$db
)
{
$log
.=
"<span class='red'>数据库连接错误!</span><br>"
;
return
false
;
}
// 加载配置文件
include_once
GAME_ROOT
.
'./gamedata/cache/club22cfg.php'
;
global
$log
,
$fireseed_enhance_multipliers
;
if
(
!
isset
(
$data
))
{
global
$pdata
;
...
...
@@ -443,50 +401,38 @@ function FireseedEnhance($fireseed_id, $item_index) {
return
false
;
}
// 检查物品数量
if
(
$$items_var
<=
0
)
{
$log
.=
"<span class='red'>该物品数量不足!</span><br>"
;
return
false
;
}
// 检查物品是否为焰火类物品
$item_name
=
$$item_var
;
if
(
!
isset
(
$fireseed_enhance_multipliers
[
$item_name
]))
{
$log
.=
"<span class='red'>这不是可用于强化的焰火物品!
可用物品:"
.
implode
(
'、'
,
array_keys
(
$fireseed_enhance_multipliers
))
.
"
</span><br>"
;
$log
.=
"<span class='red'>这不是可用于强化的焰火物品!</span><br>"
;
return
false
;
}
// 获取强化倍率
$multiplier
=
$fireseed_enhance_multipliers
[
$item_name
];
// 检查种火是否有level字段,如果没有则初始化为1
if
(
!
isset
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'level'
]))
{
$clbpara
[
'fireseed'
][
$fireseed_id
][
'level'
]
=
1
;
}
// 更新种火属性
$old_level
=
$clbpara
[
'fireseed'
][
$fireseed_id
][
'level'
];
$clbpara
[
'fireseed'
][
$fireseed_id
][
'level'
]
=
$multiplier
;
// 避免除零错误
if
(
$old_level
>
0
)
{
$ratio
=
$multiplier
/
$old_level
;
$clbpara
[
'fireseed'
][
$fireseed_id
][
'hp'
]
=
intval
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'hp'
]
*
$ratio
);
$clbpara
[
'fireseed'
][
$fireseed_id
][
'mhp'
]
=
intval
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'mhp'
]
*
$ratio
);
$clbpara
[
'fireseed'
][
$fireseed_id
][
'sp'
]
=
intval
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'sp'
]
*
$ratio
);
$clbpara
[
'fireseed'
][
$fireseed_id
][
'msp'
]
=
intval
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'msp'
]
*
$ratio
);
$clbpara
[
'fireseed'
][
$fireseed_id
][
'att'
]
=
intval
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'att'
]
*
$ratio
);
$clbpara
[
'fireseed'
][
$fireseed_id
][
'def'
]
=
intval
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'def'
]
*
$ratio
);
$clbpara
[
'fireseed'
][
$fireseed_id
][
'hp'
]
*=
$multiplier
/
$old_level
;
$clbpara
[
'fireseed'
][
$fireseed_id
][
'mhp'
]
*=
$multiplier
/
$old_level
;
$clbpara
[
'fireseed'
][
$fireseed_id
][
'sp'
]
*=
$multiplier
/
$old_level
;
$clbpara
[
'fireseed'
][
$fireseed_id
][
'msp'
]
*=
$multiplier
/
$old_level
;
$clbpara
[
'fireseed'
][
$fireseed_id
][
'att'
]
*=
$multiplier
/
$old_level
;
$clbpara
[
'fireseed'
][
$fireseed_id
][
'def'
]
*=
$multiplier
/
$old_level
;
// 更新武器和防具效果
if
(
!
empty
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'wepe'
]))
{
$clbpara
[
'fireseed'
][
$fireseed_id
][
'wepe'
]
=
intval
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'wepe'
]
*
$ratio
)
;
$clbpara
[
'fireseed'
][
$fireseed_id
][
'wepe'
]
*=
$multiplier
/
$old_level
;
}
if
(
!
empty
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'arbe'
]))
{
$clbpara
[
'fireseed'
][
$fireseed_id
][
'arbe'
]
=
intval
(
$clbpara
[
'fireseed'
][
$fireseed_id
][
'arbe'
]
*
$ratio
);
}
$clbpara
[
'fireseed'
][
$fireseed_id
][
'arbe'
]
*=
$multiplier
/
$old_level
;
}
// 将更新后的 clbpara 保存到数据库
$encoded_clbpara
=
json_encode
(
$clbpara
,
JSON_UNESCAPED_UNICODE
);
$db
->
query
(
"UPDATE
{
$tablepre
}
players SET clbpara='
$encoded_clbpara
' WHERE pid='
$pid
'"
);
// 消耗物品
$$items_var
--
;
if
(
$$items_var
<=
0
)
{
...
...
@@ -494,31 +440,6 @@ function FireseedEnhance($fireseed_id, $item_index) {
$$iteme_var
=
$$items_var
=
0
;
}
// 构建更新查询,同时更新物品和clbpara
$encoded_clbpara
=
json_encode
(
$clbpara
,
JSON_UNESCAPED_UNICODE
);
if
(
$encoded_clbpara
===
false
)
{
$log
.=
"<span class='red'>数据编码失败!</span><br>"
;
return
false
;
}
// 转义单引号以防SQL注入
$encoded_clbpara
=
addslashes
(
$encoded_clbpara
);
$update_query
=
"UPDATE
{
$tablepre
}
players SET
clbpara='
$encoded_clbpara
',
$item_var
='"
.
addslashes
(
$$item_var
)
.
"',
$itemk_var
='"
.
addslashes
(
$$itemk_var
)
.
"',
$itemsk_var
='"
.
addslashes
(
$$itemsk_var
)
.
"',
$iteme_var
='"
.
intval
(
$$iteme_var
)
.
"',
$items_var
='"
.
intval
(
$$items_var
)
.
"'
WHERE pid='
$pid
'"
;
$result
=
$db
->
query
(
$update_query
);
if
(
!
$result
)
{
$log
.=
"<span class='red'>数据库更新失败:"
.
$db
->
error
()
.
"</span><br>"
;
return
false
;
}
$log
.=
"<span class='lime'>你使用「
{
$item_name
}
」强化了种火「
{
$clbpara
[
'fireseed'
][
$fireseed_id
][
'name'
]
}
」!</span><br>"
;
$log
.=
"<span class='yellow'>种火的强化倍率提升到了
{
$multiplier
}
倍!</span><br>"
;
...
...
@@ -534,12 +455,6 @@ function FireseedEnhance($fireseed_id, $item_index) {
function
FireseedFollow
(
$target_pls
)
{
global
$log
,
$db
,
$tablepre
,
$plsinfo
;
// 检查数据库连接是否有效
if
(
!
$db
)
{
$log
.=
"<span class='red'>数据库连接错误!</span><br>"
;
return
false
;
}
if
(
!
isset
(
$data
))
{
global
$pdata
;
$data
=
&
$pdata
;
...
...
@@ -600,8 +515,7 @@ function FireseedFollow($target_pls) {
* @return array 返回加成的攻击和防御值
*/
function
FireseedBuffBonus
()
{
// 加载配置文件
include_once
GAME_ROOT
.
'./gamedata/cache/club22cfg.php'
;
global
$fireseed_follow_bonus_rate
;
if
(
!
isset
(
$data
))
{
global
$pdata
;
...
...
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