__init__.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Made by disKret
  2. import sys
  3. from net.sf.l2j.gameserver.model.quest import State
  4. from net.sf.l2j.gameserver.model.quest import QuestState
  5. from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
  6. #CUSTOM VALUES
  7. DROPRATE=50
  8. REWARD1=900 #This is paid per item
  9. REWARD2=10000 #Extra reward, if > 100
  10. #NPC
  11. SILVA = 7686
  12. #ITEMS
  13. JADE_CRYSTAL = 5867
  14. class Quest (JQuest) :
  15. def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr)
  16. def onEvent (self,event,st) :
  17. htmltext = event
  18. if event == "7686-2.htm" :
  19. st.set("cond","1")
  20. st.setState(STARTED)
  21. st.playSound("ItemSound.quest_accept")
  22. elif event == "7686-7.htm" :
  23. count = st.getQuestItemsCount(JADE_CRYSTAL)
  24. if count:
  25. reward = count * REWARD1
  26. if count >= 100 :
  27. reward = reward + REWARD2
  28. st.takeItems(JADE_CRYSTAL,-1)
  29. st.giveItems(57,reward)
  30. else:
  31. htmltext="7686-4.htm"
  32. if event == "7686-8.htm" :
  33. st.playSound("ItemSound.quest_finish")
  34. st.exitQuest(1)
  35. return htmltext
  36. def onTalk (Self,npc,st):
  37. htmltext = "<html><head><body>I have nothing to say you</body></html>"
  38. id = st.getState()
  39. cond=st.getint("cond")
  40. jade = st.getQuestItemsCount(JADE_CRYSTAL)
  41. if cond == 0 :
  42. if st.getPlayer().getLevel() >= 47 :
  43. htmltext = "7686-0.htm"
  44. else:
  45. htmltext = "7686-0a.htm"
  46. st.exitQuest(1)
  47. elif not jade :
  48. htmltext = "7686-4.htm"
  49. elif jade :
  50. htmltext = "7686-6.htm"
  51. return htmltext
  52. def onKill (self,npc,st):
  53. chance = st.getRandom(100)
  54. if chance < DROPRATE :
  55. st.giveItems(JADE_CRYSTAL,1)
  56. st.playSound("ItemSound.quest_itemget")
  57. return
  58. QUEST = Quest(357,"357_WarehouseKeepersAmbition","Warehouse Keepers Ambition")
  59. CREATED = State('Start', QUEST)
  60. STARTED = State('Started', QUEST)
  61. QUEST.setInitialState(CREATED)
  62. QUEST.addStartNpc(SILVA)
  63. CREATED.addTalkId(SILVA)
  64. STARTED.addTalkId(SILVA)
  65. for MOBS in range(594,598) :
  66. STARTED.addKillId(MOBS)
  67. STARTED.addQuestDrop(SILVA,JADE_CRYSTAL,1)
  68. print "importing quests: 357: Warehouse Keepers Ambition"