{ $furcount3a++; playerlog($playerinfo[player_id], LOG_FURANGEE_ATTACK, "$rowo3[character_name]"); furangeetoship($rowo3[player_id]); if ($furangeeisdead>0) { $res->MoveNext(); continue; } } } elseif ($playerinfo[aggression] == 2) // ****** O = 3 & AGRESSION = 2 ATTACK ALLWAYS ****** { $furcount3a++; playerlog($playerinfo[player_id], LOG_FURANGEE_ATTACK, "$rowo3[character_name]"); if (!$rowo3[planet_id] == 0) { // *** IS ON PLANET *** furangeetoplanet($rowo3[planet_id]); } else { furangeetoship($rowo3[player_id]); } if ($furangeeisdead>0) { $res->MoveNext(); continue; } } } } } // ********************************* // *** ORDERS = 4 SPECIAL TRADER *** // ********************************* elseif ($playerinfo[orders]==4)
function furangeehunter() { // ********************************* // *** SETUP GENERAL VARIABLES **** // ********************************* global $playerinfo; global $shipinfo; global $targetlink; global $furangeeisdead; global $db, $dbtables; $rescount = $db->Execute("SELECT COUNT(*) AS num_players FROM $dbtables[players] WHERE ship_destroyed='N' and email NOT LIKE '%@furangee' and player_id > 1"); $rowcount = $rescount->fields; echo "There are $rowcount[num_players] eligable players<br>"; $topnum = min(10,$rowcount[num_players]); //echo "Topnum = $topnum<br>"; //$topnum =1; // *** IF WE HAVE KILLED ALL THE PLAYERS IN THE GAME THEN THERE IS LITTLE POINT IN PROCEEDING *** if ($topnum<1) { echo "Furange have WON!!<br>"; return; } $res = $db->Execute("SELECT * FROM $dbtables[players] WHERE ship_destroyed='N' and email NOT LIKE '%@furangee' AND player_id > 1 ORDER BY score DESC LIMIT $topnum"); // *** LETS CHOOSE A TARGET FROM THE TOP PLAYER LIST *** $i=1; $targetnum=rand(1,$topnum); while (!$res->EOF) { if ($i==$targetnum) { $targetinfo=$res->fields; } $i++; $res->MoveNext(); } // *** Make sure we have a target *** if (!$targetinfo) { playerlog($playerinfo[player_id], LOG_RAW, "Hunt Failed: No Target "); echo "Hunt failed: No target<br>"; return; } else { echo "We have a target!<br>"; } // ********************************* // *** WORM HOLE TO TARGET SECTOR ** // ********************************* $sectres = $db->Execute ("SELECT sector_id,zone_id FROM $dbtables[universe] WHERE sector_id='$targetinfo[sector]'"); $sectrow = $sectres->fields; $zoneres = $db->Execute ("SELECT zone_id,allow_attack FROM $dbtables[zones] WHERE zone_id=$sectrow[zone_id]"); $zonerow = $zoneres->fields; // *** ONLY WORM HOLE TO TARGET IF WE CAN ATTACK IN TARGET SECTOR *** if ($zonerow[allow_attack]=="Y") { $stamp = date("Y-m-d H-i-s"); $query="UPDATE $dbtables[players] SET last_login='******', turns_used=turns_used+1 WHERE player_id=$playerinfo[player_id]"; $move_result = $db->Execute ("$query"); $db->Execute("UPDATE $dbtables[players] SET sector=$targetinfo[sector] WHERE player_id=$playerinfo[player_id]"); playerlog($playerinfo[player_id], LOG_RAW, "Furangee used a wormhole to warp to sector $targetinfo[sector] where he is hunting player $targetinfo[character_name]."); echo "Furangee used a wormhole to warp to sector $targetinfo[sector_id] where he is hunting player $targetinfo[character_name].<br>"; if (!$move_result) { $error = $db->ErrorMsg(); playerlog($playerinfo[player_id], LOG_RAW, "Move failed with error: $error "); echo "Move failed with error: $error<br> "; return; } // ********************************* // *** CHECK FOR SECTOR DEFENCE **** // ********************************* $resultf = $db->Execute ("SELECT * FROM $dbtables[sector_defence] WHERE sector_id=$targetinfo[sector_id] and defence_type ='F' ORDER BY quantity DESC"); $i = 0; $total_sector_fighters = 0; if($resultf > 0) { while(!$resultf->EOF) { $defences[$i] = $resultf->fields; $total_sector_fighters += $defences[$i]['quantity']; $i++; $resultf->MoveNext(); } } $resultm = $db->Execute ("SELECT * FROM $dbtables[sector_defence] WHERE sector_id=$targetinfo[sector_id] and defence_type ='M'"); $i = 0; $total_sector_mines = 0; if($resultm > 0) { while(!$resultm->EOF) { $defences[$i] = $resultm->fields; $total_sector_mines += $defences[$i]['quantity']; $i++; $resultm->MoveNext(); } } if ($total_sector_fighters>0 || $total_sector_mines>0 || ($total_sector_fighters>0 && $total_sector_mines>0)) //*** DEST LINK HAS DEFENCES *** { // *** ATTACK SECTOR DEFENCES *** $targetlink = $targetinfo[sector_id]; furangeetosecdef(); } if ($furangeeisdead>0) { // *** SECTOR DEFENSES KILLED US *** return; } // *** TIME TO ATTACK THE TARGET *** playerlog($playerinfo[player_id], LOG_RAW, "Furangee launching an attack on $targetinfo[character_name]."); echo "Furangee launching an attack on $targetinfo[character_name].<br>"; // *** SEE IF TARGET IS ON A PLANET *** if ($targetinfo[on_planet]=='Y') { // *** ON A PLANET *** furangeetoplanet($targetinfo[player_id]); } else { // *** NOT ON A PLANET *** furangeetoship($targetinfo[player_id]); } } else { playerlog($playerinfo[player_id], LOG_RAW, "Furangee hunt failed, target $targetinfo[character_name] was in a no attack zone (sector $targetinfo[sector])."); echo "Furangee hunt failed, target $targetinfo[character_name] was in a no attack zone (sector $targetinfo[sector]).<br>"; } }