Location: PHPKode > projects > PhpBlock > A9.8/modules/dungeon/action/abstractobjectaction.class.php
<?php
include_once $PATH_TO_CODE."/modules/dungeon/action/abstractaction.class.php";

abstract class AbstractObjectAction extends DungeonAbstractAction {
    function __construct($parActionType) {
        parent::__construct($parActionType);
    }

     public function getObjectOfPlayer($parObjectId, $parPlayerId, $parMustNotBeLobotomized=true, $parMustNotBeInABattle=false) {
        global $gloObjectManager;
        $locManageAction = ManageAction::getInstance();

        $locTargetObject = $gloObjectManager->getRealObject($parObjectId);
        if(!$locTargetObject) {
            $locManageAction->addPlayerInfo("no object for id $parObjectId");
            return false;
        } else {
            if(!$locTargetObject->isAlive()) {
                $locManageAction->addPlayerInfo("unit is dead");
                return false;
            } else if($locTargetObject->playerId != $parPlayerId) {
                $locManageAction->addPlayerInfo("$parObjectId is not your object");
                return false;
            } else {
                if($parMustNotBeLobotomized && $locTargetObject->isLobotomize()) {
                    $locManageAction->addPlayerInfo("Object is recruiting, it can't do that");
                    return false;
                }
                if($parMustNotBeInABattle && $locTargetObject->isBattling) {
        			$locManageAction->addPlayerInfo("Object is in a battle, it can't do that");
        			return false;
        		}
            }
        }
        if($locTargetObject && $this->isObjectOfPlayerMustBeNoIA()) {
        	if($locTargetObject->getIAMode() != RealObject::$IA_MODE_NO) {
        		$locManageAction->addErrorInfo("$parObjectId is IA, you can't send this order to it");
        		return false;
        	}
        }
        return $locTargetObject;
    }
}















?>
Return current item: PhpBlock