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

class ReleaseBlock extends DungeonAbstractAction {
	function __construct() {
		parent::__construct(DungeonConstante::$ACTION_RELEASE_BLOCK);
	}

	public function action($parZoneActionArray) {
		$locManageAction = ManageAction::getInstance();
		$locPlayer = $locManageAction->getPlayer();
		if($this->getZoneAndBlock($parZoneActionArray, $locZone, $locBlock)) {
			if($locBlock->playerId == $locPlayer->playerId) {
				if($locBlock->getGold() == 0) {
					if($locBlock->isInLostOfControl()) {
						$locManageAction->addPlayerInfo("Block is not fully in your control, you can't release it");
					} else {
						$locCost = DungeonConstante::$ACTION_RELEASE_BLOCK_COST;
						if($this->verifyPlayerEnoughCash($locCost)) {
							$locPlayer->addCash(-$locCost);
							$locBlock->lostOfControl();
							$locManageAction->addPlayerInfo("Block is now free");
						}
					}
				} else {
					$locManageAction->addPlayerInfo("Block contains gold");
				}
			} else {
				$locManageAction->addPlayerInfo("block is not yours");
			}
		}
	}
}



















?>
Return current item: PhpBlock