function checkForShipUpgrade(AbstractSmrPlayer &$player) { global $SHIP_UPGRADE_PATH; foreach ($SHIP_UPGRADE_PATH[$player->getRaceID()] as $upgradeShipID) { if ($player->getShipTypeID() == $upgradeShipID) { //We can't upgrade, only downgrade. return false; } if ($upgradeShipID == SHIP_TYPE_NEWBIE_MERCHANT_VESSEL) { //We can't actually buy the NMV, we just don't want to downgrade from it if we have it. continue; } $cost = $player->getShip()->getCostToUpgrade($upgradeShipID); if ($cost <= 0 || $player->getCredits() - $cost > MINUMUM_RESERVE_CREDITS) { return doShipUpgrade($player, $upgradeShipID); } } debug('Could not find a ship on the upgrade path.'); return false; }
<tr> <td valign="top"<?php echo $Style; ?> ><?php echo $CurrentPlayer->getLevelName(); ?> <?php echo $CurrentPlayer->getDisplayName(); ?> </td> <td align="center"<?php echo $Style; ?> ><?php echo AbstractSmrPlayer::getColouredRaceNameOrDefault($CurrentPlayer->getRaceID(), $ThisPlayer); ?> </td> <td<?php echo $Style; ?> ><?php echo $CurrentPlayer->getAllianceName(); ?> </td> <td align="right"<?php echo $Style; ?> ><?php echo number_format($CurrentPlayer->getExperience()); ?>