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

class FogListener extends AbstractListener {

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

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

    public function fire($parEvent) {
        switch($parEvent->getEventType()) {
            case RealObjectMoveEvent::$REAL_OBJECT_MOVE_EVENT:
                //RealObjectMoveEvent
                if($parEvent->oldZone->blockId != $parEvent->newZone->blockId) {
                    $locAllianceId = $parEvent->object->allianceId;
                    executer("DELETE FROM fowBlockSeeByObject WHERE objectId = ".$parEvent->object->realObjectId." AND blockId IN ".Block::getStaticBlockIdsWhereClauseList($parEvent->oldZone->blockId, 1, 1, 1));
                    executer("INSERT INTO fowBlockSeeByObject(blockId, objectId) SELECT blockId, ".$parEvent->object->realObjectId." FROM block WHERE blockId IN ".Block::getStaticBlockIdsWhereClauseList($parEvent->newZone->blockId, 1, 1, 1));

                    $gloObjectManager->addFowRecompute($locAllianceId, $parEvent->newZone->blockId);
                    $gloObjectManager->addFowRecompute($locAllianceId, $parEvent->oldZone->blockId);

        /*
                    executer("DELETE FROM fowBlockSeeByAlliance WHERE allianceId=$locAllianceId AND blockId IN ".Block::getStaticBlockIdsWhereClauseList($parEvent->oldZone->blockId, 1, 1, 1));
                    executer("DELETE FROM fowBlockSeeByAlliance WHERE allianceId=$locAllianceId AND blockId IN ".Block::getStaticBlockIdsWhereClauseList($parEvent->newZone->blockId, 1, 1, 1));
                    
                    executer("REPLACE INTO fowBlockSeeByAlliance(allianceId, blockId) SELECT DISTINCT $locAllianceId, blockId FROM fowBlockSeeByObject WHERE blockId IN  ".Block::getStaticBlockIdsWhereClauseList($parEvent->oldZone->blockId, 1, 1, 1));
                    executer("REPLACE INTO fowBlockSeeByAlliance(allianceId, blockId) SELECT DISTINCT $locAllianceId, blockId FROM fowBlockSeeByObject WHERE blockId IN  ".Block::getStaticBlockIdsWhereClauseList($parEvent->newZone->blockId, 1, 1, 1));

                    executer("REPLACE INTO fowBlockSeeByAlliance(allianceId, blockId) SELECT DISTINCT allianceId, blockId FROM block WHERE allianceId=$locAllianceId AND blockId IN  ".Block::getStaticBlockIdsWhereClauseList($parEvent->oldZone->blockId, 1, 1, 1));
                    */
                }
            break;
            default:
            //Noting
        }
    }
}
?>
Return current item: PhpBlock