Skip to content
Snippets Groups Projects
Commit a68aa922 authored by Rumen Nikiforov's avatar Rumen Nikiforov
Browse files

BETA: Quests from Jython to Java by nonom:

* 50_LanoscosSpecialBait
* 51_OFullesSpecialBait
* 52_WilliesSpecialBait
* 53_LinnaeusSpecialBait
parent ad5dc86b
No related branches found
No related tags found
No related merge requests found
Showing
with 161 additions and 383 deletions
......@@ -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
......
# 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)
\ No newline at end of file
# 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)
\ No newline at end of file
# 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)
\ No newline at end of file
# 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)
\ No newline at end of file
<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>
\ No newline at end of file
<a action="bypass -h Quest 50_LanoscosSpecialBait 31570-07.html">"Here they are."</a></body></html>
\ No newline at end of file
/*
* 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");
}
}
<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>
\ No newline at end of file
<a action="bypass -h Quest 51_OFullesSpecialBait 31572-07.html">"Here they are."</a></body></html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment