From 8dd3d9bc7d0f3dab650f05dd5ae13944dde9f150 Mon Sep 17 00:00:00 2001 From: kremsy Date: Sat, 4 Feb 2017 11:41:31 +0100 Subject: [PATCH] minor improvements --- core/Admin/AdminLists.php | 3 +++ core/Admin/AuthenticationManager.php | 5 +++-- core/Callbacks/Callbacks.php | 6 ++++++ core/Callbacks/LibXmlRpcCallbacks.php | 3 +++ core/Callbacks/ShootManiaCallbacks.php | 7 +++++-- core/ManiaControl.php | 2 +- core/Settings/SettingManager.php | 2 +- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/core/Admin/AdminLists.php b/core/Admin/AdminLists.php index 4f91275e..4cc820b5 100644 --- a/core/Admin/AdminLists.php +++ b/core/Admin/AdminLists.php @@ -37,6 +37,9 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener { */ private $adminListShown = array(); + /** @var ManiaControl $maniaControl */ + private $maniaControl; + /** * Construct a new PlayerList instance * diff --git a/core/Admin/AuthenticationManager.php b/core/Admin/AuthenticationManager.php index 0a1428f6..cea12ea4 100644 --- a/core/Admin/AuthenticationManager.php +++ b/core/Admin/AuthenticationManager.php @@ -335,9 +335,10 @@ class AuthenticationManager implements CallbackListener, EchoListener, Communica $mysqli = $this->maniaControl->getDatabase()->getMysqli(); $authQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` ( `login`, + `nickname`, `authLevel` ) VALUES ( - ?, ? + ?, ?, ? ) ON DUPLICATE KEY UPDATE `authLevel` = VALUES(`authLevel`);"; $authStatement = $mysqli->prepare($authQuery); @@ -345,7 +346,7 @@ class AuthenticationManager implements CallbackListener, EchoListener, Communica trigger_error($mysqli->error, E_USER_ERROR); return false; } - $authStatement->bind_param('si', $player->login, $authLevel); + $authStatement->bind_param('ssi', $player->login, $player->nickname, $authLevel); $authStatement->execute(); if ($authStatement->error) { trigger_error($authStatement->error); diff --git a/core/Callbacks/Callbacks.php b/core/Callbacks/Callbacks.php index 8bef0c8b..f3de3ebb 100644 --- a/core/Callbacks/Callbacks.php +++ b/core/Callbacks/Callbacks.php @@ -76,6 +76,9 @@ interface Callbacks { /** Scores Callback (returned after LibXmlRpc_PlayerRanking in SM, or LibXmlRpc_TeamsScores in Trackmania): Scores */ const SCORES = 'Callbacks.Scores'; + /** Rankings Callback */ + const RANKINGS = 'Callbacks.Rankings'; + /** PlayerRanking Callback, returned after LibXmlRpc_PlayerRanking * try to avoid to use this, just use the Get function of the RankingsManager instead * param1 Player $player @@ -114,6 +117,9 @@ interface Callbacks { /** Elite OnEndTurn Callback: integer (VictoryTypes) */ const ELITE_ONENDTURN = "Callbacks.EliteOnEndTurn"; + /** Joust Selected Players */ + const JOUST_SELECTEDPLAYERS = "Callbacks.JoustSelectedPlayers"; + /* * TrackMania Callbacks */ diff --git a/core/Callbacks/LibXmlRpcCallbacks.php b/core/Callbacks/LibXmlRpcCallbacks.php index 27ec421f..0c495548 100644 --- a/core/Callbacks/LibXmlRpcCallbacks.php +++ b/core/Callbacks/LibXmlRpcCallbacks.php @@ -114,6 +114,9 @@ class LibXmlRpcCallbacks implements CallbackListener { //TODO really useful? what does it have what RankingsManager not have? $this->triggerPlayerRanking($data[0]); break; + case 'LibXmlRpc_Rankings': + $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::RANKINGS, $data[0]); + break; case 'LibXmlRpc_OnStartLine': $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSTARTLINE, $data[0]); break; diff --git a/core/Callbacks/ShootManiaCallbacks.php b/core/Callbacks/ShootManiaCallbacks.php index 39d6a31a..4b92d3e2 100644 --- a/core/Callbacks/ShootManiaCallbacks.php +++ b/core/Callbacks/ShootManiaCallbacks.php @@ -64,6 +64,9 @@ class ShootManiaCallbacks implements CallbackListener { case 'Elite_EndTurn': $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ELITE_ONENDTURN, $data[0]); break; + case 'Joust_SelectedPlayers': + $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::JOUST_SELECTEDPLAYERS, $data); + break; case self::CB_TIMEATTACK_ONCHECKPOINT: $this->handleTimeAttackOnCheckpoint($name, $data); break; @@ -101,7 +104,7 @@ class ShootManiaCallbacks implements CallbackListener { $checkpointCallback->rawCallback = array($name, $data); $checkpointCallback->name = $checkpointCallback::CHECKPOINT; $checkpointCallback->setPlayer($player); - $checkpointCallback->time = (int)$data[1]; + $checkpointCallback->time = (int) $data[1]; $this->maniaControl->getCallbackManager()->triggerCallback($checkpointCallback); } @@ -124,7 +127,7 @@ class ShootManiaCallbacks implements CallbackListener { $finishCallback->rawCallback = array($name, $data); $finishCallback->name = $finishCallback::FINISH; $finishCallback->setPlayer($player); - $finishCallback->time = (int)$data[1]; + $finishCallback->time = (int) $data[1]; $this->maniaControl->getCallbackManager()->triggerCallback($finishCallback); } diff --git a/core/ManiaControl.php b/core/ManiaControl.php index 7f851238..103b57da 100644 --- a/core/ManiaControl.php +++ b/core/ManiaControl.php @@ -47,7 +47,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, /* * Constants */ - const VERSION = '0.163'; + const VERSION = '0.164'; const API_VERSION = '2013-04-16'; const MIN_DEDIVERSION = '2014-04-02_18_00'; const SCRIPT_TIMEOUT = 10; diff --git a/core/Settings/SettingManager.php b/core/Settings/SettingManager.php index 671434c5..9bd1e92e 100644 --- a/core/Settings/SettingManager.php +++ b/core/Settings/SettingManager.php @@ -55,7 +55,7 @@ class SettingManager implements CallbackListener { `class` VARCHAR(100) NOT NULL, `setting` VARCHAR(150) NOT NULL, `type` VARCHAR(50) NOT NULL, - `value` VARCHAR(100) NOT NULL, + `value` VARCHAR(150) NOT NULL, `default` VARCHAR(100) NOT NULL, `set` VARCHAR(100) NOT NULL, `changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,