Location: PHPKode > projects > PhpBlock > A9.8/script/action/abstractaction.class.php
<?php
abstract class AbstractAction {
    function __construct($parActionType) {
        $this->actionType = $parActionType;
    }

    public function getActionType() {
        return $this->actionType;
    }

    public abstract function action($parZoneActionArray);

    function getZoneAndBlock($parZoneActionArray, &$parZone, &$parBlock) {
        $locManageAction = ManageAction::getInstance();
        global $gloObjectManager;
        $locAction = $parZoneActionArray[0];
        $locZoneId = $parZoneActionArray[1];
        
        $locManageAction->addDebugInfo(" locAction=$locAction - locZoneId=$locZoneId");
        $parZone = $gloObjectManager->getZone($locZoneId);
        
        if($parZone) {
            $parBlock = $gloObjectManager->getBlock($parZone->blockId);
        } else {
            $locManageAction->addErrorInfo("WRONG X/Y $locX/$locY");
            return false;
        }
        if(!$parBlock) {
            $locManageAction->addErrorInfo("WRONG X/Y $locX/$locY");
            return false;
        } else {
            return true;
        }
    }
    
    function isObjectOfPlayerMustBeNoIA() {
    	return true;
    }

    function getObjectOfPlayer($parObjectId, $parPlayerId) {
        global $gloObjectManager;
        $locManageAction = ManageAction::getInstance();
        
        $locTargetObject = $gloObjectManager->getRealObject($parObjectId);
        if(!$locTargetObject) {
            $gloErrorInfo.="WRONG object $parObjectId";
            return false;
        } else {
            if($locTargetObject->playerId != $parPlayerId) {
                $gloErrorInfo.="$parObjectId is not your object";
                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