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

BETA: Improvements for quest '''An Elder Sows Seeds''' (370).

	Patch by: jurchiks
	Reviewed by: Adry_85
parent f6f6ef69
No related branches found
No related tags found
No related merge requests found
...@@ -102,15 +102,8 @@ public final class Q00370_AnElderSowsSeeds extends Quest ...@@ -102,15 +102,8 @@ public final class Q00370_AnElderSowsSeeds extends Quest
{ {
if (st.isStarted()) if (st.isStarted())
{ {
if (hasQuestItems(player, CHAPTER_OF_FIRE, CHAPTER_OF_WATER, CHAPTER_OF_WIND, CHAPTER_OF_EARTH)) if (exchangeChapters(player, false))
{ {
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"; htmltext = "30612-08.html";
} }
else else
...@@ -124,16 +117,7 @@ public final class Q00370_AnElderSowsSeeds extends Quest ...@@ -124,16 +117,7 @@ public final class Q00370_AnElderSowsSeeds extends Quest
{ {
if (st.isStarted()) if (st.isStarted())
{ {
if (hasQuestItems(player, CHAPTER_OF_FIRE, CHAPTER_OF_WATER, CHAPTER_OF_WIND, CHAPTER_OF_EARTH)) exchangeChapters(player, true);
{
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); st.exitQuest(true, true);
htmltext = event; htmltext = event;
} }
...@@ -185,6 +169,22 @@ public final class Q00370_AnElderSowsSeeds extends Quest ...@@ -185,6 +169,22 @@ public final class Q00370_AnElderSowsSeeds extends Quest
return htmltext; return htmltext;
} }
private final boolean exchangeChapters(L2PcInstance player, boolean takeAllItems)
{
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);
if (minCount > 0)
{
giveAdena(player, minCount * 3600, true);
}
final long countToTake = (takeAllItems ? -1 : minCount);
takeItems(player, (int) countToTake, CHAPTER_OF_WATER, CHAPTER_OF_EARTH, CHAPTER_OF_WIND, CHAPTER_OF_FIRE);
return (minCount > 0);
}
public static void main(String args[]) public static void main(String args[])
{ {
new Q00370_AnElderSowsSeeds(); new Q00370_AnElderSowsSeeds();
......
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