Location: PHPKode > projects > PhpBlock > A9.8/modules/dungeon/listener/unithasmovelistener.class.php
<?php
include_once $PATH_TO_CODE."/script/listener/abstractlistener.class.php";
include_once $PATH_TO_CODE."/script/event/precommitevent.class.php";

class UnitHasMoveListener extends AbstractListener {

    public function __construct() {
        parent::__construct();
    }

    public function supports($parEventType) {
        return RealObjectMoveEvent::$REAL_OBJECT_MOVE_EVENT == $parEventType;
    }

    public function fire($parEvent) {
    	global $gloObjectManager;
    	$locNewBlock = $gloObjectManager->getBlock($parEvent->newZone->blockId);
		if($locNewBlock->allianceId <> $parEvent->object->allianceId) {
			/*No more gold in this game !
			if($locNewBlock->containsGoldAndIsOwnableForAllianceId($parEvent->object->allianceId)) {
				$locNewBlock->setPlayerId($parEvent->object->playerId);
			}
			*/
			if($locNewBlock->allianceId > 0 && !$locNewBlock->isInLostOfControl()) {
				if($locNewBlock->testIsInLostOfControl()) {
					$locNewBlock->setLostOfControl(DungeonConstante::$DEFAULT_TIME_TO_LOST_CONTROL);
				}
			}
		}
    }
}
?>
Return current item: PhpBlock