function post_gameover_events() { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys')); $result = $db->query("SELECT name,pid FROM {$tablepre}players WHERE type=0"); while ($udata = $db->fetch_array($result)) { $edata = \player\fetch_playerdata_by_pid($udata['pid']); if ($edata === NULL) { continue; } $res = $db->query("SELECT n_achievements FROM {$gtablepre}users WHERE username='******'name']}'"); if (!$db->num_rows($res)) { continue; } $zz = $db->fetch_array($res); $ach = $zz['n_achievements']; $achdata = explode(';', $ach); $maxid = count($achdata) - 2; foreach (\skillbase\get_acquired_skill_array($edata) as $key) { if (defined('MOD_SKILL' . $key . '_INFO') && defined('MOD_SKILL' . $key . '_ACHIEVEMENT_ID')) { if (strpos(constant('MOD_SKILL' . $key . '_INFO'), 'achievement;') !== false) { $id = (int) constant('MOD_SKILL' . $key . '_ACHIEVEMENT_ID'); if ($id > $maxid) { $maxid = $id; } if (isset($achdata[$id])) { $s = (string) $achdata[$id]; } else { $s = ''; } $f = false; if (strpos(constant('MOD_SKILL' . $key . '_INFO'), 'daily;') == false) { $f = true; } if ($s != '' && $s != 'VWXYZ') { $f = true; } if ($f) { $func = '\\skill' . $key . '\\finalize' . $key; $achdata[$id] = $func($edata, $s); } } } } $nachdata = ''; for ($i = 0; $i <= $maxid; $i++) { $nachdata .= $achdata[$i] . ';'; } $db->query("UPDATE {$gtablepre}users SET n_achievements = '{$nachdata}' WHERE username='******'name']}'"); } $chprocess(); }
function act() { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player', 'map', 'logger')); if ($mode == "advteamspecial") { if (!in_array($gametype, $teamwin_mode)) { $log .= "此命令在本游戏模式下不可用。<br>"; $mode = 'command'; } else { if ($command == "sendflare") { $log .= "发出支援请求成功。<br>"; $flare = 1; $mode = 'command'; } else { if ($command == "stopflare") { $log .= "取消支援请求成功。<br>"; $flare = 0; $mode = 'command'; } else { if (strpos($command, 'findteam') === 0) { $which = (int) substr($command, 8); $edata = \player\fetch_playerdata_by_pid($which); if ($edata === NULL) { $log .= "队友不存在。<br>"; $mode = 'command'; } else { if (!$teamID || $edata['teamID'] != $teamID) { $log .= "对方不是你的队友!<br>"; $mode = 'command'; } else { if ($edata['hp'] <= 0) { $log .= "对方已经死亡!<br>"; $mode == 'command'; } else { if ($edata['pls'] != $pls) { $log .= "对方与你不在同一个地图!<br>"; $mode == 'command'; } else { \team\findteam($edata); } } } } } } } } return; } $chprocess(); }
function meetman($sid) { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'logger', 'player', 'metman')); $edata = \player\fetch_playerdata_by_pid($sid); if ($edata['hp'] <= 0) { $action = 'corpse' . $sid; findcorpse($edata); return; } else { $chprocess($sid); } }
function get_trap_damage() { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player', 'skill428')); if (is_numeric($itmsk0)) { $wdata = \player\fetch_playerdata_by_pid($itmsk0); if (\skillbase\skill_query(428, $wdata)) { $var_428 = get_skill428_dmg_gain($wdata); return round($var_428 * $chprocess()); } } return $chprocess(); }
function skill_onload_event(&$pa) { if (eval(__MAGIC__)) { return $___RET_VALUE; } if (\skillbase\skill_query(57, $pa) && $pa['hp'] > 0) { $i = \skillbase\skill_getvalue(57, 'l', $pa); $z = \skillbase\skill_getvalue(57, 'p', $pa); eval(import_module('sys', 'player', 'skill56', 'logger')); //判断触发者是否就是雇佣者本身 if ($z == $pid) { $employer = NULL; } else { $employer = \player\fetch_playerdata_by_pid($z); } $infochanged = 0; //收钱判断 $is_hired = (int) \skillbase\skill_getvalue(56, 'h' . $i, $employer); if ($is_hired == 1) { $lastsal = (int) \skillbase\skill_getvalue(56, 'l' . $i, $employer); $ty = (int) \skillbase\skill_getvalue(56, 's' . $i); while ($now - $lastsal >= 60) { $mercsal = $skill56_npc['sub'][$ty]['mercsalary']; if ($employer !== NULL) { $emoney =& $employer['money']; } else { $emoney =& $money; } if ($emoney >= $mercsal) { //收钱成功 $pa['money'] += $mercsal; $emoney -= $mercsal; $lastsal += 60; \skillbase\skill_setvalue(56, 'l' . $i, $lastsal, $employer); $w_log = '你支付了<span class="yellow">' . $mercsal . '</span>元作为佣兵<span class="yellow">' . $skill56_npc['sub'][$ty]['name'] . '</span>的薪水!<br>'; \logger\logsave($z, $lastsal, $w_log, 'b'); $infochanged = 1; $pa['infochanged'] = 1; } else { if ($now - $lastsal >= $merc_leave_timeout) { //强制解雇 $pa['money'] += $emoney; $emoney = 0; $lastsal += $merc_leave_timeout; \skillbase\skill_setvalue(56, 'l' . $i, $lastsal, $employer); \skillbase\skill_setvalue(56, 'h' . $i, 2, $employer); if ($skill56_npc['sub'][$ty]['mercfireaction'] == 1) { $pa['pls'] = 999; } $w_log = '<span class="red">因为你长期拖欠佣兵<span class="yellow">' . $skill56_npc['sub'][$ty]['name'] . '</span>的薪水,佣兵<span class="yellow">' . $skill56_npc['sub'][$ty]['name'] . '</span>与你解除了雇佣合同!</span><br>'; \logger\logsave($z, $lastsal, $w_log, 'b'); $infochanged = 1; $pa['infochanged'] = 1; break; } else { break; } } } } if ($infochanged && $employer !== NULL) { \player\player_save($employer); } } $chprocess($pa); }
function rs_game($xmode = 0) { if (eval(__MAGIC__)) { return $___RET_VALUE; } $chprocess($xmode); eval(import_module('sys', 'map', 'player', 'npc', 'lvlctl', 'skillbase')); if ($xmode & 8) { //echo " - NPC初始化 - "; $db->query("DELETE FROM {$tablepre}players WHERE type>0 "); //$typenum = sizeof($typeinfo); $plsnum = sizeof($plsinfo) - sizeof($hidden_arealist); $npcqry = ''; foreach ($npcinfo as $i => $npcs) { if (!empty($npcs)) { if (sizeof($npcs['sub']) > $npcs['num']) { shuffle($npcs['sub']); } for ($j = 1; $j <= $npcs['num']; $j++) { $npc = array_merge($npcinit, $npcs); //$npc = $npcinfo[$i]; $npc['type'] = $i; $npc['endtime'] = $now; $npc['sNo'] = $j; $subnum = sizeof($npc['sub']); $sub = $j % $subnum; $npc = array_merge($npc, $npc['sub'][$sub]); $npc['hp'] = $npc['mhp']; $npc['sp'] = $npc['msp']; $npc['exp'] = round(2 * $npc['lvl'] * $baseexp); $npc['wp'] = $npc['wk'] = $npc['wg'] = $npc['wc'] = $npc['wd'] = $npc['wf'] = $npc['skill']; if ($npc['gd'] == 'r') { $npc['gd'] = rand(0, 1) ? 'm' : 'f'; } $rpls = rand(1, $plsnum - 1); while ($rpls == 34) { $rpls = rand(1, $plsnum - 1); } if ($npc['pls'] == 99) { $npc['pls'] = $rpls; } elseif (is_array($npc['pls'])) { $epls = rand(0, sizeof($npc['pls'])); $npc['pls'] = $npc['pls'][$epls]; } $npc['state'] = 0; $npcqrylit = "("; $npcqry = "("; foreach ($npc as $key => $value) { if (in_array($key, $db_player_structure)) { $npcqrylit .= $key . ","; $npcqry .= "'" . $npc[$key] . "',"; } } $npcqrylit = substr($npcqrylit, 0, strlen($npcqrylit) - 1) . ")"; $npcqry = substr($npcqry, 0, strlen($npcqry) - 1) . ")"; $qry = "INSERT INTO {$tablepre}players " . $npcqrylit . " VALUES " . $npcqry; $db->query($qry); unset($qry); if (is_array($npc['skills'])) { $qry = "SELECT * FROM {$tablepre}players WHERE type>'0' ORDER BY pid DESC LIMIT 1"; $result = $db->query($qry); $pr = $db->fetch_array($result); $pp = \player\fetch_playerdata_by_pid($pr['pid']); foreach ($npc['skills'] as $key => $value) { if (defined('MOD_SKILL' . $key)) { \skillbase\skill_acquire($key, $pp); if ($value > 0) { \skillbase\skill_setvalue($key, 'lvl', $value, $pp); } } } \player\player_save($pp); } unset($npc); } } } } }
function check_addarea_gameover($atime) { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'map')); if ($gametype == 1) { if ($alivenum <= 0) { \sys\gameover($atime, 'end1'); //理论不会这样,防BUG return; } if ($areanum >= $areaadd * 2) { //限时2禁 $result = $db->query("SELECT * FROM {$tablepre}players WHERE type=0 ORDER BY pid DESC"); $ml = -1; $winner = ''; $wl = array(); while ($pt = $db->fetch_array($result)) { $pa = \player\fetch_playerdata_by_pid($pt['pid']); $cl = (int) \skillbase\skill_getvalue(424, 'lvl', $pa); $wl[$pa['name']] = $cl; if ($cl > $ml) { $ml = $cl; $winner = $pa['name']; } } arsort($wl); $rk = 0; foreach ($wl as $kk => $v) { $rk++; $k = \player\fetch_playerdata($kk); if ($v >= 5) { \cardbase\get_qiegao(150, $k); } if ($v >= 10) { \cardbase\get_qiegao(300, $k); } if ($v >= 20) { \cardbase\get_qiegao(600, $k); } if ($v >= 30) { \cardbase\get_card(94, $k); \cardbase\get_qiegao(500, $k); } if ($rk == 1) { \cardbase\get_card(96, $k); \cardbase\get_card(95, $k); } if ($rk <= 2) { \cardbase\get_card(95, $k); } if ($rk <= 3) { \cardbase\get_qiegao(500, $k); addnews(0, 'g1announce', $rk, $kk, $v); } } \sys\gameover($atime, 'end8', $winner); return; } \sys\rs_game(16 + 32); return; } $chprocess($atime); }
function discover_player() { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player', 'logger', 'metman')); $result = $db->query("SELECT pid FROM {$tablepre}players WHERE pls='{$pls}' AND pid!='{$pid}'"); if (!$db->num_rows($result)) { $log .= '<span class="yellow">周围一个人都没有。</span><br>'; $mode = 'command'; return; } $enemynum = $db->num_rows($result); $enemyarray = range(0, $enemynum - 1); shuffle($enemyarray); $hideflag = false; foreach ($enemyarray as $enum) { $db->data_seek($result, $enum); $z = $db->fetch_array($result); $edata = \player\fetch_playerdata_by_pid($z['pid']); if (isset($edata['infochanged']) && $edata['infochanged']) { \player\player_save($edata); } if ($edata['pls'] == $pls) { $z = check_player_discover($edata); if ($z == -1) { //这不是bug,是原版本的奇葩设定,请参见corpse模块注释 \explore\discover('search2'); return; } if ($z) { meetman($edata['pid']); return; } } } if ($hideflag == true) { $log .= '似乎有人隐藏着……<br>'; } else { $log .= '<span class="yellow">周围一个人都没有。</span><br>'; } $mode = 'command'; return; }
function act() { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player')); if ($mode == 'corpse') { getcorpse($command); return; } if (strpos($action, 'pacorpse') === 0) { $cid = str_replace('pacorpse', '', $action); if ($cid) { $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$cid}' AND hp=0"); if ($db->num_rows($result) > 0) { $edata = \player\fetch_playerdata_by_pid($cid); findcorpse($edata); return; } } } $chprocess(); }
function act() { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'map', 'player', 'logger', 'metman', 'input')); if ($mode == 'combat') { if ($command == 'back') { $log .= "你逃跑了。"; $action = ''; $mode = 'command'; return; } $enemyid = str_replace('enemy', '', $action); if (!$enemyid || strpos($action, 'enemy') === false) { $log .= "<span class=\"yellow\">你没有遇到敌人,或已经离开战场!</span><br>"; $action = ''; $mode = 'command'; return; } $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$enemyid}'"); if (!$db->num_rows($result)) { $log .= "对方不存在!<br>"; $action = ''; $mode = 'command'; return; } $edata = \player\fetch_playerdata_by_pid($enemyid); extract($edata, EXTR_PREFIX_ALL, 'w'); if ($edata['pls'] != $pls) { $log .= "<span class=\"yellow\">" . $edata['name'] . "</span>已经离开了<span class=\"yellow\">{$plsinfo[$pls]}</span>。<br>"; $action = ''; $mode = 'command'; return; } elseif ($edata['hp'] <= 0) { $log .= "<span class=\"red\">" . $edata['name'] . "</span>已经死亡,不能被攻击。<br>"; if (\corpse\check_corpse_discover($edata)) { $action = 'corpse' . $edata['pid']; \corpse\findcorpse($edata); } return; } \player\update_sdata(); $ldata = $sdata; battle_wrapper($ldata, $edata, 1); return; } $chprocess(); }
function action435() { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('skill435', 'sys', 'map', 'player', 'logger', 'input')); if (!\skillbase\skill_query(435) || !check_unlocked435($sdata)) { $log .= '你没有这个技能。<br>'; return; } $skillpara1 = (int) $skillpara1; $skillpara2 = (int) $skillpara2; $skillpara3 = (int) $skillpara3; if ($skillpara1 == 1) { //雇佣 $x = (int) \skillbase\skill_getvalue(435, 't'); if ($x >= $skill435_lim) { $log .= '发动次数已经达到了上限。<br>'; return; } if ($money < $skill435_need) { $log .= '金钱不足。<br>'; return; } if (in_array($pls, $arealist) && (array_search($pls, $arealist) > $areanum || $hack)) { addnews(0, 'bskill435', $name); $money -= $skill435_need; $x++; \skillbase\skill_setvalue(435, 't', $x); $tot = count($skill435_npc['sub']); $tp = 0; for ($i = 0; $i < $tot; $i++) { $tp += $skill435_npc['sub'][$i]['probability']; } $dice = rand(1, $tp); for ($i = 0; $i < $tot; $i++) { if ($dice <= $skill435_npc['sub'][$i]['probability']) { skill435_summon_npc($i); break; } else { $dice -= $skill435_npc['sub'][$i]['probability']; } } } else { $log .= '不能在禁区招募保安。<br>'; return; } } else { $x = (int) \skillbase\skill_getvalue(435, 't'); if ($skillpara2 < 1 || $skillpara2 > $x) { $log .= '参数错误。<br>'; return; } if ((int) \skillbase\skill_getvalue(435, 'h' . $skillpara2) != 1) { $log .= '该保安已经与你没有雇佣关系。<br>'; return; } $spid = (int) \skillbase\skill_getvalue(435, 'p' . $skillpara2); if ($spid <= 0) { $log .= '出现了一个BUG,请报告管理员。抱歉。<br>'; return; } $employee = \player\fetch_playerdata_by_pid($spid); if ($employee['hp'] <= 0) { $log .= '该保安已经死亡!<br>'; return; } $ty = (int) \skillbase\skill_getvalue(435, 's' . $skillpara2); if ($skillpara1 == 2) { //解雇 $lastsal = (int) \skillbase\skill_getvalue(435, 'l' . $skillpara2); if ($now - $lastsal >= 60) { //这说明该保安工资处于拖欠状态 $employee['money'] += $money; $money = 0; } if ($skill435_npc['sub'][$ty]['mercfireaction'] == 1) { $employee['pls'] = 999; } \skillbase\skill_setvalue(435, 'h' . $skillpara2, 0); $log .= '解雇成功。'; } else { if ($skillpara1 == 3) { //移动 $cost = $skill435_npc['sub'][$ty]['mercsalary'] * 2; if ($money >= $cost) { if ($skillpara3 == $employee['pls']) { $log .= '保安已经在该地点,不需移动。<br>'; return; } if (in_array($skillpara3, $arealist) && (array_search($skillpara3, $arealist) > $areanum || $hack)) { $money -= $cost; $employee['money'] += $cost; $employee['pls'] = $skillpara3; $log .= "消耗了<span class=\"yellow\">{$cost}</span>元,保安<span class=\"yellow\">{$employee['name']}</span>移动到了<span class=\"yellow\">{$plsinfo[$employee['pls']]}</span>。<br>"; } else { $log .= '不能将保安移动到禁区。<br>'; return; } } else { $log .= '金钱不足。'; return; } } else { if ($skillpara1 == 4) { //预付工资 if ($skillpara3 < 0) { $log .= '不能倒贴工资。<br>'; return; } if ($skillpara3 > 20) { $skillpara3 = 20; } //防溢出。。。 $cost = $skill435_npc['sub'][$ty]['mercsalary'] * $skillpara3; if ($money >= $cost) { $lastsal = (int) \skillbase\skill_getvalue(435, 'l' . $skillpara2); $lastsal += $skillpara3 * 60; \skillbase\skill_setvalue(435, 'l' . $skillpara2, $lastsal); $money -= $cost; $employee['money'] += $cost; $log .= "消耗了<span class=\"yellow\">{$cost}</span>元,预付了保安<span class=\"yellow\">{$employee['name']}</span>将来<span class=\"yellow\">{$skillpara3}</span>分钟的工资。<br>"; } else { $log .= '金钱不足。<br>'; return; } } else { $log .= '未知参数。<br>'; return; } } } \player\player_save($employee); } }
function itemdepot_load($i) { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player', 'logger', 'itemmain', 'itemdepot')); if ($pls != 19) { $log .= "<span class='red'>你所在的位置没有仓库功能,如果存在BUG,请告知管理员。</span><br>"; return; } if ($money < $loaditem_cost) { $log .= "<span class='red'>你身上的钱不足以支付取出道具的保管费……卧槽竟然二次收费,奸商啊!</span><br>"; return; } $idpt = change_itemdepot('decode', $itemdepot); $idpt_num = sizeof($idpt); if (!is_numeric($i) || $i > $max_saveitem_num || $i < 0 || $idpt[$i]['itms'] <= 0 && $idpt[$i]['itms'] !== '∞') { $log .= "<span class='red'>要取出的道具信息错误,请返回重新输入。</span><br>"; return; } $money -= $loaditem_cost; $itm0 = $idpt[$i]['itm']; $itmk0 = $idpt[$i]['itmk']; $itme0 = $idpt[$i]['itme']; $itms0 = $idpt[$i]['itms']; $itmsk0 = $idpt[$i]['itmsk']; unset($idpt[$i]); $log .= "你成功将道具<span class='yellow'>{$itm0}</span>从仓库中取了出来!<br>同时你也不得不支付了保管费<span class='yellow'>{$loaditem_cost}</span>元……你感觉自己的心在滴血。<br>"; addnews($now, 'itemdepot_load', $name, $itm0); \itemmain\itemget(); sort($idpt); $idpt = change_itemdepot('encode', $idpt); $itemdepot = $idpt; \player\player_save(\player\fetch_playerdata_by_pid($pid)); }
function addnpc($xtype, $xsub, $num, $time = 0, $xpls = 0) { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player', 'map', 'logger', 'addnpc', 'lvlctl', 'skillbase')); $time = $time == 0 ? $now : $time; $plsnum = sizeof($plsinfo) - sizeof($hidden_arealist); $npc = array_merge($npcinit, $anpcinfo[$xtype]); //$npcwordlist = Array(); $summon_pid = -1; //禁止NPC随机刷新至以下地区 $deny_add_arr = array(0, 34, 99); if (!$npc) { return; } else { for ($i = 0; $i < $num; $i++) { $npc = array_merge($npc, $npc['sub'][$xsub]); $npc['type'] = $xtype; $npc['endtime'] = $time; $npc['exp'] = round(($npc['lvl'] * 2 + 1) * $baseexp); $npc['sNo'] = $i; $npc['hp'] = $npc['mhp']; $npc['sp'] = $npc['msp']; $spid = uniqid('', true); $npc['pass'] = $spid; if (!isset($npc['state'])) { $npc['state'] = 0; } $npc['wp'] = $npc['wk'] = $npc['wg'] = $npc['wc'] = $npc['wd'] = $npc['wf'] = $npc['skill']; if ($npc['gd'] == 'r') { $npc['gd'] = rand(0, 1) ? 'm' : 'f'; } //之前的写法会导致一旦召唤$num>1数量的NPC,所有NPC都会刷到同一个地方 //因此用$npc['npls']代替$npc['pls'] //不得不说太蠢了,所以希望以后有机会能大改addnpc函数 $npc['npls'] = $xpls ? $xpls : $npc['pls']; if ($npc['pls'] == 99) { $areaarr = array_slice($arealist, $areanum + 1); if (empty($areaarr)) { $npc['npls'] = 0; } else { while (in_array($npc['npls'], $deny_add_arr)) { $npc['npls'] = $areaarr[rand(0, sizeof($areaarr))]; } } } elseif (is_array($npc['pls'])) { $epls = rand(0, sizeof($npc['pls'])); $npc['npls'] = $npc['pls'][$epls]; } $db->query("INSERT INTO {$tablepre}players (name,pass,type,endtime,gd,sNo,icon,club,hp,mhp,sp,msp,att,def,pls,lvl,`exp`,money,bid,inf,rage,pose,tactic,killnum,state,wp,wk,wg,wc,wd,wf,teamID,teamPass,wep,wepk,wepe,weps,arb,arbk,arbe,arbs,arh,arhk,arhe,arhs,ara,arak,arae,aras,arf,arfk,arfe,arfs,art,artk,arte,arts,itm0,itmk0,itme0,itms0,itm1,itmk1,itme1,itms1,itm2,itmk2,itme2,itms2,itm3,itmk3,itme3,itms3,itm4,itmk4,itme4,itms4,itm5,itmk5,itme5,itms5,itm6,itmk6,itme6,itms6,wepsk,arbsk,arhsk,arask,arfsk,artsk,itmsk0,itmsk1,itmsk2,itmsk3,itmsk4,itmsk5,itmsk6) VALUES ('" . $npc['name'] . "','" . $npc['pass'] . "','" . $npc['type'] . "','" . $npc['endtime'] . "','" . $npc['gd'] . "','" . $npc['sNo'] . "','" . $npc['icon'] . "','" . $npc['club'] . "','" . $npc['hp'] . "','" . $npc['mhp'] . "','" . $npc['sp'] . "','" . $npc['msp'] . "','" . $npc['att'] . "','" . $npc['def'] . "','" . $npc['npls'] . "','" . $npc['lvl'] . "','" . $npc['exp'] . "','" . $npc['money'] . "','" . $npc['bid'] . "','" . $npc['inf'] . "','" . $npc['rage'] . "','" . $npc['pose'] . "','" . $npc['tactic'] . "','" . $npc['killnum'] . "','" . $npc['state'] . "','" . $npc['wp'] . "','" . $npc['wk'] . "','" . $npc['wg'] . "','" . $npc['wc'] . "','" . $npc['wd'] . "','" . $npc['wf'] . "','" . $npc['teamID'] . "','" . $npc['teamPass'] . "','" . $npc['wep'] . "','" . $npc['wepk'] . "','" . $npc['wepe'] . "','" . $npc['weps'] . "','" . $npc['arb'] . "','" . $npc['arbk'] . "','" . $npc['arbe'] . "','" . $npc['arbs'] . "','" . $npc['arh'] . "','" . $npc['arhk'] . "','" . $npc['arhe'] . "','" . $npc['arhs'] . "','" . $npc['ara'] . "','" . $npc['arak'] . "','" . $npc['arae'] . "','" . $npc['aras'] . "','" . $npc['arf'] . "','" . $npc['arfk'] . "','" . $npc['arfe'] . "','" . $npc['arfs'] . "','" . $npc['art'] . "','" . $npc['artk'] . "','" . $npc['arte'] . "','" . $npc['arts'] . "','" . $npc['itm0'] . "','" . $npc['itmk0'] . "','" . $npc['itme0'] . "','" . $npc['itms0'] . "','" . $npc['itm1'] . "','" . $npc['itmk1'] . "','" . $npc['itme1'] . "','" . $npc['itms1'] . "','" . $npc['itm2'] . "','" . $npc['itmk2'] . "','" . $npc['itme2'] . "','" . $npc['itms2'] . "','" . $npc['itm3'] . "','" . $npc['itmk3'] . "','" . $npc['itme3'] . "','" . $npc['itms3'] . "','" . $npc['itm4'] . "','" . $npc['itmk4'] . "','" . $npc['itme4'] . "','" . $npc['itms4'] . "','" . $npc['itm5'] . "','" . $npc['itmk5'] . "','" . $npc['itme5'] . "','" . $npc['itms5'] . "','" . $npc['itm6'] . "','" . $npc['itmk6'] . "','" . $npc['itme6'] . "','" . $npc['itms6'] . "','" . $npc['wepsk'] . "','" . $npc['arbsk'] . "','" . $npc['arhsk'] . "','" . $npc['arask'] . "','" . $npc['arfsk'] . "','" . $npc['artsk'] . "','" . $npc['itmsk0'] . "','" . $npc['itmsk1'] . "','" . $npc['itmsk2'] . "','" . $npc['itmsk3'] . "','" . $npc['itmsk4'] . "','" . $npc['itmsk5'] . "','" . $npc['itmsk6'] . "')"); $newsname = $typeinfo[$xtype] . ' ' . $npc['name']; //$npcwordlist[] = $typeinfo[$type].' '.$npc['name']; $result = $db->query("SELECT pid FROM {$tablepre}players where pass='******' AND type>0"); if ($db->num_rows($result)) { $zz = $db->fetch_array($result); $summon_pid = $zz['pid']; } else { //出BUG了 $summon_pid = -1; } if (is_array($npc['skills'])) { $qry = "SELECT * FROM {$tablepre}players WHERE type>'0' ORDER BY pid DESC LIMIT 1"; $result = $db->query($qry); $pr = $db->fetch_array($result); $pp = \player\fetch_playerdata_by_pid($pr['pid']); foreach ($npc['skills'] as $key => $value) { if (defined('MOD_SKILL' . $key)) { \skillbase\skill_acquire($key, $pp); if ($value > 0) { \skillbase\skill_setvalue($key, 'lvl', $value, $pp); } } } \player\player_save($pp); } } if ($num > 1) { addnews($now, 'addnpcs', $newsname, $num); } else { addnews($now, 'addnpc', $newsname); } } /* if($num > $npc['num']){ //if($num > 1){ $newsname=$typeinfo[$xtype]; addnews($time, 'addnpcs', $newsname,$i); }else{ // for($i=0;$i< $num;$i++){ // addnews($time, 'addnpc', $npcwordlist[$i]); // } //$newsname=$typeinfo[$type].' '.$npc['name']; //addnews($time, 'addnpc', $newsname); } */ return $summon_pid; }
function senditem() { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'map', 'logger', 'player', 'metman', 'input')); $mateid = str_replace('team', '', $action); if (!$mateid || strpos($action, 'team') === false) { $log .= '<span class="yellow">你没有遇到队友,或已经离开现场!</span><br>'; $action = ''; $mode = 'command'; return; } $edata = \player\fetch_playerdata_by_pid($mateid); if (!isset($edata)) { $log .= "对方不存在!<br>"; $action = ''; $mode = 'command'; return; } if ($edata['pls'] != $pls) { $log .= '<span class="yellow">' . $edata['name'] . '</span>已经离开了<span class="yellow">' . $plsinfo[$pls] . '</span>。<br>'; $mode = 'command'; $action = ''; return; } elseif ($edata['hp'] <= 0) { $log .= '<span class="yellow">' . $edata['name'] . '</span>已经死亡,不能接受物品。<br>'; $mode = 'command'; $action = ''; return; } elseif (!$teamID || $edata['teamID'] != $teamID || $pid == $edata['pid']) { $log .= '<span class="yellow">' . $edata['name'] . '</span>并非你的队友,不能接受物品。<br>'; $mode = 'command'; $action = ''; return; } if ($message) { $log .= "<span class=\"lime\">你对{$edata['name']}说:“{$message}”</span><br>"; $x = "<span class=\"lime\">{$name}对你说:“{$message}”</span>"; if (!$edata['type']) { \logger\logsave($edata['pid'], $now, $x, 'c'); } } if ($command != 'back') { $itmn = substr($command, 4); if (!${'itms' . $itmn}) { $log .= '此道具不存在!'; $action = ''; $mode = 'command'; return; } $itm =& ${'itm' . $itmn}; $itmk =& ${'itmk' . $itmn}; $itme =& ${'itme' . $itmn}; $itms =& ${'itms' . $itmn}; $itmsk =& ${'itmsk' . $itmn}; for ($i = 1; $i <= 6; $i++) { if (!$edata['itms' . $i]) { $edata['itm' . $i] = $itm; $edata['itmk' . $i] = $itmk; $edata['itme' . $i] = $itme; $edata['itms' . $i] = $itms; $edata['itmsk' . $i] = $itmsk; $log .= "你将<span class=\"yellow\">" . $edata['itm' . $i] . "</span>送给了<span class=\"yellow\">{$edata['name']}</span>。<br>"; $x = "<span class=\"yellow\">{$name}</span>将<span class=\"yellow\">" . $edata['itm' . $i] . "</span>送给了你。"; if (!$edata['type']) { \logger\logsave($edata['pid'], $now, $x, 't'); } addnews($now, 'senditem', $name, $edata['name'], $itm); \player\player_save($edata); $itm = $itmk = $itmsk = ''; $itme = $itms = 0; $action = ''; return; } } $log .= "<span class=\"yellow\">{$edata['name']}</span> 的包裹已经满了,不能赠送物品。<br>"; } $action = ''; $mode = 'command'; return; }
function check_addarea_gameover($atime) { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'map')); if ($gametype == 1) { if ($alivenum <= 0) { \sys\gameover($atime, 'end1'); //理论不会这样,防BUG return; } if ($areanum >= $areaadd * 2) { //限时2禁 $result = $db->query("SELECT * FROM {$tablepre}players WHERE type=0 ORDER BY pid DESC"); $ml = -1; $winner = ''; $wl = array(); $wc = 0; while ($pt = $db->fetch_array($result)) { $pa = \player\fetch_playerdata_by_pid($pt['pid']); $cl = (int) \skillbase\skill_getvalue(424, 'lvl', $pa); //$wl[$pa['name']]=$cl; if ($cl > $ml) { $ml = $cl; $winner = $pa['name']; } $wc++; $wl[$wc]['n'] = $pa['name']; $wl[$wc]['p'] = $pa['pid']; $wl[$wc]['c'] = $cl; } //arsort($wl); for ($i = 1; $i < $wc; $i++) { for ($j = $i + 1; $j <= $wc; $j++) { if ($wl[$i]['c'] < $wl[$j]['c'] || $wl[$i]['c'] == $wl[$j]['c'] && $wl[$i]['p'] < $wl[$j]['p']) { $tt = $wl[$i]; $wl[$i] = $wl[$j]; $wl[$j] = $tt; } } } $rk = 0; $max_announce_num = 3; //进行状况展示人数 $bestlist = array(); //进行状况中展示的前X名列表 //foreach ($wl as $kk=>$v){ for ($rk = 1; $rk <= $wc; $rk++) { //$rk++; $kk = $wl[$rk]['n']; $v = $wl[$rk]['c']; $k = \player\fetch_playerdata($kk); if ($v >= 5) { \cardbase\get_qiegao(150, $k); } if ($v >= 10) { \cardbase\get_qiegao(300, $k); } if ($v >= 20) { \cardbase\get_qiegao(600, $k); } if ($v >= 30) { \cardbase\get_card(94, $k); \cardbase\get_qiegao(500, $k); } if ($rk == 1) { \cardbase\get_card(96, $k); \cardbase\get_card(95, $k); } if ($rk <= 2) { \cardbase\get_card(95, $k); } if ($rk <= $max_announce_num) { \cardbase\get_qiegao(500, $k); $bestlist[$rk] = array(0 => $kk, 1 => $v); } } for ($i = $max_announce_num; $i >= 1; $i--) { if (isset($bestlist[$i])) { addnews(0, 'g1announce', $i, $bestlist[$i][0], $bestlist[$i][1]); } } \sys\gameover($atime, 'end8', $winner); return; } \sys\rs_game(16 + 32); return; } $chprocess($atime); }
function getcorpse($item) { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player', 'logger')); $corpseid = strpos($action, 'corpse') === 0 ? str_replace('corpse', '', $action) : str_replace('pacorpse', '', $action); if (!$corpseid || strpos($action, 'corpse') === false) { $log .= '<span class="yellow">你没有遇到尸体,或已经离开现场!</span><br>'; $action = ''; $mode = 'command'; return; } $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$corpseid}'"); if (!$db->num_rows($result)) { $log .= '对方不存在!<br>'; $action = ''; $mode = 'command'; return; } //$edata = $db->fetch_array($result); $edata = \player\fetch_playerdata_by_pid($corpseid); if ($edata['hp'] > 0) { $log .= '对方尚未死亡!<br>'; $action = ''; $mode = 'command'; return; } elseif ($edata['pls'] != $pls) { $log .= '对方跟你不在同一个地图!<br>'; $action = ''; $mode = 'command'; return; } if ($item == 'wep') { $itm0 = $edata['wep']; $itmk0 = $edata['wepk']; $itme0 = $edata['wepe']; $itms0 = $edata['weps']; $itmsk0 = $edata['wepsk']; $edata['wep'] = $edata['wepk'] = $edata['wepsk'] = ''; $edata['wepe'] = $edata['weps'] = 0; } elseif (strpos($item, 'ar') === 0) { $itm0 = $edata[$item]; $itmk0 = $edata[$item . 'k']; $itme0 = $edata[$item . 'e']; $itms0 = $edata[$item . 's']; $itmsk0 = $edata[$item . 'sk']; $edata[$item] = $edata[$item . 'k'] = $edata[$item . 'sk'] = ''; $edata[$item . 'e'] = $edata[$item . 's'] = 0; } elseif (strpos($item, 'itm') === 0) { $itmn = substr($item, 3, 1); $itm0 = $edata['itm' . $itmn]; $itmk0 = $edata['itmk' . $itmn]; $itme0 = $edata['itme' . $itmn]; $itms0 = $edata['itms' . $itmn]; $itmsk0 = $edata['itmsk' . $itmn]; $edata['itm' . $itmn] = $edata['itmk' . $itmn] = $edata['itmsk' . $itmn] = ''; $edata['itme' . $itmn] = $edata['itms' . $itmn] = 0; } elseif ($item == 'money') { $money += $edata['money']; $log .= '获得了金钱 <span class="yellow">' . $edata['money'] . '</span>。<br>'; $edata['money'] = 0; \player\player_save($edata); $action = ''; $mode = 'command'; return; } elseif ($item == 'destroy') { $edata['weps'] = 0; $edata['arbs'] = 0; $edata['arhs'] = 0; $edata['aras'] = 0; $edata['arfs'] = 0; $edata['arts'] = 0; $edata['itms0'] = 0; $edata['itms1'] = 0; $edata['itms2'] = 0; $edata['itms3'] = 0; $edata['itms4'] = 0; $edata['itms5'] = 0; $edata['itms6'] = 0; $edata['money'] = 0; $edata['state'] = 16; \player\player_save($edata); $log .= '尸体成功销毁!'; $action = ''; $mode = 'command'; return; } else { $mode = 'command'; $action = ''; return; } \player\player_save($edata); if (!$itms0 || !$itmk0 || $itmk0 == 'WN' || $itmk0 == 'DN') { $log .= '该物品不存在!'; } else { \itemmain\itemget(); } $action = ''; $mode = 'command'; return; }
function trapget($mi) { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player', 'trap')); $itm0 = $mi['itm']; $itmk0 = $mi['itmk']; $itme0 = $mi['itme']; $itms0 = $mi['itms']; $itmsk0 = $mi['itmsk']; $tid = $mi['tid']; $db->query("DELETE FROM {$tablepre}maptrap WHERE tid='{$tid}'"); $playerflag = is_numeric($itmsk0) ? true : false; $selflag = $playerflag && $itmsk0 == $pid ? true : false; if ($playerflag && !$selflag) { $wdata = \player\fetch_playerdata_by_pid($itmsk0); $trname = $wdata['name']; $trtype = $wdata['type']; $trperfix = '<span class="yellow">' . $trname . '</span>设置的'; } elseif ($selflag) { $trname = $name; $trtype = 0; $trperfix = '你自己设置的'; } else { $trname = $trtype = $trperfix = ''; } trap(); }
function itemuse(&$theitem) { if (eval(__MAGIC__)) { return $___RET_VALUE; } eval(import_module('sys', 'player', 'itemmain', 'logger')); $itm =& $theitem['itm']; $itmk =& $theitem['itmk']; $itme =& $theitem['itme']; $itms =& $theitem['itms']; $itmsk =& $theitem['itmsk']; if (strpos($itmk, 'P') === 0) { if (strpos($itmk, '2') === 2) { $damage = round($itme * 2); } elseif (strpos($itmk, '1') === 2) { $damage = round($itme * 1.5); } else { $damage = round($itme); } if (defined('MOD_WOUND')) { \wound\get_inf('p'); } $hp -= $damage; $playerflag = 0; if ($itmsk && is_numeric($itmsk)) { $playerflag = 1; } $selflag = 0; if ($playerflag && $itmsk == $pid) { $selflag = 1; } if ($playerflag) { $wdata = \player\fetch_playerdata_by_pid($itmsk); $wprefix = '<span class="yellow">' . $wdata['name'] . '</span>'; if ($selflag) { $wprefix = '你自己'; } $log .= "糟糕,<span class=\"yellow\">{$itm}</span>中被{$wprefix}掺入了毒药!你受到了<span class=\"dmg\">{$damage}</span>点伤害!<br>"; addnews($now, 'poison', $name, $wdata['name'], $itm); if (!$selflag) { send_poison_enemylog($itm, $itmsk); } } else { $log .= "糟糕,<span class=\"yellow\">{$itm}</span>有毒!你受到了<span class=\"dmg\">{$damage}</span>点伤害!<br>"; } if ($hp <= 0) { $state = 26; \player\update_sdata(); if ($playerflag && !$selflag) { $sdata['bid'] = $itmsk; $log .= "你被<span class=\"red\">" . $wdata['name'] . "</span>毒死了!"; } else { if ($playerflag) { $sdata['bid'] = $itmsk; $wdata =& $sdata; $log .= "你被毒死了!"; } else { $wdata =& $sdata; $sdata['sourceless'] = 1; $log .= "你被毒死了!"; } } $wdata['attackwith'] = $itm; $killmsg = \player\kill($wdata, $sdata); if (isset($sdata['sourceless'])) { unset($sdata['sourceless']); } if ($killmsg) { $log .= "<span class=\"yellow\">{$wdata['name']}对你说:“{$killmsg}”</span><br>"; } if ($playerflag && !$selflag) { \player\player_save($wdata); } \player\player_save($sdata); \player\load_playerdata($sdata); } \itemmain\itms_reduce($theitem); return; } if ((strpos($itmk, 'Y') === 0 || strpos($itmk, 'Z') === 0) && $itm == '毒药') { include template(MOD_POISON_POISON); $cmd = ob_get_contents(); ob_clean(); return; } $chprocess($theitem); }