__init__.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. # Made by Fulminus, version 0.1
  2. import sys
  3. from com.l2jserver.gameserver.model.quest import State
  4. from com.l2jserver.gameserver.model.quest import QuestState
  5. from com.l2jserver.gameserver.model.quest import Quest as JQuest
  6. from com.l2jserver.util import Rnd
  7. qn = "234_FatesWhisper"
  8. PIPETTE_KNIFE = 4665
  9. REIRIAS_SOUL_ORB = 4666
  10. KERMONS_INFERNIUM_SCEPTER = 4667
  11. GOLCONDAS_INFERNIUM_SCEPTER = 4668
  12. HALLATES_INFERNIUM_SCEPTER = 4669
  13. REORINS_HAMMER = 4670
  14. REORINS_MOLD = 4671
  15. INFERNIUM_VARNISH = 4672
  16. RED_PIPETTE_KNIFE = 4673
  17. STAR_OF_DESTINY = 5011
  18. CRYSTAL_B = 1460
  19. BLOOD_STAINED_CLOTH = 14361
  20. WHITE_CLOTH = 14362
  21. #Reorin, Cliff, Ferris, Zenkin, Kaspar, Kernon's Chest, Golkonda's Chest, Hallate's Chest, Cabrio's "Coffer of the Dead"
  22. NPC=[31002,30182,30847,30178,30833,31028,31029,31030,31027]
  23. CHEST_SPAWNS = {
  24. 25035:31027, # Shilen's Messenger Cabrio
  25. 25054:31028, # Demon Kernon
  26. 25126:31029, # Golkonda, the Longhorn General
  27. 25220:31030 # Death Lord Hallate
  28. }
  29. #mobId=[cond,dropId,rate]
  30. DROPLIST={
  31. 20823: [8,BLOOD_STAINED_CLOTH,80],
  32. 20826: [8,BLOOD_STAINED_CLOTH,80],
  33. 20827: [8,BLOOD_STAINED_CLOTH,80],
  34. 20828: [8,BLOOD_STAINED_CLOTH,80],
  35. 20829: [8,BLOOD_STAINED_CLOTH,80],
  36. 21064: [8,BLOOD_STAINED_CLOTH,80],
  37. 21065: [8,BLOOD_STAINED_CLOTH,80],
  38. 21066: [8,BLOOD_STAINED_CLOTH,80],
  39. 21069: [8,BLOOD_STAINED_CLOTH,80],
  40. 21072: [8,BLOOD_STAINED_CLOTH,80],
  41. }
  42. Weapons={
  43. 79:"Sword of Damascus",
  44. 2626:"Samurai Dualsword",
  45. 287:"Bow of Peril",
  46. 97:"Lance",
  47. 175:"Art of Battle Axe",
  48. 210:"Staff of Evil Spirits",
  49. 234:"Demon Dagger" ,
  50. 268:"Bellion Cestus" ,
  51. 171:"Deadman's Glory" ,
  52. 7883:"Guardian Sword",
  53. 7889:"Wizard's Tear",
  54. 7901:"Star Buster",
  55. 7893:"Kaim Vanul's Bones"
  56. }
  57. class Quest (JQuest) :
  58. def __init__(self,id,name,descr):
  59. JQuest.__init__(self,id,name,descr)
  60. self.questItemIds = [BLOOD_STAINED_CLOTH,WHITE_CLOTH,PIPETTE_KNIFE,RED_PIPETTE_KNIFE]
  61. def onAdvEvent (self,event,npc, player) :
  62. htmltext = event
  63. st = self.getQuestState(player, False)
  64. if not st : return
  65. #accept quest
  66. if event == "1" :
  67. st.set("cond","1")
  68. st.setState(State.STARTED)
  69. htmltext = "31002-03.htm"
  70. # talking with cliff...last dialog to get the Infernium Varnish
  71. elif event == "30182_01" :
  72. htmltext = "30182-01c.htm"
  73. st.giveItems(INFERNIUM_VARNISH,1)
  74. # open Kernon's Chest
  75. elif event == "31028_01" :
  76. htmltext = "31028-02.htm"
  77. st.giveItems(KERMONS_INFERNIUM_SCEPTER,1)
  78. # open Hallate's Chest
  79. elif event == "31029_01" :
  80. htmltext = "31029-02.htm"
  81. st.giveItems(GOLCONDAS_INFERNIUM_SCEPTER,1)
  82. # open Golkonda's Chest
  83. elif event == "31030_01" :
  84. htmltext = "31030-02.htm"
  85. st.giveItems(HALLATES_INFERNIUM_SCEPTER,1)
  86. # dialog with Zenkin
  87. elif event == "30178_01" :
  88. st.set("cond","6")
  89. htmltext = "30178-01a.htm"
  90. # dialog with Kaspar - go to baium
  91. elif event == "30833_01a" :
  92. htmltext = "30833-01b.htm"
  93. st.giveItems(PIPETTE_KNIFE,1)
  94. st.set("cond","7")
  95. # dialog with Kaspar - go to toi
  96. elif event == "30833_01a2" :
  97. htmltext = "30833-01b2.htm"
  98. st.giveItems(WHITE_CLOTH,30)
  99. st.set("cond","8")
  100. ## FINAL ITEM EXCHANGE SECTION
  101. elif event.startswith("selectBGrade_"):
  102. if st.getInt("bypass") :
  103. return
  104. bGradeId = event.replace("selectBGrade_", "")
  105. st.set("weaponId",bGradeId)
  106. htmltext = st.showHtmlFile("31002-13.htm").replace("%weaponname%",Weapons[int(bGradeId)])
  107. elif event.startswith("confirmWeapon"):
  108. st.set("bypass","1")
  109. htmltext = st.showHtmlFile("31002-14.htm").replace("%weaponname%",Weapons[st.getInt("weaponId")])
  110. elif event.startswith("selectAGrade_"):
  111. if st.getInt("bypass"):
  112. if st.getQuestItemsCount(st.getInt("weaponId")) > 0 :
  113. aGradeItemId = int(event.replace("selectAGrade_", ""))
  114. htmltext = "31002-12.htm"
  115. st.takeItems(st.getInt("weaponId"),1)
  116. st.giveItems(aGradeItemId,1)
  117. st.giveItems(STAR_OF_DESTINY,1)
  118. st.exitQuest(False)
  119. st.unset("cond")
  120. st.unset("bypass")
  121. st.unset("weaponId")
  122. else:
  123. htmltext = st.showHtmlFile("31002-15.htm").replace("%weaponname%",Weapons[st.getInt("weaponId")])
  124. else:
  125. htmltext="<html><body>Maestro Reorin:<br>Are you trying to cheat me?! What happenned to the weapon you were about to give me for the neutralization of Infernum's evil aura?</body></html>"
  126. #st.exitQuest(1)
  127. return htmltext
  128. def onTalk (self,npc,player):
  129. htmltext = Quest.getNoQuestMsg(player)
  130. st = self.getQuestState(player, True)
  131. if not st : return htmltext
  132. npcId = npc.getId()
  133. id = st.getState()
  134. # first time when a player join the quest
  135. if id == State.CREATED:
  136. if player.getLevel() >= 75:
  137. htmltext = "31002-02.htm"
  138. else:
  139. htmltext = "31002-01.htm"
  140. st.exitQuest(1)
  141. return htmltext
  142. # if quest is already State.COMPLETED
  143. elif id == State.COMPLETED:
  144. return Quest.getAlreadyCompletedMsg(player)
  145. # if quest is accepted and in progress
  146. elif id == State.STARTED:
  147. cond =st.getInt("cond")
  148. if npcId == NPC[0] :
  149. if cond == 1 and not st.getQuestItemsCount(REIRIAS_SOUL_ORB) : # waiting for the orb
  150. htmltext = "31002-04b.htm"
  151. elif cond == 1 : #got the orb! Go to the next step (infernium scepter pieces)
  152. st.takeItems(REIRIAS_SOUL_ORB,1)
  153. htmltext = "31002-05.htm"
  154. st.set("cond","2")
  155. # waiting for infernium scepter pieces
  156. elif cond == 2 and (st.getQuestItemsCount(KERMONS_INFERNIUM_SCEPTER)+st.getQuestItemsCount(GOLCONDAS_INFERNIUM_SCEPTER)+st.getQuestItemsCount(HALLATES_INFERNIUM_SCEPTER) < 3) :
  157. htmltext = "31002-05c.htm"
  158. elif cond == 2 : #got the infernium scepter pieces! Go to the next step (infernium Varnish)
  159. st.takeItems(KERMONS_INFERNIUM_SCEPTER,1)
  160. st.takeItems(GOLCONDAS_INFERNIUM_SCEPTER,1)
  161. st.takeItems(HALLATES_INFERNIUM_SCEPTER,1)
  162. htmltext = "31002-06.htm"
  163. st.set("cond","3")
  164. # waiting for infernium varnish
  165. elif cond == 3 and not st.getQuestItemsCount(INFERNIUM_VARNISH) :
  166. htmltext = "31002-06b.htm"
  167. elif cond == 3 : #got the infernium varnish! Go to the next step (Reorin's Hammer)
  168. st.takeItems(INFERNIUM_VARNISH,1)
  169. htmltext = "31002-07.htm"
  170. st.set("cond","4")
  171. # waiting for Reorin's Hammer
  172. elif cond == 4 and not st.getQuestItemsCount(REORINS_HAMMER) :
  173. htmltext = "31002-07b.htm"
  174. elif cond == 4 : # got Reorin's Hammer! Go to the next step (Reorin's Mold)
  175. st.takeItems(REORINS_HAMMER,1)
  176. htmltext = "31002-08.htm"
  177. st.set("cond","5")
  178. elif cond < 10 : # waiting for Reorin's Mold
  179. htmltext = "31002-08b.htm"
  180. elif cond == 10 : # got Reorin's Mold! Go to the next step (B Crystals)
  181. st.takeItems(REORINS_MOLD,1)
  182. htmltext = "31002-09.htm"
  183. st.set("cond","11")
  184. qs = st.getPlayer().getQuestState("255_Tutorial")
  185. if qs:
  186. st.showQuestionMark(13)
  187. st.playSound("ItemSound.quest_tutorial")
  188. # waiting for 984 B Grade Crystals
  189. elif cond == 11 and (st.getQuestItemsCount(CRYSTAL_B) < 984) :
  190. htmltext = "31002-09a.htm"
  191. elif cond == 11 : # got the crystals
  192. st.takeItems(CRYSTAL_B,984)
  193. htmltext = "31002-BGradeList.htm"
  194. st.set("cond","12")
  195. # all is ready. Now give a menu to trade the B weapon for the player's choice of A Weapon.
  196. elif cond == 12:
  197. if st.getInt("bypass"): #weapon is set
  198. if st.getQuestItemsCount(st.getInt("weaponId")) > 0 : #have weapon
  199. htmltext = st.showHtmlFile("31002-AGradeList.htm").replace("%weaponname%",Weapons[st.getInt("weaponId")])
  200. else: #dont have
  201. htmltext = st.showHtmlFile("31002-15.htm").replace("%weaponname%",Weapons[st.getInt("weaponId")])
  202. else : #weapon not yet chosen
  203. htmltext = "31002-BGradeList.htm"
  204. ## CLIFF.
  205. # came to take the varnish
  206. elif npcId == NPC[1] and cond==3 and not st.getQuestItemsCount(INFERNIUM_VARNISH) :
  207. htmltext = "30182-01.htm"
  208. # you already got the varnish...why are you back?
  209. elif npcId == NPC[1] and (cond>=3 or st.getQuestItemsCount(INFERNIUM_VARNISH)) :
  210. htmltext = "30182-02.htm"
  211. ## FERRIS
  212. # go to take the mold
  213. elif npcId == NPC[2] and cond==4 and not st.getQuestItemsCount(REORINS_HAMMER) :
  214. htmltext = "30847-01.htm" # go to trader Zenkin
  215. st.giveItems(REORINS_HAMMER,1)
  216. # I already told you I don't have it!
  217. elif npcId == NPC[2] and cond>=4 :
  218. htmltext = "30847-02.htm" # go to trader Zenkin
  219. ## ZENKIN
  220. # go to take mold
  221. elif npcId == NPC[3] and cond==5 :
  222. htmltext = "30178-01.htm" # go to Magister Kaspar
  223. # I already told you I don't have it!
  224. elif npcId == NPC[3] and cond>5 :
  225. htmltext = "30178-02.htm" # go to Magister Kaspar
  226. ## KASPAR
  227. elif npcId == NPC[4]:
  228. # first visit: You have neither plain nor blooded knife.
  229. if cond==6 :
  230. htmltext = "30833-01.htm" # go to Magister Hanellin,etc. Get Baium's Blood with the pipette
  231. #revisit after you've gotten the mold: What are you still doing here?
  232. if cond > 9 :
  233. htmltext = "30833-04.htm" # Have you given the mold to Reorin, yet?
  234. # revisit before getting the blood: remind "go get the blood"
  235. if cond==7 and st.getQuestItemsCount(PIPETTE_KNIFE) and not st.getQuestItemsCount(RED_PIPETTE_KNIFE) :
  236. htmltext = "30833-02.htm" # go to Magister Hanellin,etc. Get Baium's Blood with the pipette
  237. # got the blood and I'm ready to proceed
  238. if cond==7 and not st.getQuestItemsCount(PIPETTE_KNIFE) and st.getQuestItemsCount(RED_PIPETTE_KNIFE) :
  239. htmltext = "30833-03.htm" # great! Here is your mold for Reorin
  240. st.takeItems(RED_PIPETTE_KNIFE,1)
  241. st.giveItems(REORINS_MOLD,1)
  242. st.set("cond","10")
  243. # get 30 blood cloths
  244. if cond==8:
  245. htmltext = "30833-02b.htm"
  246. # finished hunt 30 blood cloths, give reorin mold
  247. if cond==9:
  248. htmltext = "30833-03b.htm"
  249. st.takeItems(BLOOD_STAINED_CLOTH,-1)
  250. st.giveItems(REORINS_MOLD,1)
  251. st.set("cond","10")
  252. ## CHESTS FROM RAIDBOSSES
  253. elif cond==1 :
  254. if npcId ==NPC[8] and st.getQuestItemsCount(REIRIAS_SOUL_ORB)==0 :
  255. htmltext = "31027-01.htm"
  256. st.giveItems(REIRIAS_SOUL_ORB,1)
  257. st.playSound("ItemSound.quest_itemget")
  258. elif cond==2 :
  259. # Kernon's Chest
  260. if npcId == NPC[5] and st.getQuestItemsCount(KERMONS_INFERNIUM_SCEPTER)==0 :
  261. htmltext = "31028-01.htm"
  262. elif npcId == NPC[5] :
  263. htmltext = "<html><body>This chest looks empty</body></html>"
  264. # Golkonda's Chest
  265. elif npcId == NPC[6] and st.getQuestItemsCount(GOLCONDAS_INFERNIUM_SCEPTER)==0 :
  266. htmltext = "31029-01.htm"
  267. elif npcId == NPC[6] :
  268. htmltext = "<html><body>This chest looks empty</body></html>"
  269. # Hallate's Chest
  270. elif npcId == NPC[7] and st.getQuestItemsCount(HALLATES_INFERNIUM_SCEPTER)==0 :
  271. htmltext = "31030-01.htm"
  272. elif npcId == NPC[7] :
  273. htmltext = "<html><body>This chest looks empty</body></html>"
  274. return htmltext
  275. def onAttack (self, npc, player, damage, isPet, skill):
  276. st = self.getQuestState(player, False)
  277. if not st : return
  278. if st.getState() != State.STARTED : return
  279. if isPet : return
  280. if st.getInt("cond") == 7 and npc.getId() == 29020 :
  281. if player.getActiveWeaponItem() and player.getActiveWeaponItem().getId() == PIPETTE_KNIFE and st.getQuestItemsCount(RED_PIPETTE_KNIFE) == 0:
  282. st.giveItems(RED_PIPETTE_KNIFE,1)
  283. st.takeItems(PIPETTE_KNIFE,1)
  284. st.playSound("ItemSound.quest_itemget")
  285. return
  286. def onKill(self,npc,player,isPet):
  287. npcId=npc.getId()
  288. # the chests always spawn, even if the RB is killed with nobody nearby doing the quest.
  289. if npcId in CHEST_SPAWNS.keys() :
  290. self.addSpawn(CHEST_SPAWNS[npcId], npc.getX(), npc.getY(), npc.getZ(),npc.getHeading(), True, 60000)
  291. else :
  292. value,dropId,chance = DROPLIST[npcId]
  293. if chance > 0 and Rnd.get(100) < chance:
  294. party = player.getParty()
  295. if party :
  296. PartyQuestMembers = []
  297. for partyMember in party.getMembers().toArray() :
  298. if partyMember.isInsideRadius(player,1500,True,False):
  299. pst = partyMember.getQuestState(qn)
  300. if pst :
  301. if pst.getInt("cond") == 8 and pst.getQuestItemsCount(dropId) < 30 :
  302. PartyQuestMembers.append(pst)
  303. if len(PartyQuestMembers) == 0 : return
  304. stw = PartyQuestMembers[Rnd.get(len(PartyQuestMembers))]
  305. stw.giveItems(dropId,1)
  306. stw.takeItems(WHITE_CLOTH,1)
  307. stw.playSound("ItemSound.quest_itemget")
  308. if stw.getQuestItemsCount(dropId) >= 30:
  309. stw.set("cond","9")
  310. else:
  311. st = self.getQuestState(player, False)
  312. if not st : return
  313. if st.getState() != State.STARTED : return
  314. if npcId in DROPLIST.keys() :
  315. if st.getInt("cond") == value:
  316. if value == 8 and st.getQuestItemsCount(dropId) < 30:
  317. st.giveItems(dropId,1)
  318. st.takeItems(WHITE_CLOTH,1)
  319. st.playSound("ItemSound.quest_itemget")
  320. if st.getQuestItemsCount(dropId) >= 30:
  321. st.set("cond","9")
  322. return
  323. QUEST = Quest(234,qn,"Fate's Whisper")
  324. QUEST.addStartNpc(NPC[0])
  325. for npcId in NPC:
  326. QUEST.addTalkId(npcId)
  327. for mobId in DROPLIST.keys() :
  328. QUEST.addKillId(mobId)
  329. for mobId in CHEST_SPAWNS.keys() :
  330. QUEST.addKillId(mobId)
  331. QUEST.addAttackId(29020)