add_item($char_id, 'ginsengroot', 4); } else { $oni_killed = false; } } } else { $oni_killed = false; } $npc_template = 'npc.oni.tpl'; $combat_data = array('victory' => $oni_killed); } elseif (array_key_exists($victim, $npcs)) { /**** Abstracted NPCs *****/ $npc_stats = $npcs[$victim]; // Pull an npcs individual stats with generic fallbacks. /* ============= STANDARD NPCS ======================= */ $npco = new Npc($npc_stats); // Construct the npc object. $display_name = first_value(@$npc_stats['name'], ucfirst($victim)); $max_damage = $npco->max_damage(); $percent_damage = null; // Percent damage does to the player's health. $status_effect = whichever(@$npc_stats['status'], null); $reward_item = first_value(@$npc_stats['item'], null); $base_gold = $npco->gold(); $npc_gold = (int) @$npc_stats['gold']; $is_quick = $npco->speed() > $player->speed() ? true : false; // Beyond basic speed and they see you coming, so show that message. // If npc gold explicitly set to 0, then none will be given. $reward_gold = $npc_gold === 0 ? 0 : ($reward_item ? round($base_gold * 0.9) : $base_gold); // Hack a little off reward gold if items received. $bounty_mod = @$npc_stats['bounty'];
</tr> </table> </td>'; $i__0++; if ($i__0 == 4) { echo '</tr><tr>'; $i__0 = 0; } $num++; } } while ($i__0 < 4) { echo '<td> </td>'; $i__0++; } echo '</tr></table>'; } // Покажем ботов $result = myquery("SELECT game_npc.id FROM game_npc,game_npc_template WHERE game_npc.map_name ='" . $char['map_name'] . "' AND game_npc.xpos ='" . $char['map_xpos'] . "' AND game_npc.ypos ='" . $char['map_ypos'] . "' AND (game_npc.time_kill+game_npc_template.respawn)<unix_timestamp() AND game_npc.npc_id=game_npc_template.npc_id ORDER BY game_npc_template.npc_level ASC"); if (mysql_num_rows($result) > 0) { echo '<table cellpadding="2" cellspacing="0" border="0"><tr>'; while ($npc = mysql_fetch_array($result)) { $NPC_object = new Npc($npc['id']); $NPC_object->show_around(); } echo '</tr></table>'; } } if (function_exists("save_debug")) { save_debug(); }
private function kill_user($kto, $kogo) { if ($this->all[$kogo]['npc'] == 1) { $Npc = new Npc($kogo); //АЙ-АЙ-ЯЙ... УБИЛИ БОТА....НИ ЗА ЧТО ЗАМОЧИЛИ.... if ($Npc->templ['npc_id'] == npc_id_nechto) { $mas = array(); foreach ($this->all as $key => $value) { if ($this->all[$key]['npc'] == 0) { for ($j = $this->all[$key]['hod_start']; $j <= $this->combat['hod']; $j++) { $mas[] = $key; if ($key == $kto) { $mas[] = $key; } } } } if (sizeof($mas) > 0) { $user_loot = $mas[mt_rand(0, sizeof($mas) - 1)]; } else { $user_loot = $kto; } $Npc->drop_loot($user_loot); $say = 'В Средиземье (' . $this->combat['map_xpos'] . ',' . $this->combat['map_ypos'] . ') было повержено [b]НЕЧТО[/b]. Имя героя, одолевшего этого монстра - [color=yellow][b]' . $this->all[$kto]['name'] . '![/b][/color]. Слава герою!!!'; $say = iconv("Windows-1251", "UTF-8//IGNORE", "<span style=\"font-style:italic;font-size:12px;color:gold;font-family:Verdana,Tahoma,Arial,Helvetica,sans-serif\">" . $say . "</b></span>"); myquery("INSERT INTO game_log (`message`,`date`,`fromm`) VALUES ('" . mysql_real_escape_string($say) . "'," . time() . ",-1)"); } else { $Npc->drop_loot($kto); $Npc->check_hunter($kto); $Npc->teleport($kto); } } //ВСЕ. КТО-ТО СЕЙЧАС СТАЛ ТРУПОМ. $this->user_dead($kogo, $kto); if ($this->all[$kto]['pol'] == 'female') { $this->log[$kto][]['action'] = 48; } else { $this->log[$kto][]['action'] = 49; } $index = sizeof($this->log[$kto]) - 1; $this->log[$kto][$index]['na_kogo'] = $kogo; $this->log[$kto][$index]['na_kogo_name'] = $this->all[$kogo]['name']; $this->log[$kto][$index]['name'] = $this->all[$kto]['name']; $this->log[$kto][$index]['mode'] = $kto; if ($this->all[$kto]['npc'] == 1 and $this->all[$kogo]['npc'] == 0) { //бот убил игрока if (function_exists("save_stat")) { save_stat($kogo, $kto, '', 2, '', '', '', '', '', '', '', ''); } } }
} else { setLocation('http://' . domain_name . '/act.php?func=boy'); } die; } } // Видимо тут уже игрок в игре if (defined("MODULE_ID")) { $result_func = checkFunc($user_id, MODULE_ID); if (!defined("NO_FUNC_CHECK")) { if ($result_func == 0) { $last_str = getRedirectFunc($user_id); setLocation('http://' . domain_name . '/' . $last_str . ''); die; } } } $map_name = $char['map_name']; $filelist = ",/combat.php,/arcomage.php,/chat/chat_online.php,/chat/chat_ajax.php,/combat/ajax.php,/chat/chat.php,/chat/chat_update.php,/admin.php,/lib/map_editor.php,/main.php,/lib/town.php,"; if (strpos($filelist, PHP_SELF) == false) { //сначала проверяем на автонападение ботов if ($char['func_id'] != func_craft and $char['func_id'] != func_combat and $char['func_id'] != func_arcomage and (close_combat != 1 or $user_id == 612) and $char['hide'] == 0) { $result = myquery("SELECT game_npc.id FROM game_npc,game_npc_template WHERE game_npc.npc_id=game_npc_template.npc_id AND game_npc.map_name =" . $char['map_name'] . " AND game_npc.xpos =" . $char['map_xpos'] . " AND game_npc.ypos =" . $char['map_ypos'] . " AND game_npc_template.agressive IN ('2','1') AND game_npc.time_kill+game_npc_template.respawn<UNIX_TIMESTAMP() AND (game_npc.for_user_id=0 OR game_npc.for_user_id={$user_id}) ORDER BY game_npc.HP"); if (mysql_num_rows($result) > 0) { while ($npc = mysql_fetch_array($result)) { $Npc = new Npc($npc['id']); $Npc->check_aggro($char); } } } }
function testGuardsThatMatchStrengthTakeEnemyStrength() { if (!DEBUG) { $this->markTestSkipped(); } $pc = new Player(); $pc->vo->strength = 100; $guard = new Npc('guard2'); $guard_strength = $guard->strength(); $guard_max_damage = $guard->max_damage(); $guard_with_enemy = new Npc('guard2'); $improved_dam = $guard_with_enemy->max_damage($pc); $this->assertTrue($guard->has_trait('partial_match_strength')); $this->assertGreaterThan(0, $guard_max_damage); $this->assertGreaterThan($guard_max_damage, $improved_dam, 'Guard damage should be higher with an enemy that has any strength'); }
if ($up['name'] != $char['name']) { $output_string .= '<tr><td><a href="?func=pm&pm=write&komu=' . $up["name"] . '">Послать сообщение</a></td></tr>'; } $num = 0; $map = mysql_fetch_array(myquery("SELECT * FROM game_maps WHERE id = '" . $char['map_name'] . "'")); //if ($char['MS_LEK']!='0' and ($up['func_id']!='1')) $output_string.='<tr><td><a href="?func=main&lek='.$up['user_id'].'">Лечить (Специализация '.$char['MS_LEK'].' уровня)</a></td></tr>'; //if ($char['MS_VOR']!='0') $output_string.='<tr><td><a href="?func=main&vor='.$up['name'].'">Воровство (Специализация '.$char['MS_VOR'].' уровня)</a></td></tr>'; $output_string .= '</table>'; } else { $output_string .= '<b><font face=verdana size=1 color=ff0000>Игрок перешел на другую гексу</font></b>'; } } if (isset($_GET['npc_info'])) { $npc_info = (int) $_GET['npc_info']; if ($npc_info > 0) { $Npc_object = new Npc($npc_info); $output_string .= $Npc_object->create_output(); } } /* if (!isset($npc_info) and !isset($menu) and !isset($errror) and !isset($lek) and !isset($vor)) { $result_battles = myquery("SELECT type, map_name, map_xpos, map_ypos, contents, post_time FROM game_battles WHERE attacker_id=$user_id ORDER BY post_time DESC LIMIT 5"); echo '5 последних боевых сообщений</font><br /><br /> <table cellpadding="0" cellspacing="5" border="0">'; if ($result_battles!=false AND mysql_num_rows($result_battles) > 0) { while ($battle = mysql_fetch_array($result_battles)) { echo '<tr><td><font color=#C0FFC0>'.date("H:i",$battle['post_time']).'</font></td><td>'.$battle['contents'].'</td></tr>'; }
if (function_exists("start_debug")) { start_debug(); } if (!empty($_GET['option'])) { if ($char['hide'] == 1) { if (function_exists("save_debug")) { save_debug(); } exit; } switch ($_GET['option']) { case 'npc': if (isset($_GET['id']) and is_numeric($_GET['id']) and $_GET['id'] > 0) { $current_time = time(); $online_range = $current_time; $Npc = new Npc($_GET['id']); if ($Npc->can_attack($char)) { if ($Npc->npc_for_level($char)) { //движок квестов. проверка на ненападение на квестового бота другим игроком во время квеста if ($Npc->npc['npc_quest_engine_id'] > 0) { list($fin_time) = mysql_fetch_array(myquery("SELECT quest_finish_time FROM quest_engine_users WHERE quest_type=1 AND par1_value='" . $id . "'")); if ($Npc->npc['npc_quest_engine_id'] != $user_id and $fin_time > time()) { if (function_exists("save_debug")) { save_debug(); } setLocation("act.php?func=main"); exit; } } attack_npc($char, $_GET['id'], 0); } else {