Location: PHPKode > projects > PhpBlock > A9.8/script/action/moveaction.class.php
<?php
class MoveAction extends AbstractAction{
    function __construct() {
        parent::__construct(Constante::$ACTION_MOVE_OBJECT);
    }
    
    public function action($parZoneActionArray) {
        $locManageAction = ManageAction::getInstance();
        $locTargetObjectId= $parZoneActionArray[1];
        $locTargetZoneId= $parZoneActionArray[2];
        if($locTargetObject=$this->getObjectOfPlayer($locTargetObjectId, $locManageAction->getPlayer()->playerId)) {
            if(!Zone::staticCanExist($locTargetZoneId)) {
                $locManageAction->addErrorInfo("WRONG target zone $locTargetZoneId");
            } else {
            	if($locTargetObject->isAlive()) {
	                global $gloObjectManager;
	                $locTargetZone = $gloObjectManager->getZone($locTargetZoneId);
	                $locResult = $locTargetObject->move($locTargetZone->zoneId, $locMessage);
	                $locTextZone = Zone::staticGetTextZoneCoord($locTargetZone->zoneId);
	                if($locResult) {
	                    $locManageAction->addPlayerInfo("Move to $locTextZone $locMessage");
	                } else {
	                    $locManageAction->addPlayerInfo("No move to $locTextZone, cause: $locMessage");
	                }
            	} else {
            		$locManageAction->addErrorInfo("unit is dead");
            	}
            }
        }
    }
}
?>
Return current item: PhpBlock