» Find Revision
L2J Revision Number: 3892
L2JDP Revision Number: 7000
I decided to tie Kamaloka with L2emu, took the script:
Code: Select all
# Testinstances/Kamaloka/Solo/Kamaloka20_30.pyinstances/Kamaloka/Solo/Kamaloka25_35.pyinstances/Kamaloka/Solo/Kamaloka30_40.pyinstances/Kamaloka/Solo/Kamaloka35_45.pyinstances/Kamaloka/Solo/Kamaloka40_50.pyinstances/Kamaloka/Solo/Kamaloka45_55.pyinstances/Kamaloka/Solo/Kamaloka50_60.pyinstances/Kamaloka/Solo/Kamaloka55_65.pyinstances/Kamaloka/Solo/Kamaloka60_70.pyinstances/Kamaloka/Solo/Kamaloka65_75.pyinstances/Kamaloka/Solo/Kamaloka70_80.pycustom/9010_PathFinder/__init__.pycustom/9011_KamalokaAch/__init__.py
Code: Select all
import sysfrom java.lang import Systemfrom com.l2jserver import L2DatabaseFactoryfrom com.l2jserver.gameserver.instancemanager import InstanceManagerfrom com.l2jserver.gameserver.model import L2ItemInstancefrom com.l2jserver.gameserver.model.actor.instance import L2PcInstancefrom com.l2jserver.gameserver.model.entity import Instancefrom com.l2jserver.gameserver.model.quest import Statefrom com.l2jserver.gameserver.model.quest import QuestStatefrom com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuestfrom com.l2jserver.gameserver.network import SystemMessageIdfrom com.l2jserver.gameserver.network.serverpackets import SystemMessagefrom com.l2jserver.util import Rnd Entrace = 32484Rewarder = 32485 KANABION = 22452APPEAR = [22453, 22454] #ITEMSHERBS = [8600, 8601, 8602, 8603, 8604, 8605]BATTLEHERBS = [8606, 8607, 8608, 8609, 8610] #REWARDS#Example: d,count,c,count,b,count.....REW1 = [13002, 2, 13002, 2, 13002, 2, 13002, 2, 13002, 2]REW2 = [10839, 1, 10838, 1, 10837, 1, 10836, 1, 12824, 1] qn = "Kamaloka20_30" class PyObject: pass def isWithinLevel(player): if player.getLevel() > 30: player.sendPacket(SystemMessage.sendString("You can't enter in kamaloka.")) return False if player.getLevel() < 20: player.sendPacket(SystemMessage.sendString("You can't enter in kamaloka.")) return False return True def checkConditions(player, new): party = player.getParty() if party: player.sendPacket(SystemMessage.sendString("You are currently in a party, so you cannot enter.")) return False if not player.checkKamaDate(3): player.sendPacket(SystemMessage.sendString("You can't enter in kamaloka.")) return False return True def teleportplayer(self, player, npc, teleto): player.setInstanceId(teleto.instanceId) player.teleToLocation(teleto.x, teleto.y, teleto.z) pet = player.getPet() if pet != None: pet.setInstanceId(teleto.instanceId) pet.teleToLocation(teleto.x, teleto.y, teleto.z) if npc.isInsideRadius(-13948, 123819, -3112, 500, 1, 0): instanceObj = InstanceManager.getInstance().getInstance(player.getInstanceId()) instanceObj.setReturnTeleport(-13870, 123767, -3117) elif npc.isInsideRadius(18228, 146030, -3088, 500, 1, 0): instanceObj = InstanceManager.getInstance().getInstance(player.getInstanceId()) instanceObj.setReturnTeleport(-13870, 123767, -3117) def enterInstance(self, player, npc, template, teleto): instanceId = 0 playerName = player.getName() if not checkConditions(player, True): return 0 if not isWithinLevel(player): 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) print "Kamaloka 20-30: started " + template + " Instance: " + str(instanceId) + " created by player: " + str(player.getName()) # teleports player teleto.instanceId = instanceId teleportplayer(self, player, npc, teleto) player.setKamaDate(3) playerName = player.getName() currentTime = System.currentTimeMillis() instanceOver = 1800000 + currentTime self.Kamaloka1st[playerName] = {} self.Kamaloka1st[playerName]['instance'] = instanceId self.Kamaloka1st[playerName]['timeStamp'] = instanceOver self.Kamaloka1st[playerName]['points'] = 0 self.Kamaloka1st[playerName]['count'] = 0 self.Kamaloka1st[playerName]['reward'] = 0 self.Kamaloka1st[playerName]['rewarded'] = 0 self.startQuestTimer("time", 1200000, None, player) return instanceId def exitInstance(player, tele): player.setInstanceId(0) player.teleToLocation(tele.x, tele.y, tele.z) pet = player.getPet() if pet != None: pet.setInstanceId(0) pet.teleToLocation(tele.x, tele.y, tele.z) class Quest(JQuest): def __init__(self, id, name, descr): JQuest.__init__(self, id, name, descr) self.worlds = {} self.world_ids = [] self.Kamaloka1st = {} def onAdvEvent (self, event, npc, player): st = player.getQuestState(qn) if not st: st = self.newQuestState(player) playerName = player.getName() curentInstance = self.Kamaloka1st[playerName]['instance'] if event == "time" and player and player.isOnline() and player.getInstanceId() == curentInstance: instanceObj = InstanceManager.getInstance().getInstance(player.getInstanceId()) instanceObj.setDuration(300000) instanceObj.removeNpcs() newpath = self.addSpawn(32485, 9261, -219862, -8021, 0, False, 0, False, curentInstance) if playerName in self.Kamaloka1st: if self.Kamaloka1st[playerName]['count'] < 10: self.Kamaloka1st[playerName]['reward'] = 1 elif self.Kamaloka1st[playerName]['count'] >= 10: self.Kamaloka1st[playerName]['reward'] = (self.Kamaloka1st[playerName]['points'] / self.Kamaloka1st[playerName]['count']) + 1 reward = self.Kamaloka1st[playerName]['reward'] count = self.Kamaloka1st[playerName]['count'] con = L2DatabaseFactory.getInstance().getConnection() insertion = con.prepareStatement("INSERT INTO kamaloka_results (char_name,Level,Grade,Count) VALUES (?,?,?,?)") insertion.setString(1, playerName) insertion.setInt(2, 2030) insertion.setInt(3, reward) insertion.setInt(4, count) insertion.executeUpdate() insertion.close(); try: con.close() except: pass elif event == "Reward": if playerName in self.Kamaloka1st and self.Kamaloka1st[playerName]['rewarded'] != 1: self.Kamaloka1st[playerName]['rewarded'] = 1 r = self.Kamaloka1st[playerName]['reward'] - 1 st.giveItems(REW1[r * 2], REW1[r * 2 + 1]) st.giveItems(REW2[r * 2], REW2[r * 2 + 1]) fullPath = "1.htm" return st.showHtmlFile(fullPath).replace("%kamaloka%", qn) elif event == "Exit": instanceObj = InstanceManager.getInstance().getInstance(player.getInstanceId()) instanceObj.removePlayers() InstanceManager.getInstance().destroyInstance(curentInstance) return def onTalk (self, npc, player): st = player.getQuestState(qn) if not st : st = self.newQuestState(player) npcId = npc.getNpcId() if npcId == Entrace: tele = PyObject() tele.x = 10025 tele.y = -219868 tele.z = -8021 playerName = player.getName() if playerName in self.Kamaloka1st: playerInstance = self.Kamaloka1st[playerName]['instance'] if InstanceManager.getInstance().instanceExist(playerInstance): currentTime = System.currentTimeMillis() if self.Kamaloka1st[playerName]['timeStamp'] > currentTime: player.setInstanceId(playerInstance) player.teleToLocation(tele.x, tele.y, tele.z) else: enterInstance(self, player, npc, "Kamaloka20_30.xml", tele) else: enterInstance(self, player, npc, "Kamaloka20_30.xml", tele) if not playerName in self.Kamaloka1st: enterInstance(self, player, npc, "Kamaloka20_30.xml", tele) if npcId == Rewarder: playerName = player.getName() if playerName in self.Kamaloka1st: if self.Kamaloka1st[playerName]['rewarded'] == 1: fullPath = "0.htm" return st.showHtmlFile(fullPath).replace("%kamaloka%", qn) switch = { 1: lambda:"D.htm", 2: lambda:"C.htm", 3: lambda:"B.htm", 4: lambda:"A.htm", 5: lambda:"S.htm", } fullPath = switch.get(self.Kamaloka1st[playerName]['reward'], lambda:"1.htm")() return st.showHtmlFile(fullPath).replace("%kamaloka%", qn) if not playerName in self.Kamaloka1st: return return def onKill(self, npc, player, isPet): st = player.getQuestState(qn) if not st : st = self.newQuestState(player) if self.worlds.has_key(npc.getInstanceId()): world = self.worlds[npc.getInstanceId()] playerName = player.getName() if playerName in self.Kamaloka1st: npcId = npc.getNpcId() if npcId == KANABION: self.Kamaloka1st[player.getName()]['count'] += 1 if Rnd.get(100) <= 85: new = self.addSpawn(APPEAR[0], npc.getX(), npc.getY(), npc.getZ(), 0, False, 0, False, npc.getInstanceId()) if Rnd.get(100) <= 65: st.dropItem(npc, player, HERBS[Rnd.get(len(HERBS))], 1) if Rnd.get(100) <= 1: st.dropItem(npc, player, 956, 1) elif npcId == APPEAR[0]: self.Kamaloka1st[player.getName()]['points'] += 1 if Rnd.get(100) <= 90: new = self.addSpawn(APPEAR[Rnd.get(len(APPEAR))], npc.getX(), npc.getY(), npc.getZ(), 0, False, 0, False, npc.getInstanceId()) if Rnd.get(100) <= 65: st.dropItem(npc, player, HERBS[Rnd.get(len(HERBS))], 1) if Rnd.get(100) <= 20: st.dropItem(npc, player, BATTLEHERBS[Rnd.get(len(BATTLEHERBS))], 1) if Rnd.get(100) <= 1: st.dropItem(npc, player, 956, 1) elif npcId == APPEAR[1]: self.Kamaloka1st[player.getName()]['points'] += 2 if Rnd.get(100) <= 65: st.dropItem(npc, player, HERBS[Rnd.get(len(HERBS))], 1) if Rnd.get(100) <= 25: st.dropItem(npc, player, BATTLEHERBS[Rnd.get(len(BATTLEHERBS))], 1) if Rnd.get(100) <= 20: new = self.addSpawn(APPEAR[1], npc.getX(), npc.getY(), npc.getZ(), 0, False, 0, False, npc.getInstanceId()) if Rnd.get(1000) <= 11: st.dropItem(npc, player, 956, 1) if not playerName in self.Kamaloka1st: return return QUEST = Quest(-1, qn, "instances") QUEST.addStartNpc(Entrace)QUEST.addTalkId(Entrace)QUEST.addTalkId(Rewarder)for i in APPEAR: QUEST.addKillId(i)QUEST.addKillId(KANABION)
Code: Select all
D:\server\gameserver\data\scripts\instances\Kamaloka\Solo\Kamaloka20_30.pyTraceback (innermost last): File "Kamaloka20_30.py", line 180, in onTalk File "Kamaloka20_30.py", line 71, in enterInstance File "Kamaloka20_30.py", line 49, in checkConditionsAttributeError: checkKamaDate at org.python.core.Py.AttributeError(Unknown Source) at org.python.core.PyInstance.invoke(Unknown Source) at org.python.pycode.serializable._pyx1265225211324.checkConditions$3(Kamaloka20_30.py:49) at org.python.pycode.serializable._pyx1265225211324.call_function(Kamaloka20_30.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.pycode.serializable._pyx1265225211324.enterInstance$5(Kamaloka20_30.py:71) at org.python.pycode.serializable._pyx1265225211324.call_function(Kamaloka20_30.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.pycode.serializable._pyx1265225211324.onTalk$10(Kamaloka20_30.py:180) at org.python.pycode.serializable._pyx1265225211324.call_function(Kamaloka20_30.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyObject._jcallexc(Unknown Source) at org.python.core.PyObject._jcall(Unknown Source) at org.python.proxies.main$Quest$36.onTalk(Unknown Source) at com.l2jserver.gameserver.model.quest.Quest.notifyTalk(Quest.java:449) at com.l2jserver.gameserver.model.actor.L2Npc.showQuestWindow(L2Npc.java:1926) at com.l2jserver.gameserver.model.actor.L2Npc.onBypassFeedback(L2Npc.java:1449) at com.l2jserver.gameserver.model.actor.instance.L2NpcInstance.onBypassFeedback(L2NpcInstance.java:242) at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:131) at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:92) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)