def onAdvEvent (self,event,npc,player): if event == "timer" or event =="timer2": if self.npcobject[npc.getObjectId()].correct == False: dx = npc.getX() - 142999 dy = npc.getY() - 151671 d = dx * dx + dy * dy if d < 10000: npc.broadcastPacket(MagicSkillUse(npc, npc, 5441, 1, 1, 0)) self.npcobject[npc.getObjectId()].correct = True self.worlds[npc.getInstanceId()].correct = self.worlds[npc.getInstanceId()].correct +1 if self.npcobject[npc.getObjectId()].correct == False: dx = npc.getX() - 139494 dy = npc.getY() - 151668 d = dx * dx + dy * dy if d < 10000: npc.broadcastPacket(MagicSkillUse(npc, npc, 5441, 1, 1, 0)) self.npcobject[npc.getObjectId()].correct = True self.worlds[npc.getInstanceId()].correct = self.worlds[npc.getInstanceId()].correct +1 if self.worlds[npc.getInstanceId()].correct>=2: for door in InstanceManager.getInstance().getInstance(npc.getInstanceId()).getDoors(): if door.getDoorId() == 24220026: door.openMe() return if self.npcobject[npc.getObjectId()].lastitem: L2World.getInstance().removeVisibleObject(self.npcobject[npc.getObjectId()].lastitem, self.npcobject[npc.getObjectId()].lastitem.getWorldRegion()) L2World.getInstance().removeObject(self.npcobject[npc.getObjectId()].lastitem) if len(self.npcobject[npc.getObjectId()].walklist_order)==0: return for item in self.npcobject[npc.getObjectId()].walklist_order: crystal = self.npcobject[npc.getObjectId()].walklist[item] newpos = L2CharPosition(crystal.getX(), crystal.getY(), crystal.getZ(), 0) npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, newpos) self.npcobject[npc.getObjectId()].lastitem = crystal self.npcobject[npc.getObjectId()].walklist_order.remove(item) npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),"小氣鬼,只分一個給我!真是絕情耶~ ...")) break; if(len(self.npcobject[npc.getObjectId()].walklist_order))>0: if event == "timer": self.startQuestTimer("timer2",2000,npc,None) else: self.startQuestTimer("timer",2000,npc,None) else: if self.npcobject[npc.getObjectId()].last == False: self.npcobject[npc.getObjectId()].last = True if event == "timer": self.startQuestTimer("timer2",2000,npc,None) else: self.startQuestTimer("timer",2000,npc,None) return
def findRightState(self, player, mob): mobid = mob.getObjectId() name = player.getName() st1 = None if [mobid, name] in self.Spawn_List: st1 = L2World.getInstance().getPlayer(name) else: for entry in self.Spawn_List: if entry[0] == mobid: name = entry[1] st1 = L2World.getInstance().getPlayer(name) break if st1: return st1.getQuestState(self.qn) return st1
def findRightState(self, player,mob) : mobObjectId = mob.getObjectId() st1 = None playerName,mob = self.Spawn_List[mobObjectId] st1 = L2World.getInstance().getPlayer(playerName) if st1 : st1 = st1.getQuestState(self.qn) return st1
def findRightState(self, mobObjectId): st1 = None playerName = self.Spawn_List[mobObjectId][ 0] #There is a possibility for an NPE here, but only if something else is wrong in the quest st1 = L2World.getInstance().getPlayer( playerName ) #Therefore, placing an NPE catch here will only hide the error, not solve it. if st1: st1 = st1.getQuestState(self.qn) return st1
def onSkillSee (self,npc,player,skill,targets,isPet) : name = self.Spawn_List[npc.getObjectId()][0] #This can also result in an NPE, but again, this alerts us to an error. if player.getName() != name : quest_player = L2World.getInstance().getPlayer(name) if (quest_player in targets) or (npc in targets) : st2 = self.findRightState(npc.getObjectId()) if not st2 : return self.AutoChat(npc,self.Text[5].replace('PLAYERNAME',player.getName())) if st2.getQuestTimer("Archon Hellisha has despawned") : st2.getQuestTimer("Archon Hellisha has despawned").cancel() self.DeleteSpawn(st2,npc.getObjectId()) st2.set("spawned","0")
def onSkillSee (self,npc,player,skill,targets,isPet) : name = self.Spawn_List[npc.getObjectId()][0] if player.getName() != name : quest_player = L2World.getInstance().getPlayer(name) if (quest_player in targets) or (npc in targets) : st2 = self.findRightState(player,npc) if not st2 : return self.AutoChat(npc,self.Text[5].replace('PLAYERNAME',player.getName())) if st2.getQuestTimer("Archon Hellisha has despawned") : st2.getQuestTimer("Archon Hellisha has despawned").cancel() self.DeleteSpawn(st2,st2.getInt("Archon")) st2.set("spawned","0")
def findRightState(self, mobObjectId) : st1 = None playerName = self.Spawn_List[mobObjectId][0] #There is a possibility for an NPE here, but only if something else is wrong in the quest st1 = L2World.getInstance().getPlayer(playerName) #Therefore, placing an NPE catch here will only hide the error, not solve it. if st1 : st1 = st1.getQuestState(self.qn) return st1