Skip to content
Snippets Groups Projects
Commit f6f6ef69 authored by Adry_85's avatar Adry_85
Browse files

BETA: Retail-like quests in Java.

	* '''Collector of Jewels''' (369)
	* ''' An Elder Sows Seeds''' (370)
Reviewed by: jurchiks
parent 5f263135
No related branches found
No related tags found
No related merge requests found
Showing
with 440 additions and 19 deletions
/*
* Copyright (C) 2004-2013 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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.Q00369_CollectorOfJewels;
import java.util.HashMap;
import java.util.Map;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.QuestItemHolder;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
/**
* Collector of Jewels (369)
* @author Adry_85
*/
public final class Q00369_CollectorOfJewels extends Quest
{
// NPC
private static final int NELL = 30376;
// Items
private static final int FLARE_SHARD = 5882;
private static final int FREEZING_SHARD = 5883;
// Misc
private static final int MIN_LEVEL = 25;
// Mobs
private static final Map<Integer, QuestItemHolder> MOBS_DROP_CHANCES = new HashMap<>();
static
{
MOBS_DROP_CHANCES.put(20609, new QuestItemHolder(FLARE_SHARD, 75, 1)); // salamander_lakin
MOBS_DROP_CHANCES.put(20612, new QuestItemHolder(FLARE_SHARD, 91, 1)); // salamander_rowin
MOBS_DROP_CHANCES.put(20749, new QuestItemHolder(FLARE_SHARD, 100, 2)); // death_fire
MOBS_DROP_CHANCES.put(20616, new QuestItemHolder(FREEZING_SHARD, 81, 1)); // undine_lakin
MOBS_DROP_CHANCES.put(20619, new QuestItemHolder(FREEZING_SHARD, 87, 1)); // undine_rowin
MOBS_DROP_CHANCES.put(20747, new QuestItemHolder(FREEZING_SHARD, 100, 2)); // roxide
}
private Q00369_CollectorOfJewels()
{
super(369, Q00369_CollectorOfJewels.class.getSimpleName(), "Collector of Jewels");
addStartNpc(NELL);
addTalkId(NELL);
addKillId(MOBS_DROP_CHANCES.keySet());
registerQuestItems(FLARE_SHARD, FREEZING_SHARD);
}
@Override
public boolean checkPartyMember(L2PcInstance member, L2Npc npc)
{
final QuestState st = member.getQuestState(getName());
return ((st != null) && (st.isMemoState(1) || st.isMemoState(3)));
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
final QuestState st = getQuestState(player, false);
if (st == null)
{
return null;
}
String htmltext = null;
switch (event)
{
case "30376-02.htm":
{
st.startQuest();
st.setMemoState(1);
htmltext = event;
break;
}
case "30376-05.html":
{
htmltext = event;
break;
}
case "30376-06.html":
{
if (st.isMemoState(2))
{
st.setMemoState(3);
st.setCond(3, true);
htmltext = event;
}
break;
}
case "30376-07.html":
{
st.exitQuest(true, true);
htmltext = event;
break;
}
}
return htmltext;
}
@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance())
{
L2PcInstance luckyPlayer = getRandomPartyMember(player, npc);
if (luckyPlayer != null)
{
final QuestState st = luckyPlayer.getQuestState(getName());
final int itemCount = (st.isMemoState(1) ? 50 : 200);
final int cond = (st.isMemoState(1) ? 2 : 4);
if (giveItemRandomly(luckyPlayer, npc, item.getId(), item.getCount(), itemCount, 1.0, true) //
&& (getQuestItemsCount(luckyPlayer, FLARE_SHARD, FREEZING_SHARD) >= (itemCount * 2)))
{
st.setCond(cond);
}
}
}
return super.onKill(npc, player, isSummon);
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
final QuestState st = getQuestState(player, true);
String htmltext = getNoQuestMsg(player);
if (st.isCreated())
{
htmltext = (player.getLevel() >= MIN_LEVEL) ? "30376-01.htm" : "30376-03.html";
}
else if (st.isStarted())
{
switch (st.getMemoState())
{
case 1:
{
if (getQuestItemsCount(player, FLARE_SHARD, FREEZING_SHARD) >= 100)
{
giveAdena(player, 31810, true);
takeItems(player, -1, FLARE_SHARD, FREEZING_SHARD);
st.setMemoState(2);
htmltext = "30376-04.html";
}
else
{
htmltext = "30376-08.html";
}
break;
}
case 2:
{
htmltext = "30376-09.html";
break;
}
case 3:
{
if (getQuestItemsCount(player, FLARE_SHARD, FREEZING_SHARD) >= 400)
{
giveAdena(player, 84415, true);
takeItems(player, -1, FLARE_SHARD, FREEZING_SHARD);
st.exitQuest(true, true);
htmltext = "30376-10.html";
}
else
{
htmltext = "30376-11.html";
}
break;
}
}
}
return htmltext;
}
public static void main(String args[])
{
new Q00369_CollectorOfJewels();
}
}
<html><body>Wiseman Casian:<br> <html><body>Elder Casian:<br>
Did you know that at one time this barren wasteland was one of the most fertile places in Aden? For centuries farmers sowed their seeds and harvested abundant crops here. Ah, yes, those were the days...<br> Did you know that at one time this barren wasteland was one of the most fertile places in Aden? For centuries farmers sowed their seeds and harvested abundant crops here. Ah, yes, those were the days...<br>
But then that devil Beleth and his minions arrived. We had to come up with a resolution quickly. We were compelled to at last open the forbidden spellbook...<br> But then that devil Beleth and his minions arrived. We had to come up with a resolution quickly. We were compelled to at last open the forbidden spellbook...<br>
For two days and nights fire rained down on us and dark magic swept the land like a whirlwind... It wasn't at all what we'd anticipated...<br> For two days and nights fire rained down on us and dark magic swept the land like a whirlwind... It wasn't at all what we'd anticipated...<br>
I couldn't bear to stay in this ruined place, so I wandered the world for many years. But now I find myself drawn back, hoping to somehow restore this land to its former beauty. I shan't be able to do this alone...<br> I couldn't bear to stay in this ruined place, so I wandered the world for many years. But now I find myself drawn back, hoping to somehow restore this land to its former beauty. I shan't be able to do this alone...<br>
<a action="bypass -h Quest 370_AWisemanSowsSeeds 30612-1.htm">What can I do to help?</a> <a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-02.htm">"What can I do to help?"</a>
</body></html> </body></html>
\ No newline at end of file
<html><body>Wiseman Casian:<br> <html><body>Elder Casian:<br>
The magic we unwittingly unleashed came from "Kranvel's Spellbook", one of the forbidden tomes of the Ivory Tower. Its fearsome power sucked the magic from all living organisms in the area, and then unleashed it all back upon us with a vengeance!<br> The magic we unwittingly unleashed came from "Kranvel's Spellbook", one of the forbidden tomes of the Ivory Tower. Its fearsome power sucked the magic from all living organisms in the area, and then unleashed it all back upon us with a vengeance!<br>
Poor Spellsinger Diena saw the whole thing and fell into a deep state of shock. As she shed blood and tears, she destroyed the book and scattered it to the wind... She was determined that no one should ever use such evil magic again... We couldn't stop her! We all felt as if we were in a terrible nightmare, and just stared blankly at her...<br> Poor Spellsinger Diena saw the whole thing and fell into a deep state of shock. As she shed blood and tears, she destroyed the book and scattered it to the wind... She was determined that no one should ever use such evil magic again... We couldn't stop her! We all felt as if we were in a terrible nightmare, and just stared blankly at her...<br>
But now we know that that spellbook is the key to the restoration of this place. Please find the pieces of the book that were scattered to the wind.<br> But now we know that that spellbook is the key to the restoration of this place. Please find the pieces of the book that were scattered to the wind.<br>
<a action="bypass -h Quest 370_AWisemanSowsSeeds 30612-2.htm">Where should I look for the pieces of "Kranvel's Spellbook"?</a> <a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-03.htm">"Where should I look for the pieces of "Kranvel's Spellbook"?"</a>
</body></html> </body></html>
\ No newline at end of file
<html><body>Wiseman Casian:<br> <html><body>Elder Casian:<br>
Ironically, the deformed beasts around us hole the clues to finding the legacy of Kranvel. Giant ants are known to pick up anything they find and take it to their nests. It is said that they have collected a great number of ancient relics and taken them to their nest in the maze-like caves beneath the wasteland.<br> Ironically, the deformed beasts around us hold the clues to finding the legacy of Kranvel. Giant ants are known to pick up anything they find and take it to their nests. It is said that they have collected a great number of ancient relics and taken them to their nest in the maze-like caves beneath the wasteland.<br>
You will most likely find the pieces of "Kranvel's Spellbook" in the<font color="LEVEL"> Ant Nest</font>. You mustn't attempt this alone! Take some reliable colleagues along with you.<br> You will most likely find the pieces of "Kranvel's Spellbook" in the <font color="LEVEL">Ant Nest</font>. You mustn't attempt this alone! Take some reliable colleagues along with you.<br>
<a action="bypass -h Quest 370_AWisemanSowsSeeds 30612-3.htm">You can count on me.</a> <a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-04.htm">"You can count on me."</a>
</body></html> </body></html>
\ No newline at end of file
<html><body>Wiseman Casian:<br> <html><body>Elder Casian:<br>
In order to obtain the pieces of the spellbook, you must conquer the<font color="LEVEL"> ant recruits, ant patrols, ant guards, the noble ant and the noble ant leader</font>.<br> In order to obtain the pieces of the spellbook, you must conquer the <font color="LEVEL">ant recruits, ant patrols, ant guards, the noble ant and the noble ant leader</font>.<br>
<font color="LEVEL">Check carefully any scraps of paper you come across</font>. The pieces of "Kranvel's Spellbook" should be easy to identify.<br> <font color="LEVEL">Check carefully any scraps of paper you come across</font>. The pieces of "Kranvel's Spellbook" should be easy to identify.<br>
The spellbook has four chapters:<font color="LEVEL"> the Chapter of Fire, the Chapter of Water, the Chapter of Wind and the Chapter of Earth</font>. The contents will only be discernible if you recover all four chapters.<br> The spellbook has four chapters: <font color="LEVEL">the Chapter of Fire, the Chapter of Water, the Chapter of Wind and the Chapter of Earth</font>. The contents will only be discernible if you recover all four chapters.<br>
This is a challenging task, but I think you are ready for it. May the divine blessing be with you... This is a challenging task, but I think you are ready for it. May the divine blessing be with you...
</body></html> </body></html>
\ No newline at end of file
<html><body>Elder Casian:<br>
Did you know that at one time this barren wasteland was one of the most fertile places in Aden? For centuries, farmers sowed their seeds and harvested their abundant crops here. Ah, yes, those were the days...<br>
But then that devil Beleth and his minions arrived. We had to act quickly. We were compelled to at last open the forbidden spellbook...<br>
For two days and nights fire rained down on us and dark magic swept over the land like a whirlwind... It wasn't at all what we'd anticipated...<br>
When it was over, this is all that was left... A dusty wasteland inhabited by weird-looking freaks...<br>
Some day, hopefully, we shall find a way to change this place back into the verdant farmland it once was... I hope we can count on you when that time comes.<br>
(This quest may only be undertaken by a character of level 28 or above.)
</body></html>
<html><body>Wiseman Casian:<br> <html><body>Elder Casian:<br>
The wind is unusually scorching today... Do you feel it? The angry cries of the souls of those who perished here seem carried on the blistering breeze across the Wasteland...<br> The wind is unusually scorching today... Do you feel it? The angry cries of the souls of those who perished here seem carried on the blistering breeze across the Wasteland...<br>
Forgive me. This place has that effect on me. By the way, how are things at the Ant Nest?<br> Forgive me. This place has that effect on me. By the way, how are things at the Ant Nest?<br>
<a action="bypass -h Quest 370_AWisemanSowsSeeds 30612-5.htm">Where can I find the spellbook?</a><br> <a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-07.html">"Where can I find the spellbook?"</a><br>
<a action="bypass -h Quest 370_AWisemanSowsSeeds 30612-6.htm">I have brought all four chapters of "Kranvel's Spellbook".</a><br> <a action="bypass -h Quest Q00370_AnElderSowsSeeds REWARD">"I have brought all four chapters of "Kranvel's Spellbook"."</a><br>
<a action="bypass -h Quest 370_AWisemanSowsSeeds 30612-7.htm">I need to find more chapters.</a><br> <a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-09.html">"I need to find more chapters."</a><br>
<a action="bypass -h Quest 370_AWisemanSowsSeeds 30612-9.htm">I quit.</a> <a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-10.html">"I quit."</a>
</body></html> </body></html>
\ No newline at end of file
<html><body>Elder Casian:<br>
How could you forget? You must slay <font color="LEVEL">ant recruits, ant patrols, ant guards, noble ants, and the noble ant leader</font> in order to obtain the pieces of the spellbook.<br>
<font color="LEVEL">Examine any scraps of paper you come across carefully.</font> The pieces of "Kranvel's Spellbook" should be instantly recognizable.<br>
You must find all four chapters: <font color="LEVEL">the Chapter of Fire, the Chapter of Water, the Chapter of Wind and the Chapter of Earth</font>.<br>
<a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-06.html">Back</a>
</body></html>
<html><body>Wiseman Casian:<br> <html><body>Elder Casian:<br>
Let's see, the Chapter of Fire, the Chapter of Water, the Chapter of Wind and the Chapter of Earth... you have brought them all! Perhaps your discovery will lead to a way to restore this ruined place. At last I shall be redeemed... This is all thanks to you. Please accept this humble token of my appreciation.<br> Let's see, the Chapter of Fire, the Chapter of Water, the Chapter of Wind, and the Chapter of Earth... you have brought them all! Perhaps your discovery will lead to a way to restore this ruined place. At last I shall be redeemed... This is all thanks to you. Please accept this humble token of my appreciation.<br>
But this sad chapter is not yet complete... The dark magic that caused this disaster had many sources, united in their power and holding copies of "Kranvel's Spellbook"!<br> But this sad chapter is not yet complete... The dark magic that caused this disaster had many sources, united in their power and holding copies of "Kranvel's Spellbook"!<br>
Alas, it's true! There remain many pieces of that horrid tome scattered about the inside of the Ant Nest. If I am to continue my research, and above all to keep this dreadful power from falling into wrong hands, the remaining fragments of "Kranvel's Spellbook" must be recovered! Please help!<br> Alas, it's true! There remain many pieces of that horrid tome scattered about the inside of the Ant Nest. If I am to continue my research, and above all to keep this dreadful power from falling into the wrong hands, the remaining fragments of "Kranvel's Spellbook" must be recovered! Please help!<br>
<a action="bypass -h Quest 370_AWisemanSowsSeeds 30612-7.htm">I will continue to help.</a> <a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-09.html">"I will continue to help."</a><br>
</body></html> <a action="bypass -h Quest Q00370_AnElderSowsSeeds 30612-10.html">"I quit."</a>
\ No newline at end of file </body></html>
<html><body>Wiseman Casian:<br> <html><body>Elder Casian:<br>
Thank you for helping us. Hopefully someday our efforts will pay off, and restore this wasteland to its former beauty. Bless you, my child... Thank you for helping us. Hopefully someday our efforts will pay off, and restore this wasteland to its former beauty. Bless you, my child...
</body></html> </body></html>
\ No newline at end of file
<html><body>Wiseman Casian:<br> <html><body>Elder Casian:<br>
I understand. Your assistance has given me the opportunity to redeem myself. I don't know exactly where my research will lead, but hopefully to a better world...<br> I understand. Your assistance has given me the opportunity to redeem myself. I don't know exactly where my research will lead, but hopefully to a better world...<br>
We all must do what we think is best. Only time will tell whether our choices are good ones...<br> We all must do what we think is best. Only time will tell whether our choices are good ones...<br>
Thank you so very much for your help. May you be blessed by the gods... Thank you so very much for your help. May you be blessed by the gods...
</body></html> </body></html>
\ No newline at end of file
<html><body>Elder Casian:<br>
How could you have forgotten so quickly?<br>
"Kranvel's Spellbook" consists of four chapters: <font color="LEVEL">the Chapter of Fire, the Chapter of Water, the Chapter of Wind and the Chapter of Earth</font>. The contents will not be discernible unless you find all four chapters. Please, you must help us! We're counting on you!
</body></html>
/*
* Copyright (C) 2004-2013 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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.Q00370_AnElderSowsSeeds;
import java.util.HashMap;
import java.util.Map;
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.util.Util;
/**
* An Elder Sows Seeds (370)
* @author Adry_85
*/
public final class Q00370_AnElderSowsSeeds extends Quest
{
// NPC
private static final int CASIAN = 30612;
// Items
private static final int SPELLBOOK_PAGE = 5916;
private static final int CHAPTER_OF_FIRE = 5917;
private static final int CHAPTER_OF_WATER = 5918;
private static final int CHAPTER_OF_WIND = 5919;
private static final int CHAPTER_OF_EARTH = 5920;
// Misc
private static final int MIN_LEVEL = 28;
// Mobs
private static final Map<Integer, Integer> MOBS1 = new HashMap<>();
private static final Map<Integer, Double> MOBS2 = new HashMap<>();
static
{
MOBS1.put(20082, 9); // ant_recruit
MOBS1.put(20086, 9); // ant_guard
MOBS1.put(20090, 22); // noble_ant_leader
MOBS2.put(20084, 0.101); // ant_patrol
MOBS2.put(20089, 0.100); // noble_ant
}
private Q00370_AnElderSowsSeeds()
{
super(370, Q00370_AnElderSowsSeeds.class.getSimpleName(), "An Elder Sows Seeds");
addStartNpc(CASIAN);
addTalkId(CASIAN);
addKillId(MOBS1.keySet());
addKillId(MOBS2.keySet());
}
@Override
public boolean checkPartyMember(L2PcInstance member, L2Npc npc)
{
final QuestState st = member.getQuestState(getName());
return ((st != null) && st.isStarted());
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
final QuestState st = getQuestState(player, false);
if (st == null)
{
return null;
}
String htmltext = null;
switch (event)
{
case "30612-02.htm":
case "30612-03.htm":
case "30612-06.html":
case "30612-07.html":
case "30612-09.html":
{
htmltext = event;
break;
}
case "30612-04.htm":
{
st.startQuest();
htmltext = event;
break;
}
case "REWARD":
{
if (st.isStarted())
{
if (hasQuestItems(player, CHAPTER_OF_FIRE, CHAPTER_OF_WATER, CHAPTER_OF_WIND, CHAPTER_OF_EARTH))
{
final long waterChapters = getQuestItemsCount(player, CHAPTER_OF_WATER);
final long earthChapters = getQuestItemsCount(player, CHAPTER_OF_EARTH);
final long windChapters = getQuestItemsCount(player, CHAPTER_OF_WIND);
final long fireChapters = getQuestItemsCount(player, CHAPTER_OF_FIRE);
final long minCount = Util.min(waterChapters, earthChapters, windChapters, fireChapters);
giveAdena(player, minCount * 3600, true);
takeItems(player, (int) minCount, CHAPTER_OF_WATER, CHAPTER_OF_EARTH, CHAPTER_OF_WIND, CHAPTER_OF_FIRE);
htmltext = "30612-08.html";
}
else
{
htmltext = "30612-11.html";
}
}
break;
}
case "30612-10.html":
{
if (st.isStarted())
{
if (hasQuestItems(player, CHAPTER_OF_FIRE, CHAPTER_OF_WATER, CHAPTER_OF_WIND, CHAPTER_OF_EARTH))
{
final long waterChapters = getQuestItemsCount(player, CHAPTER_OF_WATER);
final long earthChapters = getQuestItemsCount(player, CHAPTER_OF_EARTH);
final long windChapters = getQuestItemsCount(player, CHAPTER_OF_WIND);
final long fireChapters = getQuestItemsCount(player, CHAPTER_OF_FIRE);
final long minCount = Util.min(waterChapters, earthChapters, windChapters, fireChapters);
giveAdena(player, minCount * 3600, true);
}
takeItems(player, -1, CHAPTER_OF_WATER, CHAPTER_OF_EARTH, CHAPTER_OF_WIND, CHAPTER_OF_FIRE);
st.exitQuest(true, true);
htmltext = event;
}
break;
}
}
return htmltext;
}
@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
int npcId = npc.getId();
if (MOBS1.containsKey(npcId))
{
if (getRandom(100) < MOBS1.get(npcId))
{
L2PcInstance luckyPlayer = getRandomPartyMember(player, npc);
if (luckyPlayer != null)
{
giveItemRandomly(luckyPlayer, npc, SPELLBOOK_PAGE, 1, 0, 1.0, true);
}
}
}
else
{
final QuestState st = getRandomPartyMemberState(player, -1, 3, npc);
if (st != null)
{
giveItemRandomly(st.getPlayer(), npc, SPELLBOOK_PAGE, 1, 0, MOBS2.get(npcId), true);
}
}
return super.onKill(npc, player, isSummon);
}
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
final QuestState st = getQuestState(player, true);
String htmltext = getNoQuestMsg(player);
if (st.isCreated())
{
htmltext = (player.getLevel() >= MIN_LEVEL) ? "30612-01.htm" : "30612-05.html";
}
else if (st.isStarted())
{
htmltext = "30612-06.html";
}
return htmltext;
}
public static void main(String args[])
{
new Q00370_AnElderSowsSeeds();
}
}
UPDATE character_quests SET name='Q00369_CollectorOfJewels' WHERE name='369_CollectorOfJewels';
UPDATE character_quests SET name='Q00370_AnElderSowsSeeds' WHERE name='370_AWisemanSowsSeeds';
\ 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