callback improvements

This commit is contained in:
kremsy 2014-12-21 23:21:59 +01:00
parent 5f7eff0660
commit 440d690279
5 changed files with 22 additions and 10 deletions

View File

@ -1,7 +1,7 @@
<?php
// TODO: method class for all the libxmlrpc get Methods, to fetch the callback asnyc
// TODO implement all STOP callbacks
namespace ManiaControl\Callbacks;
/**
@ -37,12 +37,16 @@ interface Callbacks {
const BEGINROUND = 'Callbacks.BeginRound';
/** BeginTurn Callback: TurnNumber */
const BEGINTURN = 'Callbacks.BeginTurn';
/** BeginTurnStop Callback: TurnNumber */
const BEGINTURNSTOP = 'Callbacks.BeginTurnStop';
/** BeginPlaying Callback */
const BEGINPLAYING = 'Callbacks.BeginPlaying';
/** EndPlaying Callback */
const ENDPLAYING = 'Callbacks.EndPlaying';
/** EndTurn Callback: TurnNumber */
const ENDTURN = 'Callbacks.EndTurn';
/** EndTurnStop Callback: TurnNumber */
const ENDTURNSTOP = 'Callbacks.EndTurnStop';
/** EndRound Callback: RoundNumber */
const ENDROUND = 'Callbacks.EndRound';
/** EndSubmatch Callback: SubmatchNumber */

View File

@ -61,6 +61,9 @@ class LibXmlRpcCallbacks implements CallbackListener {
case 'LibXmlRpc_BeginTurn':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINTURN, $data[0]);
break;
case 'LibXmlRpc_BeginTurnStop':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINTURNSTOP, $data[0]);
break;
case 'LibXmlRpc_BeginRound':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::BEGINROUND, $data[0]);
break;
@ -73,8 +76,10 @@ class LibXmlRpcCallbacks implements CallbackListener {
case 'LibXmlRpc_EndTurn':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDTURN, $data[0]);
break;
case 'LibXmlRpc_EndTurnStop':
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDTURNSTOP, $data[0]);
break;
case 'LibXmlRpc_EndRound':
var_dump("test");
$this->maniaControl->getCallbackManager()->triggerCallback(Callbacks::ENDROUND, $data[0]);
break;
case 'LibXmlRpc_EndSubmatch':

View File

@ -41,7 +41,10 @@ class CaptureStructure {
public function getPlayerArray() {
$playerArray = array();
foreach ($this->playerArray as $login) {
$playerArray[$login] = $this->maniaControl->getPlayerManager()->getPlayer($this->playerArray);
$player = $this->maniaControl->getPlayerManager()->getPlayer($login);
if($player){
$playerArray[$login] = $player;
}
}
return $playerArray;
}

View File

@ -51,10 +51,10 @@ class NearMissStructure {
/**
* Get the distance
*
* @return float
* @return double
*/
public function getDistance() {
return $this->distance;
return doubleval($this->distance);
}
/**

View File

@ -69,7 +69,7 @@ class PlayerHitStructure {
* @return int
*/
public function getDamage() {
return $this->damage;
return intval($this->damage);
}
/**
@ -78,7 +78,7 @@ class PlayerHitStructure {
* @return int
*/
public function getShooterPoints() {
return $this->shooterPoints;
return intval($this->shooterPoints);
}
/**
@ -94,9 +94,9 @@ class PlayerHitStructure {
/**
* Get The Hit Distance
*
* @return int
* @return double
*/
public function getHitDistance() {
return $this->hitDistance;
return doubleval($this->hitDistance);
}
}