예제 #1
0
$template->assign('PageTopic', 'Ship Dealer');
$db->query('SELECT ship_type_id FROM location
			JOIN location_sells_ships USING (location_type_id)
			WHERE sector_id = ' . $db->escapeNumber($player->getSectorID()) . '
				AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
				AND location_type_id = ' . $db->escapeNumber($var['LocationID']));
$shipsSold = array();
if ($db->getNumRows() > 0) {
    $container = create_container('skeleton.php', 'shop_ship.php');
    transfer('LocationID');
    while ($db->nextRecord()) {
        $shipTypeID = $db->getField('ship_type_id');
        $shipsSold[$shipTypeID] =& AbstractSmrShip::getBaseShip(Globals::getGameType($player->getGameID()), $shipTypeID);
        $container['ship_id'] = $shipTypeID;
        $container['level_needed'] = $shipsSold[$shipTypeID]['Level'];
        $shipsSoldHREF[$shipTypeID] = SmrSession::getNewHREF($container);
    }
}
$template->assign('ShipsSold', $shipsSold);
$template->assign('ShipsSoldHREF', $shipsSoldHREF);
if (isset($var['ship_id'])) {
    $compareShip = AbstractSmrShip::getBaseShip(Globals::getGameType($player->getGameID()), $var['ship_id']);
    $compareShip['RealSpeed'] = $compareShip['Speed'] * Globals::getGameSpeed($player->getGameID());
    $compareShip['Turns'] = round($player->getTurns() * $compareShip['Speed'] / $ship->getSpeed());
    $container = create_container('shop_ship_processing.php');
    transfer('LocationID');
    transfer('ship_id');
    $compareShip['BuyHREF'] = SmrSession::getNewHREF($container);
    $template->assign('CompareShip', $compareShip);
}
예제 #2
0
<?php

$shipID = $var['ship_id'];
$newShip =& AbstractSmrShip::getBaseShip(Globals::getGameType($player->getGameID()), $shipID);
$cost = $ship->getCostToUpgrade($shipID);
// trade master 33
// trip maker 30
//(22,25,23,75,43,55,61,24,21,38,67,33,49)
// Top racials minus ATM + top UG/FED are restricted
if ($newShip['AlignRestriction'] == 2 && $player->getAlignment() > -100) {
    create_error('You can\'t buy smuggler ships!');
}
if ($newShip['AlignRestriction'] == 1 && $player->getAlignment() < 100) {
    create_error('You can\'t buy federal ships!');
}
if ($newShip['RaceID'] != 1 && $player->getRaceID() != $newShip['RaceID']) {
    create_error('You can\'t buy other race\'s ships!');
}
/*if ($player->getAccountID() == 101)
	create_error('Cheaters do NOT get ships!');*/
// do we have enough cash?
if ($player->getCredits() < $cost) {
    create_error('You do not have enough cash to purchase this ship!');
}
// adapt turns
$player->setTurns(round($player->getTurns() * $newShip['Speed'] / $ship->getSpeed()));
//Don't times by game speed as getSpeed doesn't include it meaning ratio will be the same but less work.
// take the money from the user
if ($cost > 0) {
    $player->decreaseCredits($cost);
} else {
예제 #3
0
파일: npc.php 프로젝트: smrealms/smrv2.0
function doShipUpgrade(AbstractSmrPlayer &$player, $upgradeShipID)
{
    $plotNearest = plotToNearest($player, AbstractSmrShip::getBaseShip(Globals::getGameType($player->getGameID()), $upgradeShipID));
    if ($plotNearest == true) {
        //We're already there!
        //TODO: We're going to want to UNO after upgrading
        return create_container('shop_ship_processing.php', '', array('ship_id' => $upgradeShipID));
    }
    //Otherwise return the plot
    return $plotNearest;
}