added log message on player join / leave
This commit is contained in:
parent
323cec03ac
commit
16c5a12cff
@ -30,7 +30,7 @@ class Player {
|
|||||||
public $ladderScore = -1.;
|
public $ladderScore = -1.;
|
||||||
public $ladderRank = -1;
|
public $ladderRank = -1;
|
||||||
public $joinTime = -1;
|
public $joinTime = -1;
|
||||||
|
public $ipAddress = '';
|
||||||
/**
|
/**
|
||||||
* Construct a player from XmlRpc data
|
* Construct a player from XmlRpc data
|
||||||
*
|
*
|
||||||
@ -40,7 +40,6 @@ class Player {
|
|||||||
if (!$rpcInfos) {
|
if (!$rpcInfos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pid = $rpcInfos['PlayerId'];
|
$this->pid = $rpcInfos['PlayerId'];
|
||||||
$this->login = $rpcInfos['Login'];
|
$this->login = $rpcInfos['Login'];
|
||||||
$this->nickname = $rpcInfos['NickName'];
|
$this->nickname = $rpcInfos['NickName'];
|
||||||
@ -57,6 +56,8 @@ class Player {
|
|||||||
$this->ladderScore = $rpcInfos['LadderStats']['PlayerRankings'][0]['Score'];
|
$this->ladderScore = $rpcInfos['LadderStats']['PlayerRankings'][0]['Score'];
|
||||||
$this->ladderRank = $rpcInfos['LadderStats']['PlayerRankings'][0]['Ranking'];
|
$this->ladderRank = $rpcInfos['LadderStats']['PlayerRankings'][0]['Ranking'];
|
||||||
|
|
||||||
|
$this->ipAddress = $rpcInfos['IPAddress'];
|
||||||
|
|
||||||
$this->joinTime = time();
|
$this->joinTime = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +129,8 @@ class PlayerManager implements CallbackListener {
|
|||||||
$this->maniaControl->chat->sendInformation('This server uses ManiaControl v' . ManiaControl::VERSION,$player->login);
|
$this->maniaControl->chat->sendInformation('This server uses ManiaControl v' . ManiaControl::VERSION,$player->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->maniaControl->log('Player joined: ' . $player->login . " / " . $player->nickname . " Nation: " . $player->getCountry() . " IP: " .$player->ipAddress);
|
||||||
|
|
||||||
// Trigger own callback
|
// Trigger own callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERJOINED, array(self::CB_PLAYERJOINED, $player));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_PLAYERJOINED, array(self::CB_PLAYERJOINED, $player));
|
||||||
}
|
}
|
||||||
@ -142,12 +144,13 @@ class PlayerManager implements CallbackListener {
|
|||||||
$login = $callback[1][0];
|
$login = $callback[1][0];
|
||||||
$player = $this->removePlayer($login);
|
$player = $this->removePlayer($login);
|
||||||
|
|
||||||
if (!$this->maniaControl->settingManager->getSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$played = Formatter::formatTimeH(time() - $player->joinTime);
|
$played = Formatter::formatTimeH(time() - $player->joinTime);
|
||||||
|
$this->maniaControl->log("Player left: " . $player->login . " / " . $player->nickname . " Playtime: " . $played);
|
||||||
|
|
||||||
|
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES)) {
|
||||||
$this->maniaControl->chat->sendChat('$<' . $player->nickname . '$> $ff0has left the game. Played:$fff ' . $played);
|
$this->maniaControl->chat->sendChat('$<' . $player->nickname . '$> $ff0has left the game. Played:$fff ' . $played);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the complete PlayerList
|
* Get the complete PlayerList
|
||||||
|
Loading…
Reference in New Issue
Block a user