Exemple #1
0
class QuestIndicatorNodeIntDoor(QuestIndicatorNode):
    
    def __init__(self, questStep):
        self.pendingStepObj = None
        QuestIndicatorNode.__init__(self, 'IntDoorIndicator', [
            5], questStep)
        self.nearEffect = None

    
    def delete(self):
        if self.pendingStepObj:
            base.cr.relatedObjectMgr.abortRequest(self.pendingStepObj)
            self.pendingStepObj = None
        
        QuestIndicatorNode.delete(self)
        if self.nearEffect:
            self.nearEffect.cleanUpEffect()
        
        self.nearEffect = None

    
    def placeInWorld(self):
        
        def stepObjHere(stepObj):
            self.pendingStepObj = None
            self.reparentTo(stepObj)
            self.setPos(0, 0, 0)
            self.setHpr(0, 0, 0)
            self.setScale(render, 1)

        if self.pendingStepObj:
            base.cr.relatedObjectMgr.abortRequest(self.pendingStepObj)
            self.pendingStepObj = None
        
        self.pendingStepObj = base.cr.relatedObjectMgr.requestObjects([
            self.questStep.getStepDoId()], eachCallback = stepObjHere)

    
    def loadZoneLevel(self, level):
        QuestIndicatorNode.loadZoneLevel(self, level)
        if level == 0:
            self.request('At')
        
        if level == 1:
            self.request('Near')
        

    
    def unloadZoneLevel(self, level):
        QuestIndicatorNode.unloadZoneLevel(self, level)
        if level == 0:
            self.request('Near')
        
        if level == 1:
            self.request('Off')
        

    
    def enterOff(self):
        QuestIndicatorNode.enterOff(self)
        self.stopNearEffect()

    enterOff = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterOff)
    
    def enterNear(self):
        self.startNearEffect()

    enterNear = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterNear)
    
    def exitNear(self):
        self.stopNearEffect()

    exitNear = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(exitNear)
    
    def enterAt(self):
        pass

    
    def exitAt(self):
        pass

    
    def showEffect(self):
        QuestIndicatorNode.showEffect(self)
        self.startNearEffect()

    
    def hideEffect(self):
        QuestIndicatorNode.hideEffect(self)
        self.stopNearEffect()

    
    def startNearEffect(self):
        if self.muted:
            return None
        
        if not self.nearEffect:
            self.nearEffect = RayOfLight()
            self.nearEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.nearEffect.reparentTo(self)
            self.nearEffect.startLoop()
        

    startNearEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(startNearEffect)
    
    def stopNearEffect(self):
        if self.nearEffect:
            self.nearEffect.stopLoop()
            self.nearEffect = None
        

    stopNearEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stopNearEffect)
Exemple #2
0
class QuestIndicatorNodeShip(QuestIndicatorGridNode):
    def __init__(self, questStep):
        self.nearEffect = None
        QuestIndicatorGridNode.__init__(self, 'ShipIndicator', [300, 1500],
                                        questStep)
        self._selfRefreshTask = None
        self._refreshTargetLoc = None
        return

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def delete(self):
        QuestIndicatorGridNode.delete(self)
        if self.nearEffect:
            self.nearEffect.cleanUpEffect()
        self.nearEffect = None
        self.stopTargetRefresh()
        return

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def enterOff(self):
        QuestIndicatorGridNode.enterOff(self)
        self.stopNearEffect()

    def enterFar(self):
        QuestIndicatorGridNode.enterFar(self)
        self.requestTargetRefresh()

    def exitFar(self):
        QuestIndicatorGridNode.exitFar(self)
        self.stopTargetRefresh()

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def enterNear(self):
        QuestIndicatorGridNode.enterNear(self)
        self.startNearEffect()

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def exitNear(self):
        self.stopNearEffect()
        QuestIndicatorGridNode.exitNear(self)

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def enterAt(self):
        QuestIndicatorGridNode.enterAt(self)

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def exitAt(self):
        QuestIndicatorGridNode.exitAt(self)

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def stepObjArrived(self, stepObj):
        QuestIndicatorGridNode.stepObjArrived(self, stepObj)
        if self.getCurrentOrNextState() in ('Near', ):
            self.startNearEffect()

    def stepObjLeft(self):
        self.stopNearEffect()
        QuestIndicatorGridNode.stepObjLeft(self)

    def showEffect(self):
        QuestIndicatorGridNode.showEffect(self)
        self.startNearEffect()

    def hideEffect(self):
        QuestIndicatorGridNode.hideEffect(self)
        self.stopNearEffect()

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def startNearEffect(self):
        if self.muted:
            return
        if not self.nearEffect:
            self.nearEffect = RayOfLight()
            self.nearEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.nearEffect.startLoop()
        if self.stepObj:
            self.nearEffect.reparentTo(self.stepObj)

    @report(types=['frameCount', 'args'], dConfigParam='quest-indicator')
    def stopNearEffect(self):
        if self.nearEffect:
            self.nearEffect.stopLoop()
            self.nearEffect = None
        return
class QuestIndicatorNodeShip(QuestIndicatorGridNode):
    def __init__(self, questStep):
        self.nearEffect = None
        QuestIndicatorGridNode.__init__(self, "ShipIndicator", [300, 1500], questStep)
        self._selfRefreshTask = None
        self._refreshTargetLoc = None

    def delete(self):
        QuestIndicatorGridNode.delete(self)
        if self.nearEffect:
            self.nearEffect.cleanUpEffect()

        self.nearEffect = None
        self.stopTargetRefresh()

    delete = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(delete)

    def enterOff(self):
        QuestIndicatorGridNode.enterOff(self)
        self.stopNearEffect()

    enterOff = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(enterOff)

    def enterFar(self):
        QuestIndicatorGridNode.enterFar(self)
        self.requestTargetRefresh()

    def exitFar(self):
        QuestIndicatorGridNode.exitFar(self)
        self.stopTargetRefresh()

    def enterNear(self):
        QuestIndicatorGridNode.enterNear(self)
        self.startNearEffect()

    enterNear = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(enterNear)

    def exitNear(self):
        self.stopNearEffect()
        QuestIndicatorGridNode.exitNear(self)

    exitNear = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(exitNear)

    def enterAt(self):
        QuestIndicatorGridNode.enterAt(self)

    enterAt = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(enterAt)

    def exitAt(self):
        QuestIndicatorGridNode.exitAt(self)

    exitAt = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(exitAt)

    def stepObjArrived(self, stepObj):
        QuestIndicatorGridNode.stepObjArrived(self, stepObj)
        if self.getCurrentOrNextState() in ("Near",):
            self.startNearEffect()

    stepObjArrived = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(stepObjArrived)

    def stepObjLeft(self):
        self.stopNearEffect()
        QuestIndicatorGridNode.stepObjLeft(self)

    def showEffect(self):
        QuestIndicatorGridNode.showEffect(self)
        self.startNearEffect()

    def hideEffect(self):
        QuestIndicatorGridNode.hideEffect(self)
        self.stopNearEffect()

    def startNearEffect(self):
        if self.muted:
            return None

        if not self.nearEffect:
            self.nearEffect = RayOfLight()
            self.nearEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.nearEffect.startLoop()

        if self.stepObj:
            self.nearEffect.reparentTo(self.stepObj)

    startNearEffect = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(startNearEffect)

    def stopNearEffect(self):
        if self.nearEffect:
            self.nearEffect.stopLoop()
            self.nearEffect = None

    stopNearEffect = report(types=["frameCount", "args"], dConfigParam="quest-indicator")(stopNearEffect)
class QuestIndicatorNodeExtDoor(QuestIndicatorGridNode):
    
    def __init__(self, questStep):
        self.nearEffect = None
        QuestIndicatorGridNode.__init__(self, 'ExtDoorIndicator', [
            10,
            150], questStep)

    
    def delete(self):
        QuestIndicatorGridNode.delete(self)
        if self.nearEffect:
            self.nearEffect.cleanUpEffect()
        
        self.nearEffect = None

    delete = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(delete)
    
    def enterOff(self):
        QuestIndicatorGridNode.enterOff(self)
        self.stopNearEffect()

    enterOff = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterOff)
    
    def enterNear(self):
        QuestIndicatorGridNode.enterNear(self)
        self.startNearEffect()

    
    def exitNear(self):
        QuestIndicatorGridNode.exitNear(self)
        self.stopNearEffect()

    
    def stepObjArrived(self, stepObj):
        QuestIndicatorGridNode.stepObjArrived(self, stepObj)
        if self.getCurrentOrNextState() in ('Near',):
            self.startNearEffect()
        

    stepObjArrived = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stepObjArrived)
    
    def stepObjLeft(self):
        QuestIndicatorGridNode.stepObjLeft(self)
        self.stopNearEffect()

    stepObjLeft = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stepObjLeft)
    
    def showEffect(self):
        QuestIndicatorGridNode.showEffect(self)
        self.startNearEffect()

    showEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(showEffect)
    
    def hideEffect(self):
        QuestIndicatorGridNode.hideEffect(self)
        self.stopNearEffect()

    hideEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(hideEffect)
    
    def startNearEffect(self):
        if self.muted:
            return None
        
        if not self.nearEffect:
            self.nearEffect = RayOfLight()
            self.nearEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.nearEffect.setPos(Point3(0, 5, 0))
            self.nearEffect.startLoop()
        
        if self.stepObj:
            self.nearEffect.reparentTo(self.stepObj)
        

    startNearEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(startNearEffect)
    
    def stopNearEffect(self):
        if self.nearEffect:
            self.nearEffect.stopLoop()
            self.nearEffect = None
        

    stopNearEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stopNearEffect)
class QuestIndicatorNodeQuestProp(QuestIndicatorGridNode):
    
    def __init__(self, questStep):
        self.nearEffect = None
        QuestIndicatorGridNode.__init__(self, 'QuestPropIndicator', [
            30,
            150], questStep)

    
    def delete(self):
        QuestIndicatorGridNode.delete(self)
        if self.nearEffect:
            self.nearEffect.destroy()
        
        self.nearEffect = None

    delete = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(delete)
    
    def enterOff(self):
        QuestIndicatorGridNode.enterOff(self)

    enterOff = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterOff)
    
    def enterFar(self):
        QuestIndicatorGridNode.enterFar(self)
        self.requestTargetRefresh()

    
    def exitFar(self):
        QuestIndicatorGridNode.exitFar(self)
        self.stopTargetRefresh()

    
    def enterNear(self):
        QuestIndicatorGridNode.enterNear(self)
        self.startNearEffect()

    enterNear = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterNear)
    
    def exitNear(self):
        self.stopNearEffect()
        QuestIndicatorGridNode.exitNear(self)

    exitNear = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(exitNear)
    
    def enterAt(self):
        QuestIndicatorGridNode.enterAt(self)

    enterAt = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterAt)
    
    def exitAt(self):
        QuestIndicatorGridNode.exitAt(self)

    exitAt = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(exitAt)
    
    def stepObjArrived(self, stepObj):
        QuestIndicatorGridNode.stepObjArrived(self, stepObj)
        if self.getCurrentOrNextState() in ('Near',):
            self.startNearEffect()
        

    stepObjArrived = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stepObjArrived)
    
    def stepObjLeft(self):
        self.stopNearEffect()
        QuestIndicatorGridNode.stepObjLeft(self)

    
    def showEffect(self):
        QuestIndicatorGridNode.showEffect(self)
        self.startNearEffect()

    
    def hideEffect(self):
        QuestIndicatorGridNode.hideEffect(self)
        self.stopNearEffect()

    
    def startNearEffect(self):
        if self.muted:
            return None
        
        if not self.nearEffect:
            self.nearEffect = RayOfLight()
            self.nearEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.nearEffect.startLoop()
        
        if self.stepObj:
            self.nearEffect.reparentTo(self.stepObj)
        

    startNearEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(startNearEffect)
    
    def stopNearEffect(self):
        if self.nearEffect:
            self.nearEffect.stopLoop()
            self.nearEffect = None
        

    stopNearEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stopNearEffect)
class QuestIndicatorNode(NodePath, FSM, ZoneLOD):
    notify = directNotify.newCategory('QuestIndicatorNode')
    
    def __init__(self, name, zoneRadii, questStep):
        zoneRadii += [
            1000000]
        NodePath.__init__(self, name)
        FSM.__init__(self, '%sFSM' % name)
        ZoneLOD.__init__(self, self._QuestIndicatorNode__uniqueName, zoneRadii)
        self.questStep = questStep
        self.pendingOriginObj = None
        self.muted = False
        self.farEffect = None
        self.wantBottomEffect = True
        self.minimapObject = None
        self.minimap = None
        
        def originObjHere(originObj):
            self.pendingOriginObj = None
            self.setZoneRadii(zoneRadii)
            self.placeInWorld()

        self._selfRefreshTask = None
        self._refreshTargetInfo = None
        if self.questStep.getOriginDoId():
            self.pendingOriginObj = base.cr.relatedObjectMgr.requestObjects([
                self.questStep.getOriginDoId()], eachCallback = originObjHere)
        else:
            originObjHere(None)

    
    def delete(self):
        if self.minimapObject:
            self.minimapObject.removeFromMap()
            self.minimapObject = None
        
        self.stopTargetRefresh()
        if self.pendingOriginObj:
            base.cr.relatedObjectMgr.abortRequest(self.pendingOriginObj)
            self.pendingOriginObj = None
        
        self._QuestIndicatorNode__cleanup()
        ZoneLOD.delete(self)
        self.remove()
        self.minimapObject = None
        self.minimap = None
        self.questStep = None
        if self.farEffect:
            self.farEffect.stopLoop()
            self.farEffect.destroy()
        
        self.farEffect = None

    delete = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(delete)
    
    def cleanup(self):
        pass

    
    def __cleanup(self):
        ZoneLOD.cleanup(self)
        FSM.cleanup(self)

    _QuestIndicatorNode__cleanup = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(__cleanup)
    
    def _QuestIndicatorNode__uniqueName(self, idString):
        return '%s-QuestNodeIndicator-%s' % (idString, id(self.questStep))

    
    def placeInWorld(self):
        pass

    placeInWorld = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(placeInWorld)
    
    def loadZoneLevel(self, level):
        self.notify.debug('LoadZoneLevel: %s' % level)

    
    def unloadZoneLevel(self, level, cacheObs = False):
        self.notify.debug('UnloadZoneLevel: %s' % level)

    
    def defaultFilter(self, request, args):
        if request != self.state:
            return FSM.defaultFilter(self, request, args)
        

    
    def getMinimapObject(self):
        if not self.minimapObject:
            self.minimapObject = MinimapQuest(self)
        
        return self.minimapObject

    
    def exitOff(self):
        self.accept('transferMinimapObjects', self.transferMinimapObject)
        if hasattr(localAvatar, 'guiMgr') and localAvatar.guiMgr:
            self.minimap = localAvatar.guiMgr.getMinimap()
            if self.minimap and self.getMinimapObject():
                self.minimap.addObject(self.getMinimapObject())
            
            self.updateGuiHints(localAvatar.activeQuestId)
        

    exitOff = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(exitOff)
    
    def transferMinimapObject(self, guiMgr):
        guiMgr.transferMinimapObject(self.getMinimapObject())

    
    def enterOff(self):
        self.ignore('transferMinimapObjects')
        self.stopFarEffect()
        if self.minimap and self.minimapObject:
            self.minimap.removeObject(self.minimapObject)
        
        if hasattr(localAvatar, 'guiMgr') and localAvatar.guiMgr:
            localAvatar.guiMgr.setQuestHintText('')
        
        self.minimap = None

    enterOff = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterOff)
    
    def enterFar(self):
        self.notify.debug('Enter: Far')
        self.startFarEffect()

    enterFar = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterFar)
    
    def exitFar(self):
        self.notify.debug('Exit: Far')
        self.stopFarEffect()

    exitFar = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(exitFar)
    
    def enterNear(self):
        self.notify.debug('Enter: Near')

    
    def exitNear(self):
        self.notify.debug('Exit: Near')

    
    def enterAt(self):
        self.notify.debug('Enter: At')

    
    def exitAt(self):
        self.notify.debug('Exit: At')

    
    def startFarEffect(self):
        if self.muted:
            return None
        
        if not self.farEffect:
            self.farEffect = RayOfLight()
            self.farEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.farEffect.reparentTo(self)
            self.farEffect.startLoop()
        

    startFarEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(startFarEffect)
    
    def stopFarEffect(self):
        if self.farEffect:
            self.farEffect.stopLoop()
            self.farEffect.destroy()
            self.farEffect = None
        

    stopFarEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stopFarEffect)
    
    def showEffect(self):
        self.notify.debug('ShowEffect')
        self.muted = False
        self.startFarEffect()

    
    def hideEffect(self):
        self.notify.debug('HideEffect')
        self.muted = True
        self.stopFarEffect()

    
    def requestTargetRefresh(self, refreshDelay = 10):
        self.stopTargetRefresh()
        
        def tryRefresh(task):
            if localAvatar.ship:
                avLoc = localAvatar.ship.getLocation()
            else:
                avLoc = localAvatar.getLocation()
            currTime = globalClock.getFrameTime()
            if (self._refreshTargetInfo == None or self._refreshTargetInfo[0] != avLoc) and currTime - self._refreshTargetInfo[1] > 10:
                localAvatar.refreshActiveQuestStep(False, True)
                self._refreshTargetInfo = [
                    avLoc,
                    currTime]
            
            if refreshDelay == 0:
                return task.done
            else:
                return task.again

        if localAvatar.questStepAutoRefresh():
            self._selfRefreshTask = taskMgr.doMethodLater(refreshDelay, tryRefresh, 'indicatorNodeRefresh-%s' % localAvatar.doId)
        

    
    def stopTargetRefresh(self):
        if self._selfRefreshTask:
            taskMgr.remove(self._selfRefreshTask)
            self._selfRefreshTask = None
            self._refreshTargetInfo = None
        

    
    def updateGuiHints(self, questId):
        if not hasattr(localAvatar, 'guiMgr') or not (localAvatar.guiMgr):
            return None
        
        hintText = ''
        quest = localAvatar.getQuestById(questId)
        if quest and hasattr(quest.getTasks()[0], 'getEnemyType') and not quest.isComplete():
            if quest.getTasks()[0].getLocation() != LocationIds.ANY_LOCATION:
                pass
            elif localAvatar.questStep and localAvatar.questStep.getTargetArea():
                targetLocation = localAvatar.questStep.getTargetArea()
                localAvatar.guiMgr.radarGui.hideGlowRing()
                targetLocationName = PLocalizer.LocationNamesNotIsland.get(targetLocation)
                if not targetLocationName:
                    targetLocationName = PLocalizer.LocationNames.get(targetLocation)
                
                if targetLocationName:
                    hintText = PLocalizer.TargetsInThere % targetLocationName
                
            elif localAvatar.questStep:
                localAvatar.guiMgr.radarGui.hideGlowRing()
                targetLocation = localAvatar.questStep.getIsland()
                targetLocationName = PLocalizer.LocationNames.get(targetLocation)
                if targetLocationName:
                    hintText = PLocalizer.TargetsInThere % targetLocationName
                
            
        
        localAvatar.guiMgr.setQuestHintText(hintText)

    
    def setZoneLODOffset(self, zone, offset):
        if zone == -1:
            for currSphere in self.zoneSphere:
                sphereSolid = currSphere.node().modifySolid(0)
                sphereSolid.setCenter(offset)
            
        else:
            sphereSolid = self.zoneSphere[zone].node().modifySolid(0)
            sphereSolid.setCenter(offset)
Exemple #7
0
class QuestIndicatorNode(NodePath, FSM, ZoneLOD):
    notify = directNotify.newCategory('QuestIndicatorNode')

    def __init__(self, name, zoneRadii, questStep):
        zoneRadii += [1000000]
        NodePath.__init__(self, name)
        FSM.__init__(self, '%sFSM' % name)
        ZoneLOD.__init__(self, self._QuestIndicatorNode__uniqueName, zoneRadii)
        self.questStep = questStep
        self.pendingOriginObj = None
        self.muted = False
        self.farEffect = None
        self.wantBottomEffect = True
        self.minimapObject = None
        self.minimap = None

        def originObjHere(originObj):
            self.pendingOriginObj = None
            self.setZoneRadii(zoneRadii)
            self.placeInWorld()

        self._selfRefreshTask = None
        self._refreshTargetInfo = None
        if self.questStep.getOriginDoId():
            self.pendingOriginObj = base.cr.relatedObjectMgr.requestObjects(
                [self.questStep.getOriginDoId()], eachCallback=originObjHere)
        else:
            originObjHere(None)

    def delete(self):
        if self.minimapObject:
            self.minimapObject.removeFromMap()
            self.minimapObject = None

        self.stopTargetRefresh()
        if self.pendingOriginObj:
            base.cr.relatedObjectMgr.abortRequest(self.pendingOriginObj)
            self.pendingOriginObj = None

        self._QuestIndicatorNode__cleanup()
        ZoneLOD.delete(self)
        self.remove()
        self.minimapObject = None
        self.minimap = None
        self.questStep = None
        if self.farEffect:
            self.farEffect.stopLoop()
            self.farEffect.destroy()

        self.farEffect = None

    delete = report(types=['args'], dConfigParam='quest-indicator')(delete)

    def cleanup(self):
        pass

    cleanup = report(types=['args'], dConfigParam='quest-indicator')(cleanup)

    def __cleanup(self):
        ZoneLOD.cleanup(self)
        FSM.cleanup(self)

    _QuestIndicatorNode__cleanup = report(
        types=['args'], dConfigParam='quest-indicator')(__cleanup)

    def _QuestIndicatorNode__uniqueName(self, idString):
        return '%s-QuestNodeIndicator-%s' % (idString, id(self.questStep))

    def placeInWorld(self):
        pass

    placeInWorld = report(types=['args'],
                          dConfigParam='quest-indicator')(placeInWorld)

    def loadZoneLevel(self, level):
        self.notify.debug('LoadZoneLevel: %s' % level)

    def unloadZoneLevel(self, level, cacheObs=False):
        self.notify.debug('UnloadZoneLevel: %s' % level)

    def defaultFilter(self, request, args):
        if request != self.state:
            return FSM.defaultFilter(self, request, args)

    def getMinimapObject(self):
        if not self.minimapObject:
            self.minimapObject = MinimapQuest(self)

        return self.minimapObject

    def exitOff(self):
        self.accept('transferMinimapObjects', self.transferMinimapObject)
        if hasattr(localAvatar, 'guiMgr') and localAvatar.guiMgr:
            self.minimap = localAvatar.guiMgr.getMinimap()
            if self.minimap and self.getMinimapObject():
                self.minimap.addObject(self.getMinimapObject())

            self.updateGuiHints(localAvatar.activeQuestId)

    exitOff = report(types=['args'], dConfigParam='quest-indicator')(exitOff)

    def transferMinimapObject(self, guiMgr):
        guiMgr.transferMinimapObject(self.getMinimapObject())

    def enterOff(self):
        self.ignore('transferMinimapObjects')
        self.stopFarEffect()
        if self.minimap and self.minimapObject:
            self.minimap.removeObject(self.minimapObject)

        if hasattr(localAvatar, 'guiMgr') and localAvatar.guiMgr:
            localAvatar.guiMgr.setQuestHintText('')

        self.minimap = None

    enterOff = report(types=['frameCount', 'args'],
                      dConfigParam='quest-indicator')(enterOff)

    def enterFar(self):
        self.notify.debug('Enter: Far')
        self.startFarEffect()

    enterFar = report(types=['args'], dConfigParam='quest-indicator')(enterFar)

    def exitFar(self):
        self.notify.debug('Exit: Far')
        self.stopFarEffect()

    exitFar = report(types=['args'], dConfigParam='quest-indicator')(exitFar)

    def enterNear(self):
        self.notify.debug('Enter: Near')

    def exitNear(self):
        self.notify.debug('Exit: Near')

    def enterAt(self):
        self.notify.debug('Enter: At')

    def exitAt(self):
        self.notify.debug('Exit: At')

    def startFarEffect(self):
        if self.muted:
            return None

        if not self.farEffect:
            self.farEffect = RayOfLight()
            self.farEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.farEffect.reparentTo(self)
            self.farEffect.startLoop()

    startFarEffect = report(types=['args'],
                            dConfigParam='quest-indicator')(startFarEffect)

    def stopFarEffect(self):
        if self.farEffect:
            self.farEffect.stopLoop()
            self.farEffect.destroy()
            self.farEffect = None

    stopFarEffect = report(types=['args'],
                           dConfigParam='quest-indicator')(stopFarEffect)

    def showEffect(self):
        self.notify.debug('ShowEffect')
        self.muted = False
        self.startFarEffect()

    showEffect = report(types=['args'],
                        dConfigParam='quest-indicator')(showEffect)

    def hideEffect(self):
        self.notify.debug('HideEffect')
        self.muted = True
        self.stopFarEffect()

    hideEffect = report(types=['args'],
                        dConfigParam='quest-indicator')(hideEffect)

    def requestTargetRefresh(self, refreshDelay=10):
        self.stopTargetRefresh()

        def tryRefresh(task):
            if localAvatar.ship:
                avLoc = localAvatar.ship.getLocation()
            else:
                avLoc = localAvatar.getLocation()
            currTime = globalClock.getFrameTime()
            if (self._refreshTargetInfo == None or self._refreshTargetInfo[0]
                    != avLoc) and currTime - self._refreshTargetInfo[1] > 10:
                localAvatar.refreshActiveQuestStep(False, True)
                self._refreshTargetInfo = [avLoc, currTime]

            if refreshDelay == 0:
                return task.done
            else:
                return task.again

        if localAvatar.questStepAutoRefresh():
            self._selfRefreshTask = taskMgr.doMethodLater(
                refreshDelay, tryRefresh,
                'indicatorNodeRefresh-%s' % localAvatar.doId)

    def stopTargetRefresh(self):
        if self._selfRefreshTask:
            taskMgr.remove(self._selfRefreshTask)
            self._selfRefreshTask = None
            self._refreshTargetInfo = None

    def updateGuiHints(self, questId):
        if not hasattr(localAvatar, 'guiMgr') or not (localAvatar.guiMgr):
            return None

        hintText = ''
        quest = localAvatar.getQuestById(questId)
        if quest and hasattr(quest.getTasks()[0],
                             'getEnemyType') and not quest.isComplete():
            if quest.getTasks()[0].getLocation() != LocationIds.ANY_LOCATION:
                pass
            elif localAvatar.questStep and localAvatar.questStep.getTargetArea(
            ):
                targetLocation = localAvatar.questStep.getTargetArea()
                localAvatar.guiMgr.radarGui.hideGlowRing()
                targetLocationName = PLocalizer.LocationNamesNotIsland.get(
                    targetLocation)
                if not targetLocationName:
                    targetLocationName = PLocalizer.LocationNames.get(
                        targetLocation)

                if targetLocationName:
                    hintText = PLocalizer.TargetsInThere % targetLocationName

            elif localAvatar.questStep:
                localAvatar.guiMgr.radarGui.hideGlowRing()
                targetLocation = localAvatar.questStep.getIsland()
                targetLocationName = PLocalizer.LocationNames.get(
                    targetLocation)
                if targetLocationName:
                    hintText = PLocalizer.TargetsInThere % targetLocationName

        localAvatar.guiMgr.setQuestHintText(hintText)

    def setZoneLODOffset(self, zone, offset):
        if zone == -1:
            for currSphere in self.zoneSphere:
                sphereSolid = currSphere.node().modifySolid(0)
                sphereSolid.setCenter(offset)

        else:
            sphereSolid = self.zoneSphere[zone].node().modifySolid(0)
            sphereSolid.setCenter(offset)
class QuestIndicatorNodeQuestProp(QuestIndicatorGridNode):
    def __init__(self, questStep):
        self.nearEffect = None
        QuestIndicatorGridNode.__init__(self, 'QuestPropIndicator', [30, 150],
                                        questStep)

    def delete(self):
        QuestIndicatorGridNode.delete(self)
        if self.nearEffect:
            self.nearEffect.destroy()

        self.nearEffect = None

    delete = report(types=['frameCount', 'args'],
                    dConfigParam='quest-indicator')(delete)

    def enterOff(self):
        QuestIndicatorGridNode.enterOff(self)

    enterOff = report(types=['frameCount', 'args'],
                      dConfigParam='quest-indicator')(enterOff)

    def enterFar(self):
        QuestIndicatorGridNode.enterFar(self)
        self.requestTargetRefresh()

    def exitFar(self):
        QuestIndicatorGridNode.exitFar(self)
        self.stopTargetRefresh()

    def enterNear(self):
        QuestIndicatorGridNode.enterNear(self)
        self.startNearEffect()

    enterNear = report(types=['frameCount', 'args'],
                       dConfigParam='quest-indicator')(enterNear)

    def exitNear(self):
        self.stopNearEffect()
        QuestIndicatorGridNode.exitNear(self)

    exitNear = report(types=['frameCount', 'args'],
                      dConfigParam='quest-indicator')(exitNear)

    def enterAt(self):
        QuestIndicatorGridNode.enterAt(self)

    enterAt = report(types=['frameCount', 'args'],
                     dConfigParam='quest-indicator')(enterAt)

    def exitAt(self):
        QuestIndicatorGridNode.exitAt(self)

    exitAt = report(types=['frameCount', 'args'],
                    dConfigParam='quest-indicator')(exitAt)

    def stepObjArrived(self, stepObj):
        QuestIndicatorGridNode.stepObjArrived(self, stepObj)
        if self.getCurrentOrNextState() in ('Near', ):
            self.startNearEffect()

    stepObjArrived = report(types=['frameCount', 'args'],
                            dConfigParam='quest-indicator')(stepObjArrived)

    def stepObjLeft(self):
        self.stopNearEffect()
        QuestIndicatorGridNode.stepObjLeft(self)

    def showEffect(self):
        QuestIndicatorGridNode.showEffect(self)
        self.startNearEffect()

    def hideEffect(self):
        QuestIndicatorGridNode.hideEffect(self)
        self.stopNearEffect()

    def startNearEffect(self):
        if self.muted:
            return None

        if not self.nearEffect:
            self.nearEffect = RayOfLight()
            self.nearEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.nearEffect.startLoop()

        if self.stepObj:
            self.nearEffect.reparentTo(self.stepObj)

    startNearEffect = report(types=['frameCount', 'args'],
                             dConfigParam='quest-indicator')(startNearEffect)

    def stopNearEffect(self):
        if self.nearEffect:
            self.nearEffect.stopLoop()
            self.nearEffect = None

    stopNearEffect = report(types=['frameCount', 'args'],
                            dConfigParam='quest-indicator')(stopNearEffect)
class QuestIndicatorNodeExtDoor(QuestIndicatorGridNode):
    
    def __init__(self, questStep):
        self.nearEffect = None
        QuestIndicatorGridNode.__init__(self, 'ExtDoorIndicator', [
            10,
            150], questStep)

    
    def delete(self):
        QuestIndicatorGridNode.delete(self)
        if self.nearEffect:
            self.nearEffect.cleanUpEffect()
        
        self.nearEffect = None

    delete = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(delete)
    
    def enterOff(self):
        QuestIndicatorGridNode.enterOff(self)
        self.stopNearEffect()

    enterOff = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(enterOff)
    
    def enterNear(self):
        QuestIndicatorGridNode.enterNear(self)
        self.startNearEffect()

    
    def exitNear(self):
        QuestIndicatorGridNode.exitNear(self)
        self.stopNearEffect()

    
    def stepObjArrived(self, stepObj):
        QuestIndicatorGridNode.stepObjArrived(self, stepObj)
        if self.getCurrentOrNextState() in ('Near',):
            self.startNearEffect()
        

    stepObjArrived = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stepObjArrived)
    
    def stepObjLeft(self):
        QuestIndicatorGridNode.stepObjLeft(self)
        self.stopNearEffect()

    stepObjLeft = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stepObjLeft)
    
    def showEffect(self):
        QuestIndicatorGridNode.showEffect(self)
        self.startNearEffect()

    
    def hideEffect(self):
        QuestIndicatorGridNode.hideEffect(self)
        self.stopNearEffect()

    
    def startNearEffect(self):
        if self.muted:
            return None
        
        if not self.nearEffect:
            self.nearEffect = RayOfLight()
            self.nearEffect.setBottomRayEnabled(self.wantBottomEffect)
            self.nearEffect.setPos(Point3(0, 5, 0))
            self.nearEffect.startLoop()
        
        if self.stepObj:
            self.nearEffect.reparentTo(self.stepObj)
        

    startNearEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(startNearEffect)
    
    def stopNearEffect(self):
        if self.nearEffect:
            self.nearEffect.stopLoop()
            self.nearEffect = None
        

    stopNearEffect = report(types = [
        'frameCount',
        'args'], dConfigParam = 'quest-indicator')(stopNearEffect)