Example #1
0
$resh = $db->Execute("UPDATE {$db->prefix}universe SET port_goods=port_goods+({$goods_rate}*{$multiplier}*{$port_regenrate}) WHERE port_type!='special' AND port_type!='none' AND port_goods<{$goods_limit}");
QUERYOK($resh);
echo "Ensuring minimum goods levels are 0...";
$resi = $db->Execute("UPDATE {$db->prefix}universe SET port_goods=0 WHERE port_goods<0");
QUERYOK($resi);
echo "<br>";
# Update Energy in Ports
echo "Adding energy to all commodities ports...";
$resj = $db->Execute("UPDATE {$db->prefix}universe SET port_energy=port_energy+({$energy_rate}*{$multiplier}*{$port_regenrate}) WHERE port_type='energy' AND port_energy<{$energy_limit}");
QUERYOK($resj);
echo "Adding energy to all energy ports...";
$resk = $db->Execute("UPDATE {$db->prefix}universe SET port_energy=port_energy+({$energy_rate}*{$multiplier}*{$port_regenrate}) WHERE port_type!='special' AND port_type!='none' AND port_energy<{$energy_limit}");
QUERYOK($resk);
echo "Ensuring minimum energy levels are 0...";
$resl = $db->Execute("UPDATE {$db->prefix}universe SET port_energy=0 WHERE port_energy<0");
QUERYOK($resl);
echo "<br>";
# Now check to see if any ports are over max, if so rectify.
echo "Checking Energy Port Cap...";
$resm = $db->Execute("UPDATE {$db->prefix}universe SET port_energy={$energy_limit} WHERE port_energy > {$energy_limit}");
QUERYOK($resm);
echo "Checking Goods Port Cap...";
$resn = $db->Execute("UPDATE {$db->prefix}universe SET port_goods={$goods_limit} WHERE  port_goods > {$goods_limit}");
QUERYOK($resn);
echo "Checking Organics Port Cap...";
$reso = $db->Execute("UPDATE {$db->prefix}universe SET port_organics={$organics_limit} WHERE port_organics > {$organics_limit}");
QUERYOK($reso);
echo "Checking Ore Port Cap...";
$resp = $db->Execute("UPDATE {$db->prefix}universe SET port_ore={$ore_limit} WHERE port_ore > {$ore_limit}");
QUERYOK($resp);
$multiplier = 0;
Example #2
0
<?

  if (preg_match("/sched_turns.php/i", $PHP_SELF)) {
      echo "You can not access this file directly!";
      die();
  }

  echo "<B>TURNS</B><BR><BR>";
  echo "Adding turns...";
  QUERYOK($db->Execute("UPDATE $dbtables[players] SET turns=turns+(2*$multiplier) WHERE turns<$max_turns"));
  echo "Ensuring maximum turns are $max_turns...";
  QUERYOK($db->Execute("UPDATE $dbtables[players] SET turns=$max_turns WHERE turns>$max_turns"));
  echo "<BR>";
  $multiplier = 0;

?>
Example #3
0
  echo "Ensuring minimum ore levels are 0...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_ore=0 WHERE port_ore<0"));
  echo "<BR>";
  echo "Adding organics to all commodities ports...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_organics=port_organics+($organics_rate*$multiplier) WHERE port_type='organics' AND port_organics<$organics_limit"));
  echo "Adding organics to all organics ports...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_organics=port_organics+($organics_rate*$multiplier) WHERE port_type!='special' AND port_type!='none' AND port_organics<$organics_limit"));
  echo "Ensuring minimum organics levels are 0...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_organics=0 WHERE port_organics<0"));
  echo "<BR>";
  echo "Adding goods to all commodities ports...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_goods=port_goods+($goods_rate*$multiplier) WHERE port_type='goods' AND port_goods<$goods_limit"));
  echo "Adding goods to all goods ports...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_goods=port_goods+($goods_rate*$multiplier) WHERE port_type!='special' AND port_type!='none' AND port_goods<$goods_limit"));
  echo "Ensuring minimum goods levels are 0...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_goods=0 WHERE port_goods<0"));
  echo "<BR>";
  echo "Adding energy to all commodities ports...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_energy=port_energy+($energy_rate*$multiplier) WHERE port_type='energy' AND port_energy<$energy_limit"));
  echo "Adding energy to all energy ports...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_energy=port_energy+($energy_rate*$multiplier) WHERE port_type!='special' AND port_type!='none' AND port_energy<$energy_limit"));
  echo "Ensuring minimum energy levels are 0...";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_energy=0 WHERE port_energy<0"));
  echo "<BR>";
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_energy=$energy_limit WHERE port_energy > $energy_limit"));
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_goods=$goods_limit WHERE  port_goods > $goods_limit"));
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_organics=$organics_limit WHERE port_organics > $organics_limit"));
  QUERYOK($db->Execute("UPDATE $dbtables[universe] SET port_ore=$ore_limit WHERE port_ore > $ore_limit"));
  $multiplier = 0;
?>
Example #4
0
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Affero General Public License as
//  published by the Free Software Foundation, either version 3 of the
//  License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Affero General Public License for more details.
//
//  You should have received a copy of the GNU Affero General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// File: sched_turns.php
if (preg_match("/sched_turns.php/i", $_SERVER['PHP_SELF'])) {
    echo "You can not access this file directly!";
    die;
}
echo "<strong>TURNS</strong><br><br>";
echo "Adding turns...";
global $db_logging;
$resa = $db->Execute("UPDATE {$db->prefix}ships SET turns = turns + ({$turns_per_tick} * {$multiplier}) WHERE turns < {$max_turns}");
db_op_result($db, $resa, __LINE__, __FILE__, $db_logging);
QUERYOK($resa);
echo "Ensuring maximum turns are {$max_turns}...";
$resb = $db->Execute("UPDATE {$db->prefix}ships SET turns = {$max_turns} WHERE turns > {$max_turns};");
db_op_result($db, $resb, __LINE__, __FILE__, $db_logging);
QUERYOK($resb);
echo "<br>";
$multiplier = 0;