Commit d1981422 authored by Nemo Ma's avatar Nemo Ma

fix(admin): preserve itmpara JSON commas in resource editor

parent 7d154693
......@@ -22,6 +22,7 @@ $admin_cmd_list = Array(
'roommng' => 5,
'antiAFKmng' => 4,
'templates_clean' => 4,
'resourcemng' => 7,
);
if(!$cuser||!$cpass) { gexit($_ERROR['no_login'],__file__,__line__); }
......
......@@ -257,6 +257,8 @@ $lang = array
'templates_clean_comment' => '清空已生成的模板缓存文件',
'roommng' => '临时性房间管理',
'roommng_comment' => '强制关闭指定编号的房间<br>不能关闭0号大房间(临时功能)',
'resourcemng' => '游戏资源管理',
'resourcemng_comment' => '管理地图物品/商店/开局物品与NPC配置,支持按RuleSet编辑',
'pcmng' => '玩家数据管理',
'pcmng_comment' => '修改当前局玩家的各数值,不影响帐号',
......
This diff is collapsed.
......@@ -91,6 +91,11 @@
<td>$lang['templates_clean_comment']</td>
<td>$admin_cmd_list['templates_clean']</td>
</tr>
<tr height="45px">
<td><input type="submit" style="width:100;height:40;" value="$lang['resourcemng']" onclick="$('command').value='resourcemng'" <!--{if $mygroup < $admin_cmd_list['resourcemng']}-->disabled="true"<!--{/if}-->></td>
<td>$lang['resourcemng_comment']</td>
<td>$admin_cmd_list['resourcemng']</td>
</tr>
<tr height="45px">
<td><input type="submit" style="width:100;height:40;" value="$lang['roommng']" onclick="$('command').value='roommng'" <!--{if $mygroup < $admin_cmd_list['roommng']}-->disabled="true"<!--{/if}-->></td>
<td>$lang['roommng_comment']</td>
......
<form method="post" name="resmng" action="admin.php" enctype="multipart/form-data">
<input type="hidden" name="mode" value="resourcemng">
<input type="hidden" name="start" value="$start">
<input type="hidden" name="record_id" id="record_id" value="$record_id">
<table class="admin" cellspacing="1" cellpadding="4">
<tr>
<td colspan="4" class="tdtitle">游戏资源管理</td>
</tr>
<tr>
<td>资源类型</td>
<td>
<select name="res_type">
<option value="mapitem" <!--{if $res_type=='mapitem'}-->selected<!--{/if}-->>地图物品</option>
<option value="shopitem" <!--{if $res_type=='shopitem'}-->selected<!--{/if}-->>商店物品</option>
<option value="stitem" <!--{if $res_type=='stitem'}-->selected<!--{/if}-->>开局物品</option>
<option value="stwep" <!--{if $res_type=='stwep'}-->selected<!--{/if}-->>开局武器</option>
<option value="npc" <!--{if $res_type=='npc'}-->selected<!--{/if}-->>开局NPC</option>
</select>
</td>
<td>配置来源</td>
<td>
<select name="ruleset">
<!--{loop $ruleset_list $rid $rinfo}-->
<option value="$rid" <!--{if $ruleset==$rid}-->selected<!--{/if}-->>$rinfo['name']</option>
<!--{/loop}-->
</select>
<input type="submit" name="action" value="list">
</td>
</tr>
<tr>
<td>搜索</td>
<td colspan="3">
<input type="text" name="keyword" value="$keyword" style="width:300px;">
<input type="submit" name="action" value="list">
<span class="yellow">$resultinfo</span>
</td>
</tr>
<tr>
<td>文件操作</td>
<td colspan="3">
<input type="submit" name="action" value="download">
<!--{if $allow_upload}-->
<input type="file" name="cfgfile">
<input type="submit" name="action" value="upload">
<!--{else}-->
<span class="grey">上传覆盖仅限管理员等级 &gt; 10</span>
<!--{/if}-->
</td>
</tr>
</table>
<br>
<!--{if $res_type!='npc'}-->
<table class="admin" cellspacing="1" cellpadding="4">
<tr>
<th>ID</th>
<!--{loop $columns $i $c}-->
<th>$c</th>
<!--{/loop}-->
<th>操作</th>
</tr>
<!--{loop $paged_records $idx $row}-->
<tr>
<td>$row['_idx']</td>
<!--{loop $columns $ci $c}-->
<td>{eval echo $row[$ci];}</td>
<!--{/loop}-->
<td>
<button type="submit" name="edit_id" value="$row['_idx']">编辑</button>
<button type="submit" name="delete_id" value="$row['_idx']" onclick="return confirm('确认删除该记录?');">删除</button>
</td>
</tr>
<!--{/loop}-->
</table>
<!--{else}-->
<table class="admin" cellspacing="1" cellpadding="4">
<tr>
<th>NPC类别</th>
<th>子键数量</th>
<th>操作</th>
</tr>
<!--{loop $paged_records $idx $row}-->
<tr>
<td>$row['_idx']</td>
<td>$row['_sub_count']</td>
<td>
<button type="submit" name="edit_id" value="$row['_idx']">编辑</button>
<button type="submit" name="delete_id" value="$row['_idx']" onclick="return confirm('确认删除该类别?');">删除</button>
</td>
</tr>
<!--{/loop}-->
</table>
<!--{/if}-->
<br>
<table class="admin" cellspacing="1" cellpadding="4">
<tr>
<td colspan="2" class="tdtitle">编辑/新增</td>
</tr>
<!--{if $res_type!='npc'}-->
<tr>
<td>ID</td>
<td><input type="text" name="record_id" value="$record_id"></td>
</tr>
<!--{loop $columns $i $c}-->
<tr>
<td>$c</td>
<td><input type="text" name="col_$i" style="width:98%;" value="{$edit_record[$i]}"></td>
</tr>
<!--{/loop}-->
<tr>
<td colspan="2">
<button type="submit" name="action" value="save_record">保存当前ID</button>
<button type="submit" name="action" value="add">新增记录</button>
</td>
</tr>
<!--{else}-->
<tr>
<td>NPC类别ID</td>
<td><input type="text" name="record_id" value="$record_id"></td>
</tr>
<tr>
<td>JSON配置</td>
<td>
<textarea name="npc_json" style="width:98%;height:260px;">$edit_record_json</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<button type="submit" name="action" value="save_record">保存当前类别</button>
<button type="submit" name="action" value="add">新增类别</button>
</td>
</tr>
<!--{/if}-->
</table>
<div style="margin-top:8px;">
<button type="submit" name="pagemode" value="up">上一页</button>
<button type="submit" name="pagemode" value="down">下一页</button>
</div>
</form>
......@@ -117,7 +117,8 @@ if($mode == 'enter') {
$arhe = $arae = $arfe = $arte = 0;
$arhs = $aras = $arfs = $arts = 0;
for ($i=0; $i<=6; $i++){$itm[$i] = $itmk[$i] = $itmsk[$i] = ''; $itme[$i] = $itms[$i] = 0;}
for ($i=0; $i<=6; $i++){$itm[$i] = $itmk[$i] = $itmsk[$i] = $itmpara[$i] = ''; $itme[$i] = $itms[$i] = 0;}
$weppara = '';
$itm[1] = '面包'; $itmk[1] = 'HH'; $itme[1] = 120; $itms[1] = 15;
$itm[2] = '矿泉水'; $itmk[2] = 'HS'; $itme[2] = 140; $itms[2] = 15;
//$itm[6] = '银白盒子'; $itmk[6] = 'p'; $itme[6] = 1; $itms[6] = 1; $itmsk[6] = 'ps';
......@@ -139,7 +140,9 @@ if($mode == 'enter') {
$weplist = openfile(config('stwep',$gamecfg));
do {
$index = rand(1,count($weplist)-1);
list($wep,$wepk,$wepe,$weps,$wepsk) = explode(",",$weplist[$index]);
$wline = rtrim($weplist[$index]);
$wline = preg_replace('/,\s*$/', '', $wline);
list($wep,$wepk,$wepe,$weps,$wepsk,$weppara) = array_pad(explode(",", $wline, 6), 6, '');
} while(!$wepk);
$stitemlist = openfile(config('stitem',$gamecfg));
......@@ -149,7 +152,9 @@ if($mode == 'enter') {
} while(!$itmk[3]);*/
do {
$index = rand(1,count($stitemlist)-1);
list($itm[4],$itmk[4],$itme[4],$itms[4],$itmsk[4]) = explode(",",$stitemlist[$index]);
$iline = rtrim($stitemlist[$index]);
$iline = preg_replace('/,\s*$/', '', $iline);
list($itm[4],$itmk[4],$itme[4],$itms[4],$itmsk[4],$itmpara[4]) = array_pad(explode(",", $iline, 6), 6, '');
} while(!$itmk[4] || ($itmk[3] == $itmk[4]));
if ($name == 'Amarillo_NMC') {
......@@ -185,6 +190,7 @@ if($mode == 'enter') {
{
${'itm'.$i} = $value; ${'itmk'.$i} = $itmk[$i]; ${'itme'.$i} = $itme[$i]; ${'itms'.$i} = $itms[$i];
if(isset($itmsk[$i])) ${'itmsk'.$i} = $itmsk[$i];
if(isset($itmpara[$i])) ${'itmpara'.$i} = $itmpara[$i];
}
}
......
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