//$lowerlimit= 3000; //$upperlimit= $lowerlimit+200; //if ($count > $upperlimit ) { // $delta= 3+(int)(($count-$upperlimit)/100); // $result = mysql_query("select id,location,user,name from players where $where order by rand() LIMIT $delta"); // while( $row = mysql_fetch_assoc($result) ){ // $mob = new character($row['id']); // $mob->kill_characterid(); // } //} //@$_COOKIE['_speed'] is just a HACK to speed up testing on my PC, which is very slow if ($count < $lowerlimit) { $n = ceil(sqrt($lowerlimit - $count) * 0.2 * (@$_COOKIE['_speed'] ? 0.5 : 1.0)); $n > 6 and $n = 6; for ($i = 0; $i < $n; ++$i) { npcgen(); } } if (@$_COOKIE['_timing']) { echo "time end pop control=" . endTiming() . "<br>\n"; } // move some NPC first $npctomov = @$_COOKIE['_speed'] ? 3 : 9; for ($i = 0; $i < $npctomov; $i++) { movenpc(); } if (@$_COOKIE['_timing']) { echo "time end pop movement=" . endTiming() . "<br>\n"; } updateshops(); if (@$_COOKIE['_timing']) {
$defender->hit_points = 0; } $_SESSION['disp_msg'][] = $lang_comb["kill_a"] . " " . $defender->name; if ($defender->id == $_SESSION['opponent_id']) { $_SESSION['opponent_id'] = 0; unset($_SESSION['opponent_id']); // clear current opp } $ret = $defender->kill_characterid(); if (DEBUG >= 1) { $_SESSION['disp_msg'][] = "**DEBUG: killing oppponent"; } // add monsters to replace dead one for ($i = 1; $i <= 2; $i++) { //FIXME: 2 monsters for now, but this WILL over populate! npcgen() and DEBUG and $_SESSION['disp_msg'][] = "**DEBUG: npcgen is success"; } //Receive Gold $_SESSION['gold_rec'] = $_SESSION['fightbonus'] * $defender->gold; $character->gold += $_SESSION['gold_rec']; $_SESSION['disp_msg'][] = "{$lang_fun['gai_gold']} {$_SESSION['gold_rec']}"; //Receive Experience $_SESSION['xp_rec'] = (int) ($defender->max_hp / 2 + $character->wisdom); $_SESSION['xp_rec'] *= $_SESSION['fightbonus']; $character->xp += $_SESSION['xp_rec']; $_SESSION['disp_msg'][] = "{$lang_fun['gai_xp']} {$_SESSION['xp_rec']}"; //Update Character rewards to the DataBase // $res=mysql_query("UPDATE players SET gold=".$character->gold.", xp=".$character->xp." WHERE id='$PHP_PHAOS_CHARID'"); $res = mysql_query($sql); if (!$res) { showError(__FILE__, __LINE__, __FUNCTION__);