callback improvements
This commit is contained in:
parent
5f7eff0660
commit
440d690279
@ -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 */
|
||||
|
@ -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':
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ class NearMissStructure {
|
||||
/**
|
||||
* Get the distance
|
||||
*
|
||||
* @return float
|
||||
* @return double
|
||||
*/
|
||||
public function getDistance() {
|
||||
return $this->distance;
|
||||
return doubleval($this->distance);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ class PlayerHitStructure {
|
||||
$this->damage = $data[2];
|
||||
$this->weapon = $data[3];
|
||||
$this->shooterPoints = $data[4];
|
||||
|
||||
|
||||
//TODO remove key check in some months (hitDistance got implemented 2014-10-16)
|
||||
if (array_key_exists(5, $data)) {
|
||||
$this->hitDistance = $data[5];
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user