Exemple #1
0
    $PHP_OUTPUT .= '</th>';
    setCategories($container, 'scout_drones', $category, $categorySQL, $subcategory);
    $PHP_OUTPUT .= '<th>';
    $PHP_OUTPUT .= create_header_link($container, 'Scout Drones');
    $PHP_OUTPUT .= '</th>';
    setCategories($container, 'mines', $category, $categorySQL, $subcategory);
    $PHP_OUTPUT .= '<th>';
    $PHP_OUTPUT .= create_header_link($container, 'Mines');
    $PHP_OUTPUT .= '</th>';
    setCategories($container, 'expire_time', $category, $categorySQL, $subcategory);
    $PHP_OUTPUT .= '<th>';
    $PHP_OUTPUT .= create_header_link($container, 'Expire time');
    $PHP_OUTPUT .= '</th>';
    $PHP_OUTPUT .= '</tr>';
    while ($db->nextRecord()) {
        $forces =& SmrForce::getForce($player->getGameID(), $db->getField('sector_id'), $db->getField('owner_id'));
        $PHP_OUTPUT .= '<tr>';
        $PHP_OUTPUT .= '<td>' . $forces->getOwner()->getLinkedDisplayName(false) . '</td>';
        $PHP_OUTPUT .= '<td class="shrink noWrap">' . $forces->getSectorID() . ' (' . $forces->getGalaxy()->getName() . ')</td>';
        $PHP_OUTPUT .= '<td class="shrink center">' . $forces->getCDs() . '</td>';
        $PHP_OUTPUT .= '<td class="shrink center">' . $forces->getSDs() . '</td>';
        $PHP_OUTPUT .= '<td class="shrink center">' . $forces->getMines() . '</td>';
        $PHP_OUTPUT .= '<td class="shrink noWrap">' . date(DATE_FULL_SHORT, $forces->getExpire()) . '</td>';
        $PHP_OUTPUT .= '</tr>';
    }
    $PHP_OUTPUT .= '</table>';
} else {
    $PHP_OUTPUT .= 'Your alliance has no deployed forces';
}
$PHP_OUTPUT .= '</div>';
function setCategories(&$container, $newCategory, $oldCategory, $oldCategorySQL, $subcategory)
$take_mines = round(isset($var['take_mines']) ? $var['take_mines'] : (isset($_REQUEST['take_mines']) ? trim($_REQUEST['take_mines']) : 0));
$take_combat_drones = round(isset($var['take_combat_drones']) ? $var['take_combat_drones'] : (isset($_REQUEST['take_combat_drones']) ? trim($_REQUEST['take_combat_drones']) : 0));
$take_scout_drones = round(isset($var['take_scout_drones']) ? $var['take_scout_drones'] : (isset($_REQUEST['take_scout_drones']) ? trim($_REQUEST['take_scout_drones']) : 0));
// do we have numbers?
if (!empty($drop_mines) && !is_numeric($drop_mines) || !empty($drop_combat_drones) && !is_numeric($drop_combat_drones) || !empty($drop_scout_drones) && !is_numeric($drop_scout_drones) || !empty($take_mines) && !is_numeric($take_mines) || !empty($take_combat_drones) && !is_numeric($take_combat_drones) || !empty($take_scout_drones) && !is_numeric($take_scout_drones)) {
    create_error('Only numbers as input allowed!');
}
// so how many forces do we take/add per type?
$change_mines = $drop_mines - $take_mines;
$change_combat_drones = $drop_combat_drones - $take_combat_drones;
$change_scout_drones = $drop_scout_drones - $take_scout_drones;
if ($sector->hasLocation()) {
    create_error('You can\'t drop forces in a sector with a location!');
}
require_once get_file_loc('SmrForce.class.inc');
$forces =& SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']);
// check max on that stack
if ($forces->getMines() + $change_mines > 50) {
    $change_mines = 50 - $forces->getMines();
    //	create_error('This stack can only take up to 50 mines!');
}
if ($forces->getCDs() + $change_combat_drones > 50) {
    $change_combat_drones = 50 - $forces->getCDs();
    //	create_error('This stack can only take up to 50 combat drones!');
}
if ($forces->getSDs() + $change_scout_drones > 5) {
    $change_scout_drones = 5 - $forces->getSDs();
    //	create_error('This stack can only take up to 5 scout drones!');
}
// Check if the delta is 0 after applying the caps, in case by applying the caps we actually changed it to 0.
if ($change_mines == 0 && $change_combat_drones == 0 && $change_scout_drones == 0) {
Exemple #3
0
<?php

$results = unserialize($var['results']);
$template->assignByRef('FullForceCombatResults', $results);
if ($var['owner_id'] > 0) {
    $template->assignByRef('Target', SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']));
}
if (isset($var['override_death'])) {
    $template->assign('OverrideDeath', true);
} else {
    $template->assign('OverrideDeath', false);
}
Exemple #4
0
<?php

if (isset($var['owner_id'])) {
    $owner =& SmrPlayer::getPlayer($var['owner_id'], $player->getGameID());
    $template->assign('PageTopic', 'Change ' . $owner->getPlayerName() . '\'s Forces');
    $owner_id = $var['owner_id'];
} else {
    $template->assign('PageTopic', 'Drop Forces');
    $owner_id = $player->getAccountID();
}
require_once get_file_loc('SmrForce.class.inc');
$forces =& SmrForce::getForce($player->getGameID(), $player->getSectorID(), $owner_id);
$container = array();
$container['url'] = 'forces_drop_processing.php';
$container['owner_id'] = $owner_id;
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= create_table();
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th align="center">Force</th>';
$PHP_OUTPUT .= '<th align="center">On Ship</th>';
$PHP_OUTPUT .= '<th align="center">In Sector</th>';
$PHP_OUTPUT .= '<th align="center">Drop</th>';
$PHP_OUTPUT .= '<th align="center">Take</th>';
$PHP_OUTPUT .= '</tr>';
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<td align="center">Mines</td>';
$PHP_OUTPUT .= '<td align="center">' . $ship->getMines() . '</td>';
$PHP_OUTPUT .= '<td align="center">' . $forces->getMines() . '</td>';
$PHP_OUTPUT .= '<td align="center"><input type="number" name="drop_mines" min="0" max="50" value="0" id="InputFields" style="width:100px;" class="center"></td>';
$PHP_OUTPUT .= '<td align="center"><input type="number" name="take_mines" min="0" max="50" value="0" id="InputFields" style="width:100px;" class="center"></td>';
$PHP_OUTPUT .= '</tr>';
Exemple #5
0
function clearCaches()
{
    SmrSector::clearCache();
    SmrPlayer::clearCache();
    SmrShip::clearCache();
    SmrForce::clearCache();
    SmrPort::clearCache();
}
        $curr_attacker->increaseExperience($attacker_damage * 0.05);
    } else {
        $attacker_msg[] = '<span style="color:yellow;">' . $curr_attacker->getPlayerName() . '</span> does absolutely no damage this round. Send the worthless lout back to the academy!';
    }
    $attacker_team_damage += $attacker_damage;
    $attacker_total_msg[] = $attacker_msg;
    //reset damage for each person and the array
    $attacker_damage = 0;
    $attacker_msg = array();
    $curr_attacker->update();
    $curr_attacker_ship->update_hardware();
}
// recalc forces expiration date
$forces->updateExpire();
// update forces
$forces->update();
// echo the overall damage
if ($attacker_team_damage > 0) {
    $attacker_msg[] = '<br>This team does a total of <span style="color:red;">$attacker_team_damage</span> damage in this round of combat.';
} else {
    $attacker_msg[] = '<br>This team does no damage at all. You call that a team? They need a better recruiter.';
}
$attacker_total_msg[] = $attacker_msg;
// info for the next page
$container['force_msg'] = $force_msg;
$container['attacker_total_msg'] = $attacker_total_msg;
transfer('owner_id');
SmrPlayer::refreshCache();
SmrShip::refreshCache();
SmrForce::refreshCache();
forward($container);