2.htm ====================== Item Information


Items Required
X 1
X


 

__init__.py ============= import sys from net.sf.l2j.gameserver.model.quest import State from net.sf.l2j.gameserver.model.quest import QuestState from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest from net.sf.l2j.gameserver import ItemTable ############################## Feel Free to add more Weapons ##########################################################################################################3 # Weapon enhancement definition WeaponID:[Icon, [Enhancement, newWeaponID, MaterialID, MaterialQuant], ...] EnhanceList={ # Bows' 5608:["weapon_carnium_bow_i", [["itemname", 288, 5575, 109000]]], 5609:["weapon_carnium_bow_i", [["itemname", 288, 5575, 109000]]], 5610:["weapon_carnium_bow_i", [["itemname", 288, 5575, 109000]]], 5611:["weapon_soul_bow_i", [["itemname", 289, 5575, 109000]]], 5612:["weapon_soul_bow_i", [["itemname", 289, 5575, 109000]]], 5613:["weapon_soul_bow_i", [["itemname", 289, 5575, 109000]]] # etc etc .. I'll add the rest here and set the correct item names !!!!!!!!!!!!!!!!!!!!!!!!!!! just from the plan items. } ############################################################## DO NOT MODIFY BELOW THIS LINE ##################################################################################### def getItemName(Item): ItemName = Item.getItem().getName() if Item.getEnchantLevel() > 0: ItemName = "+" + str(Item.getEnchantLevel()) + " " + ItemName return ItemName def getMaterialName(MaterialID): return "Ancient Adena" def getMaterialIcon(MaterialID): return "etc_ancient_adena_i00" # Main Code class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onEvent (self,event,st) : htmltext = event # shows you how much materials you need to enhance, ok button to go forward, too if event.startswith("2_"): reqEnh = event.replace("2_", "").split(".") ObjectID = int(reqEnh[0]) EnhancID = int(reqEnh[1]) Item = st.getPlayer().getInventory().getItemByObjectId(ObjectID) if Item.getItemId() in EnhanceList: Icon, Enhancements = EnhanceList[Item.getItemId()] Name, WeaponID, MaterialID, MaterialQuant = Enhancements[EnhancID] htmltext = st.showHtmlFile("2.htm") return htmltext.replace("", Name)\ .replace("", Icon+"00")\ .replace("", Icon+"01")\ .replace("", getItemName(Item))\ .replace("", getMaterialName(MaterialID))\ .replace("", getMaterialIcon(MaterialID))\ .replace("", str(MaterialQuant))\ .replace("", "3_" + str(Item.getObjectId()) + "." + str(EnhancID)) # this handles the whole enhance stuff with objectIds, not ItemIds... no html shows up.. just work and socket return elif event.startswith("3_"): reqEnh = event.replace("3_", "").split(".") ObjectID = int(reqEnh[0]) EnhancID = int(reqEnh[1]) Item = st.getPlayer().getInventory().getItemByObjectId(ObjectID) if Item.getItemId() in EnhanceList: Icon, Enhancements = EnhanceList[Item.getItemId()] Name, WeaponID, MaterialID, MaterialQuant = Enhancements[EnhancID] if st.getQuestItemsCount(MaterialID) >= MaterialQuant : EnchantLevel = Item.getEnchantLevel() st.getPlayer().getInventory().destroyItem(ObjectID, 1) NewItem = ItemTable.getInstance().createItem(WeaponID) NewItem.setEnchantLevel(EnchantLevel) st.getPlayer().getInventory().addItem(NewItem) st.takeItems(MaterialID, MaterialQuant) htmltext = "Enhancement has been successfully removed!" else : htmltext = "You do not have enough materials." # if event is 0, or has a bug... trade is canceled else : htmltext = "Trade has been cancelled." st.setState(COMPLETED) st.exitQuest(1) return htmltext # this just return new html, if the player can talk with this npc about that enhance stuff def onTalk (self,npc,st): npcId = npc.getNpcId() htmltext = "I have nothing to say to you." st.set("cond","0") st.setState(STARTED) htmltext = "" for Item in st.getPlayer().getInventory().getItems(): if Item.getItemId() in EnhanceList and not Item.isEquipped(): Icon, Enhancements = EnhanceList[Item.getItemId()] EnhancID = 0 for Name, WeaponID, MaterialID, MaterialQuant in Enhancements: htmltext += "\n\n" \ "\n\n" \ "
" + getItemName(Item) + ": " + Name + "
Remove Enhancement
\n" EnhancID += 1 if htmltext == "": htmltext = "You have no weapons with special abilities in your inventory" htmltext = "\nList:\n\n\n" + htmltext + "
\n
" return htmltext QUEST = Quest(1010,"1010_remove_mammon","Blacksmith") CREATED = State('Start', QUEST) STARTED = State('Started', QUEST) COMPLETED = State('Completed', QUEST) QUEST.setInitialState(CREATED) # init all npc to the correct stats for npcId in [8126]: QUEST.addStartNpc(npcId) STARTED.addTalkId(npcId) # always at the end, then it shows only up if anything is correct in the code.. no jython error.. because we cant check jython errors with idle print "importing blacksmith data: 1010_remove_mammon"