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;
$recvhandle = 0;
@stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 200);
@stream_set_timeout($this->socket, 0, $this->timeout * 1000 * 1000);
// Get result
if ($this->protocol == 1)
{

View File

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

View File

@ -560,16 +560,18 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
/**
* Update Settings
*
* @param $class
* @param $settingName
* @param $value
*/
public function updateSettings($class, $settingName, $value){
if(!$class = get_class())
public function updateSettings($class, $settingName, $value) {
if (!$class = get_class()) {
return;
}
$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') {
$this->mxKarmaOpenSession();
}
}
@ -667,7 +669,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
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();
return;
}
@ -718,7 +720,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
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();
return;
}
@ -738,6 +740,11 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
* @param bool $import
*/
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);
if (count($votes) == 0) {