Commit 88bafccc authored by unknown's avatar unknown

新增分要素提取

Signed-off-by: default avatarunknown <37928663+mccleaner@users.noreply.github.com>
parent b0607318
......@@ -282,12 +282,15 @@ if($hp > 0){
if (!isset($choice) || $choice == 'menu') {
$mode = 'command';
} else {
$choice = (int)$choice;
if ($choice < 1 || $choice > 6)
var_dump($choice);
$choice_position = (int)(substr($choice, -1));
var_dump($choice_position);
//$choice = (int)$choice;
if ($choice_position < 1 || $choice_position > 6)
$log .= '<span class="red">无此物品。</span><br />';
else {
include_once GAME_ROOT . './include/game/special.func.php';
item_extract_trait($choice);
item_extract_trait($choice, $choice_position);
}
$mode = 'command';
}
......
......@@ -1027,6 +1027,7 @@ $iteminfo = Array(//注意顺序,AB必须在A的前面,以此类推
'ZA' => '代码漏洞',
'ZB'=> '称号卡',
'Z' => '特殊',#不可合并
'🥚' => '代码片段',
);
$itemspkinfo = Array(
......
......@@ -479,9 +479,10 @@ function press_bomb(){
}
//提取代码片段逻辑
//——创建一个新的函数【ItemExtractTrait(...)】,读取物品的itm、itme、itms和itmsk属性,并清除其中的无效部分(例如排除不应该被提取的属性,如下毒者ID等),将其对应的值赋予一个新的itmk为"代码片段"的物品,并替代(摧毁)原物品。可以考虑为新物品添加一些额外的字段。
function item_extract_trait($which){
//var_dump($itmn);
function item_extract_trait($which, $item_position){
//去掉string which的最后一位
$which = substr($which, 0, -1);
global $log,$mode,$club;
if($club != 21){
$log .= '你的称号不能使用该技能。';
......@@ -489,25 +490,41 @@ function item_extract_trait($which){
return;
}
if ( $which < 1 || $which > 6 ) {
if ( $item_position < 1 || $item_position > 6 ) {
$log .= '此道具不存在,请重新选择。';
$mode = 'command';
return;
}
global ${'itm'.$item_position},${'itmk'.$item_position},${'itme'.$item_position},${'itms'.$item_position},${'itmsk'.$item_position};
global ${'itm'.$which},${'itmk'.$which},${'itme'.$which},${'itms'.$which},${'itmsk'.$which};
$itm = & ${'itm'.$which};
$itmk = & ${'itmk'.$which};
$itme = & ${'itme'.$which};
$itms = & ${'itms'.$which};
$itmsk = & ${'itmsk'.$which};
$itm = & ${'itm'.$item_position};
$itmk = & ${'itmk'.$item_position};
$itme = & ${'itme'.$item_position};
$itms = & ${'itms'.$item_position};
$itmsk = & ${'itmsk'.$item_position};
$tmp_trait = ${$which.$item_position};
// 判断itmk是否以'D'或'W'开头
if (strpos($itmk, 'D') === 0 || strpos($itmk, 'W') === 0) {
$itm = '';
$itmk = '';
$itme = '0';
$itms = '1';
$itmsk = '';
${$which.$item_position} = $tmp_trait;
// 将itmk替换为代码片段的itmk
$itmk = '代码片段';
$itmk = '🥚';
// 给代码片段命名
$itm = $itm . '代码片段';
if ($which == 'itm') {
$itm = "名称".${$which.$item_position} . '代码片段';
} elseif ($which == 'itme') {
$itm = "效果".${$which.$item_position} . '代码片段';
} elseif ($which == 'itms') {
$itm = "耐久".${$which.$item_position} . '代码片段';
} elseif ($which == 'itmsk') {
$itm = "属性".${$which.$item_position} . '代码片段';
}
$log .= '成功将物品转换为代码片段。<br>';
} else {
$log .= '该物品无法转换为代码片段。<br>';
......
......@@ -2,25 +2,48 @@
<input type="hidden" name="command" value="special">
<input type="hidden" name="sp_cmd" value="sp_extract_trait_selected">
<input type="hidden" id="choice" name="choice" value="menu">
你想提取哪个的要素?<br>
你想提取什么要素?<br>
<br>
<!--{if (strpos ( $itmk1, 'D' ) === 0 ) || (strpos ( $itmk1, 'W' ) === 0) }-->
<input type="button" onclick="$('choice').value='1';postCmd('gamecmd','command.php');this.disabled=true;" value="$itm1/$itme1/$itms1"><br>
<input type="button" onclick="$('choice').value='itm1';postCmd('gamecmd','command.php');this.disabled=true;" value="名称">$itm1<br>
<input type="button" onclick="$('choice').value='itme1';postCmd('gamecmd','command.php');this.disabled=true;" value="效果">$itme1<br>
<input type="button" onclick="$('choice').value='itms1';postCmd('gamecmd','command.php');this.disabled=true;" value="耐久">$itms1<br>
<input type="button" onclick="$('choice').value='itmsk1';postCmd('gamecmd','command.php');this.disabled=true;" value="属性">$itmsk1_words<br>
<!--{/if}-->
<br>
<!--{if (strpos ( $itmk2, 'D' ) === 0 ) || (strpos ( $itmk2, 'W' ) === 0) }-->
<input type="button" onclick="$('choice').value='2';postCmd('gamecmd','command.php');this.disabled=true;" value="$itm2/$itme2/$itms2"><br>
<input type="button" onclick="$('choice').value='itm2';postCmd('gamecmd','command.php');this.disabled=true;" value="名称">$itm2<br>
<input type="button" onclick="$('choice').value='itme2';postCmd('gamecmd','command.php');this.disabled=true;" value="效果">$itme2<br>
<input type="button" onclick="$('choice').value='itms2';postCmd('gamecmd','command.php');this.disabled=true;" value="耐久">$itms2<br>
<input type="button" onclick="$('choice').value='itmsk2';postCmd('gamecmd','command.php');this.disabled=true;" value="属性">$itmsk2_words<br>
<!--{/if}-->
<br>
<!--{if (strpos ( $itmk3, 'D' ) === 0 ) || (strpos ( $itmk3, 'W' ) === 0) }-->
<input type="button" onclick="$('choice').value='3';postCmd('gamecmd','command.php');this.disabled=true;" value="$itm3/$itme3/$itms3"><br>
<input type="button" onclick="$('choice').value='itm3';postCmd('gamecmd','command.php');this.disabled=true;" value="名称">$itm3<br>
<input type="button" onclick="$('choice').value='itme3';postCmd('gamecmd','command.php');this.disabled=true;" value="效果">$itme3<br>
<input type="button" onclick="$('choice').value='itms3';postCmd('gamecmd','command.php');this.disabled=true;" value="耐久">$itms3<br>
<input type="button" onclick="$('choice').value='itmsk3';postCmd('gamecmd','command.php');this.disabled=true;" value="属性">$itmsk3_words<br>
<!--{/if}-->
<br>
<!--{if (strpos ( $itmk4, 'D' ) === 0 ) || (strpos ( $itmk4, 'W' ) === 0) }-->
<input type="button" onclick="$('choice').value='4';postCmd('gamecmd','command.php');this.disabled=true;" value="$itm4/$itme4/$itms4"><br>
<input type="button" onclick="$('choice').value='itm4';postCmd('gamecmd','command.php');this.disabled=true;" value="名称">$itm4<br>
<input type="button" onclick="$('choice').value='itme4';postCmd('gamecmd','command.php');this.disabled=true;" value="效果">$itme4<br>
<input type="button" onclick="$('choice').value='itms4';postCmd('gamecmd','command.php');this.disabled=true;" value="耐久">$itms4<br>
<input type="button" onclick="$('choice').value='itmsk4';postCmd('gamecmd','command.php');this.disabled=true;" value="属性">$itmsk4_words<br>
<!--{/if}-->
<br>
<!--{if (strpos ( $itmk5, 'D' ) === 0 ) || (strpos ( $itmk5, 'W' ) === 0) }-->
<input type="button" onclick="$('choice').value='5';postCmd('gamecmd','command.php');this.disabled=true;" value="$itm5/$itme5/$itms5"><br>
<input type="button" onclick="$('choice').value='itm5';postCmd('gamecmd','command.php');this.disabled=true;" value="名称">$itm5<br>
<input type="button" onclick="$('choice').value='itme5';postCmd('gamecmd','command.php');this.disabled=true;" value="效果">$itme5<br>
<input type="button" onclick="$('choice').value='itms5';postCmd('gamecmd','command.php');this.disabled=true;" value="耐久">$itms5<br>
<input type="button" onclick="$('choice').value='itmsk5';postCmd('gamecmd','command.php');this.disabled=true;" value="属性">$itmsk5_words<br>
<!--{/if}-->
<br>
<!--{if (strpos ( $itmk6, 'D' ) === 0 ) || (strpos ( $itmk6, 'W' ) === 0) }-->
<input type="button" onclick="$('choice').value='6';postCmd('gamecmd','command.php');this.disabled=true;" value="$itm6/$itme6/$itms6"><br>
<input type="button" onclick="$('choice').value='itm6';postCmd('gamecmd','command.php');this.disabled=true;" value="名称">$itm6<br>
<input type="button" onclick="$('choice').value='itme6';postCmd('gamecmd','command.php');this.disabled=true;" value="效果">$itme6<br>
<input type="button" onclick="$('choice').value='itms6';postCmd('gamecmd','command.php');this.disabled=true;" value="耐久">$itms6<br>
<input type="button" onclick="$('choice').value='itmsk6';postCmd('gamecmd','command.php');this.disabled=true;" value="属性">$itmsk6_words<br>
<!--{/if}-->
<br>
<input type="button" class="cmdbutton" onclick="postCmd('gamecmd','command.php');this.disabled=true;" value="放弃">
\ No newline at end of file
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