minor improvements

This commit is contained in:
kremsy 2017-02-04 11:41:31 +01:00
parent 2e50a757fd
commit 8dd3d9bc7d
7 changed files with 22 additions and 6 deletions

View File

@ -37,6 +37,9 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
*/ */
private $adminListShown = array(); private $adminListShown = array();
/** @var ManiaControl $maniaControl */
private $maniaControl;
/** /**
* Construct a new PlayerList instance * Construct a new PlayerList instance
* *

View File

@ -335,9 +335,10 @@ class AuthenticationManager implements CallbackListener, EchoListener, Communica
$mysqli = $this->maniaControl->getDatabase()->getMysqli(); $mysqli = $this->maniaControl->getDatabase()->getMysqli();
$authQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` ( $authQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` (
`login`, `login`,
`nickname`,
`authLevel` `authLevel`
) VALUES ( ) VALUES (
?, ? ?, ?, ?
) ON DUPLICATE KEY UPDATE ) ON DUPLICATE KEY UPDATE
`authLevel` = VALUES(`authLevel`);"; `authLevel` = VALUES(`authLevel`);";
$authStatement = $mysqli->prepare($authQuery); $authStatement = $mysqli->prepare($authQuery);
@ -345,7 +346,7 @@ class AuthenticationManager implements CallbackListener, EchoListener, Communica
trigger_error($mysqli->error, E_USER_ERROR); trigger_error($mysqli->error, E_USER_ERROR);
return false; return false;
} }
$authStatement->bind_param('si', $player->login, $authLevel); $authStatement->bind_param('ssi', $player->login, $player->nickname, $authLevel);
$authStatement->execute(); $authStatement->execute();
if ($authStatement->error) { if ($authStatement->error) {
trigger_error($authStatement->error); trigger_error($authStatement->error);

View File

@ -76,6 +76,9 @@ interface Callbacks {
/** Scores Callback (returned after LibXmlRpc_PlayerRanking in SM, or LibXmlRpc_TeamsScores in Trackmania): Scores */ /** Scores Callback (returned after LibXmlRpc_PlayerRanking in SM, or LibXmlRpc_TeamsScores in Trackmania): Scores */
const SCORES = 'Callbacks.Scores'; const SCORES = 'Callbacks.Scores';
/** Rankings Callback */
const RANKINGS = 'Callbacks.Rankings';
/** PlayerRanking Callback, returned after LibXmlRpc_PlayerRanking /** PlayerRanking Callback, returned after LibXmlRpc_PlayerRanking
* try to avoid to use this, just use the Get function of the RankingsManager instead * try to avoid to use this, just use the Get function of the RankingsManager instead
* param1 Player $player * param1 Player $player
@ -114,6 +117,9 @@ interface Callbacks {
/** Elite OnEndTurn Callback: integer (VictoryTypes) */ /** Elite OnEndTurn Callback: integer (VictoryTypes) */
const ELITE_ONENDTURN = "Callbacks.EliteOnEndTurn"; const ELITE_ONENDTURN = "Callbacks.EliteOnEndTurn";
/** Joust Selected Players */
const JOUST_SELECTEDPLAYERS = "Callbacks.JoustSelectedPlayers";
/* /*
* TrackMania Callbacks * TrackMania Callbacks
*/ */

View File

@ -114,6 +114,9 @@ class LibXmlRpcCallbacks implements CallbackListener {
//TODO really useful? what does it have what RankingsManager not have? //TODO really useful? what does it have what RankingsManager not have?
$this->triggerPlayerRanking($data[0]); $this->triggerPlayerRanking($data[0]);
break; break;
case 'LibXmlRpc_Rankings':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::RANKINGS, $data[0]);
break;
case 'LibXmlRpc_OnStartLine': case 'LibXmlRpc_OnStartLine':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSTARTLINE, $data[0]); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ONSTARTLINE, $data[0]);
break; break;

View File

@ -64,6 +64,9 @@ class ShootManiaCallbacks implements CallbackListener {
case 'Elite_EndTurn': case 'Elite_EndTurn':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ELITE_ONENDTURN, $data[0]); $this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ELITE_ONENDTURN, $data[0]);
break; break;
case 'Joust_SelectedPlayers':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::JOUST_SELECTEDPLAYERS, $data);
break;
case self::CB_TIMEATTACK_ONCHECKPOINT: case self::CB_TIMEATTACK_ONCHECKPOINT:
$this->handleTimeAttackOnCheckpoint($name, $data); $this->handleTimeAttackOnCheckpoint($name, $data);
break; break;

View File

@ -47,7 +47,7 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
/* /*
* Constants * Constants
*/ */
const VERSION = '0.163'; const VERSION = '0.164';
const API_VERSION = '2013-04-16'; const API_VERSION = '2013-04-16';
const MIN_DEDIVERSION = '2014-04-02_18_00'; const MIN_DEDIVERSION = '2014-04-02_18_00';
const SCRIPT_TIMEOUT = 10; const SCRIPT_TIMEOUT = 10;

View File

@ -55,7 +55,7 @@ class SettingManager implements CallbackListener {
`class` VARCHAR(100) NOT NULL, `class` VARCHAR(100) NOT NULL,
`setting` VARCHAR(150) NOT NULL, `setting` VARCHAR(150) NOT NULL,
`type` VARCHAR(50) NOT NULL, `type` VARCHAR(50) NOT NULL,
`value` VARCHAR(100) NOT NULL, `value` VARCHAR(150) NOT NULL,
`default` VARCHAR(100) NOT NULL, `default` VARCHAR(100) NOT NULL,
`set` VARCHAR(100) NOT NULL, `set` VARCHAR(100) NOT NULL,
`changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,