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 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)
 def __init__(self, id, name, descr):
     JQuest.__init__(self, id, name, descr)
     self.captainState = 0
     hellboundLevel = HellboundManager.getInstance().getLevel()
     if hellboundLevel != 8:
         return
     xx, yy, zz = CaptainLoc
     newCaptain = HellboundManager.getInstance().addSpawn(Captain, xx, yy, zz, 36561, 0)
Beispiel #4
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 onKill(self, npc, player, isPet):
		hellboundLevel = HellboundManager.getInstance().getLevel()
		if hellboundLevel != 6: return
		id = npc.getNpcId()
		objId = npc.getObjectId()
		if id == Hellinark:
			HellboundManager.getInstance().increaseTrust(10000)
			HellboundManager.getInstance().changeLevel(7)
			HellboundManager.getInstance().setMegalithsCompleted(1)
			return
		#if id in MegalithMinions:
		if id == Megalith:
			delNum = 4000
			mobsKilled = 0
			try:
				#### add the mobs to the leveling system(points)
				mobsKilled = int(self.loadGlobalQuestVar("megaliths_killed"))
			except:
				pass
			mobsKilled += 1
			if mobsKilled >= 500:
				mobsKilled = 0
				# actual number saved will be 1++, when in the array it will be 0++
				megaliths = int(self.loadGlobalQuestVar("megaliths_portals"))
				delNum = megaliths - 1
				for i in self.SpawnedMobs[delNum]:
					i.stopRespawn()
				megaliths = megaliths - 1
				if megaliths < 0:
					return
				self.saveGlobalQuestVar("megaliths_portals", str(megaliths))
			megalithCompleted = HellboundManager.getInstance().checkMegalithsCompleted()
			if megalithCompleted : return
			self.saveGlobalQuestVar("megaliths_killed", str(mobsKilled))
Beispiel #6
0
  def onTalk (self,npc,player):
    npcId = npc.getNpcId()
    hellboundLevel = HellboundManager.getInstance().getLevel()
    if hellboundLevel <= 10: return "<html><body>塞良:<br>你的實力不適合進去與敵人抗爭,待敵人的實力變弱的時候再來吧。</body></html>"
    if npcId == 32302 :
      if not player.getFirstEffect(2357):
        return "<html><body>塞良:<br>將惡魔溫熱的血液噴灑在全身....!</body></html>"
#        if content:
#            content = content.replace("%objectId%", str(player.getTarget().getObjectId()))
#            npcReply = NpcHtmlMessage(5)
#            npcReply.setHtml(content)
#            npcReply.replace("%playername%", player.getName())
#            player.sendPacket(npcReply);
#        return
      tele = PyObject()
      tele.x = -19645
      tele.y = 277528
      tele.z = -15048
      instanceId = enterInstance(self, player, "Infinitum.xml", tele)
      if not instanceId :
        return
      if instanceId == 0 :
        return
    if self.worlds.has_key(npc.getInstanceId()) :
      world = self.worlds[npc.getInstanceId()]
    return
	def __init__(self, id, name, descr):
		JQuest.__init__(self, id, name, descr)
		self.Slaves = {}
		self.startQuestTimer("SpawnSlaves", 10000, None, None)
		self.rescued = 0
		try:
			self.rescued = int(self.loadGlobalQuestVar("rescued_slaves"))
		except:
			pass
		self.saveGlobalQuestVar("rescued_slaves", str(self.rescued))
		if HellboundManager.getInstance().getLevel() > 5: return
		for i in range(17):
			master, xx, yy, zz, headg = QuarryMastersSpawns[i]
			newMaster = HellboundManager.getInstance().addSpawn(master, xx, yy, zz, headg, 170)
		for i in range(31):
			xx, yy, zz, headg = QuarrySlavesSpawns[i]
			newSlave = HellboundManager.getInstance().addSpawn(QuarrySlave, xx, yy, zz, headg, 170)
	def onAdvEvent (self, event, npc, player) :
		if event == "levelCheck":
			hellboundLevel = HellboundManager.getInstance().getLevel()
			if hellboundLevel == 5 and self.hellboundLevel < hellboundLevel:
				self.hellboundLevel = hellboundLevel
				changeNativeSpawn(1, self.corpses, self)
			else:
				self.startQuestTimer("levelCheck", 30000, None, None)
Beispiel #9
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
	def __init__(self, id, name, descr):
		JQuest.__init__(self, id, name, descr)
		hellboundLevel = HellboundManager.getInstance().getLevel()
		self.hellboundLevel = hellboundLevel
		self.corpses = []
		# if the level of hellbound is below level 5, this replaces
		# the natives with native corpses
		if hellboundLevel < 5:
			self.startQuestTimer("levelCheck", 30000, None, None)
			self.corpses = changeNativeSpawn(0, None, self)
	def onFirstTalk (self, npc, player):
		npcId = npc.getNpcId()
		hellboundLevel = HellboundManager.getInstance().getLevel()
		if npcId == Insurgents:
			if hellboundLevel <= 5: return "<html><body>地獄邊界反抗軍:<br>我們的同胞很難存活,現在他們遭受的創傷和食品短缺。我們需要幫助!</body></html>"
			if hellboundLevel > 5: return "<html><body>地獄邊界反抗軍:<br>感謝您的幫忙。<br>我十分瞭解同胞們的憤慨,但我們的力量微弱到還不足以面對鋼鐵之城。但是這微不足道的力量若能在擊倒惡魔時幫得上忙,那我們樂於效勞。</body></html>"
		if npcId == Natives:
			if hellboundLevel <= 5: return "<html><body>地獄邊界原住民:<br>呃...呃...吃的...給點吃的吧...</body></html>"
			if hellboundLevel > 5: return "<html><body>地獄邊界原住民:<br>歡迎你們!<br>多虧你們好不容易才能從吝嗇的那些商隊得到足夠的糧食,總算可以放心了。現在我們得同心協力,讓鋼鐵之城的那些傢伙瞧瞧我們的厲害!</body></html>"
		return
	def onKill(self, npc, player, isPet):
		id = npc.getNpcId()
		objId = npc.getObjectId()
		xx, yy, zz = SlaveWalkTo
		if id in SlaveMasters:
			try:
				if self.Slaves[objId][0] != "noSlaves":
					for i in self.Slaves[objId]:
						try:
							i.setIsInvul(1)
							i.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, L2CharPosition(xx, yy, zz, 3500))
							timerName = "Delete" + str(i.getObjectId())
							self.startQuestTimer(timerName, 3000, i, None)
						except:
							pass
					self.Slaves[objId] = []
			except:
				pass
		if id == QuarrySlave:
			HellboundManager.getInstance().increaseTrust(-10)
			self.rescued -= 1
			self.saveGlobalQuestVar("rescued_Slaves", str(self.rescued))
	def onFirstTalk (self, npc, player):
		st = player.getQuestState("Native_Quarry_Slaves")
		hellboundLevel = HellboundManager.getInstance().getLevel()
		if not st:
			st = self.newQuestState(player)
		npcId = npc.getNpcId()
		if npcId == QuarrySlave:
			if hellboundLevel != 5: return "<html><body>採石場奴隸:<br>是來救我們的人嗎?求求你,救救我們吧!!!<br><a action=\"bypass -h Quest\">任務</a></body></html>"
			else:
				htmltext = "<html><body>採石場奴隸:<br>"
				htmltext += "誰...誰?<br><br>"
				htmltext += "<a action=\"bypass -h Quest Native_Quarry_Slaves FollowMe\">說跟著我走吧</a>"
				htmltext += "</body></html>"
		return htmltext
def changeBoxesSpawnState(booleanValue):
	worldObjects = SpawnTable.getInstance().getSpawnTable().values()
	for i in worldObjects:
		npcId = i.getNpcid()
		if npcId == 32361:  # 商隊支援糧食
			xx, yy, zz = i.getLocx(), i.getLocy(), i.getLocz()
			if booleanValue == 0:
				i.stopRespawn()
				curNpc = i.getLastSpawn()
				curNpc.onDecay()
			if booleanValue == 1:
				respTime = i.getRespawnDelay()
				headg = i.getHeading()
				newNpc = HellboundManager.getInstance().addSpawn(npcId, xx, yy, zz, headg, respTime)
				return
Beispiel #15
0
	def __init__(self, id, name, descr):
		JQuest.__init__(self, id, name, descr)
		self.worlds = {}
		self.world_ids = []
		self.Slaves = {}
		self.currentWorld = 0
		self.Lock = 0
		self.NATIVELock = 0
		self.hellboundLevel = 0
		self.trustp = 0
		try:
			self.trustp = int(self.loadGlobalQuestVar("trust10p"))
		except:
			pass
		self.saveGlobalQuestVar("trust10p", str(self.trustp))
		if HellboundManager.getInstance().getLevel() == 10: self.startQuestTimer("CheckTrustP", 60000, None, None, True)
	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)
Beispiel #17
0
	def onTalk (self,npc,player):
		htmltext = "<html><body>目前沒有執行任務,或條件不符合。</body></html>"
		st = player.getQuestState(qn)
		if not st: return htmltext

		npcId = npc.getNpcId()
		id = st.getState()
		cond = st.getInt("cond")

		if id == State.COMPLETED :
			htmltext = "<html><body>這是已經完成的任務。</body></html>"
		elif id == State.CREATED :
			if npcId == CASIAN and cond == 0 :
				if HellboundManager.getInstance().isLocked() :
					if player.getLevel() >= 78 :
						htmltext = "30612-01.htm"
					else :
						htmltext = "30612-00.htm"
						st.exitQuest(1)
				else :
					htmltext = "30612-hellbound-locked.htm"
					st.exitQuest(1)
		elif id == State.STARTED:
			if npcId == CASIAN :
				if cond == 1 :
					htmltext = "30612-03a.htm"
				elif cond == 2 :
					htmltext = "30612-04.htm"
				elif cond == 3 :
					htmltext = "30612-05a.htm"
			elif npcId == GALATE :
				if cond == 1 :
					htmltext = "32292-01.htm"
				elif cond == 2 :
					htmltext = "32292-03a.htm"
				elif cond == 3 :
					if st.getQuestItemsCount(CASIAN_BLUE_CRY) == 1 :
						htmltext = "32292-04.htm"
					else :
						htmltext = "道具不符。"
		return htmltext
 def onTalk (self,npc,player):
   st = player.getQuestState(qn)
   htmltext = Quest.getNoQuestMsg(player)
   if not st: return htmltext

   npcId = npc.getNpcId()
   id = st.getState()
   cond = st.getInt("cond")

   if id == State.COMPLETED :
     htmltext = Quest.getAlreadyCompletedMsg(player)

   elif npcId == CASIAN :
     if cond == 0 :
       if not HellboundManager.getInstance().isLocked() :
         if player.getLevel() >= 78 :
           htmltext = "30612-01.htm"
         else :
           htmltext = "30612-00.htm"
           st.exitQuest(1)
       else :
         htmltext = "30612-hellbound-locked.htm"
         st.exitQuest(1)
     elif cond == 1 :
       htmltext = "30612-03a.htm"
     elif cond == 2 :
       htmltext = "30612-04.htm"
     elif cond == 3 :
       htmltext = "30612-05a.htm"
   elif npcId == GALATE :
     if cond == 1 :
       htmltext = "32292-01.htm"
     elif cond == 2 :
       htmltext = "32292-03a.htm"
     elif cond == 3 :
       if st.getQuestItemsCount(CASIAN_BLUE_CRY) == 1 :
         htmltext = "32292-04.htm"
       else :
         htmltext = "Incorrect item count."
   return htmltext
Beispiel #19
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 == 32346 :
			party = player.getParty()
			if not party:
				return "32346-0.htm"
			else :
				tele = PyObject()
				tele.x = 14205
				tele.y = 255451
				tele.z = -2025
				enterInstance(self, player, "HBTown.xml", tele, self)
				party = player.getParty()
				if party :
					for partyMember in party.getPartyMembers().toArray() :
						st = partyMember.getQuestState(qn)
						if not st : st = self.newQuestState(partyMember)
		return
Beispiel #20
0
	def onTalk (self, npc, player) :
		htmltext = "<html><body>目前沒有執行任務,或條件不符。</body></html>"
		st = player.getQuestState(qn)
		if not st : return htmltext

		npcId = npc.getNpcId()
		id = st.getState()
		cond = st.getInt("cond") 

		if id == State.COMPLETED :
			if npcId == MATRAS :
				htmltext = "<html><body>這是已經完成的任務。</body></html>"
		elif id == State.CREATED :
			if npcId == MATRAS and cond == 0 :
				hellboundLevel = HellboundManager.getInstance().getLevel()
				if hellboundLevel < 9:
					htmltext="32245-00.htm"
					st.exitQuest(1)
				if player.getLevel() >= 76 :
					htmltext="32245-01.htm"
				else :
					htmltext="32245-02.htm"
					st.exitQuest(1)
		elif id == State.STARTED :
			if npcId == MATRAS :
				if cond == 1 :
					htmltext = "32245-04.htm"
				elif cond == 2 :
					if st.getQuestItemsCount(PRINCESBLUEPRINT) >= 1 and st.getQuestItemsCount(RANKUSBLUEPRINT) >= 1 :
						htmltext = "32245-05.htm"
						st.takeItems(RANKUSBLUEPRINT,-1)
						st.takeItems(PRINCESBLUEPRINT,-1)
						st.set("cond","3")
						st.playSound("ItemSound.quest_middle")
				elif cond == 3 :
					htmltext = "32245-06.htm"
		return htmltext
 def onKill(self, npc, player, isPet):
     id = npc.getNpcId()
     if id == Captain:
         HellboundManager.getInstance().changeLevel(9)
         DoorTable.getInstance().getDoor(20250001).openMe()
Beispiel #22
0
	def onKill(self, npc, player, isPet):
		npcId = npc.getNpcId()
		objId = npc.getObjectId()
		if npcId == KEYMASTER:
			HellboundManager.getInstance().increaseTrust(250)
			self.trustp += 250
			self.saveGlobalQuestVar("trust10p", str(self.trustp))
			chance = Rnd.get(100)
			if chance <= 75:
				npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "我的天呀!我.的..鑰...匙......."))
				dropItem(player,npc,9714,1)
			else:
				npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "你永遠都不能得到我的..鑰匙!"))
		if npcId == AMASKARI:
			if HellboundManager.getInstance().getLevel() <= 11:
				HellboundManager.getInstance().increaseTrust(500)
				self.trustp += 500
				self.saveGlobalQuestVar("trust10p", str(self.trustp))
			try:
				if self.Slaves[objId][0] != "noSlaves":
					for i in self.Slaves[objId]:
						try:
							i.setIsInvul(1)
							i.broadcastPacket(CreatureSay(i.getObjectId(), 0, i.getName(), "謝謝你救我!"))
							i.decayMe()
						except:
							pass
					self.Slaves[objId] = []
			except:
				pass
		if npcId == NATIVE:
			HellboundManager.getInstance().increaseTrust(-10)
			self.trustp -= 10
			self.saveGlobalQuestVar("trust10p", str(self.trustp))
			self.Lock = 0
		if npcId == PRISONER:
			HellboundManager.getInstance().increaseTrust(-10)
			self.trustp -= 10
			self.saveGlobalQuestVar("trust10p", str(self.trustp))
		if npcId in LIST:
			HellboundManager.getInstance().increaseTrust(20)
			self.trustp += 20
			self.saveGlobalQuestVar("trust10p", str(self.trustp))
		if self.worlds.has_key(npc.getInstanceId()):
			world = self.worlds[npc.getInstanceId()]
		return
 def onKill(self, npc, player, isPet):
     id = npc.getNpcId()
     if id == Captain:
         HellboundManager.getInstance().changeLevel(9)
         DoorTable.getInstance().getDoor(20250001).openMe()
	def __init__(self, id, name, descr):
		JQuest.__init__(self, id, name, descr)
		self.hellboundTrust = 0
		self.hellboundLevel = 0
		self.hellboundMobs = {
				22320: {'points':10},
				22321: {'points':10},
				22324: {'points':1},
				22325: {'points':1},
				22327: {'points':3},
				22328: {'points':3},
				22329: {'points':3},
		}
		self.hellboundMobs1 = {
				22322: {'points':-10},
				22323: {'points':-10},
				22342: {'points':3},
				22343: {'points':3},
				22361: {'points':20},
				22449: {'points':50},
				22450: {'points':-10},
				25536: {'points':200}
		}
		self.Warpgateloc = []
		self.Warpgate1loc = []
		self.buronloc = []
		self.kiefloc = []
		self.keltasmin = []
		self.keltasloc = []
		self.Keltas = 0
		con = L2DatabaseFactory.getInstance().getConnection()
		trigger = con.prepareStatement("SELECT name FROM hellbound WHERE dummy=0")
		trigger1 = trigger.executeQuery()
		ZoneName = 100
		while (trigger1.next()):
			ZoneName = trigger1.getInt("name")
		try:
			con.close()
		except:
			pass
		if ZoneName != 8000:
			con = L2DatabaseFactory.getInstance().getConnection()
			insertion = con.prepareStatement("INSERT INTO hellbound (name,trustLevel,zonesLevel,unlocked,dummy) VALUES (?,?,?,?,?)")
			insertion.setInt(1, 8000)
			insertion.setInt(2, 0)
			insertion.setInt(3, 0)
			insertion.setInt(4, 0)
			insertion.setInt(5, 0)
			insertion.executeUpdate()
			insertion.close();
			try:
				con.close()
			except:
				pass
		self.hellboundLevel = HellboundManager.getInstance().getLevel()
		self.hellboundTrust = HellboundManager.getInstance().getTrust()
		if self.hellboundLevel == 0:
			self.Warpgateloc = []
			self.Warpgate1loc = []
			oldWarpgate = self.addSpawn(Warpgate, 112080, 219568, -3664, 0, False, 0)
			oldWarpgate1 = self.addSpawn(Warpgate, -16899, 209827, -3640, 0, False, 0)
			self.Warpgateloc.append(oldWarpgate)
			self.Warpgate1loc.append(oldWarpgate1)
		if self.hellboundLevel >= 1:
			newWarpgate6 = self.addSpawn(32319, 112080, 219568, -3664, 0, False, 0)
			newWarpgate6 = self.addSpawn(32319, -16899, 209827, -3640, 0, False, 0)
		if self.hellboundLevel >= 2:
			newFalk = self.addSpawn(32297, -19904, 250016, -3240, 12288, False, 0)
		if self.hellboundLevel >= 3 and self.hellboundLevel < 5:
			self.keltasloc = []
			xx, yy, zz = KeltasSpawn
			newKeltas = self.addSpawn(Keltas, xx, yy, zz, 0, False, 0)
			self.keltasloc.append(newKeltas)
			self.keltasmin = []
			for i in range(31):
				xx, yy, zz = KeltasMinionsSpawns[i]
				RndMobSpawn = KeltasMinions[Rnd.get(len(KeltasMinions))]
				newKeltasMinion = self.addSpawn(RndMobSpawn, xx, yy, zz, 0, False, 0)
				self.keltasmin.append(newKeltasMinion)
		if self.hellboundLevel == 4:
			newDerek = self.addSpawn(ghostofderek, -28058, 256885, -1934, 0, False, 0)
		if self.hellboundLevel < 5:
			self.buronloc = []
			self.kiefloc = []
			oldKief = self.addSpawn(Kief, -21271, 250238, -3314, 16384, False, 0)
			oldBuron = self.addSpawn(Buron, -11173, 236537, -3236, 41760, False, 0)
			self.buronloc.append(oldBuron)
			self.kiefloc.append(oldKief)
		if self.hellboundLevel >= 5:
			newSolomon = self.addSpawn(Solomon, -28916, 249381, -3472, 0, False, 0)
			newTraitor = self.addSpawn(Traitor, -27352, 252387, -3520, 5416, False, 0)
			newKief = self.addSpawn(Kief, -28357, 248993, -3472, 16384, False, 0)
			newBuron = self.addSpawn(Buron, -28567, 248994, -3472, 16384, False, 0)
		if self.hellboundLevel < 6:
			changeBoxesSpawnState(0)
		if self.hellboundLevel < 7:
			changeChimeraSpawnState(0)
		if self.hellboundLevel >= 7:
			worldObjects = SpawnTable.getInstance().getSpawnTable().values()
			for i in worldObjects:
				npcId = i.getNpcid()
				if npcId == WLGuard:
					xx, yy, zz = i.getLocx(), i.getLocy(), i.getLocz()
					i.stopRespawn()
					curNpc = i.getLastSpawn()
					curNpc.onDecay()
		self.startQuestTimer("LevelCheck", 60000, None, None, True)
	def onAdvEvent (self, event, npc, player) :
		if npc:
			npcId = npc.getNpcId()
			npcObjId = npc.getObjectId()
		if event == "keltasRespawn":
			if self.hellboundLevel >= 5: return
			self.keltasloc = []
			xx, yy, zz = KeltasSpawn
			newKeltas = self.addSpawn(Keltas, xx, yy, zz, 0, False, 0)
			self.keltasloc.append(newKeltas)
			self.keltasmin = []
			self.Keltas = 0
			for i in range(31):
				xx, yy, zz = KeltasMinionsSpawns[i]
				RndMobSpawn = KeltasMinions[Rnd.get(len(KeltasMinions))]
				newKeltasMinion = self.addSpawn(RndMobSpawn, xx, yy, zz, 0, False, 0)
				self.keltasmin.append(newKeltasMinion)
		if event == "LevelCheck":
			HellboundManager.getInstance().checkHellboundLevel()
			newLevel = HellboundManager.getInstance().getLevel()
			self.hellboundTrust = HellboundManager.getInstance().getTrust()
			if newLevel > self.hellboundLevel:
				self.hellboundLevel = newLevel
				print "---- Hellbound achieved Level " + str(self.hellboundLevel)
				announce = "地獄邊界已經達到的等級: " + str(self.hellboundLevel)
				Announcements.getInstance().announceToAll(announce)
				if newLevel == 1:
					for i in self.Warpgateloc :
						i.deleteMe()
					for i in self.Warpgate1loc :
						i.deleteMe()
					newWarpgate6 = self.addSpawn(32319, 112080, 219568, -3664, 0, False, 0)
					newWarpgate6 = self.addSpawn(32319, -16899, 209827, -3640, 0, False, 0)
				if newLevel == 2:
					newFalk = self.addSpawn(32297, -19904, 250016, -3240, 12288, False, 0)  # 福爾克
				if newLevel == 3:
					xx, yy, zz = KeltasSpawn
					newKeltas = self.addSpawn(Keltas, xx, yy, zz, 0, False, 0)
					self.keltasloc.append(newKeltas)
					self.Keltas = 0
					self.keltasmin = []
					for i in range(31):
						xx, yy, zz = KeltasMinionsSpawns[i]
						RndMobSpawn = KeltasMinions[Rnd.get(len(KeltasMinions))]
						newKeltasMinion = self.addSpawn(RndMobSpawn, xx, yy, zz, 0, False, 0)
						self.keltasmin.append(newKeltasMinion)
				if newLevel == 4:
					newDerek = self.addSpawn(ghostofderek, -28058, 256885, -1934, 0, False, 0)
				if newLevel == 5:
					for i in self.buronloc :
						i.deleteMe()
					for i in self.kiefloc :
						i.deleteMe()
					for i in self.keltasloc :
						i.deleteMe()
					for i in self.keltasmin :
						i.deleteMe()
					newSolomon = self.addSpawn(Solomon, -28916, 249381, -3472, 0, False, 0)
					newTraitor = self.addSpawn(Traitor, -27352, 252387, -3520, 5416, False, 0)
					newKief = self.addSpawn(Kief, -28357, 248993, -3472, 16384, False, 0)
					newBuron = self.addSpawn(Buron, -28567, 248994, -3472, 16384, False, 0)
				if newLevel == 6:
					changeBoxesSpawnState(1)
				if newLevel == 7:
					changeChimeraSpawnState(1)
					LOC = LOCS[Rnd.get(len(LOCS))]
					CeltrespTime = (18 + Rnd.get(36)) * 100 #between 30m and 1h
					newCeltus = HellboundManager.getInstance().addSpawn(celtus, LOC[0], LOC[1], LOC[2], 0, CeltrespTime)
				if newLevel == 8:
					newCaptain = HellboundManager.getInstance().addSpawn(Captain, 4766, 243995, -1928, 36561, 0)
				if newLevel == 9:
					newWarpgate = self.addSpawn(32319, 112080, 219568, -3664, 0, False, 0)
					newWarpgate = self.addSpawn(32319, -16899, 209827, -3640, 0, False, 0)
			if self.hellboundLevel >= 5:
				DoorTable.getInstance().getDoor(19250001).openMe()
				DoorTable.getInstance().getDoor(19250002).openMe()
			if self.hellboundLevel < 7:
				DoorTable.getInstance().getDoor(20250002).closeMe()
			if self.hellboundLevel >= 7:
				DoorTable.getInstance().getDoor(20250002).openMe()
			if self.hellboundLevel < 9:
				DoorTable.getInstance().getDoor(20250001).closeMe()
			if self.hellboundLevel >= 9:
				DoorTable.getInstance().getDoor(20250001).openMe()
	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()
Beispiel #27
0
	def onKill(self, npc, player, isPet):
		npcId = npc.getNpcId()
		objId = npc.getObjectId()
		if npcId == KEYMASTER:
			HellboundManager.getInstance().increaseTrust(250)
			self.trustp += 250
			self.saveGlobalQuestVar("trust10p", str(self.trustp))
			chance = Rnd.get(100)
			if chance <= 75:
				npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "我的天呀!我.的..鑰...匙......."))
				dropItem(player,npc,9714,1)
			else:
				npc.broadcastPacket(NpcSay(objId, 0, npc.getNpcId(), "你永遠都不能得到我的..鑰匙!"))
		elif npcId == AMASKARI:
			if HellboundManager.getInstance().getLevel() <= 11:
				HellboundManager.getInstance().increaseTrust(500)
				self.trustp += 500
				self.saveGlobalQuestVar("trust10p", str(self.trustp))
			try:
				if self.Slaves[objId][0] != "noSlaves":
					for i in self.Slaves[objId]:
						try:
							i.setIsInvul(1)
							i.broadcastPacket(CreatureSay(i.getObjectId(), 0, i.getName(), "謝謝你救我!"))
							i.decayMe()
						except:
							pass
					self.Slaves[objId] = []
			except:
				pass
		elif npcId == NATIVE:
			HellboundManager.getInstance().increaseTrust(-10)
			self.trustp -= 10
			self.saveGlobalQuestVar("trust10p", str(self.trustp))
		elif npcId == PRISONER:
			HellboundManager.getInstance().increaseTrust(-10)
			self.trustp -= 10
			self.saveGlobalQuestVar("trust10p", str(self.trustp))
		elif npcId in LIST:
			HellboundManager.getInstance().increaseTrust(20)
			self.trustp += 20
			self.saveGlobalQuestVar("trust10p", str(self.trustp))
		if self.worlds.has_key(npc.getInstanceId()):
			world = self.worlds[npc.getInstanceId()]
		return
 def onAdvEvent(self, event, npc, player):
     hellboundLevel = HellboundManager.getInstance().getLevel()
     if npc:
         npcId = npc.getNpcId()
         npcObjId = npc.getObjectId()
     if "Delete" in event and npc:
         try:
             npc.setIsInvul(0)
             npc.deleteMe()
         except:
             pass
     if "followCheck" in event and npc:
         if npc.isDead(): return
         newObjId = npc.getObjectId()
         timerName = "followCheck" + str(newObjId)
         self.startQuestTimer(timerName, 1000, npc, None)
         xx, yy, zz, headg = npc.getX(), npc.getY(), npc.getZ(
         ), npc.getHeading()
         npc.getKnownList().removeAllKnownObjects()
         npcKnownObjects = L2World.getInstance().getVisibleObjects(
             npc, 2000)
         if npcKnownObjects > 0:
             for i in npcKnownObjects:
                 npc.getKnownList().addKnownObject(i)
         npcKnownPlayers = npc.getKnownList().getKnownPlayers().values()
         #npcKnownObjects = npc.getKnownList().getKnownCharacers()
         #npc.getTaget().sendMessage("X:"+str(xx)+" Y:"+str(yy))
         if yy in range(249000, 249880) and xx in range(-6230, -5230):
             try:
                 chat = CreatureSay(npc.getObjectId(), 0, "採石場奴隸",
                                    "謝謝您的相助,這是小小的心意。")
                 npc.broadcastPacket(chat)
                 aa = Rnd.get(3)
                 for i in range(aa):
                     xx1 = xx + (35 - Rnd.get(70))
                     yy1 = yy + (35 - Rnd.get(70))
                     ditem = ItemTable.getInstance().createItem(
                         "Gift",
                         QuarryDropItems[Rnd.get(len(QuarryDropItems))], 1,
                         None, None)
                     ditem.dropMe(npc, xx1, yy1, zz)
             except:
                 pass
             try:
                 npc.doDie(npc)
                 npc.decayMe()
             except:
                 pass
             HellboundManager.getInstance().increaseTrust(10)
             self.rescued += 1
             self.saveGlobalQuestVar("rescued_Slaves", str(self.rescued))
             if self.rescued >= 1000:
                 HellboundManager.getInstance().changeLevel(6)
                 self.rescued = 0
                 self.saveGlobalQuestVar("rescued_Slaves",
                                         str(self.rescued))
             return
         minX = xx - 170
         maxX = xx + 170
         minY = yy - 170
         maxY = yy + 170
         for neighbor in npcKnownObjects:
             if not neighbor in npcKnownPlayers:
                 if neighbor.getX() in range(minX, maxX):
                     if neighbor.getY() in range(minY, maxY):
                         try:
                             if neighbor.getNpcId() in QuarryMasters:
                                 neighbor.setTarget(npc)
                                 neighbor.addDamageHate(npc, 0, 999)
                                 neighbor.getAI().setIntention(
                                     CtrlIntention.AI_INTENTION_ATTACK, npc)
                                 neighbor.setRunning()
                                 return
                         except:
                             pass
     if event == "FollowMe":
         npcSlave = player.getTarget()
         #npcSlave.setIsFollowingMaster(1)
         npcSlave.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW,
                                       player)
         newObjId = npcSlave.getObjectId()
         timerName = "followCheck" + str(newObjId)
         self.startQuestTimer(timerName, 1000, npcSlave, None)
     if event == "SpawnSlaves":
         worldObjects = SpawnTable.getInstance().getSpawnTable().values()
         for i in worldObjects:
             if i.getNpcid() in SlaveMasters:
                 curNpc = i.getLastSpawn()
                 objId = curNpc.getObjectId()
                 self.Slaves[objId] = []
                 self.Slaves[objId].append("noSlaves")
                 if int(hellboundLevel) >= 5: return
                 xx, yy, zz = i.getLocx(), i.getLocy(), i.getLocz()
                 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, curNpc)
                 newSlave1.getAI().setIntention(
                     CtrlIntention.AI_INTENTION_FOLLOW, curNpc)
                 self.Slaves[objId].append(newSlave)
                 self.Slaves[objId].append(newSlave1)
	def onAdvEvent (self, event, npc, player) :
		hellboundLevel = HellboundManager.getInstance().getLevel()
		if npc:
			npcId = npc.getNpcId()
			npcObjId = npc.getObjectId()
		if "Delete" in event and npc:
			try:
				npc.setIsInvul(0)
				npc.deleteMe()
			except:
				pass
		if "followCheck" in event and npc:
			if npc.isDead(): return
			newObjId = npc.getObjectId()
			timerName = "followCheck" + str(newObjId)
			self.startQuestTimer(timerName, 1000, npc, None)
			xx, yy, zz, headg = npc.getX(), npc.getY(), npc.getZ(), npc.getHeading()
			npc.getKnownList().removeAllKnownObjects()
			npcKnownObjects = L2World.getInstance().getVisibleObjects(npc, 2000)
			if npcKnownObjects > 0:
				for i in npcKnownObjects:
					npc.getKnownList().addKnownObject(i)
			npcKnownPlayers = npc.getKnownList().getKnownPlayers().values()
			#npcKnownObjects = npc.getKnownList().getKnownCharacers()
			#npc.getTaget().sendMessage("X:"+str(xx)+" Y:"+str(yy))
			if yy in range(249000, 249880) and xx in range(-6230, -5230):
				try:
					chat = CreatureSay(npc.getObjectId(), 0, "採石場奴隸", "謝謝您的相助,這是小小的心意。")
					npc.broadcastPacket(chat)
					aa = Rnd.get(3)
					for i in range(aa):
						xx1 = xx + (35 - Rnd.get(70))
						yy1 = yy + (35 - Rnd.get(70))
						ditem = ItemTable.getInstance().createItem("Gift", QuarryDropItems[Rnd.get(len(QuarryDropItems))], 1, None, None)
						ditem.dropMe(npc, xx1, yy1, zz)
				except:
					pass
				try:
					npc.doDie(npc)
					npc.decayMe()
				except:
					pass
				HellboundManager.getInstance().increaseTrust(10)
				self.rescued += 1
				self.saveGlobalQuestVar("rescued_Slaves", str(self.rescued))
				if self.rescued >= 1000:
					HellboundManager.getInstance().changeLevel(6)
					self.rescued = 0
					self.saveGlobalQuestVar("rescued_Slaves", str(self.rescued))
				return
			minX = xx - 170
			maxX = xx + 170
			minY = yy - 170
			maxY = yy + 170
			for neighbor in npcKnownObjects:
				if not neighbor in npcKnownPlayers:
					if neighbor.getX() in range(minX, maxX):
						if neighbor.getY() in range(minY, maxY):
							try:
								if neighbor.getNpcId() in QuarryMasters:
									neighbor.setTarget(npc)
									neighbor.addDamageHate(npc, 0, 999)
									neighbor.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, npc)
									neighbor.setRunning()
									return
							except:
								pass
		if event == "FollowMe":
			npcSlave = player.getTarget()
			#npcSlave.setIsFollowingMaster(1)
			npcSlave.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player)
			newObjId = npcSlave.getObjectId()
			timerName = "followCheck" + str(newObjId)
			self.startQuestTimer(timerName, 1000, npcSlave, None)
		if event == "SpawnSlaves":
			worldObjects = SpawnTable.getInstance().getSpawnTable().values()
			for i in worldObjects:
				if i.getNpcid() in SlaveMasters:
					curNpc = i.getLastSpawn()
					objId = curNpc.getObjectId()
					self.Slaves[objId] = []
					self.Slaves[objId].append("noSlaves")
					if int(hellboundLevel) >= 5: return
					xx, yy, zz = i.getLocx(), i.getLocy(), i.getLocz()
					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, curNpc)
					newSlave1.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, curNpc)
					self.Slaves[objId].append(newSlave)
					self.Slaves[objId].append(newSlave1)