Esempio n. 1
0
 def onAttack(self, npc, player, damage, isPet):
     npcId = npc.getNpcId()
     objId = npc.getObjectId()
     if self.MobSpawns.has_key(npcId):
         if npc.getStatus().getCurrentHp() <= npc.getMaxHp(
         ) * self.MobSpawns[npcId]['HP'] / 100 and Rnd.get(
                 100) < self.MobSpawns[npcId]['chance']:
             if self.MobTexts.has_key(npcId):
                 text = self.MobTexts[npcId][Rnd.get(
                     len(self.MobTexts[npcId]))]
                 npc.broadcastPacket(
                     CreatureSay(objId, 0, npc.getName(), text))
             posX = npc.getX()
             posY = npc.getY()
             posZ = npc.getZ()
             signX = -500
             signY = -500
             if npc.getX() > player.getX():
                 signX = 500
             if npc.getY() > player.getY():
                 signY = 500
             posX = posX + signX
             posY = posY + signY
             npc.setIsAfraid(1)
             npc.setRunning()
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(posX, posY, posZ, 0))
             self.startQuestTimer("Retreat", 10000, npc, player)
     return
Esempio n. 2
0
 def onFirstTalk(self, npc, player):
     npcId = npc.getNpcId()
     if npcId == Doctor_Chaos:
         npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                  L2CharPosition(96323, -110914, -3328, 0))
         self.startQuestTimer("1", 3000, npc, player)
     return ""
Esempio n. 3
0
 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
Esempio n. 4
0
 def onAdvEvent(self, event, npc, player):
     st = player.getQuestState(qn)
     if not st: return
     htmltext = event
     if event == "31522-02.htm":
         st.setState(STARTED)
         st.playSound("ItemSound.quest_accept")
         st.set("cond", "1")
     elif event == "timer":
         htmltext = "31328-05.htm"
     elif event == "31328-05.htm":
         st.set("cond", "0")
         st.set("onlyone", "1")
         st.unset("AGRIPEL")
         st.unset("DOMINIC")
         st.unset("BENEDICT")
         st.setState(COMPLETED)
         st.takeItems(7140, -1)
         if st.getQuestItemsCount(7141) == 0:
             st.giveItems(7141, 1)
         st.playSound("ItemSound.quest_finish")
         st.startQuestTimer("timer", 1)
         htmltext = "Congratulations! You are completed this quest!"     + \
                    " \n The Quest \"Tragedy In Von Hellmann Forest\""   + \
                    " become available.\n Show Cross of Einhasad to High"+ \
                    " Priest Tifaren."
     elif event == "31523-03.htm":
         st.playSound("SkillSound5.horror_02")
         st.playSound("ItemSound.quest_middle")
         st.set("cond", "2")
         st.addSpawn(31524, 51432, -54570, -3136, 1800000)
     elif event == "31524-06.htm":
         st.set("cond", "3")
         st.playSound("ItemSound.quest_middle")
         ghost = self.addSpawn(31525, npc)
         self.startQuestTimer("1", 1, ghost, player)
         self.startQuestTimer("despawn", 1800000, ghost, player)
     elif event == "31526-03.htm":
         st.playSound("ItemSound.item_drop_equip_armor_cloth")
     elif event == "31526-08.htm":
         st.playSound("AmdSound.ed_chimes_05")
         st.set("cond", "5")
         st.playSound("ItemSound.quest_middle")
     elif event == "31526-14.htm":
         st.giveItems(7140, 1)
         st.set("cond", "6")
         st.playSound("ItemSound.quest_middle")
     elif event == "despawn":
         npc.deleteMe()
         htmltext = None
     elif event.isdigit():
         htmltext = None
         loc = int(event)
         x, y, z, heading = ROUTES[loc]
         if event == "1":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(x, y, z, heading))
             self.startQuestTimer("2", 5000, npc, player)
         elif event == "2":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(x, y, z, heading))
             self.startQuestTimer("3", 12000, npc, player)
         elif event == "3":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(x, y, z, heading))
             self.startQuestTimer("4", 15000, npc, player)
         elif event == "4":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(x, y, z, heading))
             self.startQuestTimer("5", 5000, npc, player)
         elif event == "5":
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
                                      L2CharPosition(x, y, z, heading))
     return htmltext
Esempio n. 5
0
 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