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 = $db->fetch_array($result); findcorpse($edata); return; } } } $chprocess(); }
} elseif ($state == 1 || $state == 2 || $state == 3) { $mode = 'rest'; } elseif ($itms0) { $mode = 'itemmain'; } else { $mode = 'command'; } $cmd = $main = ''; if ((strpos($action, 'corpse') === 0 || strpos($action, 'pacorpse') === 0) && $gamestate < 40) { $cid = strpos($action, 'corpse') === 0 ? str_replace('corpse', '', $action) : 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 = $db->fetch_array($result); include_once GAME_ROOT . './include/game/battle.func.php'; findcorpse($edata); extract($edata, EXTR_PREFIX_ALL, 'w'); init_battle(1); $main = 'battle'; } } } if ($hp > 0 && $coldtimeon && $showcoldtimer && $rmcdtime) { $log .= "行动冷却时间:<span id=\"timer\" class=\"yellow\">0.0</span>秒<script type=\"text/javascript\">demiSecTimerStarter({$rmcdtime});</script><br>"; } if ($club == 0) { include_once GAME_ROOT . './include/game/clubslct.func.php'; getclub($name, $c1, $c2, $c3); $clubavl[0] = 0; $clubavl[1] = $c1; $clubavl[2] = $c2;
function combat($active = 1, $wep_kind = '') { global $log, $mode, $main, $cmd, $battle_title, $db, $tablepre, $pls, $message, $now, $w_log, $nosta, $hdamage, $hplayer; global $pid, $name, $club, $inf, $lvl, $exp, $killnum, $bid, $tactic, $pose, $hp, $mhp; global $wep, $wepk, $wepe, $weps, $wepsk; global $edata, $w_pid, $w_name, $w_pass, $w_type, $w_endtime, $w_deathtime, $w_gd, $w_sNo, $w_icon, $w_club, $w_hp, $w_mhp, $w_sp, $w_msp, $w_att, $w_def, $w_pls, $w_lvl, $w_exp, $w_money, $w_bid, $w_inf, $w_rage, $w_pose, $w_tactic, $w_killnum, $w_state, $w_wp, $w_wk, $w_wg, $w_wc, $w_wd, $w_wf, $w_teamID, $w_teamPass; global $w_wep, $w_wepk, $w_wepe, $w_weps, $w_arb, $w_arbk, $w_arbe, $w_arbs, $w_arh, $w_arhk, $w_arhe, $w_arhs, $w_ara, $w_arak, $w_arae, $w_aras, $w_arf, $w_arfk, $w_arfe, $w_arfs, $w_art, $w_artk, $w_arte, $w_arts, $w_itm0, $w_itmk0, $w_itme0, $w_itms0, $w_itm1, $w_itmk1, $w_itme1, $w_itms1, $w_itm2, $w_itmk2, $w_itme2, $w_itms2, $w_itm3, $w_itmk3, $w_itme3, $w_itms3, $w_itm4, $w_itmk4, $w_itme4, $w_itms4, $w_itm5, $w_itmk5, $w_itme5, $w_itms5, $w_itm6, $w_itmk6, $w_itme6, $w_itms6, $w_wepsk, $w_arbsk, $w_arhsk, $w_arask, $w_arfsk, $w_artsk, $w_itmsk0, $w_itmsk1, $w_itmsk2, $w_itmsk3, $w_itmsk4, $w_itmsk5, $w_itmsk6; global $infinfo, $w_combat_inf; global $rp, $w_rp, $action, $w_action, $achievement, $w_achievement, $skills, $w_skills, $skillpoint, $w_skillpoint; $battle_title = '战斗发生'; if (!$wep_kind) { $w1 = substr($wepk, 1, 1); $w2 = substr($wepk, 2, 1); if (($w1 == 'G' || $w1 == 'J') && $weps == $nosta) { $wep_kind = $w2 ? $w2 : 'P'; } else { $wep_kind = $w1; } } elseif (strpos($wepk, $wep_kind) === false && $wep_kind != 'back') { $wep_kind = substr($wepk, 1, 1); } $wep_temp = $wep; include_once GAME_ROOT . './include/game/clubskills.func.php'; if ($active) { if ($wep_kind == 'back') { $log .= "你逃跑了。"; $action = ''; $mode = 'command'; return; } $enemyid = $active ? str_replace('enemy', '', $action) : $bid; 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 = $db->fetch_array($result); 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) { global $corpseprotect, $gamestate; $log .= "<span class=\"red\">" . $edata['name'] . "</span>已经死亡,不能被攻击。<br>"; if ($edata['endtime'] < $now - $corpseprotect && $gamestate < 40) { $action = 'corpse' . $edata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findcorpse($edata); } //$action = ''; return; } if ($message) { // foreach ( Array('<','>',';',',') as $value ) { // if(strpos($message,$value)!==false){ // $message = str_replace ( $value, '', $message ); // } // } $log .= "<span class=\"lime\">你对{$edata['name']}大喊:{$message}</span><br>"; if (!$edata['type']) { $w_log = "<span class=\"lime\">{$name}对你大喊:{$message}</span><br>"; logsave($edata['pid'], $now, $w_log, 'c'); } } extract($edata, EXTR_PREFIX_ALL, 'w'); init_battle(1); include_once GAME_ROOT . './include/game/attr.func.php'; $log .= "你向<span class=\"red\">{$w_name}</span>发起了攻击!<br>"; $att_dmg = attack($wep_kind, 1); global $ggflag; if ($ggflag) { return; } $w_hp -= $att_dmg; if ($w_hp > 0 && $w_tactic != 4 && $w_pose != 5) { global $rangeinfo; $w_w1 = substr($w_wepk, 1, 1); $w_w2 = substr($w_wepk, 2, 1); if (($w_w1 == 'G' || $w_w1 == 'J') && $w_weps == $nosta) { $w_wep_kind = $w_w2 ? $w_w2 : 'P'; } else { $w_wep_kind = $w_w1; } //if (($rangeinfo [$wep_kind] == $rangeinfo [$w_wep_kind]) || ($rangeinfo [$w_wep_kind] == 'M')) { if ($rangeinfo[$wep_kind] <= $rangeinfo[$w_wep_kind] && $rangeinfo[$wep_kind] !== 0) { $counter = get_counter($w_wep_kind, $w_tactic, $w_club, $w_inf); $counter *= get_clubskill_bonus_counter($w_club, $w_skills, 'w_', $club, $skills, ''); $counter_dice = rand(0, 99); if ($counter_dice < $counter) { $log .= "<span class=\"red\">{$w_name}的反击!</span><br>"; $log .= npc_chat($w_type, $w_name, 'defend'); $def_dmg = defend($w_wep_kind); } else { $log .= npc_chat($w_type, $w_name, 'escape'); $log .= "<span class=\"red\">{$w_name}处于无法反击的状态,逃跑了!</span><br>"; } } else { $log .= npc_chat($w_type, $w_name, 'cannot'); $log .= "<span class=\"red\">{$w_name}攻击范围不足,不能反击,逃跑了!</span><br>"; } } elseif ($w_hp > 0) { $log .= "<span class=\"red\">{$w_name}逃跑了!</span><br>"; } } else { $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$bid}'"); $edata = $db->fetch_array($result); extract($edata, EXTR_PREFIX_ALL, 'w'); init_battle(1); include_once GAME_ROOT . './include/game/attr.func.php'; $log .= "<span class=\"red\">{$w_name}</span>突然向你袭来!<br>"; $log .= npc_chat($w_type, $w_name, 'attack'); npc_changewep(); $w_w1 = substr($w_wepk, 1, 1); $w_w2 = substr($w_wepk, 2, 1); if (($w_w1 == 'G' || $w_w1 == 'J') && $w_weps == $nosta) { $w_wep_kind = $w_w2 ? $w_w2 : 'P'; } else { $w_wep_kind = $w_w1; } $def_dmg = defend($w_wep_kind, 1); if ($hp > 0 && $tactic != 4 && $pose != 5) { global $rangeinfo; if ($rangeinfo[$wep_kind] >= $rangeinfo[$w_wep_kind] && $rangeinfo[$w_wep_kind] !== 0) { $counter = get_counter($wep_kind, $tactic, $club, $inf); $counter *= get_clubskill_bonus_counter($club, $skills, '', $w_club, $w_skills, 'w_'); $counter_dice = rand(0, 99); if ($counter_dice < $counter) { $log .= "<span class=\"red\">你的反击!</span><br>"; $wep_kind = substr($wepk, 1, 1); $att_dmg = attack($wep_kind); $w_hp -= $att_dmg; } else { $log .= "<span class=\"red\">你处于无法反击的状态,逃跑了!</span><br>"; } } else { $log .= "<span class=\"red\">你攻击范围不足,不能反击,逃跑了!</span><br>"; } } elseif ($hp > 0) { $log .= "<span class=\"red\">你逃跑了!</span><br>"; } } if ($hp == 0 && !$w_action) { $w_action = 'pacorpse' . $pid; } w_save($w_pid); $att_dmg = $att_dmg ? $att_dmg : 0; $def_dmg = $def_dmg ? $def_dmg : 0; if (!$w_type) { $w_inf_log = ''; if ($w_combat_inf) { global $exdmginf; foreach ($exdmginf as $inf_ky => $w_inf_words) { if (strpos($w_combat_inf, $inf_ky) !== false) { $w_inf_log .= "敌人的攻击造成你{$w_inf_words}了!<br>"; } } } if ($active) { $w_log = "手持<span class=\"red\">{$wep_temp}</span>的<span class=\"yellow\">{$name}</span>向你袭击!<br>你受到其<span class=\"yellow\">{$att_dmg}</span>点攻击,对其做出了<span class=\"yellow\">{$def_dmg}</span>点反击。<br>{$w_inf_log}"; } else { $w_log = "你发现了手持<span class=\"red\">{$wep_temp}</span>的<span class=\"yellow\">{$name}</span>并且先发制人!<br>你对其做出<span class=\"yellow\">{$def_dmg}</span>点攻击,受到其<span class=\"yellow\">{$att_dmg}</span>点反击。<br>{$w_inf_log}"; } if ($hp == 0) { $w_log .= "<span class=\"yellow\">{$name}</span><span class=\"red\">被你杀死了!</span><br>"; //include_once GAME_ROOT.'./include/game/achievement.func.php'; //check_battle_achievement($w_achievement,$w_type,$name); } logsave($w_pid, $now, $w_log, 'b'); } if ($att_dmg > $hdamage && $att_dmg >= $def_dmg) { $hdamage = $att_dmg; $hplayer = $name; save_combatinfo(); } elseif ($def_dmg > $hdamage && !$w_type) { $hdamage = $def_dmg; $hplayer = $w_name; save_combatinfo(); } //$bid = $w_pid; if ($w_hp <= 0 && $w_club != 99) { $w_bid = $pid; $w_hp = 0; if ($w_type == 0) { $killnum++; } include_once GAME_ROOT . './include/state.func.php'; $killmsg = kill($wep_kind, $w_name, $w_type, $w_pid, $wep_temp); $log .= npc_chat($w_type, $w_name, 'death'); include_once GAME_ROOT . './include/game/achievement.func.php'; check_battle_achievement($name, $w_type, $w_name, $wep_temp); $log .= "<span class=\"red\">{$w_name}被你杀死了!</span><br>"; //$rp = $rp + 20 ; if (!$w_type) { $rpup = $w_rp; } else { $rpup = 20; } if ($club == 19) { $rpdec = 30; $rpdec += get_clubskill_rp_dec($club, $skills); $rp += round($rpup * (100 - $rpdec) / 100); } else { $rp += $rpup; } if ($killmsg) { $log .= "<span class=\"yellow\">你对{$w_name}说:“{$killmsg}”</span><br>"; } include_once GAME_ROOT . './include/game/battle.func.php'; $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$w_pid}'"); $cdata = $db->fetch_array($result); $action = 'corpse' . $edata['pid']; findcorpse($cdata); return; } else { if ($w_hp <= 0) { //有第二阶段 if ($w_type) { $log .= npc_chat($w_type, $w_name, 'death'); include_once GAME_ROOT . './include/system.func.php'; $npcdata = evonpc($w_type, $w_name); $log .= '<span class="yellow">' . $w_name . '却没死去,反而爆发出真正的实力!</span><br>'; if ($npcdata) { addnews($now, 'evonpc', $w_name, $npcdata['name'], $name); foreach ($npcdata as $key => $val) { ${'w_' . $key} = $val; } } } else { include_once GAME_ROOT . './include/state.func.php'; $killmsg = kill($wep_kind, $w_name, $w_type, $w_pid, $wep_temp); $log .= '<span class="yellow">' . $w_name . '由于其及时按了BOMB键而原地满血复活了!</span><br>'; } } $main = 'battle'; init_battle(1); if (CURSCRIPT !== 'botservice') { include template('battleresult'); //$cmd = '<br><br><input type="hidden" name="mode" value="command"><input type="radio" name="command" id="back" value="back" checked><a onclick=sl("back"); href="javascript:void(0);" >确定</a><br>'; $cmd = ob_get_contents(); ob_clean(); //$bid = $hp <= 0 ? $bid : 0; } $action = ''; return; } }
function discover($schmode = 0) { global $art, $pls, $now, $log, $mode, $command, $cmd, $event_obbs, $weather, $pls, $club, $pose, $tactic, $inf, $item_obbs, $enemy_obbs, $trap_min_obbs, $trap_max_obbs, $bid, $db, $tablepre, $gamestate, $corpseprotect, $action, $skills, $rp, $aidata; $event_dice = rand(0, 99); if ($event_dice < $event_obbs || $art != "Untainted Glory" && $pls == 34 && $gamestate != 50) { include_once GAME_ROOT . './include/game/event.func.php'; event(); $mode = 'command'; return; } include_once GAME_ROOT . './include/game/aievent.func.php'; //AI事件 $aidata = false; //用于判断天然呆AI(冴冴这样的)是否已经来到你身后并且很生气 aievent(20); //触发AI事件的概率 if (is_array($aidata)) { include_once GAME_ROOT . './include/game/attr.func.php'; $active_r = get_active_r($weather, $pls, $pose, $tactic, $club, $inf, $aidata['pose']); include_once GAME_ROOT . './include/game/clubskills.func.php'; $active_r *= get_clubskill_bonus_active($club, $skills, $aidata['club'], $aidata['skills']); if ($active_r > 96) { $active_r = 96; } $bid = $aidata['pid']; $active_dice = rand(0, 99); if ($active_dice < $active_r) { $action = 'enemy' . $aidata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findenemy($aidata); return; } else { include_once GAME_ROOT . './include/game/combat.func.php'; combat(0); return; } } $trap_dice = rand(0, 99); //随机数,开始判断是否踩陷阱 if ($trap_dice < $trap_max_obbs) { //踩陷阱概率最大值 $trapresult = $db->query("SELECT * FROM {$tablepre}maptrap WHERE pls = '{$pls}' ORDER BY itmk DESC"); // $traplist = Array(); // while($trap0 = $db->fetch_array($result)){ // $traplist[$trap0['tid']] = $trap0; // if($trap0['itmk'] == 'TOc'){ // $xtrap = true; // $xtrapid = $ // } // } $xtrp = $db->fetch_array($trapresult); $xtrpflag = false; //echo $xtrp['itm']; if ($xtrp['itmk'] == 'TOc') { $xtrpflag = true; } $trpnum = $db->num_rows($trapresult); if ($trpnum) { //看地图上有没有陷阱 //echo "踩陷阱概率:{$real_trap_obbs}%"; if ($xtrpflag) { global $itm0, $itmk0, $itme0, $itms0, $itmsk0; $itm0 = $xtrp['itm']; $itmk0 = $xtrp['itmk']; $itme0 = $xtrp['itme']; $itms0 = $xtrp['itms']; $itmsk0 = $xtrp['itmsk']; $tid = $xtrp['tid']; $db->query("DELETE FROM {$tablepre}maptrap WHERE tid='{$tid}'"); include_once GAME_ROOT . './include/game/itemmain.func.php'; itemfind(); return; } else { $real_trap_obbs = $trap_min_obbs + $trpnum / 4; //Anti-Meta RP System Version 2.00 ~ Nemo //冴冴我喜欢你! //17rp/177rp+1% if ($gamestate >= 50) { $real_trap_obbs = $real_trap_obbs + $rp / 177; } else { $real_trap_obbs = $real_trap_obbs + $rp / 30; } if ($pose == 1) { $real_trap_obbs += 1; } elseif ($pose == 3) { $real_trap_obbs += 3; } //攻击和探索姿势略容易踩陷阱 if ($gamestate >= 40) { $real_trap_obbs += 3; } //连斗以后略容易踩陷阱 if ($pls == 0) { $real_trap_obbs += 15; } //在后台非常容易踩陷阱 if ($club == 6) { $real_trap_obbs -= 5; } //人肉搜索称号遭遇陷阱概率减少 if ($trap_dice < $real_trap_obbs) { //踩陷阱判断 $itemno = rand(0, $trpnum - 1); $db->data_seek($trapresult, $itemno); $mi = $db->fetch_array($trapresult); global $itm0, $itmk0, $itme0, $itms0, $itmsk0; $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}'"); if ($itms0) { include_once GAME_ROOT . './include/game/itemmain.func.php'; itemfind(); return; } } } } } // $trap_dice = rand(0,99); // if($pose==1){$trap_dice-=5;} // elseif($pose==3){$trap_dice-=8;}//攻击和探索姿势略容易踩陷阱 // if($gamestate >= 40){$trap_dice-=5;}//连斗以后略容易踩陷阱 // if($trap_dice < $trap_obbs){ // $result = $db->query("SELECT * FROM {$tablepre}{$pls}mapitem WHERE itmk = 'TO'"); // $trpnum = $db->num_rows($result); // if($trpnum){ // $itemno = rand(0,$trpnum-1); // $db->data_seek($result,$itemno); // $mi=$db->fetch_array($result); // global $itm0,$itmk0,$itme0,$itms0,$itmsk0; // $itm0=$mi['itm']; // $itmk0=$mi['itmk']; // $itme0=$mi['itme']; // $itms0=$mi['itms']; // $itmsk0=$mi['itmsk']; // $iid=$mi['iid']; // $db->query("DELETE FROM {$tablepre}{$pls}mapitem WHERE iid='$iid'"); // if($itms0){ // include_once GAME_ROOT.'./include/game/itemmain.func.php'; // itemfind(); // return; // } // } // } include_once GAME_ROOT . './include/game/attr.func.php'; $mode_dice = rand(0, 99); if ($mode_dice < $schmode) { global $pid, $corpse_obbs, $teamID, $fog, $bid, $gamestate; // if($gamestate < 40) { // $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='$pls' AND pid!='$pid' AND pid!='$bid'"); // } else { // $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='$pls' AND pid!='$pid'"); // } $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='{$pls}' AND pid!='{$pid}'"); if (!$db->num_rows($result)) { $log .= '<span class="yellow">周围一个人都没有。</span><br>'; if (CURSCRIPT == 'botservice') { echo "noenemy=1\n"; } $mode = 'command'; return; } $enemynum = $db->num_rows($result); $enemyarray = range(0, $enemynum - 1); shuffle($enemyarray); $find_r = get_find_r($weather, $pls, $pose, $tactic, $club, $inf); $find_obbs = $enemy_obbs + $find_r; foreach ($enemyarray as $enum) { $db->data_seek($result, $enum); $edata = $db->fetch_array($result); if (!$edata['type'] || $gamestate < 50) { if ($edata['hp'] > 0) { global $art, $artk, $name; if (!$edata['type'] && $artk == 'XX' && ($edata['artk'] != 'XX' || $edata['art'] != $name) && $gamestate < 50) { continue; } if ($artk != 'XX' && $edata['artk'] == 'XX' && $gamestate < 50) { continue; } $hide_r = get_hide_r($weather, $pls, $edata['pose'], $edata['tactic'], $edata['club'], $edata['inf']); include_once GAME_ROOT . './include/game/clubskills.func.php'; $hide_r *= get_clubskill_bonus_hide($edata['club'], $edata['skills']); $enemy_dice = rand(0, 99); if ($enemy_dice < $find_obbs - $hide_r) { if ($teamID && !$fog && $gamestate < 40 && $teamID == $edata['teamID']) { $bid = $edata['pid']; $action = 'team' . $edata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findteam($edata); return; } else { $active_r = get_active_r($weather, $pls, $pose, $tactic, $club, $inf, $edata['pose']); include_once GAME_ROOT . './include/game/clubskills.func.php'; $active_r *= get_clubskill_bonus_active($club, $skills, $edata['club'], $edata['skills']); if ($active_r > 96) { $active_r = 96; } $bid = $edata['pid']; $active_dice = rand(0, 99); if ($active_dice < $active_r) { $action = 'enemy' . $edata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findenemy($edata); return; } else { if (CURSCRIPT == 'botservice') { echo "passive_battle=1\n"; echo "passive_w_name={$edata['name']}\n"; echo "passive_w_type={$edata['type']}\n"; echo "passive_w_sNo={$edata['sNo']}\n"; } include_once GAME_ROOT . './include/game/combat.func.php'; combat(0); return; } } } else { $hideflag = true; } } else { $corpse_dice = rand(0, 99); if ($corpse_dice < $corpse_obbs) { if ($gamestate < 40 && $edata['endtime'] < $now - $corpseprotect && ($edata['weps'] && $edata['wepe'] || $edata['arbs'] && $edata['arbe'] || $edata['arhs'] || $edata['aras'] || $edata['arfs'] || $edata['arts'] || $edata['itms0'] || $edata['itms1'] || $edata['itms2'] || $edata['itms3'] || $edata['itms4'] || $edata['itms5'] || $edata['money'])) { $bid = $edata['pid']; $action = 'corpse' . $edata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findcorpse($edata); return; } else { //这看上去是个bug…… 会导致地图上最后一个兵很难摸到…… //改成discover(100)应该就能解决问题…… 但修复了可能导致平衡性问题…… 所以暂时留在这…… discover(50); return; } } } } } if ($hideflag == true) { $log .= '似乎有人隐藏着……<br>'; } else { $log .= '<span class="yellow">周围一个人都没有。</span><br>'; } $mode = 'command'; return; } else { $find_r = get_find_r($weather, $pls, $pose, $tactic, $club, $inf); $find_obbs = $item_obbs + $find_r; $item_dice = rand(0, 99); if ($item_dice < $find_obbs) { //$mapfile = GAME_ROOT."./gamedata/mapitem/{$pls}mapitem.php"; //$mapitem = openfile($mapfile); //$itemnum = sizeof($mapitem) - 1; // $result = $db->query("SELECT * FROM {$tablepre}mapitem WHERE map='$pls'"); // $itemnum = $db->num_rows($result); $result = $db->query("SELECT * FROM {$tablepre}mapitem WHERE pls = '{$pls}'"); $itemnum = $db->num_rows($result); if ($itemnum <= 0) { $log .= '<span class="yellow">周围找不到任何物品。</span><br>'; $mode = 'command'; return; } $itemno = rand(0, $itemnum - 1); $db->data_seek($result, $itemno); $mi = $db->fetch_array($result); global $itm0, $itmk0, $itme0, $itms0, $itmsk0; $itm0 = $mi['itm']; $itmk0 = $mi['itmk']; $itme0 = $mi['itme']; $itms0 = $mi['itms']; $itmsk0 = $mi['itmsk']; $iid = $mi['iid']; $db->query("DELETE FROM {$tablepre}mapitem WHERE iid='{$iid}'"); //list($itm0,$itmk0,$itme0,$itms0,$itmsk0) = explode(',', $mapitem[$itemno]); //array_splice($mapitem,$itemno,1); //writeover($mapfile,implode('', $mapitem),'wb'); //unset($mapitem); if ($itms0) { include_once GAME_ROOT . './include/game/itemmain.func.php'; itemfind(); return; } else { $log .= "但是什么都没有发现。可能是因为道具有天然呆属性。<br>"; } } else { $log .= "但是什么都没有发现。<br>"; } } $mode = 'command'; return; }
function discover($schmode = 0) { global $log, $mode, $command, $cmd, $event_obbs, $weather, $pls, $club, $pose, $tactic, $inf, $item_obbs, $enemy_obbs, $active_obbs; $event_dice = rand(0, 99); if ($event_dice < $event_obbs) { include_once GAME_ROOT . './include/game/event.func.php'; event(); $mode = 'command'; return; } include_once GAME_ROOT . './include/game/attr.func.php'; $mode_dice = rand(0, 99); if ($mode_dice < $schmode) { global $db, $tablepre, $pid, $corpse_obbs, $teamID, $fog, $gamestate, $bid; if ($gamestate < 40) { $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='{$pls}' AND pid!='{$pid}' AND pid!='{$bid}'"); } else { $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='{$pls}' AND pid!='{$pid}'"); } if (!$db->num_rows($result)) { $log .= '这里似乎已经没有人在了。<br>'; $mode = 'command'; return; } $enemynum = $db->num_rows($result); $enemyarray = range(0, $enemynum - 1); shuffle($enemyarray); $find_r = get_find_r($weather, $pls, $pose, $tactic, $club, $inf); $find_obbs = $enemy_obbs + $find_r; foreach ($enemyarray as $enum) { $db->data_seek($result, $enum); $edata = $db->fetch_array($result); if ($edata['hp'] > 0) { $hide_r = get_hide_r($weather, $pls, $edata['pose'], $edata['tactic'], $edata['club'], $edata['inf']); $enemy_dice = rand(0, 99); if ($enemy_dice < $find_obbs - $hide_r) { if ($teamID && !$fog && $teamID == $edata['teamID']) { include_once GAME_ROOT . './include/game/battle.func.php'; findteam($edata); return; } else { $active_r = get_active_r($weather, $pls, $pose, $tactic, $club, $inf); $active_dice = rand(0, 99); if ($active_dice < $active_obbs + $active_r) { include_once GAME_ROOT . './include/game/battle.func.php'; findenemy($edata); return; } else { include_once GAME_ROOT . './include/game/combat.func.php'; combat($edata, 0); return; } } } } else { $corpse_dice = rand(0, 99); if ($corpse_dice < $corpse_obbs) { if ($gamestate < 40 && ($edata['weps'] && $edata['wepe'] || $edata['arbs'] && $edata['arbe'] || $edata['arhs'] || $edata['aras'] || $edata['arfs'] || $edata['arts'] || $edata['itms0'] || $edata['itms1'] || $edata['itms2'] || $edata['itms3'] || $edata['itms4'] || $edata['itms5'] || $edata['money'])) { include_once GAME_ROOT . './include/game/battle.func.php'; findcorpse($edata); return; } else { discover(50); return; } } } } $log .= '似乎有什么人潜藏着┅┅士兵吗?<br>'; $mode = 'command'; return; } else { $find_r = get_find_r($weather, $pls, $pose, $tactic, $club, $inf); $find_obbs = $item_obbs + $find_r; $item_dice = rand(0, 99); if ($item_dice < $find_obbs) { $mapfile = GAME_ROOT . "./gamedata/mapitem/{$pls}mapitem.php"; $mapitem = openfile($mapfile); $itemnum = sizeof($mapitem) - 1; if ($itemnum <= 0) { $log .= "这里似乎什么都没有了。<br>"; $mode = 'command'; return; } $itemno = rand(1, $itemnum); global $itm0, $itmk0, $itme0, $itms0, $itmsk0; list($itm0, $itmk0, $itme0, $itms0, $itmsk0) = explode(',', $mapitem[$itemno]); array_splice($mapitem, $itemno, 1); writeover($mapfile, implode('', $mapitem), 'wb'); unset($mapitem); if ($itms0) { include_once GAME_ROOT . './include/game/itemmain.func.php'; itemfind(); return; } else { $log .= "但是什么都没有发现。<br>"; } } else { $log .= "但是什么都没有发现。<br>"; } } $mode = 'command'; return; }