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
31b2f0c9
Commit
31b2f0c9
authored
Jun 09, 2025
by
Nemo Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUGFIX: Item infinite durability
parent
f74e6c7c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
279 additions
and
18 deletions
+279
-18
doc/etc/20250119_infinite_durability_fix.txt
doc/etc/20250119_infinite_durability_fix.txt
+228
-0
include/game/item.giftbox.php
include/game/item.giftbox.php
+16
-4
include/game/item.main.php
include/game/item.main.php
+4
-2
include/game/item.other.php
include/game/item.other.php
+4
-1
include/game/item.tool.php
include/game/item.tool.php
+20
-6
include/game/item.weather.php
include/game/item.weather.php
+7
-5
No files found.
doc/etc/20250119_infinite_durability_fix.txt
0 → 100644
View file @
31b2f0c9
修复耐久度为∞的消耗道具被错误消耗的问题
时间:2025年1月19日
## 问题描述
玩家汇报使用了一件耐久度为∞(itms='∞')的消耗道具时,该物品被直接消耗。
耐久度∞的道具正确的处理是可以无限使用。
## 问题分析
通过对比item.func.old和新版本的item.main.php,发现在重构过程中,有几处地方直接使用了`$itms--`而没有检查`$nosta`(无限耐久度标识)。
## 修复内容
### 1. include/game/item.main.php
**位置**:第218行
**问题**:元素大师使用提示纸条时直接消耗道具
**修复前**:
```php
$itms--;
```
**修复后**:
```php
if ($itms != $nosta) {
$itms--;
}
```
### 2. include/game/item.tool.php
**位置**:多处
**问题**:多个工具类道具使用时直接消耗道具
#### 2.1 探测器电池(第98行)
**修复前**:
```php
$itms--;
```
**修复后**:
```php
if ($itms != $nosta) {
$itms--;
}
```
#### 2.2 御神签(第111行)
**修复前**:
```php
$itms--;
```
**修复后**:
```php
if ($itms != $nosta) {
$itms--;
}
```
#### 2.3 凸眼鱼(第118行)
**修复前**:
```php
$itms--; $isk = $cnum;
```
**修复后**:
```php
if ($itms != $nosta) {
$itms--;
}
$isk = $cnum;
```
#### 2.4 鱼眼凸(第127行)
**修复前**:
```php
$itms--; $isk = $cnum;
```
**修复后**:
```php
if ($itms != $nosta) {
$itms--;
}
$isk = $cnum;
```
#### 2.5 天候棒(第139行)
**修复前**:
```php
$itms--;
```
**修复后**:
```php
if ($itms != $nosta) {
$itms--;
}
```
#### 2.6 消音器(第146行)
**修复前**:
```php
$itms--;
```
**修复后**:
```php
if ($itms != $nosta) {
$itms--;
}
```
### 3. include/game/item.giftbox.php
**位置**:多处
**问题**:礼品盒类道具使用时直接消耗道具
#### 3.1 YGO box(第134行)
**修复前**:
```php
$itms--; $oitm = $itm;
```
**修复后**:
```php
$oitm = $itm;
if ($itms != $nosta) {
$itms--;
}
```
#### 3.2 FY box(第161行)
**修复前**:
```php
$itms--; $oitm = $itm;
```
**修复后**:
```php
$oitm = $itm;
if ($itms != $nosta) {
$itms--;
}
```
#### 3.3 Debug box(第188行)
**修复前**:
```php
$itms--; $oitm = $itm;
```
**修复后**:
```php
$oitm = $itm;
if ($itms != $nosta) {
$itms--;
}
```
#### 3.4 Gift box(第20行)
**修复前**:
```php
$itms--; $oitm = $itm; $oitmk = $itmk;
```
**修复后**:
```php
$oitm = $itm; $oitmk = $itmk;
if ($itms != $nosta) {
$itms--;
}
```
### 4. include/game/item.weather.php
**位置**:第20行
**问题**:天气控制道具使用时直接消耗道具
**修复前**:
```php
$itms--;
if ($itms <= 0) {
$log .= "<span class=\"red\">$itm</span>用光了。<br>";
$itm = $itmk = $itmsk = '';
$itme = $itms = 0;
}
```
**修复后**:
```php
if ($itms != $nosta) {
$itms--;
if ($itms <= 0) {
$log .= "<span class=\"red\">$itm</span>用光了。<br>";
$itm = $itmk = $itmsk = '';
$itme = $itms = 0;
}
}
```
### 5. include/game/item.other.php
**位置**:第410行
**问题**:🎆C类型道具(Weird Fireseed Box)使用时直接消耗道具
**修复前**:
```php
$itms--; $oitm = $itm; $oitmk = $itmk;
```
**修复后**:
```php
$oitm = $itm; $oitmk = $itmk;
if ($itms != $nosta) {
$itms--;
}
```
## 修复原理
在旧版本的item.func.old中,所有的物品消耗都正确地使用了以下模式:
```php
if ($itms != $nosta) {
$itms--;
if ($itms <= 0) {
$log .= "<span class=\"red\">$itm</span>用光了。<br>";
$itm = $itmk = $itmsk = '';
$itme = $itms = 0;
}
}
```
其中`$nosta`是全局变量,表示无限耐久度的标识(通常为'∞')。
当物品的耐久度等于`$nosta`时,不应该减少耐久度,从而实现无限使用的效果。
## 测试建议
1. 创建一个耐久度为∞的消耗道具
2. 使用该道具,确认道具不会被消耗
3. 测试各种类型的道具:
- 元素大师的提示纸条
- 工具类道具(探测器电池、御神签等)
- 礼品盒类道具
## 注意事项
此修复确保了所有消耗道具在使用时都会正确检查耐久度是否为无限,
保持了与旧版本item.func.old的一致性。
include/game/item.giftbox.php
View file @
31b2f0c9
...
...
@@ -17,7 +17,10 @@ function item_giftbox($itmn, &$data) {
$log
.=
"你打开了<span class=
\"
yellow
\"
>
$itm
</span>。<br>"
;
$itms
--
;
$oitm
=
$itm
;
$oitmk
=
$itmk
;
$oitm
=
$itm
;
$oitmk
=
$itmk
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
//if($itms <= 0) destory_single_item($data,$itmn,1);
if
(
strpos
(
$oitmk
,
'ps'
)
===
0
){
//银色盒子
...
...
@@ -131,7 +134,10 @@ function item_ygo_box($itmn, &$data) {
$itmsk
=
&
$
{
'itmsk'
.
$itmn
};
$log
.=
"你打开了<span class=
\"
yellow
\"
>
$itm
</span>。<br>"
;
$itms
--
;
$oitm
=
$itm
;
$oitm
=
$itm
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
if
(
$itms
<=
0
)
destory_single_item
(
$data
,
$itmn
,
1
);
$file1
=
config
(
'box'
,
$gamecfg
);
...
...
@@ -158,7 +164,10 @@ function item_fy_box($itmn, &$data) {
$itmsk
=
&
$
{
'itmsk'
.
$itmn
};
$log
.=
"你打开了<span class=
\"
yellow
\"
>
$itm
</span>。<br>"
;
$itms
--
;
$oitm
=
$itm
;
$oitm
=
$itm
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
if
(
$itms
<=
0
)
destory_single_item
(
$data
,
$itmn
,
1
);
$file1
=
config
(
'fy'
,
$gamecfg
);
...
...
@@ -185,7 +194,10 @@ function item_debug_box($itmn, &$data) {
$itmsk
=
&
$
{
'itmsk'
.
$itmn
};
$log
.=
"你打开了<span class=
\"
yellow
\"
>
$itm
</span>。<br>"
;
$itms
--
;
$oitm
=
$itm
;
$oitm
=
$itm
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
if
(
$itms
<=
0
)
destory_single_item
(
$data
,
$itmn
,
1
);
$file1
=
config
(
'f99'
,
$gamecfg
);
...
...
include/game/item.main.php
View file @
31b2f0c9
...
...
@@ -215,14 +215,16 @@ function itemuse($itmn,&$data=NULL) {
$log
.=
"特征的元素组合起来,就有机会组合出【
{
$s_result
}
】属性。”</span><br>"
;
//阅后即焚
$log
.=
"<br>……说这么多鬼记得住啊!<br>你思考了一下,决定把
{
$itm
}
吃进肚子里,以便慢慢消化其中的知识。<br>"
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
# 将提示给到的次要特征组合加入笔记内
if
(
empty
(
$clbpara
[
'elements'
][
'info'
][
'sd'
][
'sd'
.
$s_id
]))
$clbpara
[
'elements'
][
'info'
][
'sd'
][
'sd'
.
$s_id
]
=
1
;
}
// 消耗物品
if
(
$itms
<=
0
&&
$itm
)
{
if
(
$itms
<=
0
&&
$itm
s
!=
$nosta
&&
$itm
)
{
$log
.=
"<span class=
\"
red
\"
>
$itm
</span>用光了。<br>"
;
$itm
=
$itmk
=
$itmsk
=
''
;
$itme
=
$itms
=
0
;
...
...
include/game/item.other.php
View file @
31b2f0c9
...
...
@@ -407,7 +407,10 @@ function item_fireworks($itmn, &$data) {
# Officially dubbed Weird Box.
$log
.=
"你打开了<span class=
\"
yellow
\"
>
$itm
</span>。<br>"
;
$itms
--
;
$oitm
=
$itm
;
$oitmk
=
$itmk
;
$oitm
=
$itm
;
$oitmk
=
$itmk
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
include_once
config
(
'randomFSW'
,
$gamecfg
);
...
...
include/game/item.tool.php
View file @
31b2f0c9
...
...
@@ -95,7 +95,9 @@ function item_tool($itmn, &$data) {
for
(
$i
=
1
;
$i
<=
6
;
$i
++
)
{
if
(
$
{
'itmk'
.
$i
}
==
'R'
)
{
$
{
'itme'
.
$i
}
+=
$itme
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
$flag
=
true
;
$log
.=
"为<span class=
\"
yellow
\"
>
{${
'itm'
.
$i
}}
</span>充了电。"
;
break
;
...
...
@@ -108,14 +110,19 @@ function item_tool($itmn, &$data) {
$log
.=
"使用了<span class=
\"
yellow
\"
>
$itm
</span>。<br>"
;
include_once
GAME_ROOT
.
'./include/game/item2.func.php'
;
divining
();
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
}
elseif
(
$itm
==
'凸眼鱼'
)
{
$tm
=
$now
-
$corpseprotect
;
// 尸体保护
$db
->
query
(
"UPDATE
{
$tablepre
}
players SET weps='0',wep2s='0',arbs='0',arhs='0',aras='0',arfs='0',arts='0',itms0='0',itms1='0',itms2='0',itms3='0',itms4='0',itms5='0',itms6='0',money='0' WHERE hp <= 0 AND endtime <=
$tm
"
);
$cnum
=
$db
->
affected_rows
();
addnews
(
$now
,
'corpseclear'
,
$name
,
$cnum
,
$nick
);
$log
.=
"使用了<span class=
\"
yellow
\"
>
$itm
</span>。<br>突然刮起了一阵怪风,吹走了地上的
{
$cnum
}
具尸体!<br>"
;
$itms
--
;
$isk
=
$cnum
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
$isk
=
$cnum
;
}
elseif
(
$itm
==
'鱼眼凸'
)
{
$tm
=
$now
-
$corpseprotect
;
// 尸体保护
$db
->
query
(
"UPDATE
{
$tablepre
}
players SET pls='
$pls
' WHERE hp <= 0 AND endtime <=
$tm
"
);
...
...
@@ -124,7 +131,10 @@ function item_tool($itmn, &$data) {
$log
.=
"使用了<span class=
\"
yellow
\"
>
$itm
</span>。<br>突然刮起了一阵怪风,将遍布全场的
{
$cnum
}
具尸体吹到了你所在的地方!<br>"
;
$rp
+=
diceroll
(
1024
);
$log
.=
"<span class=
\"
lime
\"
>这过于惨无人道了!</span><br>你觉得罪恶感爬上了你的脊梁!<br>"
;
$itms
--
;
$isk
=
$cnum
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
$isk
=
$cnum
;
}
elseif
(
$itm
==
'天候棒'
)
{
if
(
$weather
<=
13
)
{
$weather
=
rand
(
10
,
13
);
...
...
@@ -136,14 +146,18 @@ function item_tool($itmn, &$data) {
addnews
(
$now
,
'wthfail'
,
$name
,
$weather
,
$nick
);
$log
.=
"你转动了几下天候棒。<br>但天气并未发生改变!<br>"
;
}
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
}
elseif
(
$itm
==
'消音器'
)
{
if
(
strpos
(
$wepk
,
'WG'
)
!==
0
)
{
$log
.=
'你没有装备枪械,不能使用消音器。<br>'
;
}
elseif
(
strpos
(
$wepsk
,
'S'
)
===
false
)
{
$wepsk
.=
'S'
;
$log
.=
"你给<span class=
\"
yellow
\"
>
$wep
</span>安装了<span class=
\"
yellow
\"
>
$itm
</span>。<br>"
;
if
(
$itms
!=
$nosta
)
{
$itms
--
;
}
}
else
{
$log
.=
"你的武器已经安装了消音器。<br>"
;
}
...
...
include/game/item.weather.php
View file @
31b2f0c9
...
...
@@ -17,10 +17,12 @@ function item_weather($itmn, &$data) {
include_once
GAME_ROOT
.
'./include/game/item2.func.php'
;
wthchange
(
$itm
,
$itmsk
);
if
(
$itms
!=
$nosta
)
{
$itms
--
;
if
(
$itms
<=
0
)
{
$log
.=
"<span class=
\"
red
\"
>
$itm
</span>用光了。<br>"
;
$itm
=
$itmk
=
$itmsk
=
''
;
$itme
=
$itms
=
0
;
}
}
}
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