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

class BuildStair extends DungeonAbstractChangeZoneTypeAction {
    function __construct() {
        parent::__construct(DungeonConstante::$ACTION_BUILD_STAIR, DungeonConstante::$ZONE_TYPE_STAIR, DungeonConstante::$ACTION_BUILD_STAIR_COST);
    }

    public function isOkToChange($locBlock, $locZone) {
        $locManageAction = ManageAction::getInstance();
        $locPlayer = $locManageAction->getPlayer();

        if($this->isZoneOk($locZone)) {
        	return parent::isOkToChange($locBlock, $locZone);
        } else {
            $locManageAction->addPlayerInfo("Target zone is not plain or rock or stair");
        }
        return false;
    }
    private function isZoneOk($parZone) {
    	return $parZone->zoneType == Constante::$ZONE_TYPE_PLAIN
        || $parZone->zoneType == DungeonConstante::$ZONE_TYPE_ROCK
        || $parZone->zoneType == DungeonConstante::$ZONE_TYPE_STAIR
        || $parZone->zoneType == DungeonConstante::$ZONE_TYPE_ROAD;
    }
    public function setNewZoneType($parZone) {
    	parent::setNewZoneType($parZone);
    	$locTopZone = $parZone->getTopZone();
    	$locBottomZone = $parZone->getBottomZone();
    	if($locTopZone && $this->isZoneOk($loTopZone)) {
    		$locTopZone->setZoneType($this->newZoneType);
    	}
    	if($locBottomZone && $this->isZoneOk($locBottomZone)) {
    		$locBottomZone->setZoneType($this->newZoneType);
    	}
    }
}
?>
Return current item: PhpBlock