Browse Source

BETA: Quests from Jython to Java by nonom:
* 50_LanoscosSpecialBait
* 51_OFullesSpecialBait
* 52_WilliesSpecialBait
* 53_LinnaeusSpecialBait

Rumen Nikiforov 13 years ago
parent
commit
a68aa9226d
37 changed files with 659 additions and 391 deletions
  1. 4 4
      L2J_DataPack_BETA/dist/game/data/scripts.cfg
  2. 0 93
      L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/__init__.py
  3. 0 91
      L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/__init__.py
  4. 0 91
      L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/__init__.py
  5. 0 102
      L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/__init__.py
  6. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-01.htm
  7. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-02.html
  8. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-03.htm
  9. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-04.html
  10. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-05.html
  11. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-06.htm
  12. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-07.html
  13. 155 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/Q50_LanoscosSpecialBait.java
  14. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-01.htm
  15. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-02.html
  16. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-03.htm
  17. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-04.html
  18. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-05.html
  19. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-06.htm
  20. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-07.html
  21. 155 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/Q51_OFullesSpecialBait.java
  22. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-01.htm
  23. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-02.html
  24. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-03.htm
  25. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-04.html
  26. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-05.html
  27. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-06.htm
  28. 0 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-07.html
  29. 155 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/Q52_WilliesSpecialBait.java
  30. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-0.htm
  31. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-0a.html
  32. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-1.htm
  33. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-2.html
  34. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-3.htm
  35. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-4.html
  36. 1 1
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-5.html
  37. 180 0
      L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/Q53_LinnaeusSpecialBait.java

+ 4 - 4
L2J_DataPack_BETA/dist/game/data/scripts.cfg

@@ -307,10 +307,10 @@ quests/46_OnceMoreInTheArmsOfTheMotherTree/__init__.py
 quests/47_IntoTheDarkForest/__init__.py
 quests/48_ToTheImmortalPlateau/__init__.py
 quests/49_TheRoadHome/__init__.py
-quests/50_LanoscosSpecialBait/__init__.py
-quests/51_OFullesSpecialBait/__init__.py
-quests/52_WilliesSpecialBait/__init__.py
-quests/53_LinnaeusSpecialBait/__init__.py
+quests/Q50_LanoscosSpecialBait/Q50_LanoscosSpecialBait.java
+quests/Q51_OFullesSpecialBait/Q51_OFullesSpecialBait.java
+quests/Q52_WilliesSpecialBait/Q52_WilliesSpecialBait.java
+quests/Q53_LinnaeusSpecialBait/Q53_LinnaeusSpecialBait.java
 quests/60_GoodWorkReward/__init__.py
 quests/61_LawEnforcement/__init__.py
 quests/62_PathoftheTrooper/__init__.py

+ 0 - 93
L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/__init__.py

@@ -1,93 +0,0 @@
-# This is essentially a DrLecter's copy&paste from
-# a Kilkenny's contribution to the Official L2J Datapack Project.
-# Visit http://www.l2jdp.com/trac if you find a bug.
-import sys
-from com.l2jserver import Config
-from com.l2jserver.gameserver.model.quest import State
-from com.l2jserver.gameserver.model.quest import QuestState
-from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
-
-qn = "50_LanoscosSpecialBait"
-
-#NPC
-LANOSCO = 31570
-#ITEMS
-ESSENCE_OF_WIND = 7621
-#REWARDS
-WIND_FISHING_LURE = 7610
-#MOB
-SINGING_WIND = 21026
-
-class Quest (JQuest) :
-
- def __init__(self,id,name,descr):
-     JQuest.__init__(self,id,name,descr)
-     self.questItemIds = [ESSENCE_OF_WIND]
-
- def onAdvEvent (self,event,npc, player) :
-   htmltext = event
-   st = player.getQuestState(qn)
-   if not st : return
-   if event == "31570-03.htm" :
-     st.set("cond","1")
-     st.setState(State.STARTED)
-     st.playSound("ItemSound.quest_accept")
-   elif event == "31570-07.htm" and st.getQuestItemsCount(ESSENCE_OF_WIND) == 100 :
-     htmltext = "31570-06.htm"
-     st.giveItems(WIND_FISHING_LURE,4)
-     st.takeItems(ESSENCE_OF_WIND,-1)
-     st.playSound("ItemSound.quest_finish")
-     st.unset("cond")
-     st.exitQuest(False)
-   return htmltext
-
- def onTalk (Self,npc,player):
-   htmltext = Quest.getNoQuestMsg(player)
-   st = player.getQuestState(qn)
-   if not st : return htmltext
-   npcId = npc.getNpcId()
-   id = st.getState()
-   cond = st.getInt("cond")
-   if id == State.COMPLETED :
-      htmltext = Quest.getAlreadyCompletedMsg(player)
-
-   elif cond == 0 :
-      if player.getLevel() >= 27 :
-         htmltext = "31570-01.htm"
-      else:
-         htmltext = "31570-02.htm"
-         st.exitQuest(1)
-   elif id == State.STARTED :
-      if st.getQuestItemsCount(ESSENCE_OF_WIND) == 100 :
-         htmltext = "31570-04.htm"
-      else :
-         htmltext = "31570-05.htm"
-   return htmltext
-
- def onKill(self,npc,player,isPet):
-   partyMember = self.getRandomPartyMember(player,"1")
-   if not partyMember : return
-   st = partyMember.getQuestState(qn)
-   if st :
-      count = st.getQuestItemsCount(ESSENCE_OF_WIND)
-      if st.getInt("cond") == 1 and count < 100 :
-         chance = 33 * Config.RATE_QUEST_DROP
-         numItems, chance = divmod(chance,100)
-         if self.getRandom(100) < chance : 
-            numItems += 1
-         if numItems :
-            if count + numItems >= 100 :
-               numItems = 100 - count
-               st.playSound("ItemSound.quest_middle")
-               st.set("cond","2")
-            else:
-               st.playSound("ItemSound.quest_itemget")
-            st.giveItems(ESSENCE_OF_WIND,int(numItems))
-   return
-
-QUEST       = Quest(50,qn,"Lanosco's Special Bait")
-
-QUEST.addStartNpc(LANOSCO)
-QUEST.addTalkId(LANOSCO)
-
-QUEST.addKillId(SINGING_WIND)

+ 0 - 91
L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/__init__.py

@@ -1,91 +0,0 @@
-# Contributed by Kilkenny to the Official L2J Datapack Project.
-# with little cleanups by DrLecter.
-# Visit http://www.l2jdp.com/trac if you find a bug.
-import sys
-from com.l2jserver import Config
-from com.l2jserver.gameserver.model.quest import State
-from com.l2jserver.gameserver.model.quest import QuestState
-from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
-
-qn = "51_OFullesSpecialBait"
-
-#NPC
-OFULLE = 31572
-#ITEMS
-LOST_BAIT = 7622
-#REWARDS
-ICY_AIR_LURE = 7611
-#MOB
-FETTERED_SOUL = 20552
-
-class Quest (JQuest) :
-
- def __init__(self,id,name,descr):
-     JQuest.__init__(self,id,name,descr)
-     self.questItemIds = [LOST_BAIT]
-
- def onEvent (self,event,st) :
-   htmltext = event
-   if event == "31572-03.htm" :
-     st.set("cond","1")
-     st.setState(State.STARTED)
-     st.playSound("ItemSound.quest_accept")
-   elif event == "31572-07.htm" and st.getQuestItemsCount(LOST_BAIT) == 100 :
-     htmltext = "31572-06.htm"
-     st.giveItems(ICY_AIR_LURE,4)
-     st.takeItems(LOST_BAIT,-1)
-     st.playSound("ItemSound.quest_finish")
-     st.exitQuest(False)
-     st.unset("cond")
-   return htmltext
-
- def onTalk (Self,npc,player):
-   htmltext = Quest.getNoQuestMsg(player)
-   st = player.getQuestState(qn)
-   if not st : return htmltext
-   npcId = npc.getNpcId()
-   id = st.getState()
-   cond = st.getInt("cond")
-   if id == State.COMPLETED :
-      htmltext = Quest.getAlreadyCompletedMsg(player)
-
-   elif cond == 0 :
-      if player.getLevel() >= 36 :
-         htmltext = "31572-01.htm"
-      else:
-         htmltext = "31572-02.htm"
-         st.exitQuest(1)
-   elif id == State.STARTED :
-      if st.getQuestItemsCount(LOST_BAIT) == 100 :
-         htmltext = "31572-04.htm"
-      else :
-         htmltext = "31572-05.htm"
-   return htmltext
-
- def onKill(self,npc,player,isPet):
-   partyMember = self.getRandomPartyMember(player,"1")
-   if not partyMember : return
-   st = partyMember.getQuestState(qn)
-   if st :
-      count = st.getQuestItemsCount(LOST_BAIT)
-      if st.getInt("cond") == 1 and count < 100 :
-         chance = 33 * Config.RATE_QUEST_DROP
-         numItems, chance = divmod(chance,100)
-         if self.getRandom(100) < chance : 
-            numItems += 1
-         if numItems :
-            if count + numItems >= 100 :
-               numItems = 100 - count
-               st.playSound("ItemSound.quest_middle")
-               st.set("cond","2")
-            else:
-               st.playSound("ItemSound.quest_itemget")
-            st.giveItems(LOST_BAIT,int(numItems))
-   return
-
-QUEST       = Quest(51,qn,"O'Fulle's Special Bait")
-
-QUEST.addStartNpc(OFULLE)
-QUEST.addTalkId(OFULLE)
-
-QUEST.addKillId(FETTERED_SOUL)

+ 0 - 91
L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/__init__.py

@@ -1,91 +0,0 @@
-# This is essentially a DrLecter's copy&paste from
-# a Kilkenny's contribution to the Official L2J Datapack Project.
-# Visit http://www.l2jdp.com/trac if you find a bug.
-import sys
-from com.l2jserver import Config
-from com.l2jserver.gameserver.model.quest import State
-from com.l2jserver.gameserver.model.quest import QuestState
-from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
-
-qn = "52_WilliesSpecialBait"
-
-#NPC
-WILLIE = 31574
-#ITEMS
-TARLK_EYE = 7623
-#REWARDS
-EARTH_FISHING_LURE = 7612
-#MOB
-TARLK_BASILISK = 20573
-
-class Quest (JQuest) :
-
- def __init__(self,id,name,descr):
-     JQuest.__init__(self,id,name,descr)
-     self.questItemIds = [TARLK_EYE]
-
- def onEvent (self,event,st) :
-   htmltext = event
-   if event == "31574-03.htm" :
-     st.set("cond","1")
-     st.setState(State.STARTED)
-     st.playSound("ItemSound.quest_accept")
-   elif event == "31574-07.htm" and st.getQuestItemsCount(TARLK_EYE) == 100 :
-     htmltext = "31574-06.htm"
-     st.giveItems(EARTH_FISHING_LURE,4)
-     st.takeItems(TARLK_EYE,-1)
-     st.playSound("ItemSound.quest_finish")
-     st.unset("cond")
-     st.exitQuest(False)
-   return htmltext
-
- def onTalk (Self,npc,player):
-   htmltext = Quest.getNoQuestMsg(player)
-   st = player.getQuestState(qn)
-   if not st : return htmltext
-   npcId = npc.getNpcId()
-   id = st.getState()
-   cond = st.getInt("cond")
-   if id == State.COMPLETED :
-      htmltext = Quest.getAlreadyCompletedMsg(player)
-
-   elif cond == 0 :
-      if player.getLevel() >= 48 :
-         htmltext = "31574-01.htm"
-      else:
-         htmltext = "31574-02.htm"
-         st.exitQuest(1)
-   elif id == State.STARTED :
-      if st.getQuestItemsCount(TARLK_EYE) == 100 :
-         htmltext = "31574-04.htm"
-      else :
-         htmltext = "31574-05.htm"
-   return htmltext
-
- def onKill(self,npc,player,isPet):
-   partyMember = self.getRandomPartyMember(player,"1")
-   if not partyMember : return
-   st = partyMember.getQuestState(qn)
-   if st :
-      count = st.getQuestItemsCount(TARLK_EYE)
-      if st.getInt("cond") == 1 and count < 100 :
-         chance = 33 * Config.RATE_QUEST_DROP
-         numItems, chance = divmod(chance,100)
-         if self.getRandom(100) < chance : 
-            numItems += 1
-         if numItems :
-            if count + numItems >= 100 :
-               numItems = 100 - count
-               st.playSound("ItemSound.quest_middle")
-               st.set("cond","2")
-            else:
-               st.playSound("ItemSound.quest_itemget")
-            st.giveItems(TARLK_EYE,int(numItems))
-   return
-
-QUEST       = Quest(52,qn,"Willie's Special Bait")
-
-QUEST.addStartNpc(WILLIE)
-QUEST.addTalkId(WILLIE)
-
-QUEST.addKillId(TARLK_BASILISK)

+ 0 - 102
L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/__init__.py

@@ -1,102 +0,0 @@
-# Linnaeus Special Bait - a seamless merge from Next and DooMita contributions
-import sys
-from com.l2jserver import Config
-from com.l2jserver.gameserver.model.quest import State
-from com.l2jserver.gameserver.model.quest import QuestState
-from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
-
-qn = "53_LinnaeusSpecialBait"
-
-LINNAEUS = 31577
-CRIMSON_DRAKE = 20670
-CRIMSON_DRAKE_HEART = 7624
-FLAMING_FISHING_LURE = 7613
-#Drop chance
-CHANCE = 50
-#Custom setting: wether or not to check for fishing skill level?
-#default False to require fishing skill level, any other value to ignore fishing
-#and evaluate char level only.
-ALT_IGNORE_FISHING=False
-
-def fishing_level(player):
-    if ALT_IGNORE_FISHING :
-       level=20
-    else :
-       level = player.getSkillLevel(1315)
-       effect = player.getFirstEffect(2274)
-       if effect:
-            level = int(effect.getSkill().getPower())
-    return level
-
-class Quest (JQuest):
-
- def __init__(self,id,name,descr):
-     JQuest.__init__(self,id,name,descr)
-     self.questItemIds = [CRIMSON_DRAKE_HEART]
-
- def onEvent (self,event,st):
-     htmltext = event
-     if event == "31577-1.htm":
-        st.setState(State.STARTED)
-        st.set("cond","1")
-        st.playSound("ItemSound.quest_accept")
-     elif event == "31577-3.htm":
-        cond = st.getInt("cond")
-        if cond == 2 and st.getQuestItemsCount(CRIMSON_DRAKE_HEART) == 100:
-           st.giveItems(FLAMING_FISHING_LURE, 4)
-           st.takeItems(CRIMSON_DRAKE_HEART, 100)                
-           st.exitQuest(False)
-           st.unset("cond") # we dont need it in db if quest is already State.COMPLETED
-           st.playSound("ItemSound.quest_finish")
-        else :
-           htmltext = "31577-5.htm"
-     return htmltext
-
- def onTalk (self,npc,player):
-     st = player.getQuestState(qn)
-     htmltext = Quest.getNoQuestMsg(player)
-     if not st: return htmltext
-     id = st.getState()
-     if id == State.COMPLETED:
-        htmltext = Quest.getAlreadyCompletedMsg(player)
-           
-     elif id == State.CREATED :
-        if player.getLevel() > 59 and fishing_level(player) > 19 :
-           htmltext= "31577-0.htm"
-        else:
-           st.exitQuest(1)
-           htmltext= "31577-0a.htm"
-     elif id == State.STARTED:
-        if st.getInt("cond") == 1:
-            htmltext = "31577-4.htm"
-        else :
-            htmltext = "31577-2.htm"
-     return htmltext
-
- def onKill(self,npc,player,isPet):
-     partyMember = self.getRandomPartyMember(player,"1")
-     if not partyMember : return
-     st = partyMember.getQuestState(qn)
-     if st :
-        count = st.getQuestItemsCount(CRIMSON_DRAKE_HEART)
-        if st.getInt("cond") == 1 and count < 100 :
-           chance = 33 * Config.RATE_QUEST_DROP
-           numItems, chance = divmod(chance,100)
-           if self.getRandom(100) < chance : 
-              numItems += 1
-           if numItems :
-              if count + numItems >= 100 :
-                 numItems = 100 - count
-                 st.playSound("ItemSound.quest_middle")
-                 st.set("cond","2")
-              else:
-                 st.playSound("ItemSound.quest_itemget")
-              st.giveItems(CRIMSON_DRAKE_HEART,int(numItems))
-     return
-
-QUEST       = Quest(53, qn, "Linnaeus Special Bait")
-
-QUEST.addStartNpc(LINNAEUS)
-QUEST.addTalkId(LINNAEUS)
-
-QUEST.addKillId(CRIMSON_DRAKE)

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/31570-01.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-01.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/31570-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-02.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/31570-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-03.htm


+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/31570-04.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-04.html

@@ -1,4 +1,4 @@
 <html><body>Fishermen's Guild Member Lanosco:<br>
 Thanks for your help. I can't get around to get the materials I need like I used to... Now I'll make the<font color="LEVEL"> bait of wind</font> for you. I use the repulsive power between the elements of water and wind. Just as water and air don't mix, things that are underwater begin to float.<br>
 Now, give me the<font color="LEVEL"> 100 essences of wind</font>!<br>
-<a action="bypass -h Quest 50_LanoscosSpecialBait 31570-07.htm">"Here they are."</a></body></html>
+<a action="bypass -h Quest 50_LanoscosSpecialBait 31570-07.html">"Here they are."</a></body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/31570-05.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-05.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/31570-06.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-06.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/50_LanoscosSpecialBait/31570-07.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/31570-07.html


+ 155 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q50_LanoscosSpecialBait/Q50_LanoscosSpecialBait.java

@@ -0,0 +1,155 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package quests.Q50_LanoscosSpecialBait;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ * Lanosco's Special Bait (50)<br>
+ * Original Jython script by Kilkenny
+ * @author nonom
+ */
+public class Q50_LanoscosSpecialBait extends Quest
+{
+	private static final String qn = "50_LanoscosSpecialBait";
+	
+	// NPCs
+	private static final int LANOSCO = 31570;
+	private static final int SINGING_WIND = 21026;
+	
+	// Items
+	private static final int ESSENCE_OF_WIND = 7621;
+	private static final int WIND_FISHING_LURE = 7610;
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = event;
+		final QuestState st = player.getQuestState(qn);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (event)
+		{
+			case "31570-03.htm":
+				st.set("cond", "1");
+				st.setState(State.STARTED);
+				st.playSound("ItemSound.quest_accept");
+				break;
+			case "31570-07.html":
+				if ((st.getInt("cond") == 2) && (st.getQuestItemsCount(ESSENCE_OF_WIND) >= 100))
+				{
+					htmltext = "31570-06.htm";
+					st.giveItems(WIND_FISHING_LURE, 4);
+					st.takeItems(ESSENCE_OF_WIND, -1);
+					st.playSound("ItemSound.quest_finish");
+					st.exitQuest(false);
+				}
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = getNoQuestMsg(player);
+		final QuestState st = player.getQuestState(qn);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (st.getState())
+		{
+			case State.COMPLETED:
+				htmltext = getAlreadyCompletedMsg(player);
+				break;
+			case State.CREATED:
+				htmltext = (player.getLevel() >= 27) ? "31570-01.htm" : "31570-02.html";
+				break;
+			case State.STARTED:
+				htmltext = (st.getInt("cond") == 1) ? "31570-04.html" : "31570-05.html";
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
+	{
+		final L2PcInstance partyMember = getRandomPartyMember(player, "1");
+		if (partyMember == null)
+		{
+			return null;
+		}
+		
+		final QuestState st = partyMember.getQuestState(qn);
+		if (st == null)
+		{
+			return null;
+		}
+		
+		final long count = st.getQuestItemsCount(ESSENCE_OF_WIND);
+		if ((st.getInt("cond") == 1) && (count < 100))
+		{
+			float chance = 33 * Config.RATE_QUEST_DROP;
+			float numItems = chance / 100;
+			chance = chance % 100;
+			
+			if (getRandom(100) < chance)
+			{
+				numItems += 1;
+			}
+			if (numItems > 0)
+			{
+				if ((count + numItems) >= 100)
+				{
+					numItems = 100 - count;
+				}
+				st.set("cond", "2");
+				st.playSound("ItemSound.quest_middle");
+			}
+			else
+			{
+				st.playSound("ItemSound.quest_itemget");
+			}
+			st.giveItems(ESSENCE_OF_WIND, (int) numItems);
+		}
+		
+		return super.onKill(npc, player, isPet);
+	}
+	
+	public Q50_LanoscosSpecialBait(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		
+		addStartNpc(LANOSCO);
+		addTalkId(LANOSCO);
+		addKillId(SINGING_WIND);
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q50_LanoscosSpecialBait(50, qn, "Lanosco's Special Bait");
+	}
+}

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/31572-01.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-01.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/31572-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-02.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/31572-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-03.htm


+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/31572-04.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-04.html

@@ -1,3 +1,3 @@
 <html><body>Fishermen's Guild Member O'Fulle:<br>
 Did you recover my stolen bait materials? Awesome! Please accept this<font color="LEVEL"> bait of chill</font> from my inventory as a token of my gratitude! Please give me the<font color="LEVEL"> 100 lost bait materials</font> that you found!<br>
-<a action="bypass -h Quest 51_OFullesSpecialBait 31572-07.htm">"Here they are."</a></body></html>
+<a action="bypass -h Quest 51_OFullesSpecialBait 31572-07.html">"Here they are."</a></body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/31572-05.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-05.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/31572-06.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-06.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/51_OFullesSpecialBait/31572-07.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/31572-07.html


+ 155 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q51_OFullesSpecialBait/Q51_OFullesSpecialBait.java

@@ -0,0 +1,155 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package quests.Q51_OFullesSpecialBait;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ * O'Fulle's Special Bait (51)<br>
+ * Original Jython script by Kilkenny
+ * @author nonom
+ */
+public class Q51_OFullesSpecialBait extends Quest
+{
+	private static final String qn = "51_OFullesSpecialBait";
+	
+	// NPCs
+	private static final int OFULLE = 31572;
+	private static final int FETTERED_SOUL = 20552;
+	
+	// Items
+	private static final int LOST_BAIT = 7622;
+	private static final int ICY_AIR_LURE = 7611;
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = event;
+		final QuestState st = player.getQuestState(qn);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (event)
+		{
+			case "31572-03.htm":
+				st.set("cond", "1");
+				st.setState(State.STARTED);
+				st.playSound("ItemSound.quest_accept");
+				break;
+			case "31572-07.html":
+				if ((st.getInt("cond") == 2) && (st.getQuestItemsCount(LOST_BAIT) >= 100))
+				{
+					htmltext = "31572-06.htm";
+					st.giveItems(ICY_AIR_LURE, 4);
+					st.takeItems(LOST_BAIT, -1);
+					st.playSound("ItemSound.quest_finish");
+					st.exitQuest(false);
+				}
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = getNoQuestMsg(player);
+		final QuestState st = player.getQuestState(qn);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (st.getState())
+		{
+			case State.COMPLETED:
+				htmltext = getAlreadyCompletedMsg(player);
+				break;
+			case State.CREATED:
+				htmltext = (player.getLevel() >= 36) ? "31572-01.htm" : "31572-02.html";
+				break;
+			case State.STARTED:
+				htmltext = (st.getInt("cond") == 1) ? "31572-04.html" : "31572-05.html";
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
+	{
+		final L2PcInstance partyMember = getRandomPartyMember(player, "1");
+		if (partyMember == null)
+		{
+			return null;
+		}
+		
+		final QuestState st = partyMember.getQuestState(qn);
+		if (st == null)
+		{
+			return null;
+		}
+		
+		final long count = st.getQuestItemsCount(LOST_BAIT);
+		if ((st.getInt("cond") == 1) && (count < 100))
+		{
+			float chance = 33 * Config.RATE_QUEST_DROP;
+			float numItems = chance / 100;
+			chance = chance % 100;
+			
+			if (getRandom(100) < chance)
+			{
+				numItems += 1;
+			}
+			if (numItems > 0)
+			{
+				if ((count + numItems) >= 100)
+				{
+					numItems = 100 - count;
+				}
+				st.set("cond", "2");
+				st.playSound("ItemSound.quest_middle");
+			}
+			else
+			{
+				st.playSound("ItemSound.quest_itemget");
+			}
+			st.giveItems(LOST_BAIT, (int) numItems);
+		}
+		
+		return super.onKill(npc, player, isPet);
+	}
+	
+	public Q51_OFullesSpecialBait(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		
+		addStartNpc(OFULLE);
+		addTalkId(OFULLE);
+		addKillId(FETTERED_SOUL);
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q51_OFullesSpecialBait(51, qn, "O'Fulle's Special Bait");
+	}
+}

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/31574-01.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-01.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/31574-02.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-02.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/31574-03.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-03.htm


+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/31574-04.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-04.html

@@ -1,3 +1,3 @@
 <html><body>Fishermen's Guild Member Willie:<br>
 Good job, my friend! You brought everything I need to make the bait! You're really getting a good deal! Well, our guild wants to build our customer base, so we work for free! OK, give me the eyes...<br>
-<a action="bypass -h Quest 52_WilliesSpecialBait 31574-07.htm">"Here they are."</a></body></html>
+<a action="bypass -h Quest 52_WilliesSpecialBait 31574-07.html">"Here they are."</a></body></html>

+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/31574-05.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-05.html


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/31574-06.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-06.htm


+ 0 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/52_WilliesSpecialBait/31574-07.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/31574-07.html


+ 155 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q52_WilliesSpecialBait/Q52_WilliesSpecialBait.java

@@ -0,0 +1,155 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package quests.Q52_WilliesSpecialBait;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ * Willie's Special Bait (52)<br>
+ * Original Jython script by Kilkenny
+ * @author nonom
+ */
+public class Q52_WilliesSpecialBait extends Quest
+{
+	private static final String qn = "52_WilliesSpecialBait";
+	
+	// NPCs
+	private static final int WILLIE = 31574;
+	private static final int TARLK_BASILISK = 20573;
+	
+	// Items
+	private static final int TARLK_EYE = 7623;
+	private static final int EARTH_FISHING_LURE = 7612;
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = event;
+		final QuestState st = player.getQuestState(qn);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (event)
+		{
+			case "31574-03.htm":
+				st.set("cond", "1");
+				st.setState(State.STARTED);
+				st.playSound("ItemSound.quest_accept");
+				break;
+			case "31574-07.html":
+				if ((st.getInt("cond") == 2) && (st.getQuestItemsCount(TARLK_EYE) >= 100))
+				{
+					htmltext = "31574-06.htm";
+					st.giveItems(EARTH_FISHING_LURE, 4);
+					st.takeItems(TARLK_EYE, -1);
+					st.playSound("ItemSound.quest_finish");
+					st.exitQuest(false);
+				}
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = getNoQuestMsg(player);
+		final QuestState st = player.getQuestState(qn);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (st.getState())
+		{
+			case State.COMPLETED:
+				htmltext = getAlreadyCompletedMsg(player);
+				break;
+			case State.CREATED:
+				htmltext = (player.getLevel() >= 48) ? "31574-01.htm" : "31574-02.html";
+				break;
+			case State.STARTED:
+				htmltext = (st.getInt("cond") == 1) ? "31574-04.html" : "31574-05.html";
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
+	{
+		final L2PcInstance partyMember = getRandomPartyMember(player, "1");
+		if (partyMember == null)
+		{
+			return null;
+		}
+		
+		final QuestState st = partyMember.getQuestState(qn);
+		if (st == null)
+		{
+			return null;
+		}
+		
+		final long count = st.getQuestItemsCount(TARLK_EYE);
+		if ((st.getInt("cond") == 1) && (count < 100))
+		{
+			float chance = 33 * Config.RATE_QUEST_DROP;
+			float numItems = chance / 100;
+			chance = chance % 100;
+			
+			if (getRandom(100) < chance)
+			{
+				numItems += 1;
+			}
+			if (numItems > 0)
+			{
+				if ((count + numItems) >= 100)
+				{
+					numItems = 100 - count;
+				}
+				st.set("cond", "2");
+				st.playSound("ItemSound.quest_middle");
+			}
+			else
+			{
+				st.playSound("ItemSound.quest_itemget");
+			}
+			st.giveItems(TARLK_EYE, (int) numItems);
+		}
+		
+		return super.onKill(npc, player, isPet);
+	}
+	
+	public Q52_WilliesSpecialBait(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		
+		addStartNpc(WILLIE);
+		addTalkId(WILLIE);
+		addKillId(TARLK_BASILISK);
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q52_WilliesSpecialBait(52, qn, "Willie's Special Bait");
+	}
+}

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/31577-0.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-0.htm

@@ -1,4 +1,4 @@
-<html><body>Fishing Guild Member Linneus:<br>
+<html><body>Fishing Guild Member Linnaeus:<br>
 Theese days, many nobles enjoy fishing. We fishermen like to take our time while fishing, but the nobles prefer to quickly catch things other than fish.<br>
 They're quite particular about who is allowed to use the special bait, but I don't think they'd have a problem with my giving it to a fine soldier like you! Of course, I can't legally sell it to you, but if you bring me the ingredients I need, I'll make it for you for free! Don't be surprised if you pull in a treasure box when you start using this bait! It uses the power of the elements to retrieve sunken treasure! Will you bring me the materials I need?<br>
 <a action="bypass -h Quest 53_LinnaeusSpecialBait 31577-1.htm">I'll do it.</a>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/31577-0a.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-0a.html

@@ -1,4 +1,4 @@
-<html><body>Fishermen's Guild Member Linneus:<br>
+<html><body>Fishermen's Guild Member Linnaeus:<br>
 Not long ago while fishing, I caught several strange boxes containing assorted valuable items. They ended up being more valuable than fish!<br>
 I have a knack for finding these boxes, but I can't show you how to do it yet.<br>
 (This quest may only be undertaken by a character of level 60 or above with a fishing skill of 20.)

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/31577-1.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-1.htm

@@ -1,3 +1,3 @@
-<html><body>Fishing Guild Member Linneus:<br>
+<html><body>Fishing Guild Member Linnaeus:<br>
 The special bait I'm talking about is made of<font color="LEVEL"> Crimson Drake's Heart</font> at<font color="LEVEL"> Seal of Shilen</font>. This bait is called<font color="LEVEL"> Bait of Flame</font> to contain the power of flames. And it never easy to get the materials. Besides, it requires<font color="LEVEL"> 100</font> hearts. To make even a few baits, you need that number of hearts at least. If you want to get the special bait materials, there is something you have to bear in mind. That is to use the power of flame extracted from Crimson Drake's Heart containing evil thoughts of flame for the bait. When the power of fire incompatible to water is contained in the bait and thrown in the water, things that must not stay in the water are pulled out. Ultimately, it depends on your fishing skills, but you can take out anything from the water if you had special bait with the attributes of flame.
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/31577-2.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-2.html

@@ -1,4 +1,4 @@
-<html><body>Fishing Guild Member Linneus:<br>
+<html><body>Fishing Guild Member Linnaeus:<br>
 You already came back. Being such a famous person, you clearly have different ability. You've obtained all the bait materials to make the bait with the attributes of flame, haven't you? Frankly, I should charge you for the production itself, but wouldn't do that since you're a well-known soldier. This is also a type of advertisement. This bait utilizes the repulsive force between the elements. Like the water and fire don't mix together, the thing sunken like boxes in the water will float if you use the<font color="LEVEL"> Bait of Flame</font>. Then, will you give me the materials that you got now?<br>
 <a action="bypass -h Quest 53_LinnaeusSpecialBait 31577-3.htm">Give the hearts</a>
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/31577-3.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-3.htm

@@ -1,4 +1,4 @@
-<html><body>Fishing Guild Member Linneus:<br>
+<html><body>Fishing Guild Member Linnaeus:<br>
 You've obtained all the crimson drake's hearts. Please accept this<font color="LEVEL"> bait of flame</font>. You'll find it quite different than baits containing the other elements. You won't catch any fish with it, but you're more likely to discover a sunken Treasure Chest! You won't always land your catch with this bait.<br>
 This bait is mostly useless unless your fishing level is exectly 20. If it's not, you should consider giving it to someone else. Remember, bring anything you recover to me unopened!
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/31577-4.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-4.html

@@ -1,3 +1,3 @@
-<html><body>Fishing Guild Member Linneus:<br>
+<html><body>Fishing Guild Member Linnaeus:<br>
 You still haven't obtained the<font color="LEVEL"> 100 crimson drake's hearts</font> I need to make the bait. Since I'm making it for free, the least you can do is bring the materials I need!
 </body></html>

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/quests/53_LinnaeusSpecialBait/31577-5.htm → L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/31577-5.html

@@ -1,3 +1,3 @@
-<html><body>Fishermen's Guild Member Linneus:<br>
+<html><body>Fishermen's Guild Member Linnaeus:<br>
 You said you'd brought all of the Crimson Drake's Hearts, but they are not enough. I cannot make<font color="LEVEL"> Bait of Flame</font> containing the power of flame with these. Even though you are a famous soldier, you have to bring me the right materials for making it.
 </body></html>

+ 180 - 0
L2J_DataPack_BETA/dist/game/data/scripts/quests/Q53_LinnaeusSpecialBait/Q53_LinnaeusSpecialBait.java

@@ -0,0 +1,180 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package quests.Q53_LinnaeusSpecialBait;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.effects.L2Effect;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.quest.State;
+
+/**
+ * Linnaeus Special Bait (53)<br>
+ * Original Jython script by Next and DooMita
+ * @author nonom
+ */
+public class Q53_LinnaeusSpecialBait extends Quest
+{
+	private static final String qn = "53_LinnaeusSpecialBait";
+	
+	// NPCs
+	private static final int LINNAEUS = 31577;
+	private static final int CRIMSON_DRAKE = 20670;
+	
+	// Items
+	private static final int CRIMSON_DRAKE_HEART = 7624;
+	private static final int FLAMING_FISHING_LURE = 7613;
+	
+	// Custom setting: wether or not to check for fishing skill level?
+	// default False to require fishing skill level, any other value to ignore fishing
+	// and evaluate char level only.
+	private static final boolean ALT_IGNORE_FISHING = false;
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = event;
+		final QuestState st = player.getQuestState(qn);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (event)
+		{
+			case "31577-1.htm":
+				st.set("cond", "1");
+				st.setState(State.STARTED);
+				st.playSound("ItemSound.quest_accept");
+				break;
+			case "31577-3.htm":
+				if ((st.getInt("cond") == 2) && (st.getQuestItemsCount(CRIMSON_DRAKE_HEART) >= 100))
+				{
+					st.giveItems(FLAMING_FISHING_LURE, 4);
+					st.takeItems(CRIMSON_DRAKE_HEART, -1);
+					st.playSound("ItemSound.quest_finish");
+					st.exitQuest(false);
+				}
+				else
+				{
+					htmltext = "31577-5.html";
+				}
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onTalk(L2Npc npc, L2PcInstance player)
+	{
+		String htmltext = getNoQuestMsg(player);
+		final QuestState st = player.getQuestState(qn);
+		if (st == null)
+		{
+			return htmltext;
+		}
+		
+		switch (st.getState())
+		{
+			case State.COMPLETED:
+				htmltext = getAlreadyCompletedMsg(player);
+				break;
+			case State.CREATED:
+				htmltext = ((player.getLevel() > 59) && (fishingLevel(player) > 19)) ? "31577-0.htm" : "31577-0a.html";
+				break;
+			case State.STARTED:
+				htmltext = (st.getInt("cond") == 1) ? "31577-4.html" : "31577-2.html";
+				break;
+		}
+		return htmltext;
+	}
+	
+	@Override
+	public String onKill(L2Npc npc, L2PcInstance player, boolean isPet)
+	{
+		final L2PcInstance partyMember = getRandomPartyMember(player, "1");
+		if (partyMember == null)
+		{
+			return null;
+		}
+		
+		final QuestState st = partyMember.getQuestState(qn);
+		if (st == null)
+		{
+			return null;
+		}
+		
+		final long count = st.getQuestItemsCount(CRIMSON_DRAKE_HEART);
+		if ((st.getInt("cond") == 1) && (count < 100))
+		{
+			float chance = 33 * Config.RATE_QUEST_DROP;
+			float numItems = chance / 100;
+			chance = chance % 100;
+			
+			if (getRandom(100) < chance)
+			{
+				numItems += 1;
+			}
+			if (numItems > 0)
+			{
+				if ((count + numItems) >= 100)
+				{
+					numItems = 100 - count;
+				}
+				st.set("cond", "2");
+				st.playSound("ItemSound.quest_middle");
+			}
+			else
+			{
+				st.playSound("ItemSound.quest_itemget");
+			}
+			st.giveItems(CRIMSON_DRAKE_HEART, (int) numItems);
+		}
+		
+		return super.onKill(npc, player, isPet);
+	}
+	
+	private int fishingLevel(L2PcInstance player)
+	{
+		int level = 20;
+		
+		if (!ALT_IGNORE_FISHING)
+		{
+			level = player.getSkillLevel(1315);
+			L2Effect effect = player.getFirstEffect(2274);
+			if (effect != null)
+			{
+				level = (int) effect.getSkill().getPower();
+			}
+		}
+		return level;
+	}
+	
+	public Q53_LinnaeusSpecialBait(int questId, String name, String descr)
+	{
+		super(questId, name, descr);
+		
+		addStartNpc(LINNAEUS);		
+		addTalkId(LINNAEUS);
+		addKillId(CRIMSON_DRAKE);
+	}
+	
+	public static void main(String[] args)
+	{
+		new Q53_LinnaeusSpecialBait(53, qn, "Linnaeus Special Bait");
+	}
+}