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

abstract class DungeonAbstractAction extends AbstractAction{
    function __construct($parActionType, $parCost=0, $parCostIsCash2=false) {
        parent::__construct($parActionType);
        $this->costIsCash2 = $parCostIsCash2;
        $this->cost = $parCost;
    }
    public function verifyPlayerEnoughCash($parCost) {
        if($parCost > 0) {
        	$locManageAction = ManageAction::getInstance();
        	$locPlayer = ManageAction::getInstance()->getPlayer();
        	if($this->costIsCash2) {
	        	if($locPlayer->cash2 < $parCost) {
	                $locManageAction->addPlayerInfo("Not enough evil points");
	                return false;
	            }
        	} else {
	        	if($locPlayer->cash < $parCost) {
	                $locManageAction->addPlayerInfo("Not enough good points");
	                return false;
	            }
        	}
        }
        return true;
    }
    public function payBill() {
        $locManageAction = ManageAction::getInstance();
        $locPlayer = ManageAction::getInstance()->getPlayer();
    	if($this->costIsCash2) {
        	$locPlayer->addCash2(-$this->cost);
   		} else{
   			$locPlayer->addCash(-$this->cost);
   		}
    }
}
?>
Return current item: PhpBlock