def onAdvEvent(self, event, npc, player): if event == "start": self.vlc = self.addSpawn(VELO, 27845, -5567, -1982, 45000, False, 0) self.startQuestTimer("camera", 2000, self.vlc, player) self.cancelQuestTimer("start", npc, None) if event == "round2": self.ptr = self.addSpawn(PTERO, 27838, -5578, -1982, 45000, False, 0) self.startQuestTimer("camera", 2000, self.ptr, player) self.cancelQuestTimer("round2", npc, None) if event == "round3": self.trx = self.addSpawn(TREX, 27838, -5578, -1982, 45000, False, 0) self.startQuestTimer("camera", 2000, self.trx, player) self.cancelQuestTimer("round3", npc, None) if event == "sailren": self.slrn = self.addSpawn(SAILREN, 27489, -6223, -1982, 45000, False, 0) self.startQuestTimer("camera", 2000, self.slrn, player) self.startQuestTimer("vkrovatku", 1200000, self.slrn, None) self.cancelQuestTimer("round4", npc, None) elif event == "camera": player.broadcastPacket( SpecialCamera(npc.getObjectId(), 400, -75, 3, -150, 5000)) npc.broadcastPacket(SocialAction(npc.getObjectId(), 1)) elif event == "open": self.deleteGlobalQuestVar("close") self.cancelQuestTimer("open", npc, None) elif event == "vkrovatku": npc.deleteMe() self.deleteGlobalQuestVar("close") self.cancelQuestTimer("open", npc, None) self.cancelQuestTimer("vkrovatku", npc, None) return
def onAdvEvent(self, event, npc, player): if event == "1": machine_instance = self.FindTemplate(Strange_Machine) if machine_instance: npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, machine_instance) machine_instance.broadcastPacket( SpecialCamera(machine_instance.getObjectId(), 1, -200, 15, 10000, 20000)) else: print "Dr Chaos AI: problem finding Strange Machine (npcid = " + Strange_Machine + "). Error: not spawned!" self.startQuestTimer("2", 2000, npc, player) self.startQuestTimer("3", 10000, npc, player) if self.isChaosSpawned == 0: chaos = self.addSpawn(32033, 96471, -111425, -3334, 0, False, 0) self.isChaosSpawned == 1 self.startQuestTimer("2", 2000, npc, player) self.startQuestTimer("3", 10000, npc, player) elif event == "2": npc.broadcastPacket(SocialAction(npc.getObjectId(), 3)) elif event == "3": npc.broadcastPacket( SpecialCamera(npc.getObjectId(), 1, -150, 10, 3000, 20000)) self.startQuestTimer("4", 2500, npc, player) elif event == "4": npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(96055, -110759, -3312, 0)) self.startQuestTimer("5", 2000, npc, player) elif event == "5": player.teleToLocation(94832, -112624, -3304) npc.teleToLocation(-113091, -243942, -15536) if self.isGolemSpawned == 0: golem = self.addSpawn(25512, 94640, -112496, -3336, 0, False, 0) self.isGolemSpawned == 1 self.startQuestTimer("6", 1000, golem, player) player.sendPacket(PlaySound(1, "Rm03_A", 0, 0, 0, 0, 0)) elif event == "6": npc.broadcastPacket( SpecialCamera(npc.getObjectId(), 30, -200, 20, 6000, 8000)) return
def onAdvEvent(self, event, npc, player) : status = GrandBossManager.getInstance().getBossStatus(Benom) if event == "BenomTeleSpawn" : self.Teleport = self.addSpawn(BenomTeleport, 11013, -49629, -547, 13400, False, 0) elif event == "BenomRaidRoomSpawn" : if self.BenomIsSpawned == 0 and status == 0 : self.Benomm = self.addSpawn(Benom, 12047, -49211, -3009, 0, False, 0) self.BenomIsSpawned = 1 elif event == "BenomRaidSiegeSpawn" : if status == 0 : if self.BenomIsSpawned == 0 : self.Benomm = self.addSpawn(Benom, 11025, -49152, -537, 0, False, 0) self.BenomIsSpawned = 1 elif self.BenomIsSpawned == 1 : self.Benomm.teleToLocation(11025, -49152, -537) self.startQuestTimer("BenomSpawnEffect", 100, None, None) self.startQuestTimer("BenomBossDespawn", 5400000, None, None) self.Teleport.deleteMe() elif event == "BenomSpawnEffect" : self.Benomm.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE) self.Benomm.broadcastPacket(SpecialCamera(self.Benomm.getObjectId(), 200, 0, 150, 0, 5000)) self.Benomm.broadcastPacket(SocialAction(self.Benomm.getObjectId(), 3)) self.startQuestTimer("BenomWalk", 5000, self.Benomm, None) self.BenomWalkRouteStep = 0 elif event == "Attacking" : NumPlayers = [] for player in npc.getKnownList().getKnownPlayers().values() : NumPlayers.append(player) if len(NumPlayers) > 0 : target = NumPlayers[Rnd.get(len(NumPlayers))] npc.addDamageHate(target, 0, 999) npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target) self.startQuestTimer("Attacking", 2000, npc, player) elif len(NumPlayers) == 0 : self.startQuestTimer("BenomWalkFinish", 2000, npc, None) elif event == "BenomWalkFinish" : if npc.getCastle().getSiege().getIsInProgress() : self.cancelQuestTimer("Attacking", npc, player) X = benomWalkRoutes[self.BenomWalkRouteStep][0] Y = benomWalkRoutes[self.BenomWalkRouteStep][1] Z = benomWalkRoutes[self.BenomWalkRouteStep][2] npc.teleToLocation(X, Y, Z) npc.setWalking() self.BenomWalkRouteStep = 0 self.startQuestTimer("BenomWalk", 2200, npc, None) elif event == "BenomWalk" : if self.BenomWalkRouteStep == 33 : self.BenomWalkRouteStep = 0 self.startQuestTimer("BenomWalk", 100, npc, None) else : self.startQuestTimer("Talk", 100, npc, None) if self.BenomWalkRouteStep == 14 : self.startQuestTimer("DoorOpen", 15000, None, None) self.startQuestTimer("DoorClose", 23000, None, None) if self.BenomWalkRouteStep == 32 : self.startQuestTimer("DoorOpen", 500, None, None) self.startQuestTimer("DoorClose", 4000, None, None) Time = WalkTimes[self.BenomWalkRouteStep] npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE) X = benomWalkRoutes[self.BenomWalkRouteStep][0] Y = benomWalkRoutes[self.BenomWalkRouteStep][1] Z = benomWalkRoutes[self.BenomWalkRouteStep][2] npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(X, Y, Z, 0)) self.BenomWalkRouteStep = int(self.BenomWalkRouteStep) + 1 self.startQuestTimer("BenomWalk", Time, npc, None) elif event == "DoorOpen" : DoorTable.getInstance().getDoor(20160005).openMe() elif event == "DoorClose" : DoorTable.getInstance().getDoor(20160005).closeMe() elif event == "Talk" : if Rnd.get(100) < 40 : npc.broadcastPacket(CreatureSay(npc.getObjectId(), 0, "Benom", BenomSpeak[Rnd.get(4)])) elif event == "BenomBossDespawn" : GrandBossManager.getInstance().setBossStatus(Benom,LIVE) self.BenomIsSpawned = 0 self.Benomm.deleteMe() return
def onSkillUse(self, npc, player, skill): # gather some values on local variables npcId = npc.getNpcId() skillId = skill.getId() # check if the npc and skills used are valid for this script. Exit if invalid. if npcId not in self.feedableBeasts: return if skillId not in [SKILL_GOLDEN_SPICE, SKILL_CRYSTAL_SPICE]: return # first gather some values on local variables objectId = npc.getObjectId() growthLevel = 3 # if a mob is in feedableBeasts but not in growthCapableMobs, then it's at max growth (3) if self.growthCapableMobs.has_key(npcId): growthLevel = self.growthCapableMobs[npcId][0] # prevent exploit which allows 2 players to simultaneously raise the same 0-growth beast # If the mob is at 0th level (when it still listens to all feeders) lock it to the first feeder! if (growthLevel == 0) and self.feedInfo.has_key(objectId): return else: self.feedInfo[objectId] = player.getObjectId() food = 0 if skillId == SKILL_GOLDEN_SPICE: food = GOLDEN_SPICE elif skillId == SKILL_CRYSTAL_SPICE: food = CRYSTAL_SPICE # display the social action of the beast eating the food. npc.broadcastPacket(SocialAction(objectId, 2)) # if this pet can't grow, it's all done. if npcId in self.growthCapableMobs.keys(): # do nothing if this mob doesn't eat the specified food (food gets consumed but has no effect). if len(self.growthCapableMobs[npcId][1][food]) == 0: return # rare random talk... if Rnd.get(20) == 0: npc.broadcastPacket( CreatureSay( objectId, 0, npc.getName(), self.Text[growthLevel][Rnd.get( len(self.Text[growthLevel]))])) if growthLevel > 0: # check if this is the same player as the one who raised it from growth 0. # if no, then do not allow a chance to raise the pet (food gets consumed but has no effect). if self.feedInfo[objectId] != player.getObjectId(): return # Polymorph the mob, with a certain chance, given its current growth level if Rnd.get(100) < self.growthCapableMobs[npcId][2]: self.spawnNext(npc, growthLevel, player, food) elif npcId in self.tamedBeasts: if skillId == npc.getFoodType(): npc.onReceiveFood() mytext = [ "Refills! Yeah!", "I am such a gluttonous beast, it is embarrassing! Ha ha", "Your cooperative feeling has been getting better and better.", "I will help you!", "The weather is really good. Wanna go for a picnic?", "I really like you! This is tasty...", "If you do not have to leave this place, then I can help you.", "What can I help you with?", "I am not here only for food!", "Yam, yam, yam, yam, yam!" ] npc.broadcastPacket( CreatureSay(objectId, 0, npc.getName(), mytext[Rnd.get(len(mytext))])) return