';
- $text .= '' . $players[$accId] . ' | ';
- $text .= '' . number_format($trans[$accId][DEPOSIT]) . ' | ';
- $text .= '-' . number_format($trans[$accId][WITHDRAW]) . ' | ';
+ $text .= '' . $players[$playerID] . ' | ';
+ $text .= '' . number_format($trans[$playerID][DEPOSIT]) . ' | ';
+ $text .= '-' . number_format($trans[$playerID][WITHDRAW]) . ' | ';
$text .= 'Thanks for your purchase and good luck! You currently');
diff --git a/engine/Default/bar_lotto_claim.php b/engine/Default/bar_lotto_claim.php
index 200a4fad6..f6ac838c6 100644
--- a/engine/Default/bar_lotto_claim.php
+++ b/engine/Default/bar_lotto_claim.php
@@ -5,8 +5,8 @@
$db->query('SELECT * FROM player_has_ticket WHERE ' . $player->getSQL() . ' AND time = 0');
if ($db->nextRecord()) {
$prize = $db->getInt('prize');
- $NHLAmount = ($prize - 1000000) / 9;
- $db->query('UPDATE player SET bank = bank + ' . $db->escapeNumber($NHLAmount) . ' WHERE account_id = ' . $db->escapeNumber(ACCOUNT_ID_NHL) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
+ $NHLAmount = IRound(($prize - 1000000) / 9);
+ $db->query('UPDATE player SET bank = bank + ' . $db->escapeNumber($NHLAmount) . ' WHERE account_id = ' . $db->escapeNumber(ACCOUNT_ID_NHL) . ' AND game_id = ' . $db->escapeNumber($player->getGameID())); //TODO
$player->increaseCredits($prize);
$player->increaseHOF($prize, array('Bar', 'Lotto', 'Money', 'Claimed'), HOF_PUBLIC);
$player->increaseHOF(1, array('Bar', 'Lotto', 'Results', 'Claims'), HOF_PUBLIC);
diff --git a/engine/Default/bar_talk_bartender_processing.php b/engine/Default/bar_talk_bartender_processing.php
index fb376e681..3cc7d693e 100644
--- a/engine/Default/bar_talk_bartender_processing.php
+++ b/engine/Default/bar_talk_bartender_processing.php
@@ -16,7 +16,7 @@
}
$db->query('INSERT INTO bar_tender (game_id, message_id, message) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($amount) . ', ' . $db->escapeString($gossip) . ' )');
- SmrAccount::doMessageSendingToBox($player->getAccountID(), BOX_BARTENDER, $gossip, $player->getGameID());
+ SmrAccount::doMessageSendingToBox($player->getPlayerID(), BOX_BARTENDER, $gossip, $player->getGameID());
$container['Message'] = 'Huh, that\'s news to me...
Got anything else to tell me?';
} else {
diff --git a/engine/Default/bar_ticker_buy_processing.php b/engine/Default/bar_ticker_buy_processing.php
index ccae64756..d380ac954 100644
--- a/engine/Default/bar_ticker_buy_processing.php
+++ b/engine/Default/bar_ticker_buy_processing.php
@@ -10,7 +10,7 @@
$expires = $ticker['Expires'];
}
$expires += 5 * 86400;
-$db->query('REPLACE INTO player_has_ticker (game_id, account_id, type, expires) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeString($type) . ', ' . $db->escapeNumber($expires) . ')');
+$db->query('REPLACE INTO player_has_ticker (game_id, player_id, type, expires) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getPlayerID()) . ', ' . $db->escapeString($type) . ', ' . $db->escapeNumber($expires) . ')');
//take credits
$account->decreaseTotalSmrCredits(CREDITS_PER_TICKER);
diff --git a/engine/Default/beta_func_processing.php b/engine/Default/beta_func_processing.php
index da3c734f6..4aa80f5fb 100644
--- a/engine/Default/beta_func_processing.php
+++ b/engine/Default/beta_func_processing.php
@@ -1,7 +1,6 @@
getAccountID();
$game_id = $player->getGameID();
// delete all entries from the player_visited_sector/port table
$db->query('DELETE FROM player_visited_sector WHERE ' . $player->getSQL());
@@ -10,7 +9,7 @@
$db->query('SELECT * FROM port WHERE game_id = ' . $db->escapeNumber($game_id));
while ($db->nextRecord()) {
$port = SmrPort::getPort($game_id, $db->getInt('sector_id'), false, $db);
- $port->addCachePort($account_id);
+ $port->addCachePort($player->getPlayerID());
}
} elseif ($var['func'] == 'Money') {
diff --git a/engine/Default/bounty_claim.php b/engine/Default/bounty_claim.php
index 50b4eeb46..5aea9a177 100644
--- a/engine/Default/bounty_claim.php
+++ b/engine/Default/bounty_claim.php
@@ -39,7 +39,7 @@
// delete bounty
$db->query('DELETE FROM bounty
WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
- AND claimer_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ AND claimer_player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND bounty_id = ' . $db->escapeNumber($bounty['bounty_id']));
}
} else {
diff --git a/engine/Default/bounty_place.php b/engine/Default/bounty_place.php
index bf9dbb817..7421d27af 100644
--- a/engine/Default/bounty_place.php
+++ b/engine/Default/bounty_place.php
@@ -9,7 +9,7 @@
$template->assign('SubmitHREF', SmrSession::getNewHREF($container));
$bountyPlayers = [];
-$db->query('SELECT player_id, player_name FROM player JOIN account USING(account_id) WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND account_id != ' . $db->escapeNumber($player->getAccountID()) . ' ORDER BY player_name');
+$db->query('SELECT player_id, player_name FROM player WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND player_id != ' . $db->escapeNumber($player->getPlayerID()) . ' ORDER BY player_name');
while ($db->nextRecord()) {
$bountyPlayers[$db->getInt('player_id')] = htmlentities($db->getField('player_name'));
}
diff --git a/engine/Default/bounty_place_confirm.php b/engine/Default/bounty_place_confirm.php
index 2c84bf8ec..650a72b2e 100644
--- a/engine/Default/bounty_place_confirm.php
+++ b/engine/Default/bounty_place_confirm.php
@@ -12,7 +12,7 @@
$template->assign('BountyPlayer', $bountyPlayer->getLinkedDisplayName());
$container = create_container('bounty_place_confirm_processing.php');
-$container['account_id'] = $bountyPlayer->getAccountID();
+$container['player_id'] = $bountyPlayer->getPlayerID();
transfer('amount');
transfer('SmrCredits');
transfer('LocationID');
diff --git a/engine/Default/bounty_place_confirm_processing.php b/engine/Default/bounty_place_confirm_processing.php
index bde3f4854..004f85bc2 100644
--- a/engine/Default/bounty_place_confirm_processing.php
+++ b/engine/Default/bounty_place_confirm_processing.php
@@ -24,7 +24,6 @@
// get values from container (validated in bounty_place_processing.php)
$amount = $var['amount'];
$smrCredits = $var['SmrCredits'];
-$account_id = $var['account_id'];
// take the bounty from the cash
$player->decreaseCredits($amount);
@@ -34,7 +33,7 @@
$player->increaseHOF($amount, array('Bounties', 'Placed', 'Money'), HOF_PUBLIC);
$player->increaseHOF(1, array('Bounties', 'Placed', 'Number'), HOF_PUBLIC);
-$placed = SmrPlayer::getPlayer($account_id, $player->getGameID());
+$placed = SmrPlayer::getPlayer($var['player_id'], $player->getGameID());
$placed->increaseCurrentBountyAmount($type, $amount);
$placed->increaseCurrentBountySmrCredits($type, $smrCredits);
$placed->increaseHOF($smrCredits, array('Bounties', 'Received', 'SMR Credits'), HOF_PUBLIC);
diff --git a/engine/Default/chat_sharing.php b/engine/Default/chat_sharing.php
index 6f6b2a5cd..3836a6ba7 100644
--- a/engine/Default/chat_sharing.php
+++ b/engine/Default/chat_sharing.php
@@ -5,6 +5,8 @@
$template->assign('Message', $var['message']);
}
+//TODO
+
$shareFrom = array();
$db->query('SELECT * FROM account_shares_info WHERE to_account_id=' . $db->escapeNumber($player->getAccountID()) . ' AND (game_id=0 OR game_id=' . $db->escapeNumber($player->getGameID()) . ')');
while ($db->nextRecord()) {
diff --git a/engine/Default/chat_sharing_processing.php b/engine/Default/chat_sharing_processing.php
index 0dfc4a7d2..b87b5bb10 100644
--- a/engine/Default/chat_sharing_processing.php
+++ b/engine/Default/chat_sharing_processing.php
@@ -17,7 +17,7 @@ function error_on_page($message) {
}
try {
- $accountId = SmrPlayer::getPlayerByPlayerID($addPlayerID, $player->getGameID())->getAccountID();
+ $accountId = SmrPlayer::getPlayer($addPlayerID, $player->getGameID())->getAccountID();
} catch (PlayerNotFoundException $e) {
error_on_page($e->getMessage());
}
diff --git a/engine/Default/chess.php b/engine/Default/chess.php
index 452487eaa..d52a00e79 100644
--- a/engine/Default/chess.php
+++ b/engine/Default/chess.php
@@ -4,14 +4,14 @@
$template->assign('ChessGames', $chessGames);
$template->assign('PageTopic', 'Casino');
-$playersChallenged = array($player->getAccountID() => true);
+$playersChallenged = array($player->getPlayerID() => true);
foreach ($chessGames as $chessGame) {
$playersChallenged[$chessGame->getWhiteID()] = true;
$playersChallenged[$chessGame->getBlackID()] = true;
}
$players = array();
-$db->query('SELECT player_id, player.player_name FROM player JOIN account USING(account_id) WHERE npc = ' . $db->escapeBoolean(false) . ' AND validated = ' . $db->escapeBoolean(true) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND account_id NOT IN (' . $db->escapeArray(array_keys($playersChallenged)) . ') ORDER BY player_name');
+$db->query('SELECT player_id, player.player_name FROM player JOIN account USING(account_id) WHERE npc = ' . $db->escapeBoolean(false) . ' AND validated = ' . $db->escapeBoolean(true) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND player_id NOT IN (' . $db->escapeArray(array_keys($playersChallenged)) . ') ORDER BY player_name');
while ($db->nextRecord()) {
$players[$db->getInt('player_id')] = htmlentities($db->getField('player_name'));
}
@@ -19,7 +19,7 @@
if (ENABLE_NPCS_CHESS) {
$npcs = array();
- $db->query('SELECT player_id, player.player_name FROM player WHERE npc = ' . $db->escapeBoolean(true) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND account_id NOT IN (' . $db->escapeArray(array_keys($playersChallenged)) . ') ORDER BY player_name');
+ $db->query('SELECT player_id, player.player_name FROM player WHERE npc = ' . $db->escapeBoolean(true) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND player_id NOT IN (' . $db->escapeArray(array_keys($playersChallenged)) . ') ORDER BY player_name');
while ($db->nextRecord()) {
$npcs[$db->getInt('player_id')] = htmlentities($db->getField('player_name'));
}
diff --git a/engine/Default/chess_move_processing.php b/engine/Default/chess_move_processing.php
index 3351c92e8..33a3c0094 100644
--- a/engine/Default/chess_move_processing.php
+++ b/engine/Default/chess_move_processing.php
@@ -9,10 +9,10 @@
$toX = Request::getInt('toX');
$toY = Request::getInt('toY');
if (!$chessGame->hasEnded()) {
- if ($chessGame->isCurrentTurn($account->getAccountID())) {
+ if ($chessGame->isCurrentTurn($player->getPlayerID())) {
$board = $chessGame->getBoard();
if ($board[$y][$x] != null) {
- switch ($chessGame->tryMove($x, $y, $toX, $toY, $account->getAccountID(), ChessPiece::QUEEN)) {
+ switch ($chessGame->tryMove($x, $y, $toX, $toY, $player->getPlayerID(), ChessPiece::QUEEN)) {
case 0:
//Success
break;
diff --git a/engine/Default/chess_play.php b/engine/Default/chess_play.php
index 657b94a6d..b1f3f83ad 100644
--- a/engine/Default/chess_play.php
+++ b/engine/Default/chess_play.php
@@ -4,7 +4,7 @@
$template->assign('ChessGame', $chessGame);
// Board orientation depends on the player's color.
-$playerIsWhite = $chessGame->getWhiteID() == $player->getAccountID();
+$playerIsWhite = $chessGame->getWhitePlayerID() == $player->getPlayerID();
if ($playerIsWhite) {
$board = $chessGame->getBoard();
} else {
diff --git a/engine/Default/chess_resign_processing.php b/engine/Default/chess_resign_processing.php
index 8c12a60e7..d827377ba 100644
--- a/engine/Default/chess_resign_processing.php
+++ b/engine/Default/chess_resign_processing.php
@@ -1,7 +1,7 @@
resign($player->getAccountID());
+$result = $chessGame->resign($player->getPlayerID());
$container = create_container('skeleton.php', 'current_sector.php');
diff --git a/engine/Default/combat_log_list.php b/engine/Default/combat_log_list.php
index f502ed86b..aa84a6bbe 100644
--- a/engine/Default/combat_log_list.php
+++ b/engine/Default/combat_log_list.php
@@ -29,7 +29,7 @@
$query = 'EXISTS(
SELECT 1
FROM player_saved_combat_logs
- WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND log_id = c.log_id
)';
@@ -45,7 +45,7 @@
&& $player->hasAlliance()) {
$query .= ' AND (attacker_alliance_id=' . $db->escapeNumber($player->getAllianceID()) . ' OR defender_alliance_id=' . $db->escapeNumber($player->getAllianceID()) . ') ';
} else {
- $query .= ' AND (attacker_id=' . $db->escapeNumber($player->getAccountID()) . ' OR defender_id=' . $db->escapeNumber($player->getAccountID()) . ') ';
+ $query .= ' AND (attacker_player_id=' . $db->escapeNumber($player->getPlayerID()) . ' OR defender_player_id=' . $db->escapeNumber($player->getPlayerID()) . ') ';
}
$page = 0;
if (isset($var['page'])) {
@@ -59,16 +59,16 @@
$db->query('SELECT attacker_id,defender_id,timestamp,sector_id,log_id FROM combat_logs c WHERE ' . $query . ' ORDER BY log_id DESC, sector_id LIMIT ' . ($page * COMBAT_LOGS_PER_PAGE) . ', ' . COMBAT_LOGS_PER_PAGE);
}
-function getParticipantName($accountID, $sectorID) {
+function getParticipantName($playerID, $sectorID) {
global $player;
- if ($accountID == ACCOUNT_ID_PORT) {
+ if ($playerID == PLAYER_ID_PORT) {
return 'Port #' . $sectorID . '';
}
- if ($accountID == ACCOUNT_ID_PLANET) {
+ if ($playerID == PLAYER_ID_PLANET) {
return 'Planetary Defenses';
}
- return SmrPlayer::getPlayer($accountID, $player->getGameID())->getLinkedDisplayName(false);
+ return SmrPlayer::getPlayer($playerID, $player->getGameID())->getLinkedDisplayName(false);
}
// For display purposes, describe the type of log
@@ -120,8 +120,8 @@ function getParticipantName($accountID, $sectorID) {
while ($db->nextRecord()) {
$sectorID = $db->getInt('sector_id');
$logs[$db->getInt('log_id')] = array(
- 'Attacker' => getParticipantName($db->getInt('attacker_id'), $sectorID),
- 'Defender' => getParticipantName($db->getInt('defender_id'), $sectorID),
+ 'Attacker' => getParticipantName($db->getInt('attacker_player_id'), $sectorID),
+ 'Defender' => getParticipantName($db->getInt('defender_player_id'), $sectorID),
'Time' => $db->getInt('timestamp'),
'Sector' => $sectorID
);
diff --git a/engine/Default/combat_log_list_processing.php b/engine/Default/combat_log_list_processing.php
index f789b7397..cde12016c 100644
--- a/engine/Default/combat_log_list_processing.php
+++ b/engine/Default/combat_log_list_processing.php
@@ -17,14 +17,14 @@
if ($submitAction == 'Save') {
//save the logs we checked
// Query means people can only save logs that they are allowd to view.
- $db->query('INSERT IGNORE INTO player_saved_combat_logs (account_id, game_id, log_id)
- SELECT ' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', log_id
+ $db->query('INSERT IGNORE INTO player_saved_combat_logs (player_id, game_id, log_id)
+ SELECT ' . $db->escapeNumber($player->getPlayerID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', log_id
FROM combat_logs
WHERE log_id IN (' . $db->escapeArray($logIDs) . ')
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND (
- attacker_id = ' . $db->escapeNumber($player->getAccountID()) . '
- OR defender_id = ' . $db->escapeNumber($player->getAccountID()) .
+ attacker_player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
+ OR defender_player_id = ' . $db->escapeNumber($player->getPlayerID()) .
($player->hasAlliance() ? '
OR attacker_alliance_id = ' . $db->escapeNumber($player->getAllianceID()) . '
OR defender_alliance_id = ' . $db->escapeNumber($player->getAllianceID())
@@ -34,7 +34,7 @@
} elseif ($submitAction == 'Delete') {
$db->query('DELETE FROM player_saved_combat_logs
WHERE log_id IN (' . $db->escapeArray($logIDs) . ')
- AND account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ AND player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
LIMIT ' . count($logIDs));
}
diff --git a/engine/Default/combat_log_viewer_verify.php b/engine/Default/combat_log_viewer_verify.php
index 04da18db1..b45b38ac4 100644
--- a/engine/Default/combat_log_viewer_verify.php
+++ b/engine/Default/combat_log_viewer_verify.php
@@ -8,7 +8,7 @@
if ($player->hasAlliance()) {
$query .= '(attacker_alliance_id=' . $db->escapeNumber($player->getAllianceID()) . ' OR defender_alliance_id=' . $db->escapeNumber($player->getAllianceID()) . ')';
} else {
- $query .= '(attacker_id=' . $db->escapeNumber($player->getAccountID()) . ' OR defender_id=' . $db->escapeNumber($player->getAccountID()) . ')';
+ $query .= '(attacker_player_id=' . $db->escapeNumber($player->getPlayerID()) . ' OR defender_player_id=' . $db->escapeNumber($player->getPlayerID()) . ')';
}
$db->query($query . ' LIMIT 1');
diff --git a/engine/Default/combat_simulator.php b/engine/Default/combat_simulator.php
index 7466d6b2b..c940b01c6 100644
--- a/engine/Default/combat_simulator.php
+++ b/engine/Default/combat_simulator.php
@@ -77,12 +77,12 @@ function runAnAttack($realAttackers,$realDefenders) {
global $template;
$results = array('Attackers' => array('Traders' => array(), 'TotalDamage' => 0),
'Defenders' => array('Traders' => array(), 'TotalDamage' => 0));
- foreach ($realAttackers as $accountID => $teamPlayer) {
+ foreach ($realAttackers as $teamPlayer) {
$playerResults =& $teamPlayer->shootPlayers($realDefenders);
$results['Attackers']['Traders'][] =& $playerResults;
$results['Attackers']['TotalDamage'] += $playerResults['TotalDamage'];
}
- foreach ($realDefenders as $accountID => $teamPlayer) {
+ foreach ($realDefenders as $teamPlayer) {
$playerResults =& $teamPlayer->shootPlayers($realAttackers);
$results['Defenders']['Traders'][] =& $playerResults;
$results['Defenders']['TotalDamage'] += $playerResults['TotalDamage'];
diff --git a/engine/Default/council_embassy_processing.php b/engine/Default/council_embassy_processing.php
index 6b933284e..f45cf0897 100644
--- a/engine/Default/council_embassy_processing.php
+++ b/engine/Default/council_embassy_processing.php
@@ -54,11 +54,11 @@
. "! You have " . format_time(TIME_FOR_COUNCIL_VOTE)
. " to cast your vote.";
-foreach ($councilMembers as $accountID) {
+foreach ($councilMembers as $playerID) {
// don't send to the player who started the vote
- if ($player->getAccountID() != $accountID) {
+ if ($player->getPlayerID() != $playerID) {
SmrPlayer::sendMessageFromRace($player->getRaceID(), $player->getGameID(),
- $accountID, $message, $time);
+ $playerID, $message, $time);
}
}
diff --git a/engine/Default/council_send_message_processing.php b/engine/Default/council_send_message_processing.php
index da0c79377..cc8428b64 100644
--- a/engine/Default/council_send_message_processing.php
+++ b/engine/Default/council_send_message_processing.php
@@ -8,8 +8,8 @@
// send to all council members
$councilMembers = Council::getRaceCouncil($player->getGameID(), $var['race_id']);
-foreach ($councilMembers as $accountID) {
- $player->sendMessage($accountID, MSG_POLITICAL, $message, true, $player->getAccountID() != $accountID);
+foreach ($councilMembers as $playerID) {
+ $player->sendMessage($playerID, MSG_POLITICAL, $message, true, $player->getPlayerID() != $playerID);
}
$container = create_container('skeleton.php', 'current_sector.php');
diff --git a/engine/Default/council_vote.php b/engine/Default/council_vote.php
index 23826d676..2aef6deb9 100644
--- a/engine/Default/council_vote.php
+++ b/engine/Default/council_vote.php
@@ -9,7 +9,7 @@
// determine for what we voted
$db->query('SELECT * FROM player_votes_relation
- WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()));
$votedForRace = -1;
if ($db->nextRecord()) {
@@ -65,7 +65,7 @@
$noVotes = $db2->getInt('count(*)');
$db2->query('SELECT vote FROM player_votes_pact
- WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND race_id_1 = ' . $db->escapeNumber($player->getRaceID()) . '
AND race_id_2 = '.$db->escapeNumber($otherRaceID));
diff --git a/engine/Default/council_vote_processing.php b/engine/Default/council_vote_processing.php
index a7db20ce9..9151befdd 100644
--- a/engine/Default/council_vote_processing.php
+++ b/engine/Default/council_vote_processing.php
@@ -15,12 +15,12 @@
if ($action == 'INC' || $action == 'DEC') {
$db->query('REPLACE INTO player_votes_relation
- (account_id, game_id, race_id_1, race_id_2, action, time)
- VALUES(' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getRaceID()) . ', ' . $db->escapeNumber($race_id) . ', ' . $db->escapeString($action) . ', ' . $db->escapeNumber(TIME) . ')');
+ (player_id, game_id, race_id_1, race_id_2, action, time)
+ VALUES(' . $db->escapeNumber($player->getPlayerID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getRaceID()) . ', ' . $db->escapeNumber($race_id) . ', ' . $db->escapeString($action) . ', ' . $db->escapeNumber(TIME) . ')');
} elseif ($action == 'YES' || $action == 'NO') {
$db->query('REPLACE INTO player_votes_pact
- (account_id, game_id, race_id_1, race_id_2, vote)
- VALUES(' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getRaceID()) . ', ' . $db->escapeNumber($race_id) . ', ' . $db->escapeString($action) . ')');
+ (player_id, game_id, race_id_1, race_id_2, vote)
+ VALUES(' . $db->escapeNumber($player->getPlayerID()) . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getRaceID()) . ', ' . $db->escapeNumber($race_id) . ', ' . $db->escapeString($action) . ')');
} elseif ($action == 'VETO') {
// try to cancel both votings
$db->query('DELETE FROM race_has_voting ' .
diff --git a/engine/Default/current_players.php b/engine/Default/current_players.php
index f05e6ffb3..b0c894814 100644
--- a/engine/Default/current_players.php
+++ b/engine/Default/current_players.php
@@ -55,7 +55,7 @@
while ($db->nextRecord()) {
$row = array();
- $curr_player = SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID(), false, $db);
+ $curr_player = SmrPlayer::getPlayer($db->getInt('player_id'), $player->getGameID(), false, $db);
$row['player'] = $curr_player;
// How should we style the row for this player?
diff --git a/engine/Default/current_sector.php b/engine/Default/current_sector.php
index 8ce5b619c..a52202ec4 100644
--- a/engine/Default/current_sector.php
+++ b/engine/Default/current_sector.php
@@ -151,11 +151,11 @@ function checkForForceRefreshMessage(&$msg) {
if ($contains > 0) {
if (!$template->hasTemplateVar('ForceRefreshMessage')) {
$forceRefreshMessage = '';
- $db->query('SELECT refresh_at FROM sector_has_forces WHERE refresh_at >= ' . $db->escapeNumber(TIME) . ' AND sector_id = ' . $db->escapeNumber($player->getSectorID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND refresher = ' . $db->escapeNumber($player->getAccountID()) . ' ORDER BY refresh_at DESC LIMIT 1');
+ $db->query('SELECT refresh_at FROM sector_has_forces WHERE refresh_at >= ' . $db->escapeNumber(TIME) . ' AND sector_id = ' . $db->escapeNumber($player->getSectorID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND refresher_player_id = ' . $db->escapeNumber($player->getPlayerID()) . ' ORDER BY refresh_at DESC LIMIT 1');
if ($db->nextRecord()) {
$remainingTime = $db->getInt('refresh_at') - TIME;
$forceRefreshMessage = 'REFRESH: All forces will be refreshed in ' . $remainingTime . ' seconds.';
- $db->query('REPLACE INTO sector_message (game_id, account_id, message) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getAccountID()) . ', \'[Force Check]\')');
+ $db->query('REPLACE INTO sector_message (game_id, player_id, message) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getPlayerID()) . ', \'[Force Check]\')');
} else {
$forceRefreshMessage = 'REFRESH: All forces have finished refreshing.';
}
diff --git a/engine/Default/feature_request.php b/engine/Default/feature_request.php
index d8c94ac07..3f06437b3 100644
--- a/engine/Default/feature_request.php
+++ b/engine/Default/feature_request.php
@@ -72,7 +72,7 @@
'VotedFor' => $featureVotes[$featureRequestID] ?? false,
);
if ($featureModerator) {
- $featureRequests[$featureRequestID]['RequestAccount'] = SmrAccount::getAccount($db->getInt('poster_id'));
+ $featureRequests[$featureRequestID]['RequestAccount'] = SmrAccount::getAccount($db->getInt('poster_account_id'));
}
if ($canVote) {
diff --git a/engine/Default/feature_request_comment_processing.php b/engine/Default/feature_request_comment_processing.php
index a1ee22cd4..7ec378bec 100644
--- a/engine/Default/feature_request_comment_processing.php
+++ b/engine/Default/feature_request_comment_processing.php
@@ -6,7 +6,7 @@
}
// add this feature comment
-$db->query('INSERT INTO feature_request_comments (feature_request_id, poster_id, posting_time, anonymous, text)
+$db->query('INSERT INTO feature_request_comments (feature_request_id, poster_account_id, posting_time, anonymous, text)
VALUES(' . $db->escapeNumber($var['RequestID']) . ', ' . $db->escapeNumber($account->getAccountID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeBoolean(Request::has('anon')) . ',' . $db->escapeString(word_filter($comment)) . ')');
$container = $var;
diff --git a/engine/Default/feature_request_comments.php b/engine/Default/feature_request_comments.php
index cc7a09583..50619d1e6 100644
--- a/engine/Default/feature_request_comments.php
+++ b/engine/Default/feature_request_comments.php
@@ -34,7 +34,7 @@
'Anonymous' => $db->getBoolean('anonymous')
);
if ($featureModerator || !$db->getBoolean('anonymous')) {
- $featureRequestComments[$commentID]['PosterAccount'] = SmrAccount::getAccount($db->getInt('poster_id'));
+ $featureRequestComments[$commentID]['PosterAccount'] = SmrAccount::getAccount($db->getInt('poster_account_id'));
}
}
$template->assign('Comments', $featureRequestComments);
diff --git a/engine/Default/feature_request_processing.php b/engine/Default/feature_request_processing.php
index e86cf57d2..f1e840159 100644
--- a/engine/Default/feature_request_processing.php
+++ b/engine/Default/feature_request_processing.php
@@ -11,7 +11,7 @@
// add this feature to db
$db->query('INSERT INTO feature_request (feature_request_id) VALUES (NULL)');
$featureRequestID = $db->getInsertID();
-$db->query('INSERT INTO feature_request_comments (feature_request_id, poster_id, posting_time, anonymous, text) ' .
+$db->query('INSERT INTO feature_request_comments (feature_request_id, poster_account_id, posting_time, anonymous, text) ' .
'VALUES(' . $db->escapeNumber($featureRequestID) . ', ' . $db->escapeNumber($account->getAccountID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeBoolean(Request::has('anon')) . ',' . $db->escapeString(word_filter($feature)) . ')');
// vote for this feature
diff --git a/engine/Default/feature_request_vote_processing.php b/engine/Default/feature_request_vote_processing.php
index 4af68c395..c1c49c461 100644
--- a/engine/Default/feature_request_vote_processing.php
+++ b/engine/Default/feature_request_vote_processing.php
@@ -50,7 +50,7 @@
)
WHERE feature_request_id IN (' . $db->escapeArray($setStatusIDs) . ')');
foreach ($setStatusIDs as $featureID) {
- $db->query('INSERT INTO feature_request_comments (feature_request_id, poster_id, posting_time, anonymous, text)
+ $db->query('INSERT INTO feature_request_comments (feature_request_id, poster_account_id, posting_time, anonymous, text)
VALUES(' . $db->escapeNumber($featureID) . ', ' . $db->escapeNumber($account->getAccountID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeBoolean(false) . ',' . $db->escapeString($status) . ')');
}
diff --git a/engine/Default/forces_attack_processing.php b/engine/Default/forces_attack_processing.php
index f82e9e8a6..b85f1fad5 100644
--- a/engine/Default/forces_attack_processing.php
+++ b/engine/Default/forces_attack_processing.php
@@ -87,7 +87,7 @@
$results['Attackers'] = array('TotalDamage' => 0);
foreach ($attackers as $attacker) {
$playerResults =& $attacker->shootForces($forces);
- $results['Attackers']['Traders'][$attacker->getAccountID()] =& $playerResults;
+ $results['Attackers']['Traders'][$attacker->getPlayerID()] =& $playerResults;
$results['Attackers']['TotalDamage'] += $playerResults['TotalDamage'];
}
@@ -100,7 +100,7 @@
// Add this log to the `combat_logs` database table
$serializedResults = serialize($results);
-$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'FORCE\',' . $db->escapeNumber($forces->getSectorID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeNumber($player->getAccountID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $db->escapeNumber($forceOwner->getAccountID()) . ',' . $db->escapeNumber($forceOwner->getAllianceID()) . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
+$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'FORCE\',' . $db->escapeNumber($forces->getSectorID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeNumber($player->getPlayerID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $db->escapeNumber($forceOwner->getPlayerID()) . ',' . $db->escapeNumber($forceOwner->getAllianceID()) . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
$logId = $db->getInsertID();
if ($sendMessage) {
@@ -112,7 +112,7 @@
// If their target is dead there is no continue attack button
if ($forces->exists()) {
- $container['owner_id'] = $forces->getOwnerID();
+ $container['owner_id'] = $forces->getOwnerPlayerID();
} else {
$container['owner_id'] = 0;
}
diff --git a/engine/Default/forces_drop.php b/engine/Default/forces_drop.php
index c8c20c501..3a5e97948 100644
--- a/engine/Default/forces_drop.php
+++ b/engine/Default/forces_drop.php
@@ -3,16 +3,16 @@
if (isset($var['owner_id'])) {
$owner = SmrPlayer::getPlayer($var['owner_id'], $player->getGameID());
$template->assign('PageTopic', 'Change ' . htmlentities($owner->getPlayerName()) . '\'s Forces');
- $owner_id = $var['owner_id'];
+ $owner_player_id = $var['owner_player_id'];
} else {
$template->assign('PageTopic', 'Drop Forces');
- $owner_id = $player->getAccountID();
+ $owner_player_id = $player->getPlayerID();
}
$forces = SmrForce::getForce($player->getGameID(), $player->getSectorID(), $owner_id);
$container = create_container('forces_drop_processing.php');
-$container['owner_id'] = $owner_id;
+$container['owner_player_id'] = $owner_player_id;
$template->assign('Forces', $forces);
$template->assign('SubmitHREF', SmrSession::getNewHREF($container));
diff --git a/engine/Default/forces_drop_processing.php b/engine/Default/forces_drop_processing.php
index 317acccb2..4559ff91b 100644
--- a/engine/Default/forces_drop_processing.php
+++ b/engine/Default/forces_drop_processing.php
@@ -146,7 +146,7 @@
}
// message to send out
-if ($forces->getOwnerID() != $player->getAccountID() && $forces->getOwner()->isForceDropMessages()) {
+if (!$forces->getOwner()->equals($player) && $forces->getOwner()->isForceDropMessages()) {
$mines_message = '';
if ($change_mines > 0) {
$mines_message = 'added ' . $change_mines . ' mine';
diff --git a/engine/Default/forces_list.php b/engine/Default/forces_list.php
index 4da6f653c..4d000eb22 100644
--- a/engine/Default/forces_list.php
+++ b/engine/Default/forces_list.php
@@ -4,7 +4,7 @@
$db->query('SELECT *
FROM sector_has_forces
- WHERE owner_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE owner_player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND expire_time >= '.$db->escapeNumber(TIME) . '
ORDER BY sector_id ASC');
diff --git a/engine/Default/galactic_post_write_article_processing.php b/engine/Default/galactic_post_write_article_processing.php
index dc6f413d5..2cdc0128e 100644
--- a/engine/Default/galactic_post_write_article_processing.php
+++ b/engine/Default/galactic_post_write_article_processing.php
@@ -24,16 +24,16 @@
} else {
// Adding a new article
$message = 'Dear Galactic Post editors,
[player=' . $player->getPlayerID() . '] has just submitted an article to the Galactic Post!';
- foreach (Globals::getGalacticPostEditorIDs($player->getGameID()) as $editorID) {
- if ($editorID != $player->getAccountID()) {
- SmrPlayer::sendMessageFromAdmin($player->getGameID(), $editorID, $message);
+ foreach (Globals::getGalacticPostEditorPlayerIDs($player->getGameID()) as $editorPlayerID) {
+ if ($editorPlayerID != $player->getPlayerID()) {
+ SmrPlayer::sendMessageFromAdmin($player->getGameID(), $editorPlayerID, $message);
}
}
$db->query('SELECT MAX(article_id) article_id FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' LIMIT 1');
$db->requireRecord();
$num = $db->getInt('article_id') + 1;
- $db->query('INSERT INTO galactic_post_article (game_id, article_id, writer_id, title, text, last_modified) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($num) . ', ' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeString($title) . ' , ' . $db->escapeString($message) . ' , ' . $db->escapeNumber(TIME) . ')');
+ $db->query('INSERT INTO galactic_post_article (game_id, article_id, player_id, title, text, last_modified) VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($num) . ', ' . $db->escapeNumber($player->getPlayerID()) . ', ' . $db->escapeString($title) . ' , ' . $db->escapeString($message) . ' , ' . $db->escapeNumber(TIME) . ')');
$db->query('UPDATE galactic_post_writer SET last_wrote = ' . $db->escapeNumber(TIME) . ' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
forward(create_container('skeleton.php', 'galactic_post_read.php'));
}
diff --git a/engine/Default/game_join_processing.php b/engine/Default/game_join_processing.php
index bbdc60c9f..c78514549 100644
--- a/engine/Default/game_join_processing.php
+++ b/engine/Default/game_join_processing.php
@@ -68,8 +68,8 @@
// The `player_visited_sector` table holds *unvisited* sectors, so that once
// all sectors are visited (the majority of the game), the table is empty.
-$db->query('INSERT INTO player_visited_sector (account_id, game_id, sector_id)
- SELECT ' . $db->escapeNumber($account->getAccountID()) . ', game_id, sector_id
+$db->query('INSERT INTO player_visited_sector (player_id, game_id, sector_id)
+ SELECT ' . $db->escapeNumber($player->getPlayerID()) . ', game_id, sector_id
FROM sector WHERE game_id = ' . $db->escapeNumber($gameID));
// Mark the player's start sector as visited
@@ -84,7 +84,7 @@
For more tips to help you get started with the game, check out your alliance message boards. These can be reached by clicking the "Alliance" link on the left side of the page, and then clicking the "Message Board" menu link. The SMR Wiki also gives detailed information on all aspects of the game.
SMR is integrated with both IRC and Discord. These are free chat services where you can talk to other players and coordinate with your alliance. Simply click the "Join Chat" link at the bottom left panel of the page.';
- SmrPlayer::sendMessageFromAdmin($gameID, $account->getAccountID(), $message);
+ SmrPlayer::sendMessageFromAdmin($gameID, $player->getPlayerID(), $message);
}
// We aren't in a game yet, so updates are not done automatically here
diff --git a/engine/Default/game_play.php b/engine/Default/game_play.php
index c2e83093b..6b300d8b9 100644
--- a/engine/Default/game_play.php
+++ b/engine/Default/game_play.php
@@ -38,7 +38,7 @@
$games['Play'][$game_id]['PlayGameLink'] = SmrSession::getNewHREF($container);
// creates a new player object
- $curr_player = SmrPlayer::getPlayer($account->getAccountID(), $game_id);
+ $curr_player = SmrPlayer::getPlayerFromAccountID($account->getAccountID(), $game_id);
// update turns for this game
$curr_player->updateTurns();
diff --git a/engine/Default/game_play_processing.php b/engine/Default/game_play_processing.php
index 0f7615fb6..44314f376 100644
--- a/engine/Default/game_play_processing.php
+++ b/engine/Default/game_play_processing.php
@@ -3,7 +3,7 @@
// register game_id
SmrSession::updateGame($var['game_id']);
-$player = SmrPlayer::getPlayer($account->getAccountID(), $var['game_id']);
+$player = SmrPlayer::getPlayerFromAccountID($account->getAccountID(), $var['game_id']);
$player->updateLastCPLAction();
// Check to see if newbie status has changed
diff --git a/engine/Default/game_stats.php b/engine/Default/game_stats.php
index 6a5ff58f5..c35606cc5 100644
--- a/engine/Default/game_stats.php
+++ b/engine/Default/game_stats.php
@@ -27,7 +27,7 @@
$rank = 0;
$expRankings = array();
while ($db->nextRecord()) {
- $expRankings[++$rank] = SmrPlayer::getPlayer($db->getInt('account_id'), $gameID, false, $db);
+ $expRankings[++$rank] = SmrPlayer::getPlayer($db->getInt('player_id'), $gameID, false, $db);
}
$template->assign('ExperienceRankings', $expRankings);
}
@@ -38,7 +38,7 @@
$rank = 0;
$killRankings = array();
while ($db->nextRecord()) {
- $killRankings[++$rank] = SmrPlayer::getPlayer($db->getInt('account_id'), $gameID, false, $db);
+ $killRankings[++$rank] = SmrPlayer::getPlayer($db->getInt('player_id'), $gameID, false, $db);
}
$template->assign('KillRankings', $killRankings);
}
diff --git a/engine/Default/message_blacklist.php b/engine/Default/message_blacklist.php
index 812d1edf7..6dec31c62 100644
--- a/engine/Default/message_blacklist.php
+++ b/engine/Default/message_blacklist.php
@@ -8,7 +8,7 @@
$template->assign('Message', $var['msg']);
}
-$db->query('SELECT p.player_name, p.game_id, b.entry_id FROM player p JOIN message_blacklist b ON p.account_id = b.blacklisted_id AND b.game_id = p.game_id WHERE b.account_id=' . $db->escapeNumber($player->getAccountID()) . ' ORDER BY p.game_id, p.player_name');
+$db->query('SELECT p.player_name, p.game_id, b.entry_id FROM player p JOIN message_blacklist b ON p.player_id = b.blacklisted_player_id AND b.game_id = p.game_id WHERE b.player_id=' . $db->escapeNumber($player->getPlayerID()) . ' ORDER BY p.game_id, p.player_name');
$blacklist = [];
while ($db->nextRecord()) {
diff --git a/engine/Default/message_blacklist_add.php b/engine/Default/message_blacklist_add.php
index e31c74bb6..3bb564508 100644
--- a/engine/Default/message_blacklist_add.php
+++ b/engine/Default/message_blacklist_add.php
@@ -2,8 +2,8 @@
$container = create_container('skeleton.php', 'message_blacklist.php');
-if (isset($var['account_id'])) {
- $blacklisted = SmrPlayer::getPlayer($var['account_id'], $player->getGameID());
+if (isset($var['player_id'])) {
+ $blacklisted = SmrPlayer::getPlayer($var['player_id'], $player->getGameID());
} else {
try {
$blacklisted = SmrPlayer::getPlayerByPlayerName(Request::get('PlayerName'), $player->getGameID());
@@ -20,7 +20,7 @@
forward($container);
}
-$db->query('INSERT INTO message_blacklist (game_id,account_id,blacklisted_id) VALUES (' . $db->escapeNumber($player->getGameID()) . ',' . $db->escapeNumber($player->getAccountID()) . ',' . $db->escapeNumber($blacklisted->getAccountID()) . ')');
+$db->query('INSERT INTO message_blacklist (game_id, player_id, blacklisted_player_id) VALUES (' . $db->escapeNumber($player->getGameID()) . ',' . $db->escapeNumber($player->getPlayerID()) . ',' . $db->escapeNumber($blacklisted->getPlayerID()) . ')');
$container['msg'] = $blacklisted->getDisplayName() . ' has been added to your blacklist.';
forward($container);
diff --git a/engine/Default/message_blacklist_del.php b/engine/Default/message_blacklist_del.php
index 3114ed7fc..37e673c1c 100644
--- a/engine/Default/message_blacklist_del.php
+++ b/engine/Default/message_blacklist_del.php
@@ -8,5 +8,6 @@
forward($container);
}
-$db->query('DELETE FROM message_blacklist WHERE account_id=' . $db->escapeNumber($player->getAccountID()) . ' AND entry_id IN (' . $db->escapeArray($entry_ids) . ')');
+// TODO: does this need game_id?
+$db->query('DELETE FROM message_blacklist WHERE player_id=' . $db->escapeNumber($player->getPlayerID()) . ' AND entry_id IN (' . $db->escapeArray($entry_ids) . ')');
forward($container);
diff --git a/engine/Default/message_box.php b/engine/Default/message_box.php
index c447e9e38..506af72b0 100644
--- a/engine/Default/message_box.php
+++ b/engine/Default/message_box.php
@@ -15,7 +15,7 @@
$messageBox['HasUnread'] = false;
} else {
$db->query('SELECT 1 FROM message
- WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND message_type_id = ' . $db->escapeNumber($message_type_id) . '
AND msg_read = ' . $db->escapeBoolean(false) . '
@@ -26,13 +26,13 @@
// get number of msges
if ($message_type_id == MSG_SENT) {
$db->query('SELECT count(message_id) as message_count FROM message
- WHERE sender_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE sender_player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND message_type_id = ' . $db->escapeNumber(MSG_PLAYER) . '
AND sender_delete = ' . $db->escapeBoolean(false));
} else {
$db->query('SELECT count(message_id) as message_count FROM message
- WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND message_type_id = ' . $db->escapeNumber($message_type_id) . '
AND receiver_delete = ' . $db->escapeBoolean(false));
diff --git a/engine/Default/message_box_delete_processing.php b/engine/Default/message_box_delete_processing.php
index a6df7e2db..ac27de9bf 100644
--- a/engine/Default/message_box_delete_processing.php
+++ b/engine/Default/message_box_delete_processing.php
@@ -2,11 +2,11 @@
if ($var['folder_id'] == MSG_SENT) {
$db->query('UPDATE message SET sender_delete = ' . $db->escapeBoolean(true) . '
- WHERE sender_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE sender_player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()));
} else {
$db->query('UPDATE message SET receiver_delete = ' . $db->escapeBoolean(true) . '
- WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND message_type_id = ' . $db->escapeNumber($var['folder_id']) . '
AND msg_read = ' . $db->escapeBoolean(true));
diff --git a/engine/Default/message_delete_processing.php b/engine/Default/message_delete_processing.php
index 22da0cd32..3bf3f12c3 100644
--- a/engine/Default/message_delete_processing.php
+++ b/engine/Default/message_delete_processing.php
@@ -14,11 +14,11 @@
foreach (Request::getArray('message_id') as $id) {
if ($temp = @unserialize(base64_decode($id))) {
$db->query('SELECT message_id FROM message
- WHERE sender_id = ' . $db->escapeNumber($temp[0]) . '
+ WHERE sender_player_id = ' . $db->escapeNumber($temp[0]) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND send_time >= ' . $db->escapeNumber($temp[1]) . '
AND send_time <= ' . $db->escapeNumber($temp[2]) . '
- AND account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ AND player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND message_type_id = ' . $db->escapeNumber(MSG_SCOUT) . ' AND receiver_delete = ' . $db->escapeBoolean(false));
while ($db->nextRecord()) {
$message_id_list[] = $db->getInt('message_id');
diff --git a/engine/Default/message_notify_processing.php b/engine/Default/message_notify_processing.php
index 5acde9973..bd5e203dd 100644
--- a/engine/Default/message_notify_processing.php
+++ b/engine/Default/message_notify_processing.php
@@ -20,7 +20,7 @@
}
// get message form db
-$db->query('SELECT account_id, sender_id, message_text
+$db->query('SELECT player_id, sender_player_id, message_text
FROM message
WHERE message_id = ' . $var['message_id'] . ' AND receiver_delete = \'FALSE\'');
if (!$db->nextRecord()) {
@@ -29,7 +29,7 @@
// insert
$db->query('INSERT INTO message_notify
- (notify_id, game_id, from_id, to_id, text, sent_time, notify_time)
- VALUES ('.$notify_id . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->getInt('sender_id') . ', ' . $db->getInt('account_id') . ', ' . $db->escapeString($db->getField('message_text')) . ', ' . $var['sent_time'] . ', ' . $var['notified_time'] . ')');
+ (notify_id, game_id, from_player_id, to_player_id, text, sent_time, notify_time)
+ VALUES ('.$notify_id . ', ' . $db->escapeNumber($player->getGameID()) . ', ' . $db->getInt('sender_player_id') . ', ' . $db->getInt('player_id') . ', ' . $db->escapeString($db->getField('message_text')) . ', ' . $var['sent_time'] . ', ' . $var['notified_time'] . ')');
forward($container);
diff --git a/engine/Default/message_send_processing.php b/engine/Default/message_send_processing.php
index 3bbdbbeca..ba3a885ad 100644
--- a/engine/Default/message_send_processing.php
+++ b/engine/Default/message_send_processing.php
@@ -20,14 +20,14 @@
}
if (isset($var['alliance_id'])) {
- $db->query('SELECT account_id FROM player
+ $db->query('SELECT player_id FROM player
WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND alliance_id = ' . $var['alliance_id'] . '
- AND account_id != ' . $db->escapeNumber($player->getAccountID())); //No limit in case they are over limit - ie NHA
+ AND player_id != ' . $db->escapeNumber($player->getPlayerID())); //No limit in case they are over limit - ie NHA
while ($db->nextRecord()) {
- $player->sendMessage($db->getInt('account_id'), MSG_ALLIANCE, $message, false);
+ $player->sendMessage($db->getInt('player_id'), MSG_ALLIANCE, $message, false);
}
- $player->sendMessage($player->getAccountID(), MSG_ALLIANCE, $message, true, false);
+ $player->sendMessage($player->getPlayerID(), MSG_ALLIANCE, $message, true, false);
} elseif (!empty($var['receiver'])) {
$player->sendMessage($var['receiver'], MSG_PLAYER, $message);
} else {
diff --git a/engine/Default/message_view.php b/engine/Default/message_view.php
index 9dde0a11b..fc4528491 100644
--- a/engine/Default/message_view.php
+++ b/engine/Default/message_view.php
@@ -4,11 +4,11 @@
$whereClause = 'WHERE game_id = ' . $db->escapeNumber($player->getGameID());
if ($var['folder_id'] == MSG_SENT) {
- $whereClause .= ' AND sender_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ $whereClause .= ' AND sender_player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND message_type_id = ' . $db->escapeNumber(MSG_PLAYER) . '
AND sender_delete = ' . $db->escapeBoolean(false);
} else {
- $whereClause .= ' AND account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ $whereClause .= ' AND player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND message_type_id = ' . $db->escapeNumber($var['folder_id']) . '
AND receiver_delete = ' . $db->escapeBoolean(false);
}
@@ -81,7 +81,7 @@
displayScouts($messageBox, $player);
} else {
while ($db->nextRecord()) {
- displayMessage($messageBox, $db->getInt('message_id'), $db->getInt('account_id'), $db->getInt('sender_id'), $db->getField('message_text'), $db->getInt('send_time'), $db->getBoolean('msg_read'), $var['folder_id']);
+ displayMessage($messageBox, $db->getInt('message_id'), $db->getInt('player_id'), $db->getInt('sender_player_id'), $db->getField('message_text'), $db->getInt('send_time'), $db->getBoolean('msg_read'), $var['folder_id']);
}
}
if (!USING_AJAX) {
@@ -96,16 +96,16 @@ function displayScouts(&$messageBox, $player) {
$db = new SmrMySqlDatabase();
$db->query('SELECT player.*, count( message_id ) AS number, min( send_time ) as first, max( send_time) as last, sum(msg_read=\'FALSE\') as total_unread
FROM message
- JOIN player ON player.account_id = message.sender_id AND message.game_id = player.game_id
- WHERE message.account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ JOIN player ON player.player_id = message.sender_player_id AND message.game_id = player.game_id
+ WHERE message.player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND player.game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND message_type_id = ' . $db->escapeNumber(MSG_SCOUT) . '
AND receiver_delete = ' . $db->escapeBoolean(false) . '
- GROUP BY sender_id
+ GROUP BY sender_player_id
ORDER BY last DESC');
while ($db->nextRecord()) {
- $sender = SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID(), false, $db);
+ $sender = SmrPlayer::getPlayer($db->getInt('player_id'), $player->getGameID(), false, $db);
$totalUnread = $db->getInt('total_unread');
$message = 'Your forces have spotted ' . $sender->getBBLink() . ' passing your forces ' . $db->getInt('number') . ' ' . pluralise('time', $db->getInt('number'));
$message .= ($totalUnread > 0) ? ' (' . $totalUnread . ' unread).' : '.';
@@ -114,18 +114,18 @@ function displayScouts(&$messageBox, $player) {
// Now display individual messages in each group
// Perform a single query to minimize query overhead
- $db->query('SELECT message_id, account_id, sender_id, message_text, send_time, msg_read
+ $db->query('SELECT message_id, player_id, sender_player_id, message_text, send_time, msg_read
FROM message
- WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ WHERE player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND message_type_id = ' . $db->escapeNumber(MSG_SCOUT) . '
AND receiver_delete = ' . $db->escapeBoolean(false) . '
ORDER BY send_time DESC');
while ($db->nextRecord()) {
- $groupBox =& $messageBox['GroupedMessages'][$db->getInt('sender_id')];
+ $groupBox =& $messageBox['GroupedMessages'][$db->getInt('sender_player_id')];
// Limit the number of messages in each group
if (!isset($groupBox['Messages']) || count($groupBox['Messages']) < MESSAGE_SCOUT_GROUP_LIMIT) {
- displayMessage($groupBox, $db->getInt('message_id'), $db->getInt('account_id'), $db->getInt('sender_id'), stripslashes($db->getField('message_text')), $db->getInt('send_time'), $db->getBoolean('msg_read'), MSG_SCOUT);
+ displayMessage($groupBox, $db->getInt('message_id'), $db->getInt('player_id'), $db->getInt('sender_player_id'), stripslashes($db->getField('message_text')), $db->getInt('send_time'), $db->getBoolean('msg_read'), MSG_SCOUT);
}
}
@@ -138,7 +138,7 @@ function displayScouts(&$messageBox, $player) {
function displayGrouped(&$messageBox, SmrPlayer $sender, $message_text, $first, $last, $star) {
// Define a unique array so we can delete grouped messages
$array = array(
- $sender->getAccountID(),
+ $sender->getPlayerID(),
$first,
$last
);
@@ -146,14 +146,14 @@ function displayGrouped(&$messageBox, SmrPlayer $sender, $message_text, $first,
$message = array();
$message['ID'] = base64_encode(serialize($array));
$message['Unread'] = $star;
- $message['SenderID'] = $sender->getAccountID();
+ $message['SenderPlayerID'] = $sender->getPlayerID();
$message['SenderDisplayName'] = $sender->getLinkedDisplayName(false);
$message['SendTime'] = date(DATE_FULL_SHORT, $first) . " - " . date(DATE_FULL_SHORT, $last);
$message['Text'] = $message_text;
$messageBox['Messages'][] = $message;
}
-function displayMessage(&$messageBox, $message_id, $receiver_id, $sender_id, $message_text, $send_time, $msg_read, $type) {
+function displayMessage(&$messageBox, $message_id, $receiver_player_id, $sender_player_id, $message_text, $send_time, $msg_read, $type) {
global $player;
$message = array();
@@ -164,7 +164,7 @@ function displayMessage(&$messageBox, $message_id, $receiver_id, $sender_id, $me
// Display the sender (except for scout messages)
if ($type != MSG_SCOUT) {
- $sender = getMessagePlayer($sender_id, $player->getGameID(), $type);
+ $sender = getMessagePlayer($sender_player_id, $player->getGameID(), $type);
if ($sender instanceof SmrPlayer) {
$message['Sender'] = $sender;
$container = create_container('skeleton.php', 'trader_search_result.php');
@@ -180,11 +180,11 @@ function displayMessage(&$messageBox, $message_id, $receiver_id, $sender_id, $me
$message['ReportHref'] = SmrSession::getNewHREF($container);
$container = create_container('skeleton.php', 'message_blacklist_add.php');
- $container['account_id'] = $sender_id;
+ $container['player_id'] = $sender_player_id;
$message['BlacklistHref'] = SmrSession::getNewHREF($container);
$container = create_container('skeleton.php', 'message_send.php');
- $container['receiver'] = $sender->getAccountID();
+ $container['receiver'] = $sender->getPlayerID();
$message['ReplyHref'] = SmrSession::getNewHREF($container);
}
} else {
@@ -193,7 +193,7 @@ function displayMessage(&$messageBox, $message_id, $receiver_id, $sender_id, $me
}
if ($type == MSG_SENT) {
- $receiver = SmrPlayer::getPlayer($receiver_id, $player->getGameID());
+ $receiver = SmrPlayer::getPlayer($receiver_player_id, $player->getGameID());
$container = create_container('skeleton.php', 'trader_search_result.php');
$container['player_id'] = $receiver->getPlayerID();
$message['ReceiverDisplayName'] = create_link($container, $receiver->getDisplayName());
diff --git a/engine/Default/news_read_advanced.php b/engine/Default/news_read_advanced.php
index d205e34d3..10de3bd6f 100644
--- a/engine/Default/news_read_advanced.php
+++ b/engine/Default/news_read_advanced.php
@@ -58,9 +58,9 @@
$db->query('SELECT * FROM player WHERE player_name LIKE ' . $db->escapeString('%' . $p_name . '%') . ' AND game_id = ' . $db->escapeNumber($gameID));
$IDs = array(0);
while ($db->nextRecord()) {
- $IDs[] = $db->getInt('account_id');
+ $IDs[] = $db->getInt('player_id');
}
- $db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND (killer_id IN (' . $db->escapeArray($IDs) . ') OR dead_id IN (' . $db->escapeArray($IDs) . ')) ORDER BY news_id DESC');
+ $db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND (killer_player_id IN (' . $db->escapeArray($IDs) . ') OR dead_player_id IN (' . $db->escapeArray($IDs) . ')) ORDER BY news_id DESC');
} elseif ($submit_value == 'Search For Alliance') {
if (isset($_REQUEST['allianceID'])) {
SmrSession::updateVar('AllianceID', $_REQUEST['allianceID']);
@@ -70,25 +70,25 @@
}
$allianceID = $var['AllianceID'];
$template->assign('ResultsFor', $newsAlliances[$allianceID]['Name']);
- $db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND ((killer_alliance = ' . $db->escapeNumber($allianceID) . ' AND killer_id != ' . $db->escapeNumber(ACCOUNT_ID_PORT) . ') OR (dead_alliance = ' . $db->escapeNumber($allianceID) . ' AND dead_id != ' . $db->escapeNumber(ACCOUNT_ID_PORT) . ')) ORDER BY news_id DESC');
+ $db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND ((killer_alliance = ' . $db->escapeNumber($allianceID) . ' AND killer_player_id != ' . $db->escapeNumber(PLAYER_ID_PORT) . ') OR (dead_alliance = ' . $db->escapeNumber($allianceID) . ' AND dead_player_id != ' . $db->escapeNumber(PLAYER_ID_PORT) . ')) ORDER BY news_id DESC');
} elseif ($submit_value == 'Search For Players') {
$template->assign('ResultsFor', $_REQUEST['player1'] . ' vs. ' . $_REQUEST['player2']);
$db->query('SELECT * FROM player WHERE player_name LIKE ' . $db->escapeString('%' . $_REQUEST['player1'] . '%') . ' AND game_id = ' . $db->escapeNumber($gameID));
$IDs = array(0);
while ($db->nextRecord()) {
- $IDs[] = $db->getInt('account_id');
+ $IDs[] = $db->getInt('player_id');
}
$db->query('SELECT * FROM player WHERE player_name LIKE ' . $db->escapeString('%' . $_REQUEST['player2'] . '%') . ' AND game_id = ' . $db->escapeNumber($gameID));
$IDs2 = array(0);
while ($db->nextRecord()) {
- $IDs2[] = $db->getInt('account_id');
+ $IDs2[] = $db->getInt('player_id');
}
$db->query('SELECT * FROM news
WHERE game_id = ' . $db->escapeNumber($gameID) . '
AND (
- (killer_id IN (' . $db->escapeArray($IDs) . ') AND dead_id IN (' . $db->escapeArray($IDs2) . '))
+ (killer_player_id IN (' . $db->escapeArray($IDs) . ') AND dead_player_id IN (' . $db->escapeArray($IDs2) . '))
OR
- (killer_id IN (' . $db->escapeArray($IDs2) . ') AND dead_id IN (' . $db->escapeArray($IDs) . '))
+ (killer_player_id IN (' . $db->escapeArray($IDs2) . ') AND dead_player_id IN (' . $db->escapeArray($IDs) . '))
) ORDER BY news_id DESC');
} elseif ($submit_value == 'Search For Alliances') {
$template->assign('ResultsFor', $newsAlliances[$_REQUEST['alliance1']]['Name'] . ' vs. ' . $newsAlliances[$_REQUEST['alliance2']]['Name']);
diff --git a/engine/Default/note_add_processing.php b/engine/Default/note_add_processing.php
index 986a22734..560f7cc5e 100644
--- a/engine/Default/note_add_processing.php
+++ b/engine/Default/note_add_processing.php
@@ -8,8 +8,8 @@
$note = htmlentities($note, ENT_QUOTES, 'utf-8');
$note = nl2br($note);
-$db->query('INSERT INTO player_has_notes (account_id,game_id,note) VALUES(' .
- $db->escapeNumber($player->getAccountID()) . ',' .
+$db->query('INSERT INTO player_has_notes (player_id,game_id,note) VALUES(' .
+ $db->escapeNumber($player->getPlayerID()) . ',' .
$db->escapeNumber($player->getGameID()) . ',' .
$db->escapeBinary(gzcompress($note)) . ')');
diff --git a/engine/Default/note_delete_processing.php b/engine/Default/note_delete_processing.php
index 2bf09779b..87715990f 100644
--- a/engine/Default/note_delete_processing.php
+++ b/engine/Default/note_delete_processing.php
@@ -3,7 +3,7 @@
$note_ids = Request::getIntArray('note_id', []);
if (!empty($note_ids)) {
$db->query('DELETE FROM player_has_notes WHERE game_id=' . $db->escapeNumber($player->getGameID()) . '
- AND account_id=' . $db->escapeNumber($player->getAccountID()) . '
+ AND player_id=' . $db->escapeNumber($player->getPlayerID()) . '
AND note_id IN (' . $db->escapeArray($note_ids) . ')');
}
diff --git a/engine/Default/planet_attack_processing.php b/engine/Default/planet_attack_processing.php
index 655a004c7..a4502ba8a 100644
--- a/engine/Default/planet_attack_processing.php
+++ b/engine/Default/planet_attack_processing.php
@@ -58,7 +58,7 @@
foreach ($attackers as $attacker) {
$playerResults =& $attacker->shootPlanet($planet, false);
- $results['Attackers']['Traders'][$attacker->getAccountID()] =& $playerResults;
+ $results['Attackers']['Traders'][$attacker->getPlayerID()] =& $playerResults;
$results['Attackers']['TotalDamage'] += $playerResults['TotalDamage'];
}
$results['Attackers']['Downgrades'] = $planet->checkForDowngrade($results['Attackers']['TotalDamage']);
@@ -70,7 +70,7 @@
// Add this log to the `combat_logs` database table
$serializedResults = serialize($results);
-$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'PLANET\',' . $planet->getSectorID() . ',' . TIME . ',' . $db->escapeNumber($player->getAccountID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $planetOwner->getAccountID() . ',' . $planetOwner->getAllianceID() . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
+$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'PLANET\',' . $planet->getSectorID() . ',' . TIME . ',' . $db->escapeNumber($player->getPlayerID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $planetOwner->getPlayerID() . ',' . $planetOwner->getAllianceID() . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
$logId = $db->getInsertID();
if ($planet->isDestroyed()) {
@@ -86,17 +86,17 @@
// Send notification to planet owners
if ($planetOwner->hasAlliance()) {
- foreach ($planetOwner->getAlliance()->getMemberIDs() as $allyAccountID) {
- SmrPlayer::sendMessageFromPlanet($planet->getGameID(), $allyAccountID, $planetAttackMessage);
+ foreach ($planetOwner->getAlliance()->getMemberPlayerIDs() as $allyPlayerID) {
+ SmrPlayer::sendMessageFromPlanet($planet->getGameID(), $allyPlayerID, $planetAttackMessage);
}
} else {
- SmrPlayer::sendMessageFromPlanet($planet->getGameID(), $planetOwner->getAccountID(), $planetAttackMessage);
+ SmrPlayer::sendMessageFromPlanet($planet->getGameID(), $planetOwner->getPlayerID(), $planetAttackMessage);
}
// Update sector messages for attackers
foreach ($attackers as $attacker) {
if (!$player->equals($attacker)) {
- $db->query('REPLACE INTO sector_message VALUES(' . $attacker->getAccountID() . ',' . $attacker->getGameID() . ',' . $db->escapeString('[ATTACK_RESULTS]' . $logId) . ')');
+ $db->query('REPLACE INTO sector_message VALUES(' . $attacker->getPlayerID() . ',' . $attacker->getGameID() . ',' . $db->escapeString('[ATTACK_RESULTS]' . $logId) . ')');
}
}
diff --git a/engine/Default/planet_kick_processing.php b/engine/Default/planet_kick_processing.php
index fe3b3d6d7..324c52b8e 100644
--- a/engine/Default/planet_kick_processing.php
+++ b/engine/Default/planet_kick_processing.php
@@ -4,13 +4,13 @@
}
$planet = $player->getSectorPlanet();
-$planetPlayer = SmrPlayer::getPlayer($var['account_id'], $player->getGameID());
+$planetPlayer = SmrPlayer::getPlayer($var['targetPlayerID'], $player->getGameID());
$owner = $planet->getOwner();
if ($owner->getAllianceID() != $player->getAllianceID()) {
create_error('You can not kick someone off a planet your alliance does not own!');
}
$message = 'You have been kicked from ' . $planet->getDisplayName() . ' in ' . Globals::getSectorBBLink($player->getSectorID());
-$player->sendMessage($planetPlayer->getAccountID(), MSG_PLAYER, $message, false);
+$player->sendMessage($planetPlayer->getPlayerID(), MSG_PLAYER, $message, false);
$planetPlayer->setLandedOnPlanet(false);
$planetPlayer->update();
diff --git a/engine/Default/planet_land_processing.php b/engine/Default/planet_land_processing.php
index d00ded6e6..4daae88bf 100644
--- a/engine/Default/planet_land_processing.php
+++ b/engine/Default/planet_land_processing.php
@@ -25,7 +25,7 @@
$db->query('SELECT * FROM alliance_has_roles WHERE alliance_id = ' . $db->escapeNumber($player->getAllianceID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND role_id = ' . $db->escapeNumber($role_id));
$db->requireRecord();
if (!$db->getBoolean('planet_access')) {
- if ($planet->hasOwner() && $planet->getOwnerID() != $player->getAccountID()) {
+ if ($planet->hasOwner() && $planet->getOwnerPlayerID() != $player->getPlayerID()) {
create_error('Your alliance doesn\'t allow you to dock at their planet.');
}
}
diff --git a/engine/Default/planet_ownership_processing.php b/engine/Default/planet_ownership_processing.php
index 499950f61..75da538a4 100644
--- a/engine/Default/planet_ownership_processing.php
+++ b/engine/Default/planet_ownership_processing.php
@@ -12,12 +12,12 @@
}
// delete all previous ownerships
- $db->query('UPDATE planet SET owner_id = 0, password = NULL
- WHERE owner_id = ' . $db->escapeNumber($player->getAccountID()) . '
+ $db->query('UPDATE planet SET owner_player_id = 0, password = NULL
+ WHERE owner_player_id = ' . $db->escapeNumber($player->getPlayerID()) . '
AND game_id = ' . $db->escapeNumber($player->getGameID()));
// set ownership
- $planet->setOwnerID($player->getAccountID());
+ $planet->setOwnerPlayerID($player->getPlayerID());
$planet->removePassword();
$planet->update();
$player->log(LOG_TYPE_PLANETS, 'Player takes ownership of planet.');
diff --git a/engine/Default/port_attack_processing.php b/engine/Default/port_attack_processing.php
index 5896ab3c5..5ffdbd639 100644
--- a/engine/Default/port_attack_processing.php
+++ b/engine/Default/port_attack_processing.php
@@ -53,7 +53,7 @@
foreach ($attackers as $attacker) {
$playerResults =& $attacker->shootPort($port);
- $results['Attackers']['Traders'][$attacker->getAccountID()] =& $playerResults;
+ $results['Attackers']['Traders'][$attacker->getPlayerID()] =& $playerResults;
$results['Attackers']['TotalDamage'] += $playerResults['TotalDamage'];
}
$results['Attackers']['Downgrades'] = $port->checkForDowngrade($results['Attackers']['TotalDamage']);
@@ -65,11 +65,11 @@
$port->update();
$serializedResults = serialize($results);
-$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'PORT\',' . $db->escapeNumber($port->getSectorID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeNumber($player->getAccountID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $db->escapeNumber(ACCOUNT_ID_PORT) . ',' . $db->escapeNumber(PORT_ALLIANCE_ID) . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
+$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'PORT\',' . $db->escapeNumber($port->getSectorID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeNumber($player->getPlayerID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $db->escapeNumber(PLAYER_ID_PORT) . ',' . $db->escapeNumber(PORT_ALLIANCE_ID) . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
$logId = $db->escapeString('[ATTACK_RESULTS]' . $db->getInsertID());
foreach ($attackers as $attacker) {
if (!$player->equals($attacker)) {
- $db->query('REPLACE INTO sector_message VALUES(' . $db->escapeNumber($attacker->getAccountID()) . ',' . $db->escapeNumber($attacker->getGameID()) . ',' . $logId . ')');
+ $db->query('REPLACE INTO sector_message VALUES(' . $db->escapeNumber($attacker->getPlayerID()) . ',' . $db->escapeNumber($attacker->getGameID()) . ',' . $logId . ')');
}
}
diff --git a/engine/Default/preferences_processing.php b/engine/Default/preferences_processing.php
index 0ab15a00a..b0a3c9773 100644
--- a/engine/Default/preferences_processing.php
+++ b/engine/Default/preferences_processing.php
@@ -232,7 +232,7 @@
$player->setPlayerNameByPlayer($player_name);
$news = 'Please be advised that ' . $old_name . ' has changed their name to ' . $player->getBBLink();
- $db->query('INSERT INTO news (time, news_message, game_id, type, killer_id) VALUES (' . $db->escapeNumber(TIME) . ',' . $db->escapeString($news) . ',' . $db->escapeNumber($player->getGameID()) . ', \'admin\', ' . $db->escapeNumber($player->getAccountID()) . ')');
+ $db->query('INSERT INTO news (time, news_message, game_id, type, killer_player_id) VALUES (' . $db->escapeNumber(TIME) . ',' . $db->escapeString($news) . ',' . $db->escapeNumber($player->getGameID()) . ', \'admin\', ' . $db->escapeNumber($player->getPlayerID()) . ')');
$container['msg'] = 'SUCCESS: You have changed your player name.';
} elseif ($action == 'change_race') {
if (!$player->canChangeRace()) {
@@ -263,7 +263,7 @@
$player->giveStartingRelations();
$news = 'Please be advised that ' . $player->getBBLink() . ' has changed their race from [race=' . $oldRaceID . '] to [race=' . $player->getRaceID() . ']';
- $db->query('INSERT INTO news (time, news_message, game_id, type, killer_id) VALUES (' . $db->escapeNumber(TIME) . ',' . $db->escapeString($news) . ',' . $db->escapeNumber($player->getGameID()) . ', \'admin\', ' . $db->escapeNumber($player->getAccountID()) . ')');
+ $db->query('INSERT INTO news (time, news_message, game_id, type, killer_player_id) VALUES (' . $db->escapeNumber(TIME) . ',' . $db->escapeString($news) . ',' . $db->escapeNumber($player->getGameID()) . ', \'admin\', ' . $db->escapeNumber($player->getPlayerID()) . ')');
$container['msg'] = 'SUCCESS: You have changed your player race.';
} elseif ($action == 'Update Colours') {
$friendlyColour = Request::get('friendly_color');
diff --git a/engine/Default/trader_attack_processing.php b/engine/Default/trader_attack_processing.php
index 79e63016b..9f215b04b 100644
--- a/engine/Default/trader_attack_processing.php
+++ b/engine/Default/trader_attack_processing.php
@@ -16,7 +16,7 @@
create_error('You are not allowed to fight!');
}
-$targetPlayer = SmrPlayer::getPlayer($var['target'], $player->getGameID());
+$targetPlayer = SmrPlayer::getPlayer($var['targetPlayerID'], $player->getGameID());
if ($player->traderNAPAlliance($targetPlayer)) {
create_error('Your alliance does not allow you to attack this trader.');
@@ -46,9 +46,9 @@
$player->update();
function teamAttack(&$results, $fightingPlayers, $attack, $defend) {
- foreach ($fightingPlayers[$attack] as $accountID => $teamPlayer) {
+ foreach ($fightingPlayers[$attack] as $playerID => $teamPlayer) {
$playerResults =& $teamPlayer->shootPlayers($fightingPlayers[$defend]);
- $results[$attack]['Traders'][$teamPlayer->getAccountID()] =& $playerResults;
+ $results[$attack]['Traders'][$teamPlayer->getPlayerID()] =& $playerResults;
$results[$attack]['TotalDamage'] += $playerResults['TotalDamage'];
// Award assists (if there are multiple attackers)
@@ -76,7 +76,7 @@ function teamAttack(&$results, $fightingPlayers, $attack, $defend) {
$account->log(LOG_TYPE_TRADER_COMBAT, 'Player attacks player, their team does ' . $results['Attackers']['TotalDamage'] . ' and the other team does ' . $results['Defenders']['TotalDamage'], $sector->getSectorID());
$serializedResults = serialize($results);
-$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'PLAYER\',' . $db->escapeNumber($sector->getSectorID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeNumber($player->getAccountID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $db->escapeNumber($var['target']) . ',' . $db->escapeNumber($targetPlayer->getAllianceID()) . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
+$db->query('INSERT INTO combat_logs VALUES(\'\',' . $db->escapeNumber($player->getGameID()) . ',\'PLAYER\',' . $db->escapeNumber($sector->getSectorID()) . ',' . $db->escapeNumber(TIME) . ',' . $db->escapeNumber($player->getPlayerID()) . ',' . $db->escapeNumber($player->getAllianceID()) . ',' . $db->escapeNumber($var['target']) . ',' . $db->escapeNumber($targetPlayer->getAllianceID()) . ',' . $db->escapeBinary(gzcompress($serializedResults)) . ')');
$container = create_container('skeleton.php', 'trader_attack.php');
diff --git a/engine/Default/trader_examine.php b/engine/Default/trader_examine.php
index 17485f108..5782e13d4 100644
--- a/engine/Default/trader_examine.php
+++ b/engine/Default/trader_examine.php
@@ -1,7 +1,7 @@
getGameID());
+$targetPlayer = SmrPlayer::getPlayer($var['targetPlayerID'], $player->getGameID());
if ($targetPlayer->isDead()) {
$container = create_container('skeleton.php', 'current_sector.php');
diff --git a/engine/Default/trader_savings.php b/engine/Default/trader_savings.php
index 5b7db674c..c8ae20203 100644
--- a/engine/Default/trader_savings.php
+++ b/engine/Default/trader_savings.php
@@ -5,7 +5,7 @@
Menu::trader();
$anonAccounts = [];
-$db->query('SELECT * FROM anon_bank WHERE owner_id = ' . $db->escapeNumber($player->getAccountID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
+$db->query('SELECT * FROM anon_bank WHERE owner_player_id = ' . $db->escapeNumber($player->getPlayerID()) . ' AND game_id = ' . $db->escapeNumber($player->getGameID()));
while ($db->nextRecord()) {
$anonAccounts[] = [
'ID' => $db->getInt('anon_id'),
diff --git a/engine/Default/trader_search_result.php b/engine/Default/trader_search_result.php
index cb230ee81..7964986b6 100644
--- a/engine/Default/trader_search_result.php
+++ b/engine/Default/trader_search_result.php
@@ -17,7 +17,7 @@
WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
AND player_name = ' . $db->escapeString($player_name) . ' LIMIT 1');
if ($db->nextRecord()) {
- $resultPlayer = SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID(), false, $db);
+ $resultPlayer = SmrPlayer::getPlayer($db->getInt('player_id'), $player->getGameID(), false, $db);
}
$db->query('SELECT * FROM player
@@ -27,7 +27,7 @@
ORDER BY player_name LIMIT 5');
$similarPlayers = array();
while ($db->nextRecord()) {
- $similarPlayers[] = SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID(), false, $db);
+ $similarPlayers[] = SmrPlayer::getPlayer($db->getInt('player_id'), $player->getGameID(), false, $db);
}
}
@@ -44,11 +44,11 @@ function playerLinks(SmrPlayer $curr_player) {
$result['RaceHREF'] = SmrSession::getNewHREF($container);
$container = create_container('skeleton.php', 'message_send.php');
- $container['receiver'] = $curr_player->getAccountID();
+ $container['receiver'] = $curr_player->getPlayerID();
$result['MessageHREF'] = SmrSession::getNewHREF($container);
$container = create_container('skeleton.php', 'bounty_view.php');
- $container['id'] = $curr_player->getAccountID();
+ $container['id'] = $curr_player->getPlayerID();
$result['BountyHREF'] = SmrSession::getNewHREF($container);
$container = create_container('skeleton.php', 'hall_of_fame_player_detail.php');
diff --git a/engine/Default/trader_status.php b/engine/Default/trader_status.php
index 8aa09bb42..97f4d807f 100644
--- a/engine/Default/trader_status.php
+++ b/engine/Default/trader_status.php
@@ -19,7 +19,7 @@
$container['body'] = 'trader_bounties.php';
$template->assign('BountiesHREF', SmrSession::getNewHREF($container));
-$db->query('SELECT count(*) FROM bounty WHERE claimer_id=' . $db->escapeNumber($player->getAccountID()) . ' AND game_id=' . $db->escapeNumber($player->getGameID()));
+$db->query('SELECT count(*) FROM bounty WHERE claimer_player_id=' . $db->escapeNumber($player->getPlayerID()) . ' AND game_id=' . $db->escapeNumber($player->getGameID()));
$db->requireRecord();
$template->assign('BountiesClaimable', $db->getInt('count(*)'));
diff --git a/engine/Draft/alliance_pick.inc b/engine/Draft/alliance_pick.inc
index bd97fb131..12302cba6 100644
--- a/engine/Draft/alliance_pick.inc
+++ b/engine/Draft/alliance_pick.inc
@@ -4,22 +4,22 @@
// including their current size and if the leader can pick teammates.
function get_draft_teams($gameId) {
$db = new SmrMySqlDatabase();
- $db->query('SELECT account_id FROM draft_leaders WHERE game_id=' . $db->escapeNumber($gameId));
+ $db->query('SELECT player_id FROM draft_leaders WHERE game_id=' . $db->escapeNumber($gameId));
// Get team leader, alliance, and alliance size
$teams = array();
while ($db->nextRecord()) {
- $leader = SmrPlayer::getPlayer($db->getInt('account_id'), $gameId);
+ $leader = SmrPlayer::getPlayer($db->getInt('player_id'), $gameId);
$alliance = $leader->getAlliance();
if (!$leader->hasAlliance() || $alliance->getAllianceID() == NHA_ID) {
// Special case for leaders who haven't made their own alliance yet,
// or are still in the Newbie Help Alliance.
- $teams[$leader->getAccountId()] = array('Leader' => $leader,
- 'Size' => 0);
+ $teams[$leader->getPlayerID()] = array('Leader' => $leader,
+ 'Size' => 0);
} else {
- $teams[$leader->getAccountId()] = array('Leader' => $leader,
- 'Alliance' => $alliance,
- 'Size' => $alliance->getNumMembers());
+ $teams[$leader->getPlayerID()] = array('Leader' => $leader,
+ 'Alliance' => $alliance,
+ 'Size' => $alliance->getNumMembers());
}
}
diff --git a/engine/Draft/alliance_pick.php b/engine/Draft/alliance_pick.php
index 4d70aafc1..b098bf09c 100644
--- a/engine/Draft/alliance_pick.php
+++ b/engine/Draft/alliance_pick.php
@@ -10,15 +10,15 @@
// Add information about current player
$template->assign('PlayerID', $player->getPlayerID());
-$template->assign('CanPick', $teams[$player->getAccountID()]['CanPick']);
+$template->assign('CanPick', $teams[$player->getPlayerID()]['CanPick']);
// Get a list of players still in the pick pool
$players = array();
-$db->query('SELECT * FROM player WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' AND (alliance_id=0 OR alliance_id=' . $db->escapeNumber(NHA_ID) . ') AND account_id NOT IN (SELECT account_id FROM draft_leaders WHERE draft_leaders.game_id=player.game_id) AND account_id NOT IN (SELECT picked_account_id FROM draft_history WHERE draft_history.game_id=player.game_id) AND account_id != ' . $db->escapeNumber(ACCOUNT_ID_NHL) . ';');
+$db->query('SELECT * FROM player WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' AND (alliance_id=0 OR alliance_id=' . $db->escapeNumber(NHA_ID) . ') AND player_id NOT IN (SELECT player_id FROM draft_leaders WHERE draft_leaders.game_id=player.game_id) AND player_id NOT IN (SELECT picked_player_id FROM draft_history WHERE draft_history.game_id=player.game_id) AND player_id != ' . $db->escapeNumber(PLAYER_ID_NHL) . ';');
while ($db->nextRecord()) {
- $pickPlayer = SmrPlayer::getPlayer($db->getInt('account_id'), $player->getGameID(), false, $db);
+ $pickPlayer = SmrPlayer::getPlayer($db->getInt('player_id'), $player->getGameID(), false, $db);
$players[] = array('Player' => $pickPlayer,
- 'HREF' => SmrSession::getNewHREF(create_container('alliance_pick_processing.php', '', array('PickedAccountID'=>$pickPlayer->getAccountID()))));
+ 'HREF' => SmrSession::getNewHREF(create_container('alliance_pick_processing.php', '', array('PickedPlayerID'=>$pickPlayer->getPlayerID()))));
}
$template->assign('PickPlayers', $players);
@@ -27,8 +27,8 @@
$history = array();
$db->query('SELECT * FROM draft_history WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' ORDER BY draft_id');
while ($db->nextRecord()) {
- $leader = SmrPlayer::getPlayer($db->getInt('leader_account_id'), $player->getGameID());
- $pickedPlayer = SmrPlayer::getPlayer($db->getInt('picked_account_id'), $player->getGameID());
+ $leader = SmrPlayer::getPlayer($db->getInt('leader_player_id'), $player->getGameID());
+ $pickedPlayer = SmrPlayer::getPlayer($db->getInt('picked_player_id'), $player->getGameID());
$history[] = array('Leader' => $leader,
'Player' => $pickedPlayer,
'Time' => $db->getInt('time'));
diff --git a/engine/Draft/alliance_pick_processing.php b/engine/Draft/alliance_pick_processing.php
index 4c6b88bff..f13f0203e 100644
--- a/engine/Draft/alliance_pick_processing.php
+++ b/engine/Draft/alliance_pick_processing.php
@@ -1,21 +1,21 @@
query('SELECT 1
FROM draft_leaders
WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . '
- AND account_id = ' . $db->escapeNumber($var['PickedAccountID']));
+ AND player_id = ' . $db->escapeNumber($var['PickedPlayerID']));
if ($db->nextRecord()) {
create_error('You cannot pick another leader.');
}
require_once('alliance_pick.inc');
$teams = get_draft_teams($player->getGameID());
-if (!$teams[$player->getAccountID()]['CanPick']) {
+if (!$teams[$player->getPlayerID()]['CanPick']) {
create_error('You have to wait for others to pick first.');
}
-$pickedPlayer = SmrPlayer::getPlayer($var['PickedAccountID'], $player->getGameID());
+$pickedPlayer = SmrPlayer::getPlayer($var['PickedPlayerID'], $player->getGameID());
if ($pickedPlayer->hasAlliance()) {
if ($pickedPlayer->getAllianceID() == NHA_ID) {
@@ -37,6 +37,6 @@
$pickedPlayer->update();
// Update the draft history
-$db->query('INSERT INTO draft_history (game_id, leader_account_id, picked_account_id, time) VALUES(' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getAccountID()) . ', ' . $db->escapeNumber($pickedPlayer->getAccountID()) . ', ' . $db->escapeNumber(TIME) . ')');
+$db->query('INSERT INTO draft_history (game_id, leader_player_id, picked_player_id, time) VALUES(' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($player->getPlayerID()) . ', ' . $db->escapeNumber($pickedPlayer->getPlayerID()) . ', ' . $db->escapeNumber(TIME) . ')');
forward(create_container('skeleton.php', 'alliance_pick.php'));
diff --git a/engine/Draft/alliance_remove_member_processing.php b/engine/Draft/alliance_remove_member_processing.php
index 3a61424ab..8636c9fff 100644
--- a/engine/Draft/alliance_remove_member_processing.php
+++ b/engine/Draft/alliance_remove_member_processing.php
@@ -1,20 +1,20 @@
getAlliance()->getLeaderID(), $accountIDs)) {
+if (in_array($player->getAlliance()->getLeaderPlayerID(), $playerIDs)) {
create_error('You can\'t kick the leader!');
}
-if (in_array($player->getAccountID(), $accountIDs)) {
+if (in_array($player->getPlayerID(), $playerIDs)) {
create_error('You can\'t kick yourself!');
}
-foreach ($accountIDs as $accountID) {
- $currPlayer = SmrPlayer::getPlayer($accountID, $player->getGameID());
+foreach ($playerIDs as $playerID) {
+ $currPlayer = SmrPlayer::getPlayer($playerID, $player->getGameID());
if (!$player->sameAlliance($currPlayer)) {
throw new Exception('Cannot kick someone from another alliance!');
}
diff --git a/htdocs/config.php b/htdocs/config.php
index c3d65e4cd..62ec6a8a6 100644
--- a/htdocs/config.php
+++ b/htdocs/config.php
@@ -30,17 +30,17 @@
const PAGE_PREFIX = ENABLE_DEBUG ? 'DEV: ' : (ENABLE_BETA ? 'BETA: ' : '');
const PAGE_TITLE = PAGE_PREFIX . 'Space Merchant Realms';
-const ACCOUNT_ID_PORT = 65535;
-const ACCOUNT_ID_ADMIN = 65534;
-const ACCOUNT_ID_PLANET = 65533;
-const ACCOUNT_ID_ALLIANCE_AMBASSADOR = 65532;
-const ACCOUNT_ID_CASINO = 65531;
-const ACCOUNT_ID_BANK_REPORTER = 65530;
-const ACCOUNT_ID_FED_CLERK = 65529;
-const ACCOUNT_ID_OP_ANNOUNCE = 65528;
-const ACCOUNT_ID_ALLIANCE_COMMAND = 65527;
-const ACCOUNT_ID_GROUP_RACES = 65500;
-const ACCOUNT_ID_NHL = 36;
+const PLAYER_ID_PORT = 65535;
+const PLAYER_ID_ADMIN = 65534;
+const PLAYER_ID_PLANET = 65533;
+const PLAYER_ID_ALLIANCE_AMBASSADOR = 65532;
+const PLAYER_ID_CASINO = 65531;
+const PLAYER_ID_BANK_REPORTER = 65530;
+const PLAYER_ID_FED_CLERK = 65529;
+const PLAYER_ID_OP_ANNOUNCE = 65528;
+const PLAYER_ID_ALLIANCE_COMMAND = 65527;
+const PLAYER_ID_GROUP_RACES = 65500;
+const PLAYER_ID_NHL = 36;
const TIME_FOR_RAIDER_UNLOCK = 1209600; // 2 weeks
const TIME_FOR_RACE_CHANGE = 172800; // 2 days
diff --git a/htdocs/map_galaxy.php b/htdocs/map_galaxy.php
index cd7c99ef3..de615af51 100644
--- a/htdocs/map_galaxy.php
+++ b/htdocs/map_galaxy.php
@@ -42,7 +42,7 @@
}
$account = SmrSession::getAccount();
- $player = SmrPlayer::getPlayer($account->getAccountID(), SmrSession::getGameID());
+ $player = SmrPlayer::getPlayerByAccountID($account->getAccountID(), SmrSession::getGameID());
// Create a session to store temporary display options
// Garbage collect here often, since the page is slow anyways (see map_local.php)
diff --git a/lib/Default/AbstractSmrAccount.class.php b/lib/Default/AbstractSmrAccount.class.php
index 514478af8..7d289b75d 100644
--- a/lib/Default/AbstractSmrAccount.class.php
+++ b/lib/Default/AbstractSmrAccount.class.php
@@ -601,16 +601,16 @@ public function sendMessageToBox($boxTypeID, $message) {
self::doMessageSendingToBox($this->getAccountID(), $boxTypeID, $message);
}
- public static function doMessageSendingToBox($senderID, $boxTypeID, $message, $gameID = 0) {
+ public static function doMessageSendingToBox($senderAccountID, $boxTypeID, $message, $gameID = 0) {
$db = new SmrMySqlDatabase();
// send him the message
$db->query('INSERT INTO message_boxes
(box_type_id,game_id,message_text,
- sender_id,send_time) VALUES (' .
+ sender_account_id,send_time) VALUES (' .
$db->escapeNumber($boxTypeID) . ',' .
$db->escapeNumber($gameID) . ',' .
$db->escapeString($message) . ',' .
- $db->escapeNumber($senderID) . ',' .
+ $db->escapeNumber($senderAccountID) . ',' .
$db->escapeNumber(TIME) . ')'
);
}
diff --git a/lib/Default/AbstractSmrPlayer.class.php b/lib/Default/AbstractSmrPlayer.class.php
index d8d450b38..606978022 100644
--- a/lib/Default/AbstractSmrPlayer.class.php
+++ b/lib/Default/AbstractSmrPlayer.class.php
@@ -88,8 +88,8 @@ abstract class AbstractSmrPlayer {
public static function refreshCache() {
foreach (self::$CACHE_PLAYERS as $gameID => &$gamePlayers) {
- foreach ($gamePlayers as $accountID => &$player) {
- $player = self::getPlayer($accountID, $gameID, true);
+ foreach ($gamePlayers as $playerID => &$player) {
+ $player = self::getPlayer($playerID, $gameID, true);
}
}
}
@@ -109,9 +109,9 @@ public static function savePlayers() {
public static function getSectorPlayersByAlliances($gameID, $sectorID, array $allianceIDs, $forceUpdate = false) {
$players = self::getSectorPlayers($gameID, $sectorID, $forceUpdate); // Don't use & as we do an unset
- foreach ($players as $accountID => $player) {
+ foreach ($players as $playerID => $player) {
if (!in_array($player->getAllianceID(), $allianceIDs)) {
- unset($players[$accountID]);
+ unset($players[$playerID]);
}
}
return $players;
@@ -128,13 +128,13 @@ public static function getGalaxyPlayers($gameID, $galaxyID, $forceUpdate = false
$galaxyPlayers = [];
while ($db->nextRecord()) {
$sectorID = $db->getInt('sector_id');
- if (!$db->hasField('account_id')) {
+ if (!$db->hasField('player_id')) {
self::$CACHE_SECTOR_PLAYERS[$gameID][$sectorID] = [];
} else {
- $accountID = $db->getInt('account_id');
- $player = self::getPlayer($accountID, $gameID, $forceUpdate, $db);
- self::$CACHE_SECTOR_PLAYERS[$gameID][$sectorID][$accountID] = $player;
- $galaxyPlayers[$sectorID][$accountID] = $player;
+ $playerID = $db->getInt('player_id');
+ $player = self::getPlayer($playerID, $gameID, $forceUpdate, $db);
+ self::$CACHE_SECTOR_PLAYERS[$gameID][$sectorID][$playerID] = $player;
+ $galaxyPlayers[$sectorID][$playerID] = $player;
}
}
return $galaxyPlayers;
@@ -146,8 +146,8 @@ public static function getSectorPlayers($gameID, $sectorID, $forceUpdate = false
$db->query('SELECT * FROM player WHERE sector_id = ' . $db->escapeNumber($sectorID) . ' AND game_id=' . $db->escapeNumber($gameID) . ' AND land_on_planet = ' . $db->escapeBoolean(false) . ' AND (last_cpl_action > ' . $db->escapeNumber(TIME - TIME_BEFORE_INACTIVE) . ' OR newbie_turns = 0) AND account_id NOT IN (' . $db->escapeArray(Globals::getHiddenPlayers()) . ') ORDER BY last_cpl_action DESC');
$players = array();
while ($db->nextRecord()) {
- $accountID = $db->getInt('account_id');
- $players[$accountID] = self::getPlayer($accountID, $gameID, $forceUpdate, $db);
+ $playerID = $db->getInt('player_id');
+ $players[$playerID] = self::getPlayer($playerID, $gameID, $forceUpdate, $db);
}
self::$CACHE_SECTOR_PLAYERS[$gameID][$sectorID] = $players;
}
@@ -160,8 +160,8 @@ public static function getPlanetPlayers($gameID, $sectorID, $forceUpdate = false
$db->query('SELECT * FROM player WHERE sector_id = ' . $db->escapeNumber($sectorID) . ' AND game_id=' . $db->escapeNumber($gameID) . ' AND land_on_planet = ' . $db->escapeBoolean(true) . ' AND account_id NOT IN (' . $db->escapeArray(Globals::getHiddenPlayers()) . ') ORDER BY last_cpl_action DESC');
$players = array();
while ($db->nextRecord()) {
- $accountID = $db->getInt('account_id');
- $players[$accountID] = self::getPlayer($accountID, $gameID, $forceUpdate, $db);
+ $playerID = $db->getInt('player_id');
+ $players[$playerID] = self::getPlayer($playerID, $gameID, $forceUpdate, $db);
}
self::$CACHE_PLANET_PLAYERS[$gameID][$sectorID] = $players;
}
@@ -174,42 +174,33 @@ public static function getAlliancePlayers($gameID, $allianceID, $forceUpdate = f
$db->query('SELECT * FROM player WHERE alliance_id = ' . $db->escapeNumber($allianceID) . ' AND game_id=' . $db->escapeNumber($gameID) . ' ORDER BY experience DESC');
$players = array();
while ($db->nextRecord()) {
- $accountID = $db->getInt('account_id');
- $players[$accountID] = self::getPlayer($accountID, $gameID, $forceUpdate, $db);
+ $playerID = $db->getInt('player_id');
+ $players[$playerID] = self::getPlayer($playerID, $gameID, $forceUpdate, $db);
}
self::$CACHE_ALLIANCE_PLAYERS[$gameID][$allianceID] = $players;
}
return self::$CACHE_ALLIANCE_PLAYERS[$gameID][$allianceID];
}
- public static function getPlayer($accountID, $gameID, $forceUpdate = false, $db = null) {
- if ($forceUpdate || !isset(self::$CACHE_PLAYERS[$gameID][$accountID])) {
- self::$CACHE_PLAYERS[$gameID][$accountID] = new SmrPlayer($gameID, $accountID, $db);
+ public static function getPlayer($playerID, $gameID, $forceUpdate = false, $db = null) {
+ if ($forceUpdate || !isset(self::$CACHE_PLAYERS[$gameID][$playerID])) {
+ self::$CACHE_PLAYERS[$gameID][$playerID] = new SmrPlayer($playerID, $gameID, $db);
}
- return self::$CACHE_PLAYERS[$gameID][$accountID];
- }
-
- public static function getPlayerByPlayerID($playerID, $gameID, $forceUpdate = false) {
- $db = new SmrMySqlDatabase();
- $db->query('SELECT * FROM player WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND player_id = ' . $db->escapeNumber($playerID) . ' LIMIT 1');
- if ($db->nextRecord()) {
- return self::getPlayer($db->getInt('account_id'), $gameID, $forceUpdate, $db);
- }
- throw new PlayerNotFoundException('Player ID not found.');
+ return self::$CACHE_PLAYERS[$gameID][$playerID];
}
public static function getPlayerByPlayerName($playerName, $gameID, $forceUpdate = false) {
$db = new SmrMySqlDatabase();
$db->query('SELECT * FROM player WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND player_name = ' . $db->escapeString($playerName) . ' LIMIT 1');
if ($db->nextRecord()) {
- return self::getPlayer($db->getInt('account_id'), $gameID, $forceUpdate, $db);
+ return self::getPlayer($db->getInt('player_id'), $gameID, $forceUpdate, $db);
}
throw new PlayerNotFoundException('Player Name not found.');
}
- protected function __construct($gameID, $accountID, $db = null) {
+ protected function __construct($playerID, $gameID, $db = null) {
$this->db = new SmrMySqlDatabase();
- $this->SQL = 'account_id = ' . $this->db->escapeNumber($accountID) . ' AND game_id = ' . $this->db->escapeNumber($gameID);
+ $this->SQL = 'player_id = ' . $this->db->escapeNumber($playerID) . ' AND game_id = ' . $this->db->escapeNumber($gameID);
if (isset($db)) {
$playerExists = true;
@@ -220,10 +211,10 @@ protected function __construct($gameID, $accountID, $db = null) {
}
if ($playerExists) {
- $this->accountID = (int)$accountID;
+ $this->playerID = (int)$playerID;
$this->gameID = (int)$gameID;
+ $this->accountID = $db->getInt('account_id');
$this->playerName = $db->getField('player_name');
- $this->playerID = $db->getInt('player_id');
$this->sectorID = $db->getInt('sector_id');
$this->lastSectorID = $db->getInt('last_sector_id');
$this->turns = $db->getInt('turns');
@@ -261,7 +252,7 @@ protected function __construct($gameID, $accountID, $db = null) {
$this->raceChanged = $db->getBoolean('race_changed');
$this->combatDronesKamikazeOnMines = $db->getBoolean('combat_drones_kamikaze_on_mines');
} else {
- throw new PlayerNotFoundException('Invalid accountID: ' . $accountID . ' OR gameID:' . $gameID);
+ throw new PlayerNotFoundException('Invalid playerID: ' . $playerID . ' OR gameID:' . $gameID);
}
}
@@ -293,7 +284,7 @@ public static function createPlayer($accountID, $gameID, $playerName, $raceID, $
$db->unlock();
- $player = SmrPlayer::getPlayer($accountID, $gameID);
+ $player = SmrPlayer::getPlayer($playerID, $gameID);
$player->setSectorID($player->getHome());
return $player;
}
@@ -315,7 +306,7 @@ public function getSharingPlayers($forceUpdate = false) {
$this->db->query('SELECT from_account_id FROM account_shares_info WHERE to_account_id=' . $this->db->escapeNumber($this->getAccountID()) . ' AND (game_id=0 OR game_id=' . $this->db->escapeNumber($this->getGameID()) . ')');
while ($this->db->nextRecord()) {
try {
- $otherPlayer = SmrPlayer::getPlayer($this->db->getInt('from_account_id'),
+ $otherPlayer = SmrPlayer::getPlayer($this->db->getInt('from_account_id'), //TODO
$this->getGameID(), $forceUpdate);
} catch (PlayerNotFoundException $e) {
// Skip players that have not joined this game
@@ -453,8 +444,8 @@ public function getCustomShipName() {
}
public function setCustomShipName(string $name) {
- $this->db->query('REPLACE INTO ship_has_name (game_id, account_id, ship_name)
- VALUES (' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeString($name) . ')');
+ $this->db->query('REPLACE INTO ship_has_name (game_id, player_id, ship_name)
+ VALUES (' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($this->getPlayerID()) . ', ' . $this->db->escapeString($name) . ')');
}
/**
@@ -462,7 +453,7 @@ public function setCustomShipName(string $name) {
* Returns false if this player does not own a planet.
*/
public function getPlanet() {
- $this->db->query('SELECT * FROM planet WHERE game_id=' . $this->db->escapeNumber($this->getGameID()) . ' AND owner_id=' . $this->db->escapeNumber($this->getAccountID()));
+ $this->db->query('SELECT * FROM planet WHERE game_id=' . $this->db->escapeNumber($this->getGameID()) . ' AND owner_player_id=' . $this->db->escapeNumber($this->getPlayerID()));
if ($this->db->nextRecord()) {
return SmrPlanet::getPlanet($this->getGameID(), $this->db->getInt('sector_id'), false, $this->db);
} else {
@@ -492,7 +483,7 @@ public function setSectorID($sectorID) {
}
$port = SmrPort::getPort($this->getGameID(), $this->getSectorID());
- $port->addCachePort($this->getAccountID()); //Add port of sector we were just in, to make sure it is left totally up to date.
+ $port->addCachePort($this->getPlayerID()); //Add port of sector we were just in, to make sure it is left totally up to date.
$this->setLastSectorID($this->getSectorID());
$this->actionTaken('LeaveSector', ['SectorID' => $this->getSectorID()]);
@@ -501,7 +492,7 @@ public function setSectorID($sectorID) {
$this->hasChanged = true;
$port = SmrPort::getPort($this->getGameID(), $this->getSectorID());
- $port->addCachePort($this->getAccountID()); //Add the port of sector we are now in.
+ $port->addCachePort($this->getPlayerID()); //Add the port of sector we are now in.
}
public function getLastSectorID() {
@@ -559,15 +550,15 @@ public function updateNewbieStatus() {
* Has this player been designated as the alliance flagship?
*/
public function isFlagship() {
- return $this->hasAlliance() && $this->getAlliance()->getFlagshipID() == $this->getAccountID();
+ return $this->hasAlliance() && $this->getAlliance()->getFlagshipPlayerID() == $this->getPlayerID();
}
public function isPresident() {
- return Council::getPresidentID($this->getGameID(), $this->getRaceID()) == $this->getAccountID();
+ return Council::getPresidentPlayerID($this->getGameID(), $this->getRaceID()) == $this->getPlayerID();
}
public function isOnCouncil() {
- return Council::isOnCouncil($this->getGameID(), $this->getRaceID(), $this->getAccountID());
+ return Council::isOnCouncil($this->getGameID(), $this->getRaceID(), $this->getPlayerID());
}
public function isDraftLeader() {
@@ -630,18 +621,18 @@ public function setGroupScoutMessages($setting) {
$this->hasChanged = true;
}
- protected static function doMessageSending($senderID, $receiverID, $gameID, $messageTypeID, $message, $expires, $senderDelete = false, $unread = true) {
+ protected static function doMessageSending($senderPlayerID, $receiverPlayerID, $gameID, $messageTypeID, $message, $expires, $senderDelete = false, $unread = true) {
$message = trim($message);
$db = new SmrMySqlDatabase();
// send him the message
$db->query('INSERT INTO message
- (account_id,game_id,message_type_id,message_text,
- sender_id,send_time,expire_time,sender_delete) VALUES(' .
- $db->escapeNumber($receiverID) . ',' .
+ (receiver_player_id,game_id,message_type_id,message_text,
+ sender_player_id,send_time,expire_time,sender_delete) VALUES(' .
+ $db->escapeNumber($receiverPlayerID) . ',' .
$db->escapeNumber($gameID) . ',' .
$db->escapeNumber($messageTypeID) . ',' .
$db->escapeString($message) . ',' .
- $db->escapeNumber($senderID) . ',' .
+ $db->escapeNumber($senderPlayerID) . ',' .
$db->escapeNumber(TIME) . ',' .
$db->escapeNumber($expires) . ',' .
$db->escapeBoolean($senderDelete) . ')'
@@ -651,13 +642,13 @@ protected static function doMessageSending($senderID, $receiverID, $gameID, $mes
if ($unread === true) {
// give him the message icon
- $db->query('REPLACE INTO player_has_unread_messages (game_id, account_id, message_type_id) VALUES
- (' . $db->escapeNumber($gameID) . ', ' . $db->escapeNumber($receiverID) . ', ' . $db->escapeNumber($messageTypeID) . ')');
+ $db->query('REPLACE INTO player_has_unread_messages (game_id, player_id, message_type_id) VALUES
+ (' . $db->escapeNumber($gameID) . ', ' . $db->escapeNumber($receiverPlayerID) . ', ' . $db->escapeNumber($messageTypeID) . ')');
}
switch ($messageTypeID) {
case MSG_PLAYER:
- $receiverAccount = SmrAccount::getAccount($receiverID);
+ $receiverAccount = SmrPlayer::getPlayer($receiverPlayerID, $gameID)->getAccount();
if ($receiverAccount->isValidated() && $receiverAccount->isReceivingMessageNotifications($messageTypeID) && !$receiverAccount->isLoggedIn()) {
require_once(get_file_loc('message.functions.inc'));
$sender = getMessagePlayer($senderID, $gameID, $messageTypeID);
@@ -696,28 +687,28 @@ public function sendGlobalMessage($message, $canBeIgnored = true) {
// send to all online player
$db = new SmrMySqlDatabase();
- $db->query('SELECT account_id
+ $db->query('SELECT player_id
FROM active_session
JOIN player USING (game_id, account_id)
WHERE active_session.last_accessed >= ' . $db->escapeNumber(TIME - SmrSession::TIME_BEFORE_EXPIRY) . '
AND game_id = ' . $db->escapeNumber($this->getGameID()) . '
AND ignore_globals = \'FALSE\'
- AND account_id != ' . $db->escapeNumber($this->getAccountID()));
+ AND player_id != ' . $db->escapeNumber($this->getPlayerID()));
while ($db->nextRecord()) {
- $this->sendMessage($db->getInt('account_id'), MSG_GLOBAL, $message, $canBeIgnored);
+ $this->sendMessage($db->getInt('player_id'), MSG_GLOBAL, $message, $canBeIgnored);
}
- $this->sendMessage($this->getAccountID(), MSG_GLOBAL, $message, $canBeIgnored, false);
+ $this->sendMessage($this->getPlayerID(), MSG_GLOBAL, $message, $canBeIgnored, false);
}
- public function sendMessage($receiverID, $messageTypeID, $message, $canBeIgnored = true, $unread = true, $expires = false, $senderDelete = false) {
+ public function sendMessage($receiverPlayerID, $messageTypeID, $message, $canBeIgnored = true, $unread = true, $expires = false, $senderDelete = false) {
//get expire time
if ($canBeIgnored) {
if ($this->getAccount()->isMailBanned()) {
create_error('You are currently banned from sending messages');
}
// Don't send messages to players ignoring us
- $this->db->query('SELECT account_id FROM message_blacklist WHERE account_id=' . $this->db->escapeNumber($receiverID) . ' AND blacklisted_id=' . $this->db->escapeNumber($this->getAccountID()) . ' LIMIT 1');
+ $this->db->query('SELECT 1 FROM message_blacklist WHERE player_id=' . $this->db->escapeNumber($receiverPlayerID) . ' AND blacklisted_player_id=' . $this->db->escapeNumber($this->getPlayerID()) . ' LIMIT 1');
if ($this->db->nextRecord()) {
return;
}
@@ -764,75 +755,75 @@ public function sendMessage($receiverID, $messageTypeID, $message, $canBeIgnored
}
// send him the message and return the message_id
- return self::doMessageSending($this->getAccountID(), $receiverID, $this->getGameID(), $messageTypeID, $message, $expires, $senderDelete, $unread);
+ return self::doMessageSending($this->getPlayerID(), $receiverPlayerID, $this->getGameID(), $messageTypeID, $message, $expires, $senderDelete, $unread);
}
- public function sendMessageFromOpAnnounce($receiverID, $message, $expires = false) {
+ public function sendMessageFromOpAnnounce($receiverPlayerID, $message, $expires = false) {
// get expire time if not set
if ($expires === false) {
$expires = TIME + 86400 * 14;
}
- self::doMessageSending(ACCOUNT_ID_OP_ANNOUNCE, $receiverID, $this->getGameID(), MSG_ALLIANCE, $message, $expires);
+ self::doMessageSending(PLAYER_ID_OP_ANNOUNCE, $receiverPlayerID, $this->getGameID(), MSG_ALLIANCE, $message, $expires);
}
- public function sendMessageFromAllianceCommand($receiverID, $message) {
+ public function sendMessageFromAllianceCommand($receiverPlayerID, $message) {
$expires = TIME + 86400 * 365;
- self::doMessageSending(ACCOUNT_ID_ALLIANCE_COMMAND, $receiverID, $this->getGameID(), MSG_PLAYER, $message, $expires);
+ self::doMessageSending(PLAYER_ID_ALLIANCE_COMMAND, $receiverPlayerID, $this->getGameID(), MSG_PLAYER, $message, $expires);
}
- public static function sendMessageFromPlanet($gameID, $receiverID, $message) {
+ public static function sendMessageFromPlanet($gameID, $receiverPlayerID, $message) {
//get expire time
$expires = TIME + 86400 * 31;
// send him the message
- self::doMessageSending(ACCOUNT_ID_PLANET, $receiverID, $gameID, MSG_PLANET, $message, $expires);
+ self::doMessageSending(PLAYER_ID_PLANET, $receiverPlayerID, $gameID, MSG_PLANET, $message, $expires);
}
- public static function sendMessageFromPort($gameID, $receiverID, $message) {
+ public static function sendMessageFromPort($gameID, $receiverPlayerID, $message) {
//get expire time
$expires = TIME + 86400 * 31;
// send him the message
- self::doMessageSending(ACCOUNT_ID_PORT, $receiverID, $gameID, MSG_PLAYER, $message, $expires);
+ self::doMessageSending(PLAYER_ID_PORT, $receiverPlayerID, $gameID, MSG_PLAYER, $message, $expires);
}
- public static function sendMessageFromFedClerk($gameID, $receiverID, $message) {
+ public static function sendMessageFromFedClerk($gameID, $receiverPlayerID, $message) {
$expires = TIME + 86400 * 365;
- self::doMessageSending(ACCOUNT_ID_FED_CLERK, $receiverID, $gameID, MSG_PLAYER, $message, $expires);
+ self::doMessageSending(PLAYER_ID_FED_CLERK, $receiverPlayerID, $gameID, MSG_PLAYER, $message, $expires);
}
- public static function sendMessageFromAdmin($gameID, $receiverID, $message, $expires = false) {
+ public static function sendMessageFromAdmin($gameID, $receiverPlayerID, $message, $expires = false) {
//get expire time
if ($expires === false) {
$expires = TIME + 86400 * 365;
}
// send him the message
- self::doMessageSending(ACCOUNT_ID_ADMIN, $receiverID, $gameID, MSG_ADMIN, $message, $expires);
+ self::doMessageSending(PLAYER_ID_ADMIN, $receiverPlayerID, $gameID, MSG_ADMIN, $message, $expires);
}
- public static function sendMessageFromAllianceAmbassador($gameID, $receiverID, $message, $expires = false) {
+ public static function sendMessageFromAllianceAmbassador($gameID, $receiverPlayerID, $message, $expires = false) {
//get expire time
if ($expires === false) {
$expires = TIME + 86400 * 31;
}
// send him the message
- self::doMessageSending(ACCOUNT_ID_ALLIANCE_AMBASSADOR, $receiverID, $gameID, MSG_ALLIANCE, $message, $expires);
+ self::doMessageSending(PLAYER_ID_ALLIANCE_AMBASSADOR, $receiverPlayerID, $gameID, MSG_ALLIANCE, $message, $expires);
}
- public static function sendMessageFromCasino($gameID, $receiverID, $message, $expires = false) {
+ public static function sendMessageFromCasino($gameID, $receiverPlayerID, $message, $expires = false) {
//get expire time
if ($expires === false) {
$expires = TIME + 86400 * 7;
}
// send him the message
- self::doMessageSending(ACCOUNT_ID_CASINO, $receiverID, $gameID, MSG_CASINO, $message, $expires);
+ self::doMessageSending(PLAYER_ID_CASINO, $receiverPlayerID, $gameID, MSG_CASINO, $message, $expires);
}
- public static function sendMessageFromRace($raceID, $gameID, $receiverID, $message, $expires = false) {
+ public static function sendMessageFromRace($raceID, $gameID, $receiverPlayerID, $message, $expires = false) {
//get expire time
if ($expires === false) {
$expires = TIME + 86400 * 5;
}
// send him the message
- self::doMessageSending(ACCOUNT_ID_GROUP_RACES + $raceID, $receiverID, $gameID, MSG_POLITICAL, $message, $expires);
+ self::doMessageSending(PLAYER_ID_GROUP_RACES + $raceID, $receiverPlayerID, $gameID, MSG_POLITICAL, $message, $expires);
}
public function setMessagesRead($messageTypeID) {
@@ -1290,7 +1281,7 @@ public function setRaceID($raceID) {
}
public function isAllianceLeader($forceUpdate = false) {
- return $this->getAccountID() == $this->getAlliance($forceUpdate)->getLeaderID();
+ return $this->getPlayerID() == $this->getAlliance($forceUpdate)->getLeaderPlayerID();
}
public function getAlliance($forceUpdate = false) {
@@ -1312,8 +1303,8 @@ protected function setAllianceID($ID) {
$this->allianceID = $ID;
if ($this->allianceID != 0) {
$status = $this->hasNewbieStatus() ? 'NEWBIE' : 'VETERAN';
- $this->db->query('INSERT IGNORE INTO player_joined_alliance (account_id,game_id,alliance_id,status) ' .
- 'VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ',' . $this->db->escapeString($status) . ')');
+ $this->db->query('INSERT IGNORE INTO player_joined_alliance (player_id,game_id,alliance_id,status) ' .
+ 'VALUES (' . $this->db->escapeNumber($this->getPlayerID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ',' . $this->db->escapeString($status) . ')');
}
$this->hasChanged = true;
}
@@ -1352,15 +1343,15 @@ public function leaveAlliance(AbstractSmrPlayer $kickedBy = null) {
$allianceID = $this->getAllianceID();
$alliance = $this->getAlliance();
if ($kickedBy != null) {
- $kickedBy->sendMessage($this->getAccountID(), MSG_PLAYER, 'You were kicked out of the alliance!', false);
+ $kickedBy->sendMessage($this->getPlayerID(), MSG_PLAYER, 'You were kicked out of the alliance!', false);
$this->actionTaken('PlayerKicked', array('Alliance' => $alliance, 'Player' => $kickedBy));
$kickedBy->actionTaken('KickPlayer', array('Alliance' => $alliance, 'Player' => $this));
} elseif ($this->isAllianceLeader()) {
$this->actionTaken('DisbandAlliance', array('Alliance' => $alliance));
} else {
$this->actionTaken('LeaveAlliance', array('Alliance' => $alliance));
- if ($alliance->getLeaderID() != 0 && $alliance->getLeaderID() != ACCOUNT_ID_NHL) {
- $this->sendMessage($alliance->getLeaderID(), MSG_PLAYER, 'I left your alliance!', false);
+ if ($alliance->getLeaderID() != 0 && $alliance->getLeaderPlayerID() != PLAYER_ID_NHL) {
+ $this->sendMessage($alliance->getLeaderPlayerID(), MSG_PLAYER, 'I left your alliance!', false);
}
}
@@ -1381,11 +1372,11 @@ public function joinAlliance($allianceID) {
$alliance = $this->getAlliance();
if (!$this->isAllianceLeader()) {
- // Do not throw an exception if the NHL account doesn't exist.
+ // Do not throw an exception if the NHL player doesn't exist.
try {
- $this->sendMessage($alliance->getLeaderID(), MSG_PLAYER, 'I joined your alliance!', false);
- } catch (AccountNotFoundException $e) {
- if ($alliance->getLeaderID() != ACCOUNT_ID_NHL) {
+ $this->sendMessage($alliance->getLeaderPlayerID(), MSG_PLAYER, 'I joined your alliance!', false);
+ } catch (PlayerNotFoundException $e) {
+ if ($alliance->getLeaderPlayerID() != PLAYER_ID_NHL) {
throw $e;
}
}
@@ -1394,7 +1385,7 @@ public function joinAlliance($allianceID) {
} else {
$roleID = ALLIANCE_ROLE_LEADER;
}
- $this->db->query('INSERT INTO player_has_alliance_role (game_id, account_id, role_id, alliance_id) VALUES (' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($roleID) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
+ $this->db->query('INSERT INTO player_has_alliance_role (game_id, player_id, role_id, alliance_id) VALUES (' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($this->getPlayerID()) . ', ' . $this->db->escapeNumber($roleID) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
$this->actionTaken('JoinAlliance', array('Alliance' => $alliance));
}
@@ -1412,15 +1403,15 @@ private function setAllianceJoinable($time) {
}
/**
- * Invites player with $accountID to this player's alliance.
+ * Invites player with $playerID to this player's alliance.
*/
- public function sendAllianceInvitation(int $accountID, string $message, int $expires) : void {
+ public function sendAllianceInvitation(int $invitedPlayerID, string $message, int $expires) : void {
if (!$this->hasAlliance()) {
throw new Exception('Must be in an alliance to send alliance invitations');
}
// Send message to invited player
- $messageID = $this->sendMessage($accountID, MSG_PLAYER, $message, false, true, $expires, true);
- SmrInvitation::send($this->getAllianceID(), $this->getGameID(), $accountID, $this->getAccountID(), $messageID, $expires);
+ $messageID = $this->sendMessage($invitedPlayerID, MSG_PLAYER, $message, false, true, $expires, true);
+ SmrInvitation::send($this->getAllianceID(), $this->getGameID(), $invitedPlayerID, $this->getPlayerID(), $messageID, $expires);
}
public function isCombatDronesKamikazeOnMines() {
@@ -1552,7 +1543,7 @@ public function setRelations($relations, $raceID) {
$relationsDiff = IRound($relations - $this->personalRelations[$raceID]);
$this->personalRelations[$raceID] = $relations;
$this->relations[$raceID] += $relationsDiff;
- $this->db->query('REPLACE INTO player_has_relation (account_id,game_id,race_id,relation) values (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeNumber($raceID) . ',' . $this->db->escapeNumber($this->personalRelations[$raceID]) . ')');
+ $this->db->query('REPLACE INTO player_has_relation (player_id,game_id,race_id,relation) values (' . $this->db->escapeNumber($this->getPlayerID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeNumber($raceID) . ',' . $this->db->escapeNumber($this->personalRelations[$raceID]) . ')');
}
/**
@@ -1630,8 +1621,8 @@ public function setPlottedCourse(Distance $plottedCourse) {
$this->plottedCourse = $plottedCourse;
if ($this->plottedCourse->getTotalSectors() > 0) {
$this->db->query('REPLACE INTO player_plotted_course
- (account_id, game_id, course)
- VALUES(' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeBinary(serialize($this->plottedCourse)) . ')');
+ (player_id, game_id, course)
+ VALUES(' . $this->db->escapeNumber($this->getPlayerID()) . ', ' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeBinary(serialize($this->plottedCourse)) . ')');
} elseif ($hadPlottedCourse) {
$this->deletePlottedCourse();
}
@@ -1741,8 +1732,8 @@ public function addDestinationButton($sectorID, $label) {
);
$this->db->query('
- INSERT INTO player_stored_sector (account_id, game_id, sector_id, label, offset_top, offset_left)
- VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ', ' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($sectorID) . ',' . $this->db->escapeString($label, true) . ',1,1)'
+ INSERT INTO player_stored_sector (player_id, game_id, sector_id, label, offset_top, offset_left)
+ VALUES (' . $this->db->escapeNumber($this->getPlayerID()) . ', ' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($sectorID) . ',' . $this->db->escapeString($label, true) . ',1,1)'
);
}
@@ -1869,10 +1860,10 @@ protected function getBountiesData() {
// Type must be 'HQ' or 'UG'
public function getClaimableBounties($type) {
$bounties = array();
- $this->db->query('SELECT * FROM bounty WHERE claimer_id=' . $this->db->escapeNumber($this->getAccountID()) . ' AND game_id=' . $this->db->escapeNumber($this->getGameID()) . ' AND type=' . $this->db->escapeString($type));
+ $this->db->query('SELECT * FROM bounty WHERE claimer_player_id=' . $this->db->escapeNumber($this->getPlayerID()) . ' AND game_id=' . $this->db->escapeNumber($this->getGameID()) . ' AND type=' . $this->db->escapeString($type));
while ($this->db->nextRecord()) {
$bounties[] = array(
- 'player' => SmrPlayer::getPlayer($this->db->getInt('account_id'), $this->getGameID()),
+ 'player' => SmrPlayer::getPlayer($this->db->getInt('player_id'), $this->getGameID()),
'bounty_id' => $this->db->getInt('bounty_id'),
'credits' => $this->db->getInt('amount'),
'smr_credits' => $this->db->getInt('smr_credits'),
@@ -2017,8 +2008,8 @@ public function decreaseCurrentBountySmrCredits(string $type, int $credits) : vo
public function setBountiesClaimable(AbstractSmrPlayer $claimer) : void {
foreach ($this->getBounties() as $bounty) {
- if ($bounty['Claimer'] == 0) {
- $bounty['Claimer'] = $claimer->getAccountID();
+ if ($bounty['ClaimerPlayerID'] == 0) {
+ $bounty['ClaimerPlayerID'] = $claimer->getPlayerID();
$this->setBounty($bounty);
}
}
@@ -2221,10 +2212,10 @@ public function &killPlayerByPlayer(AbstractSmrPlayer $killer) {
}
$msg .= ' in Sector ' . Globals::getSectorBBLink($this->getSectorID());
$this->getSector()->increaseBattles(1);
- $this->db->query('INSERT INTO news (game_id,time,news_message,type,killer_id,killer_alliance,dead_id,dead_alliance) VALUES (' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeNumber(TIME) . ',' . $this->db->escapeString($msg, true) . ',\'regular\',' . $this->db->escapeNumber($killer->getAccountID()) . ',' . $this->db->escapeNumber($killer->getAllianceID()) . ',' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
+ $this->db->query('INSERT INTO news (game_id,time,news_message,type,killer_player_id,killer_alliance,dead_player_id,dead_alliance) VALUES (' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeNumber(TIME) . ',' . $this->db->escapeString($msg, true) . ',\'regular\',' . $this->db->escapeNumber($killer->getPlayerID()) . ',' . $this->db->escapeNumber($killer->getAllianceID()) . ',' . $this->db->escapeNumber($this->getPlayerID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
- self::sendMessageFromFedClerk($this->getGameID(), $this->getAccountID(), 'You were DESTROYED by ' . $killer->getBBLink() . ' in sector ' . Globals::getSectorBBLink($this->getSectorID()));
- self::sendMessageFromFedClerk($this->getGameID(), $killer->getAccountID(), 'You DESTROYED ' . $this->getBBLink() . ' in sector ' . Globals::getSectorBBLink($this->getSectorID()));
+ self::sendMessageFromFedClerk($this->getGameID(), $this->getPlayerID(), 'You were DESTROYED by ' . $killer->getBBLink() . ' in sector ' . Globals::getSectorBBLink($this->getSectorID()));
+ self::sendMessageFromFedClerk($this->getGameID(), $killer->getPlayerID(), 'You DESTROYED ' . $this->getBBLink() . ' in sector ' . Globals::getSectorBBLink($this->getSectorID()));
// Dead player loses between 5% and 25% experience
$expLossPercentage = 0.15 + 0.10 * ($this->getLevelID() - $killer->getLevelID()) / $this->getMaxLevel();
@@ -2263,7 +2254,7 @@ public function &killPlayerByPlayer(AbstractSmrPlayer $killer) {
$query = 'SELECT 1
FROM player_attacks_port
JOIN port USING(game_id, sector_id)
- JOIN player USING(game_id, account_id)
+ JOIN player USING(game_id, player_id)
WHERE armour > 0 AND ' . $this->SQL . ' LIMIT 1';
$this->db->query($query);
if ($this->db->nextRecord()) {
@@ -2362,8 +2353,8 @@ public function &killPlayerByForces(SmrForce $forces) {
$return = array();
$owner = $forces->getOwner();
// send a message to the person who died
- self::sendMessageFromFedClerk($this->getGameID(), $owner->getAccountID(), 'Your forces DESTROYED ' . $this->getBBLink() . ' in sector ' . Globals::getSectorBBLink($forces->getSectorID()));
- self::sendMessageFromFedClerk($this->getGameID(), $this->getAccountID(), 'You were DESTROYED by ' . $owner->getBBLink() . '\'s forces in sector ' . Globals::getSectorBBLink($this->getSectorID()));
+ self::sendMessageFromFedClerk($this->getGameID(), $owner->getPlayerID(), 'Your forces DESTROYED ' . $this->getBBLink() . ' in sector ' . Globals::getSectorBBLink($forces->getSectorID()));
+ self::sendMessageFromFedClerk($this->getGameID(), $this->getPlayerID(), 'You were DESTROYED by ' . $owner->getBBLink() . '\'s forces in sector ' . Globals::getSectorBBLink($this->getSectorID()));
$news_message = $this->getBBLink();
if ($this->hasCustomShipName()) {
@@ -2372,8 +2363,8 @@ public function &killPlayerByForces(SmrForce $forces) {
}
$news_message .= ' was destroyed by ' . $owner->getBBLink() . '\'s forces in sector ' . Globals::getSectorBBLink($forces->getSectorID());
// insert the news entry
- $this->db->query('INSERT INTO news (game_id, time, news_message,killer_id,killer_alliance,dead_id,dead_alliance)
- VALUES(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeString($news_message) . ',' . $this->db->escapeNumber($owner->getAccountID()) . ',' . $this->db->escapeNumber($owner->getAllianceID()) . ',' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
+ $this->db->query('INSERT INTO news (game_id, time, news_message,killer_player_id,killer_alliance,dead_player_id,dead_alliance)
+ VALUES(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeString($news_message) . ',' . $this->db->escapeNumber($owner->getPlayerID()) . ',' . $this->db->escapeNumber($owner->getAllianceID()) . ',' . $this->db->escapeNumber($this->getPlayerID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
// Player loses 15% experience
$expLossPercentage = .15;
@@ -2399,7 +2390,7 @@ public function &killPlayerByForces(SmrForce $forces) {
public function &killPlayerByPort(SmrPort $port) {
$return = array();
// send a message to the person who died
- self::sendMessageFromFedClerk($this->getGameID(), $this->getAccountID(), 'You were DESTROYED by the defenses of ' . $port->getDisplayName());
+ self::sendMessageFromFedClerk($this->getGameID(), $this->getPlayerID(), 'You were DESTROYED by the defenses of ' . $port->getDisplayName());
$news_message = $this->getBBLink();
if ($this->hasCustomShipName()) {
@@ -2408,8 +2399,8 @@ public function &killPlayerByPort(SmrPort $port) {
}
$news_message .= ' was destroyed while invading ' . $port->getDisplayName() . '.';
// insert the news entry
- $this->db->query('INSERT INTO news (game_id, time, news_message,killer_id,dead_id,dead_alliance)
- VALUES(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeString($news_message) . ',' . $this->db->escapeNumber(ACCOUNT_ID_PORT) . ',' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
+ $this->db->query('INSERT INTO news (game_id, time, news_message,killer_player_id,dead_player_id,dead_alliance)
+ VALUES(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeString($news_message) . ',' . $this->db->escapeNumber(PLAYER_ID_PORT) . ',' . $this->db->escapeNumber($this->getPlayerID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
// Player loses between 15% and 20% experience
$expLossPercentage = .20 - .05 * ($port->getLevel() - 1) / ($port->getMaxLevel() - 1);
@@ -2435,8 +2426,8 @@ public function &killPlayerByPlanet(SmrPlanet $planet) {
$return = array();
// send a message to the person who died
$planetOwner = $planet->getOwner();
- self::sendMessageFromFedClerk($this->getGameID(), $planetOwner->getAccountID(), 'Your planet DESTROYED ' . $this->getBBLink() . ' in sector ' . Globals::getSectorBBLink($planet->getSectorID()));
- self::sendMessageFromFedClerk($this->getGameID(), $this->getAccountID(), 'You were DESTROYED by the planetary defenses of ' . $planet->getCombatName());
+ self::sendMessageFromFedClerk($this->getGameID(), $planetOwner->getPlayerID(), 'Your planet DESTROYED ' . $this->getBBLink() . ' in sector ' . Globals::getSectorBBLink($planet->getSectorID()));
+ self::sendMessageFromFedClerk($this->getGameID(), $this->getPlayerID(), 'You were DESTROYED by the planetary defenses of ' . $planet->getCombatName());
$news_message = $this->getBBLink();
if ($this->hasCustomShipName()) {
@@ -2445,8 +2436,8 @@ public function &killPlayerByPlanet(SmrPlanet $planet) {
}
$news_message .= ' was destroyed by ' . $planet->getCombatName() . '\'s planetary defenses in sector ' . Globals::getSectorBBLink($planet->getSectorID()) . '.';
// insert the news entry
- $this->db->query('INSERT INTO news (game_id, time, news_message,killer_id,killer_alliance,dead_id,dead_alliance)
- VALUES(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeString($news_message) . ',' . $this->db->escapeNumber($planetOwner->getAccountID()) . ',' . $this->db->escapeNumber($planetOwner->getAllianceID()) . ',' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
+ $this->db->query('INSERT INTO news (game_id, time, news_message,killer_player_id,killer_alliance,dead_player_id,dead_alliance)
+ VALUES(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeString($news_message) . ',' . $this->db->escapeNumber($planetOwner->getPlayerID()) . ',' . $this->db->escapeNumber($planetOwner->getAllianceID()) . ',' . $this->db->escapeNumber($this->getPlayerID()) . ',' . $this->db->escapeNumber($this->getAllianceID()) . ')');
// Player loses between 15% and 20% experience
$expLossPercentage = .20 - .05 * $planet->getLevel() / $planet->getMaxLevel();
@@ -2784,8 +2775,8 @@ public function addMission($missionID, $step = 0) {
$this->rebuildMission($missionID);
$this->db->query('
- REPLACE INTO player_has_mission (game_id,account_id,mission_id,on_step,progress,unread,starting_sector,mission_sector,step_fails)
- VALUES ('.$this->db->escapeNumber($this->gameID) . ',' . $this->db->escapeNumber($this->accountID) . ',' . $this->db->escapeNumber($missionID) . ',' . $this->db->escapeNumber($mission['On Step']) . ',' . $this->db->escapeNumber($mission['Progress']) . ',' . $this->db->escapeBoolean($mission['Unread']) . ',' . $this->db->escapeNumber($mission['Starting Sector']) . ',' . $this->db->escapeNumber($mission['Sector']) . ',' . $this->db->escapeNumber($mission['Expires']) . ')'
+ REPLACE INTO player_has_mission (game_id,player_id,mission_id,on_step,progress,unread,starting_sector,mission_sector,step_fails)
+ VALUES ('.$this->db->escapeNumber($this->gameID) . ',' . $this->db->escapeNumber($this->playerID) . ',' . $this->db->escapeNumber($missionID) . ',' . $this->db->escapeNumber($mission['On Step']) . ',' . $this->db->escapeNumber($mission['Progress']) . ',' . $this->db->escapeBoolean($mission['Unread']) . ',' . $this->db->escapeNumber($mission['Starting Sector']) . ',' . $this->db->escapeNumber($mission['Sector']) . ',' . $this->db->escapeNumber($mission['Expires']) . ')'
);
}
@@ -2946,7 +2937,7 @@ public function canSee(AbstractSmrPlayer $otherPlayer) {
}
public function equals(AbstractSmrPlayer $otherPlayer = null) {
- return $otherPlayer !== null && $this->getAccountID() == $otherPlayer->getAccountID() && $this->getGameID() == $otherPlayer->getGameID();
+ return $otherPlayer !== null && $this->getPlayerID() == $otherPlayer->getPlayerID() && $this->getGameID() == $otherPlayer->getGameID();
}
public function sameAlliance(AbstractSmrPlayer $otherPlayer = null) {
@@ -3035,17 +3026,17 @@ public function getLeaveNewbieProtectionHREF() {
public function getExamineTraderHREF() {
$container = create_container('skeleton.php', 'trader_examine.php');
- $container['target'] = $this->getAccountID();
+ $container['targetPlayerID'] = $this->getPlayerID();
return SmrSession::getNewHREF($container);
}
public function getAttackTraderHREF() {
- return Globals::getAttackTraderHREF($this->getAccountID());
+ return Globals::getAttackTraderHREF($this->getPlayerID());
}
public function getPlanetKickHREF() {
$container = create_container('planet_kick_processing.php', 'trader_attack_processing.php');
- $container['account_id'] = $this->getAccountID();
+ $container['targetPlayerID'] = $this->getPlayerID();
return SmrSession::getNewHREF($container);
}
@@ -3134,7 +3125,7 @@ public function save() {
$bounty = $this->getBounty($key);
if ($bounty['New'] === true) {
if ($bounty['Amount'] > 0 || $bounty['SmrCredits'] > 0) {
- $this->db->query('INSERT INTO bounty (account_id,game_id,type,amount,smr_credits,claimer_id,time) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeString($bounty['Type']) . ',' . $this->db->escapeNumber($bounty['Amount']) . ',' . $this->db->escapeNumber($bounty['SmrCredits']) . ',' . $this->db->escapeNumber($bounty['Claimer']) . ',' . $this->db->escapeNumber($bounty['Time']) . ')');
+ $this->db->query('INSERT INTO bounty (player_id,game_id,type,amount,smr_credits,claimer_player_id,time) VALUES (' . $this->db->escapeNumber($this->getPlayerID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeString($bounty['Type']) . ',' . $this->db->escapeNumber($bounty['Amount']) . ',' . $this->db->escapeNumber($bounty['SmrCredits']) . ',' . $this->db->escapeNumber($bounty['ClaimerPlayerID']) . ',' . $this->db->escapeNumber($bounty['Time']) . ')');
}
} else {
if ($bounty['Amount'] > 0 || $bounty['SmrCredits'] > 0) {
@@ -3142,7 +3133,7 @@ public function save() {
SET amount=' . $this->db->escapeNumber($bounty['Amount']) . ',
smr_credits=' . $this->db->escapeNumber($bounty['SmrCredits']) . ',
type=' . $this->db->escapeString($bounty['Type']) . ',
- claimer_id=' . $this->db->escapeNumber($bounty['Claimer']) . ',
+ claimer_player_id=' . $this->db->escapeNumber($bounty['ClaimerPlayerID']) . ',
time=' . $this->db->escapeNumber($bounty['Time']) . '
WHERE bounty_id=' . $this->db->escapeNumber($bounty['ID']) . ' AND ' . $this->SQL . ' LIMIT 1');
} else {
@@ -3185,7 +3176,7 @@ protected function doHOFSave(array $hasChangedList, array $typeList = array()) {
$amount = $this->getHOF($tempTypeList);
if ($hofChanged == self::HOF_NEW) {
if ($amount > 0) {
- $this->db->query('INSERT INTO player_hof (account_id,game_id,type,amount) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeArray($tempTypeList, false, true, ':', false) . ',' . $this->db->escapeNumber($amount) . ')');
+ $this->db->query('INSERT INTO player_hof (account_id,game_id,type,amount) VALUES (' . $this->db->escapeNumber($this->getAccountID()) . ',' . $this->db->escapeNumber($this->getGameID()) . ',' . $this->db->escapeArray($tempTypeList, false, true, ':', false) . ',' . $this->db->escapeNumber($amount) . ')'); //TODO
}
} elseif ($hofChanged == self::HOF_CHANGED) {
$this->db->query('UPDATE player_hof
diff --git a/lib/Default/AbstractSmrPort.class.php b/lib/Default/AbstractSmrPort.class.php
index af1b41fec..a21bc90b4 100644
--- a/lib/Default/AbstractSmrPort.class.php
+++ b/lib/Default/AbstractSmrPort.class.php
@@ -634,8 +634,8 @@ public function attackedBy(AbstractSmrPlayer $trigger, array $attackers) {
$trigger->increaseHOF(1, array('Combat', 'Port', 'Number Of Triggers'), HOF_PUBLIC);
foreach ($attackers as $attacker) {
$attacker->increaseHOF(1, array('Combat', 'Port', 'Number Of Attacks'), HOF_PUBLIC);
- $this->db->query('REPLACE INTO player_attacks_port (game_id, account_id, sector_id, time, level) VALUES
- (' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($attacker->getAccountID()) . ', ' . $this->db->escapeNumber($this->getSectorID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeNumber($this->getLevel()) . ')');
+ $this->db->query('REPLACE INTO player_attacks_port (game_id, player_id, sector_id, time, level) VALUES
+ (' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($attacker->getPlayerID()) . ', ' . $this->db->escapeNumber($this->getSectorID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeNumber($this->getLevel()) . ')');
}
if (!$this->isUnderAttack()) {
@@ -1279,9 +1279,9 @@ protected function doArmourDamage($damage) {
protected function getAttackersToCredit() {
//get all players involved for HoF
$attackers = array();
- $this->db->query('SELECT account_id FROM player_attacks_port WHERE ' . $this->SQL . ' AND time > ' . $this->db->escapeNumber(TIME - self::TIME_TO_CREDIT_RAID));
+ $this->db->query('SELECT player_id FROM player_attacks_port WHERE ' . $this->SQL . ' AND time > ' . $this->db->escapeNumber(TIME - self::TIME_TO_CREDIT_RAID));
while ($this->db->nextRecord()) {
- $attackers[] = SmrPlayer::getPlayer($this->db->getInt('account_id'), $this->getGameID());
+ $attackers[] = SmrPlayer::getPlayerByPlayerID($this->db->getInt('player_id'), $this->getGameID());
}
return $attackers;
}
diff --git a/lib/Default/Globals.class.php b/lib/Default/Globals.class.php
index d0d98f892..253686c0d 100644
--- a/lib/Default/Globals.class.php
+++ b/lib/Default/Globals.class.php
@@ -288,9 +288,9 @@ public static function getTradeHREF() {
return self::$AVAILABLE_LINKS['EnterPort'] = SmrSession::getNewHREF(create_container('skeleton.php', 'shop_goods.php'));
}
- public static function getAttackTraderHREF($accountID) {
+ public static function getAttackTraderHREF($playerID) {
$container = create_container('trader_attack_processing.php');
- $container['target'] = $accountID;
+ $container['targetPlayerID'] = $playerID;
return self::$AVAILABLE_LINKS['AttackTrader'] = SmrSession::getNewHREF($container);
}
diff --git a/lib/Default/SmrAlliance.class.php b/lib/Default/SmrAlliance.class.php
index f99645711..dedc955b9 100644
--- a/lib/Default/SmrAlliance.class.php
+++ b/lib/Default/SmrAlliance.class.php
@@ -451,7 +451,7 @@ public function getNumVeterans() {
}
public function getNumMembers() {
- return count($this->getMemberIDs());
+ return count($this->getMemberPlayerIDs());
}
public function update() {
@@ -478,32 +478,32 @@ public function getMembers() {
return SmrPlayer::getAlliancePlayers($this->getGameID(), $this->getAllianceID());
}
- public function getMemberIDs() {
+ public function getMemberPlayerIDs() {
if (!isset($this->memberList)) {
- $this->db->query('SELECT account_id FROM player WHERE ' . $this->SQL);
+ $this->db->query('SELECT player_id FROM player WHERE ' . $this->SQL);
//we have the list of players put them in an array now
$this->memberList = array();
while ($this->db->nextRecord()) {
- $this->memberList[] = $this->db->getInt('account_id');
+ $this->memberList[] = $this->db->getInt('player_id');
}
}
return $this->memberList;
}
- public function getActiveIDs() {
+ public function getActivePlayerIDs() {
$activeIDs = array();
- $this->db->query('SELECT account_id
+ $this->db->query('SELECT player_id
FROM active_session
JOIN player USING(account_id, game_id)
WHERE '.$this->SQL . ' AND last_accessed >= ' . $this->db->escapeNumber(TIME - 600));
while ($this->db->nextRecord()) {
- $activeIDs[] = $this->db->getInt('account_id');
+ $activePlayerIDs[] = $this->db->getInt('account_id');
}
- return $activeIDs;
+ return $activePlayerIDs;
}
/**
diff --git a/lib/Default/SmrPlanet.class.php b/lib/Default/SmrPlanet.class.php
index 186003238..99f2be3b6 100644
--- a/lib/Default/SmrPlanet.class.php
+++ b/lib/Default/SmrPlanet.class.php
@@ -1071,8 +1071,8 @@ public function attackedBy(AbstractSmrPlayer $trigger, array $attackers) {
$trigger->increaseHOF(1, array('Combat', 'Planet', 'Number Of Triggers'), HOF_PUBLIC);
foreach ($attackers as $attacker) {
$attacker->increaseHOF(1, array('Combat', 'Planet', 'Number Of Attacks'), HOF_PUBLIC);
- $this->db->query('REPLACE INTO player_attacks_planet (game_id, account_id, sector_id, time, level) VALUES ' .
- '(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($attacker->getAccountID()) . ', ' . $this->db->escapeNumber($this->getSectorID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeNumber($this->getLevel()) . ')');
+ $this->db->query('REPLACE INTO player_attacks_planet (game_id, player_id, sector_id, time, level) VALUES ' .
+ '(' . $this->db->escapeNumber($this->getGameID()) . ', ' . $this->db->escapeNumber($attacker->getPlayerID()) . ', ' . $this->db->escapeNumber($this->getSectorID()) . ', ' . $this->db->escapeNumber(TIME) . ', ' . $this->db->escapeNumber($this->getLevel()) . ')');
}
// Add each unique attack to news unless it was already added recently.
@@ -1282,9 +1282,9 @@ protected function doArmourDamage($damage, $delayed) {
public function creditCurrentAttackersForKill() {
//get all players involved for HoF
- $this->db->query('SELECT account_id,level FROM player_attacks_planet WHERE ' . $this->SQL . ' AND time > ' . $this->db->escapeNumber(TIME - self::TIME_TO_CREDIT_BUST));
+ $this->db->query('SELECT player_id, level FROM player_attacks_planet WHERE ' . $this->SQL . ' AND time > ' . $this->db->escapeNumber(TIME - self::TIME_TO_CREDIT_BUST));
while ($this->db->nextRecord()) {
- $currPlayer = SmrPlayer::getPlayer($this->db->getInt('account_id'), $this->getGameID());
+ $currPlayer = SmrPlayer::getPlayerByPlayerID($this->db->getInt('player_id'), $this->getGameID());
$currPlayer->increaseHOF($this->db->getInt('level'), array('Combat', 'Planet', 'Levels'), HOF_PUBLIC);
$currPlayer->increaseHOF(1, array('Combat', 'Planet', 'Completed'), HOF_PUBLIC);
}
diff --git a/lib/Default/SmrSector.class.php b/lib/Default/SmrSector.class.php
index adb179652..2e9088e14 100644
--- a/lib/Default/SmrSector.class.php
+++ b/lib/Default/SmrSector.class.php
@@ -166,15 +166,15 @@ public function update() {
public function markVisited(AbstractSmrPlayer $player) {
if ($this->hasPort()) {
- $this->getPort()->addCachePort($player->getAccountID());
+ $this->getPort()->addCachePort($player->getPlayerID());
}
//now delete the entry from visited
if (!$this->isVisited($player)) {
$this->db->query('DELETE FROM player_visited_sector WHERE ' . $this->SQL . '
- AND account_id = ' . $this->db->escapeNumber($player->getAccountID()) . ' LIMIT 1');
+ AND player_id = ' . $this->db->escapeNumber($player->getPlayerID()) . ' LIMIT 1');
}
- $this->visited[$player->getAccountID()] = true;
+ $this->visited[$player->getPlayerID()] = true;
}
public function hasWeaponShop() {
@@ -801,7 +801,7 @@ public function hasPlayers() {
public function getOtherTraders(AbstractSmrPlayer $player) {
$players = SmrPlayer::getSectorPlayers($this->getGameID(), $this->getSectorID()); //Do not use & because we unset something and only want that in what we return
- unset($players[$player->getAccountID()]);
+ unset($players[$player->getPlayerID()]);
return $players;
}
@@ -875,10 +875,10 @@ public function getFightingTradersAgainstForces(AbstractSmrPlayer $attackingPlay
public function getFightingTradersAgainstPort(AbstractSmrPlayer $attackingPlayer, SmrPort $defendingPort) {
$fightingPlayers = array();
$alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(), $this->getSectorID(), array($attackingPlayer->getAllianceID()));
- foreach ($alliancePlayers as $accountID => $player) {
+ foreach ($alliancePlayers as $playerID => $player) {
if ($player->canFight()) {
if ($attackingPlayer->traderAttackPortAlliance($player)) {
- $fightingPlayers[$accountID] = $alliancePlayers[$accountID];
+ $fightingPlayers[$playerID] = $alliancePlayers[$playerID];
}
}
}
@@ -890,10 +890,10 @@ public function getFightingTradersAgainstPlanet(AbstractSmrPlayer $attackingPlay
$alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(), $this->getSectorID(), array($attackingPlayer->getAllianceID()));
if (count($alliancePlayers) > 0) {
$planetOwner = $defendingPlanet->getOwner();
- foreach ($alliancePlayers as $accountID => $player) {
+ foreach ($alliancePlayers as $playerID => $player) {
if ($player->canFight()) {
if ($attackingPlayer->traderAttackPlanetAlliance($player) && !$planetOwner->planetNAPAlliance($player)) {
- $fightingPlayers[$accountID] = $alliancePlayers[$accountID];
+ $fightingPlayers[$playerID] = $alliancePlayers[$playerID];
}
}
}
@@ -909,24 +909,24 @@ public function getFightingTraders(AbstractSmrPlayer $attackingPlayer, AbstractS
$alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(), $this->getSectorID(), array($attackingPlayer->getAllianceID(), $defendingPlayer->getAllianceID()));
$attackers = array();
$defenders = array();
- foreach ($alliancePlayers as $accountID => $player) {
+ foreach ($alliancePlayers as $playerID => $player) {
if ($player->canFight()) {
if ($attackingPlayer->traderAttackTraderAlliance($player) && !$defendingPlayer->traderDefendTraderAlliance($player) && !$defendingPlayer->traderNAPAlliance($player)) {
- $attackers[] = $alliancePlayers[$accountID];
+ $attackers[] = $alliancePlayers[$playerID];
} elseif ($defendingPlayer->traderDefendTraderAlliance($player) && !$attackingPlayer->traderAttackTraderAlliance($player) && !$attackingPlayer->traderNAPAlliance($player) && ($checkForCloak === false || $attackingPlayer->canSee($player))) {
- $defenders[] = $alliancePlayers[$accountID];
+ $defenders[] = $alliancePlayers[$playerID];
}
}
}
$attackers = self::limitFightingTraders($attackers, $attackingPlayer, MAXIMUM_PVP_FLEET_SIZE);
shuffle($attackers);
foreach ($attackers as $attacker) {
- $fightingPlayers['Attackers'][$attacker->getAccountID()] = $attacker;
+ $fightingPlayers['Attackers'][$attacker->getPlayerID()] = $attacker;
}
$defenders = self::limitFightingTraders($defenders, $defendingPlayer, MAXIMUM_PVP_FLEET_SIZE);
shuffle($defenders);
foreach ($defenders as $defender) {
- $fightingPlayers['Defenders'][$defender->getAccountID()] = $defender;
+ $fightingPlayers['Defenders'][$defender->getPlayerID()] = $defender;
}
return $fightingPlayers;
}
@@ -949,10 +949,10 @@ public static function limitFightingTraders(array &$fightingPlayers, AbstractSmr
public function getPotentialFightingTraders(AbstractSmrPlayer $attackingPlayer) {
$fightingPlayers = array();
$alliancePlayers = SmrPlayer::getSectorPlayersByAlliances($this->getGameID(), $this->getSectorID(), array($attackingPlayer->getAllianceID()));
- foreach ($alliancePlayers as $accountID => $player) {
+ foreach ($alliancePlayers as $playerID => $player) {
if ($player->canFight()) {
if ($attackingPlayer->traderAttackTraderAlliance($player)) {
- $fightingPlayers['Attackers'][$accountID] = $player;
+ $fightingPlayers['Attackers'][$playerID] = $player;
}
}
}
@@ -991,11 +991,11 @@ public function isVisited(AbstractSmrPlayer $player = null) {
if ($player === null) {
return true;
}
- if (!isset($this->visited[$player->getAccountID()])) {
- $this->db->query('SELECT sector_id FROM player_visited_sector WHERE ' . $this->SQL . ' AND account_id=' . $this->db->escapeNumber($player->getAccountID()) . ' LIMIT 1');
- $this->visited[$player->getAccountID()] = !$this->db->nextRecord();
+ if (!isset($this->visited[$player->getPlayerID()])) {
+ $this->db->query('SELECT sector_id FROM player_visited_sector WHERE ' . $this->SQL . ' AND player_id=' . $this->db->escapeNumber($player->getPlayerID()) . ' LIMIT 1');
+ $this->visited[$player->getPlayerID()] = !$this->db->nextRecord();
}
- return $this->visited[$player->getAccountID()];
+ return $this->visited[$player->getPlayerID()];
}
public function getLocalMapMoveHREF() {
diff --git a/lib/Default/council.inc b/lib/Default/council.inc
index a88afcfa8..5e798e7af 100644
--- a/lib/Default/council.inc
+++ b/lib/Default/council.inc
@@ -88,37 +88,37 @@ function checkPacts($race_id_1) {
// more yes than no?
if ($yes_votes > $no_votes) {
if ($type == 'WAR') {
- $currentlyParkedAccountIDs = array();
+ $currentlyParkedPlayerIDs = array();
$raceFedSectors = array(
$race_id_1 => SmrSector::getLocationSectors($player->getGameID(), LOCATION_GROUP_RACIAL_BEACONS + $race_id_1),
$race_id_2 => SmrSector::getLocationSectors($player->getGameID(), LOCATION_GROUP_RACIAL_BEACONS + $race_id_2)
);
foreach ($raceFedSectors as $raceID => $fedSectors) {
- $currentlyParkedAccountIDs[$raceID] = array(); //initialize
+ $currentlyParkedPlayerIDs[$raceID] = array(); //initialize
$otherRaceID = $raceID == $race_id_1 ? $race_id_2 : $race_id_1;
foreach ($fedSectors as $fedSector) {
$sectorPlayers = $fedSector->getPlayers();
foreach ($sectorPlayers as $sectorPlayer) {
if ($sectorPlayer->getRaceID() == $otherRaceID && $sectorPlayer->canBeProtectedByRace($raceID)) {
- $currentlyParkedAccountIDs[$raceID][] = $sectorPlayer->getAccountID();
+ $currentlyParkedPlayerIDs[$raceID][] = $sectorPlayer->getPlayerID();
}
}
}
}
- if (count($currentlyParkedAccountIDs[$race_id_1]) + count($currentlyParkedAccountIDs[$race_id_2]) > 0) {
+ if (count($currentlyParkedPlayerIDs[$race_id_1]) + count($currentlyParkedPlayerIDs[$race_id_2]) > 0) {
$expireTime = TIME + TIME_FOR_WAR_VOTE_FED_SAFETY;
- $query = 'REPLACE INTO player_can_fed (account_id, game_id, race_id, expiry, allowed) VALUES ';
- foreach ($currentlyParkedAccountIDs as $raceID => $accountIDs) {
+ $query = 'REPLACE INTO player_can_fed (player_id, game_id, race_id, expiry, allowed) VALUES ';
+ foreach ($currentlyParkedPlayerIDs as $raceID => $playerIDs) {
if ($raceID == $race_id_1) {
$message = 'We have declared war upon your race';
} else {
$message = 'Your race has declared war upon us';
}
$message .= ', you have ' . format_time(TIME_FOR_WAR_VOTE_FED_SAFETY) . ' to vacate our federal space, after that time you will no longer be protected (unless you have strong personal relations).';
- foreach ($accountIDs as $accountID) {
- $query .= '(' . $db2->escapeNumber($accountID) . ',' . $db2->escapeNumber($player->getGameID()) . ',' . $db2->escapeNumber($raceID) . ',' . $db2->escapeNumber($expireTime) . ',' . $db2->escapeBoolean(true) . '),';
- SmrPlayer::sendMessageFromRace($raceID, $player->getGameID(), $accountID, $message, $expireTime);
+ foreach ($playerIDs as $playerID) {
+ $query .= '(' . $db2->escapeNumber($playerID) . ',' . $db2->escapeNumber($player->getGameID()) . ',' . $db2->escapeNumber($raceID) . ',' . $db2->escapeNumber($expireTime) . ',' . $db2->escapeBoolean(true) . '),';
+ SmrPlayer::sendMessageFromRace($raceID, $player->getGameID(), $playerID, $message, $expireTime);
}
}
$db2->query(substr($query, 0, -1));
|