Exemple #1
0
	def onAdvEvent(self, event, npc, player):
		if event.startswith("showQuestion "):
			params = event[len("showQuestion "):]
			self.item, self.qty, self.question, self.answer = params.split(self.command_split_char)
			Announcements.getInstance().announceToAll("搶答活動 請使用大喊頻作答 第一位答中問題的玩家 將會得到 %s 數量 %s" % (self.item, self.qty), self.isCritical)
			Announcements.getInstance().announceToAll("問題:%s" % (self.question), self.isCritical)
			return
		print self.qn, "不明要求", npc, player, event
		return self.htm_header + "不明要求" + self.htm_footer
Exemple #2
0
	def onAdvEvent(self, event, npc, player):
		print event, npc, player
		if event == 'spawn_npc_in_town':
			for player in L2World.getInstance().getAllPlayers().values():
				print player
				if self.canSpawn(player):
					print "canspawn"
					c = Rnd.get(self.npc_town_spawn_max - self.npc_town_spawn_min) + self.npc_town_spawn_min
					for i in range(c):
						self.myAddSpawn(player, player, 1000)
		elif event in self.BOSS_spawn_info:
			t, boss_id, x, y, z, heading, random_offset, despawn_delay = self.BOSS_spawn_info[event]
			n = self.addSpawn(boss_id, x, y, z, heading, random_offset, despawn_delay)
			Announcements.getInstance().announceToAll('活動 BOSS 出現在「' + n.getCastle().getCName() + '」地區 ' + str(x) + ',' + str(y) + ',' + str(z))
			self.startQuestTimer(event, 14400*1000, None, None, False)	#遊戲時間一天後再重生
Exemple #3
0
	def onEnterZone(self, player, zonetype):
		if isinstance(player, L2PcInstance) and not player.getName() in self.blacklist:
			area_name = zonetype.getName()
			if zonetype.getId() in self.zone_data.keys():
				if not self.zone_data[zonetype.getId()]["show"]:
					return JQuest.onEnterZone(self, player, zonetype)
				area_name = self.zone_data[zonetype.getId()]["name"]
			else:
				if not self.no_data_show:
					return JQuest.onEnterZone(self, player, zonetype)
			t = time.localtime()
			h = t[3]
			m = t[4]
			a = "%s 進入%s範圍! 於%d時%d分" % (player.getName(), area_name, h, m)
			Announcements.getInstance().announceToAll(a)
		return JQuest.onEnterZone(self, player, zonetype)
Exemple #4
0
	def useVoicedCommand(self, command, player, params):
		if not player: return
		inv = player.getInventory()
		if not inv: return
		ditem = inv.destroyItemByItemId("vcplayeranno", self.requireItemId, self.requireItemCount, player, None) 
		if ditem:
			player.sendMessage("消耗了 %s %d 個" % (ditem.getName(), self.requireItemCount))
			Announcements.getInstance().announceToAll("%s:%s" % (player.getName(), params[:self.messageLength]), self.isCritical)
			iu = InventoryUpdate()
			iu.addModifiedItem(ditem)
			player.sendPacket(iu)
		else:
			item = ItemTable.getInstance().getTemplate(self.requireItemId)
			name = ""
			if item:
				name = item.getName()
			player.sendMessage("所需道具不足 需要 %s %d 個" % (name, self.requireItemCount))
Exemple #5
0
 def onEnterZone(self, player, zonetype):
     if isinstance(player,
                   L2PcInstance) and not player.getName() in self.blacklist:
         area_name = zonetype.getName()
         if zonetype.getId() in self.zone_data.keys():
             if not self.zone_data[zonetype.getId()]["show"]:
                 return JQuest.onEnterZone(self, player, zonetype)
             area_name = self.zone_data[zonetype.getId()]["name"]
         else:
             if not self.no_data_show:
                 return JQuest.onEnterZone(self, player, zonetype)
         t = time.localtime()
         h = t[3]
         m = t[4]
         a = "%s 進入%s範圍! 於%d時%d分" % (player.getName(), area_name, h, m)
         Announcements.getInstance().announceToAll(a)
     return JQuest.onEnterZone(self, player, zonetype)
Exemple #6
0
 def onAdvEvent(self, event, npc, player):
     print event, npc, player
     if event == 'spawn_npc_in_town':
         for player in L2World.getInstance().getAllPlayers().values():
             print player
             if self.canSpawn(player):
                 print "canspawn"
                 c = Rnd.get(
                     self.npc_town_spawn_max -
                     self.npc_town_spawn_min) + self.npc_town_spawn_min
                 for i in range(c):
                     self.myAddSpawn(player, player, 1000)
     elif event in self.BOSS_spawn_info:
         t, boss_id, x, y, z, heading, random_offset, despawn_delay = self.BOSS_spawn_info[
             event]
         n = self.addSpawn(boss_id, x, y, z, heading, random_offset,
                           despawn_delay)
         Announcements.getInstance().announceToAll(
             '活動 BOSS 出現在「' + n.getCastle().getCName() + '」地區 ' + str(x) +
             ',' + str(y) + ',' + str(z))
         self.startQuestTimer(event, 14400 * 1000, None, None,
                              False)  #遊戲時間一天後再重生
Exemple #7
0
 def useVoicedCommand(self, command, player, params):
     if not player: return
     inv = player.getInventory()
     if not inv: return
     ditem = inv.destroyItemByItemId("vcplayeranno", self.requireItemId,
                                     self.requireItemCount, player, None)
     if ditem:
         player.sendMessage("消耗了 %s %d 個" %
                            (ditem.getName(), self.requireItemCount))
         Announcements.getInstance().announceToAll(
             "%s:%s" % (player.getName(), params[:self.messageLength]),
             self.isCritical)
         iu = InventoryUpdate()
         iu.addModifiedItem(ditem)
         player.sendPacket(iu)
     else:
         item = ItemTable.getInstance().getTemplate(self.requireItemId)
         name = ""
         if item:
             name = item.getName()
         player.sendMessage("所需道具不足 需要 %s %d 個" %
                            (name, self.requireItemCount))
Exemple #8
0
	def handleChat(self, type, activeChar, target, text):
		if activeChar.isChatBanned() and Util.contains(Config.BAN_CHAT_CHANNELS, type):
			activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED)
			return
		cs = CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text)
		pls = L2World.getInstance().getAllPlayersArray()
		if Config.DEFAULT_GLOBAL_CHAT.lower() == "on" or (Config.DEFAULT_GLOBAL_CHAT.lower() == "gm" and activeChar.isGM()):
			region = MapRegionManager.getInstance().getMapRegionLocId(activeChar)
			for player in pls:
				if region == MapRegionManager.getInstance().getMapRegionLocId(player) and not BlockList.isBlocked(player, activeChar) and player.getInstanceId() == activeChar.getInstanceId():
					player.sendPacket(cs)
		elif Config.DEFAULT_GLOBAL_CHAT.lower() == "global":
			if not activeChar.isGM() and not activeChar.getFloodProtectors().getGlobalChat().tryPerformAction("global chat"):
				activeChar.sendMessage(1101)
				return
			for player in pls:
				if not BlockList.isBlocked(player, activeChar):
					player.sendPacket(cs)
		if not self.answer == None:
			if text == self.answer:
				self.answer = None
				Announcements.getInstance().announceToAll("恭喜 %s 獲得 %s 數量 %s 答案:%s" % (activeChar.getName(), self.item, self.qty, text), self.isCritical)
				activeChar.addItem(self.qn, self.gifts[self.item], int(self.qty), None, True)
Exemple #9
0
                            r4 = data.split(",")
                        r3["data"] = r4
                        r2[id] = r3
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json; charset=utf-8")

                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "server":

                if command[3] == "anno":
                    if command[4] == "once":
                        Announcements.getInstance().announceToAll(ibuff)
                    elif command[4] == "show":
                        for player in L2World.getInstance().getAllPlayersArray():
                            Announcements.getInstance().showAnnouncements(player)
                    elif command[4] == "list":
                        script = """
setAccessibility(true);
import com.l2jserver.gameserver.Announcements;
for(s : Announcements.getInstance()._announcements)
	out_writer.println(random_string + s);
"""
                        random_string = "".join([chr(Random().nextInt(26) + ord("a")) for x in xrange(10)])
                        r3 = self.exec_script("bsh", script, attr={"random_string": random_string}).split(
                            random_string
                        )[1:]
                        r2 = {}
 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 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()
Exemple #11
0
 def send_jmessage(self, event):
     Announcements.getInstance().announceToAll(self.jmessage.getText())
     print self.jmessage.getText()
Exemple #12
0
                            r4 = data.split(",")
                        r3['data'] = r4
                        r2[id] = r3
                    r = JSON().toJSON(r2)
                    rh = exchange.getResponseHeaders()
                    rh.set("Content-Type", "application/json; charset=utf-8")

                else:
                    exchange.sendResponseHeaders(501, 0)
                    return

            elif command[2] == "server":

                if command[3] == "anno":
                    if command[4] == "once":
                        Announcements.getInstance().announceToAll(ibuff)
                    elif command[4] == "show":
                        for player in L2World.getInstance().getAllPlayersArray(
                        ):
                            Announcements.getInstance().showAnnouncements(
                                player)
                    elif command[4] == "list":
                        script = """
setAccessibility(true);
import com.l2jserver.gameserver.Announcements;
for(s : Announcements.getInstance()._announcements)
	out_writer.println(random_string + s);
"""
                        random_string = "".join([
                            chr(Random().nextInt(26) + ord("a"))
                            for x in xrange(10)
Exemple #13
0
 def send_jmessage(self, event):
     Announcements.getInstance().announceToAll(self.jmessage.getText())
     print self.jmessage.getText()
	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()