Exemple #1
0
 echo ',';
 $db2->query('SELECT * FROM location WHERE game_id = ' . $game_id . ' AND sector_id = ' . $id);
 $amount = 0;
 while ($db2->nextRecord()) {
     $loc_id = $db2->getField('location_type_id');
     $add = 'LOC' . $loc_id;
     if ($amount > 0) {
         echo '+';
     }
     echo $add;
     $amount += 1;
 }
 echo ',';
 $db2->query('SELECT * FROM planet WHERE game_id = ' . $game_id . ' AND sector_id = ' . $id);
 if ($db2->nextRecord()) {
     $planet =& SmrPlanet::getPlanet($game_id, $id);
     $level = $planet->getLevel();
     $owner = $planet->getOwnerID();
     $db2->query('SELECT * FROM player WHERE game_id = ' . $game_id . ' AND account_id = ' . $owner);
     $db2->nextRecord();
     $all_id = $db2->getField('alliance_id');
     if ($all_id > 0) {
         $db2->query('SELECT * FROM alliance WHERE game_id = ' . $game_id . ' AND alliance_id = ' . $all_id);
         $db2->nextRecord();
         $alliance = stripslashes($db2->getField('alliance_name'));
     } else {
         $alliance = 'None';
     }
     echo $level . ':' . $alliance;
 }
 echo EOL;
<?php

if (!isset($var['alliance_id'])) {
    SmrSession::updateVar('alliance_id', $player->getAllianceID());
}
$alliance =& SmrAlliance::getAlliance($var['alliance_id'], $player->getGameID());
$template->assign('PageTopic', $alliance->getAllianceName() . ' (' . $alliance->getAllianceID() . ')');
require_once get_file_loc('menu.inc');
create_alliance_menu($alliance->getAllianceID(), $alliance->getLeaderID());
// Ugly, but funtional
$db->query('
SELECT planet.sector_id
FROM player
JOIN planet ON player.game_id = planet.game_id AND player.account_id = planet.owner_id
WHERE player.game_id=' . $db->escapeNumber($alliance->getGameID()) . '
AND player.alliance_id=' . $db->escapeNumber($alliance->getAllianceID()) . '
ORDER BY planet.sector_id
');
$alliancePlanets = array();
while ($db->nextRecord()) {
    $sectorID = $db->getInt('sector_id');
    $alliancePlanets[$sectorID] =& SmrPlanet::getPlanet($player->getGameID(), $sectorID);
    $alliancePlanets[$sectorID]->getCurrentlyBuilding();
    //In case anything gets updated here we want to do it before template.
}
$template->assignByRef('AlliancePlanets', $alliancePlanets);
$isLeader = $player->getAccountID() == $alliance->getLeaderID();
$template->assignByRef('IsLeader', $isLeader);
Exemple #3
0
<?php

require_once get_file_loc('SmrPlanet.class.inc');
if (isset($var['results'])) {
    $results = unserialize($var['results']);
    $template->assignByRef('FullPlanetCombatResults', $results);
    $template->assign('AlreadyDestroyed', false);
} else {
    $template->assign('AlreadyDestroyed', true);
}
$template->assign('MinimalDisplay', false);
if (isset($var['override_death'])) {
    $template->assign('OverrideDeath', true);
} else {
    $template->assign('OverrideDeath', false);
}
$template->assignByRef('Planet', SmrPlanet::getPlanet($player->getGameID(), $var['sector_id']));
}
planetFires($fleet, $planet, $players);
fleetFires($fleet, $planet, $players, $weapons);
//get results in a way we want them
$results = processResults($players, $planet, $fleet, $weapons);
//post on alliances MB or send to player
planetDowngrade($results, $planet);
sendReport($results, $planet);
//log player
doLog($results);
//insert into combat logs
$db->query('SELECT alliance_id FROM player WHERE account_id = ' . $planet[OWNER] . ' AND game_id = ' . $player->getGameID() . ' LIMIT 1');
$db->next_record();
$ownerAlliance = $db->f('alliance_id');
$finalResults = $results[0] . '<br /><img src="images/planetAttack.jpg" alt="Planet Attack" title="Planet Attack"><br />' . $results[1];
$db->query('INSERT INTO combat_logs VALUES(\'\',' . SmrSession::$game_id . ',\'PLANET\',' . $player->getSectorID() . ',' . TIME . ',' . SmrSession::$account_id . ',' . $player->getAllianceID() . ',' . $planet[OWNER] . ',' . $ownerAlliance . ',' . $db->escapeBinary(gzcompress($finalResults)) . ', \'FALSE\')');
if (DEBUG) {
    $PHP_OUTPUT .= 'Pre Forward/Display<br>';
}
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'planet_attack.php';
$container['results'] = $results;
if ($players[$player->getAccountID()][KILLER]) {
    $container['override_death'] = TRUE;
}
$container['continue'] = checkContinue($players, $planet);
SmrPlayer::refreshCache();
SmrShip::refreshCache();
SmrPlanet::refreshCache();
forward($container);