def onKill(self, npc, player, isPet): npcId = npc.getNpcId() if self.worlds.has_key(npc.getInstanceId()): world = self.worlds[npc.getInstanceId()] if world.status == 0: if npcId == 22494: newNpc = self.addSpawn(KamaBoss1[0], -49649, -174887, -10459, 0, False, 0, False, world.instanceId) # Boss world.startRoom.npclist[newNpc] = False if npcId == 25619: newNpc = self.addSpawn(KamaBoss[0], -53418, -174887, -10015, 0, False, 0, False, world.instanceId) # Boss world.startRoom.npclist[newNpc] = False if npcId == 29138: instanceObj = InstanceManager.getInstance().getInstance( self.currentWorld) player.sendPacket( SystemMessage.sendString( "從現在起將會限制進入即時地區:「欲界 (深淵迷宮)」。下一次的進場時間可透過「/即時地區」指令來查詢。" )) instanceObj.setDuration(300000) instanceObj.removeNpcs() party = player.getParty() if party != None: for partyMember in party.getPartyMembers().toArray(): partyMember.sendPacket( SystemMessage.sendString( "從現在起將會限制進入即時地區:「欲界 (深淵迷宮)」。下一次的進場時間可透過「/即時地區」指令來查詢。" )) return
def onTalk(self, npc, player): html = "fine" npcId = npc.getNpcId() st = player.getQuestState(qn) if not st: st = self.newQuestState(player) party = player.getParty() if not party: html = "32330-01.htm" else: have_quest = False wrong_Level = False for partyMember in party.getPartyMembers().toArray(): pst = partyMember.getQuestState("179_IntoTheLargeCavern") if pst: have_quest = True if partyMember.getLevel() < 15 or partyMember.getLevel( ) > 22 or partyMember.getClassId().level() != 0: wrong_Level = True player_name = partyMember.getName() if not have_quest: html = "32330-02.htm" elif player != party.getLeader(): party.broadcastToPartyMembers(SystemMessage(2185)) html = "32330-03.htm" elif wrong_Level: party.broadcastToPartyMembers( SystemMessage(2097).addString(player_name)) html = "32330-03.htm" else: for partyMember in party.getPartyMembers().toArray(): partyMember.teleToLocation(-111188, 74555, -12432) html = "" st.exitQuest(1) return html
def onTalk(self, npc, player): if not checkPrimaryConditions(player): return tele = PyObject() dataIndex = getKamaIndex(KamalokaLevel) tele.x = KamaPorts[dataIndex][0] tele.y = KamaPorts[dataIndex][1] tele.z = KamaPorts[dataIndex][2] instanceId = getExistingInstanceId(player) if instanceId == 0: #brand new instance if not checkNewInstanceConditions(player): return instanceId = InstanceManager.getInstance().createDynamicInstance( KamaTemplate[dataIndex]) if not self.worlds.has_key(instanceId): world = PyObject() world.rewarded = [] world.instanceId = instanceId self.worlds[instanceId] = world self.world_ids.append(instanceId) self.currentWorld = instanceId instanceObj = InstanceManager.getInstance().getInstance( instanceId) instanceObj.setAllowSummon(False) instanceObj.setReturnTeleport(ReturnPort[dataIndex][0], ReturnPort[dataIndex][1], ReturnPort[dataIndex][2]) print "欲界-深淵之廳:使用 " + InstanceTemplate + " 即時地區:" + str( instanceId) + " 創造玩家:" + str(player.getName()) runStartRoom(self, world) tele.instanceId = instanceId player.setKamaDate(1) player.removeActiveBuffForKama() teleportPlayer(self, player, tele) party = player.getParty() if party != None: for partyMember in party.getPartyMembers().toArray(): partyMember.setKamaDate(1) partyMember.removeActiveBuffForKama() teleportPlayer(self, partyMember, tele) else: #party already in Kamaloka foundworld = False for worldid in self.world_ids: if worldid == instanceId: foundworld = True if not foundworld: player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。")) return instanceObj = InstanceManager.getInstance().getInstance(instanceId) if instanceObj.getCountPlayers() >= KamaPartySize[dataIndex]: player.sendPacket( SystemMessage( SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER)) return tele.instanceId = instanceId player.removeActiveBuffForKama() teleportPlayer(self, player, tele) return
def onTalk (self,npc,player): npcId = npc.getNpcId() if npcId == YIYEN : tele = PyObject() instanceId = enterInstance(self, player, "DarkCloudMansion.xml", tele) if self.worlds.has_key(npc.getInstanceId()) : world = self.worlds[npc.getInstanceId()] if npcId == SOTruth : tele = PyObject() tele.x = ReturnPort[dataIndex][0] tele.y = ReturnPort[dataIndex][1] tele.z = ReturnPort[dataIndex][2] exitInstance(player, tele) if player.getObjectId() in world.rewarded : pass else : item = player.getInventory().addItem("Quest", CC, 1, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu) sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) if debug : print "DarkCloudMansion - id" + str(player.getObjectId()) + " added to reward list" world.rewarded.append(player.getObjectId()) return return
def onKill (self,npc,player,isPet): npcId = npc.getNpcId() if npcId == WANDERING_CARAVAN: bcertificate = player.getInventory().getItemByItemId(BASIC_CERTIFICATE) scertificate = player.getInventory().getItemByItemId(STANDARD_CERTIFICATE) if bcertificate and not scertificate: item = player.getInventory().addItem("Quest", MARK_BETRAYAL, 1, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu); sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) if npcId in [22334,22335]: bcertificate = player.getInventory().getItemByItemId(BASIC_CERTIFICATE) scertificate = player.getInventory().getItemByItemId(STANDARD_CERTIFICATE) if bcertificate and not scertificate: item = player.getInventory().addItem("Quest", SCORPION_POISON_STINGER, 1, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu); sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) return
def checkCondition(player): party = player.getParty() if not party : player.sendPacket(SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER)) return False if not player.getParty().isLeader(player) : player.sendPacket(SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False for partyMember in party.getPartyMembers().toArray() : if not partyMember.getLevel() >= 78 : sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray() : if not partyMember.isInsideRadius(player, 500, False, False) : sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray() : item = partyMember.getInventory().getItemByItemId(CRYSTAL) if not item: sm = SystemMessage(SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def getCertified(player, itemId, var): st = player.getQuestState(qn) qvar = st.getGlobalQuestVar(var) if qvar != "" and qvar != "0" : return "" item = player.getInventory().addItem("Quest", itemId, 1, player, player.getTarget()) st.saveGlobalQuestVar(var,str(item.getObjectId())) smsg = SystemMessage(SystemMessageId.EARNED_ITEM) smsg.addItemName(item) player.sendPacket(smsg) return
def getCertified(player, itemId, var): st = player.getQuestState(qn) qvar = st.getGlobalQuestVar(var) if qvar != "" and qvar != "0": return "" item = player.getInventory().addItem("Quest", itemId, 1, player, player.getTarget()) st.saveGlobalQuestVar(var, str(item.getObjectId())) smsg = SystemMessage(SystemMessageId.EARNED_ITEM) smsg.addItemName(item) player.sendPacket(smsg) return
def onKill(self, npc, player, isPet): npcId = npc.getNpcId() if self.worlds.has_key(npc.getInstanceId()): world = self.worlds[npc.getInstanceId()] if world.status == 0: if npcId == 22503: newNpc = self.addSpawn( KamaBoss1[0], 15829, -174885, -10395, 0, False, 0, False, world.instanceId ) # Boss world.startRoom.npclist[newNpc] = False if npcId == 25622: newNpc = self.addSpawn( KamaBoss[0], 12050, -174887, -9951, 0, False, 0, False, world.instanceId ) # Boss world.startRoom.npclist[newNpc] = False if npcId == 29147: instanceObj = InstanceManager.getInstance().getInstance(self.currentWorld) instanceObj.setDuration(300000) instanceObj.removeNpcs() party = player.getParty() if party != None: for partyMember in party.getPartyMembers().toArray(): partyMember.sendPacket( SystemMessage.sendString("從現在起將會限制進入即時地區:「欲界 (深淵迷宮)」。下一次的進場時間可透過「/即時地區」指令來查詢。") ) return
def onTalk(self, npc, player): htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</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-0.htm" elif player.getClan().getLevel() < 5: st.exitQuest(1) htmltext = "31331-0.htm" else: cond = st.getInt("cond") id = st.getState() if id == State.CREATED and cond == 0: htmltext = "31331-1.htm" elif id == State.STARTED and cond == 1: count = st.getQuestItemsCount(Claw) if not count: htmltext = "31331-4.htm" elif count >= 1: htmltext = "31331-7.htm" # custom html st.takeItems(Claw, -1) reward = int(CLAN_POINTS_REWARD * count) clan.setReputationScore(clan.getReputationScore() + reward, True) player.sendPacket(SystemMessage(1777).addNumber(reward)) clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan)) return htmltext
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.setReputationScore(clan.getReputationScore()+CLAN_POINTS_REWARD,True) player.sendPacket(SystemMessage(1777).addNumber(CLAN_POINTS_REWARD)) clan.broadcastToOnlineMembers(PledgeShowInfoUpdate(clan)) return htmltext
def enterInstance(self, player, template, teleto): instanceId = 0 if not checkCondition(player): return 0 party = player.getParty() # Check for existing instances of party members for partyMember in party.getPartyMembers().toArray(): if partyMember.getInstanceId() != 0: instanceId = partyMember.getInstanceId() if debug: print "Emerald/Steam: found party member in instance:" + str( instanceId) # Existing instance if instanceId != 0: foundworld = False for worldid in self.world_ids: if worldid == instanceId: foundworld = True if not foundworld: player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。")) return 0 teleto.instanceId = instanceId teleportplayer(self, player, teleto, True) return instanceId # New instance else: instanceId = InstanceManager.getInstance().createDynamicInstance( template) if not self.worlds.has_key(instanceId): world = PyObject() world.instanceId = instanceId world.bosses = 5 self.worlds[instanceId] = world self.world_ids.append(instanceId) if debug: print "Emerald/Steam Instance: " + str( instanceId) + " created by player: " + str( player.getName()) # Close all doors for door in InstanceManager.getInstance().getInstance( instanceId).getDoors(): door.closeMe() # Start the first room runEmeraldAndSteamFirstRoom(self, world) # Teleports player for partyMember in party.getPartyMembers().toArray(): st = partyMember.getQuestState(qn) if not st: st = self.newQuestState(partyMember) st.takeItems(9694, -1) st.takeItems(9698, -1) st.takeItems(9699, -1) teleto.instanceId = instanceId teleportplayer(self, partyMember, teleto, True) return instanceId return instanceId
def onTalk(self, npc, player): if not checkPrimaryConditions(player): return tele = PyObject() dataIndex = getKamaIndex(KamalokaLevel) tele.x = KamaPorts[dataIndex][0] tele.y = KamaPorts[dataIndex][1] tele.z = KamaPorts[dataIndex][2] instanceId = getExistingInstanceId(player) if instanceId == 0: # brand new instance if not checkNewInstanceConditions(player): return instanceId = InstanceManager.getInstance().createDynamicInstance(KamaTemplate[dataIndex]) if not self.worlds.has_key(instanceId): world = PyObject() world.rewarded = [] world.instanceId = instanceId self.worlds[instanceId] = world self.world_ids.append(instanceId) self.currentWorld = instanceId instanceObj = InstanceManager.getInstance().getInstance(instanceId) instanceObj.setAllowSummon(False) instanceObj.setReturnTeleport( ReturnPort[dataIndex][0], ReturnPort[dataIndex][1], ReturnPort[dataIndex][2] ) print "近緣欲界-深淵之廳:使用 " + InstanceTemplate + " 即時地區:" + str(instanceId) + " 創造玩家:" + str(player.getName()) runStartRoom(self, world) tele.instanceId = instanceId player.setKamaDate(1) player.removeActiveBuffForKama() teleportPlayer(self, player, tele) party = player.getParty() if party != None: for partyMember in party.getPartyMembers().toArray(): partyMember.setKamaDate(1) partyMember.removeActiveBuffForKama() teleportPlayer(self, partyMember, tele) else: # party already in Kamaloka foundworld = False for worldid in self.world_ids: if worldid == instanceId: foundworld = True if not foundworld: player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。")) return instanceObj = InstanceManager.getInstance().getInstance(instanceId) if instanceObj.getCountPlayers() >= KamaPartySize[dataIndex]: player.sendPacket(SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER)) return tele.instanceId = instanceId player.removeActiveBuffForKama() teleportPlayer(self, player, tele) return
def onTalk(self, npc, player): npcId = npc.getNpcId() if npcId == YIYEN: tele = PyObject() instanceId = enterInstance(self, player, "DarkCloudMansion.xml", tele) if self.worlds.has_key(npc.getInstanceId()): world = self.worlds[npc.getInstanceId()] if npcId == SOTruth: tele = PyObject() tele.x = ReturnPort[dataIndex][0] tele.y = ReturnPort[dataIndex][1] tele.z = ReturnPort[dataIndex][2] exitInstance(player, tele) if player.getObjectId() in world.rewarded: pass else: item = player.getInventory().addItem( "Quest", CC, 1, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu) sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) if debug: print "DarkCloudMansion - id" + str( player.getObjectId()) + " added to reward list" world.rewarded.append(player.getObjectId()) return return
def checkCondition(player) : party = player.getParty() if not party : player.sendPacket(SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER)) return False if not player.getParty().isLeader(player) : player.sendPacket(SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False membersCount = player.getParty().getMemberCount() if membersCount < 2 : player.sendPacket(SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER)) return False for partyMember in party.getPartyMembers().toArray() : if not partyMember.getLevel() >= 78 : sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray() : if not partyMember.isInsideRadius(player, 500, False, False) : sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def enterInstance(self, player, template, teleto) : instanceId = 0 party = player.getParty() #check for existing instances of party members if party : for partyMember in party.getPartyMembers().toArray() : st = partyMember.getQuestState(qn) if not st : st = self.newQuestState(partyMember) if partyMember.getInstanceId()!= 0 : instanceId = partyMember.getInstanceId() if debug: print "HBTown : found party member in instance:"+str(instanceId) else : if player.getInstanceId()!=0 : instanceId = player.getInstanceId() #existing instance if instanceId != 0 : if not checkConditions(player, False) : return 0 foundworld = False for worldid in self.world_ids : if worldid == instanceId : foundworld = True if not foundworld: player.sendPacket(SystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER)) return 0 teleto.instanceId = instanceId teleportPlayer(self, player, teleto) return instanceId #new instance else: if not checkConditions(player, True) : return 0 instanceId = InstanceManager.getInstance().createDynamicInstance(template) if not instanceId in self.world_ids : world = PyObject() world.rewarded = [] world.instanceId = instanceId self.worlds[instanceId] = world self.world_ids.append(instanceId) self.currentWorld = instanceId instanceObj = InstanceManager.getInstance().getInstance(instanceId) print "地獄舊市區:使用 " + template + " 即時地區:" +str(instanceId) + " 創造玩家:" + str(player.getName()) runStartRoom(self, world) # teleports player teleto.instanceId = instanceId for partyMember in party.getPartyMembers().toArray() : teleportPlayer(self, partyMember, teleto) return instanceId return instanceId
def enterInstance(self,player,template,teleto): instanceId = 0 if not checkCondition(player): return 0 party = player.getParty() # Check for existing instances of party members for partyMember in party.getPartyMembers().toArray(): if partyMember.getInstanceId()!=0: instanceId = partyMember.getInstanceId() if debug: print "Emerald/Steam: found party member in instance:"+str(instanceId) # Existing instance if instanceId != 0: foundworld = False for worldid in self.world_ids: if worldid == instanceId: foundworld = True if not foundworld: player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。")) return 0 teleto.instanceId = instanceId teleportplayer(self,player,teleto,True) return instanceId # New instance else: instanceId = InstanceManager.getInstance().createDynamicInstance(template) if not self.worlds.has_key(instanceId): world = PyObject() world.instanceId = instanceId world.bosses = 5 self.worlds[instanceId]=world self.world_ids.append(instanceId) if debug: print "Emerald/Steam Instance: " +str(instanceId) + " created by player: " + str(player.getName()) # Close all doors for door in InstanceManager.getInstance().getInstance(instanceId).getDoors(): door.closeMe() # Start the first room runEmeraldAndSteamFirstRoom(self,world) # Teleports player for partyMember in party.getPartyMembers().toArray() : st = partyMember.getQuestState(qn) if not st : st = self.newQuestState(partyMember) st.takeItems(9694,-1) st.takeItems(9698,-1) st.takeItems(9699,-1) teleto.instanceId = instanceId teleportplayer(self,partyMember,teleto,True) return instanceId return instanceId
def enterInstance(self, player, template, tele): if not checkPrimaryConditions(player): return tele = PyObject() dataIndex = getDcmIndex(DcmLevel) tele.x = DcmPorts[dataIndex][0] tele.y = DcmPorts[dataIndex][1] tele.z = DcmPorts[dataIndex][2] instanceId = getExistingInstanceId(player) if instanceId == 0: #brand new instance if not checkNewInstanceConditions(player): return instanceId = InstanceManager.getInstance().createDynamicInstance( DcmTemplate[dataIndex]) if not self.worlds.has_key(instanceId): world = PyObject() world.rewarded = [] world.instanceId = instanceId self.worlds[instanceId] = world self.world_ids.append(instanceId) self.currentWorld = instanceId instanceObj = InstanceManager.getInstance().getInstance(instanceId) instanceObj.setAllowSummon(False) instanceObj.setReturnTeleport(ReturnPort[dataIndex][0], ReturnPort[dataIndex][1], ReturnPort[dataIndex][2]) print "暗雲宅邸:使用 " + InstanceTemplate + " 即時地區:" + str( instanceId) + " 創造玩家:" + str(player.getName()) runStartRoom(self, world) tele.instanceId = instanceId teleportPlayer(self, player, tele) party = player.getParty() if party != None: for partyMember in party.getPartyMembers().toArray(): teleportPlayer(self, partyMember, tele) else: foundworld = False for worldid in self.world_ids: if worldid == instanceId: foundworld = True if not foundworld: player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。")) return tele.instanceId = instanceId teleportPlayer(self, player, tele) return
def checkNewInstanceConditions(player): if not player.getParty().isLeader(player): player.sendPacket( SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False party = player.getParty() if party == None: return True for partyMember in party.getPartyMembers().toArray(): if not isWithinLevel(partyMember): sm = SystemMessage( SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray(): if not partyMember.isInsideRadius(player, 500, False, False): sm = SystemMessage( SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def onAcquireSkillList (self, npc, player) : asl = AcquireSkillList(AcquireSkillList.SkillType.unk4) st = player.getQuestState(qn) oldSkills = player.getAllSkills() count = 0 for i in SKILLITEMS: for j in SUBSKILLS[i]: minLevel = 0 maxLevel = SkillTable.getInstance().getMaxLevel(j) for oldsk in oldSkills: if oldsk.getId() == j: minLevel = oldsk.getLevel() if minLevel < maxLevel: count+=1 asl.addSkill(j, minLevel+1, maxLevel, 0, 0) player.sendPacket(asl) if count == 0: player.sendPacket(SystemMessage(SystemMessageId.NO_MORE_SKILLS_TO_LEARN)) return ""
def enterInstance(self, player, template, tele) : if not checkPrimaryConditions(player) : return tele = PyObject() dataIndex = getDcmIndex(DcmLevel) tele.x = DcmPorts[dataIndex][0] tele.y = DcmPorts[dataIndex][1] tele.z = DcmPorts[dataIndex][2] instanceId = getExistingInstanceId(player) if instanceId == 0 : #brand new instance if not checkNewInstanceConditions(player) : return instanceId = InstanceManager.getInstance().createDynamicInstance(DcmTemplate[dataIndex]) if not self.worlds.has_key(instanceId) : world = PyObject() world.rewarded = [] world.instanceId = instanceId self.worlds[instanceId] = world self.world_ids.append(instanceId) self.currentWorld = instanceId instanceObj = InstanceManager.getInstance().getInstance(instanceId) instanceObj.setAllowSummon(False) instanceObj.setReturnTeleport(ReturnPort[dataIndex][0],ReturnPort[dataIndex][1],ReturnPort[dataIndex][2]) print "暗雲宅邸:使用 " + InstanceTemplate + " 即時地區:" + str(instanceId) + " 創造玩家:" + str(player.getName()) runStartRoom(self, world) tele.instanceId = instanceId teleportPlayer(self, player, tele) party = player.getParty() if party != None : for partyMember in party.getPartyMembers().toArray() : teleportPlayer(self, partyMember, tele) else: foundworld = False for worldid in self.world_ids : if worldid == instanceId : foundworld = True if not foundworld: player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。")) return tele.instanceId = instanceId teleportPlayer(self, player, tele) return
def onAcquireSkill (self, npc, player, skill) : if player.isSubClassActive(): player.sendMessage("You are trying to learn skill that u can't.."); Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to learn skill that he can't!!!", Config.DEFAULT_PUNISH); return "false" st = player.getQuestState(qn) for i in SKILLITEMS: if skill.getId() in SUBSKILLS[i]: for var in QUESTVARSITEMS: if i in QUESTVARSITEMS[var]: for j in range(Config.MAX_SUBCLASS): qvar = st.getGlobalQuestVar(var+str(j+1)) if qvar != "" and qvar != "0" and not qvar.endswith(";") : Item = player.getInventory().getItemByObjectId(int(qvar)) if Item and Item.getItemId() == i: player.destroyItem(qn,int(qvar), 1, player, 0) st.saveGlobalQuestVar(var+str(j+1),str(skill.getId())+";") return "true" player.sendPacket(SystemMessage(SystemMessageId.ITEM_MISSING_TO_LEARN_SKILL)) return "false"
def enterInstance(self, player, template, teleto): instanceId = 0 if not checkCondition(player): return 0 party = player.getParty() # Check for existing instances of party members for partyMember in party.getPartyMembers().toArray(): if partyMember.getInstanceId() != 0: instanceId = partyMember.getInstanceId() # Existing instance if instanceId != 0: foundWorld = False for worldid in self.world_ids: if worldid == instanceId: foundWorld = True if not foundWorld: player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。")) return teleto.instanceId = instanceId teleportPlayer(self, player, teleto) return instanceId # New instance else: instanceId = InstanceManager.getInstance().createDynamicInstance( template) if not self.worlds.has_key(instanceId): world = PyObject() world.instanceId = instanceId self.worlds[instanceId] = world self.world_ids.append(instanceId) print "Tower of Infinity: started " + template + " Instance: " + str( instanceId) + " created by player: " + str(player.getName()) runFloor(self, world, 0) # teleports player for partyMember in party.getPartyMembers().toArray(): st = partyMember.getQuestState(qn) if not st: st = self.newQuestState(partyMember) teleto.instanceId = instanceId teleportPlayer(self, partyMember, teleto) return instanceId return instanceId
def enterInstance(self, player, template, teleto) : instanceId = 0 if not checkCondition(player) : return 0 party = player.getParty() # Check for existing instances of party members for partyMember in party.getPartyMembers().toArray() : if partyMember.getInstanceId() != 0 : instanceId = partyMember.getInstanceId() # Existing instance if instanceId != 0 : foundWorld = False for worldid in self.world_ids : if worldid == instanceId : foundWorld = True if not foundWorld : player.sendPacket(SystemMessage.sendString("你的隊員已進入其它的即時地區。")) return teleto.instanceId = instanceId teleportPlayer(self, player, teleto) return instanceId # New instance else : instanceId = InstanceManager.getInstance().createDynamicInstance(template) if not self.worlds.has_key(instanceId) : world = PyObject() world.instanceId = instanceId self.worlds[instanceId] = world self.world_ids.append(instanceId) print "Tower of Infinity: started " + template + " Instance: " +str(instanceId) + " created by player: " + str(player.getName()) runFloor(self, world, 0) # teleports player for partyMember in party.getPartyMembers().toArray() : st = partyMember.getQuestState(qn) if not st : st = self.newQuestState(partyMember) teleto.instanceId = instanceId teleportPlayer(self, partyMember, teleto) return instanceId return instanceId
def checkNewInstanceConditions(player) : if not player.getParty().isLeader(player) : player.sendPacket(SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False party = player.getParty() if party == None : return True for partyMember in party.getPartyMembers().toArray() : if not isWithinLevel(partyMember) : sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray() : if not partyMember.isInsideRadius(player, 500, False, False) : sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def checkPrimaryConditions(player): if not player.getParty(): player.sendPacket(SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER)) return False if not player.getParty().isLeader(player): player.sendPacket(SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False if not isPartySizeOk(player): player.sendPacket(SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER)) if not isWithinLevel(player): sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(player) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray(): if not partyMember.isInsideRadius(player, 500, False, False): sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def checkCondition(player): party = player.getParty() if not party: player.sendPacket( SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER)) return False if not player.getParty().isLeader(player): player.sendPacket( SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False for partyMember in party.getPartyMembers().toArray(): if not partyMember.getLevel() >= 78: sm = SystemMessage( SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray(): if not partyMember.isInsideRadius(player, 500, False, False): sm = SystemMessage( SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray(): item = partyMember.getInventory().getItemByItemId(CRYSTAL) if not item: sm = SystemMessage( SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def checkCondition(player): party = player.getParty() if not party: player.sendPacket( SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER)) return False if not player.getParty().isLeader(player): player.sendPacket( SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False membersCount = player.getParty().getMemberCount() if membersCount < 2: player.sendPacket( SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER)) return False for partyMember in party.getPartyMembers().toArray(): if not partyMember.getLevel() >= 78: sm = SystemMessage( SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray(): if not partyMember.isInsideRadius(player, 500, False, False): sm = SystemMessage( SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def onKill(self, npc, player, isPet): npcId = npc.getNpcId() if npcId == WANDERING_CARAVAN: bcertificate = player.getInventory().getItemByItemId( BASIC_CERTIFICATE) scertificate = player.getInventory().getItemByItemId( STANDARD_CERTIFICATE) if bcertificate and not scertificate: item = player.getInventory().addItem("Quest", MARK_BETRAYAL, 1, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu) sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) if npcId in [22334, 22335]: bcertificate = player.getInventory().getItemByItemId( BASIC_CERTIFICATE) scertificate = player.getInventory().getItemByItemId( STANDARD_CERTIFICATE) if bcertificate and not scertificate: item = player.getInventory().addItem("Quest", SCORPION_POISON_STINGER, 1, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu) sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) return
def checkPrimaryConditions(player): if not player.getParty(): player.sendPacket( SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER)) return False if not player.getParty().isLeader(player): player.sendPacket( SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False if not isPartySizeOk(player): player.sendPacket( SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER)) if not isWithinLevel(player): sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(player) player.sendPacket(sm) return False for partyMember in player.getParty().getPartyMembers().toArray(): if not partyMember.isInsideRadius(player, 500, False, False): sm = SystemMessage( SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def checkConditions(player, new) : party = player.getParty() if not party : player.sendPacket(SystemMessage(SystemMessageId.NOT_IN_PARTY_CANT_ENTER)) return False if not player.getParty().isLeader(player) : player.sendPacket(SystemMessage(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER)) return False if party and party.getMemberCount() < 2 : player.sendPacket(SystemMessage(SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER)) return False for partyMember in party.getPartyMembers().toArray(): if not partyMember.getLevel() >= 78 : sm = SystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT) sm.addCharName(partyMember) player.sendPacket(sm) return False if not Util.checkIfInRange(1000, player, partyMember, True) and new : sm = SystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED) sm.addCharName(partyMember) player.sendPacket(sm) return False return True
def EvolvePet(player,item,striderControlItem) : con = L2DatabaseFactory.getInstance().getConnection() statement = con.prepareStatement("UPDATE items SET item_id =? WHERE object_id=? AND owner_id=?") statement.setInt(1, striderControlItem) statement.setInt(2, item.getObjectId()) statement.setInt(3, player.getObjectId()) statement.execute() statement.close() con.close() sm1 = SystemMessage(SystemMessageId.S2_S1_DISAPPEARED) sm1.addItemName(item.getItemId()) sm1.addNumber(1) sm2 = SystemMessage(SystemMessageId.YOU_PICKED_UP_A_S1_S2) sm2.addNumber(item.getEnchantLevel()) sm2.addItemName(striderControlItem) player.sendPacket(sm1) player.sendPacket(sm2) player.sendPacket(ItemList(player, False)) return
def checkCondition(player): party = player.getParty() if party: player.sendPacket(SystemMessage.sendString("菲拉卡只能由單人挑戰。")) return False return True