We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -11,8 +11,7 @@ discard block |
||
| 11 | 11 | $action = $_REQUEST['action']; |
| 12 | 12 | if ($_REQUEST['save'] == 'Yes') { |
| 13 | 13 | $save = true; |
| 14 | -} |
|
| 15 | -else { |
|
| 14 | +} else { |
|
| 16 | 15 | $save = false; |
| 17 | 16 | } |
| 18 | 17 | |
@@ -42,8 +41,7 @@ discard block |
||
| 42 | 41 | $mines = $db2->getInt('sum_m'); |
| 43 | 42 | $cds = $db2->getInt('cds'); |
| 44 | 43 | $sds = $db2->getInt('sds'); |
| 45 | - } |
|
| 46 | - else { |
|
| 44 | + } else { |
|
| 47 | 45 | $mines = 0; |
| 48 | 46 | $cds = 0; |
| 49 | 47 | $sds = 0; |
@@ -143,16 +141,25 @@ discard block |
||
| 143 | 141 | $owner = $db->getInt('owner_id'); |
| 144 | 142 | |
| 145 | 143 | $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 1'); |
| 146 | - if ($db2->nextRecord()) $gens = $db2->getInt('amount'); |
|
| 147 | - else $gens = 0; |
|
| 144 | + if ($db2->nextRecord()) { |
|
| 145 | + $gens = $db2->getInt('amount'); |
|
| 146 | + } else { |
|
| 147 | + $gens = 0; |
|
| 148 | + } |
|
| 148 | 149 | |
| 149 | 150 | $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 2'); |
| 150 | - if ($db2->nextRecord()) $hangs = $db2->getInt('amount'); |
|
| 151 | - else $hangs = 0; |
|
| 151 | + if ($db2->nextRecord()) { |
|
| 152 | + $hangs = $db2->getInt('amount'); |
|
| 153 | + } else { |
|
| 154 | + $hangs = 0; |
|
| 155 | + } |
|
| 152 | 156 | |
| 153 | 157 | $db2->query('SELECT * FROM planet_has_building WHERE game_id = '.$game_id.' AND sector_id = '.$sector.' AND construction_id = 3'); |
| 154 | - if ($db2->nextRecord()) $turs = $db2->getInt('amount'); |
|
| 155 | - else $turs = 0; |
|
| 158 | + if ($db2->nextRecord()) { |
|
| 159 | + $turs = $db2->getInt('amount'); |
|
| 160 | + } else { |
|
| 161 | + $turs = 0; |
|
| 162 | + } |
|
| 156 | 163 | |
| 157 | 164 | // insert into history db |
| 158 | 165 | $history_db_sql[] = 'INSERT INTO planet (game_id, sector_id, owner_id, generators, hangers, turrets) VALUES ' . |
@@ -189,14 +196,21 @@ discard block |
||
| 189 | 196 | $smrCredits = 0; |
| 190 | 197 | $db2->query('SELECT sum(amount) as bounty_am, sum(smr_credits) as bounty_cred FROM bounty WHERE game_id = '.$game_id.' AND account_id = '.$acc_id.' AND claimer_id = 0'); |
| 191 | 198 | if ($db2->nextRecord()) { |
| 192 | - if (is_int($db2->getField('bounty_am'))) $amount = $db2->getInt('bounty_am'); |
|
| 193 | - if (is_int($db2->getField('bounty_cred'))) $smrCredits = $db2->getInt('bounty_cred'); |
|
| 199 | + if (is_int($db2->getField('bounty_am'))) { |
|
| 200 | + $amount = $db2->getInt('bounty_am'); |
|
| 201 | + } |
|
| 202 | + if (is_int($db2->getField('bounty_cred'))) { |
|
| 203 | + $smrCredits = $db2->getInt('bounty_cred'); |
|
| 204 | + } |
|
| 194 | 205 | |
| 195 | 206 | } |
| 196 | 207 | |
| 197 | 208 | $db2->query('SELECT * FROM ship_has_name WHERE game_id = '.$game_id.' AND account_id = '.$acc_id); |
| 198 | - if ($db2->nextRecord()) $ship_name = $db2->getField('ship_name'); |
|
| 199 | - else $ship_name = 'None'; |
|
| 209 | + if ($db2->nextRecord()) { |
|
| 210 | + $ship_name = $db2->getField('ship_name'); |
|
| 211 | + } else { |
|
| 212 | + $ship_name = 'None'; |
|
| 213 | + } |
|
| 200 | 214 | |
| 201 | 215 | // insert into history db |
| 202 | 216 | $history_db_sql[] = 'INSERT INTO player (account_id, game_id, player_name, player_id, experience, ship, race, alignment, alliance_id, kills, deaths, bounty, bounty_cred, ship_name) ' . |
@@ -244,9 +258,15 @@ discard block |
||
| 244 | 258 | $mines = $db2->getInt('sum_mines'); |
| 245 | 259 | $cds = $db2->getInt('cds'); |
| 246 | 260 | $sds = $db2->getInt('sds'); |
| 247 | - if (!is_numeric($mines)) $mines = 0; |
|
| 248 | - if (!is_numeric($cds)) $cds = 0; |
|
| 249 | - if (!is_numeric($sds)) $sds = 0; |
|
| 261 | + if (!is_numeric($mines)) { |
|
| 262 | + $mines = 0; |
|
| 263 | + } |
|
| 264 | + if (!is_numeric($cds)) { |
|
| 265 | + $cds = 0; |
|
| 266 | + } |
|
| 267 | + if (!is_numeric($sds)) { |
|
| 268 | + $sds = 0; |
|
| 269 | + } |
|
| 250 | 270 | |
| 251 | 271 | } else { |
| 252 | 272 | |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | echo $CombatPlanet->getDisplayName(); |
| 6 | 6 | if($TotalDamage > 0) { |
| 7 | 7 | ?> hit for a total of <span class="red"><?php echo $TotalDamage; ?></span> damage in this round of combat of which <span class="red"><?php echo $PlanetCombatResults['TotalDamagePerTargetPlayer'][$ThisPlayer->getAccountID()]; ?></span> was done to you<?php |
| 8 | - } |
|
| 9 | - else { |
|
| 8 | + } else { |
|
| 10 | 9 | ?> does no damage this round<?php |
| 11 | 10 | } ?>. <?php echo $AttackLogLink; |
| 12 | 11 | return; |
@@ -23,24 +22,19 @@ discard block |
||
| 23 | 22 | if (!$ShotHit || !$ActualDamage['TargetAlreadyDead']) { |
| 24 | 23 | if(!$ShotHit) { |
| 25 | 24 | ?> and misses<?php |
| 26 | - } |
|
| 27 | - else if($ActualDamage['TotalDamage'] == 0) { |
|
| 25 | + } else if($ActualDamage['TotalDamage'] == 0) { |
|
| 28 | 26 | if($WeaponDamage['Shield'] > 0) { |
| 29 | 27 | if($ActualDamage['HasCDs']) { |
| 30 | 28 | ?> which proves ineffective against their combat drones<?php |
| 31 | - } |
|
| 32 | - else { |
|
| 29 | + } else { |
|
| 33 | 30 | ?> which washes harmlessly over their hull<?php |
| 34 | 31 | } |
| 35 | - } |
|
| 36 | - else if($WeaponDamage['Armour'] > 0) { |
|
| 32 | + } else if($WeaponDamage['Armour'] > 0) { |
|
| 37 | 33 | ?> which is deflected by their shields<?php |
| 38 | - } |
|
| 39 | - else { |
|
| 34 | + } else { |
|
| 40 | 35 | ?> but it cannot do any damage<?php |
| 41 | 36 | } |
| 42 | - } |
|
| 43 | - else { |
|
| 37 | + } else { |
|
| 44 | 38 | ?> destroying <?php |
| 45 | 39 | $DamageTypes = 0; |
| 46 | 40 | if($ActualDamage['Shield'] > 0){ $DamageTypes = $DamageTypes+1; } |
@@ -79,27 +73,22 @@ discard block |
||
| 79 | 73 | echo $CombatPlanet->getDisplayName(); |
| 80 | 74 | if($WeaponDamage['Launched'] == 0) { |
| 81 | 75 | ?> fails to launch it's combat drones<?php |
| 82 | - } |
|
| 83 | - else { |
|
| 76 | + } else { |
|
| 84 | 77 | ?> launches <span class="cds"><?php echo $WeaponDamage['Launched'] ?></span> combat drones at <?php if($ActualDamage['TargetAlreadyDead']){ ?>the debris that was once <?php } echo $TargetPlayer->getDisplayName(); |
| 85 | 78 | if(!$ActualDamage['TargetAlreadyDead']) { |
| 86 | 79 | if($ActualDamage['TotalDamage'] == 0) { |
| 87 | 80 | if($WeaponDamage['Shield'] > 0) { |
| 88 | 81 | if($ActualDamage['HasCDs']) { |
| 89 | 82 | ?> which prove ineffective against their combat drones<?php |
| 90 | - } |
|
| 91 | - else { |
|
| 83 | + } else { |
|
| 92 | 84 | ?> which washes harmlessly over their hull<?php |
| 93 | 85 | } |
| 94 | - } |
|
| 95 | - else if($WeaponDamage['Armour'] > 0) { |
|
| 86 | + } else if($WeaponDamage['Armour'] > 0) { |
|
| 96 | 87 | ?> which is deflected by their shields<?php |
| 97 | - } |
|
| 98 | - else { |
|
| 88 | + } else { |
|
| 99 | 89 | ?> but they cannot do any damage<?php |
| 100 | 90 | } |
| 101 | - } |
|
| 102 | - else { |
|
| 91 | + } else { |
|
| 103 | 92 | ?> destroying <?php |
| 104 | 93 | if($ActualDamage['Shield'] > 0) { |
| 105 | 94 | ?><span class="shields"><?php echo number_format($ActualDamage['Shield']); ?></span> shields<?php |
@@ -124,7 +113,6 @@ discard block |
||
| 124 | 113 | echo $CombatPlanet->getDisplayName(); |
| 125 | 114 | if($TotalDamage > 0) { |
| 126 | 115 | ?> hit for a total of <span class="red"><?php echo $TotalDamage; ?></span> damage in this round of combat<?php |
| 127 | -} |
|
| 128 | -else { |
|
| 116 | +} else { |
|
| 129 | 117 | ?> does no damage this round. You call that a planet? It needs a better builder<?php |
| 130 | 118 | } ?>. |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | } elseif ($showBold) { |
| 63 | 63 | $style = 'class="bold"'; |
| 64 | 64 | } |
| 65 | - } |
|
| 66 | - else { |
|
| 65 | + } else { |
|
| 67 | 66 | $db2->query('SELECT kills FROM alliance_vs_alliance |
| 68 | 67 | WHERE alliance_id_2 = ' . $db2->escapeNumber($curr_id) . ' |
| 69 | 68 | AND alliance_id_1 = ' . $db2->escapeNumber($id) . ' |
@@ -104,11 +103,15 @@ discard block |
||
| 104 | 103 | if ($id > 0) { |
| 105 | 104 | $killer_alliance = SmrAlliance::getAlliance($id, $player->getGameID()); |
| 106 | 105 | $alliance_name = $killer_alliance->getAllianceDisplayName(); |
| 106 | + } elseif ($id == 0) { |
|
| 107 | + $alliance_name = 'No Alliance'; |
|
| 108 | + } elseif ($id == ALLIANCE_VS_FORCES) { |
|
| 109 | + $alliance_name = '<span class="yellow">Forces</span>'; |
|
| 110 | + } elseif ($id == ALLIANCE_VS_PLANETS) { |
|
| 111 | + $alliance_name = '<span class="yellow">Planets</span>'; |
|
| 112 | + } elseif ($id == ALLIANCE_VS_PORTS) { |
|
| 113 | + $alliance_name = '<span class="yellow">Ports</span>'; |
|
| 107 | 114 | } |
| 108 | - elseif ($id == 0) $alliance_name = 'No Alliance'; |
|
| 109 | - elseif ($id == ALLIANCE_VS_FORCES) $alliance_name = '<span class="yellow">Forces</span>'; |
|
| 110 | - elseif ($id == ALLIANCE_VS_PLANETS) $alliance_name = '<span class="yellow">Planets</span>'; |
|
| 111 | - elseif ($id == ALLIANCE_VS_PORTS) $alliance_name = '<span class="yellow">Ports</span>'; |
|
| 112 | 115 | |
| 113 | 116 | $kills[] = [ |
| 114 | 117 | 'Name' => $alliance_name, |
@@ -126,11 +129,15 @@ discard block |
||
| 126 | 129 | if ($id > 0) { |
| 127 | 130 | $killer_alliance = SmrAlliance::getAlliance($id, $player->getGameID()); |
| 128 | 131 | $alliance_name = $killer_alliance->getAllianceDisplayName(); |
| 132 | + } elseif ($id == 0) { |
|
| 133 | + $alliance_name = 'No Alliance'; |
|
| 134 | + } elseif ($id == ALLIANCE_VS_FORCES) { |
|
| 135 | + $alliance_name = '<span class="yellow">Forces</span>'; |
|
| 136 | + } elseif ($id == ALLIANCE_VS_PLANETS) { |
|
| 137 | + $alliance_name = '<span class="yellow">Planets</span>'; |
|
| 138 | + } elseif ($id == ALLIANCE_VS_PORTS) { |
|
| 139 | + $alliance_name = '<span class="yellow">Ports</span>'; |
|
| 129 | 140 | } |
| 130 | - elseif ($id == 0) $alliance_name = 'No Alliance'; |
|
| 131 | - elseif ($id == ALLIANCE_VS_FORCES) $alliance_name = '<span class="yellow">Forces</span>'; |
|
| 132 | - elseif ($id == ALLIANCE_VS_PLANETS) $alliance_name = '<span class="yellow">Planets</span>'; |
|
| 133 | - elseif ($id == ALLIANCE_VS_PORTS) $alliance_name = '<span class="yellow">Ports</span>'; |
|
| 134 | 141 | |
| 135 | 142 | $deaths[] = [ |
| 136 | 143 | 'Name' => $alliance_name, |
@@ -34,8 +34,7 @@ |
||
| 34 | 34 | $account->log(LOG_TYPE_PLANETS, 'Player takes ' . $amount . ' ' . Globals::getGoodName($var['good_id']) . ' from planet.', $player->getSectorID()); |
| 35 | 35 | |
| 36 | 36 | // transfer to planet |
| 37 | -} |
|
| 38 | -elseif ($action == 'Planet') { |
|
| 37 | +} elseif ($action == 'Planet') { |
|
| 39 | 38 | // do we want transfer more than we have? |
| 40 | 39 | if ($amount > $ship->getCargo($var['good_id'])) { |
| 41 | 40 | create_error('You can\'t store more than you carry!'); |
@@ -38,8 +38,7 @@ discard block |
||
| 38 | 38 | $planet->decreaseShields($amount); |
| 39 | 39 | $ship->increaseShields($amount); |
| 40 | 40 | $account->log(LOG_TYPE_PLANETS, 'Player takes ' . $amount . ' shields from planet.', $player->getSectorID()); |
| 41 | - } |
|
| 42 | - else if ($type_id == HARDWARE_COMBAT) { |
|
| 41 | + } else if ($type_id == HARDWARE_COMBAT) { |
|
| 43 | 42 | // do we want transfer more than we have? |
| 44 | 43 | if ($amount > $planet->getCDs()) { |
| 45 | 44 | create_error('You can\'t take more drones from planet than are on it!'); |
@@ -54,8 +53,7 @@ discard block |
||
| 54 | 53 | $planet->decreaseCDs($amount); |
| 55 | 54 | $ship->increaseCDs($amount); |
| 56 | 55 | $account->log(LOG_TYPE_PLANETS, 'Player takes ' . $amount . ' drones from planet.', $player->getSectorID()); |
| 57 | - } |
|
| 58 | - else if ($type_id == HARDWARE_ARMOUR) { |
|
| 56 | + } else if ($type_id == HARDWARE_ARMOUR) { |
|
| 59 | 57 | // do we want transfer more than we have? |
| 60 | 58 | if ($amount > $planet->getArmour()) { |
| 61 | 59 | create_error('You can\'t take more armour from planet than are on it!'); |
@@ -72,8 +70,7 @@ discard block |
||
| 72 | 70 | $account->log(LOG_TYPE_PLANETS, 'Player takes ' . $amount . ' armour from planet.', $player->getSectorID()); |
| 73 | 71 | } |
| 74 | 72 | |
| 75 | -} |
|
| 76 | -elseif ($action == 'Planet') { |
|
| 73 | +} elseif ($action == 'Planet') { |
|
| 77 | 74 | // does the user wants to transfer shields? |
| 78 | 75 | if ($type_id == HARDWARE_SHIELDS) { |
| 79 | 76 | // do we want transfer more than we have? |
@@ -91,8 +88,7 @@ discard block |
||
| 91 | 88 | $ship->decreaseShields($amount); |
| 92 | 89 | $account->log(LOG_TYPE_PLANETS, 'Player puts ' . $amount . ' shields on planet.', $player->getSectorID()); |
| 93 | 90 | // does the user wants to transfer drones? |
| 94 | - } |
|
| 95 | - else if ($type_id == HARDWARE_COMBAT) { |
|
| 91 | + } else if ($type_id == HARDWARE_COMBAT) { |
|
| 96 | 92 | // do we want transfer more than we have? |
| 97 | 93 | if ($amount > $ship->getCDs()) { |
| 98 | 94 | create_error('You can\'t transfer more combat drones than you carry!'); |
@@ -126,9 +122,9 @@ discard block |
||
| 126 | 122 | $account->log(LOG_TYPE_PLANETS, 'Player puts ' . $amount . ' armour on planet.', $player->getSectorID()); |
| 127 | 123 | } |
| 128 | 124 | |
| 129 | -} |
|
| 130 | -else |
|
| 125 | +} else { |
|
| 131 | 126 | create_error('You must choose if you want to transfer to planet or to the ship!'); |
| 127 | +} |
|
| 132 | 128 | |
| 133 | 129 | $ship->removeUnderAttack(); |
| 134 | 130 | |
@@ -129,8 +129,7 @@ discard block |
||
| 129 | 129 | if ($change_combat_drones > 0) { |
| 130 | 130 | $ship->decreaseCDs($change_combat_drones, true); |
| 131 | 131 | $forces->addCDs($change_combat_drones); |
| 132 | - } |
|
| 133 | - else { |
|
| 132 | + } else { |
|
| 134 | 133 | $ship->increaseCDs(-$change_combat_drones, true); |
| 135 | 134 | $forces->takeCDs(-$change_combat_drones); |
| 136 | 135 | } |
@@ -140,8 +139,7 @@ discard block |
||
| 140 | 139 | if ($change_scout_drones > 0) { |
| 141 | 140 | $ship->decreaseSDs($change_scout_drones); |
| 142 | 141 | $forces->addSDs($change_scout_drones); |
| 143 | - } |
|
| 144 | - else { |
|
| 142 | + } else { |
|
| 145 | 143 | $ship->increaseSDs(-$change_scout_drones); |
| 146 | 144 | $forces->takeSDs(-$change_scout_drones); |
| 147 | 145 | } |
@@ -155,8 +153,7 @@ discard block |
||
| 155 | 153 | $ship->decloak(); |
| 156 | 154 | $player->giveTurns(1); |
| 157 | 155 | } |
| 158 | - } |
|
| 159 | - else { |
|
| 156 | + } else { |
|
| 160 | 157 | $ship->increaseMines(-$change_mines); |
| 161 | 158 | $forces->takeMines(-$change_mines); |
| 162 | 159 | } |
@@ -191,8 +188,7 @@ discard block |
||
| 191 | 188 | $scout_drones_message = 'added '; |
| 192 | 189 | } |
| 193 | 190 | $scout_drones_message .= $change_scout_drones . ' scout drone'; |
| 194 | - } |
|
| 195 | - elseif ($change_scout_drones < 0) { |
|
| 191 | + } elseif ($change_scout_drones < 0) { |
|
| 196 | 192 | $scout_drones_message = ''; |
| 197 | 193 | if ((isset($combat_drones_message) && $change_combat_drones > 0) || (!isset($combat_drones_message) && $change_mines >= 0)) { |
| 198 | 194 | $scout_drones_message = 'removed '; |
@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | //The player is sent here after trading and sees this if his offer is accepted. |
| 25 | 25 | if (!empty($var['trade_msg'])) { |
| 26 | 26 | $template->assign('TradeMsg', $var['trade_msg']); |
| 27 | -} |
|
| 28 | -elseif ($player->getLastPort() != $player->getSectorID()) { |
|
| 27 | +} elseif ($player->getLastPort() != $player->getSectorID()) { |
|
| 29 | 28 | // test if we are searched, but only if we hadn't a previous trade here |
| 30 | 29 | |
| 31 | 30 | $base_chance = 15; |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | $player->setBank(5000); |
| 73 | 72 | } |
| 74 | 73 | } |
| 75 | - } |
|
| 76 | - else { |
|
| 74 | + } else { |
|
| 77 | 75 | $player->decreaseCredits($fine); |
| 78 | 76 | } |
| 79 | 77 | |
@@ -85,8 +83,7 @@ discard block |
||
| 85 | 83 | $ship->setCargo(GOODS_NARCOTICS, 0); |
| 86 | 84 | $account->log(LOG_TYPE_TRADING, 'Player gets caught with illegals', $player->getSectorID()); |
| 87 | 85 | |
| 88 | - } |
|
| 89 | - else { |
|
| 86 | + } else { |
|
| 90 | 87 | $template->assign('IllegalsFound', false); |
| 91 | 88 | $player->increaseHOF(1, array('Trade', 'Search', 'Times Found Innocent'), HOF_PUBLIC); |
| 92 | 89 | $player->increaseAlignment(1); |
@@ -32,11 +32,16 @@ discard block |
||
| 32 | 32 | $ship->increaseHardware($hardware_id, $amount); |
| 33 | 33 | |
| 34 | 34 | //HoF |
| 35 | - if ($hardware_id == HARDWARE_COMBAT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE); |
|
| 36 | - if ($hardware_id == HARDWARE_SCOUT) $player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE); |
|
| 37 | - if ($hardware_id == HARDWARE_MINE) $player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE); |
|
| 38 | -} |
|
| 39 | -else if ($action == 'Sell') { |
|
| 35 | + if ($hardware_id == HARDWARE_COMBAT) { |
|
| 36 | + $player->increaseHOF($amount, array('Forces', 'Bought', 'Combat Drones'), HOF_ALLIANCE); |
|
| 37 | + } |
|
| 38 | + if ($hardware_id == HARDWARE_SCOUT) { |
|
| 39 | + $player->increaseHOF($amount, array('Forces', 'Bought', 'Scout Drones'), HOF_ALLIANCE); |
|
| 40 | + } |
|
| 41 | + if ($hardware_id == HARDWARE_MINE) { |
|
| 42 | + $player->increaseHOF($amount, array('Forces', 'Bought', 'Mines'), HOF_ALLIANCE); |
|
| 43 | + } |
|
| 44 | + } else if ($action == 'Sell') { |
|
| 40 | 45 | // We only allow selling combat drones |
| 41 | 46 | if ($hardware_id != HARDWARE_COMBAT) { |
| 42 | 47 | throw new Exception('This item cannot be sold!'); |
@@ -49,8 +54,7 @@ discard block |
||
| 49 | 54 | |
| 50 | 55 | $player->increaseCredits(IRound($cost * CDS_REFUND_PERCENT) * $amount); |
| 51 | 56 | $ship->decreaseCDs($amount, true); // 2nd arg avoids under attack warning |
| 52 | -} |
|
| 53 | -else { |
|
| 57 | +} else { |
|
| 54 | 58 | throw new Exception('Action must be either Buy or Sell.'); |
| 55 | 59 | } |
| 56 | 60 | |
@@ -58,10 +58,14 @@ discard block |
||
| 58 | 58 | // get relations for us (global + personal) |
| 59 | 59 | $relations = $player->getRelation($port->getRaceID()); |
| 60 | 60 | |
| 61 | -if (!isset($var['ideal_price'])) SmrSession::updateVar('ideal_price', $port->getIdealPrice($good_id, $transaction, $amount, $relations)); |
|
| 61 | +if (!isset($var['ideal_price'])) { |
|
| 62 | + SmrSession::updateVar('ideal_price', $port->getIdealPrice($good_id, $transaction, $amount, $relations)); |
|
| 63 | +} |
|
| 62 | 64 | $ideal_price = $var['ideal_price']; |
| 63 | 65 | |
| 64 | -if (!isset($var['offered_price'])) SmrSession::updateVar('offered_price', $port->getOfferPrice($ideal_price, $relations, $transaction)); |
|
| 66 | +if (!isset($var['offered_price'])) { |
|
| 67 | + SmrSession::updateVar('offered_price', $port->getOfferPrice($ideal_price, $relations, $transaction)); |
|
| 68 | +} |
|
| 65 | 69 | $offered_price = $var['offered_price']; |
| 66 | 70 | |
| 67 | 71 | // nothing should happen here but just to avoid / by 0 |
@@ -120,8 +124,7 @@ discard block |
||
| 120 | 124 | $player->increaseHOF($bargain_price, array('Trade', 'Money', 'Buying'), HOF_PUBLIC); |
| 121 | 125 | $port->buyGoods($portGood, $amount, $ideal_price, $bargain_price, $gained_exp); |
| 122 | 126 | $player->increaseRelationsByTrade($amount, $port->getRaceID()); |
| 123 | - } |
|
| 124 | - elseif ($transaction == 'Sell') { |
|
| 127 | + } elseif ($transaction == 'Sell') { |
|
| 125 | 128 | $msg_transaction = 'sold'; |
| 126 | 129 | $ship->decreaseCargo($good_id, $amount); |
| 127 | 130 | $player->increaseCredits($bargain_price); |
@@ -131,8 +134,7 @@ discard block |
||
| 131 | 134 | $player->increaseHOF($bargain_price, array('Trade', 'Money', 'Selling'), HOF_PUBLIC); |
| 132 | 135 | $port->sellGoods($portGood, $amount, $ideal_price, $bargain_price, $gained_exp); |
| 133 | 136 | $player->increaseRelationsByTrade($amount, $port->getRaceID()); |
| 134 | - } |
|
| 135 | - elseif ($transaction == 'Steal') { |
|
| 137 | + } elseif ($transaction == 'Steal') { |
|
| 136 | 138 | $msg_transaction = 'stolen'; |
| 137 | 139 | $ship->increaseCargo($good_id, $amount); |
| 138 | 140 | $player->increaseHOF($amount, array('Trade', 'Goods', 'Stolen'), HOF_ALLIANCE); |
@@ -168,8 +170,7 @@ discard block |
||
| 168 | 170 | $container['body'] = 'shop_goods.php'; |
| 169 | 171 | } |
| 170 | 172 | |
| 171 | -} |
|
| 172 | -else { |
|
| 173 | +} else { |
|
| 173 | 174 | // does the trader try to outsmart us? |
| 174 | 175 | $container = create_container('skeleton.php', 'shop_goods_trade.php'); |
| 175 | 176 | transfer('ideal_price'); |