Added full source code

This commit is contained in:
Emmanuel BENOîT 2016-01-10 11:01:49 +01:00
commit 33f8586698
1377 changed files with 123808 additions and 0 deletions

View file

@ -0,0 +1,99 @@
<?
//-----------------------------------------------------------------------
// LegacyWorlds Beta 5
// Game libraries
//
// beta5/ctf/library.inc
//
// This library handles everything specific to Kings of the Hill (CTF)
// matches.
//
// Copyright(C) 2004-2008, DeepClone Development
//-----------------------------------------------------------------------
class beta5_ctf_library {
var $index = array (
'assign',
'checkTargets',
'joinMessage',
'resetGame'
);
public function __construct($lib) {
$this->lib = $lib;
$this->game = $this->lib->game;
$this->db = $this->game->db;
}
// This function sends a CTF-specific message to a player
public function message($player, $mType, $team, $timestamp = null) {
if (! $this->msgs) {
$this->msgs = $this->game->getLib('beta5/msg');
}
$this->msgs->call('send', $player, 'ctf', array(
'msg_type' => $mType,
'team' => $team,
'time_stamp' => $timestamp
), $mType ? 'INT' : 'IN');
}
// This function checks whether a specific system is a target
public function isTarget($system) {
// Cache the targets as this function tends to be called several
// times in a row
if (! $this->targets) {
$q = $this->db->query("SELECT system FROM ctf_target");
if (!($q && dbCount($q))) {
return;
}
$this->targets = array();
while ($r = dbFetchArray($q)) {
array_push($this->targets, $r[0]);
}
}
return in_array($system, $this->targets);
}
// This function returns the amount of points a team has
public function getTeamPoints($team) {
$q = $this->db->query("SELECT points FROM ctf_points WHERE team = $team");
if (!($q && dbCount($q))) {
return 0;
}
list($points) = dbFetchArray($q);
return $points;
}
// This function checks for victory
public function checkVictory() {
// Get the target count
$q = $this->db->query("SELECT COUNT(*) FROM ctf_target");
list($tCount) = dbFetchArray($q);
// For each team, get the count of targets held without grace
// for more than <v2time> hours
$time = $this->game->params['v2time'] * 3600;
$q = $this->db->query(
"SELECT held_by, COUNT(*) FROM ctf_target "
. "WHERE held_by IS NOT NULL AND grace_expires IS NULL "
. "AND held_since <= UNIX_TIMESTAMP(NOW()) - $time "
. "GROUP BY held_by"
);
// If there's only one result and if the count is the same as
// the target count, we got a winner
if (dbCount($q) == 1) {
list($team, $hCount) = dbFetchArray($q);
if ($hCount == $tCount) {
return $team;
}
}
return null;
}
}
?>

View file

@ -0,0 +1,88 @@
<?php
//-----------------------------------------------------------------------
// LegacyWorlds Beta 5
// Game libraries
//
// beta5/ctf/library/assign.inc
//
// This function assigns a planet to a player in a CTF game.
//
// Copyright(C) 2004-2008, DeepClone Development
//-----------------------------------------------------------------------
class beta5_ctf_assign {
public function __construct($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
$this->planets = $this->lib->game->getLib('beta5/planet');
}
public function run($player, $planetName, $team) {
logText("Assigning planet $planetName for player #$player in team #$team");
// Find unassigned systems marked as spawning area for the team
$system = $this->findFreeSystem($team);
// Assign a random planet in the system
$planet = $this->assignPlanet($player, $system, $planetName);
// Mark the system as the player's spawning point
$this->markSystem($player, $system);
return $planet;
}
private function findFreeSystem($team) {
$q = $this->db->query(
"SELECT s.id FROM system s, ctf_alloc a "
. "WHERE s.id = a.system AND a.alliance = $team "
. "AND a.spawn_point AND NOT s.assigned "
. "FOR UPDATE OF s, a"
);
$n = rand(0, dbCount($q) - 2);
while ($n) {
dbFetchArray($q);
$n --;
}
list($system) = dbFetchArray($q);
return $system;
}
private function assignPlanet($player, $system, $name) {
// Randomize orbit
$npl = 6;
$porb = rand(0, $npl - 1);
// Give the planet to the player
$tm = time();
$this->db->query("UPDATE planet SET name='$name', owner=$player,renamed=$tm,mod_check=FALSE "
. "WHERE system = $system AND orbit = $porb");
// Get planet ID and population
$q = $this->db->query("SELECT id, pop FROM planet WHERE system = $system AND orbit = $porb FOR UPDATE");
list($plid, $cPop) = dbFetchArray($q);
// Update happiness and maximum population
$this->planets->call('updateHappiness', $plid);
$this->planets->call('updateMaxPopulation', $plid, null, $player);
return $plid;
}
private function markSystem($player, $system) {
// Mark the system itself
$this->db->query("UPDATE system SET assigned = TRUE WHERE id = $system");
// Mark the allocation record
$this->db->query("UPDATE ctf_alloc SET player = $player WHERE system = $system");
}
}
?>

View file

@ -0,0 +1,279 @@
<?php
//-----------------------------------------------------------------------
// LegacyWorlds Beta 5
// Game libraries
//
// beta5/ctf/library/checkTargets.inc
//
// This function checks the targets' status and sends messages if needed.
//
// Copyright(C) 2004-2008, DeepClone Development
//-----------------------------------------------------------------------
class beta5_ctf_checkTargets {
public function __construct($lib) {
$this->lib = $lib;
$this->game = $this->lib->game;
$this->db = $this->game->db;
}
public function run() {
// Get the current status (used later to send messages)
$initialStatus = $this->getStatus();
$this->grace = ($initialStatus[0] != 'nohold') ? (3600 * $this->game->params['v2grace']) : 0;
// Get the list of all target systems
$q = $this->db->query("SELECT * FROM ctf_target");
$targets = array();
while ($r = dbFetchHash($q)) {
array_push($targets, $r);
}
// For each target, check the system's status
foreach ($targets as $target) {
$this->checkTargetStatus($target);
}
// Get the new status
$newStatus = $this->getStatus();
// Check status changes
$this->checkStatusChanges($initialStatus, $newStatus);
}
private function getStatus() {
// Get the target count
$q = $this->db->query("SELECT COUNT(*) FROM ctf_target");
list($tCount) = dbFetchArray($q);
// For each team, get the count of targets held without grace
$q = $this->db->query(
"SELECT held_by, COUNT(*) FROM ctf_target "
. "WHERE held_by IS NOT NULL AND grace_expires IS NULL "
. "GROUP BY held_by"
);
if (dbCount($q) == 1) {
list($team, $hCount) = dbFetchArray($q);
if ($hCount == $tCount) {
$q = $this->db->query("SELECT MAX(held_since) FROM ctf_target");
list($heldSince) = dbFetchArray($q);
return array('held', $team, $heldSince);
}
}
// For each team, get the count of targets held
$q = $this->db->query(
"SELECT held_by, COUNT(*) FROM ctf_target "
. "WHERE held_by IS NOT NULL "
. "GROUP BY held_by"
);
if (dbCount($q) == 1) {
list($team, $gCount) = dbFetchArray($q);
if ($gCount == $tCount) {
$q = $this->db->query("SELECT MIN(grace_expires) FROM ctf_target");
list($graceExpires) = dbFetchArray($q);
return array('grace', $team, $graceExpires);
}
}
return array('nohold');
}
private function checkTargetStatus($target) {
// Get the team for each planet in the system
$q = $this->db->query(
"SELECT y.alliance FROM planet p, player y "
. "WHERE y.id = p.owner AND p.system = {$target['system']}"
);
// If all planets are being held, list the alliances
$teams = array();
$teamPlanets = array();
while ($r = dbFetchArray($q)) {
if (array_key_exists($r[0], $teamPlanets)) {
$teamPlanets[$r[0]] ++;
} else {
$teamPlanets[$r[0]] = 1;
array_push($teams, $r[0]);
}
}
if (count($teams) == 1 && $teamPlanets[$teams[0]] == 6) {
// One team is holding the whole system
$this->heldByTeam($target, $teams[0]);
} else {
// The system is not being held by any particular team
$this->notHeld($target);
}
}
private function heldByTeam($target, $team) {
$tid = $target['system'];
if (is_null($target['held_by'])) {
// If only one team is holding the planets and the system was
// not marked as being held, mark it
logText("Target #$tid now held by team #$team");
$this->assignTarget($target['system'], $team);
} elseif ($target['held_by'] == $team && ! is_null($target['grace_expires'])) {
// If the target was being held by the team but had a grace expiration,
// cancel grace period expiration and increase held_by accordingly
logText("Target #$tid held by team #$team again, grace cancelled");
$gracePeriod = time() - $target['grace_expires'] + $this->grace;
$this->db->query(
"UPDATE ctf_target "
. "SET grace_expires = NULL, held_since = held_since + $gracePeriod "
. "WHERE system = {$target['system']}"
);
} elseif ($target['held_by'] != $team && $this->grace > 0) {
// The target is now being held by another team and the game
// has support for grace periods
if (is_null($target['grace_expires'])) {
// No grace was set - set it
logText("Target #$tid held by team #$team, setting grace for previous holder #"
. $target['held_by']);
$this->setGrace($target['system'], $this->grace);
} elseif ($target['grace_expires'] <= time()) {
// Grace has expired, but a new team is holding the system
logText("Target #$tid now held by team #$team, grace ended for previous holder #"
. $target['held_by']);
$this->assignTarget($target['system'], $team);
}
} elseif ($target['held_by'] != $team) {
// The target is now being held by another team, and there is no
// grace period
logText("Target #$tid now held by team #$team, no grace for previous holder #"
. $target['held_by']);
$this->assignTarget($target['system'], $team);
}
}
private function notHeld($target) {
// If the target wasn't being held before, we're done
if (is_null($target['held_by'])) {
return;
}
$tid = $target['system'];
if ($this->grace > 0) {
// If there is support for grace periods
if (is_null($target['grace_expires'])) {
// Grace period wasn't set - set it
$this->setGrace($target['system'], $this->grace);
logText("Target #$tid no longer held by team #{$target['held_by']}, setting grace");
} elseif ($target['grace_expires'] <= time()) {
// Grace period expired, no-one's holding the system
logText("Target #$tid no longer held by team #{$target['held_by']}, grace ended");
$this->unassignTarget($target['system']);
}
} else {
// No grace periods, no-one's holding the system
logText("Target #$tid no longer held by team #{$target['held_by']}, no grace");
$this->unassignTarget($target['system']);
}
}
private function assignTarget($target, $team) {
$this->db->query(
"UPDATE ctf_target "
. "SET held_by = $team, "
. "held_since = UNIX_TIMESTAMP(NOW()), "
. "grace_expires = NULL "
. "WHERE system = $target"
);
}
private function setGrace($target, $grace) {
$this->db->query(
"UPDATE ctf_target SET grace_expires = UNIX_TIMESTAMP(NOW()) + $grace WHERE system = $target"
);
}
private function unassignTarget($target) {
$this->db->query(
"UPDATE ctf_target "
. "SET held_by = NULL, held_since = NULL, grace_expires = NULL "
. "WHERE system = $target"
);
}
private function checkStatusChanges($initialStatus, $newStatus) {
$winTime = $this->game->params['v2time'] * 3600;
// Status hasn't changed
if ($initialStatus[0] == $newStatus[0] && $initialStatus[1] == $newStatus[1]) {
// Check for victory / halfway to victory
if ($initialStatus[0] == 'held') {
$halfWay = $initialStatus[2] + $winTime / 2;
$victory = $initialStatus[2] + $winTime;
$now = time();
if ($now >= $halfWay && $now < $halfWay + 21) {
$this->statusMessage(10, 11, $newStatus[1], $victory);
} elseif ($now >= $victory) {
// If the game is finished, we shouldn't be here anyways
$this->lib->call('resetGame', $newStatus[1]);
}
}
return;
}
// Status changed, send messages
logText("CTF Status: (" . join(',',$initialStatus) . ") -> (" . join(',',$newStatus) . ")");
if ($initialStatus[0] == 'nohold' && $newStatus[0] == 'held') {
// The targets are now being held by a team
$this->statusMessage(2, 3, $newStatus[1], $newStatus[2] + $winTime);
} elseif ($initialStatus[0] == 'grace' && $newStatus[0] == 'nohold') {
// Targets are no longer being held (no grace period)
$this->statusMessage(6, 9, $initialStatus[1]);
$this->cancelAllGraces();
} elseif ($initialStatus[0] == 'held' && $newStatus[0] == 'nohold') {
// Targets are no longer being held (no grace period)
$this->statusMessage(5, 8, $initialStatus[1]);
} elseif ($initialStatus[0] == 'held' && $newStatus[0] == 'grace') {
// Targets are no longer being held (with grace period)
$this->statusMessage(4, 7, $initialStatus[1], $newStatus[2]);
} elseif ($initialStatus[0] == 'held' && $newStatus[0] == 'held') {
// Targets are now held by another team
$this->statusMessage(5, 8, $initialStatus[1]);
$this->statusMessage(2, 3, $newStatus[1], $newStatus[2] + $winTime);
} elseif ($initialStatus[0] == 'grace' && $newStatus[0] == 'held') {
if ($initialStatus[1] != $newStatus[1]) {
// Other team gained control
$this->statusMessage(6, 9, $initialStatus[1]);
}
$this->statusMessage(2, 3, $newStatus[1], $newStatus[2] + $winTime);
}
}
private function statusMessage($toTeam, $toOthers, $team, $timestamp = null) {
$q = $this->db->query("SELECT id,alliance FROM player");
while ($r = dbFetchArray($q)) {
$this->lib->call('message', $r[0], $r[1] == $team ? $toTeam : $toOthers, $team, $timestamp);
}
}
private function cancelAllGraces() {
$this->db->query("UPDATE ctf_target SET grace_expires = NULL");
}
}
?>

View file

@ -0,0 +1,38 @@
<?php
//-----------------------------------------------------------------------
// LegacyWorlds Beta 5
// Game libraries
//
// beta5/ctf/library/joinMessage.inc
//
// This function sends messages to members of a team when another player
// is assigned to it.
//
// Copyright(C) 2004-2008, DeepClone Development
//-----------------------------------------------------------------------
class beta5_ctf_joinMessage {
public function __construct($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
public function run($team, $player) {
// List all players in the team
$q = $this->db->query(
"SELECT id FROM player WHERE alliance=$team AND id <> $player"
);
if (!($q && dbCount($q))) {
return;
}
// Send a message to each player
while ($r = dbFetchArray($q)) {
$this->lib->call('message', $r[0], 1, $team, $player);
}
}
}
?>

View file

@ -0,0 +1,349 @@
<?php
//-----------------------------------------------------------------------
// LegacyWorlds Beta 5
// Game libraries
//
// beta5/ctf/library/resetGame.inc
//
// This function is called when a team wins a round.
//
// It first increases the team's victory status. If the game is finished
// it sends messages, updates the rankings and stops there.
//
// FIXME: incomplete explanation
//
// Copyright(C) 2004-2008, DeepClone Development
//-----------------------------------------------------------------------
class beta5_ctf_resetGame {
private static $ftFields = array('gaships', 'fighters', 'cruisers', 'bcruisers');
public function __construct($lib) {
$this->lib = $lib;
$this->game = $this->lib->game;
$this->db = $this->game->db;
$this->fleets = $this->game->getLib('beta5/fleet');
$this->planets = $this->game->getLib('beta5/planet');
$this->players = $this->game->getLib('beta5/player');
}
public function run($winningTeam) {
// Starts by increasing the team's score
$cPoints = $this->increaseScore($winningTeam);
// Did the team win the whole game ?
if ($cPoints == 100) {
$this->endGame($winningTeam);
return;
}
// Neutralize all planets that are owned by players of a team in an area allocated to another team
// as well as planets owned by players in other players' spawning systems
$this->neutralizeColonies();
// Reset all planets that had been WHSN'd
$this->resetWHSN();
// Remove all WHSN penalties
$this->removePenalties();
// Neutralize and consolidate planets in target systems
$this->neutralizeTargets();
// And the dead shall rise again ...
$this->respawnPlayers();
// Equalize fleet sizes and send the fleets home
$this->equalizeFleets();
// Update corruption, happiness and attack status for all planets
$this->updatePlanets();
// Send messages
$this->sendRoundMessages($winningTeam);
}
private function increaseScore($winningTeam) {
$q = $this->db->query("SELECT points FROM ctf_points WHERE team = $winningTeam FOR UPDATE");
if (dbCount($q)) {
list($cPoints) = dbFetchArray($q);
$cPoints = min(100, $cPoints + $this->game->params['v2points']);
$this->db->query("UPDATE ctf_points SET points = $cPoints WHERE team = $winningTeam");
} else {
$cPoints = $this->game->params['v2points'];
$this->db->query("INSERT INTO ctf_points (team, points) VALUES ($winningTeam, $cPoints)");
}
return $cPoints;
}
private function endGame($winningTeam) {
// Fetch the list of players and their teams
$q = $this->db->query("SELECT id,alliance FROM player");
while ($r = dbFetchArray($q)) {
$this->lib->call('message', $r[0], ($r[1] == $winningTeam ? 14 : 15), $winningTeam);
}
// Update the rankings
$this->game->getLib()->call('updateRankings');
}
private function neutralizeColonies() {
// Get the list of all planets to neutralize
$q = $this->db->query(
"SELECT p.id, y.id FROM planet p, ctf_alloc a, player y "
. "WHERE p.owner = y.id AND p.system = a.system "
. "AND a.alliance <> y.alliance "
. "UNION SELECT p.id, y.id FROM planet p, ctf_alloc a, player y "
. "WHERE p.system = a.system AND y.id = p.owner AND a.alliance = y.alliance "
. "AND a.spawn_point AND a.player <> y.id"
);
// Neutralize the planets
while ($r = dbFetchArray($q)) {
$this->planets->call('ownerChange', $r[0]);
$this->players->call('losePlanet', $r[1], $r[0]);
}
}
private function resetWHSN() {
// Get the list of WHSN'd planets
$q = $this->db->query(
"SELECT p.id FROM planet p, system s WHERE s.nebula = 0 AND p.status <> 0 AND p.system = s.id"
);
// Recreate planets instead
while ($r = dbFetchArray($q)) {
$this->regenPlanet($r[0]);
}
}
private function regenPlanet($id) {
$ttn = rand(3, 12);
do {
$rn = strtoupper(substr(md5(uniqid(rand())), 0, 7));
$q = $this->db->query("SELECT id FROM planet WHERE name='P-[$rn]'");
} while (dbCount($q));
$q = $this->db->query("SELECT max_pop FROM planet_max_pop WHERE planet = $id AND tech_level = 0");
list($maxPop) = dbFetchArray($q);
$this->db->query(
"UPDATE planet SET status = 0, pop = 2000, ifact = 3, mfact = 3, "
. "turrets = $ttn, name = 'P-[$rn]', max_pop = $maxPop "
. "WHERE id = $id"
);
}
private function removePenalties() {
$this->db->query("UPDATE planet SET bh_unhappiness = 0");
$this->db->query("UPDATE player SET bh_unhappiness = 0");
}
private function neutralizeTargets() {
// Reset target status
$this->db->query("UPDATE ctf_target SET held_by = NULL, held_since = NULL, grace_expires = NULL");
// Get the list of all planets to neutralize
$q = $this->db->query(
"SELECT p.id, y.id, p.pop FROM planet p, ctf_target t, player y "
. "WHERE p.owner = y.id AND p.system = t.system"
);
while ($r = dbFetchArray($q)) {
// Neutralize the planet
$this->planets->call('ownerChange', $r[0]);
$this->players->call('losePlanet', $r[1], $r[0]);
// Compute factories and turrets for the planet
$x = ($r[2] - 2000) / 48000;
$facts = floor((($r[2] / 30) - 754 * $x * $x) / 2);
$turrets = floor(($r[2] / 22) - 510 * $x * $x);
// Set the planet's factories and turrets, reset its corruption
$this->db->query(
"UPDATE planet SET ifact = $facts, mfact = $facts, turrets = $turrets, corruption = 0 "
. "WHERE id = {$r[0]}"
);
}
}
private function respawnPlayers() {
// Get the list of players who don't have planets
$q = $this->db->query(
"SELECT id FROM player WHERE NOT hidden AND id NOT IN ("
. "SELECT DISTINCT owner FROM planet WHERE owner IS NOT NULL)"
);
while ($r = dbFetchArray($q)) {
$this->respawn($r[0]);
}
}
private function respawn($player) {
// Get the player's initial system
$q = $this->db->query("SELECT system FROM ctf_alloc WHERE player = $player");
list($system) = dbFetchArray($q);
// Choose a random planet
$orbit = rand(0, 5);
$q = $this->db->query("SELECT id FROM planet WHERE system = $system AND orbit = $orbit");
list($planet) = dbFetchArray($q);
// Assign the planet
$this->planets->call('ownerChange', $planet, $player);
$this->players->call('takePlanet', $player, $planet);
}
private function equalizeFleets() {
// Get the list of fleets
list($pFleets, $aFleets) = $this->getAllFleets();
// Compute fleet reduction based on alliance fleets
$fleetReductions = $this->computeReductions($aFleets);
// Compute the reductions for each player
foreach ($pFleets as $player => $fleets) {
$team = array_shift($fleets);
$pFleets[$player] = $this->playerReduction($fleets, $aFleets[$team], $fleetReductions[$team]);
}
// Reinsert each player's fleet at one of his planets
foreach ($pFleets as $player => $fleet) {
$this->insertFleet($player, $fleet);
}
}
private function getAllFleets() {
// Get the list of all fleets
$q = $this->db->query(
"SELECT f.id, p.id, p.alliance FROM fleet f, player p WHERE f.owner = p.id"
);
// Compute totals and disband the fleets as we go
$playerFleets = array();
$allianceFleets = array();
while ($r = dbFetchArray($q)) {
list($fleetID, $player, $alliance) = $r;
if (is_null($playerFleets[$player])) {
$playerFleets[$player] = array($alliance,0,0,0,0);
}
if (is_null($allianceFleets[$alliance])) {
$allianceFleets[$alliance] = array(0,0,0,0);
}
$fleet = $this->fleets->call('get', $fleetID);
for ($i = 0; $i < 4; $i ++) {
$playerFleets[$player][$i + 1] += $fleet[self::$ftFields[$i]];
$allianceFleets[$alliance][$i] += $fleet[self::$ftFields[$i]];
}
$this->fleets->call('disband', $fleetID);
}
return array($playerFleets, $allianceFleets);
}
private function computeReductions($fleets) {
// Find the smallest values for each type of ship
$smallest = null;
foreach ($fleets as $team => $tFleets) {
if (is_null($smallest)) {
$smallest = $tFleets;
continue;
}
for ($i = 0; $i < 4; $i ++) {
if ($tFleets[$i] < $smallest[$i]) {
$smallest[$i] = $tFleets[$i];
}
}
}
// Compute reductions for each team
$reductions = array();
foreach ($fleets as $team => $tFleets) {
$reductions[$team] = array();
for ($i = 0; $i < 4; $i ++) {
if ($tFleets[$i] == $smallest[$i]) {
$nAmount = 0;
} else {
$rnd = ($smallest == 0) ? rand(101, 105) : rand(98, 105);
$nAmount = $tFleets[$i] - floor($rnd * $smallest[$i] / 100);
}
$reductions[$team][$i] = $nAmount;
}
}
return $reductions;
}
private function playerReduction($pFleets, $aFleets, $aReduction) {
$reduc = array();
for ($i = 0; $i < 4; $i ++) {
if ($aFleets[$i] == 0) {
continue;
}
$ratio = $pFleets[$i] / $aFleets[$i];
$reduction = floor($aReduction[$i] * $ratio);
$reduc[$i] = $pFleets[$i] - $reduction;
}
return $reduc;
}
private function insertFleet($player, $fleet) {
if ($fleet[0] + $fleet[1] + $fleet[2] + $fleet[3] == 0) {
return;
}
// Get a planet belonging to the player
$q = $this->db->query("SELECT id FROM planet WHERE owner = $player LIMIT 1");
list($planet) = dbFetchArray($q);
$qString1 = "INSERT INTO fleet (owner, location";
$qString2 = ") VALUES ($player, $planet";
for ($i = 0; $i < 4; $i ++) {
if ($fleet[$i] == 0) {
continue;
}
$qString1 .= ", " . self::$ftFields[$i];
$qString2 .= ", {$fleet[$i]}";
}
$this->db->query("$qString1$qString2)");
}
private function updatePlanets() {
$this->db->query("UPDATE planet SET corruption = corruption / 2");
$q = $this->db->query(
"SELECT p.id FROM planet p, system s "
. "WHERE s.id = p.system AND s.nebula = 0"
);
while ($r = dbFetchArray($q)) {
$this->planets->call('updateHappiness', $r[0]);
$this->planets->call('updateMilStatus', $r[0]);
}
}
private function sendRoundMessages($winningTeam) {
$q = $this->db->query("SELECT id,alliance FROM player");
while ($r = dbFetchArray($q)) {
$this->lib->call('message', $r[0], ($r[1] == $winningTeam ? 12 : 13), $winningTeam);
}
}
}