Exemple #1
0
 def onEvent(self, event, st):
     htmltext = event
     if event == "32264-02.htm":
         st.set("cond", "1")
         st.setState(State.STARTED)
         st.playSound("ItemSound.quest_accept")
     elif event == "32264-08.htm":
         st.giveItems(ECHO_CRYSTAL, 1)
         st.set("cond", "2")
         st.playSound("ItemSound.quest_middle")
     elif event == "32271-03.htm":
         st.set("cond", "3")
         st.giveItems(PARMES_LETTER, 1)
         st.playSound("ItemSound.quest_middle")
         x = Rnd.get(-100, 100)
         y = Rnd.get(-100, 100)
         st.getPlayer().teleToLocation(143472 + x, 191040 + y, -3696)
         st.getPlayer().setInstanceId(0)
     elif event == "32264-12.htm":
         if st.getQuestItemsCount(PARMES_LETTER):
             st.takeItems(PARMES_LETTER, 1)
         st.playSound("ItemSound.quest_middle")
     elif event == "32264-13.htm":
         st.takeItems(ECHO_CRYSTAL, 1)
         st.addExpAndSp(250677, 25019)
         st.playSound("ItemSound.quest_finish")
         st.exitQuest(False)
     return htmltext
Exemple #2
0
 def onKill(self,npc,player,isPet):
     npcId = npc.getId()
     if npcId == DAIMON :
        respawnMinDelay = 43200000  * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
        respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
        respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay)
        self.saveGlobalQuestVar("604_respawn", str(System.currentTimeMillis()+respawn_delay))
        self.startQuestTimer("spawn_npc", respawn_delay, None, None)
        self.cancelQuestTimer("Daimon the White-Eyed has despawned",npc,None)
        party = player.getParty()
        if party :
            PartyQuestMembers = []
            for player1 in party.getMembers().toArray() :
                st1 = player1.getQuestState(qn)
                if st1 :
                    if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) :
                        PartyQuestMembers.append(st1)
            if len(PartyQuestMembers) == 0 : return
            st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
            if st.getQuestItemsCount(S_SUMMON) > 0 :
                st.takeItems(S_SUMMON,1)
            st.giveItems(ESSENCE,1) 
            st.set("cond","3") 
            st.playSound("ItemSound.quest_middle")
        else :
            st = player.getQuestState(qn)
            if not st : return
            if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) :
                if st.getQuestItemsCount(S_SUMMON) > 0 :
                    st.takeItems(S_SUMMON,1)
                st.giveItems(ESSENCE,1) 
                st.set("cond","3") 
                st.playSound("ItemSound.quest_middle")
     return
Exemple #3
0
 def onKill(self,npc,player,isPet):
     npcId = npc.getNpcId()
     if npcId == DAIMON :
        respawnMinDelay = 43200000  * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
        respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
        respawn_delay = Rnd.get(respawnMinDelay,respawnMaxDelay)
        self.saveGlobalQuestVar("604_respawn", str(System.currentTimeMillis()+respawn_delay))
        self.startQuestTimer("spawn_npc", respawn_delay, None, None)
        self.cancelQuestTimer("Daimon the White-Eyed has despawned",npc,None)
        party = player.getParty()
        if party :
            PartyQuestMembers = []
            for player1 in party.getMembers().toArray() :
                st1 = player1.getQuestState(qn)
                if st1 :
                    if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2) :
                        PartyQuestMembers.append(st1)
            if len(PartyQuestMembers) == 0 : return
            st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
            if st.getQuestItemsCount(S_SUMMON) > 0 :
                st.takeItems(S_SUMMON,1)
            st.giveItems(ESSENCE,1) 
            st.set("cond","3") 
            st.playSound("ItemSound.quest_middle")
        else :
            st = player.getQuestState(qn)
            if not st : return
            if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2) :
                if st.getQuestItemsCount(S_SUMMON) > 0 :
                    st.takeItems(S_SUMMON,1)
                st.giveItems(ESSENCE,1) 
                st.set("cond","3") 
                st.playSound("ItemSound.quest_middle")
     return
Exemple #4
0
 def merge(self, player, item1OID, item2OID):
     inv = player.getInventory()
     item1 = inv.getItemByObjectId(int(item1OID))
     item2 = inv.getItemByObjectId(int(item2OID))
     if not self.check(player, item1, item2):
         return self.htm_header + "指定的道具出問題<BR>請確定道具能強化" + self.htm_footer
     if not self.removeRequirement(player):
         return self.htm_header + "需要金幣1個" + self.htm_footer
     item1enclvl = item1.getEnchantLevel()
     item2enclvl = item2.getEnchantLevel()
     enchant2 = item2.getEnchantLevel()
     inv.destroyItem(self.qn, item2, player, item2)
     if Rnd.get(100) > self.chance:
         self.updatePlayerInfo(player)
         return self.htm_header + "<font color=FF0000>合拼強化機率性失敗</font><BR>" + self.htm_select_part + self.htm_footer
     item1.setEnchantLevel(item1.getEnchantLevel() + Rnd.get(enchant2 + 1))
     item1.updateDatabase()
     player.sendPacket(EnchantResult(0, 0, 0))
     sm = SystemMessage.getSystemMessage(
         SystemMessageId.C1_SUCCESSFULY_ENCHANTED_A_S2_S3)
     sm.addCharName(player)
     sm.addNumber(item1.getEnchantLevel())
     sm.addItemName(item1)
     player.sendPacket(sm)
     self.updatePlayerInfo(player)
     return self.htm_header + "<font color=FFFF00>恭喜! 合拼強化成功 強化度由 +%d 變為 +%d</font><BR>" % (
         item1enclvl,
         item1.getEnchantLevel()) + self.htm_select_part + self.htm_footer
	def onKill(self, npc, player, isPet):
		id = npc.getNpcId()
		st = player.getQuestState("Leveling_System")
		if not st:
			st = self.newQuestState(player)
		if npc:
			if id == Keltas:
				HellboundManager.getInstance().increaseTrust(100)
				if HellboundManager.getInstance().getLevel() > 4: return
				if HellboundManager.getInstance().getLevel() == 3: respTime = (72 + Rnd.get(144)) * 100000 #between 2 and 4 hours respawn retail-like
				if HellboundManager.getInstance().getLevel() == 4: respTime = (288 + Rnd.get(576)) * 100000 #between 8 and 16 hours respawn retail-like
				self.startQuestTimer("keltasRespawn", respTime, None, None)
				for i in self.keltasmin:
					i.deleteMe()
			if id in self.hellboundMobs.keys():
				if HellboundManager.getInstance().getLevel() > 1: return
				HellboundManager.getInstance().increaseTrust(self.hellboundMobs[id]['points'])
			if id in self.hellboundMobs1.keys():
				HellboundManager.getInstance().increaseTrust(self.hellboundMobs1[id]['points'])
			if id == WLGuard:
				if HellboundManager.getInstance().getLevel() == 7:
					worldObjects = SpawnTable.getInstance().getSpawnTable().values()
					for i in worldObjects:
						if i.getNpcid() == WLGuard:
							i.stopRespawn()
Exemple #6
0
 def onEvent (self,event,st) :
   htmltext = event
   if event == "32264-02.htm" :
     st.set("cond", "1")
     st.setState(State.STARTED)
     st.playSound("ItemSound.quest_accept")
   elif event == "32264-08.htm" :
     st.giveItems(ECHO_CRYSTAL, 1)
     st.set("cond", "2")
     st.playSound("ItemSound.quest_middle")
   elif event == "32271-03.htm" :
     st.set("cond", "3")
     st.giveItems(PARMES_LETTER, 1)
     st.playSound("ItemSound.quest_middle")
     x = Rnd.get(-100, 100)
     y = Rnd.get(-100, 100)
     st.getPlayer().teleToLocation(143472 + x, 191040 + y, -3696)
     st.getPlayer().setInstanceId(0)
   elif event == "32264-12.htm" :
     if st.getQuestItemsCount(PARMES_LETTER) :
       st.takeItems(PARMES_LETTER, 1)
     st.playSound("ItemSound.quest_middle")
   elif event == "32264-13.htm" :
     st.takeItems(ECHO_CRYSTAL, 1)
     st.addExpAndSp(250677,25019)
     st.playSound("ItemSound.quest_finish")
     st.exitQuest(False)
   return htmltext
Exemple #7
0
	def merge(self, player, item1OID, item2OID):
		inv = player.getInventory()
		item1 = inv.getItemByObjectId(int(item1OID))
		item2 = inv.getItemByObjectId(int(item2OID))
		if not self.check(player, item1, item2):
			return self.htm_header + "指定的道具出問題<BR>請確定道具能強化" + self.htm_footer
		if not self.removeRequirement(player):
			return self.htm_header + "需要金幣1個" + self.htm_footer
		item1enclvl = item1.getEnchantLevel()
		item2enclvl = item2.getEnchantLevel()
		enchant2 = item2.getEnchantLevel()
		inv.destroyItem(self.qn, item2, player, item2)
		if Rnd.get(100) > self.chance:
			self.updatePlayerInfo(player)
			return self.htm_header + "<font color=FF0000>合拼強化機率性失敗</font><BR>" + self.htm_select_part + self.htm_footer
		item1.setEnchantLevel(item1.getEnchantLevel()+Rnd.get(enchant2+1))
		item1.updateDatabase()
		player.sendPacket(EnchantResult(0, 0, 0))
		sm = SystemMessage.getSystemMessage(SystemMessageId.C1_SUCCESSFULY_ENCHANTED_A_S2_S3);
		sm.addCharName(player)
		sm.addNumber(item1.getEnchantLevel())
		sm.addItemName(item1)
		player.sendPacket(sm)
		self.updatePlayerInfo(player)
		return self.htm_header + "<font color=FFFF00>恭喜! 合拼強化成功 強化度由 +%d 變為 +%d</font><BR>" % (item1enclvl, item1.getEnchantLevel()) + self.htm_select_part + self.htm_footer
 def onKill(self, npc, player, isPet):
     id = npc.getNpcId()
     st = player.getQuestState("Leveling_System")
     if not st:
         st = self.newQuestState(player)
     if npc:
         if id == Keltas:
             HellboundManager.getInstance().increaseTrust(100)
             if HellboundManager.getInstance().getLevel() > 4: return
             if HellboundManager.getInstance().getLevel() == 3:
                 respTime = (
                     72 + Rnd.get(144)
                 ) * 100000  #between 2 and 4 hours respawn retail-like
             if HellboundManager.getInstance().getLevel() == 4:
                 respTime = (
                     288 + Rnd.get(576)
                 ) * 100000  #between 8 and 16 hours respawn retail-like
             self.startQuestTimer("keltasRespawn", respTime, None, None)
             for i in self.keltasmin:
                 i.deleteMe()
         if id in self.hellboundMobs.keys():
             if HellboundManager.getInstance().getLevel() > 1: return
             HellboundManager.getInstance().increaseTrust(
                 self.hellboundMobs[id]['points'])
         if id in self.hellboundMobs1.keys():
             HellboundManager.getInstance().increaseTrust(
                 self.hellboundMobs1[id]['points'])
         if id == WLGuard:
             if HellboundManager.getInstance().getLevel() == 7:
                 #worldObjects = SpawnTable.getInstance().getSpawnTable().values()
                 worldObjects = SpawnTable.getInstance().getSpawnTable()
                 for i in worldObjects:
                     if i.getNpcid() == WLGuard:
                         i.stopRespawn()
Exemple #9
0
def runFloor(self, world, floor):
  world.status = floor
  world.FloorSt = {}
  world.FloorSt[floor] = PyObject()
  world.FloorSt[floor].npclist = {}
  if floor in [0,1,2,3,5,6,7,8] :
    i = MOBS[floor][0][1]
    x = FLOORS[floor][0]
    y = FLOORS[floor][1]
    z = FLOORS[floor][4]
    while i > 0 :
      rx = Rnd.get(FLOORS[floor][2])
      ry = Rnd.get(FLOORS[floor][3])
      newNpc = self.addSpawn(MOBS[floor][0][0], x+rx, y+ry, z, 0, False, 0, False, world.instanceId)
      world.FloorSt[floor].npclist[newNpc] = False
      i -= 1
  if floor in [2,3,6,7,8] :
    i = MOBS[floor][1][1]
    x = FLOORS[floor][0]
    y = FLOORS[floor][1]
    z = FLOORS[floor][4]
    while i > 0 :
      rx = Rnd.get(FLOORS[floor][2])
      ry = Rnd.get(FLOORS[floor][3])
      newNpc = self.addSpawn(MOBS[floor][1][0], x+rx, y+ry, z, 0, False, 0, False, world.instanceId)
      world.FloorSt[floor].npclist[newNpc] = False
      i -= 1
  if floor in [4,9] :
    newNpc = self.addSpawn(MOBS[floor][0][0],MOBS[floor][1][0],MOBS[floor][1][1],MOBS[floor][1][2], 0, False, 0, False, world.instanceId)
    world.FloorSt[floor].npclist[newNpc] = False
Exemple #10
0
 def onKill(self,npc,player,isPet):
   partyMember1 = self.getRandomPartyMember(player,"1")
   partyMember2 = self.getRandomPartyMemberState(player, State.COMPLETED)
   if not partyMember1 and not partyMember2 : return
   partyMember = partyMember1
   item,chance = DROPLIST[npc.getNpcId()]
   dropchance = Rnd.get(100)
   if dropchance  < chance:
    # player who has State.COMPLETED up to 2 out of 3 item collections may consume the party drop
    if partyMember2 :
      if Rnd.get(100) <= 66:
         return
      else :
         partyMember = partyMember1
    st = partyMember.getQuestState(qn)
    if st :
      if st.getState() == State.STARTED :
         count = st.getQuestItemsCount(item)
         if st.getInt("cond") == 1 and count < 100 :
            numItems, chance = divmod(chance*Config.RATE_QUEST_DROP,100)
            if dropchance  < chance:
               numItems += 1
            if count + numItems >= 100 :
              numItems = 100 - count
            if numItems != 0 :
              st.giveItems(item,int(numItems))
              if st.getQuestItemsCount(LEAF_OF_FLAVA) == st.getQuestItemsCount(BUFFALO_MEAT) == st.getQuestItemsCount(ANTELOPE_HORN) == 100 :
                 st.set("cond","2")
                 st.playSound("ItemSound.quest_middle")
              else :
                 st.playSound("ItemSound.quest_itemget")
   return
Exemple #11
0
def spawnRaid(self, world, raid) :
	if raid == 1 :
		spawnid = RAIDS1[Rnd.get(0, 2)]
	elif raid == 2 :
		spawnid = RAIDS2[Rnd.get(0, 3)]
	elif raid == 3 :
		spawnid = RAIDS3[Rnd.get(0, 2)]
	spawnedNpc = self.addSpawn(spawnid, 12161, -49144, -3000, 0, False, 0, False, world.instanceId)
Exemple #12
0
def spawnRaid(self, world, raid) :
	if raid == 1 :
		spawnid = RAIDS1[Rnd.get(0, 2)]
	elif raid == 2 :
		spawnid = RAIDS2[Rnd.get(0, 3)]
	elif raid == 3 :
		spawnid = RAIDS3[Rnd.get(0, 2)]
	spawnedNpc = self.addSpawn(spawnid, 12161, -49144, -3000, 0, False, 0, False, world.instanceId)
Exemple #13
0
 def myAddSpawn(self, npc, player, damage):  # npc 用作召喚位置, player 被仇恨的玩家
     n = self.addSpawn(self.NPCs[Rnd.get(len(self.NPCs))], npc, False)
     n.addDamageHate(player, 0, damage * 1000 / (player.getLevel() + 7))
     n.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
     npc.broadcastPacket(
         NpcSay(
             n.getObjectId(), 0, n.getNpcId(), self.npc_spawn_say[Rnd.get(
                 len(self.npc_spawn_say))].replace('%player_name%',
                                                   player.getName())))
	def onAttack(self, npc, player, damage, isPet, skill) :
		objId = npc.getObjectId()
		if self.FirstAttacked :
			if Rnd.get(4) : return
			npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "幾乎無人防守的後方是你的!"))
		else :
			self.FirstAttacked = True
			if Rnd.get(4) : return
			npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(),"我一定會回來!"))
		return
Exemple #15
0
	def onAdvEvent (self, event, npc, player) :
		if event == "CheckTrustP":
			if self.trustp >= 500000:
				HellboundManager.getInstance().changeLevel(11)
				self.trustp = 0
				self.saveGlobalQuestVar("trust10p", str(self.trustp))
				self.cancelQuestTimers("CheckTrustP")
		elif event == "keySpawn1" or event == "keySpawn2":
			self.startQuestTimer("keySpawn2", 300000, None, None)
			loc = LOCS[Rnd.get(len(LOCS))]
			self.keymaster.teleToLocation(loc[0],loc[1],loc[2])
			if event == "keySpawn1":
				self.startQuestTimer("keySpawn2", 300000, None, None)
			else:
				self.startQuestTimer("keySpawn1", 300000, None, None)
		elif event == "decayNpc":
			npc.decayMe()
		elif event == "NATIVESay":
			world = self.worlds[npc.getInstanceId()]
			npc.broadcastPacket(NpcSay(22450, 0, 22450, "我會...將...全部...打死...!"))
			npc.broadcastPacket(NpcSay(22450, 0, 22450, "我會...將...全部...打死...!"))
			npc.broadcastPacket(NpcSay(22450, 0, 22450, "我會...將...全部...打死...!"))
		elif event == "freeprisoner":
			world = self.worlds[npc.getInstanceId()]
			sayNpc = npc.getObjectId()
			npc.broadcastPacket(NpcSay(sayNpc, 0, npc.getNpcId(), "多謝幫助!看守者馬上就要來了快躲起來..."))
			self.startQuestTimer("decayNpc", 15000, npc, None)
			chance = Rnd.get(100)
			if chance <= 30:
				if not world.guardsSpawned:
					callGuards(self,npc,player,world)
					world.guardsSpawned = True
					npc.broadcastPacket(NpcSay(22359, 0, 22359, "發.現.入.侵.者...!"))
					hellboundLevel = HellboundManager.getInstance().getLevel()
					if hellboundLevel == 10:
						HellboundManager.getInstance().increaseTrust(50)
						self.trustp += 50
						self.saveGlobalQuestVar("trust10p", str(self.trustp))
		elif event == "key":
			world = self.worlds[npc.getInstanceId()]
			if not world.instanceFinished:
				key = player.getInventory().getItemByItemId(KEY);
				if key != None:
					world.instanceFinished = True
					player.destroyItemByItemId("Moonlight Stone", KEY, 1, player, True);
					instance = InstanceManager.getInstance().getInstance(npc.getInstanceId())
					if instance != None:
						instance.setDuration(30000)
						instance.setReturnTeleport(ReturnPort[dataIndex][0],ReturnPort[dataIndex][1],ReturnPort[dataIndex][2])
				else :
					return "32343-2.htm"
			else :
				return "32343-1.htm"
		return
 def onAttack(self, npc, player, damage, isPet, skill):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(4): return
         npc.broadcastPacket(
             NpcSay(objId, 0, npc.getNpcId(), "幾乎無人防守的後方是你的!"))
     else:
         self.FirstAttacked = True
         if Rnd.get(4): return
         npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "我一定會回來!"))
     return
Exemple #17
0
 def onAttack(self,npc,player,damage,isPet, skill):
   npcId = npc.getNpcId()
   NewMob,chance,NameNpc,NbMessage = MutationId[npcId]
   if Rnd.get(100) <= chance :
      if MutationId.has_key(npcId) :
         Msg = NpcMessage[NameNpc]
         npc.broadcastPacket(NpcSay(npc.getObjectId(),0,npc.getNpcId(),Msg[Rnd.get(NbMessage-1)]))
         npc.deleteMe()
         newNpc = self.addSpawn(NewMob,npc,)
         newNpc.addDamageHate(player,0,99999)
         newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player)
   return
	def onKill (self,npc,player,isPet):
		chance = Rnd.get(100)
		if chance <= 5:
			dropItem(npc,9422,1)
		elif chance >= 6 and chance <= 10:
			dropItem(npc,9429,1)
		elif chance >= 11 and chance <= 15:
			dropItem(npc,9438,1)
		elif chance >= 16 and chance <= 30:
			dropItem(npc,Rnd.get(9455,9457),1)
		elif chance >= 31 and chance <= 50:
			dropItem(npc,Rnd.get(6577,6578),2)
		return
Exemple #19
0
 def onKill(self, npc, player, isPet):
     chance = Rnd.get(100)
     if chance <= 5:
         dropItem(npc, 9422, 1)
     elif chance >= 6 and chance <= 10:
         dropItem(npc, 9429, 1)
     elif chance >= 11 and chance <= 15:
         dropItem(npc, 9438, 1)
     elif chance >= 16 and chance <= 30:
         dropItem(npc, Rnd.get(9455, 9457), 1)
     elif chance >= 31 and chance <= 50:
         dropItem(npc, Rnd.get(6577, 6578), 2)
     return
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     if npcId == Nastron:
         respawnMinDelay = 43200000 * int(
             Config.RAID_MIN_RESPAWN_MULTIPLIER)
         respawnMaxDelay = 129600000 * int(
             Config.RAID_MAX_RESPAWN_MULTIPLIER)
         respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay)
         self.saveGlobalQuestVar(
             "616_respawn", str(System.currentTimeMillis() + respawn_delay))
         self.startQuestTimer("spawn_npc", respawn_delay, None, None)
         self.cancelQuestTimer("Soul of Fire Nastron has despawned", npc,
                               None)
         party = player.getParty()
         if party:
             PartyQuestMembers = []
             for player1 in party.getPartyMembers().toArray():
                 st1 = player1.getQuestState(qn)
                 if st1:
                     if st1.getState() == State.STARTED and (
                             st1.getInt("cond") == 1
                             or st1.getInt("cond") == 2):
                         PartyQuestMembers.append(st1)
             if len(PartyQuestMembers) == 0: return
             st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
             if st.getQuestItemsCount(Totem2) > 0:
                 st.takeItems(Totem2, 1)
             st.giveItems(Fire_Heart, 1)
             st.set("cond", "3")
             st.set("id", "3")
             st.playSound("ItemSound.quest_middle")
         else:
             st = player.getQuestState(qn)
             if not st: return
             if st.getState() == State.STARTED and (
                     st.getInt("cond") == 1 or st.getInt("cond") == 2):
                 if st.getQuestItemsCount(Totem2) > 0:
                     st.takeItems(Totem2, 1)
                 st.giveItems(Fire_Heart, 1)
                 st.set("cond", "3")
                 st.set("id", "3")
                 st.playSound("ItemSound.quest_middle")
     elif npcId in Varka_Mobs:
         st = player.getQuestState(qn)
         if st:
             if st.getQuestItemsCount(Fire_Heart):
                 st.takeItems(Fire_Heart, -1)
             st.unset("cond")
             st.unset("id")
             st.exitQuest(1)
     return
Exemple #21
0
 def onAttack(self, npc, player, damage, isPet, skill):
   npdId = npc.getId()
   if (npc.getMaxHp()/2) > npc.getCurrentHp():
     if Rnd.get(100) < 4:
       if self.ImpGraveKepperStat == 1:
         for j in range(2):
           for k in range(2):
             self.addSpawn(27180,npc.getX()+70*pow(-1,j%2),npc.getY()+70*pow(-1,k%2),npc.getZ(),0,False,0)
         self.ImpGraveKepperStat = 2
       else:
         players = npc.getKnownList().getKnownPlayers().values().toArray()
         if len(players) :
           playerToTP = players[Rnd.get(int(len(players)))]
           playerToTP.teleToLocation(185462,20342,-3250)
   return
Exemple #22
0
 def onAttack(self, npc, player, damage, isPet, skill):
   npdId = npc.getNpcId()
   if (npc.getMaxHp()/2) > npc.getCurrentHp():
     if Rnd.get(100) < 4:
       if self.ImpGraveKepperStat == 1:
         for j in range(2):
           for k in range(2):
             self.addSpawn(27180,npc.getX()+70*pow(-1,j%2),npc.getY()+70*pow(-1,k%2),npc.getZ(),0,False,0)
         self.ImpGraveKepperStat = 2
       else:
         players = npc.getKnownList().getKnownPlayers().values().toArray()
         if len(players) :
           playerToTP = players[Rnd.get(int(len(players)))]
           playerToTP.teleToLocation(185462,20342,-3250)
   return
Exemple #23
0
	def onKill(self, npc, player, isPet) :
		npcId = npc.getNpcId()
		party = player.getParty()
		if party :
			PartyMembers = []
			for member in party.getPartyMembers().toArray() :
				st = member.getQuestState(qn)
				if st and st.getState() == State.STARTED and st.getInt("cond") == 1 :
					if npcId == CRIMSON_HATU and st.getQuestItemsCount(TISSUE_CH) == 0 :
						PartyMembers.append(st)
					elif npcId == TISSUE_SF and st.getQuestItemsCount(TISSUE_SF) == 0 :
						PartyMembers.append(st)
			if len(PartyMembers) == 0 : return
			winnerst = PartyMembers[Rnd.get(len(PartyMembers))]
			if npcId == CRIMSON_HATU and winnerst.getQuestItemsCount(TISSUE_CH) == 0 :
				winnerst.giveItems(TISSUE_CH,1)
				winnerst.playSound("ItemSound.quest_itemget")
			elif npcId == SEER_FLOUROS and winnerst.getQuestItemsCount(TISSUE_SF) == 0 :
				winnerst.giveItems(TISSUE_SF,1)
				winnerst.playSound("ItemSound.quest_itemget")
		else :
			st = player.getQuestState(qn)
			if not st : return
			if st.getState() != State.STARTED : return

			if npcId == CRIMSON_HATU and st.getQuestItemsCount(TISSUE_CH) == 0 :
				st.giveItems(TISSUE_CH,1)
				st.playSound("ItemSound.quest_itemget")
			elif npcId == SEER_FLOUROS and st.getQuestItemsCount(TISSUE_SF) == 0 :
				st.giveItems(TISSUE_SF,1)
				st.playSound("ItemSound.quest_itemget")
		return
 def generateBoard(self, player, bet):
     board = []
     num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     for i in range(9):
         board.append(num.pop(Rnd.get(1, len(num)) - 1))
     self.gameStatus[player.getName()] = [board, [], bet]
     return
Exemple #25
0
 def onKill(self, npc, player, isPet):
     world = self.getWorld(npc)
     if not isinstance(world, MyInstanceWorld):
         return
     if npc.getNpcId() == self.wave1mobid:
         world.wave1killed += 1
         if world.wave1killed >= self.killcountspawnstrongmob:
             x, y, z = self.wave2mobspawnloc[Rnd.get(
                 0,
                 len(self.wave2mobspawnloc) - 1)]
             x, y, z = self.getRandomXYZ(x, y, z, 100)
             n = self.spawnNpc(self.wave2mobid, x, y, z, 0,
                               world.instanceId)
             p = self.getRandomPlayer(world)
             self.addHate(world, n, p)
     if npc.getNpcId() == self.bossid:
         self.broadcastMessage(
             world.instanceId,
             "%s 殺死了 %s 副本成功" % (player.getName(), npc.getName()))
         self.broadcastScreenMessage(world.instanceId, "副本成功")
         InstanceManager.getInstance().getInstance(
             world.instanceId).setDuration(1000 * 60 * 5)
         x, y, z = self.entryLoc
         self.spawnNpc(self.NPCID, x, y, z, 0, world.instanceId)
         world.stage, world.step = 4, 0
Exemple #26
0
 def onAttack(self, npc, player, damage, isPet, skill):
     try:
         if player and player.getTransformationId() != 5:  # 劍齒虎變身 ID 5
             if Rnd.get(100) < spawn_rate:
                 self.myAddSpawn(npc, player, damage)
     except:
         pass
Exemple #27
0
 def onTalk (self,npc,player) :
  htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>"
  st = player.getQuestState(qn)
  if not st : return htmltext
  clan = player.getClan()
  npcId = npc.getNpcId()
  if player.getClan() == None or player.isClanLeader() == 0 :
     st.exitQuest(1)
     htmltext = "30868-0a.htm"
  elif player.getClan().getLevel() < 5 :
     st.exitQuest(1)
     htmltext =  "30868-0b.htm"
  else :
     cond = st.getInt("cond")
     raid = st.getInt("raid")
     id = st.getState()
     if id == State.CREATED and cond == 0 :
        htmltext =  "30868-0c.htm"
     elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys() :
        npc,item,min,max=REWARDS_LIST[raid]
        count = st.getQuestItemsCount(item)
        CLAN_POINTS_REWARD = Rnd.get(min, max)
        if not count :
           htmltext = "30868-"+str(raid)+"a.htm"
        elif count == 1 :
           htmltext = "30868-"+str(raid)+"b.htm"
           st.takeItems(item,1)
           clan.addReputationScore(CLAN_POINTS_REWARD,True)
           player.sendPacket(SystemMessage.getSystemMessage(1777).addNumber(CLAN_POINTS_REWARD))
           clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
  return htmltext
 def onAdvEvent(self, event, npc, player):
     if event == "levelCheckMeg":
         hellboundLevel = HellboundManager.getInstance().getLevel()
         if hellboundLevel > self.hellboundLevel and hellboundLevel == 6:
             self.hellboundLevel = 6
             megaliths = 6
             try:
                 megaliths = int(
                     self.loadGlobalQuestVar("megaliths_portals"))
             except:
                 pass
             self.saveGlobalQuestVar("megaliths_portals", str(megaliths))
             if megaliths <= 0:
                 HellboundManager.getInstance().setMegalithsCompleted(1)
                 for i in self.SpawnedMobs.keys():
                     for n in self.SpawnedMobs[i]:
                         n.stopRespawn()
             if self.hellboundLevel == 6:
                 self.cancelQuestTimers("levelCheckMeg")
                 xx2, yy2, zz2 = HellinarkSpawn
                 newHellinark = HellboundManager.getInstance().addSpawn(
                     Hellinark, xx2, yy2, zz2, 18000, 0)
                 if megaliths > 0:
                     for i in range(megaliths):
                         self.SpawnedMobs[i] = []
                         xx, yy, zz, headg = MegalithSpawnLocs[i]
                         respawnTime = (
                             Rnd.get(90, 180) * 1000
                         )  # between 90 seconds and 3 minutes
                         newMegalith = HellboundManager.getInstance(
                         ).addSpawn(Megalith, xx, yy, zz, headg,
                                    respawnTime)
                         self.SpawnedMobs[i].append(newMegalith)
Exemple #29
0
 def onTalk (self,npc,player) :
  htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>"
  st = player.getQuestState(qn)
  if not st : return htmltext
  clan = player.getClan()
  npcId = npc.getNpcId()
  if player.getClan() == None or player.isClanLeader() == 0 :
     st.exitQuest(1)
     htmltext = "31331-0a.htm"
  elif player.getClan().getLevel() < 6 :
     st.exitQuest(1)
     htmltext =  "31331-0b.htm"
  else :
     cond = st.getInt("cond")
     raid = st.getInt("raid")
     id = st.getState()
     if id == State.CREATED and cond == 0 :
        htmltext =  "31331-0c.htm"
     elif id == State.STARTED and cond == 1 and raid in REWARDS_LIST.keys() :
        npc,item,min,max=REWARDS_LIST[raid]
        count = st.getQuestItemsCount(item)
        CLAN_POINTS_REWARD = Rnd.get(min, max)
        if not count :
           htmltext = "31331-"+str(raid)+"a.htm"
        elif count == 1 :
           htmltext = "31331-"+str(raid)+"b.htm"
           st.takeItems(item,1)
           clan.addReputationScore(CLAN_POINTS_REWARD,True)
           player.sendPacket(SystemMessage.getSystemMessage(1777).addNumber(CLAN_POINTS_REWARD))
           clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan))
  return htmltext
Exemple #30
0
 def onAdvEvent(self, event, npc, player):
     htmltext = event
     st = player.getQuestState(qn)
     if not st:
         return
     if event == "30081-02.htm":
         st.set("cond", "1")
         st.playSound("ItemSound.quest_accept")
         condition = Rnd.get(1, 2)
         if condition == 1:
             st.set("cond", "2")
             htmltext = "30081-02a.htm"
             st.playSound("ItemSound.quest_accept")
         else:
             st.set("cond", "5")
             htmltext = "30081-02b.htm"
         st.setState(State.STARTED)
         st.playSound("ItemSound.quest_accept")
     elif event == "30511-03.htm":
         st.set("cond", "6")
         st.playSound("ItemSound.quest_middle")
     elif event == "31572-03.htm":
         st.set("cond", "3")
         st.playSound("ItemSound.quest_middle")
     elif event == "30081-05a.htm":
         st.takeItems(FishChest, 1)
         st.giveItems(WondrousCubic, 1)
         st.playSound("ItemSound.quest_finish")
         st.exitQuest(False)
     elif event == "30081-05b.htm":
         st.takeItems(SeedJar, 1)
         st.giveItems(WondrousCubic, 1)
         st.playSound("ItemSound.quest_finish")
         st.exitQuest(False)
     return htmltext
Exemple #31
0
	def onSpawn(self, npc):
		npcId = npc.getNpcId()
		objId = npc.getObjectId()
		if npcId == AMASKARI:
			self.Prisonslaves = []
			self.Slaves[objId] = []
			self.Slaves[objId].append("noSlaves")
			xx, yy, zz = npc.getX(), npc.getY(), npc.getZ()
			self.Slaves[objId] = []
			for i in range(9):
				offsetX = xx + (50 - Rnd.get(250))
				offsetY = yy + (50 - Rnd.get(250))
				newSlave = self.addSpawn(22450, offsetX, offsetY, zz, 0, False, 0, False, npc.getInstanceId())
				newSlave.setRunning()
				newSlave.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, npc)
				self.Slaves[objId].append(newSlave)
	def onKill(self, npc, player, isPet) :
		npcId = npc.getNpcId()
		party = player.getParty()
		if party :
			PartyMembers = []
			for member in party.getPartyMembers().toArray() :
				st = member.getQuestState(qn)
				if st and st.getState() == State.STARTED and st.getInt("cond") == 1 :
					if npcId == KAIM_ABIGORE and st.getQuestItemsCount(TISSUE_KA) == 0 :
						PartyMembers.append(st)
					elif npcId == TISSUE_KM and st.getQuestItemsCount(TISSUE_KM) == 0 :
						PartyMembers.append(st)
			if len(PartyMembers) == 0 : return
			winnerst = PartyMembers[Rnd.get(len(PartyMembers))]
			if npcId == KAIM_ABIGORE and winnerst.getQuestItemsCount(TISSUE_KA) == 0 :
				winnerst.giveItems(TISSUE_KA,1)
				winnerst.playSound("ItemSound.quest_itemget")
			elif npcId == KNIGHT_MONTAGNAR and winnerst.getQuestItemsCount(TISSUE_KM) == 0 :
				winnerst.giveItems(TISSUE_KM,1)
				winnerst.playSound("ItemSound.quest_itemget")
		else :
			st = player.getQuestState(qn)
			if not st : return
			if st.getState() != State.STARTED : return

			if npcId == KAIM_ABIGORE and st.getQuestItemsCount(TISSUE_KA) == 0 :
				st.giveItems(TISSUE_KA,1)
				st.playSound("ItemSound.quest_itemget")
			elif npcId == KNIGHT_MONTAGNAR and st.getQuestItemsCount(TISSUE_KM) == 0 :
				st.giveItems(TISSUE_KM,1)
				st.playSound("ItemSound.quest_itemget")
		return
Exemple #33
0
	def onAttack(self, npc, player, damage, isPet, skill):
		try:
			if player and player.getTransformationId() != 5: # 劍齒虎變身 ID 5
				if Rnd.get(100) < spawn_rate:
					self.myAddSpawn(npc, player, damage)
		except:
			pass
Exemple #34
0
 def onAdvEvent(self, event, npc, player):
     htmltext = event
     st = player.getQuestState(qn)
     if not st: return
     if event == "30081-02.htm":
         st.set("cond", "1")
         st.playSound("ItemSound.quest_accept")
         condition = Rnd.get(1, 2)
         if condition == 1:
             st.set("cond", "2")
             htmltext = "30081-02a.htm"
             st.playSound("ItemSound.quest_accept")
         else:
             st.set("cond", "5")
             htmltext = "30081-02b.htm"
         st.setState(State.STARTED)
         st.playSound("ItemSound.quest_accept")
     elif event == "30511-03.htm":
         st.set("cond", "6")
         st.playSound("ItemSound.quest_middle")
     elif event == "31572-03.htm":
         st.set("cond", "3")
         st.playSound("ItemSound.quest_middle")
     elif event == "30081-05a.htm":
         st.takeItems(FishChest, 1)
         st.giveItems(WondrousCubic, 1)
         st.playSound("ItemSound.quest_finish")
         st.exitQuest(False)
     elif event == "30081-05b.htm":
         st.takeItems(SeedJar, 1)
         st.giveItems(WondrousCubic, 1)
         st.playSound("ItemSound.quest_finish")
         st.exitQuest(False)
     return htmltext
 def generateBoard(self, player, bet):
     board = []
     num = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     for i in range(9):
         board.append(num.pop(Rnd.get(1, len(num)) - 1))
     self.gameStatus[player.getName()] = [board, [], bet]
     return
	def __init__(self, id, name, descr):
		JQuest.__init__(self, id, name, descr)
		self.SpawnedMobs = {}
		self.hellboundLevel = HellboundManager.getInstance().getLevel()
		if self.hellboundLevel < 6:
			self.startQuestTimer("levelCheckMeg", 60000, None, None, True)
		megaliths = 6
		try:
			megaliths = int(self.loadGlobalQuestVar("megaliths_portals"))
		except:
			pass
		self.saveGlobalQuestVar("megaliths_portals", str(megaliths))
		if megaliths <= 0:
			HellboundManager.getInstance().setMegalithsCompleted(1)
		if self.hellboundLevel == 6:
			# spawn the megaliths and hellinark
			xx2, yy2, zz2 = HellinarkSpawn
			newHellinark = HellboundManager.getInstance().addSpawn(Hellinark, xx2, yy2, zz2, 5000, 0)
			if megaliths > 0:
				for i in range(megaliths):
					self.SpawnedMobs[i] = []
					xx, yy, zz, headg = MegalithSpawnLocs[i]
					respawnTime = Rnd.get(90, 180) # between 90 seconds and 3 minutes
					newMegalith = HellboundManager.getInstance().addSpawn(Megalith, xx, yy, zz, headg, respawnTime)
					self.SpawnedMobs[i].append(newMegalith)
Exemple #37
0
 def onAdvEvent(self, event, npc, player):
     htmltext = event
     st = player.getQuestState(qn)
     if not st: return
     if event == "32017-03.htm":
         if st.getPlayer().getLevel() < 80:
             htmltext = "32017-02.htm"
             st.exitQuest(1)
         else:
             st.set("cond", "1")
             st.setState(State.STARTED)
             st.playSound("ItemSound.quest_accept")
     elif event in REWARDS.keys():
         qty, item = REWARDS[event]
         if st.getQuestItemsCount(CURSED_BURIAL) >= qty:
             st.takeItems(CURSED_BURIAL, qty)
             if len(item) > 1:
                 itemId = item[Rnd.get(len(item))]
             else:
                 itemId = item[0]
             st.rewardItems(itemId, 1)
             htmltext = "32017-05c.htm"
         else:
             htmltext = "32017-07.htm"
     elif event == "32017-08.htm":
         st.exitQuest(1)
     return htmltext
	def onAdvEvent(self, event, npc, player) :
		if event == "levelCheckMeg":
			hellboundLevel = HellboundManager.getInstance().getLevel()
			if hellboundLevel > self.hellboundLevel and hellboundLevel == 6:
				self.hellboundLevel = 6
				megaliths = 6
				try:
					megaliths = int(self.loadGlobalQuestVar("megaliths_portals"))
				except:
					pass
				self.saveGlobalQuestVar("megaliths_portals", str(megaliths))
				if megaliths <= 0:
					HellboundManager.getInstance().setMegalithsCompleted(1)
					for i in self.SpawnedMobs.keys():
						for n in self.SpawnedMobs[i]:
							n.stopRespawn()
				if self.hellboundLevel == 6:
					self.cancelQuestTimers("levelCheckMeg")
					xx2, yy2, zz2 = HellinarkSpawn
					newHellinark = HellboundManager.getInstance().addSpawn(Hellinark, xx2, yy2, zz2, 18000, 0)
					if megaliths > 0:
						for i in range(megaliths):
							self.SpawnedMobs[i] = []
							xx, yy, zz, headg = MegalithSpawnLocs[i]
							respawnTime = (Rnd.get(90, 180) * 1000) # between 90 seconds and 3 minutes
							newMegalith = HellboundManager.getInstance().addSpawn(Megalith, xx, yy, zz, headg, respawnTime)
							self.SpawnedMobs[i].append(newMegalith)
Exemple #39
0
    def onKill(self, npc, player, isPet):
        npcId = npc.getNpcId()
        party = player.getParty()
        if party:
            PartyMembers = []
            for member in party.getPartyMembers().toArray():
                st = member.getQuestState(qn)
                if st and st.getState() == State.STARTED and st.getInt(
                        "cond") == 1:
                    if npcId == WHITE_ALLOSCE and st.getQuestItemsCount(
                            TISSUE_WA) == 0:
                        PartyMembers.append(st)
            if len(PartyMembers) == 0: return
            winnerst = PartyMembers[Rnd.get(len(PartyMembers))]
            if npcId == WHITE_ALLOSCE and winnerst.getQuestItemsCount(
                    TISSUE_WA) == 0:
                winnerst.giveItems(TISSUE_WA, 1)
                winnerst.playSound("ItemSound.quest_itemget")
        else:
            st = player.getQuestState(qn)
            if not st: return
            if st.getState() != State.STARTED: return

            if npcId == WHITE_ALLOSCE and st.getQuestItemsCount(
                    TISSUE_WA) == 0:
                st.giveItems(TISSUE_WA, 1)
                st.playSound("ItemSound.quest_itemget")
        return
Exemple #40
0
    def onKill(self, npc, player, isPet):
        partyMember1 = self.getRandomPartyMember(player, "1")
        partyMember2 = self.getRandomPartyMember(player, "2")
        partyMember = partyMember1  # initialize
        if not partyMember1 and not partyMember2:
            return
        elif not partyMember2:
            partyMember = partyMember1
        elif not partyMember1:
            partyMember = partyMember2
        else:
            if Rnd.get(2):
                partyMember = partyMember2

        if not partyMember:
            return
        st = partyMember.getQuestState(qn)
        if not st:
            return
        if st.getState() != State.STARTED:
            return
        count = st.getQuestItemsCount(ROUGH_JEWEL)
        if count < 10:
            st.giveItems(ROUGH_JEWEL, 1)
            if count == 9:
                st.playSound("ItemSound.quest_middle")
                st.set("cond", "3")
            else:
                st.playSound("ItemSound.quest_itemget")
        return
Exemple #41
0
 def onAdvEvent (self,event,npc, player) :
   htmltext = event
   st = player.getQuestState(qn)
   if not st : return
   if event == "32017-03.htm" :
      if st.getPlayer().getLevel() < 80 :
         htmltext = "32017-02.htm"
         st.exitQuest(1)
      else :
         st.set("cond","1")
         st.setState(State.STARTED)
         st.playSound("ItemSound.quest_accept")
   elif event in REWARDS.keys() :
      qty,item = REWARDS[event]
      if st.getQuestItemsCount(CURSED_BURIAL) >= qty :
         st.takeItems(CURSED_BURIAL,qty)
         if len(item) > 1 :
            itemId = item[Rnd.get(len(item))]
         else :
            itemId = item[0]
         st.rewardItems(itemId,1)
         htmltext = "32017-05c.htm"
      else :
         htmltext = "32017-07.htm"
   elif event == "32017-08.htm" :
      st.exitQuest(1)
   return htmltext
 def __init__(self, id, name, descr):
     JQuest.__init__(self, id, name, descr)
     self.SpawnedMobs = {}
     self.hellboundLevel = HellboundManager.getInstance().getLevel()
     if self.hellboundLevel < 6:
         self.startQuestTimer("levelCheckMeg", 60000, None, None, True)
     megaliths = 6
     try:
         megaliths = int(self.loadGlobalQuestVar("megaliths_portals"))
     except:
         pass
     self.saveGlobalQuestVar("megaliths_portals", str(megaliths))
     if megaliths <= 0:
         HellboundManager.getInstance().setMegalithsCompleted(1)
     if self.hellboundLevel == 6:
         # spawn the megaliths and hellinark
         xx2, yy2, zz2 = HellinarkSpawn
         newHellinark = HellboundManager.getInstance().addSpawn(
             Hellinark, xx2, yy2, zz2, 5000, 0)
         if megaliths > 0:
             for i in range(megaliths):
                 self.SpawnedMobs[i] = []
                 xx, yy, zz, headg = MegalithSpawnLocs[i]
                 respawnTime = Rnd.get(
                     90, 180)  # between 90 seconds and 3 minutes
                 newMegalith = HellboundManager.getInstance().addSpawn(
                     Megalith, xx, yy, zz, headg, respawnTime)
                 self.SpawnedMobs[i].append(newMegalith)
	def __init__(self, id = qID, name = qn, descr = qDesc):
		self.qID, self.qn, self.qDesc = id, name, descr
		JQuest.__init__(self, id, name, descr)
		for npcid in selfTalkData:
			delay = Rnd.get(15, 25)
			self.startQuestTimer("say_%d_%d" % (npcid, 0), 1000 * delay, None, None, False)
		print "%s loaded" % self.qn
	def onKill(self, npc, player, isPet) :
		npcId = npc.getNpcId()
		party = player.getParty()
		if party :
			PartyMembers = []
			for member in party.getPartyMembers().toArray() :
				st = member.getQuestState(qn)
				if st and st.getState() == State.STARTED and st.getInt("cond") == 1 :
					if npcId == BLADE_OTIS and st.getQuestItemsCount(TISSUE_BO) == 0 :
						PartyMembers.append(st)
					elif npcId == TISSUE_WB and st.getQuestItemsCount(TISSUE_WB) == 0 :
						PartyMembers.append(st)
			if len(PartyMembers) == 0 : return
			winnerst = PartyMembers[Rnd.get(len(PartyMembers))]
			if npcId == BLADE_OTIS and winnerst.getQuestItemsCount(TISSUE_BO) == 0 :
				winnerst.giveItems(TISSUE_BO,1)
				winnerst.playSound("ItemSound.quest_itemget")
			elif npcId == WEIRD_BUNEI and winnerst.getQuestItemsCount(TISSUE_WB) == 0 :
				winnerst.giveItems(TISSUE_WB,1)
				winnerst.playSound("ItemSound.quest_itemget")
		else :
			st = player.getQuestState(qn)
			if not st : return
			if st.getState() != State.STARTED : return

			if npcId == BLADE_OTIS and st.getQuestItemsCount(TISSUE_BO) == 0 :
				st.giveItems(TISSUE_BO,1)
				st.playSound("ItemSound.quest_itemget")
			elif npcId == WEIRD_BUNEI and st.getQuestItemsCount(TISSUE_WB) == 0 :
				st.giveItems(TISSUE_WB,1)
				st.playSound("ItemSound.quest_itemget")
		return
Exemple #45
0
 def __init__(self, id=qID, name=qn, descr=qDesc):
     self.qID, self.qn, self.qDesc = id, name, descr
     JQuest.__init__(self, id, name, descr)
     for npcid in selfTalkData:
         delay = Rnd.get(15, 25)
         self.startQuestTimer("say_%d_%d" % (npcid, 0), 1000 * delay, None,
                              None, False)
     print "%s loaded" % self.qn
Exemple #46
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getNpcId()
     if npcId == Ashutar:
         respawnMinDelay = 43200000 * int(Config.RAID_MIN_RESPAWN_MULTIPLIER)
         respawnMaxDelay = 129600000 * int(Config.RAID_MAX_RESPAWN_MULTIPLIER)
         respawn_delay = Rnd.get(respawnMinDelay, respawnMaxDelay)
         self.saveGlobalQuestVar("610_respawn", str(System.currentTimeMillis() + respawn_delay))
         self.startQuestTimer("spawn_npc", respawn_delay, None, None)
         self.cancelQuestTimer("Soul of Water Ashutar has despawned", npc, None)
         party = player.getParty()
         if party:
             PartyQuestMembers = []
             for player1 in party.getPartyMembers().toArray():
                 st1 = player1.getQuestState(qn)
                 if st1:
                     if st1.getState() == State.STARTED and (st1.getInt("cond") == 1 or st1.getInt("cond") == 2):
                         PartyQuestMembers.append(st1)
             if len(PartyQuestMembers) == 0:
                 return
             st = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
             if st.getQuestItemsCount(Totem2) > 0:
                 st.takeItems(Totem2, 1)
             st.giveItems(Ice_Heart, 1)
             st.set("cond", "3")
             st.set("id", "3")
             st.playSound("ItemSound.quest_middle")
         else:
             st = player.getQuestState(qn)
             if not st:
                 return
             if st.getState() == State.STARTED and (st.getInt("cond") == 1 or st.getInt("cond") == 2):
                 if st.getQuestItemsCount(Totem2) > 0:
                     st.takeItems(Totem2, 1)
                 st.giveItems(Ice_Heart, 1)
                 st.set("cond", "3")
                 st.set("id", "3")
                 st.playSound("ItemSound.quest_middle")
     elif npcId in Ketra_Orcs:
         st = player.getQuestState(qn)
         if st:
             if st.getQuestItemsCount(Ice_Heart):
                 st.takeItems(Ice_Heart, -1)
             st.unset("cond")
             st.unset("id")
             st.exitQuest(1)
     return
 def onAttack(self, npc, player, damage, isPet, skill) :
   objId = npc.getObjectId()
   if self.FirstAttacked :
      if Rnd.get(50) : return
      npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "Brother " + player.getName() + ", move your weapon away!!"))
   else :
      self.FirstAttacked = True
   return
 def onKill(self,npc,player,isPet) :
     st = player.getQuestState(qn)
     if not st : return
     npcId = npc.getNpcId()
     if npcId in Droplist.keys() :
         if Rnd.get(100) < Droplist[npcId] :
             st.giveItems(Medal,1)
             st.playSound("ItemSound.quest_itemget")
     return
	def onSpawn(self, npc):
		npcId = npc.getNpcId()
		objId = npc.getObjectId()
		hellboundLevel = HellboundManager.getInstance().getLevel()
		if npcId in SlaveMasters:
			self.Slaves[objId] = []
			self.Slaves[objId].append("noSlaves")
			if int(hellboundLevel) >= 5:return
			xx, yy, zz = npc.getX(), npc.getY(), npc.getZ()
			self.Slaves[objId] = []
			offsetX = xx + (50 - Rnd.get(100))
			offsetY = yy + (50 - Rnd.get(100))
			newSlave = self.addSpawn(NativeSlave[0], offsetX, offsetY, zz, 0, False, 0, 0)
			newSlave1 = self.addSpawn(NativeSlave[1], offsetX + 20, offsetY + 10, zz, 0, False, 0, 0)
			newSlave.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, npc)
			newSlave1.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, npc)
			self.Slaves[objId].append(newSlave)
			self.Slaves[objId].append(newSlave1)
Exemple #50
0
	def onSpawn(self, npc):
		npcId = npc.getNpcId()
		objId = npc.getObjectId()
		hellboundLevel = HellboundManager.getInstance().getLevel()
		if npcId in SlaveMasters:
			self.Slaves[objId] = []
			self.Slaves[objId].append("noSlaves")
			if int(hellboundLevel) >= 5:return
			xx, yy, zz = npc.getX(), npc.getY(), npc.getZ()
			self.Slaves[objId] = []
			offsetX = xx + (50 - Rnd.get(100))
			offsetY = yy + (50 - Rnd.get(100))
			newSlave = self.addSpawn(NativeSlave[0], offsetX, offsetY, zz, 0, False, 0, 0)
			newSlave1 = self.addSpawn(NativeSlave[1], offsetX + 20, offsetY + 10, zz, 0, False, 0, 0)
			newSlave.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, npc)
			newSlave1.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, npc)
			self.Slaves[objId].append(newSlave)
			self.Slaves[objId].append(newSlave1)
 def onKill(self, npc, player, isPet):
     st = player.getQuestState(qn)
     if not st: return
     npcId = npc.getId()
     if npcId in Droplist.keys():
         if Rnd.get(100) < Droplist[npcId]:
             st.giveItems(Medal, 1)
             st.playSound("ItemSound.quest_itemget")
     return
Exemple #52
0
 def addHate(self, world, npc, target):
     try:
         if target and L2World.getInstance().findObject(target.getObjectId()):
             npc.setTarget(target)
             # npc.getKnownList().addKnownObject(target)
             npc.addDamageHate(target, 0, Rnd.get(100, 999))
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK)
     except:
         pass
Exemple #53
0
	def onTalk(self, npc, player):
		npcId = npc.getNpcId()
		st = player.getQuestState(qn)
		if not st :
			st = self.newQuestState(player)
		hellboundLevel = HellboundManager.getInstance().getLevel()
		if hellboundLevel < 10: return "<html><body>卡納夫:<br>你是誰?...<br>快滾開,我不想和你說話!</body></html>"
		if npcId == KANAF :
			party = player.getParty()
			if not party:
				return "32346-0.htm"
			if not checkCondition(player):
				return
			else :
				tele = PyObject()
				tele.x = 14205
				tele.y = 255451
				tele.z = -2025
				instanceId = getExistingInstanceId(player)
				if instanceId == 0:
					instanceId = InstanceManager.getInstance().createDynamicInstance("HBTown.xml")
					if not self.worlds.has_key(instanceId):
						world = PyObject()
						world.rewarded=[]
						world.instanceId = instanceId
						world.instanceFinished = False
						world.guardsSpawned = False
						self.worlds[instanceId] = world
						self.world_ids.append(instanceId)
						self.currentWorld = instanceId
						print "地獄舊市區:使用即時地區:" +str(instanceId) + " 創造玩家:" + str(player.getName())
						KLOC = KLOCS[Rnd.get(len(KLOCS))]
						newKeymaster = self.addSpawn(KEYMASTER,KLOC[0],KLOC[1],KLOC[2],KLOC[3],False,0,False,world.instanceId)
						self.keymaster = newKeymaster
						self.keymasterattacked = False
						newAmaskari = self.addSpawn(AMASKARI,19496,253125,-2030,0,False,0,False,world.instanceId)
						self.amaskari = newAmaskari
						self.amaskariattacked = False
						tele.instanceId = instanceId
						teleportPlayer(self,player,tele)
						party = player.getParty()
						if party != None:
							for partyMember in party.getPartyMembers().toArray():
								teleportPlayer(self,partyMember,tele)
				else:
					for worldid in self.world_ids:
						if worldid == instanceId:
							foundworld = True
						if not worldid == instanceId:
							foundworld = False
					if not foundworld:
						player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。"))
						return
					tele.instanceId = instanceId
					teleportPlayer(self,player,tele)
		return
Exemple #54
0
 def addHate(self, world, npc, target):
     try:
         if target and L2World.getInstance().findObject(
                 target.getObjectId()):
             npc.setTarget(target)
             #npc.getKnownList().addKnownObject(target)
             npc.addDamageHate(target, 0, Rnd.get(100, 999))
             npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK)
     except:
         pass
Exemple #55
0
 def onKill(self, npc, player, isPet):
     npcId = npc.getId()
     # the chests always spawn, even if the RB is killed with nobody nearby doing the quest.
     if npcId in CHEST_SPAWNS.keys():
         self.addSpawn(CHEST_SPAWNS[npcId], npc.getX(), npc.getY(),
                       npc.getZ(), npc.getHeading(), True, 60000)
     else:
         value, dropId, chance = DROPLIST[npcId]
         if chance > 0 and Rnd.get(100) < chance:
             party = player.getParty()
             if party:
                 PartyQuestMembers = []
                 for partyMember in party.getMembers().toArray():
                     if partyMember.isInsideRadius(player, 1500, True,
                                                   False):
                         pst = partyMember.getQuestState(qn)
                         if pst:
                             if pst.getInt(
                                     "cond"
                             ) == 8 and pst.getQuestItemsCount(dropId) < 30:
                                 PartyQuestMembers.append(pst)
                 if len(PartyQuestMembers) == 0: return
                 stw = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
                 stw.giveItems(dropId, 1)
                 stw.takeItems(WHITE_CLOTH, 1)
                 stw.playSound("ItemSound.quest_itemget")
                 if stw.getQuestItemsCount(dropId) >= 30:
                     stw.set("cond", "9")
             else:
                 st = player.getQuestState(qn)
                 if not st: return
                 if st.getState() != State.STARTED: return
                 if npcId in DROPLIST.keys():
                     if st.getInt("cond") == value:
                         if value == 8 and st.getQuestItemsCount(
                                 dropId) < 30:
                             st.giveItems(dropId, 1)
                             st.takeItems(WHITE_CLOTH, 1)
                             st.playSound("ItemSound.quest_itemget")
                             if st.getQuestItemsCount(dropId) >= 30:
                                 st.set("cond", "9")
     return
Exemple #56
0
 def onAttack(self, npc, player, damage, isPet, skill):
     objId = npc.getObjectId()
     if self.FirstAttacked:
         if Rnd.get(50): return
         npc.broadcastPacket(
             NpcSay(
                 objId, 0, npc.getNpcId(), "Brother " + player.getName() +
                 ", move your weapon away!!"))
     else:
         self.FirstAttacked = True
     return