Commit 87a87a3a authored by unknown's avatar unknown

完善插入界面

Signed-off-by: default avatarunknown <37928663+mccleaner@users.noreply.github.com>
parent 88bafccc
...@@ -293,6 +293,41 @@ if($hp > 0){ ...@@ -293,6 +293,41 @@ if($hp > 0){
item_extract_trait($choice, $choice_position); item_extract_trait($choice, $choice_position);
} }
$mode = 'command'; $mode = 'command';
}
//码语行人插入
} elseif ($sp_cmd == 'sp_add_trait') {
$position = 0;
if ($club == 21) {
foreach (array(1, 2, 3, 4, 5, 6) as $imn)
//遍历所有武器装备
if (strpos(${'itmk' . $imn}, '🥚') === 0) {
$position = $imn;
break;
}
if (!$position) {
$log .= '<span class="red">你没有代码片段,无法插入代码片段!</span><br />';
$mode = 'command';
} else $mode = 'sp_add_trait';
} else {
$log .= '<span class="red">你不懂得如何插入代码片段!</span><br />';
$mode = 'command';
}
} elseif ($sp_cmd == 'sp_add_trait_selected') {
if (!isset($choice) || $choice == 'menu') {
var_dump($choice);
$mode = 'command';
} else {
$choice = (int)($choice);
$choice2 = (int)($choice2);
//$choice = (int)$choice;
var_dump($choice);
if ($choice < 1 || $choice > 6 || $choice2 < 1 || $choice2 > 6)
$log .= '<span class="red">无此物品。</span><br />';
else {
include_once GAME_ROOT . './include/game/special.func.php';
item_add_trait($choice, $choice2);
}
$mode = 'command';
} }
}elseif($sp_cmd == 'sp_pbomb'){ }elseif($sp_cmd == 'sp_pbomb'){
$mode = 'sp_pbomb'; $mode = 'sp_pbomb';
......
...@@ -532,6 +532,51 @@ function item_extract_trait($which, $item_position){ ...@@ -532,6 +532,51 @@ function item_extract_trait($which, $item_position){
} }
//合并代码片段逻辑
function item_add_trait($choice1, $choice2){
global $log,$mode,$club;
if($club != 21){
$log .= '你的称号不能使用该技能。';
$mode = 'command';
return;
}
//获取choice1和choice2的itm itmk itme itms itmsk
global ${'itm'.$choice1},${'itmk'.$choice1},${'itme'.$choice1},${'itms'.$choice1},${'itmsk'.$choice1};
global ${'itm'.$choice2},${'itmk'.$choice2},${'itme'.$choice2},${'itms'.$choice2},${'itmsk'.$choice2};
$itm1 = & ${'itm'.$choice1};
$itmk1 = & ${'itmk'.$choice1};
$itme1 = & ${'itme'.$choice1};
$itms1 = & ${'itms'.$choice1};
$itmsk1 = & ${'itmsk'.$choice1};
$itm2 = & ${'itm'.$choice2};
$itmk2 = & ${'itmk'.$choice2};
$itme2 = & ${'itme'.$choice2};
$itms2 = & ${'itms'.$choice2};
$itmsk2 = & ${'itmsk'.$choice2};
//检查itmk1是否为🥚,itmk2是否为D或W开头
var_dump($itmk1);
if ($itmk1 != '🥚' || (strpos($itmk2, 'D') !== 0 && strpos($itmk2, 'W') !== 0)) {
$log .= '该物品无法合并。<br>';
return;
}
var_dump($itm1);
//让itm2属性合并itm1
$itm2 = $itm1 . $itm2;
$itmk2 = $itmk1 . $itmk2;
$itme2 = (int)$itme1 + (int)$itme2;
$itms2 = (int)$itms1 + (int)$itms2;
$itmsk2 = $itmsk1 . $itmsk2;
//清空itm1
$itm1 = '';
$itmk1 = '';
$itme1 = '0';
$itms1 = '0';
//去除itm2重复的属性
$itmsk2 = implode(array_unique(str_split($itmsk2)));
//去除itm2属性里的🥚
$itmk2 = str_replace('🥚', '', $itmk2);
}
function shoplist($sn,$getlist=NULL) { function shoplist($sn,$getlist=NULL) {
global $gamecfg,$mode,$itemdata,$areanum,$areaadd,$iteminfo,$itemspkinfo,$club; global $gamecfg,$mode,$itemdata,$areanum,$areaadd,$iteminfo,$itemspkinfo,$club;
global $db,$tablepre; global $db,$tablepre;
...@@ -587,5 +632,3 @@ function shoplist($sn,$getlist=NULL) { ...@@ -587,5 +632,3 @@ function shoplist($sn,$getlist=NULL) {
return; return;
} }
?>
<input type="hidden" name="mode" value="command" />
<input type="hidden" name="command" value="special" />
<input type="hidden" name="sp_cmd" value="sp_add_trait_selected" />
<input type="hidden" id="choice" name="choice" value="menu" />
<input type="hidden" id="choice2" name="choice" value="menu" />
你打算怎么插入代码片段?<br>
<div style="padding: 5px;">
<select name="choice" onclick=sl('choice'); href="javascript:void(0);">
<option value="0">■ 道具一 ■<br />
<!--{if (strpos($itmk1, '🥚') === 0)}--><option value="1">$itm1/$itme1/$itms1<br /><!--{/if}-->
<!--{if (strpos($itmk2, '🥚') === 0)}--><option value="2">$itm2/$itme2/$itms2<br /><!--{/if}-->
<!--{if (strpos($itmk3, '🥚') === 0)}--><option value="3">$itm3/$itme3/$itms3<br /><!--{/if}-->
<!--{if (strpos($itmk4, '🥚') === 0)}--><option value="4">$itm4/$itme4/$itms4<br /><!--{/if}-->
<!--{if (strpos($itmk5, '🥚') === 0)}--><option value="5">$itm5/$itme5/$itms5<br /><!--{/if}-->
<!--{if (strpos($itmk6, '🥚') === 0)}--><option value="6">$itm6/$itme6/$itms6<br /><!--{/if}-->
</select>
<br><br>
<select name="choice2" onclick=sl('choice2'); href="javascript:void(0);">
<option value="0">■ 道具二 ■<br />
<!--{if (strpos ( $itmk1, 'D' ) === 0 ) || (strpos ( $itmk1, 'W' ) === 0) }--><option value="1">$itm1/$itme1/$itms1<br /><!--{/if}-->
<!--{if (strpos ( $itmk2, 'D' ) === 0 ) || (strpos ( $itmk2, 'W' ) === 0) }--><option value="2">$itm2/$itme2/$itms2<br /><!--{/if}-->
<!--{if (strpos ( $itmk3, 'D' ) === 0 ) || (strpos ( $itmk3, 'W' ) === 0) }--><option value="3">$itm3/$itme3/$itms3<br /><!--{/if}-->
<!--{if (strpos ( $itmk4, 'D' ) === 0 ) || (strpos ( $itmk4, 'W' ) === 0) }--><option value="4">$itm4/$itme4/$itms4<br /><!--{/if}-->
<!--{if (strpos ( $itmk5, 'D' ) === 0 ) || (strpos ( $itmk5, 'W' ) === 0) }--><option value="5">$itm5/$itme5/$itms5<br /><!--{/if}-->
<!--{if (strpos ( $itmk6, 'D' ) === 0 ) || (strpos ( $itmk6, 'W' ) === 0) }--><option value="6">$itm6/$itme6/$itms6<br /><!--{/if}-->
</select>
</div>
<input type="button" class="cmdbutton" id="zz" name="submit" value="[Z]提交" onclick="postCmd('gamecmd','command.php');this.disabled=true;">
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