Location: PHPKode > projects > PhpBlock > A9.8/script/update/playerobjectlistupdate.class.php
<?php
include_once $PATH_TO_CODE."/script/connect.php";
include_once $PATH_TO_CODE."/script/fonction.php";
include_once $PATH_TO_CODE."/script/update/abstractupdate.class.php";


class PlayerObjectListUpdate extends AbstractUpdate {
	public function __construct($parArguments, $parPlayer) {
		parent::__construct($parArguments, $parPlayer, "playerobjectlist");
	}

	protected function isObjectActive(RealObject  $locObject) {
		return $locObject->isAlive()&&!$locObject->isLobotomize();
	}

	public function echoObjectUpdate(RealObject $locObject) {
		$locObjectIsActive = $this->isObjectActive($locObject);
		//Mandatory information
		echo $locObject->realObjectId;
		echo Constante::$SEP_URL_3;
		echo $locObject->zoneId;
		echo Constante::$SEP_URL_3;
		echo $locObject->isLobotomize;
		echo Constante::$SEP_URL_3;
		echo $locObject->getLobotomizeCounter();
		echo Constante::$SEP_URL_3;
		echo $locObject->isBattling;
		echo Constante::$SEP_URL_3;
		echo $locObject->realObjectType;

		//Optionnal information
		echo Constante::$SEP_URL_2;

		echo ($locObject->moveIndex > 0 && $locObject->isAlive() ? "1" : "0");
		echo Constante::$SEP_URL_3;
		echo $locObject->getUpkeepCost();

		//Action point
		echo Constante::$SEP_URL_2;

		if($locObjectIsActive) {
			echo $locObject->getActionPoint();
		} else {
			echo "0";
		}
		echo Constante::$SEP_URL_3;

		if($locObjectIsActive) {
			echo $locObject->getMaxActionPoint();
		} else {
			echo "0";
		}
		echo Constante::$SEP_URL_3;
		echo $locObject->getDigCost();
		echo Constante::$SEP_URL_3;
		echo $locObject->getMoveCost();
		echo Constante::$SEP_URL_3;
		echo $locObject->getTrapSearchCost();

		//Fight information
		echo Constante::$SEP_URL_2;

		if($locObjectIsActive) {
			echo $locObject->getFightActionPoint();
			echo Constante::$SEP_URL_3;
			echo $locObject->getMaxFightActionPoint();
			echo Constante::$SEP_URL_3;
			echo $locObject->getFightCost();
			echo Constante::$SEP_URL_3;
		} else {
			echo "0";
			echo Constante::$SEP_URL_3;
			echo "0";
			echo Constante::$SEP_URL_3;
			echo "-";
			echo Constante::$SEP_URL_3;
		}
		if($locObject->isAlive()) {
			echo $locObject->getLife();
		} else {
			echo "0";
		}
		echo Constante::$SEP_URL_3;
		echo $locObject->getMaxLife();

		echo Constante::$SEP_URL_3;
		echo $locObject->getShield();
	}
	
	protected function getObjectsList() {
		return $this->player->getAllRealObject();
	}

	public function echoUpdate() {
		if($this->getOptions("ask", false)) {
			$this->echoOptionNameOpen();
			$locArrayOfObject = $this->getObjectsList(); 
			foreach ($locArrayOfObject as $locObject) {
				$this->echoObjectUpdate($locObject);
				//Separator for each real object
				echo Constante::$SEP_URL_1;
			}
			$this->echoOptionNameClose();
		}
	}
}
?>
Return current item: PhpBlock