small error fixes

This commit is contained in:
kremsy 2014-04-09 11:11:22 +02:00 committed by Steffen Schröder
parent 4ff88a1204
commit f05c75143e
3 changed files with 27 additions and 12 deletions

View File

@ -196,7 +196,7 @@ class Client
{ {
$size = 0; $size = 0;
$recvhandle = 0; $recvhandle = 0;
@stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 200); @stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 1000);
// Get result // Get result
if ($this->protocol == 1) if ($this->protocol == 1)
{ {

View File

@ -244,9 +244,13 @@ class StatisticCollector implements CallbackListener {
$shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); $shooter = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]);
$victim = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]); $victim = $this->maniaControl->playerManager->getPlayer($callback[1][1][1]);
$weapon = $callback[1][1][3]; $weapon = $callback[1][1][3];
if ($shooter) {
$this->maniaControl->statisticManager->incrementStat($this->getWeaponStat(intval($weapon), false), $shooter); $this->maniaControl->statisticManager->incrementStat($this->getWeaponStat(intval($weapon), false), $shooter);
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter); $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter);
}
if ($victim) {
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim); $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim);
}
break; break;
case 'LibXmlRpc_OnNearMiss': case 'LibXmlRpc_OnNearMiss':
$player = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]); $player = $this->maniaControl->playerManager->getPlayer($callback[1][1][0]);
@ -298,9 +302,13 @@ class StatisticCollector implements CallbackListener {
$shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login); $shooter = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Shooter->Login);
$victim = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Victim->Login); $victim = $this->maniaControl->playerManager->getPlayer($paramsObject->Event->Victim->Login);
$weapon = $paramsObject->Event->WeaponNum; $weapon = $paramsObject->Event->WeaponNum;
$this->maniaControl->statisticManager->incrementStat($this->getWeaponStat($weapon, false), $shooter); if ($shooter) {
$this->maniaControl->statisticManager->incrementStat($this->getWeaponStat(intval($weapon), false), $shooter);
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter); $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_HIT, $shooter);
}
if ($victim) {
$this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim); $this->maniaControl->statisticManager->incrementStat(self::STAT_ON_GOT_HIT, $victim);
}
break; break;
case 'OnArmorEmpty': case 'OnArmorEmpty':
$paramsObject = json_decode($callback[1][1]); $paramsObject = json_decode($callback[1][1]);

View File

@ -560,13 +560,15 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/** /**
* Update Settings * Update Settings
*
* @param $class * @param $class
* @param $settingName * @param $settingName
* @param $value * @param $value
*/ */
public function updateSettings($class, $settingName, $value) { public function updateSettings($class, $settingName, $value) {
if(!$class = get_class()) if (!$class = get_class()) {
return; return;
}
$serverLogin = $this->maniaControl->server->login; $serverLogin = $this->maniaControl->server->login;
if ($settingName == '$l[http://karma.mania-exchange.com/auth/getapikey?server=' . $serverLogin . ']MX Karma Code for ' . $serverLogin . '$l') { if ($settingName == '$l[http://karma.mania-exchange.com/auth/getapikey?server=' . $serverLogin . ']MX Karma Code for ' . $serverLogin . '$l') {
@ -667,7 +669,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
return; return;
} }
if (!isset($this->mxKarma['session']) && isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'] != true) { if (!isset($this->mxKarma['session']) && !(isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'])) {
$this->mxKarmaOpenSession(); $this->mxKarmaOpenSession();
return; return;
} }
@ -718,7 +720,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
return; return;
} }
if (!isset($this->mxKarma['session']) && isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'] != true) { if (!isset($this->mxKarma['session']) && !(isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'])) {
$this->mxKarmaOpenSession(); $this->mxKarmaOpenSession();
return; return;
} }
@ -738,6 +740,11 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
* @param bool $import * @param bool $import
*/ */
private function postKarmaVotes(Map $map, array $votes, $import = false) { private function postKarmaVotes(Map $map, array $votes, $import = false) {
if (!isset($this->mxKarma['session']) && !(isset($this->mxKarma['connectionInProgress']) && $this->mxKarma['connectionInProgress'])) {
$this->mxKarmaOpenSession();
return;
}
$gameMode = $this->maniaControl->server->getGameMode(true); $gameMode = $this->maniaControl->server->getGameMode(true);
if (count($votes) == 0) { if (count($votes) == 0) {