Location: PHPKode > projects > PhpBlock > A9.8/script/tick/unlobotomizecounter.php
<?php
include_once $PATH_TO_CODE."/script/tick/allincludefortick.php";

class UnlobotomizeCounterTick extends Tick {
    public function getName() {
        return "Recruitment";
    }
    public function run() {
        global $gloObjectManager;

        executer("UPDATE objectInfo SET value = value - 1 WHERE type1=".RealObject::$REAL_OBJECT_INFO_TYPE1_COUNTER." AND type2=".RealObject::$REAL_OBJECT_INFO_TYPE2_LOBOTOMIZE_TIME);
        $res = executer("SELECT objectId, value FROM objectInfo WHERE type1=".RealObject::$REAL_OBJECT_INFO_TYPE1_COUNTER." AND type2=".RealObject::$REAL_OBJECT_INFO_TYPE2_LOBOTOMIZE_TIME);
        while($row  = mysql_fetch_array($res))
        {
            $locValue = $row[1];
            $locObject = $gloObjectManager->getRealObject($row[0]);
            if($locObject) {
                if($locValue <= 0 && $locObject->isAlive()) {
                    $locObject->unLobotomize();
                    $locObject->setActionPoint(0);
                    $locObject->setFightPoint(0);
                }
                $locObject->hasBeenModified();
            } else {
                Log::error("tick/unlobotomizecounter.php : objectId ".$row[0]." doesn't exist ?");
            }
        }
        executer("DELETE FROM objectInfo WHERE value <= 0 AND type1=".RealObject::$REAL_OBJECT_INFO_TYPE1_COUNTER." AND type2=".RealObject::$REAL_OBJECT_INFO_TYPE2_LOBOTOMIZE_TIME);
    }
}
?>
Return current item: PhpBlock