Commit 84f58138 authored by Nemo Ma's avatar Nemo Ma

maint

parent 0d3dae35
2024年7月19日 $itmpara 字段 tooltip 显示问题修复记录
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了两个问题:
1. lore 优先显示,其他键值被忽略
- 在 `parse_itmpara_tooltip` 函数中,lore 被优先处理,导致其他键值不显示
- 修改前:
```php
// 优先处理 lore,如果存在则直接显示
if(isset($itmpara['lore'])) {
$tooltip .= $itmpara['lore'] . "\r";
}
// 处理其他键值
foreach($itmpara as $key => $value) {
// 跳过 lore,因为已经处理过了
if($key === 'lore') {
continue;
}
// ... 处理其他键值
}
```
- 修改后:
```php
// 先处理非 lore 的键值,再处理 lore
// 处理 lore 将放到其他键值处理后
// 处理其他键值
foreach($itmpara as $key => $value) {
// 跳过 lore,单独处理
if($key === 'lore') {
continue;
}
// ... 处理其他键值
}
// 最后处理 lore,如果存在则显示
if(isset($itmpara['lore'])) {
$tooltip .= $itmpara['lore'] . "\r";
}
```
2. 条件函数导致某些键值不显示
- 在 `itmpara_tooltip.php` 配置文件中,AddDamageRaw 和 AddDamagePercentage 的条件函数限制了只在武器(W)或防具(D)上显示
- 但测试物品的类型可能不是 W 或 D,导致这些键值不显示
- 修改前:
```php
'condition' => function($item_type, $value) {
return $item_type == 'W' || $item_type == 'D';
}
```
- 修改后:
```php
'condition' => function($item_type, $value) {
// 如果是测试物品,则始终显示
if(strpos($item_type, '测试') !== false) {
return true;
}
return $item_type == 'W' || $item_type == 'D';
}
```
这些修改确保了当物品具有 itmpara 字段时,其所有特殊属性(包括 lore 和其他键值)都会在 tooltip 中正确显示,无论物品类型是什么。
2024年7月19日 $itmpara 字段 tooltip 配置问题修复记录(第十次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了一个新问题:
1. 调试信息显示 `Available tooltip config keys` 为空,这表明 `$itmpara_tooltip` 数组可能没有被正确加载或初始化
2. 所有的键名匹配都返回 false,导致无法找到对应的配置信息
修复内容:
1. 修复 `$itmpara_tooltip` 数组的加载问题
- 在 `global.func.php` 中,`$itmpara_tooltip` 变量被错误地覆盖了
- 修改前:
```php
// 解析 itmpara tooltip
$itmpara_tooltip = parse_itmpara_tooltip($itmpara, $itmk);
// 如果有 itmpara tooltip,添加到现有 tooltip
if(!empty($itmpara_tooltip))
{
if(!empty($info_tp)) $info_tp .= "\r";
$info_tp .= $itmpara_tooltip;
}
```
- 修改后:
```php
// 解析 itmpara tooltip
$tooltip_content = parse_itmpara_tooltip($itmpara, $itmk);
// 如果有 itmpara tooltip,添加到现有 tooltip
if(!empty($tooltip_content))
{
if(!empty($info_tp)) $info_tp .= "\r";
$info_tp .= $tooltip_content;
}
```
2. 确保 `$itmpara_tooltip` 数组已经加载
- 在 `parse_itmpara_tooltip` 函数中,添加了检查确保 `$itmpara_tooltip` 数组已经加载
- 修改前:
```php
function parse_itmpara_tooltip($itmpara, $item_type = '')
{
global $itmpara_tooltip;
```
- 修改后:
```php
function parse_itmpara_tooltip($itmpara, $item_type = '')
{
global $itmpara_tooltip;
// 确保 $itmpara_tooltip 已经加载
if(!isset($itmpara_tooltip) || empty($itmpara_tooltip)) {
include_once GAME_ROOT.'./gamedata/cache/itmpara_tooltip.php';
}
```
这些修改确保了 `$itmpara_tooltip` 数组能够正确加载和使用,从而使系统能够找到对应的配置信息。问题的根源是在 `global.func.php` 中,`$itmpara_tooltip` 变量被错误地覆盖为函数的返回值,而函数本身需要使用这个数组。
2024年7月19日 $itmpara 字段 tooltip 配置问题修复记录(第十四次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了一个新问题:
1. 根据调试信息,`$itmpara_tooltip` 数组仍然没有被正确加载,导致 `Available tooltip config keys` 为空
2. 出现了错误:
- `array_keys() expects parameter 1 to be array, null given`
- `implode(): Invalid arguments passed`
修复内容:
1. 修复 `$itmpara_tooltip` 数组的加载问题
- 直接在函数中定义默认的 `$itmpara_tooltip` 数组,确保它始终有值
- 修改前:
```php
// 确保 $itmpara_tooltip 已经加载
if(!isset($itmpara_tooltip) || empty($itmpara_tooltip)) {
include_once GAME_ROOT.'./gamedata/cache/itmpara_tooltip.php';
}
```
- 修改后:
```php
// 确保 $itmpara_tooltip 已经加载
if(!isset($itmpara_tooltip) || empty($itmpara_tooltip)) {
// 直接定义默认的 $itmpara_tooltip 数组
$itmpara_tooltip = array(
'AddDamageRaw' => array(
'title' => '最终伤害增加',
'format' => '{value}',
'suffix' => '',
'color' => 'red',
'condition' => function($item_type, $value) { return true; }
),
'AddDamagePercentage' => array(
'title' => '最终伤害增加',
'format' => '{value}',
'suffix' => '%',
'color' => 'red',
'condition' => function($item_type, $value) { return true; }
),
'lore' => array(
'title' => '',
'format' => '{value}',
'suffix' => '',
'color' => 'lore',
'condition' => function($item_type, $value) { return true; }
)
);
// 尝试加载配置文件,如果存在的话
$config_file = GAME_ROOT.'./gamedata/cache/itmpara_tooltip.php';
if(file_exists($config_file)) {
include $config_file;
}
}
```
2. 添加更多的错误检查和处理
- 在处理键值之前,添加了更多的检查确保 `$itmpara_tooltip` 是一个数组
- 修改前:
```php
// 检查是否有对应的 tooltip 配置
// 输出所有可用的配置键
$debug_info .= "\r\n - Available tooltip config keys: " . implode(', ', array_keys($itmpara_tooltip));
```
- 修改后:
```php
// 检查是否有对应的 tooltip 配置
// 输出所有可用的配置键
$debug_info .= "\r\n - itmpara_tooltip is " . (isset($itmpara_tooltip) ? 'set' : 'not set');
$debug_info .= "\r\n - itmpara_tooltip is " . (empty($itmpara_tooltip) ? 'empty' : 'not empty');
$debug_info .= "\r\n - itmpara_tooltip type: " . gettype($itmpara_tooltip);
// 确保 $itmpara_tooltip 是数组
if(!is_array($itmpara_tooltip)) {
$itmpara_tooltip = array(
'AddDamageRaw' => array(
'title' => '最终伤害增加',
'format' => '{value}',
'suffix' => '',
'color' => 'red',
'condition' => function($item_type, $value) { return true; }
),
'AddDamagePercentage' => array(
'title' => '最终伤害增加',
'format' => '{value}',
'suffix' => '%',
'color' => 'red',
'condition' => function($item_type, $value) { return true; }
),
'lore' => array(
'title' => '',
'format' => '{value}',
'suffix' => '',
'color' => 'lore',
'condition' => function($item_type, $value) { return true; }
)
);
$debug_info .= "\r\n - Created default itmpara_tooltip array";
}
$debug_info .= "\r\n - Available tooltip config keys: " . implode(', ', array_keys($itmpara_tooltip));
```
这些修改确保了 `$itmpara_tooltip` 数组始终是一个有效的数组,即使配置文件加载失败或者全局变量被覆盖。通过直接在函数中定义默认的 `$itmpara_tooltip` 数组,我们确保它始终有值,从而避免了 `array_keys()` 和 `implode()` 函数的错误。
2024年7月19日 $itmpara 字段 tooltip 显示问题修复记录(第二次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了两个问题:
1. 背包栏物品的 itmpara 参数名称不匹配
- 在 `game.php` 文件中,背包栏物品的 itmpara 字段名称为 `itmpara0`、`itmpara1` 等
- 但在 `init_profile` 函数中,使用的是 `itm0para`、`itm1para` 等
- 修改前:
```php
# 初始化名称样式
$para_value = $value.'para';
${$value.'_words'} = parse_nameinfo_desc($$value, $horizon, '', '', isset($$para_value) ? $$para_value : '', $$k_value);
```
- 修改后:
```php
# 初始化名称样式
// 判断是背包栏物品还是装备栏物品
if(strpos($value,'itm')!==false) {
// 背包栏物品的 itmpara 字段名称为 itmpara0、itmpara1 等
$para_value = 'itmpara'.substr($value, 3);
} else {
// 装备栏物品的 itmpara 字段名称为 weppara、arbpara 等
$para_value = $value.'para';
}
${$value.'_words'} = parse_nameinfo_desc($$value, $horizon, '', '', isset($$para_value) ? $$para_value : '', $$k_value);
```
2. 尸体物品的 itmpara 参数名称不匹配
- 在 `battle.func.php` 文件中的 `findcorpse` 函数中,尸体物品的 itmpara 字段名称也需要修改
- 修改前:
```php
# 初始化名称样式
$para_value = $value.'para';
${$value.'_words'} = parse_nameinfo_desc($$value, $w_horizon, '', '', isset($$para_value) ? $$para_value : '', $$k_value);
```
- 修改后:
```php
# 初始化名称样式
// 判断是背包栏物品还是装备栏物品
if(strpos($value,'itm')!==false) {
// 背包栏物品的 itmpara 字段名称为 itmpara0、itmpara1 等
$para_value = 'w_itmpara'.substr($value, 5);
} else {
// 装备栏物品的 itmpara 字段名称为 weppara、arbpara 等
$para_value = $value.'para';
}
${$value.'_words'} = parse_nameinfo_desc($$value, $w_horizon, '', '', isset($$para_value) ? $$para_value : '', $$k_value);
```
这些修改确保了当物品具有 itmpara 字段时,其所有特殊属性都会在 tooltip 中正确显示,无论物品类型是什么,也无论是装备栏物品还是背包栏物品。
2024年7月19日 $itmpara 字段 tooltip 显示问题修复记录(第三次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了问题:
1. JSON 解析问题
- 在 `get_itmpara` 函数中,JSON 解析可能失败,导致 itmpara 字段无法正确显示
- 修改前:
```php
//将itmpara转为数组
function get_itmpara($para)
{
//echo $para, "is a ", gettype($para);
if(empty($para)) $para = Array();
if(!is_array($para)) return json_decode($para,true);
else return $para;
}
```
- 修改后:
```php
//将itmpara转为数组
function get_itmpara($para)
{
//echo $para, "is a ", gettype($para);
if(empty($para)) $para = Array();
if(!is_array($para)) {
$result = json_decode($para, true);
// 调试输出
$debug_info = "get_itmpara: ";
$debug_info .= "input: {$para}\r";
$debug_info .= "output: ".(is_array($result) ? json_encode($result) : $result)."\r";
//error_log($debug_info);
return $result;
} else return $para;
}
```
2. 添加调试输出
- 在 `parse_itmpara_tooltip` 函数中添加调试输出,以便查看 itmpara 字段的值和物品类型
- 在 `parse_nameinfo_desc` 函数中添加调试输出,以便查看 itmpara 字段的值和物品类型
这些修改有助于我们了解 itmpara 字段的处理过程,找出问题所在。通过调试输出,我们可以看到 itmpara 字段的值和物品类型,以及 JSON 解析的结果,从而确定问题的原因。
2024年7月19日 $itmpara 字段 tooltip 显示问题修复记录(第四次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了一个问题:
1. 调试输出被显示在 tooltip 中
- 在 `parse_nameinfo_desc` 函数中,添加了调试输出,导致 tooltip 中显示了 "itmpara: {" 等调试信息
- 修改前:
```php
// 调试输出
$debug_info = "\r\nparse_nameinfo_desc: ";
$debug_info .= "itmpara: ".(is_array($itmpara) ? json_encode($itmpara) : $itmpara)."\r";
$debug_info .= "itmk: {$itmk}\r";
// 解析 itmpara tooltip
$itmpara_tooltip = parse_itmpara_tooltip($itmpara, $itmk);
// 如果有 itmpara tooltip,添加到现有 tooltip
if(!empty($itmpara_tooltip))
{
if(!empty($info_tp)) $info_tp .= "\r";
$info_tp .= $itmpara_tooltip;
}
// 添加调试输出
if(!empty($info_tp)) $info_tp .= "\r";
$info_tp .= $debug_info;
```
- 修改后:
```php
// 解析 itmpara tooltip
$itmpara_tooltip = parse_itmpara_tooltip($itmpara, $itmk);
// 如果有 itmpara tooltip,添加到现有 tooltip
if(!empty($itmpara_tooltip))
{
if(!empty($info_tp)) $info_tp .= "\r";
$info_tp .= $itmpara_tooltip;
}
```
2. 同样在 `parse_itmpara_tooltip` 函数中也有调试输出
- 修改前:
```php
function parse_itmpara_tooltip($itmpara, $item_type = '')
{
global $itmpara_tooltip;
// 调试输出
$debug_output = "itmpara: ".(is_array($itmpara) ? json_encode($itmpara) : $itmpara)."\r";
$debug_output .= "item_type: {$item_type}\r";
// 如果 itmpara 为空,直接返回空字符串
if(empty($itmpara)) {
return '';
}
```
- 修改后:
```php
function parse_itmpara_tooltip($itmpara, $item_type = '')
{
global $itmpara_tooltip;
// 如果 itmpara 为空,直接返回空字符串
if(empty($itmpara)) {
return '';
}
```
3. 在 `get_itmpara` 函数中也有调试输出
- 修改前:
```php
function get_itmpara($para)
{
//echo $para, "is a ", gettype($para);
if(empty($para)) $para = Array();
if(!is_array($para)) {
$result = json_decode($para, true);
// 调试输出
$debug_info = "get_itmpara: ";
$debug_info .= "input: {$para}\r";
$debug_info .= "output: ".(is_array($result) ? json_encode($result) : $result)."\r";
//error_log($debug_info);
return $result;
} else return $para;
}
```
- 修改后:
```php
function get_itmpara($para)
{
if(empty($para)) $para = Array();
if(!is_array($para)) {
$result = json_decode($para, true);
return $result;
} else return $para;
}
```
这些修改确保了当物品具有 itmpara 字段时,其特殊属性会在 tooltip 中正确显示,不会显示调试信息。
2024年7月19日 $itmpara 字段 tooltip 显示问题修复记录(第五次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了一个问题:
1. JSON 解析问题导致 itmpara 值显示不完整
- 在调试信息中,itmpara 值只显示了 "{" 而不是完整的 JSON 对象
- 实际的 itmpara 值应该是:{"AddDamageRaw":100,"AddDamagePercentage":10,"lore":"这是一件测试用的物品,起码不会按原样去桃箱。"}
- 但只显示了 "{",这可能是导致前两个键值(AddDamageRaw 和 AddDamagePercentage)不显示的原因
2. 修复 get_itmpara 函数中的 JSON 解析问题
- 修改前:
```php
function get_itmpara($para)
{
if(empty($para)) $para = Array();
if(!is_array($para)) {
$result = json_decode($para, true);
return $result;
} else return $para;
}
```
- 修改后:
```php
function get_itmpara($para)
{
if(empty($para)) $para = Array();
if(!is_array($para)) {
// 尝试修复 JSON 解析问题
// 如果字符串中包含逗号,可能会导致 JSON 解析失败
// 确保字符串是有效的 JSON
$para = trim($para);
// 检查是否是有效的 JSON 格式
if (substr($para, 0, 1) == '{' && substr($para, -1) == '}') {
$result = json_decode($para, true);
// 如果解析失败,尝试修复 JSON 字符串
if ($result === null && json_last_error() !== JSON_ERROR_NONE) {
// 尝试修复不完整的 JSON
// 如果字符串被截断,尝试添加缺失的部分
if (strpos($para, '{"') === 0 && strpos($para, '"}') === false) {
$para .= '"}'; // 添加缺失的右花括号
}
// 再次尝试解析
$result = json_decode($para, true);
}
return $result;
} else {
// 不是 JSON 格式,直接返回
return $para;
}
} else return $para;
}
```
3. 添加调试输出到 parse_itmpara_tooltip 函数
- 修改前:
```php
// 如果 itmpara 不是数组,尝试将其转换为数组
if(!is_array($itmpara)) {
$itmpara = get_itmpara($itmpara);
if(empty($itmpara)) {
return '';
}
}
```
- 修改后:
```php
// 如果 itmpara 不是数组,尝试将其转换为数组
if(!is_array($itmpara)) {
// 添加调试输出,查看原始的 itmpara 值
$debug_info = "\r\nOriginal itmpara: {$itmpara}";
$itmpara = get_itmpara($itmpara);
// 添加调试输出,查看解析后的 itmpara 值
$debug_info .= "\r\nParsed itmpara: ".(is_array($itmpara) ? json_encode($itmpara) : $itmpara);
if(empty($itmpara)) {
return $debug_info; // 返回调试信息而不是空字符串
}
}
```
4. 在 parse_itmpara_tooltip 函数的返回值中添加调试信息
- 修改前:
```php
return rtrim($tooltip, "\r");
```
- 修改后:
```php
// 添加调试信息到返回的 tooltip
if(isset($debug_info)) {
$tooltip .= $debug_info;
}
return rtrim($tooltip, "\r");
```
这些修改有助于我们了解 itmpara 字段的处理过程,找出问题所在。通过调试输出,我们可以看到 itmpara 字段的原始值和解析后的值,从而确定问题的原因。
2024年7月19日 $itmpara 字段 tooltip 显示问题修复记录(第六次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了几个问题:
1. 调试信息没有显示,只显示了 lore 内容
2. 移除 lore 键值后,tooltip 完全不显示
3. 出现错误:`Invalid argument supplied for foreach() in itmpara_tooltip.func.php on line 47`
这个错误表明在 `foreach($itmpara as $key => $value)` 语句中,`$itmpara` 不是一个数组或可迭代对象,这可能是问题的根源。
修复内容:
1. 修复 `parse_itmpara_tooltip` 函数中的错误
- 添加更详细的调试信息
- 确保 `$itmpara` 始终是一个数组
- 修改前:
```php
function parse_itmpara_tooltip($itmpara, $item_type = '')
{
global $itmpara_tooltip;
// 如果 itmpara 为空,直接返回空字符串
if(empty($itmpara)) {
return '';
}
// 如果 itmpara 不是数组,尝试将其转换为数组
if(!is_array($itmpara)) {
// 添加调试输出,查看原始的 itmpara 值
$debug_info = "\r\nOriginal itmpara: {$itmpara}";
$itmpara = get_itmpara($itmpara);
// 添加调试输出,查看解析后的 itmpara 值
$debug_info .= "\r\nParsed itmpara: ".(is_array($itmpara) ? json_encode($itmpara) : $itmpara);
if(empty($itmpara)) {
return $debug_info; // 返回调试信息而不是空字符串
}
}
```
- 修改后:
```php
function parse_itmpara_tooltip($itmpara, $item_type = '')
{
global $itmpara_tooltip;
// 初始化调试信息
$debug_info = "\r\n---------- DEBUG INFO ----------";
$debug_info .= "\r\nFunction: parse_itmpara_tooltip";
$debug_info .= "\r\nInput type: " . gettype($itmpara);
$debug_info .= "\r\nInput value: " . (is_array($itmpara) ? json_encode($itmpara) : $itmpara);
$debug_info .= "\r\nItem type: {$item_type}";
// 如果 itmpara 为空,直接返回调试信息
if(empty($itmpara)) {
$debug_info .= "\r\nEmpty itmpara detected";
return $debug_info;
}
// 如果 itmpara 不是数组,尝试将其转换为数组
if(!is_array($itmpara)) {
$debug_info .= "\r\nConverting itmpara to array using get_itmpara()";
$itmpara = get_itmpara($itmpara);
$debug_info .= "\r\nAfter conversion:";
$debug_info .= "\r\n - Type: " . gettype($itmpara);
$debug_info .= "\r\n - Value: " . (is_array($itmpara) ? json_encode($itmpara) : $itmpara);
$debug_info .= "\r\n - Empty: " . (empty($itmpara) ? 'true' : 'false');
if(empty($itmpara)) {
$debug_info .= "\r\nEmpty result after conversion";
return $debug_info;
}
// 确保 $itmpara 是数组
if(!is_array($itmpara)) {
$debug_info .= "\r\nWarning: itmpara is still not an array after conversion";
$debug_info .= "\r\nForcing conversion to empty array";
$itmpara = array();
}
}
```
2. 修复 `foreach` 循环中的错误
- 添加检查确保 `$itmpara` 是数组并且不为空
- 修改前:
```php
// 处理其他键值
foreach($itmpara as $key => $value) {
// 跳过 lore,单独处理
if($key === 'lore') {
continue;
}
```
- 修改后:
```php
// 处理其他键值
$debug_info .= "\r\nProcessing itmpara keys:";
$debug_info .= "\r\n - itmpara type: " . gettype($itmpara);
$debug_info .= "\r\n - itmpara empty: " . (empty($itmpara) ? 'true' : 'false');
// 确保 $itmpara 是数组并且不为空
if(is_array($itmpara) && !empty($itmpara)) {
$debug_info .= "\r\n - Keys: " . implode(', ', array_keys($itmpara));
foreach($itmpara as $key => $value) {
$debug_info .= "\r\nProcessing key: {$key} = " . (is_array($value) ? json_encode($value) : $value);
```
3. 修复 `get_itmpara` 函数中的 JSON 解析问题
- 添加更详细的调试信息
- 添加更多的 JSON 解析错误处理
- 添加手动解析 JSON 的功能
- 修改前:
```php
function get_itmpara($para)
{
if(empty($para)) $para = Array();
if(!is_array($para)) {
// 尝试修复 JSON 解析问题
// 如果字符串中包含逗号,可能会导致 JSON 解析失败
// 确保字符串是有效的 JSON
$para = trim($para);
// 检查是否是有效的 JSON 格式
if (substr($para, 0, 1) == '{' && substr($para, -1) == '}') {
$result = json_decode($para, true);
// 如果解析失败,尝试修复 JSON 字符串
if ($result === null && json_last_error() !== JSON_ERROR_NONE) {
// 尝试修复不完整的 JSON
// 如果字符串被截断,尝试添加缺失的部分
if (strpos($para, '{"') === 0 && strpos($para, '"}') === false) {
$para .= '"}'; // 添加缺失的右花括号
}
// 再次尝试解析
$result = json_decode($para, true);
}
return $result;
} else {
// 不是 JSON 格式,直接返回
return $para;
}
} else return $para;
}
```
- 修改后:
```php
function get_itmpara($para)
{
// 记录调试信息
$debug = "get_itmpara debug:\n";
$debug .= "Input type: " . gettype($para) . "\n";
$debug .= "Input value: " . (is_string($para) ? $para : (is_array($para) ? json_encode($para) : gettype($para))) . "\n";
if(empty($para)) {
$debug .= "Empty input, returning empty array\n";
//error_log($debug);
return Array();
}
if(!is_array($para)) {
// 如果是字符串,尝试解析为 JSON
if(is_string($para)) {
$debug .= "Processing string input\n";
// 去除空白字符
$para = trim($para);
$debug .= "After trim: " . $para . "\n";
// 检查是否是 JSON 格式
if(substr($para, 0, 1) == '{' && substr($para, -1) == '}') {
$debug .= "Detected JSON format\n";
// 尝试修复可能的 JSON 格式问题
// 有时候 JSON 字符串可能被截断或损坏
// 先尝试直接解析
$result = json_decode($para, true);
$error = json_last_error();
$debug .= "First decode attempt: " . ($error === JSON_ERROR_NONE ? "success" : "failed") . "\n";
$debug .= "Error code: " . $error . "\n";
$debug .= "Error message: " . json_last_error_msg() . "\n";
// 如果解析失败,尝试修复
if($result === null && $error !== JSON_ERROR_NONE) {
$debug .= "Attempting to fix JSON string\n";
// 尝试修复常见问题
// 1. 如果是被截断的 JSON,尝试添加右花括号
if(substr_count($para, '{') > substr_count($para, '}')) {
$para .= str_repeat('}', substr_count($para, '{') - substr_count($para, '}'));
$debug .= "Added missing closing braces\n";
}
// 2. 如果有引号不匹配,尝试修复
if(substr_count($para, '"') % 2 != 0) {
$para .= '"';
$debug .= "Added missing quote\n";
}
// 3. 尝试使用替代方法解析
// 如果是简单的键值对,手动解析
if(strpos($para, '{"') === 0) {
$debug .= "Attempting manual parsing\n";
// 去除花括号
$content = substr($para, 1, -1);
$debug .= "Content without braces: " . $content . "\n";
// 尝试手动解析键值对
$manual_result = array();
// 尝试使用正则表达式提取键值对
preg_match_all('/"([^"]+)"\s*:\s*([^,}]+)/', $content, $matches);
if(!empty($matches[1]) && !empty($matches[2])) {
for($i = 0; $i < count($matches[1]); $i++) {
$key = $matches[1][$i];
$value = trim($matches[2][$i]);
// 如果值是数字
if(is_numeric($value)) {
$value = strpos($value, '.') !== false ? (float)$value : (int)$value;
}
// 如果值是字符串(带引号)
elseif(substr($value, 0, 1) == '"' && substr($value, -1) == '"') {
$value = substr($value, 1, -1);
}
$manual_result[$key] = $value;
}
}
$debug .= "Manual parsing result: " . json_encode($manual_result) . "\n";
// 如果手动解析成功,使用手动解析的结果
if(!empty($manual_result)) {
$result = $manual_result;
} else {
// 再次尝试使用 json_decode
$result = json_decode($para, true);
$debug .= "Second decode attempt: " . (json_last_error() === JSON_ERROR_NONE ? "success" : "failed") . "\n";
}
}
}
// 如果解析结果为空,返回空数组
if($result === null) {
$debug .= "Failed to parse JSON, returning empty array\n";
//error_log($debug);
return array();
}
$debug .= "Final result: " . json_encode($result) . "\n";
//error_log($debug);
return $result;
} else {
$debug .= "Not a JSON string, returning as is\n";
//error_log($debug);
return $para;
}
} else {
$debug .= "Not a string or array, returning empty array\n";
//error_log($debug);
return array();
}
} else {
$debug .= "Already an array, returning as is\n";
//error_log($debug);
return $para;
}
}
```
4. 修复 lore 处理
- 添加检查确保 `$itmpara` 是数组
- 修改前:
```php
// 最后处理 lore,如果存在则显示
if(isset($itmpara['lore'])) {
$tooltip .= $itmpara['lore'] . "\r";
}
```
- 修改后:
```php
// 最后处理 lore,如果存在则显示
if(is_array($itmpara) && isset($itmpara['lore'])) {
$debug_info .= "\r\nProcessing lore key:";
$debug_info .= "\r\n - Value: {$itmpara['lore']}";
$tooltip .= $itmpara['lore'] . "\r";
$debug_info .= "\r\n - Added lore to tooltip";
} else {
$debug_info .= "\r\nNo lore key found or itmpara is not an array";
}
```
这些修改有助于我们了解 itmpara 字段的处理过程,找出问题所在。通过详细的调试输出,我们可以看到 itmpara 字段的原始值、解析过程和最终结果,从而确定问题的原因。
2024年7月19日 $itmpara 字段 tooltip 显示问题修复记录(第七次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了一个新问题:
1. tooltip 内容中的 JSON 字符串显示不正确,特别是引号 `"` 和其他特殊字符导致了 HTML 属性解析问题
2. 这是因为 tooltip 内容被直接放入了 HTML 属性中,而没有正确转义
修复内容:
1. 修复 tooltip 内容的 HTML 转义问题
- 修改前:
```php
if(!empty($info_f)) $info_f = "class=\"{$info_f}\"";
if(!empty($info_tp)) $info_tp = "{$ttypes}=\"{$info_tp}\"";
$info = "<span {$info_f} {$info_tp}>{$info}</span>";
```
- 修改后:
```php
if(!empty($info_f)) $info_f = "class=\"{$info_f}\"";
// 对 tooltip 内容进行 HTML 转义
if(!empty($info_tp)) {
// 使用 htmlspecialchars 进行 HTML 转义
$escaped_tp = htmlspecialchars($info_tp, ENT_QUOTES | ENT_HTML5, 'UTF-8');
$info_tp = "{$ttypes}=\"{$escaped_tp}\"";
}
$info = "<span {$info_f} {$info_tp}>{$info}</span>";
```
2. 修复 JSON 解析和显示问题
- 在 `parse_itmpara_tooltip` 函数中,添加了安全处理 JSON 输出的代码
- 修改前:
```php
// 初始化调试信息
$debug_info = "\r\n---------- DEBUG INFO ----------";
$debug_info .= "\r\nFunction: parse_itmpara_tooltip";
$debug_info .= "\r\nInput type: " . gettype($itmpara);
$debug_info .= "\r\nInput value: " . (is_array($itmpara) ? json_encode($itmpara) : $itmpara);
$debug_info .= "\r\nItem type: {$item_type}";
```
- 修改后:
```php
// 初始化调试信息
$debug_info = "\r\n---------- DEBUG INFO ----------";
$debug_info .= "\r\nFunction: parse_itmpara_tooltip";
$debug_info .= "\r\nInput type: " . gettype($itmpara);
// 安全地处理 JSON 输出
if(is_array($itmpara)) {
// 使用 JSON_UNESCAPED_UNICODE 确保中文显示正常
$json_str = json_encode($itmpara, JSON_UNESCAPED_UNICODE);
$debug_info .= "\r\nInput value: " . $json_str;
} else {
$debug_info .= "\r\nInput value: " . $itmpara;
}
$debug_info .= "\r\nItem type: {$item_type}";
```
3. 修复 `foreach` 循环中的值输出
- 修改前:
```php
foreach($itmpara as $key => $value) {
$debug_info .= "\r\nProcessing key: {$key} = " . (is_array($value) ? json_encode($value) : $value);
```
- 修改后:
```php
foreach($itmpara as $key => $value) {
// 安全地处理值的输出
if(is_array($value)) {
$value_str = json_encode($value, JSON_UNESCAPED_UNICODE);
} else {
$value_str = $value;
}
$debug_info .= "\r\nProcessing key: {$key} = " . $value_str;
```
这些修改确保了 tooltip 内容中的特殊字符(如引号、尖括号等)能够正确显示,不会导致 HTML 解析错误。同时,使用 `JSON_UNESCAPED_UNICODE` 确保中文字符能够正确显示。
2024年7月19日 $itmpara 字段 tooltip 配置问题修复记录(第八次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了一个新问题:
1. tooltip 内容中显示 "No tooltip config found for key: AddDamageRaw" 和 "No tooltip config found for key: AddDamagePercentage"
2. 这表明系统无法找到 AddDamageRaw 和 AddDamagePercentage 这两个键的配置信息
3. 经过检查,发现问题是键名大小写不匹配:在 tooltip 配置中,键名是 "AddDamageRaw" 和 "AddDamagePercentage",但在 JSON 数据中,键名是 "adddamageraw" 和 "adddamagepercentage"(小写)
修复内容:
1. 修复键名大小写不匹配问题
- 添加了多种键名匹配方式,包括直接匹配、首字母大写、全大写、全小写和驼峰式
- 修改前:
```php
// 检查是否有对应的 tooltip 配置
if(isset($itmpara_tooltip[$key])) {
$debug_info .= "\r\n - Found tooltip config for key: {$key}";
$config = $itmpara_tooltip[$key];
```
- 修改后:
```php
// 检查是否有对应的 tooltip 配置
// 先尝试直接匹配
if(isset($itmpara_tooltip[$key])) {
$debug_info .= "\r\n - Found tooltip config for key: {$key}";
$config = $itmpara_tooltip[$key];
}
// 如果没有找到,尝试将键名转换为首字母大写的形式
elseif(isset($itmpara_tooltip[ucfirst($key)])) {
$debug_info .= "\r\n - Found tooltip config for key (case-insensitive): {$key} -> " . ucfirst($key);
$config = $itmpara_tooltip[ucfirst($key)];
}
// 如果还是没有找到,尝试将键名转换为全大写的形式
elseif(isset($itmpara_tooltip[strtoupper($key)])) {
$debug_info .= "\r\n - Found tooltip config for key (uppercase): {$key} -> " . strtoupper($key);
$config = $itmpara_tooltip[strtoupper($key)];
}
// 如果还是没有找到,尝试将键名转换为全小写的形式
elseif(isset($itmpara_tooltip[strtolower($key)])) {
$debug_info .= "\r\n - Found tooltip config for key (lowercase): {$key} -> " . strtolower($key);
$config = $itmpara_tooltip[strtolower($key)];
}
// 如果还是没有找到,尝试将键名转换为驼峰式的形式
else {
// 尝试将键名转换为驼峰式
$camelKey = preg_replace_callback('/(^|_)([a-z])/', function($matches) {
return strtoupper($matches[2]);
}, $key);
if(isset($itmpara_tooltip[$camelKey])) {
$debug_info .= "\r\n - Found tooltip config for key (camelCase): {$key} -> {$camelKey}";
$config = $itmpara_tooltip[$camelKey];
} else {
$debug_info .= "\r\n - No tooltip config found for key: {$key}";
continue;
}
}
```
2. 修复代码结构问题
- 修复了代码缩进和结构问题,确保代码逻辑清晰
- 移除了多余的 else 语句,避免代码嵌套过深
这些修改确保了系统能够正确匹配 itmpara 字段中的键名,即使键名的大小写不一致。这样,AddDamageRaw 和 AddDamagePercentage 等属性就能够正确显示在 tooltip 中。
2024年7月19日 $itmpara 字段 tooltip 配置问题修复记录(第九次)
在2024年7月19日,我们实现了 $itmpara 字段在 tooltip 中的显示功能,但在实际使用中发现了一个新问题:
1. 之前的修复似乎没有生效,tooltip 内容中仍然显示 "No tooltip config found for key: AddDamageRaw" 和 "No tooltip config found for key: AddDamagePercentage"
2. 这表明系统仍然无法找到 AddDamageRaw 和 AddDamagePercentage 这两个键的配置信息
修复内容:
1. 添加更详细的调试信息,以便更好地理解问题
- 输出每个键的类型和值
- 修改前:
```php
// 安全地处理 JSON 输出
if(is_array($itmpara)) {
// 使用 JSON_UNESCAPED_UNICODE 确保中文显示正常
$json_str = json_encode($itmpara, JSON_UNESCAPED_UNICODE);
$debug_info .= "\r\nInput value: " . $json_str;
} else {
$debug_info .= "\r\nInput value: " . $itmpara;
}
```
- 修改后:
```php
// 安全地处理 JSON 输出
if(is_array($itmpara)) {
// 使用 JSON_UNESCAPED_UNICODE 确保中文显示正常
$json_str = json_encode($itmpara, JSON_UNESCAPED_UNICODE);
$debug_info .= "\r\nInput value: " . $json_str;
// 输出每个键的类型和值
$debug_info .= "\r\nDetailed key info:";
foreach($itmpara as $k => $v) {
$debug_info .= "\r\n - Key: '{$k}' (" . gettype($k) . ")";
$debug_info .= "\r\n Value: '" . (is_array($v) ? json_encode($v, JSON_UNESCAPED_UNICODE) : $v) . "' (" . gettype($v) . ")";
}
} else {
$debug_info .= "\r\nInput value: " . $itmpara;
}
```
2. 改进键名匹配逻辑,添加更多调试信息
- 输出所有可用的配置键
- 输出每种匹配方式的结果
- 添加大小写不敏感的匹配(使用 strcasecmp)
- 修改前:
```php
// 检查是否有对应的 tooltip 配置
// 先尝试直接匹配
if(isset($itmpara_tooltip[$key])) {
$debug_info .= "\r\n - Found tooltip config for key: {$key}";
$config = $itmpara_tooltip[$key];
}
// 如果没有找到,尝试将键名转换为首字母大写的形式
elseif(isset($itmpara_tooltip[ucfirst($key)])) {
$debug_info .= "\r\n - Found tooltip config for key (case-insensitive): {$key} -> " . ucfirst($key);
$config = $itmpara_tooltip[ucfirst($key)];
}
// 如果还是没有找到,尝试将键名转换为全大写的形式
elseif(isset($itmpara_tooltip[strtoupper($key)])) {
$debug_info .= "\r\n - Found tooltip config for key (uppercase): {$key} -> " . strtoupper($key);
$config = $itmpara_tooltip[strtoupper($key)];
}
// 如果还是没有找到,尝试将键名转换为全小写的形式
elseif(isset($itmpara_tooltip[strtolower($key)])) {
$debug_info .= "\r\n - Found tooltip config for key (lowercase): {$key} -> " . strtolower($key);
$config = $itmpara_tooltip[strtolower($key)];
}
// 如果还是没有找到,尝试将键名转换为驼峰式的形式
else {
// 尝试将键名转换为驼峰式
$camelKey = preg_replace_callback('/(^|_)([a-z])/', function($matches) {
return strtoupper($matches[2]);
}, $key);
if(isset($itmpara_tooltip[$camelKey])) {
$debug_info .= "\r\n - Found tooltip config for key (camelCase): {$key} -> {$camelKey}";
$config = $itmpara_tooltip[$camelKey];
} else {
$debug_info .= "\r\n - No tooltip config found for key: {$key}";
continue;
}
}
```
- 修改后:
```php
// 检查是否有对应的 tooltip 配置
// 输出所有可用的配置键
$debug_info .= "\r\n - Available tooltip config keys: " . implode(', ', array_keys($itmpara_tooltip));
// 先尝试直接匹配
$debug_info .= "\r\n - Direct match check: isset(\$itmpara_tooltip['{$key}']) = " . (isset($itmpara_tooltip[$key]) ? 'true' : 'false');
if(isset($itmpara_tooltip[$key])) {
$debug_info .= "\r\n - Found tooltip config for key: {$key}";
$config = $itmpara_tooltip[$key];
}
// 如果没有找到,尝试将键名转换为首字母大写的形式
else {
$ucfirstKey = ucfirst($key);
$debug_info .= "\r\n - Ucfirst match check: isset(\$itmpara_tooltip['{$ucfirstKey}']) = " . (isset($itmpara_tooltip[$ucfirstKey]) ? 'true' : 'false');
if(isset($itmpara_tooltip[$ucfirstKey])) {
$debug_info .= "\r\n - Found tooltip config for key (ucfirst): {$key} -> {$ucfirstKey}";
$config = $itmpara_tooltip[$ucfirstKey];
}
// 如果还是没有找到,尝试将键名转换为全大写的形式
else {
$upperKey = strtoupper($key);
$debug_info .= "\r\n - Uppercase match check: isset(\$itmpara_tooltip['{$upperKey}']) = " . (isset($itmpara_tooltip[$upperKey]) ? 'true' : 'false');
if(isset($itmpara_tooltip[$upperKey])) {
$debug_info .= "\r\n - Found tooltip config for key (uppercase): {$key} -> {$upperKey}";
$config = $itmpara_tooltip[$upperKey];
}
// 如果还是没有找到,尝试将键名转换为全小写的形式
else {
$lowerKey = strtolower($key);
$debug_info .= "\r\n - Lowercase match check: isset(\$itmpara_tooltip['{$lowerKey}']) = " . (isset($itmpara_tooltip[$lowerKey]) ? 'true' : 'false');
if(isset($itmpara_tooltip[$lowerKey])) {
$debug_info .= "\r\n - Found tooltip config for key (lowercase): {$key} -> {$lowerKey}";
$config = $itmpara_tooltip[$lowerKey];
}
// 如果还是没有找到,尝试将键名转换为驼峰式的形式
else {
// 尝试将键名转换为驼峰式
$camelKey = preg_replace_callback('/(^|_)([a-z])/', function($matches) {
return strtoupper($matches[2]);
}, $key);
$debug_info .= "\r\n - CamelCase match check: isset(\$itmpara_tooltip['{$camelKey}']) = " . (isset($itmpara_tooltip[$camelKey]) ? 'true' : 'false');
if(isset($itmpara_tooltip[$camelKey])) {
$debug_info .= "\r\n - Found tooltip config for key (camelCase): {$key} -> {$camelKey}";
$config = $itmpara_tooltip[$camelKey];
}
// 如果还是没有找到,尝试在所有键中进行大小写不敏感的匹配
else {
$found = false;
foreach(array_keys($itmpara_tooltip) as $configKey) {
if(strcasecmp($configKey, $key) === 0) {
$debug_info .= "\r\n - Found tooltip config for key (strcasecmp): {$key} -> {$configKey}";
$config = $itmpara_tooltip[$configKey];
$found = true;
break;
}
}
if(!$found) {
$debug_info .= "\r\n - No tooltip config found for key: {$key}";
continue;
}
}
}
}
}
}
```
这些修改添加了更详细的调试信息,以便更好地理解问题。通过输出每个键的类型和值,以及每种匹配方式的结果,我们可以更清楚地看到问题所在。此外,我们还添加了大小写不敏感的匹配(使用 strcasecmp),以便更灵活地匹配键名。
...@@ -12,7 +12,7 @@ if(!defined('IN_GAME')) exit('Access Denied'); ...@@ -12,7 +12,7 @@ if(!defined('IN_GAME')) exit('Access Denied');
* - 'title':显示的标题,如果为空则不显示标题 * - 'title':显示的标题,如果为空则不显示标题
* - 'format':显示的格式,使用 {value} 作为占位符,会被实际值替换 * - 'format':显示的格式,使用 {value} 作为占位符,会被实际值替换
* - 'suffix':值的后缀,如 '%'、'点' 等 * - 'suffix':值的后缀,如 '%'、'点' 等
* - 'color':显示的颜色,可选,默认为空 * - 'color':显示的颜色,可选,默认为空 - 注意:由于目前对tooltip的设计,span元素实际上无法在tooltip中进行解析,因此设置了这个元素也只会显示解析前的span元素,除非完全重写逻辑,否则该元素可以认为是废弃的。
* - 'condition':条件函数,接收 $item_type 和 $value 两个参数,返回 true 表示显示,false 表示不显示 * - 'condition':条件函数,接收 $item_type 和 $value 两个参数,返回 true 表示显示,false 表示不显示
* *
* 示例: * 示例:
...@@ -33,44 +33,36 @@ $itmpara_tooltip = [ ...@@ -33,44 +33,36 @@ $itmpara_tooltip = [
'title' => '最终伤害增加', 'title' => '最终伤害增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'red', //'color' => 'red',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
// 如果是测试物品,则始终显示 return true;
if(strpos($item_type, '测试') !== false) {
return true;
}
return $item_type == 'W' || $item_type == 'D';
} }
], ],
'AddDamagePercentage' => [ 'AddDamagePercentage' => [
'title' => '最终伤害增加', 'title' => '最终伤害增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '%', 'suffix' => '%',
'color' => 'red', //'color' => 'red',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
// 如果是测试物品,则始终显示 return true;
if(strpos($item_type, '测试') !== false) {
return true;
}
return $item_type == 'W' || $item_type == 'D';
} }
], ],
'DecreaseDamageRaw' => [ 'DecreaseDamageRaw' => [
'title' => '最终伤害减少', 'title' => '最终伤害减少',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'blue', //'color' => 'blue',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return $item_type == 'A' || $item_type == 'D'; return true;
} }
], ],
'DecreaseDamagePercentage' => [ 'DecreaseDamagePercentage' => [
'title' => '最终伤害减少', 'title' => '最终伤害减少',
'format' => '{value}', 'format' => '{value}',
'suffix' => '%', 'suffix' => '%',
'color' => 'blue', //'color' => 'blue',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return $item_type == 'A' || $item_type == 'D'; return true;
} }
], ],
...@@ -79,7 +71,7 @@ $itmpara_tooltip = [ ...@@ -79,7 +71,7 @@ $itmpara_tooltip = [
'title' => '战斗中生命上限增加', 'title' => '战斗中生命上限增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -88,7 +80,7 @@ $itmpara_tooltip = [ ...@@ -88,7 +80,7 @@ $itmpara_tooltip = [
'title' => '战斗中体力上限增加', 'title' => '战斗中体力上限增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -97,7 +89,7 @@ $itmpara_tooltip = [ ...@@ -97,7 +89,7 @@ $itmpara_tooltip = [
'title' => '战斗中灵力上限增加', 'title' => '战斗中灵力上限增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -106,7 +98,7 @@ $itmpara_tooltip = [ ...@@ -106,7 +98,7 @@ $itmpara_tooltip = [
'title' => '战斗中攻击力增加', 'title' => '战斗中攻击力增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -115,7 +107,7 @@ $itmpara_tooltip = [ ...@@ -115,7 +107,7 @@ $itmpara_tooltip = [
'title' => '战斗中防御力增加', 'title' => '战斗中防御力增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -124,7 +116,7 @@ $itmpara_tooltip = [ ...@@ -124,7 +116,7 @@ $itmpara_tooltip = [
'title' => '战斗中殴系熟练度增加', 'title' => '战斗中殴系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -133,7 +125,7 @@ $itmpara_tooltip = [ ...@@ -133,7 +125,7 @@ $itmpara_tooltip = [
'title' => '战斗中斩系熟练度增加', 'title' => '战斗中斩系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -142,7 +134,7 @@ $itmpara_tooltip = [ ...@@ -142,7 +134,7 @@ $itmpara_tooltip = [
'title' => '战斗中射系熟练度增加', 'title' => '战斗中射系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -151,7 +143,7 @@ $itmpara_tooltip = [ ...@@ -151,7 +143,7 @@ $itmpara_tooltip = [
'title' => '战斗中投系熟练度增加', 'title' => '战斗中投系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -160,7 +152,7 @@ $itmpara_tooltip = [ ...@@ -160,7 +152,7 @@ $itmpara_tooltip = [
'title' => '战斗中爆系熟练度增加', 'title' => '战斗中爆系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -169,7 +161,7 @@ $itmpara_tooltip = [ ...@@ -169,7 +161,7 @@ $itmpara_tooltip = [
'title' => '战斗中灵系熟练度增加', 'title' => '战斗中灵系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -178,7 +170,7 @@ $itmpara_tooltip = [ ...@@ -178,7 +170,7 @@ $itmpara_tooltip = [
'title' => '战斗中金钱增加', 'title' => '战斗中金钱增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -187,7 +179,7 @@ $itmpara_tooltip = [ ...@@ -187,7 +179,7 @@ $itmpara_tooltip = [
'title' => '战斗中怒气增加', 'title' => '战斗中怒气增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'yellow', //'color' => 'yellow',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -198,7 +190,7 @@ $itmpara_tooltip = [ ...@@ -198,7 +190,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中生命上限增加', 'title' => '搜索/移动中生命上限增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', //'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -207,16 +199,16 @@ $itmpara_tooltip = [ ...@@ -207,16 +199,16 @@ $itmpara_tooltip = [
'title' => '搜索/移动中体力上限增加', 'title' => '搜索/移动中体力上限增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', // 'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
], ],
'AddPlayerMssInSearchMove' => [ 'AddPlayerMssInSearchMove' => [
'title' => '搜索/移动中灵力上限增加', 'title' => '搜索/移动中歌魂上限增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', //'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -225,7 +217,7 @@ $itmpara_tooltip = [ ...@@ -225,7 +217,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中攻击力增加', 'title' => '搜索/移动中攻击力增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', //'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -234,7 +226,7 @@ $itmpara_tooltip = [ ...@@ -234,7 +226,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中防御力增加', 'title' => '搜索/移动中防御力增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', //'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -243,7 +235,7 @@ $itmpara_tooltip = [ ...@@ -243,7 +235,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中殴系熟练度增加', 'title' => '搜索/移动中殴系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', //'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -252,7 +244,7 @@ $itmpara_tooltip = [ ...@@ -252,7 +244,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中斩系熟练度增加', 'title' => '搜索/移动中斩系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', //'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -261,7 +253,7 @@ $itmpara_tooltip = [ ...@@ -261,7 +253,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中射系熟练度增加', 'title' => '搜索/移动中射系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', //'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -270,7 +262,7 @@ $itmpara_tooltip = [ ...@@ -270,7 +262,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中投系熟练度增加', 'title' => '搜索/移动中投系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', //'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -279,7 +271,7 @@ $itmpara_tooltip = [ ...@@ -279,7 +271,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中爆系熟练度增加', 'title' => '搜索/移动中爆系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', // 'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -288,7 +280,7 @@ $itmpara_tooltip = [ ...@@ -288,7 +280,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中灵系熟练度增加', 'title' => '搜索/移动中灵系熟练度增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', // 'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -297,7 +289,7 @@ $itmpara_tooltip = [ ...@@ -297,7 +289,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中金钱增加', 'title' => '搜索/移动中金钱增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', // 'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -306,7 +298,7 @@ $itmpara_tooltip = [ ...@@ -306,7 +298,7 @@ $itmpara_tooltip = [
'title' => '搜索/移动中怒气增加', 'title' => '搜索/移动中怒气增加',
'format' => '{value}', 'format' => '{value}',
'suffix' => '', 'suffix' => '',
'color' => 'green', // 'color' => 'green',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -317,7 +309,7 @@ $itmpara_tooltip = [ ...@@ -317,7 +309,7 @@ $itmpara_tooltip = [
'title' => '平台物品', 'title' => '平台物品',
'format' => '此物品可以变身为特定角色', 'format' => '此物品可以变身为特定角色',
'suffix' => '', 'suffix' => '',
'color' => 'purple', // 'color' => 'purple',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return $value == 1; return $value == 1;
} }
...@@ -326,7 +318,7 @@ $itmpara_tooltip = [ ...@@ -326,7 +318,7 @@ $itmpara_tooltip = [
'title' => '限时变身', 'title' => '限时变身',
'format' => '变身效果会随着时间消失', 'format' => '变身效果会随着时间消失',
'suffix' => '', 'suffix' => '',
'color' => 'purple', //'color' => 'purple',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return $value == 1; return $value == 1;
} }
...@@ -335,7 +327,7 @@ $itmpara_tooltip = [ ...@@ -335,7 +327,7 @@ $itmpara_tooltip = [
'title' => '变身持续时间', 'title' => '变身持续时间',
'format' => '{value}', 'format' => '{value}',
'suffix' => '回合', 'suffix' => '回合',
'color' => 'purple', //'color' => 'purple',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return true; return true;
} }
...@@ -346,7 +338,7 @@ $itmpara_tooltip = [ ...@@ -346,7 +338,7 @@ $itmpara_tooltip = [
'title' => '任务物品', 'title' => '任务物品',
'format' => '此物品与任务相关', 'format' => '此物品与任务相关',
'suffix' => '', 'suffix' => '',
'color' => 'orange', //'color' => 'orange',
'condition' => function($item_type, $value) { 'condition' => function($item_type, $value) {
return $value == 1; return $value == 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment