Code: Select all
Bad RequestBypassToServer:java.lang.NullPointerException at net.sf.l2j.gameserver.model.quest.QuestState.getStateId(QuestState.java:181) at net.sf.l2j.gameserver.model.quest.Quest.createQuestInDb(Quest.java:740) at net.sf.l2j.gameserver.model.quest.Quest.newQuestState(Quest.java:182) at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.showQuestWindow(L2NpcInstance.java:1260) at net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance.onBypassFeedback(L2NpcInstance.java:928) at net.sf.l2j.gameserver.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:110) at net.sf.l2j.gameserver.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:79) 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)
Code: Select all
#Npc By RevoltadO - 30/11/2010#..........................import sysfrom net.sf.l2j import Configfrom net.sf.l2j.gameserver.model.quest import Statefrom net.sf.l2j.gameserver.model.quest import QuestStatefrom net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest qn = "99940_SafeEnchant" print "============================="print " NPC ENCHANTER - OK "print "=============================" QuestId = 99940QuestName = "SafeEnchant"QuestDesc = "custom" ENCHANT_CHECK = 1 AMOUNT_OF_ENCHANT = 3 PAYMENT_ITEM_ID = 4037 #6673 - festival adena 4037 - coin of luckPAYMENT_AMOUNT = 10 ENCHANT_NPC = 50019weapons = ['Sword','Blunt','Dagger','Bow','Pole','Etc','Fist','Dual Sword','Dual Fist','Big Sword','Big Blunt','Ancient','Crossbow','Rapier','Dual Dagger']#armors = ['Light','Heavy','Magic','Shield','Sigil']armors = ['None']jewels = ['None']#acceptableItemTypes = weapons+armors+jewelsacceptableItemTypes = weaponsclass Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onEvent (self,event,st) : if event == "choose_item" : htmltext = "" for Item in st.getPlayer().getInventory().getItems(): # given an item instance, get the item template to check what type it is itemType = Item.getItem().getItemType().toString() itemGrade = Item.getItem().getCrystalType() if itemType in acceptableItemTypes and itemGrade > 0 : htmltext += "<a action=\"bypass -h Quest 99940_SafeEnchant enchantItem_" + str(Item.getObjectId()) +"\">" + Item.getItem().getName() + "+" + str(Item.getEnchantLevel()) + "</a><br>" if htmltext == "": htmltext = "You have no enchantable items equiped or in your inventory." htmltext = "<html><title>Enchanter</title><body>Select Item do you want to enchant +7.<br>NPC Can Enchant item +0 Only:<br><br>" + htmltext + "</body></html>" elif event.startswith("enchantItem_"): # get the object id out of the event string objId = int(event.replace("enchantItem_", "")) # to avoid exploitation, check if the stored objectId still corresponds to an existing item Item = st.getPlayer().getInventory().getItemByObjectId(objId ) if Item : itemType = Item.getItem().getItemType().toString() itemEnchant = Item.getEnchantLevel() if st.getQuestItemsCount(PAYMENT_ITEM_ID) >= PAYMENT_AMOUNT : if (itemType in weapons and itemEnchant >= ENCHANT_CHECK) or (itemType in armors and itemEnchant >= ENCHANT_CHECK) or (itemType in jewels and itemEnchant >= ENCHANT_CHECK) : htmltext = "notPlusZero.htm" else : Item.setEnchantLevel(itemEnchant+AMOUNT_OF_ENCHANT) st.takeItems(PAYMENT_ITEM_ID, PAYMENT_AMOUNT) htmltext = "Congratulations.htm" else : htmltext = "notEnoughItems.htm" else : htmltext = "Error.htm" return htmltext 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 if npc.getNpcId() == ENCHANT_NPC : htmltext = "Start.htm" return htmltext QUEST = Quest(QuestId,str(QuestId) + "_" + QuestName,QuestDesc) QUEST.addStartNpc(ENCHANT_NPC)QUEST.addTalkId(ENCHANT_NPC)
Version Lastet: Interlude