Always use static modifier when adding values to static lists and maps.
This commit is contained in:
		@@ -48,7 +48,8 @@ public class Core extends Quest
 | 
			
		||||
	private static final int DOOM_WRAITH = 29008;
 | 
			
		||||
	private static final int SUSCEPTOR = 29011;
 | 
			
		||||
	// Spawns
 | 
			
		||||
	private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
 | 
			
		||||
	private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17191, 109298, -6488));
 | 
			
		||||
		MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17564, 109548, -6488));
 | 
			
		||||
 
 | 
			
		||||
@@ -1,140 +1,106 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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 custom.EchoCrystals;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.util.Util;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @authors DrLecter (python), Plim (java)
 | 
			
		||||
 * @notes Formerly based on Elektra's script
 | 
			
		||||
 */
 | 
			
		||||
public class EchoCrystals extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "EchoCrystals";
 | 
			
		||||
	
 | 
			
		||||
	private static final int ADENA = 57;
 | 
			
		||||
	private static final int COST = 200;
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, ScoreData> SCORES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		SCORES.put(4410, new ScoreData(4411, "01", "02", "03"));
 | 
			
		||||
		SCORES.put(4409, new ScoreData(4412, "04", "05", "06"));
 | 
			
		||||
		SCORES.put(4408, new ScoreData(4413, "07", "08", "09"));
 | 
			
		||||
		SCORES.put(4420, new ScoreData(4414, "10", "11", "12"));
 | 
			
		||||
		SCORES.put(4421, new ScoreData(4415, "13", "14", "15"));
 | 
			
		||||
		SCORES.put(4419, new ScoreData(4417, "16", "05", "06"));
 | 
			
		||||
		SCORES.put(4418, new ScoreData(4416, "17", "05", "06"));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public EchoCrystals()
 | 
			
		||||
	{
 | 
			
		||||
		super(-1, qn, "custom");
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31042, 31043);
 | 
			
		||||
		addTalkId(31042, 31043);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = "";
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		
 | 
			
		||||
		if ((st != null) && Util.isDigit(event))
 | 
			
		||||
		{
 | 
			
		||||
			int score = Integer.parseInt(event);
 | 
			
		||||
			if (SCORES.containsKey(score))
 | 
			
		||||
			{
 | 
			
		||||
				int crystal = SCORES.get(score).getCrystalId();
 | 
			
		||||
				String ok = SCORES.get(score).getOkMsg();
 | 
			
		||||
				String noadena = SCORES.get(score).getNoAdenaMsg();
 | 
			
		||||
				String noscore = SCORES.get(score).getNoScoreMsg();
 | 
			
		||||
				
 | 
			
		||||
				if (st.getQuestItemsCount(score) == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = npc.getNpcId() + "-" + noscore + ".htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (st.getQuestItemsCount(ADENA) < COST)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = npc.getNpcId() + "-" + noadena + ".htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					st.takeItems(ADENA, COST);
 | 
			
		||||
					st.giveItems(crystal, 1);
 | 
			
		||||
					htmltext = npc.getNpcId() + "-" + ok + ".htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		return "1.htm";
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private class ScoreData
 | 
			
		||||
	{
 | 
			
		||||
		private final int _crystalId;
 | 
			
		||||
		private final String _okMsg;
 | 
			
		||||
		private final String _noAdenaMsg;
 | 
			
		||||
		private final String _noScoreMsg;
 | 
			
		||||
		
 | 
			
		||||
		public ScoreData(int crystalId, String okMsg, String noAdenaMsg, String noScoreMsg)
 | 
			
		||||
		{
 | 
			
		||||
			_crystalId = crystalId;
 | 
			
		||||
			_okMsg = okMsg;
 | 
			
		||||
			_noAdenaMsg = noAdenaMsg;
 | 
			
		||||
			_noScoreMsg = noScoreMsg;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public int getCrystalId()
 | 
			
		||||
		{
 | 
			
		||||
			return _crystalId;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public String getOkMsg()
 | 
			
		||||
		{
 | 
			
		||||
			return _okMsg;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public String getNoAdenaMsg()
 | 
			
		||||
		{
 | 
			
		||||
			return _noAdenaMsg;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public String getNoScoreMsg()
 | 
			
		||||
		{
 | 
			
		||||
			return _noScoreMsg;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static void main(String[] args)
 | 
			
		||||
	{
 | 
			
		||||
		new EchoCrystals();
 | 
			
		||||
	}
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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 custom.EchoCrystals;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.holders.ScoreDataHolder;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.util.Util;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @authors DrLecter (python), Plim (java)
 | 
			
		||||
 * @notes Formerly based on Elektra's script
 | 
			
		||||
 */
 | 
			
		||||
public class EchoCrystals extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "EchoCrystals";
 | 
			
		||||
	
 | 
			
		||||
	private static final int ADENA = 57;
 | 
			
		||||
	private static final int COST = 200;
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, ScoreDataHolder> SCORES = new HashMap<>();
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		SCORES.put(4410, new ScoreDataHolder(4411, "01", "02", "03"));
 | 
			
		||||
		SCORES.put(4409, new ScoreDataHolder(4412, "04", "05", "06"));
 | 
			
		||||
		SCORES.put(4408, new ScoreDataHolder(4413, "07", "08", "09"));
 | 
			
		||||
		SCORES.put(4420, new ScoreDataHolder(4414, "10", "11", "12"));
 | 
			
		||||
		SCORES.put(4421, new ScoreDataHolder(4415, "13", "14", "15"));
 | 
			
		||||
		SCORES.put(4419, new ScoreDataHolder(4417, "16", "05", "06"));
 | 
			
		||||
		SCORES.put(4418, new ScoreDataHolder(4416, "17", "05", "06"));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public EchoCrystals()
 | 
			
		||||
	{
 | 
			
		||||
		super(-1, qn, "custom");
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31042, 31043);
 | 
			
		||||
		addTalkId(31042, 31043);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = "";
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		
 | 
			
		||||
		if ((st != null) && Util.isDigit(event))
 | 
			
		||||
		{
 | 
			
		||||
			int score = Integer.parseInt(event);
 | 
			
		||||
			if (SCORES.containsKey(score))
 | 
			
		||||
			{
 | 
			
		||||
				int crystal = SCORES.get(score).getCrystalId();
 | 
			
		||||
				String ok = SCORES.get(score).getOkMsg();
 | 
			
		||||
				String noadena = SCORES.get(score).getNoAdenaMsg();
 | 
			
		||||
				String noscore = SCORES.get(score).getNoScoreMsg();
 | 
			
		||||
				
 | 
			
		||||
				if (st.getQuestItemsCount(score) == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = npc.getNpcId() + "-" + noscore + ".htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (st.getQuestItemsCount(ADENA) < COST)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = npc.getNpcId() + "-" + noadena + ".htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					st.takeItems(ADENA, COST);
 | 
			
		||||
					st.giveItems(crystal, 1);
 | 
			
		||||
					htmltext = npc.getNpcId() + "-" + ok + ".htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		return "1.htm";
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static void main(String[] args)
 | 
			
		||||
	{
 | 
			
		||||
		new EchoCrystals();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,161 +1,162 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q004_LongliveThePaagrioLord;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.base.Race;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q004_LongliveThePaagrioLord extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q004_LongliveThePaagrioLord";
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q004_LongliveThePaagrioLord;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.base.Race;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q004_LongliveThePaagrioLord extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q004_LongliveThePaagrioLord";
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> NPC_GIFTS = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		NPC_GIFTS.put(30585, 1542);
 | 
			
		||||
		NPC_GIFTS.put(30566, 1541);
 | 
			
		||||
		NPC_GIFTS.put(30562, 1543);
 | 
			
		||||
		NPC_GIFTS.put(30560, 1544);
 | 
			
		||||
		NPC_GIFTS.put(30559, 1545);
 | 
			
		||||
		NPC_GIFTS.put(30587, 1546);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q004_LongliveThePaagrioLord()
 | 
			
		||||
	{
 | 
			
		||||
		super(4, qn, "Long live the Pa'agrio Lord!");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(1541, 1542, 1543, 1544, 1545, 1546);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30578); // Nakusin
 | 
			
		||||
		addTalkId(30578, 30585, 30566, 30562, 30560, 30559, 30587);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30578-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				if (player.getRace() != Race.orc)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30578-00.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (player.getLevel() < 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30578-01.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30578-02.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				int npcId = npc.getNpcId();
 | 
			
		||||
				
 | 
			
		||||
				if (npcId == 30578)
 | 
			
		||||
				{
 | 
			
		||||
					if (cond == 1)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "30578-04.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else if (cond == 2)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "30578-06.htm";
 | 
			
		||||
						st.giveItems(4, 1);
 | 
			
		||||
						for (int item : NPC_GIFTS.values())
 | 
			
		||||
						{
 | 
			
		||||
							st.takeItems(item, -1);
 | 
			
		||||
						}
 | 
			
		||||
						
 | 
			
		||||
						st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
						st.exitQuest(false);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					int i = NPC_GIFTS.get(npcId);
 | 
			
		||||
					if (st.hasQuestItems(i))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = npcId + "-02.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(i, 1);
 | 
			
		||||
						htmltext = npcId + "-01.htm";
 | 
			
		||||
						
 | 
			
		||||
						int count = 0;
 | 
			
		||||
						for (int item : NPC_GIFTS.values())
 | 
			
		||||
						{
 | 
			
		||||
							count += st.getQuestItemsCount(item);
 | 
			
		||||
						}
 | 
			
		||||
						
 | 
			
		||||
						if (count == 6)
 | 
			
		||||
						{
 | 
			
		||||
							st.set("cond", "2");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		NPC_GIFTS.put(30585, 1542);
 | 
			
		||||
		NPC_GIFTS.put(30566, 1541);
 | 
			
		||||
		NPC_GIFTS.put(30562, 1543);
 | 
			
		||||
		NPC_GIFTS.put(30560, 1544);
 | 
			
		||||
		NPC_GIFTS.put(30559, 1545);
 | 
			
		||||
		NPC_GIFTS.put(30587, 1546);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q004_LongliveThePaagrioLord()
 | 
			
		||||
	{
 | 
			
		||||
		super(4, qn, "Long live the Pa'agrio Lord!");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(1541, 1542, 1543, 1544, 1545, 1546);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30578); // Nakusin
 | 
			
		||||
		addTalkId(30578, 30585, 30566, 30562, 30560, 30559, 30587);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30578-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				if (player.getRace() != Race.orc)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30578-00.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (player.getLevel() < 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30578-01.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30578-02.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				int npcId = npc.getNpcId();
 | 
			
		||||
				
 | 
			
		||||
				if (npcId == 30578)
 | 
			
		||||
				{
 | 
			
		||||
					if (cond == 1)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "30578-04.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else if (cond == 2)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "30578-06.htm";
 | 
			
		||||
						st.giveItems(4, 1);
 | 
			
		||||
						for (int item : NPC_GIFTS.values())
 | 
			
		||||
						{
 | 
			
		||||
							st.takeItems(item, -1);
 | 
			
		||||
						}
 | 
			
		||||
						
 | 
			
		||||
						st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
						st.exitQuest(false);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					int i = NPC_GIFTS.get(npcId);
 | 
			
		||||
					if (st.hasQuestItems(i))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = npcId + "-02.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(i, 1);
 | 
			
		||||
						htmltext = npcId + "-01.htm";
 | 
			
		||||
						
 | 
			
		||||
						int count = 0;
 | 
			
		||||
						for (int item : NPC_GIFTS.values())
 | 
			
		||||
						{
 | 
			
		||||
							count += st.getQuestItemsCount(item);
 | 
			
		||||
						}
 | 
			
		||||
						
 | 
			
		||||
						if (count == 6)
 | 
			
		||||
						{
 | 
			
		||||
							st.set("cond", "2");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -64,7 +64,8 @@ public class Q038_DragonFangs extends Quest
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	// Droplist
 | 
			
		||||
	private static final Map<Integer, int[]> DROPLIST = new HashMap<>();
 | 
			
		||||
	private static final Map<Integer, int[]> DROPLIST = new HashMap<>();
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(21100, new int[]
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,244 +1,246 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q039_RedEyedInvaders;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q039_RedEyedInvaders extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q039_RedEyedInvaders";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int BABENCO = 30334;
 | 
			
		||||
	private static final int BATHIS = 30332;
 | 
			
		||||
	
 | 
			
		||||
	// Mobs
 | 
			
		||||
	private static final int MAILLE_LIZARDMAN = 20919;
 | 
			
		||||
	private static final int MAILLE_LIZARDMAN_SCOUT = 20920;
 | 
			
		||||
	private static final int MAILLE_LIZARDMAN_GUARD = 20921;
 | 
			
		||||
	private static final int ARANEID = 20925;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int BLACK_BONE_NECKLACE = 7178;
 | 
			
		||||
	private static final int RED_BONE_NECKLACE = 7179;
 | 
			
		||||
	private static final int INCENSE_POUCH = 7180;
 | 
			
		||||
	private static final int GEM_OF_MAILLE = 7181;
 | 
			
		||||
	
 | 
			
		||||
	// First droplist
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q039_RedEyedInvaders;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q039_RedEyedInvaders extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q039_RedEyedInvaders";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int BABENCO = 30334;
 | 
			
		||||
	private static final int BATHIS = 30332;
 | 
			
		||||
	
 | 
			
		||||
	// Mobs
 | 
			
		||||
	private static final int MAILLE_LIZARDMAN = 20919;
 | 
			
		||||
	private static final int MAILLE_LIZARDMAN_SCOUT = 20920;
 | 
			
		||||
	private static final int MAILLE_LIZARDMAN_GUARD = 20921;
 | 
			
		||||
	private static final int ARANEID = 20925;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int BLACK_BONE_NECKLACE = 7178;
 | 
			
		||||
	private static final int RED_BONE_NECKLACE = 7179;
 | 
			
		||||
	private static final int INCENSE_POUCH = 7180;
 | 
			
		||||
	private static final int GEM_OF_MAILLE = 7181;
 | 
			
		||||
	
 | 
			
		||||
	// First droplist
 | 
			
		||||
	private static final Map<Integer, int[]> FIRST_DP = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		FIRST_DP.put(MAILLE_LIZARDMAN_GUARD, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			RED_BONE_NECKLACE,
 | 
			
		||||
			BLACK_BONE_NECKLACE
 | 
			
		||||
		});
 | 
			
		||||
		FIRST_DP.put(MAILLE_LIZARDMAN, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLACK_BONE_NECKLACE,
 | 
			
		||||
			RED_BONE_NECKLACE
 | 
			
		||||
		});
 | 
			
		||||
		FIRST_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLACK_BONE_NECKLACE,
 | 
			
		||||
			RED_BONE_NECKLACE
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Second droplist
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		FIRST_DP.put(MAILLE_LIZARDMAN_GUARD, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			RED_BONE_NECKLACE,
 | 
			
		||||
			BLACK_BONE_NECKLACE
 | 
			
		||||
		});
 | 
			
		||||
		FIRST_DP.put(MAILLE_LIZARDMAN, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLACK_BONE_NECKLACE,
 | 
			
		||||
			RED_BONE_NECKLACE
 | 
			
		||||
		});
 | 
			
		||||
		FIRST_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLACK_BONE_NECKLACE,
 | 
			
		||||
			RED_BONE_NECKLACE
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Second droplist
 | 
			
		||||
	private static final Map<Integer, int[]> SECOND_DP = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		SECOND_DP.put(ARANEID, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			GEM_OF_MAILLE,
 | 
			
		||||
			INCENSE_POUCH,
 | 
			
		||||
			500000
 | 
			
		||||
		});
 | 
			
		||||
		SECOND_DP.put(MAILLE_LIZARDMAN_GUARD, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			INCENSE_POUCH,
 | 
			
		||||
			GEM_OF_MAILLE,
 | 
			
		||||
			300000
 | 
			
		||||
		});
 | 
			
		||||
		SECOND_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			INCENSE_POUCH,
 | 
			
		||||
			GEM_OF_MAILLE,
 | 
			
		||||
			250000
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int GREEN_COLORED_LURE_HG = 6521;
 | 
			
		||||
	private static final int BABY_DUCK_RODE = 6529;
 | 
			
		||||
	private static final int FISHING_SHOT_NG = 6535;
 | 
			
		||||
	
 | 
			
		||||
	public Q039_RedEyedInvaders()
 | 
			
		||||
	{
 | 
			
		||||
		super(39, qn, "Red-Eyed Invaders");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BLACK_BONE_NECKLACE, RED_BONE_NECKLACE, INCENSE_POUCH, GEM_OF_MAILLE);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(BABENCO);
 | 
			
		||||
		addTalkId(BABENCO, BATHIS);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(MAILLE_LIZARDMAN, MAILLE_LIZARDMAN_SCOUT, MAILLE_LIZARDMAN_GUARD, ARANEID);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30334-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30332-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30332-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "4");
 | 
			
		||||
			st.takeItems(BLACK_BONE_NECKLACE, -1);
 | 
			
		||||
			st.takeItems(RED_BONE_NECKLACE, -1);
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30332-5.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(INCENSE_POUCH, -1);
 | 
			
		||||
			st.takeItems(GEM_OF_MAILLE, -1);
 | 
			
		||||
			st.giveItems(GREEN_COLORED_LURE_HG, 60);
 | 
			
		||||
			st.giveItems(BABY_DUCK_RODE, 1);
 | 
			
		||||
			st.giveItems(FISHING_SHOT_NG, 500);
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(false);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 20) ? "30334-2.htm" : "30334-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case BABENCO:
 | 
			
		||||
						htmltext = "30334-3.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case BATHIS:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-0.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-2a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-2.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-3a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-4.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMember(player, npc, "2");
 | 
			
		||||
		if ((partyMember != null) && (npcId != ARANEID))
 | 
			
		||||
		{
 | 
			
		||||
			final QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
			if (st == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			final int[] list = FIRST_DP.get(npcId);
 | 
			
		||||
			if (st.dropItems(list[0], 1, 100, 500000) && (st.getQuestItemsCount(list[1]) == 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			partyMember = getRandomPartyMember(player, npc, "4");
 | 
			
		||||
			if ((partyMember != null) && (npcId != MAILLE_LIZARDMAN))
 | 
			
		||||
			{
 | 
			
		||||
				final QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
				final int[] list = SECOND_DP.get(npcId);
 | 
			
		||||
				
 | 
			
		||||
				if (st.dropItems(list[0], 1, 30, list[2]) && (st.getQuestItemsCount(list[1]) == 30))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "5");
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		SECOND_DP.put(ARANEID, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			GEM_OF_MAILLE,
 | 
			
		||||
			INCENSE_POUCH,
 | 
			
		||||
			500000
 | 
			
		||||
		});
 | 
			
		||||
		SECOND_DP.put(MAILLE_LIZARDMAN_GUARD, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			INCENSE_POUCH,
 | 
			
		||||
			GEM_OF_MAILLE,
 | 
			
		||||
			300000
 | 
			
		||||
		});
 | 
			
		||||
		SECOND_DP.put(MAILLE_LIZARDMAN_SCOUT, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			INCENSE_POUCH,
 | 
			
		||||
			GEM_OF_MAILLE,
 | 
			
		||||
			250000
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int GREEN_COLORED_LURE_HG = 6521;
 | 
			
		||||
	private static final int BABY_DUCK_RODE = 6529;
 | 
			
		||||
	private static final int FISHING_SHOT_NG = 6535;
 | 
			
		||||
	
 | 
			
		||||
	public Q039_RedEyedInvaders()
 | 
			
		||||
	{
 | 
			
		||||
		super(39, qn, "Red-Eyed Invaders");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BLACK_BONE_NECKLACE, RED_BONE_NECKLACE, INCENSE_POUCH, GEM_OF_MAILLE);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(BABENCO);
 | 
			
		||||
		addTalkId(BABENCO, BATHIS);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(MAILLE_LIZARDMAN, MAILLE_LIZARDMAN_SCOUT, MAILLE_LIZARDMAN_GUARD, ARANEID);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30334-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30332-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30332-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "4");
 | 
			
		||||
			st.takeItems(BLACK_BONE_NECKLACE, -1);
 | 
			
		||||
			st.takeItems(RED_BONE_NECKLACE, -1);
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30332-5.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(INCENSE_POUCH, -1);
 | 
			
		||||
			st.takeItems(GEM_OF_MAILLE, -1);
 | 
			
		||||
			st.giveItems(GREEN_COLORED_LURE_HG, 60);
 | 
			
		||||
			st.giveItems(BABY_DUCK_RODE, 1);
 | 
			
		||||
			st.giveItems(FISHING_SHOT_NG, 500);
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(false);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 20) ? "30334-2.htm" : "30334-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case BABENCO:
 | 
			
		||||
						htmltext = "30334-3.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case BATHIS:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-0.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-2a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-2.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-3a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30332-4.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMember(player, npc, "2");
 | 
			
		||||
		if ((partyMember != null) && (npcId != ARANEID))
 | 
			
		||||
		{
 | 
			
		||||
			final QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
			if (st == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			final int[] list = FIRST_DP.get(npcId);
 | 
			
		||||
			if (st.dropItems(list[0], 1, 100, 500000) && (st.getQuestItemsCount(list[1]) == 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			partyMember = getRandomPartyMember(player, npc, "4");
 | 
			
		||||
			if ((partyMember != null) && (npcId != MAILLE_LIZARDMAN))
 | 
			
		||||
			{
 | 
			
		||||
				final QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
				final int[] list = SECOND_DP.get(npcId);
 | 
			
		||||
				
 | 
			
		||||
				if (st.dropItems(list[0], 1, 30, list[2]) && (st.getQuestItemsCount(list[1]) == 30))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "5");
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,178 +1,179 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q162_CurseOfTheUndergroundFortress;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.base.Race;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q162_CurseOfTheUndergroundFortress extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q162_CurseOfTheUndergroundFortress";
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int SHADE_HORROR = 20033;
 | 
			
		||||
	private static final int DARK_TERROR = 20345;
 | 
			
		||||
	private static final int MIST_TERROR = 20371;
 | 
			
		||||
	private static final int DUNGEON_SKELETON_ARCHER = 20463;
 | 
			
		||||
	private static final int DUNGEON_SKELETON = 20464;
 | 
			
		||||
	private static final int DREAD_SOLDIER = 20504;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int BONE_FRAGMENT = 1158;
 | 
			
		||||
	private static final int ELF_SKULL = 1159;
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int BONE_SHIELD = 625;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q162_CurseOfTheUndergroundFortress;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.base.Race;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q162_CurseOfTheUndergroundFortress extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q162_CurseOfTheUndergroundFortress";
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int SHADE_HORROR = 20033;
 | 
			
		||||
	private static final int DARK_TERROR = 20345;
 | 
			
		||||
	private static final int MIST_TERROR = 20371;
 | 
			
		||||
	private static final int DUNGEON_SKELETON_ARCHER = 20463;
 | 
			
		||||
	private static final int DUNGEON_SKELETON = 20464;
 | 
			
		||||
	private static final int DREAD_SOLDIER = 20504;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int BONE_FRAGMENT = 1158;
 | 
			
		||||
	private static final int ELF_SKULL = 1159;
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int BONE_SHIELD = 625;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(SHADE_HORROR, 250000);
 | 
			
		||||
		CHANCES.put(DARK_TERROR, 260000);
 | 
			
		||||
		CHANCES.put(MIST_TERROR, 230000);
 | 
			
		||||
		CHANCES.put(DUNGEON_SKELETON_ARCHER, 250000);
 | 
			
		||||
		CHANCES.put(DUNGEON_SKELETON, 230000);
 | 
			
		||||
		CHANCES.put(DREAD_SOLDIER, 260000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q162_CurseOfTheUndergroundFortress()
 | 
			
		||||
	{
 | 
			
		||||
		super(162, qn, "Curse of the Underground Fortress");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BONE_FRAGMENT, ELF_SKULL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30147); // Unoren
 | 
			
		||||
		addTalkId(30147);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(SHADE_HORROR, DARK_TERROR, MIST_TERROR, DUNGEON_SKELETON_ARCHER, DUNGEON_SKELETON, DREAD_SOLDIER);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30147-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				if (player.getRace() == Race.darkelf)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-00.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (player.getLevel() < 12)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-01.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-02.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-06.htm";
 | 
			
		||||
					st.takeItems(ELF_SKULL, -1);
 | 
			
		||||
					st.takeItems(BONE_FRAGMENT, -1);
 | 
			
		||||
					st.giveItems(BONE_SHIELD, 1);
 | 
			
		||||
					st.rewardItems(57, 24000);
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(false);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case DUNGEON_SKELETON:
 | 
			
		||||
			case DUNGEON_SKELETON_ARCHER:
 | 
			
		||||
			case DREAD_SOLDIER:
 | 
			
		||||
				if (st.dropItems(BONE_FRAGMENT, 1, 10, CHANCES.get(npcId)) && (st.getQuestItemsCount(ELF_SKULL) >= 3))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "2");
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case SHADE_HORROR:
 | 
			
		||||
			case DARK_TERROR:
 | 
			
		||||
			case MIST_TERROR:
 | 
			
		||||
				if (st.dropItems(ELF_SKULL, 1, 3, CHANCES.get(npcId)) && (st.getQuestItemsCount(BONE_FRAGMENT) >= 10))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "2");
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(SHADE_HORROR, 250000);
 | 
			
		||||
		CHANCES.put(DARK_TERROR, 260000);
 | 
			
		||||
		CHANCES.put(MIST_TERROR, 230000);
 | 
			
		||||
		CHANCES.put(DUNGEON_SKELETON_ARCHER, 250000);
 | 
			
		||||
		CHANCES.put(DUNGEON_SKELETON, 230000);
 | 
			
		||||
		CHANCES.put(DREAD_SOLDIER, 260000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q162_CurseOfTheUndergroundFortress()
 | 
			
		||||
	{
 | 
			
		||||
		super(162, qn, "Curse of the Underground Fortress");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BONE_FRAGMENT, ELF_SKULL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30147); // Unoren
 | 
			
		||||
		addTalkId(30147);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(SHADE_HORROR, DARK_TERROR, MIST_TERROR, DUNGEON_SKELETON_ARCHER, DUNGEON_SKELETON, DREAD_SOLDIER);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30147-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				if (player.getRace() == Race.darkelf)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-00.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (player.getLevel() < 12)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-01.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-02.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30147-06.htm";
 | 
			
		||||
					st.takeItems(ELF_SKULL, -1);
 | 
			
		||||
					st.takeItems(BONE_FRAGMENT, -1);
 | 
			
		||||
					st.giveItems(BONE_SHIELD, 1);
 | 
			
		||||
					st.rewardItems(57, 24000);
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(false);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case DUNGEON_SKELETON:
 | 
			
		||||
			case DUNGEON_SKELETON_ARCHER:
 | 
			
		||||
			case DREAD_SOLDIER:
 | 
			
		||||
				if (st.dropItems(BONE_FRAGMENT, 1, 10, CHANCES.get(npcId)) && (st.getQuestItemsCount(ELF_SKULL) >= 3))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "2");
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case SHADE_HORROR:
 | 
			
		||||
			case DARK_TERROR:
 | 
			
		||||
			case MIST_TERROR:
 | 
			
		||||
				if (st.dropItems(ELF_SKULL, 1, 3, CHANCES.get(npcId)) && (st.getQuestItemsCount(BONE_FRAGMENT) >= 10))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "2");
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -41,7 +41,8 @@ public class Q165_ShilensHunt extends Quest
 | 
			
		||||
	private static final int LESSER_HEALING_POTION = 1060;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(ASHEN_WOLF, 1000000);
 | 
			
		||||
		CHANCES.put(YOUNG_BROWN_KELTIR, 333333);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,383 +1,384 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q171_ActsOfEvil;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q171_ActsOfEvil extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q171_ActsOfEvil";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int BLADE_MOLD = 4239;
 | 
			
		||||
	private static final int TYRA_BILL = 4240;
 | 
			
		||||
	private static final int RANGER_REPORT_1 = 4241;
 | 
			
		||||
	private static final int RANGER_REPORT_2 = 4242;
 | 
			
		||||
	private static final int RANGER_REPORT_3 = 4243;
 | 
			
		||||
	private static final int RANGER_REPORT_4 = 4244;
 | 
			
		||||
	private static final int WEAPON_TRADE_CONTRACT = 4245;
 | 
			
		||||
	private static final int ATTACK_DIRECTIVES = 4246;
 | 
			
		||||
	private static final int CERTIFICATE = 4247;
 | 
			
		||||
	private static final int CARGO_BOX = 4248;
 | 
			
		||||
	private static final int OL_MAHUM_HEAD = 4249;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int ALVAH = 30381;
 | 
			
		||||
	private static final int ARODIN = 30207;
 | 
			
		||||
	private static final int TYRA = 30420;
 | 
			
		||||
	private static final int ROLENTO = 30437;
 | 
			
		||||
	private static final int NETI = 30425;
 | 
			
		||||
	private static final int BURAI = 30617;
 | 
			
		||||
	
 | 
			
		||||
	// Turek Orcs drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q171_ActsOfEvil;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q171_ActsOfEvil extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q171_ActsOfEvil";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int BLADE_MOLD = 4239;
 | 
			
		||||
	private static final int TYRA_BILL = 4240;
 | 
			
		||||
	private static final int RANGER_REPORT_1 = 4241;
 | 
			
		||||
	private static final int RANGER_REPORT_2 = 4242;
 | 
			
		||||
	private static final int RANGER_REPORT_3 = 4243;
 | 
			
		||||
	private static final int RANGER_REPORT_4 = 4244;
 | 
			
		||||
	private static final int WEAPON_TRADE_CONTRACT = 4245;
 | 
			
		||||
	private static final int ATTACK_DIRECTIVES = 4246;
 | 
			
		||||
	private static final int CERTIFICATE = 4247;
 | 
			
		||||
	private static final int CARGO_BOX = 4248;
 | 
			
		||||
	private static final int OL_MAHUM_HEAD = 4249;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int ALVAH = 30381;
 | 
			
		||||
	private static final int ARODIN = 30207;
 | 
			
		||||
	private static final int TYRA = 30420;
 | 
			
		||||
	private static final int ROLENTO = 30437;
 | 
			
		||||
	private static final int NETI = 30425;
 | 
			
		||||
	private static final int BURAI = 30617;
 | 
			
		||||
	
 | 
			
		||||
	// Turek Orcs drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20496, 530000);
 | 
			
		||||
		CHANCES.put(20497, 550000);
 | 
			
		||||
		CHANCES.put(20498, 510000);
 | 
			
		||||
		CHANCES.put(20499, 500000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q171_ActsOfEvil()
 | 
			
		||||
	{
 | 
			
		||||
		super(171, qn, "Acts of Evil");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BLADE_MOLD, TYRA_BILL, RANGER_REPORT_1, RANGER_REPORT_2, RANGER_REPORT_3, RANGER_REPORT_4, WEAPON_TRADE_CONTRACT, ATTACK_DIRECTIVES, CERTIFICATE, CARGO_BOX, OL_MAHUM_HEAD);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(ALVAH);
 | 
			
		||||
		addTalkId(ALVAH, ARODIN, TYRA, ROLENTO, NETI, BURAI);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20496, 20497, 20498, 20499, 20062, 20064, 20066, 20438);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30381-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30207-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30381-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "5");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30381-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "7");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(WEAPON_TRADE_CONTRACT, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30437-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "9");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(CARGO_BOX, 1);
 | 
			
		||||
			st.giveItems(CERTIFICATE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30617-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "10");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(ATTACK_DIRECTIVES, 1);
 | 
			
		||||
			st.takeItems(CARGO_BOX, 1);
 | 
			
		||||
			st.takeItems(CERTIFICATE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 27) ? "30381-01a.htm" : "30381-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case ALVAH:
 | 
			
		||||
						if (cond < 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30381-02a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30381-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasQuestItems(RANGER_REPORT_1, RANGER_REPORT_2, RANGER_REPORT_3, RANGER_REPORT_4))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30381-05.htm";
 | 
			
		||||
								st.set("cond", "6");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(RANGER_REPORT_1, 1);
 | 
			
		||||
								st.takeItems(RANGER_REPORT_2, 1);
 | 
			
		||||
								st.takeItems(RANGER_REPORT_3, 1);
 | 
			
		||||
								st.takeItems(RANGER_REPORT_4, 1);
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30381-04a.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 6)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasQuestItems(WEAPON_TRADE_CONTRACT, ATTACK_DIRECTIVES))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30381-06.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30381-05a.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if ((cond > 6) && (cond < 11))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30381-07a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 11)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30381-08.htm";
 | 
			
		||||
							st.rewardItems(57, 90000);
 | 
			
		||||
							st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
							st.exitQuest(false);
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ARODIN:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30207-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30207-01a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasQuestItems(TYRA_BILL))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30207-03.htm";
 | 
			
		||||
								st.set("cond", "4");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(TYRA_BILL, 1);
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30207-01a.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30207-03a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case TYRA:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.getQuestItemsCount(BLADE_MOLD) >= 20)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30420-01.htm";
 | 
			
		||||
								st.set("cond", "3");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(BLADE_MOLD, -1);
 | 
			
		||||
								st.giveItems(TYRA_BILL, 1);
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30420-01b.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30420-01a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30420-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case NETI:
 | 
			
		||||
						if (cond == 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30425-01.htm";
 | 
			
		||||
							st.set("cond", "8");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30425-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ROLENTO:
 | 
			
		||||
						if (cond == 8)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30437-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 8)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30437-03a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case BURAI:
 | 
			
		||||
						if ((cond == 9) && st.hasQuestItems(CERTIFICATE, CARGO_BOX, ATTACK_DIRECTIVES))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30617-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 10)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.getQuestItemsCount(OL_MAHUM_HEAD) >= 30)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30617-05.htm";
 | 
			
		||||
								st.set("cond", "11");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(OL_MAHUM_HEAD, -1);
 | 
			
		||||
								st.rewardItems(57, 8000);
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30617-04a.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case 20496:
 | 
			
		||||
			case 20497:
 | 
			
		||||
			case 20498:
 | 
			
		||||
			case 20499:
 | 
			
		||||
				if ((st.getInt("cond") == 2) && !st.dropItems(BLADE_MOLD, 1, 20, CHANCES.get(npcId)))
 | 
			
		||||
				{
 | 
			
		||||
					final int count = st.getQuestItemsCount(BLADE_MOLD);
 | 
			
		||||
					if ((count == 5) || ((count >= 10) && (Rnd.get(100) < 25)))
 | 
			
		||||
					{
 | 
			
		||||
						addSpawn(27190, player.getX(), player.getY(), player.getZ(), player.getHeading(), false, 0);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 20062:
 | 
			
		||||
			case 20064:
 | 
			
		||||
				if (st.getInt("cond") == 5)
 | 
			
		||||
				{
 | 
			
		||||
					if (!st.hasQuestItems(RANGER_REPORT_1))
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(RANGER_REPORT_1, 1);
 | 
			
		||||
						st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
					}
 | 
			
		||||
					else if (Rnd.get(100) < 20)
 | 
			
		||||
					{
 | 
			
		||||
						if (!st.hasQuestItems(RANGER_REPORT_2))
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(RANGER_REPORT_2, 1);
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
						}
 | 
			
		||||
						else if (!st.hasQuestItems(RANGER_REPORT_3))
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(RANGER_REPORT_3, 1);
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
						}
 | 
			
		||||
						else if (!st.hasQuestItems(RANGER_REPORT_4))
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(RANGER_REPORT_4, 1);
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 20438:
 | 
			
		||||
				if ((st.getInt("cond") == 6) && (Rnd.get(100) < 10) && !st.hasQuestItems(WEAPON_TRADE_CONTRACT, ATTACK_DIRECTIVES))
 | 
			
		||||
				{
 | 
			
		||||
					st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
					st.giveItems(WEAPON_TRADE_CONTRACT, 1);
 | 
			
		||||
					st.giveItems(ATTACK_DIRECTIVES, 1);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 20066:
 | 
			
		||||
				if (st.getInt("cond") == 10)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(OL_MAHUM_HEAD, 1, 30, 500000);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20496, 530000);
 | 
			
		||||
		CHANCES.put(20497, 550000);
 | 
			
		||||
		CHANCES.put(20498, 510000);
 | 
			
		||||
		CHANCES.put(20499, 500000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q171_ActsOfEvil()
 | 
			
		||||
	{
 | 
			
		||||
		super(171, qn, "Acts of Evil");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BLADE_MOLD, TYRA_BILL, RANGER_REPORT_1, RANGER_REPORT_2, RANGER_REPORT_3, RANGER_REPORT_4, WEAPON_TRADE_CONTRACT, ATTACK_DIRECTIVES, CERTIFICATE, CARGO_BOX, OL_MAHUM_HEAD);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(ALVAH);
 | 
			
		||||
		addTalkId(ALVAH, ARODIN, TYRA, ROLENTO, NETI, BURAI);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20496, 20497, 20498, 20499, 20062, 20064, 20066, 20438);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30381-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30207-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30381-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "5");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30381-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "7");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(WEAPON_TRADE_CONTRACT, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30437-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "9");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(CARGO_BOX, 1);
 | 
			
		||||
			st.giveItems(CERTIFICATE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30617-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "10");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(ATTACK_DIRECTIVES, 1);
 | 
			
		||||
			st.takeItems(CARGO_BOX, 1);
 | 
			
		||||
			st.takeItems(CERTIFICATE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 27) ? "30381-01a.htm" : "30381-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case ALVAH:
 | 
			
		||||
						if (cond < 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30381-02a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30381-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasQuestItems(RANGER_REPORT_1, RANGER_REPORT_2, RANGER_REPORT_3, RANGER_REPORT_4))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30381-05.htm";
 | 
			
		||||
								st.set("cond", "6");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(RANGER_REPORT_1, 1);
 | 
			
		||||
								st.takeItems(RANGER_REPORT_2, 1);
 | 
			
		||||
								st.takeItems(RANGER_REPORT_3, 1);
 | 
			
		||||
								st.takeItems(RANGER_REPORT_4, 1);
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30381-04a.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 6)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasQuestItems(WEAPON_TRADE_CONTRACT, ATTACK_DIRECTIVES))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30381-06.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30381-05a.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if ((cond > 6) && (cond < 11))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30381-07a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 11)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30381-08.htm";
 | 
			
		||||
							st.rewardItems(57, 90000);
 | 
			
		||||
							st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
							st.exitQuest(false);
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ARODIN:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30207-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30207-01a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasQuestItems(TYRA_BILL))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30207-03.htm";
 | 
			
		||||
								st.set("cond", "4");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(TYRA_BILL, 1);
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30207-01a.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30207-03a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case TYRA:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.getQuestItemsCount(BLADE_MOLD) >= 20)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30420-01.htm";
 | 
			
		||||
								st.set("cond", "3");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(BLADE_MOLD, -1);
 | 
			
		||||
								st.giveItems(TYRA_BILL, 1);
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30420-01b.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30420-01a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30420-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case NETI:
 | 
			
		||||
						if (cond == 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30425-01.htm";
 | 
			
		||||
							st.set("cond", "8");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30425-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ROLENTO:
 | 
			
		||||
						if (cond == 8)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30437-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 8)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30437-03a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case BURAI:
 | 
			
		||||
						if ((cond == 9) && st.hasQuestItems(CERTIFICATE, CARGO_BOX, ATTACK_DIRECTIVES))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30617-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 10)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.getQuestItemsCount(OL_MAHUM_HEAD) >= 30)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30617-05.htm";
 | 
			
		||||
								st.set("cond", "11");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(OL_MAHUM_HEAD, -1);
 | 
			
		||||
								st.rewardItems(57, 8000);
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30617-04a.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case 20496:
 | 
			
		||||
			case 20497:
 | 
			
		||||
			case 20498:
 | 
			
		||||
			case 20499:
 | 
			
		||||
				if ((st.getInt("cond") == 2) && !st.dropItems(BLADE_MOLD, 1, 20, CHANCES.get(npcId)))
 | 
			
		||||
				{
 | 
			
		||||
					final int count = st.getQuestItemsCount(BLADE_MOLD);
 | 
			
		||||
					if ((count == 5) || ((count >= 10) && (Rnd.get(100) < 25)))
 | 
			
		||||
					{
 | 
			
		||||
						addSpawn(27190, player.getX(), player.getY(), player.getZ(), player.getHeading(), false, 0);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 20062:
 | 
			
		||||
			case 20064:
 | 
			
		||||
				if (st.getInt("cond") == 5)
 | 
			
		||||
				{
 | 
			
		||||
					if (!st.hasQuestItems(RANGER_REPORT_1))
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(RANGER_REPORT_1, 1);
 | 
			
		||||
						st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
					}
 | 
			
		||||
					else if (Rnd.get(100) < 20)
 | 
			
		||||
					{
 | 
			
		||||
						if (!st.hasQuestItems(RANGER_REPORT_2))
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(RANGER_REPORT_2, 1);
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
						}
 | 
			
		||||
						else if (!st.hasQuestItems(RANGER_REPORT_3))
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(RANGER_REPORT_3, 1);
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
						}
 | 
			
		||||
						else if (!st.hasQuestItems(RANGER_REPORT_4))
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(RANGER_REPORT_4, 1);
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 20438:
 | 
			
		||||
				if ((st.getInt("cond") == 6) && (Rnd.get(100) < 10) && !st.hasQuestItems(WEAPON_TRADE_CONTRACT, ATTACK_DIRECTIVES))
 | 
			
		||||
				{
 | 
			
		||||
					st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
					st.giveItems(WEAPON_TRADE_CONTRACT, 1);
 | 
			
		||||
					st.giveItems(ATTACK_DIRECTIVES, 1);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 20066:
 | 
			
		||||
				if (st.getInt("cond") == 10)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(OL_MAHUM_HEAD, 1, 30, 500000);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,417 +1,419 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q234_FatesWhisper;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.datatables.xml.ItemTable;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
 | 
			
		||||
 | 
			
		||||
public class Q234_FatesWhisper extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q234_FatesWhisper";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int REIRIA_SOUL_ORB = 4666;
 | 
			
		||||
	private static final int KERMON_INFERNIUM_SCEPTER = 4667;
 | 
			
		||||
	private static final int GOLKONDA_INFERNIUM_SCEPTER = 4668;
 | 
			
		||||
	private static final int HALLATE_INFERNIUM_SCEPTER = 4669;
 | 
			
		||||
	
 | 
			
		||||
	private static final int INFERNIUM_VARNISH = 4672;
 | 
			
		||||
	private static final int REORIN_HAMMER = 4670;
 | 
			
		||||
	private static final int REORIN_MOLD = 4671;
 | 
			
		||||
	
 | 
			
		||||
	private static final int PIPETTE_KNIFE = 4665;
 | 
			
		||||
	private static final int RED_PIPETTE_KNIFE = 4673;
 | 
			
		||||
	
 | 
			
		||||
	private static final int CRYSTAL_B = 1460;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int STAR_OF_DESTINY = 5011;
 | 
			
		||||
	
 | 
			
		||||
	// Chest Spawn
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q234_FatesWhisper;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.datatables.xml.ItemTable;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
import com.l2jmobius.gameserver.network.serverpackets.SocialAction;
 | 
			
		||||
 | 
			
		||||
public class Q234_FatesWhisper extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q234_FatesWhisper";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int REIRIA_SOUL_ORB = 4666;
 | 
			
		||||
	private static final int KERMON_INFERNIUM_SCEPTER = 4667;
 | 
			
		||||
	private static final int GOLKONDA_INFERNIUM_SCEPTER = 4668;
 | 
			
		||||
	private static final int HALLATE_INFERNIUM_SCEPTER = 4669;
 | 
			
		||||
	
 | 
			
		||||
	private static final int INFERNIUM_VARNISH = 4672;
 | 
			
		||||
	private static final int REORIN_HAMMER = 4670;
 | 
			
		||||
	private static final int REORIN_MOLD = 4671;
 | 
			
		||||
	
 | 
			
		||||
	private static final int PIPETTE_KNIFE = 4665;
 | 
			
		||||
	private static final int RED_PIPETTE_KNIFE = 4673;
 | 
			
		||||
	
 | 
			
		||||
	private static final int CRYSTAL_B = 1460;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int STAR_OF_DESTINY = 5011;
 | 
			
		||||
	
 | 
			
		||||
	// Chest Spawn
 | 
			
		||||
	private static final Map<Integer, Integer> CHEST_SPAWN = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHEST_SPAWN.put(25035, 31027);
 | 
			
		||||
		CHEST_SPAWN.put(25054, 31028);
 | 
			
		||||
		CHEST_SPAWN.put(25126, 31029);
 | 
			
		||||
		CHEST_SPAWN.put(25220, 31030);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Weapons
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHEST_SPAWN.put(25035, 31027);
 | 
			
		||||
		CHEST_SPAWN.put(25054, 31028);
 | 
			
		||||
		CHEST_SPAWN.put(25126, 31029);
 | 
			
		||||
		CHEST_SPAWN.put(25220, 31030);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Weapons
 | 
			
		||||
	private static final Map<Integer, String> WEAPONS = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		WEAPONS.put(79, "Sword of Damascus");
 | 
			
		||||
		WEAPONS.put(97, "Lance");
 | 
			
		||||
		WEAPONS.put(171, "Deadman's Glory");
 | 
			
		||||
		WEAPONS.put(175, "Art of Battle Axe");
 | 
			
		||||
		WEAPONS.put(210, "Staff of Evil Spirits");
 | 
			
		||||
		WEAPONS.put(234, "Demon Dagger");
 | 
			
		||||
		WEAPONS.put(268, "Bellion Cestus");
 | 
			
		||||
		WEAPONS.put(287, "Bow of Peril");
 | 
			
		||||
		WEAPONS.put(2626, "Samurai Dual-sword");
 | 
			
		||||
		WEAPONS.put(7883, "Guardian Sword");
 | 
			
		||||
		WEAPONS.put(7889, "Wizard's Tear");
 | 
			
		||||
		WEAPONS.put(7893, "Kaim Vanul's Bones");
 | 
			
		||||
		WEAPONS.put(7901, "Star Buster");
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q234_FatesWhisper()
 | 
			
		||||
	{
 | 
			
		||||
		super(234, qn, "Fate's Whispers");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(PIPETTE_KNIFE, RED_PIPETTE_KNIFE);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31002);
 | 
			
		||||
		addTalkId(31002, 30182, 30847, 30178, 30833, 31028, 31029, 31030, 31027);
 | 
			
		||||
		
 | 
			
		||||
		// The 4 bosses which spawn chests
 | 
			
		||||
		addKillId(25035, 25054, 25126, 25220);
 | 
			
		||||
		
 | 
			
		||||
		// Baium
 | 
			
		||||
		addAttackId(29020);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31002-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30182-01c.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			st.giveItems(INFERNIUM_VARNISH, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30178-01a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "6");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30833-01b.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "7");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(PIPETTE_KNIFE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("selectBGrade_"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getInt("bypass") == 1)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			String bGradeId = event.replace("selectBGrade_", "");
 | 
			
		||||
			st.set("weaponId", bGradeId);
 | 
			
		||||
			htmltext = getHtmlText("31002-13.htm").replace("%weaponname%", WEAPONS.get(st.getInt("weaponId")));
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("confirmWeapon"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("bypass", "1");
 | 
			
		||||
			htmltext = getHtmlText("31002-14.htm").replace("%weaponname%", WEAPONS.get(st.getInt("weaponId")));
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("selectAGrade_"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getInt("bypass") == 1)
 | 
			
		||||
			{
 | 
			
		||||
				final int itemId = st.getInt("weaponId");
 | 
			
		||||
				if (st.hasQuestItems(itemId))
 | 
			
		||||
				{
 | 
			
		||||
					int aGradeItemId = Integer.parseInt(event.replace("selectAGrade_", ""));
 | 
			
		||||
					
 | 
			
		||||
					htmltext = getHtmlText("31002-12.htm").replace("%weaponname%", ItemTable.getInstance().getTemplate(aGradeItemId).getName());
 | 
			
		||||
					st.takeItems(itemId, 1);
 | 
			
		||||
					st.giveItems(aGradeItemId, 1);
 | 
			
		||||
					st.giveItems(STAR_OF_DESTINY, 1);
 | 
			
		||||
					player.broadcastPacket(new SocialAction(player.getObjectId(), 3));
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(false);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = getHtmlText("31002-15.htm").replace("%weaponname%", WEAPONS.get(itemId));
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31002-16.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 75) ? "31002-01.htm" : "31002-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case 31002:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							if (!st.hasQuestItems(REIRIA_SOUL_ORB))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-04b.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-05.htm";
 | 
			
		||||
								st.set("cond", "2");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(REIRIA_SOUL_ORB, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							if (!st.hasQuestItems(KERMON_INFERNIUM_SCEPTER) || !st.hasQuestItems(GOLKONDA_INFERNIUM_SCEPTER) || !st.hasQuestItems(HALLATE_INFERNIUM_SCEPTER))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-05c.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-06.htm";
 | 
			
		||||
								st.set("cond", "3");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(GOLKONDA_INFERNIUM_SCEPTER, 1);
 | 
			
		||||
								st.takeItems(HALLATE_INFERNIUM_SCEPTER, 1);
 | 
			
		||||
								st.takeItems(KERMON_INFERNIUM_SCEPTER, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							if (!st.hasQuestItems(INFERNIUM_VARNISH))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-06b.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-07.htm";
 | 
			
		||||
								st.set("cond", "4");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(INFERNIUM_VARNISH, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							if (!st.hasQuestItems(REORIN_HAMMER))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-07b.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-08.htm";
 | 
			
		||||
								st.set("cond", "5");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(REORIN_HAMMER, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if ((cond > 4) && (cond < 8))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31002-08b.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 8)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31002-09.htm";
 | 
			
		||||
							st.set("cond", "9");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
							st.takeItems(REORIN_MOLD, 1);
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 9)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.getQuestItemsCount(CRYSTAL_B) < 984)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-09b.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-BGradeList.htm";
 | 
			
		||||
								st.set("cond", "10");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(CRYSTAL_B, 984);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 10)
 | 
			
		||||
						{
 | 
			
		||||
							// If a weapon is selected
 | 
			
		||||
							if (st.getInt("bypass") == 1)
 | 
			
		||||
							{
 | 
			
		||||
								// If you got it in the inventory
 | 
			
		||||
								final int itemId = st.getInt("weaponId");
 | 
			
		||||
								htmltext = getHtmlText((st.hasQuestItems(itemId)) ? "31002-AGradeList.htm" : "31002-15.htm").replace("%weaponname%", WEAPONS.get(itemId));
 | 
			
		||||
							}
 | 
			
		||||
							// B weapon is still not selected
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-BGradeList.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 30182:
 | 
			
		||||
						if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = (!st.hasQuestItems(INFERNIUM_VARNISH)) ? "30182-01.htm" : "30182-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 30847:
 | 
			
		||||
						if ((cond == 4) && !st.hasQuestItems(REORIN_HAMMER))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30847-01.htm";
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
							st.giveItems(REORIN_HAMMER, 1);
 | 
			
		||||
						}
 | 
			
		||||
						else if ((cond >= 4) && st.hasQuestItems(REORIN_HAMMER))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30847-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 30178:
 | 
			
		||||
						if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30178-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30178-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 30833:
 | 
			
		||||
						if (cond == 6)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30833-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 7)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasQuestItems(PIPETTE_KNIFE) && !st.hasQuestItems(RED_PIPETTE_KNIFE))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30833-02.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30833-03.htm";
 | 
			
		||||
								st.set("cond", "8");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(RED_PIPETTE_KNIFE, 1);
 | 
			
		||||
								st.giveItems(REORIN_MOLD, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30833-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 31027:
 | 
			
		||||
						if ((cond == 1) && !st.hasQuestItems(REIRIA_SOUL_ORB))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31027-01.htm";
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
							st.giveItems(REIRIA_SOUL_ORB, 1);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31027-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 31028:
 | 
			
		||||
					case 31029:
 | 
			
		||||
					case 31030:
 | 
			
		||||
						final int itemId = npc.getNpcId() - 26361;
 | 
			
		||||
						if ((cond == 2) && !st.hasQuestItems(itemId))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = npc.getNpcId() + "-01.htm";
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
							st.giveItems(itemId, 1);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = npc.getNpcId() + "-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(attacker, npc, "cond", "7");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if ((attacker.getActiveWeaponItem() != null) && (attacker.getActiveWeaponItem().getItemId() == PIPETTE_KNIFE) && !st.hasQuestItems(RED_PIPETTE_KNIFE))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			st.takeItems(PIPETTE_KNIFE, 1);
 | 
			
		||||
			st.giveItems(RED_PIPETTE_KNIFE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		addSpawn(CHEST_SPAWN.get(npc.getNpcId()), npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 120000);
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		WEAPONS.put(79, "Sword of Damascus");
 | 
			
		||||
		WEAPONS.put(97, "Lance");
 | 
			
		||||
		WEAPONS.put(171, "Deadman's Glory");
 | 
			
		||||
		WEAPONS.put(175, "Art of Battle Axe");
 | 
			
		||||
		WEAPONS.put(210, "Staff of Evil Spirits");
 | 
			
		||||
		WEAPONS.put(234, "Demon Dagger");
 | 
			
		||||
		WEAPONS.put(268, "Bellion Cestus");
 | 
			
		||||
		WEAPONS.put(287, "Bow of Peril");
 | 
			
		||||
		WEAPONS.put(2626, "Samurai Dual-sword");
 | 
			
		||||
		WEAPONS.put(7883, "Guardian Sword");
 | 
			
		||||
		WEAPONS.put(7889, "Wizard's Tear");
 | 
			
		||||
		WEAPONS.put(7893, "Kaim Vanul's Bones");
 | 
			
		||||
		WEAPONS.put(7901, "Star Buster");
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q234_FatesWhisper()
 | 
			
		||||
	{
 | 
			
		||||
		super(234, qn, "Fate's Whispers");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(PIPETTE_KNIFE, RED_PIPETTE_KNIFE);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31002);
 | 
			
		||||
		addTalkId(31002, 30182, 30847, 30178, 30833, 31028, 31029, 31030, 31027);
 | 
			
		||||
		
 | 
			
		||||
		// The 4 bosses which spawn chests
 | 
			
		||||
		addKillId(25035, 25054, 25126, 25220);
 | 
			
		||||
		
 | 
			
		||||
		// Baium
 | 
			
		||||
		addAttackId(29020);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31002-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30182-01c.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			st.giveItems(INFERNIUM_VARNISH, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30178-01a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "6");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30833-01b.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "7");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(PIPETTE_KNIFE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("selectBGrade_"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getInt("bypass") == 1)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			String bGradeId = event.replace("selectBGrade_", "");
 | 
			
		||||
			st.set("weaponId", bGradeId);
 | 
			
		||||
			htmltext = getHtmlText("31002-13.htm").replace("%weaponname%", WEAPONS.get(st.getInt("weaponId")));
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("confirmWeapon"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("bypass", "1");
 | 
			
		||||
			htmltext = getHtmlText("31002-14.htm").replace("%weaponname%", WEAPONS.get(st.getInt("weaponId")));
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("selectAGrade_"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getInt("bypass") == 1)
 | 
			
		||||
			{
 | 
			
		||||
				final int itemId = st.getInt("weaponId");
 | 
			
		||||
				if (st.hasQuestItems(itemId))
 | 
			
		||||
				{
 | 
			
		||||
					int aGradeItemId = Integer.parseInt(event.replace("selectAGrade_", ""));
 | 
			
		||||
					
 | 
			
		||||
					htmltext = getHtmlText("31002-12.htm").replace("%weaponname%", ItemTable.getInstance().getTemplate(aGradeItemId).getName());
 | 
			
		||||
					st.takeItems(itemId, 1);
 | 
			
		||||
					st.giveItems(aGradeItemId, 1);
 | 
			
		||||
					st.giveItems(STAR_OF_DESTINY, 1);
 | 
			
		||||
					player.broadcastPacket(new SocialAction(player.getObjectId(), 3));
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(false);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = getHtmlText("31002-15.htm").replace("%weaponname%", WEAPONS.get(itemId));
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31002-16.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 75) ? "31002-01.htm" : "31002-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case 31002:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							if (!st.hasQuestItems(REIRIA_SOUL_ORB))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-04b.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-05.htm";
 | 
			
		||||
								st.set("cond", "2");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(REIRIA_SOUL_ORB, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							if (!st.hasQuestItems(KERMON_INFERNIUM_SCEPTER) || !st.hasQuestItems(GOLKONDA_INFERNIUM_SCEPTER) || !st.hasQuestItems(HALLATE_INFERNIUM_SCEPTER))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-05c.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-06.htm";
 | 
			
		||||
								st.set("cond", "3");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(GOLKONDA_INFERNIUM_SCEPTER, 1);
 | 
			
		||||
								st.takeItems(HALLATE_INFERNIUM_SCEPTER, 1);
 | 
			
		||||
								st.takeItems(KERMON_INFERNIUM_SCEPTER, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							if (!st.hasQuestItems(INFERNIUM_VARNISH))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-06b.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-07.htm";
 | 
			
		||||
								st.set("cond", "4");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(INFERNIUM_VARNISH, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							if (!st.hasQuestItems(REORIN_HAMMER))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-07b.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-08.htm";
 | 
			
		||||
								st.set("cond", "5");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(REORIN_HAMMER, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if ((cond > 4) && (cond < 8))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31002-08b.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 8)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31002-09.htm";
 | 
			
		||||
							st.set("cond", "9");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
							st.takeItems(REORIN_MOLD, 1);
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 9)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.getQuestItemsCount(CRYSTAL_B) < 984)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-09b.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-BGradeList.htm";
 | 
			
		||||
								st.set("cond", "10");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(CRYSTAL_B, 984);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 10)
 | 
			
		||||
						{
 | 
			
		||||
							// If a weapon is selected
 | 
			
		||||
							if (st.getInt("bypass") == 1)
 | 
			
		||||
							{
 | 
			
		||||
								// If you got it in the inventory
 | 
			
		||||
								final int itemId = st.getInt("weaponId");
 | 
			
		||||
								htmltext = getHtmlText((st.hasQuestItems(itemId)) ? "31002-AGradeList.htm" : "31002-15.htm").replace("%weaponname%", WEAPONS.get(itemId));
 | 
			
		||||
							}
 | 
			
		||||
							// B weapon is still not selected
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "31002-BGradeList.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 30182:
 | 
			
		||||
						if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = (!st.hasQuestItems(INFERNIUM_VARNISH)) ? "30182-01.htm" : "30182-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 30847:
 | 
			
		||||
						if ((cond == 4) && !st.hasQuestItems(REORIN_HAMMER))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30847-01.htm";
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
							st.giveItems(REORIN_HAMMER, 1);
 | 
			
		||||
						}
 | 
			
		||||
						else if ((cond >= 4) && st.hasQuestItems(REORIN_HAMMER))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30847-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 30178:
 | 
			
		||||
						if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30178-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30178-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 30833:
 | 
			
		||||
						if (cond == 6)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30833-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 7)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasQuestItems(PIPETTE_KNIFE) && !st.hasQuestItems(RED_PIPETTE_KNIFE))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30833-02.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30833-03.htm";
 | 
			
		||||
								st.set("cond", "8");
 | 
			
		||||
								st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								st.takeItems(RED_PIPETTE_KNIFE, 1);
 | 
			
		||||
								st.giveItems(REORIN_MOLD, 1);
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30833-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 31027:
 | 
			
		||||
						if ((cond == 1) && !st.hasQuestItems(REIRIA_SOUL_ORB))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31027-01.htm";
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
							st.giveItems(REIRIA_SOUL_ORB, 1);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31027-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case 31028:
 | 
			
		||||
					case 31029:
 | 
			
		||||
					case 31030:
 | 
			
		||||
						final int itemId = npc.getNpcId() - 26361;
 | 
			
		||||
						if ((cond == 2) && !st.hasQuestItems(itemId))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = npc.getNpcId() + "-01.htm";
 | 
			
		||||
							st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
							st.giveItems(itemId, 1);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = npc.getNpcId() + "-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(attacker, npc, "cond", "7");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if ((attacker.getActiveWeaponItem() != null) && (attacker.getActiveWeaponItem().getItemId() == PIPETTE_KNIFE) && !st.hasQuestItems(RED_PIPETTE_KNIFE))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			st.takeItems(PIPETTE_KNIFE, 1);
 | 
			
		||||
			st.giveItems(RED_PIPETTE_KNIFE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		addSpawn(CHEST_SPAWN.get(npc.getNpcId()), npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), true, 120000);
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,156 +1,157 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q300_HuntingLetoLizardman;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q300_HuntingLetoLizardman extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q300_HuntingLetoLizardman";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int BRACELET = 7139;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int LETO_LIZARDMAN = 20577;
 | 
			
		||||
	private static final int LETO_LIZARDMAN_ARCHER = 20578;
 | 
			
		||||
	private static final int LETO_LIZARDMAN_SOLDIER = 20579;
 | 
			
		||||
	private static final int LETO_LIZARDMAN_WARRIOR = 20580;
 | 
			
		||||
	private static final int LETO_LIZARDMAN_OVERLORD = 20582;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q300_HuntingLetoLizardman;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q300_HuntingLetoLizardman extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q300_HuntingLetoLizardman";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int BRACELET = 7139;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int LETO_LIZARDMAN = 20577;
 | 
			
		||||
	private static final int LETO_LIZARDMAN_ARCHER = 20578;
 | 
			
		||||
	private static final int LETO_LIZARDMAN_SOLDIER = 20579;
 | 
			
		||||
	private static final int LETO_LIZARDMAN_WARRIOR = 20580;
 | 
			
		||||
	private static final int LETO_LIZARDMAN_OVERLORD = 20582;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN, 300000);
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN_ARCHER, 320000);
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN_SOLDIER, 350000);
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN_WARRIOR, 650000);
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN_OVERLORD, 700000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q300_HuntingLetoLizardman()
 | 
			
		||||
	{
 | 
			
		||||
		super(300, qn, "Hunting Leto Lizardman");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BRACELET);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30126); // Rath
 | 
			
		||||
		addTalkId(30126);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(LETO_LIZARDMAN, LETO_LIZARDMAN_ARCHER, LETO_LIZARDMAN_SOLDIER, LETO_LIZARDMAN_WARRIOR, LETO_LIZARDMAN_OVERLORD);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30126-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30126-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BRACELET) >= 60)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30126-06.htm";
 | 
			
		||||
				st.takeItems(BRACELET, -1);
 | 
			
		||||
				
 | 
			
		||||
				final int luck = Rnd.get(3);
 | 
			
		||||
				if (luck == 0)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(57, 30000);
 | 
			
		||||
				}
 | 
			
		||||
				else if (luck == 1)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(1867, 50);
 | 
			
		||||
				}
 | 
			
		||||
				else if (luck == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(1872, 50);
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 34) ? "30126-01.htm" : "30126-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (st.getInt("cond") == 1) ? "30126-04a.htm" : "30126-04.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMember(player, npc, "1");
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(BRACELET, 1, 60, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN, 300000);
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN_ARCHER, 320000);
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN_SOLDIER, 350000);
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN_WARRIOR, 650000);
 | 
			
		||||
		CHANCES.put(LETO_LIZARDMAN_OVERLORD, 700000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q300_HuntingLetoLizardman()
 | 
			
		||||
	{
 | 
			
		||||
		super(300, qn, "Hunting Leto Lizardman");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BRACELET);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30126); // Rath
 | 
			
		||||
		addTalkId(30126);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(LETO_LIZARDMAN, LETO_LIZARDMAN_ARCHER, LETO_LIZARDMAN_SOLDIER, LETO_LIZARDMAN_WARRIOR, LETO_LIZARDMAN_OVERLORD);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30126-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30126-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BRACELET) >= 60)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30126-06.htm";
 | 
			
		||||
				st.takeItems(BRACELET, -1);
 | 
			
		||||
				
 | 
			
		||||
				final int luck = Rnd.get(3);
 | 
			
		||||
				if (luck == 0)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(57, 30000);
 | 
			
		||||
				}
 | 
			
		||||
				else if (luck == 1)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(1867, 50);
 | 
			
		||||
				}
 | 
			
		||||
				else if (luck == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(1872, 50);
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 34) ? "30126-01.htm" : "30126-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (st.getInt("cond") == 1) ? "30126-04a.htm" : "30126-04.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMember(player, npc, "1");
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(BRACELET, 1, 60, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,126 +1,127 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q324_SweetestVenom;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q324_SweetestVenom extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q324_SweetestVenom";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int VENOM_SAC = 1077;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q324_SweetestVenom;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q324_SweetestVenom extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q324_SweetestVenom";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int VENOM_SAC = 1077;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20034, 220000);
 | 
			
		||||
		CHANCES.put(20038, 230000);
 | 
			
		||||
		CHANCES.put(20043, 250000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q324_SweetestVenom()
 | 
			
		||||
	{
 | 
			
		||||
		super(324, qn, "Sweetest Venom");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(VENOM_SAC);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30351); // Astaron
 | 
			
		||||
		addTalkId(30351);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20034, 20038, 20043);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30351-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 18) ? "30351-02.htm" : "30351-03.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				if (st.getInt("cond") == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30351-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30351-06.htm";
 | 
			
		||||
					st.takeItems(VENOM_SAC, -1);
 | 
			
		||||
					st.rewardItems(57, 5810);
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(VENOM_SAC, 1, 10, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20034, 220000);
 | 
			
		||||
		CHANCES.put(20038, 230000);
 | 
			
		||||
		CHANCES.put(20043, 250000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q324_SweetestVenom()
 | 
			
		||||
	{
 | 
			
		||||
		super(324, qn, "Sweetest Venom");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(VENOM_SAC);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30351); // Astaron
 | 
			
		||||
		addTalkId(30351);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20034, 20038, 20043);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30351-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 18) ? "30351-02.htm" : "30351-03.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				if (st.getInt("cond") == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30351-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30351-06.htm";
 | 
			
		||||
					st.takeItems(VENOM_SAC, -1);
 | 
			
		||||
					st.rewardItems(57, 5810);
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(VENOM_SAC, 1, 10, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,262 +1,263 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q325_GrimCollector;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q325_GrimCollector extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q325_GrimCollector";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int ANATOMY_DIAGRAM = 1349;
 | 
			
		||||
	private static final int ZOMBIE_HEAD = 1350;
 | 
			
		||||
	private static final int ZOMBIE_HEART = 1351;
 | 
			
		||||
	private static final int ZOMBIE_LIVER = 1352;
 | 
			
		||||
	private static final int SKULL = 1353;
 | 
			
		||||
	private static final int RIB_BONE = 1354;
 | 
			
		||||
	private static final int SPINE = 1355;
 | 
			
		||||
	private static final int ARM_BONE = 1356;
 | 
			
		||||
	private static final int THIGH_BONE = 1357;
 | 
			
		||||
	private static final int COMPLETE_SKELETON = 1358;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int CURTIS = 30336;
 | 
			
		||||
	private static final int VARSAK = 30342;
 | 
			
		||||
	private static final int SAMED = 30434;
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q325_GrimCollector;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.holders.ItemHolder;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q325_GrimCollector extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q325_GrimCollector";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int ANATOMY_DIAGRAM = 1349;
 | 
			
		||||
	private static final int ZOMBIE_HEAD = 1350;
 | 
			
		||||
	private static final int ZOMBIE_HEART = 1351;
 | 
			
		||||
	private static final int ZOMBIE_LIVER = 1352;
 | 
			
		||||
	private static final int SKULL = 1353;
 | 
			
		||||
	private static final int RIB_BONE = 1354;
 | 
			
		||||
	private static final int SPINE = 1355;
 | 
			
		||||
	private static final int ARM_BONE = 1356;
 | 
			
		||||
	private static final int THIGH_BONE = 1357;
 | 
			
		||||
	private static final int COMPLETE_SKELETON = 1358;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int CURTIS = 30336;
 | 
			
		||||
	private static final int VARSAK = 30342;
 | 
			
		||||
	private static final int SAMED = 30434;
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, List<ItemHolder>> DROPLIST = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(20026, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 30), new ItemHolder(ZOMBIE_HEART, 50), new ItemHolder(ZOMBIE_LIVER, 75)));
 | 
			
		||||
		DROPLIST.put(20029, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 30), new ItemHolder(ZOMBIE_HEART, 52), new ItemHolder(ZOMBIE_LIVER, 75)));
 | 
			
		||||
		DROPLIST.put(20035, Arrays.asList(new ItemHolder(SKULL, 5), new ItemHolder(RIB_BONE, 15), new ItemHolder(SPINE, 29), new ItemHolder(THIGH_BONE, 79)));
 | 
			
		||||
		DROPLIST.put(20042, Arrays.asList(new ItemHolder(SKULL, 6), new ItemHolder(RIB_BONE, 19), new ItemHolder(ARM_BONE, 69), new ItemHolder(THIGH_BONE, 86)));
 | 
			
		||||
		DROPLIST.put(20045, Arrays.asList(new ItemHolder(SKULL, 9), new ItemHolder(SPINE, 59), new ItemHolder(ARM_BONE, 77), new ItemHolder(THIGH_BONE, 97)));
 | 
			
		||||
		DROPLIST.put(20051, Arrays.asList(new ItemHolder(SKULL, 9), new ItemHolder(RIB_BONE, 59), new ItemHolder(SPINE, 79), new ItemHolder(ARM_BONE, 100)));
 | 
			
		||||
		DROPLIST.put(20457, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 40), new ItemHolder(ZOMBIE_HEART, 60), new ItemHolder(ZOMBIE_LIVER, 80)));
 | 
			
		||||
		DROPLIST.put(20458, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 40), new ItemHolder(ZOMBIE_HEART, 70), new ItemHolder(ZOMBIE_LIVER, 100)));
 | 
			
		||||
		DROPLIST.put(20514, Arrays.asList(new ItemHolder(SKULL, 6), new ItemHolder(RIB_BONE, 21), new ItemHolder(SPINE, 30), new ItemHolder(ARM_BONE, 31), new ItemHolder(THIGH_BONE, 64)));
 | 
			
		||||
		DROPLIST.put(20515, Arrays.asList(new ItemHolder(SKULL, 5), new ItemHolder(RIB_BONE, 20), new ItemHolder(SPINE, 31), new ItemHolder(ARM_BONE, 33), new ItemHolder(THIGH_BONE, 69)));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q325_GrimCollector()
 | 
			
		||||
	{
 | 
			
		||||
		super(325, qn, "Grim Collector");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ZOMBIE_HEAD, ZOMBIE_HEART, ZOMBIE_LIVER, SKULL, RIB_BONE, SPINE, ARM_BONE, THIGH_BONE, COMPLETE_SKELETON, ANATOMY_DIAGRAM);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(CURTIS);
 | 
			
		||||
		addTalkId(CURTIS, VARSAK, SAMED);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : DROPLIST.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static int getNumberOfPieces(QuestState st)
 | 
			
		||||
	{
 | 
			
		||||
		return st.getQuestItemsCount(ZOMBIE_HEAD) + st.getQuestItemsCount(SPINE) + st.getQuestItemsCount(ARM_BONE) + st.getQuestItemsCount(ZOMBIE_HEART) + st.getQuestItemsCount(ZOMBIE_LIVER) + st.getQuestItemsCount(SKULL) + st.getQuestItemsCount(RIB_BONE) + st.getQuestItemsCount(THIGH_BONE) + st.getQuestItemsCount(COMPLETE_SKELETON);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static void payback(QuestState st)
 | 
			
		||||
	{
 | 
			
		||||
		final int count = getNumberOfPieces(st);
 | 
			
		||||
		if (count > 0)
 | 
			
		||||
		{
 | 
			
		||||
			int reward = (30 * st.getQuestItemsCount(ZOMBIE_HEAD)) + (20 * st.getQuestItemsCount(ZOMBIE_HEART)) + (20 * st.getQuestItemsCount(ZOMBIE_LIVER)) + (100 * st.getQuestItemsCount(SKULL)) + (40 * st.getQuestItemsCount(RIB_BONE)) + (14 * st.getQuestItemsCount(SPINE)) + (14 * st.getQuestItemsCount(ARM_BONE)) + (14 * st.getQuestItemsCount(THIGH_BONE)) + (341 * st.getQuestItemsCount(COMPLETE_SKELETON));
 | 
			
		||||
			if (count > 10)
 | 
			
		||||
			{
 | 
			
		||||
				reward += 1629;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			if (st.hasQuestItems(COMPLETE_SKELETON))
 | 
			
		||||
			{
 | 
			
		||||
				reward += 543;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			st.takeItems(ZOMBIE_HEAD, -1);
 | 
			
		||||
			st.takeItems(ZOMBIE_HEART, -1);
 | 
			
		||||
			st.takeItems(ZOMBIE_LIVER, -1);
 | 
			
		||||
			st.takeItems(SKULL, -1);
 | 
			
		||||
			st.takeItems(RIB_BONE, -1);
 | 
			
		||||
			st.takeItems(SPINE, -1);
 | 
			
		||||
			st.takeItems(ARM_BONE, -1);
 | 
			
		||||
			st.takeItems(THIGH_BONE, -1);
 | 
			
		||||
			st.takeItems(COMPLETE_SKELETON, -1);
 | 
			
		||||
			
 | 
			
		||||
			st.rewardItems(57, reward);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30336-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30434-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			st.giveItems(ANATOMY_DIAGRAM, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30434-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(ANATOMY_DIAGRAM, -1);
 | 
			
		||||
			payback(st);
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30434-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			payback(st);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30434-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int skeletons = st.getQuestItemsCount(COMPLETE_SKELETON);
 | 
			
		||||
			if (skeletons > 0)
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(COMPLETE_SKELETON, -1);
 | 
			
		||||
				st.rewardItems(57, 543 + (341 * skeletons));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30342-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(SPINE, ARM_BONE, SKULL, RIB_BONE, THIGH_BONE))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30342-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(SPINE, 1);
 | 
			
		||||
				st.takeItems(SKULL, 1);
 | 
			
		||||
				st.takeItems(ARM_BONE, 1);
 | 
			
		||||
				st.takeItems(RIB_BONE, 1);
 | 
			
		||||
				st.takeItems(THIGH_BONE, 1);
 | 
			
		||||
				
 | 
			
		||||
				if (Rnd.get(10) < 9)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(COMPLETE_SKELETON, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30342-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 15) ? "30336-01.htm" : "30336-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case CURTIS:
 | 
			
		||||
						htmltext = (!st.hasQuestItems(ANATOMY_DIAGRAM)) ? "30336-04.htm" : "30336-05.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case SAMED:
 | 
			
		||||
						if (!st.hasQuestItems(ANATOMY_DIAGRAM))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30434-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							if (getNumberOfPieces(st) == 0)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30434-04.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = (!st.hasQuestItems(COMPLETE_SKELETON)) ? "30434-05.htm" : "30434-08.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case VARSAK:
 | 
			
		||||
						htmltext = "30342-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.hasQuestItems(ANATOMY_DIAGRAM))
 | 
			
		||||
		{
 | 
			
		||||
			final int chance = Rnd.get(100);
 | 
			
		||||
			for (ItemHolder drop : DROPLIST.get(npc.getNpcId()))
 | 
			
		||||
			{
 | 
			
		||||
				if (chance < drop.getCount())
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItemsAlways(drop.getId(), 1, 0);
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(20026, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 30), new ItemHolder(ZOMBIE_HEART, 50), new ItemHolder(ZOMBIE_LIVER, 75)));
 | 
			
		||||
		DROPLIST.put(20029, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 30), new ItemHolder(ZOMBIE_HEART, 52), new ItemHolder(ZOMBIE_LIVER, 75)));
 | 
			
		||||
		DROPLIST.put(20035, Arrays.asList(new ItemHolder(SKULL, 5), new ItemHolder(RIB_BONE, 15), new ItemHolder(SPINE, 29), new ItemHolder(THIGH_BONE, 79)));
 | 
			
		||||
		DROPLIST.put(20042, Arrays.asList(new ItemHolder(SKULL, 6), new ItemHolder(RIB_BONE, 19), new ItemHolder(ARM_BONE, 69), new ItemHolder(THIGH_BONE, 86)));
 | 
			
		||||
		DROPLIST.put(20045, Arrays.asList(new ItemHolder(SKULL, 9), new ItemHolder(SPINE, 59), new ItemHolder(ARM_BONE, 77), new ItemHolder(THIGH_BONE, 97)));
 | 
			
		||||
		DROPLIST.put(20051, Arrays.asList(new ItemHolder(SKULL, 9), new ItemHolder(RIB_BONE, 59), new ItemHolder(SPINE, 79), new ItemHolder(ARM_BONE, 100)));
 | 
			
		||||
		DROPLIST.put(20457, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 40), new ItemHolder(ZOMBIE_HEART, 60), new ItemHolder(ZOMBIE_LIVER, 80)));
 | 
			
		||||
		DROPLIST.put(20458, Arrays.asList(new ItemHolder(ZOMBIE_HEAD, 40), new ItemHolder(ZOMBIE_HEART, 70), new ItemHolder(ZOMBIE_LIVER, 100)));
 | 
			
		||||
		DROPLIST.put(20514, Arrays.asList(new ItemHolder(SKULL, 6), new ItemHolder(RIB_BONE, 21), new ItemHolder(SPINE, 30), new ItemHolder(ARM_BONE, 31), new ItemHolder(THIGH_BONE, 64)));
 | 
			
		||||
		DROPLIST.put(20515, Arrays.asList(new ItemHolder(SKULL, 5), new ItemHolder(RIB_BONE, 20), new ItemHolder(SPINE, 31), new ItemHolder(ARM_BONE, 33), new ItemHolder(THIGH_BONE, 69)));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q325_GrimCollector()
 | 
			
		||||
	{
 | 
			
		||||
		super(325, qn, "Grim Collector");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ZOMBIE_HEAD, ZOMBIE_HEART, ZOMBIE_LIVER, SKULL, RIB_BONE, SPINE, ARM_BONE, THIGH_BONE, COMPLETE_SKELETON, ANATOMY_DIAGRAM);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(CURTIS);
 | 
			
		||||
		addTalkId(CURTIS, VARSAK, SAMED);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : DROPLIST.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static int getNumberOfPieces(QuestState st)
 | 
			
		||||
	{
 | 
			
		||||
		return st.getQuestItemsCount(ZOMBIE_HEAD) + st.getQuestItemsCount(SPINE) + st.getQuestItemsCount(ARM_BONE) + st.getQuestItemsCount(ZOMBIE_HEART) + st.getQuestItemsCount(ZOMBIE_LIVER) + st.getQuestItemsCount(SKULL) + st.getQuestItemsCount(RIB_BONE) + st.getQuestItemsCount(THIGH_BONE) + st.getQuestItemsCount(COMPLETE_SKELETON);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static void payback(QuestState st)
 | 
			
		||||
	{
 | 
			
		||||
		final int count = getNumberOfPieces(st);
 | 
			
		||||
		if (count > 0)
 | 
			
		||||
		{
 | 
			
		||||
			int reward = (30 * st.getQuestItemsCount(ZOMBIE_HEAD)) + (20 * st.getQuestItemsCount(ZOMBIE_HEART)) + (20 * st.getQuestItemsCount(ZOMBIE_LIVER)) + (100 * st.getQuestItemsCount(SKULL)) + (40 * st.getQuestItemsCount(RIB_BONE)) + (14 * st.getQuestItemsCount(SPINE)) + (14 * st.getQuestItemsCount(ARM_BONE)) + (14 * st.getQuestItemsCount(THIGH_BONE)) + (341 * st.getQuestItemsCount(COMPLETE_SKELETON));
 | 
			
		||||
			if (count > 10)
 | 
			
		||||
			{
 | 
			
		||||
				reward += 1629;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			if (st.hasQuestItems(COMPLETE_SKELETON))
 | 
			
		||||
			{
 | 
			
		||||
				reward += 543;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			st.takeItems(ZOMBIE_HEAD, -1);
 | 
			
		||||
			st.takeItems(ZOMBIE_HEART, -1);
 | 
			
		||||
			st.takeItems(ZOMBIE_LIVER, -1);
 | 
			
		||||
			st.takeItems(SKULL, -1);
 | 
			
		||||
			st.takeItems(RIB_BONE, -1);
 | 
			
		||||
			st.takeItems(SPINE, -1);
 | 
			
		||||
			st.takeItems(ARM_BONE, -1);
 | 
			
		||||
			st.takeItems(THIGH_BONE, -1);
 | 
			
		||||
			st.takeItems(COMPLETE_SKELETON, -1);
 | 
			
		||||
			
 | 
			
		||||
			st.rewardItems(57, reward);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30336-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30434-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			st.giveItems(ANATOMY_DIAGRAM, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30434-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(ANATOMY_DIAGRAM, -1);
 | 
			
		||||
			payback(st);
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30434-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			payback(st);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30434-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int skeletons = st.getQuestItemsCount(COMPLETE_SKELETON);
 | 
			
		||||
			if (skeletons > 0)
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(COMPLETE_SKELETON, -1);
 | 
			
		||||
				st.rewardItems(57, 543 + (341 * skeletons));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30342-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(SPINE, ARM_BONE, SKULL, RIB_BONE, THIGH_BONE))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30342-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(SPINE, 1);
 | 
			
		||||
				st.takeItems(SKULL, 1);
 | 
			
		||||
				st.takeItems(ARM_BONE, 1);
 | 
			
		||||
				st.takeItems(RIB_BONE, 1);
 | 
			
		||||
				st.takeItems(THIGH_BONE, 1);
 | 
			
		||||
				
 | 
			
		||||
				if (Rnd.get(10) < 9)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(COMPLETE_SKELETON, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30342-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 15) ? "30336-01.htm" : "30336-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case CURTIS:
 | 
			
		||||
						htmltext = (!st.hasQuestItems(ANATOMY_DIAGRAM)) ? "30336-04.htm" : "30336-05.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case SAMED:
 | 
			
		||||
						if (!st.hasQuestItems(ANATOMY_DIAGRAM))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30434-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							if (getNumberOfPieces(st) == 0)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30434-04.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = (!st.hasQuestItems(COMPLETE_SKELETON)) ? "30434-05.htm" : "30434-08.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case VARSAK:
 | 
			
		||||
						htmltext = "30342-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.hasQuestItems(ANATOMY_DIAGRAM))
 | 
			
		||||
		{
 | 
			
		||||
			final int chance = Rnd.get(100);
 | 
			
		||||
			for (ItemHolder drop : DROPLIST.get(npc.getNpcId()))
 | 
			
		||||
			{
 | 
			
		||||
				if (chance < drop.getCount())
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItemsAlways(drop.getId(), 1, 0);
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,475 +1,476 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q327_RecoverTheFarmland;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q327_RecoverTheFarmland extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q327_RecoverTheFarmland";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int LEIKAN_LETTER = 5012;
 | 
			
		||||
	private static final int TUREK_DOGTAG = 1846;
 | 
			
		||||
	private static final int TUREK_MEDALLION = 1847;
 | 
			
		||||
	private static final int CLAY_URN_FRAGMENT = 1848;
 | 
			
		||||
	private static final int BRASS_TRINKET_PIECE = 1849;
 | 
			
		||||
	private static final int BRONZE_MIRROR_PIECE = 1850;
 | 
			
		||||
	private static final int JADE_NECKLACE_BEAD = 1851;
 | 
			
		||||
	private static final int ANCIENT_CLAY_URN = 1852;
 | 
			
		||||
	private static final int ANCIENT_BRASS_TIARA = 1853;
 | 
			
		||||
	private static final int ANCIENT_BRONZE_MIRROR = 1854;
 | 
			
		||||
	private static final int ANCIENT_JADE_NECKLACE = 1855;
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int ADENA = 57;
 | 
			
		||||
	private static final int SOULSHOT_D = 1463;
 | 
			
		||||
	private static final int SPIRITSHOT_D = 2510;
 | 
			
		||||
	private static final int HEALING_POTION = 1061;
 | 
			
		||||
	private static final int HASTE_POTION = 734;
 | 
			
		||||
	private static final int POTION_OF_ALACRITY = 735;
 | 
			
		||||
	private static final int SCROLL_OF_ESCAPE = 736;
 | 
			
		||||
	private static final int SCROLL_OF_RESURRECTION = 737;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int LEIKAN = 30382;
 | 
			
		||||
	private static final int PIOTUR = 30597;
 | 
			
		||||
	private static final int IRIS = 30034;
 | 
			
		||||
	private static final int ASHA = 30313;
 | 
			
		||||
	private static final int NESTLE = 30314;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int TUREK_ORC_WARLORD = 20495;
 | 
			
		||||
	private static final int TUREK_ORC_ARCHER = 20496;
 | 
			
		||||
	private static final int TUREK_ORC_SKIRMISHER = 20497;
 | 
			
		||||
	private static final int TUREK_ORC_SUPPLIER = 20498;
 | 
			
		||||
	private static final int TUREK_ORC_FOOTMAN = 20499;
 | 
			
		||||
	private static final int TUREK_ORC_SENTINEL = 20500;
 | 
			
		||||
	private static final int TUREK_ORC_SHAMAN = 20501;
 | 
			
		||||
	
 | 
			
		||||
	// Chances
 | 
			
		||||
	private static final int[][] DROPLIST =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_ARCHER,
 | 
			
		||||
			140000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_SKIRMISHER,
 | 
			
		||||
			70000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_SUPPLIER,
 | 
			
		||||
			120000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_FOOTMAN,
 | 
			
		||||
			100000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_SENTINEL,
 | 
			
		||||
			80000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_SHAMAN,
 | 
			
		||||
			90000,
 | 
			
		||||
			TUREK_MEDALLION
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_WARLORD,
 | 
			
		||||
			180000,
 | 
			
		||||
			TUREK_MEDALLION
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	// Exp
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q327_RecoverTheFarmland;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q327_RecoverTheFarmland extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q327_RecoverTheFarmland";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int LEIKAN_LETTER = 5012;
 | 
			
		||||
	private static final int TUREK_DOGTAG = 1846;
 | 
			
		||||
	private static final int TUREK_MEDALLION = 1847;
 | 
			
		||||
	private static final int CLAY_URN_FRAGMENT = 1848;
 | 
			
		||||
	private static final int BRASS_TRINKET_PIECE = 1849;
 | 
			
		||||
	private static final int BRONZE_MIRROR_PIECE = 1850;
 | 
			
		||||
	private static final int JADE_NECKLACE_BEAD = 1851;
 | 
			
		||||
	private static final int ANCIENT_CLAY_URN = 1852;
 | 
			
		||||
	private static final int ANCIENT_BRASS_TIARA = 1853;
 | 
			
		||||
	private static final int ANCIENT_BRONZE_MIRROR = 1854;
 | 
			
		||||
	private static final int ANCIENT_JADE_NECKLACE = 1855;
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int ADENA = 57;
 | 
			
		||||
	private static final int SOULSHOT_D = 1463;
 | 
			
		||||
	private static final int SPIRITSHOT_D = 2510;
 | 
			
		||||
	private static final int HEALING_POTION = 1061;
 | 
			
		||||
	private static final int HASTE_POTION = 734;
 | 
			
		||||
	private static final int POTION_OF_ALACRITY = 735;
 | 
			
		||||
	private static final int SCROLL_OF_ESCAPE = 736;
 | 
			
		||||
	private static final int SCROLL_OF_RESURRECTION = 737;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int LEIKAN = 30382;
 | 
			
		||||
	private static final int PIOTUR = 30597;
 | 
			
		||||
	private static final int IRIS = 30034;
 | 
			
		||||
	private static final int ASHA = 30313;
 | 
			
		||||
	private static final int NESTLE = 30314;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int TUREK_ORC_WARLORD = 20495;
 | 
			
		||||
	private static final int TUREK_ORC_ARCHER = 20496;
 | 
			
		||||
	private static final int TUREK_ORC_SKIRMISHER = 20497;
 | 
			
		||||
	private static final int TUREK_ORC_SUPPLIER = 20498;
 | 
			
		||||
	private static final int TUREK_ORC_FOOTMAN = 20499;
 | 
			
		||||
	private static final int TUREK_ORC_SENTINEL = 20500;
 | 
			
		||||
	private static final int TUREK_ORC_SHAMAN = 20501;
 | 
			
		||||
	
 | 
			
		||||
	// Chances
 | 
			
		||||
	private static final int[][] DROPLIST =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_ARCHER,
 | 
			
		||||
			140000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_SKIRMISHER,
 | 
			
		||||
			70000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_SUPPLIER,
 | 
			
		||||
			120000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_FOOTMAN,
 | 
			
		||||
			100000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_SENTINEL,
 | 
			
		||||
			80000,
 | 
			
		||||
			TUREK_DOGTAG
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_SHAMAN,
 | 
			
		||||
			90000,
 | 
			
		||||
			TUREK_MEDALLION
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			TUREK_ORC_WARLORD,
 | 
			
		||||
			180000,
 | 
			
		||||
			TUREK_MEDALLION
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	// Exp
 | 
			
		||||
	private static final Map<Integer, Integer> EXP_REWARD = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		EXP_REWARD.put(ANCIENT_CLAY_URN, 2766);
 | 
			
		||||
		EXP_REWARD.put(ANCIENT_BRASS_TIARA, 3227);
 | 
			
		||||
		EXP_REWARD.put(ANCIENT_BRONZE_MIRROR, 3227);
 | 
			
		||||
		EXP_REWARD.put(ANCIENT_JADE_NECKLACE, 3919);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q327_RecoverTheFarmland()
 | 
			
		||||
	{
 | 
			
		||||
		super(327, qn, "Recover the Farmland");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(LEIKAN_LETTER);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(LEIKAN, PIOTUR);
 | 
			
		||||
		addTalkId(LEIKAN, PIOTUR, IRIS, ASHA, NESTLE);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(TUREK_ORC_WARLORD, TUREK_ORC_ARCHER, TUREK_ORC_SKIRMISHER, TUREK_ORC_SUPPLIER, TUREK_ORC_FOOTMAN, TUREK_ORC_SENTINEL, TUREK_ORC_SHAMAN);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// Piotur
 | 
			
		||||
		if (event.equals("30597-03.htm") && (st.getInt("cond") < 1))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30597-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		// Leikan
 | 
			
		||||
		else if (event.equals("30382-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
			st.giveItems(LEIKAN_LETTER, 1);
 | 
			
		||||
		}
 | 
			
		||||
		// Asha
 | 
			
		||||
		else if (event.equals("30313-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(CLAY_URN_FRAGMENT) >= 5)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(CLAY_URN_FRAGMENT, 5);
 | 
			
		||||
				if (Rnd.get(6) < 5)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-03.htm";
 | 
			
		||||
					st.rewardItems(ANCIENT_CLAY_URN, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30313-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BRASS_TRINKET_PIECE) >= 5)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(BRASS_TRINKET_PIECE, 5);
 | 
			
		||||
				if (Rnd.get(7) < 6)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-05.htm";
 | 
			
		||||
					st.rewardItems(ANCIENT_BRASS_TIARA, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30313-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BRONZE_MIRROR_PIECE) >= 5)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(BRONZE_MIRROR_PIECE, 5);
 | 
			
		||||
				if (Rnd.get(7) < 6)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-07.htm";
 | 
			
		||||
					st.rewardItems(ANCIENT_BRONZE_MIRROR, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30313-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(JADE_NECKLACE_BEAD) >= 5)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(JADE_NECKLACE_BEAD, 5);
 | 
			
		||||
				if (Rnd.get(8) < 7)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-09.htm";
 | 
			
		||||
					st.rewardItems(ANCIENT_JADE_NECKLACE, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Iris
 | 
			
		||||
		else if (event.equals("30034-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int n = st.getQuestItemsCount(CLAY_URN_FRAGMENT);
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
				st.takeItems(CLAY_URN_FRAGMENT, n);
 | 
			
		||||
				st.rewardExpAndSp(n * 307, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30034-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int n = st.getQuestItemsCount(BRASS_TRINKET_PIECE);
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
				st.takeItems(BRASS_TRINKET_PIECE, n);
 | 
			
		||||
				st.rewardExpAndSp(n * 368, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30034-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int n = st.getQuestItemsCount(BRONZE_MIRROR_PIECE);
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
				st.takeItems(BRONZE_MIRROR_PIECE, n);
 | 
			
		||||
				st.rewardExpAndSp(n * 368, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30034-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int n = st.getQuestItemsCount(JADE_NECKLACE_BEAD);
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
				st.takeItems(JADE_NECKLACE_BEAD, n);
 | 
			
		||||
				st.rewardExpAndSp(n * 430, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30034-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			boolean isRewarded = false;
 | 
			
		||||
			
 | 
			
		||||
			for (int i = 1852; i < 1856; i++)
 | 
			
		||||
			{
 | 
			
		||||
				int n = st.getQuestItemsCount(i);
 | 
			
		||||
				if (n > 0)
 | 
			
		||||
				{
 | 
			
		||||
					st.takeItems(i, n);
 | 
			
		||||
					st.rewardExpAndSp(n * EXP_REWARD.get(i), 0);
 | 
			
		||||
					isRewarded = true;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (!isRewarded)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Nestle
 | 
			
		||||
		else if (event.equals("30314-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ANCIENT_CLAY_URN))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30314-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(ANCIENT_CLAY_URN, 1);
 | 
			
		||||
				st.rewardItems(SOULSHOT_D, 70 + Rnd.get(41));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30314-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ANCIENT_BRASS_TIARA))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30314-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(ANCIENT_BRASS_TIARA, 1);
 | 
			
		||||
				final int rnd = Rnd.get(100);
 | 
			
		||||
				if (rnd < 40)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(HEALING_POTION, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (rnd < 84)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(HASTE_POTION, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(POTION_OF_ALACRITY, 1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30314-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ANCIENT_BRONZE_MIRROR))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30314-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(ANCIENT_BRONZE_MIRROR, 1);
 | 
			
		||||
				st.rewardItems((Rnd.get(100) < 59) ? SCROLL_OF_ESCAPE : SCROLL_OF_RESURRECTION, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30314-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ANCIENT_JADE_NECKLACE))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30314-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(ANCIENT_JADE_NECKLACE, 1);
 | 
			
		||||
				st.rewardItems(SPIRITSHOT_D, 50 + Rnd.get(41));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = npc.getNpcId() + ((player.getLevel() < 25) ? "-01.htm" : "-02.htm");
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case PIOTUR:
 | 
			
		||||
						if (!st.hasQuestItems(LEIKAN_LETTER))
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasAtLeastOneQuestItem(TUREK_DOGTAG, TUREK_MEDALLION))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30597-05.htm";
 | 
			
		||||
								
 | 
			
		||||
								if (cond < 4)
 | 
			
		||||
								{
 | 
			
		||||
									st.set("cond", "4");
 | 
			
		||||
									st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								}
 | 
			
		||||
								
 | 
			
		||||
								final int dogtag = st.getQuestItemsCount(TUREK_DOGTAG);
 | 
			
		||||
								final int medallion = st.getQuestItemsCount(TUREK_MEDALLION);
 | 
			
		||||
								
 | 
			
		||||
								st.takeItems(TUREK_DOGTAG, -1);
 | 
			
		||||
								st.takeItems(TUREK_MEDALLION, -1);
 | 
			
		||||
								st.rewardItems(ADENA, (dogtag * 40) + (medallion * 50) + (((dogtag + medallion) >= 10) ? 619 : 0));
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30597-04.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30597-03a.htm";
 | 
			
		||||
							st.set("cond", "3");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
							st.takeItems(LEIKAN_LETTER, 1);
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case LEIKAN:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30382-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if ((cond == 3) || (cond == 4))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30382-05.htm";
 | 
			
		||||
							st.set("cond", "5");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30382-05.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					default:
 | 
			
		||||
						htmltext = npc.getNpcId() + "-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for (int[] npcData : DROPLIST)
 | 
			
		||||
		{
 | 
			
		||||
			if (npcData[0] == npc.getNpcId())
 | 
			
		||||
			{
 | 
			
		||||
				st.dropItemsAlways(npcData[2], 1, -1);
 | 
			
		||||
				st.dropItems(Rnd.get(1848, 1851), 1, 0, npcData[1]);
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		EXP_REWARD.put(ANCIENT_CLAY_URN, 2766);
 | 
			
		||||
		EXP_REWARD.put(ANCIENT_BRASS_TIARA, 3227);
 | 
			
		||||
		EXP_REWARD.put(ANCIENT_BRONZE_MIRROR, 3227);
 | 
			
		||||
		EXP_REWARD.put(ANCIENT_JADE_NECKLACE, 3919);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q327_RecoverTheFarmland()
 | 
			
		||||
	{
 | 
			
		||||
		super(327, qn, "Recover the Farmland");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(LEIKAN_LETTER);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(LEIKAN, PIOTUR);
 | 
			
		||||
		addTalkId(LEIKAN, PIOTUR, IRIS, ASHA, NESTLE);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(TUREK_ORC_WARLORD, TUREK_ORC_ARCHER, TUREK_ORC_SKIRMISHER, TUREK_ORC_SUPPLIER, TUREK_ORC_FOOTMAN, TUREK_ORC_SENTINEL, TUREK_ORC_SHAMAN);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// Piotur
 | 
			
		||||
		if (event.equals("30597-03.htm") && (st.getInt("cond") < 1))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30597-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		// Leikan
 | 
			
		||||
		else if (event.equals("30382-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
			st.giveItems(LEIKAN_LETTER, 1);
 | 
			
		||||
		}
 | 
			
		||||
		// Asha
 | 
			
		||||
		else if (event.equals("30313-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(CLAY_URN_FRAGMENT) >= 5)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(CLAY_URN_FRAGMENT, 5);
 | 
			
		||||
				if (Rnd.get(6) < 5)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-03.htm";
 | 
			
		||||
					st.rewardItems(ANCIENT_CLAY_URN, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30313-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BRASS_TRINKET_PIECE) >= 5)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(BRASS_TRINKET_PIECE, 5);
 | 
			
		||||
				if (Rnd.get(7) < 6)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-05.htm";
 | 
			
		||||
					st.rewardItems(ANCIENT_BRASS_TIARA, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30313-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BRONZE_MIRROR_PIECE) >= 5)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(BRONZE_MIRROR_PIECE, 5);
 | 
			
		||||
				if (Rnd.get(7) < 6)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-07.htm";
 | 
			
		||||
					st.rewardItems(ANCIENT_BRONZE_MIRROR, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30313-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(JADE_NECKLACE_BEAD) >= 5)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(JADE_NECKLACE_BEAD, 5);
 | 
			
		||||
				if (Rnd.get(8) < 7)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-09.htm";
 | 
			
		||||
					st.rewardItems(ANCIENT_JADE_NECKLACE, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30313-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Iris
 | 
			
		||||
		else if (event.equals("30034-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int n = st.getQuestItemsCount(CLAY_URN_FRAGMENT);
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
				st.takeItems(CLAY_URN_FRAGMENT, n);
 | 
			
		||||
				st.rewardExpAndSp(n * 307, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30034-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int n = st.getQuestItemsCount(BRASS_TRINKET_PIECE);
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
				st.takeItems(BRASS_TRINKET_PIECE, n);
 | 
			
		||||
				st.rewardExpAndSp(n * 368, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30034-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int n = st.getQuestItemsCount(BRONZE_MIRROR_PIECE);
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
				st.takeItems(BRONZE_MIRROR_PIECE, n);
 | 
			
		||||
				st.rewardExpAndSp(n * 368, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30034-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int n = st.getQuestItemsCount(JADE_NECKLACE_BEAD);
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
				st.takeItems(JADE_NECKLACE_BEAD, n);
 | 
			
		||||
				st.rewardExpAndSp(n * 430, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30034-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			boolean isRewarded = false;
 | 
			
		||||
			
 | 
			
		||||
			for (int i = 1852; i < 1856; i++)
 | 
			
		||||
			{
 | 
			
		||||
				int n = st.getQuestItemsCount(i);
 | 
			
		||||
				if (n > 0)
 | 
			
		||||
				{
 | 
			
		||||
					st.takeItems(i, n);
 | 
			
		||||
					st.rewardExpAndSp(n * EXP_REWARD.get(i), 0);
 | 
			
		||||
					isRewarded = true;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (!isRewarded)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30034-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Nestle
 | 
			
		||||
		else if (event.equals("30314-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ANCIENT_CLAY_URN))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30314-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(ANCIENT_CLAY_URN, 1);
 | 
			
		||||
				st.rewardItems(SOULSHOT_D, 70 + Rnd.get(41));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30314-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ANCIENT_BRASS_TIARA))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30314-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(ANCIENT_BRASS_TIARA, 1);
 | 
			
		||||
				final int rnd = Rnd.get(100);
 | 
			
		||||
				if (rnd < 40)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(HEALING_POTION, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (rnd < 84)
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(HASTE_POTION, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					st.rewardItems(POTION_OF_ALACRITY, 1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30314-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ANCIENT_BRONZE_MIRROR))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30314-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(ANCIENT_BRONZE_MIRROR, 1);
 | 
			
		||||
				st.rewardItems((Rnd.get(100) < 59) ? SCROLL_OF_ESCAPE : SCROLL_OF_RESURRECTION, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30314-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ANCIENT_JADE_NECKLACE))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30314-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(ANCIENT_JADE_NECKLACE, 1);
 | 
			
		||||
				st.rewardItems(SPIRITSHOT_D, 50 + Rnd.get(41));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = npc.getNpcId() + ((player.getLevel() < 25) ? "-01.htm" : "-02.htm");
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case PIOTUR:
 | 
			
		||||
						if (!st.hasQuestItems(LEIKAN_LETTER))
 | 
			
		||||
						{
 | 
			
		||||
							if (st.hasAtLeastOneQuestItem(TUREK_DOGTAG, TUREK_MEDALLION))
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30597-05.htm";
 | 
			
		||||
								
 | 
			
		||||
								if (cond < 4)
 | 
			
		||||
								{
 | 
			
		||||
									st.set("cond", "4");
 | 
			
		||||
									st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
								}
 | 
			
		||||
								
 | 
			
		||||
								final int dogtag = st.getQuestItemsCount(TUREK_DOGTAG);
 | 
			
		||||
								final int medallion = st.getQuestItemsCount(TUREK_MEDALLION);
 | 
			
		||||
								
 | 
			
		||||
								st.takeItems(TUREK_DOGTAG, -1);
 | 
			
		||||
								st.takeItems(TUREK_MEDALLION, -1);
 | 
			
		||||
								st.rewardItems(ADENA, (dogtag * 40) + (medallion * 50) + (((dogtag + medallion) >= 10) ? 619 : 0));
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30597-04.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30597-03a.htm";
 | 
			
		||||
							st.set("cond", "3");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
							st.takeItems(LEIKAN_LETTER, 1);
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case LEIKAN:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30382-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if ((cond == 3) || (cond == 4))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30382-05.htm";
 | 
			
		||||
							st.set("cond", "5");
 | 
			
		||||
							st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30382-05.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					default:
 | 
			
		||||
						htmltext = npc.getNpcId() + "-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for (int[] npcData : DROPLIST)
 | 
			
		||||
		{
 | 
			
		||||
			if (npcData[0] == npc.getNpcId())
 | 
			
		||||
			{
 | 
			
		||||
				st.dropItemsAlways(npcData[2], 1, -1);
 | 
			
		||||
				st.dropItems(Rnd.get(1848, 1851), 1, 0, npcData[1]);
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,154 +1,155 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q328_SenseForBusiness;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q328_SenseForBusiness extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q328_SenseForBusiness";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int MONSTER_EYE_LENS = 1366;
 | 
			
		||||
	private static final int MONSTER_EYE_CARCASS = 1347;
 | 
			
		||||
	private static final int BASILISK_GIZZARD = 1348;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q328_SenseForBusiness;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q328_SenseForBusiness extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q328_SenseForBusiness";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int MONSTER_EYE_LENS = 1366;
 | 
			
		||||
	private static final int MONSTER_EYE_CARCASS = 1347;
 | 
			
		||||
	private static final int BASILISK_GIZZARD = 1348;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20055, 48);
 | 
			
		||||
		CHANCES.put(20059, 52);
 | 
			
		||||
		CHANCES.put(20067, 68);
 | 
			
		||||
		CHANCES.put(20068, 76);
 | 
			
		||||
		CHANCES.put(20070, 500000);
 | 
			
		||||
		CHANCES.put(20072, 510000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q328_SenseForBusiness()
 | 
			
		||||
	{
 | 
			
		||||
		super(328, qn, "Sense for Business");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(MONSTER_EYE_LENS, MONSTER_EYE_CARCASS, BASILISK_GIZZARD);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30436); // Sarien
 | 
			
		||||
		addTalkId(30436);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20055, 20059, 20067, 20068, 20070, 20072);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30436-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30436-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 21) ? "30436-01.htm" : "30436-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int carcasses = st.getQuestItemsCount(MONSTER_EYE_CARCASS);
 | 
			
		||||
				final int lenses = st.getQuestItemsCount(MONSTER_EYE_LENS);
 | 
			
		||||
				final int gizzards = st.getQuestItemsCount(BASILISK_GIZZARD);
 | 
			
		||||
				
 | 
			
		||||
				final int all = carcasses + lenses + gizzards;
 | 
			
		||||
				
 | 
			
		||||
				if (all == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30436-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30436-05.htm";
 | 
			
		||||
					st.takeItems(MONSTER_EYE_CARCASS, -1);
 | 
			
		||||
					st.takeItems(MONSTER_EYE_LENS, -1);
 | 
			
		||||
					st.takeItems(BASILISK_GIZZARD, -1);
 | 
			
		||||
					st.rewardItems(57, (25 * carcasses) + (1000 * lenses) + (60 * gizzards) + ((all >= 10) ? 618 : 0));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		final int chance = CHANCES.get(npcId);
 | 
			
		||||
		
 | 
			
		||||
		if (npcId < 20069)
 | 
			
		||||
		{
 | 
			
		||||
			final int rnd = Rnd.get(100);
 | 
			
		||||
			if (rnd < (chance + 1))
 | 
			
		||||
			{
 | 
			
		||||
				st.dropItemsAlways((rnd < chance) ? MONSTER_EYE_CARCASS : MONSTER_EYE_LENS, 1, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItems(BASILISK_GIZZARD, 1, 0, chance);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20055, 48);
 | 
			
		||||
		CHANCES.put(20059, 52);
 | 
			
		||||
		CHANCES.put(20067, 68);
 | 
			
		||||
		CHANCES.put(20068, 76);
 | 
			
		||||
		CHANCES.put(20070, 500000);
 | 
			
		||||
		CHANCES.put(20072, 510000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q328_SenseForBusiness()
 | 
			
		||||
	{
 | 
			
		||||
		super(328, qn, "Sense for Business");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(MONSTER_EYE_LENS, MONSTER_EYE_CARCASS, BASILISK_GIZZARD);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30436); // Sarien
 | 
			
		||||
		addTalkId(30436);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20055, 20059, 20067, 20068, 20070, 20072);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30436-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30436-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 21) ? "30436-01.htm" : "30436-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int carcasses = st.getQuestItemsCount(MONSTER_EYE_CARCASS);
 | 
			
		||||
				final int lenses = st.getQuestItemsCount(MONSTER_EYE_LENS);
 | 
			
		||||
				final int gizzards = st.getQuestItemsCount(BASILISK_GIZZARD);
 | 
			
		||||
				
 | 
			
		||||
				final int all = carcasses + lenses + gizzards;
 | 
			
		||||
				
 | 
			
		||||
				if (all == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30436-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30436-05.htm";
 | 
			
		||||
					st.takeItems(MONSTER_EYE_CARCASS, -1);
 | 
			
		||||
					st.takeItems(MONSTER_EYE_LENS, -1);
 | 
			
		||||
					st.takeItems(BASILISK_GIZZARD, -1);
 | 
			
		||||
					st.rewardItems(57, (25 * carcasses) + (1000 * lenses) + (60 * gizzards) + ((all >= 10) ? 618 : 0));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		final int chance = CHANCES.get(npcId);
 | 
			
		||||
		
 | 
			
		||||
		if (npcId < 20069)
 | 
			
		||||
		{
 | 
			
		||||
			final int rnd = Rnd.get(100);
 | 
			
		||||
			if (rnd < (chance + 1))
 | 
			
		||||
			{
 | 
			
		||||
				st.dropItemsAlways((rnd < chance) ? MONSTER_EYE_CARCASS : MONSTER_EYE_LENS, 1, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItems(BASILISK_GIZZARD, 1, 0, chance);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,124 +1,125 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q341_HuntingForWildBeasts;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q341_HuntingForWildBeasts extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q341_HuntingForWildBeasts";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int BEAR_SKIN = 4259;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q341_HuntingForWildBeasts;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q341_HuntingForWildBeasts extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q341_HuntingForWildBeasts";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int BEAR_SKIN = 4259;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20021, 500000); // Red Bear
 | 
			
		||||
		CHANCES.put(20203, 900000); // Dion Grizzly
 | 
			
		||||
		CHANCES.put(20310, 500000); // Brown Bear
 | 
			
		||||
		CHANCES.put(20335, 700000); // Grizzly Bear
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q341_HuntingForWildBeasts()
 | 
			
		||||
	{
 | 
			
		||||
		super(341, qn, "Hunting for Wild Beasts");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BEAR_SKIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30078); // Pano
 | 
			
		||||
		addTalkId(30078);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20021, 20203, 20310, 20335);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30078-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 20) ? "30078-00.htm" : "30078-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				if (st.getQuestItemsCount(BEAR_SKIN) < 20)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30078-03.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30078-04.htm";
 | 
			
		||||
					st.takeItems(BEAR_SKIN, -1);
 | 
			
		||||
					st.rewardItems(57, 3710);
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st.dropItems(BEAR_SKIN, 1, 20, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20021, 500000); // Red Bear
 | 
			
		||||
		CHANCES.put(20203, 900000); // Dion Grizzly
 | 
			
		||||
		CHANCES.put(20310, 500000); // Brown Bear
 | 
			
		||||
		CHANCES.put(20335, 700000); // Grizzly Bear
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q341_HuntingForWildBeasts()
 | 
			
		||||
	{
 | 
			
		||||
		super(341, qn, "Hunting for Wild Beasts");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BEAR_SKIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30078); // Pano
 | 
			
		||||
		addTalkId(30078);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20021, 20203, 20310, 20335);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30078-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 20) ? "30078-00.htm" : "30078-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				if (st.getQuestItemsCount(BEAR_SKIN) < 20)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30078-03.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30078-04.htm";
 | 
			
		||||
					st.takeItems(BEAR_SKIN, -1);
 | 
			
		||||
					st.rewardItems(57, 3710);
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st.dropItems(BEAR_SKIN, 1, 20, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,316 +1,317 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q344_1000YearsTheEndOfLamentation;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q344_1000YearsTheEndOfLamentation extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q344_1000YearsTheEndOfLamentation";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int GILMORE = 30754;
 | 
			
		||||
	private static final int RODEMAI = 30756;
 | 
			
		||||
	private static final int ORVEN = 30857;
 | 
			
		||||
	private static final int KAIEN = 30623;
 | 
			
		||||
	private static final int GARVARENTZ = 30704;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int ARTICLE_DEAD_HERO = 4269;
 | 
			
		||||
	private static final int OLD_KEY = 4270;
 | 
			
		||||
	private static final int OLD_HILT = 4271;
 | 
			
		||||
	private static final int OLD_TOTEM = 4272;
 | 
			
		||||
	private static final int CRUCIFIX = 4273;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q344_1000YearsTheEndOfLamentation;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q344_1000YearsTheEndOfLamentation extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q344_1000YearsTheEndOfLamentation";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int GILMORE = 30754;
 | 
			
		||||
	private static final int RODEMAI = 30756;
 | 
			
		||||
	private static final int ORVEN = 30857;
 | 
			
		||||
	private static final int KAIEN = 30623;
 | 
			
		||||
	private static final int GARVARENTZ = 30704;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int ARTICLE_DEAD_HERO = 4269;
 | 
			
		||||
	private static final int OLD_KEY = 4270;
 | 
			
		||||
	private static final int OLD_HILT = 4271;
 | 
			
		||||
	private static final int OLD_TOTEM = 4272;
 | 
			
		||||
	private static final int CRUCIFIX = 4273;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20236, 380000);
 | 
			
		||||
		CHANCES.put(20237, 490000);
 | 
			
		||||
		CHANCES.put(20238, 460000);
 | 
			
		||||
		CHANCES.put(20239, 490000);
 | 
			
		||||
		CHANCES.put(20240, 530000);
 | 
			
		||||
		CHANCES.put(20272, 380000);
 | 
			
		||||
		CHANCES.put(20273, 490000);
 | 
			
		||||
		CHANCES.put(20274, 460000);
 | 
			
		||||
		CHANCES.put(20275, 490000);
 | 
			
		||||
		CHANCES.put(20276, 530000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q344_1000YearsTheEndOfLamentation()
 | 
			
		||||
	{
 | 
			
		||||
		super(344, qn, "1000 Years, the End of Lamentation");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ARTICLE_DEAD_HERO, OLD_KEY, OLD_HILT, OLD_TOTEM, CRUCIFIX);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(GILMORE);
 | 
			
		||||
		addTalkId(GILMORE, RODEMAI, ORVEN, GARVARENTZ, KAIEN);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20236, 20237, 20238, 20239, 20240, 20272, 20273, 20274, 20275, 20276);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30754-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30754-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.get("success") != null)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				st.unset("success");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30754-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30754-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ARTICLE_DEAD_HERO))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30754-06a.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				final int amount = st.getQuestItemsCount(ARTICLE_DEAD_HERO);
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(ARTICLE_DEAD_HERO, -1);
 | 
			
		||||
				st.giveItems(57, amount * 60);
 | 
			
		||||
				
 | 
			
		||||
				// Special item, % based on actual number of qItems.
 | 
			
		||||
				if (Rnd.get(1000) < Math.min(10, Math.max(1, amount / 10)))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30754-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30754-11.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int random = Rnd.get(4);
 | 
			
		||||
			if (random < 1)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30754-12.htm";
 | 
			
		||||
				st.giveItems(OLD_KEY, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else if (random < 2)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30754-13.htm";
 | 
			
		||||
				st.giveItems(OLD_HILT, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else if (random < 3)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30754-14.htm";
 | 
			
		||||
				st.giveItems(OLD_TOTEM, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.giveItems(CRUCIFIX, 1);
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 48) ? "30754-01.htm" : "30754-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case GILMORE:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = (st.hasQuestItems(ARTICLE_DEAD_HERO)) ? "30754-05.htm" : "30754-09.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = (st.get("success") != null) ? "30754-16.htm" : "30754-15.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					default:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.get("success") != null)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = npc.getNpcId() + "-02.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								rewards(st, npc.getNpcId());
 | 
			
		||||
								htmltext = npc.getNpcId() + "-01.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static void rewards(QuestState st, int npcId)
 | 
			
		||||
	{
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case ORVEN:
 | 
			
		||||
				if (st.hasQuestItems(CRUCIFIX))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("success", "1");
 | 
			
		||||
					st.takeItems(CRUCIFIX, -1);
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					if (chance < 80)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1875, 19);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 95)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(952, 5);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(2437, 1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case GARVARENTZ:
 | 
			
		||||
				if (st.hasQuestItems(OLD_TOTEM))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("success", "1");
 | 
			
		||||
					st.takeItems(OLD_TOTEM, -1);
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					if (chance < 55)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1882, 70);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 99)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1881, 50);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(191, 1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case KAIEN:
 | 
			
		||||
				if (st.hasQuestItems(OLD_HILT))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("success", "1");
 | 
			
		||||
					st.takeItems(OLD_HILT, -1);
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					if (chance < 60)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1874, 25);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 85)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1887, 10);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 99)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(951, 1);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(133, 1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case RODEMAI:
 | 
			
		||||
				if (st.hasQuestItems(OLD_KEY))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("success", "1");
 | 
			
		||||
					st.takeItems(OLD_KEY, -1);
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					if (chance < 80)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1879, 55);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 95)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(951, 1);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(885, 1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st.dropItems(ARTICLE_DEAD_HERO, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20236, 380000);
 | 
			
		||||
		CHANCES.put(20237, 490000);
 | 
			
		||||
		CHANCES.put(20238, 460000);
 | 
			
		||||
		CHANCES.put(20239, 490000);
 | 
			
		||||
		CHANCES.put(20240, 530000);
 | 
			
		||||
		CHANCES.put(20272, 380000);
 | 
			
		||||
		CHANCES.put(20273, 490000);
 | 
			
		||||
		CHANCES.put(20274, 460000);
 | 
			
		||||
		CHANCES.put(20275, 490000);
 | 
			
		||||
		CHANCES.put(20276, 530000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q344_1000YearsTheEndOfLamentation()
 | 
			
		||||
	{
 | 
			
		||||
		super(344, qn, "1000 Years, the End of Lamentation");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ARTICLE_DEAD_HERO, OLD_KEY, OLD_HILT, OLD_TOTEM, CRUCIFIX);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(GILMORE);
 | 
			
		||||
		addTalkId(GILMORE, RODEMAI, ORVEN, GARVARENTZ, KAIEN);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20236, 20237, 20238, 20239, 20240, 20272, 20273, 20274, 20275, 20276);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30754-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30754-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.get("success") != null)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				st.unset("success");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30754-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30754-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (!st.hasQuestItems(ARTICLE_DEAD_HERO))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30754-06a.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				final int amount = st.getQuestItemsCount(ARTICLE_DEAD_HERO);
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(ARTICLE_DEAD_HERO, -1);
 | 
			
		||||
				st.giveItems(57, amount * 60);
 | 
			
		||||
				
 | 
			
		||||
				// Special item, % based on actual number of qItems.
 | 
			
		||||
				if (Rnd.get(1000) < Math.min(10, Math.max(1, amount / 10)))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30754-10.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30754-11.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int random = Rnd.get(4);
 | 
			
		||||
			if (random < 1)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30754-12.htm";
 | 
			
		||||
				st.giveItems(OLD_KEY, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else if (random < 2)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30754-13.htm";
 | 
			
		||||
				st.giveItems(OLD_HILT, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else if (random < 3)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30754-14.htm";
 | 
			
		||||
				st.giveItems(OLD_TOTEM, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.giveItems(CRUCIFIX, 1);
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 48) ? "30754-01.htm" : "30754-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case GILMORE:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = (st.hasQuestItems(ARTICLE_DEAD_HERO)) ? "30754-05.htm" : "30754-09.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = (st.get("success") != null) ? "30754-16.htm" : "30754-15.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					default:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							if (st.get("success") != null)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = npc.getNpcId() + "-02.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								rewards(st, npc.getNpcId());
 | 
			
		||||
								htmltext = npc.getNpcId() + "-01.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static void rewards(QuestState st, int npcId)
 | 
			
		||||
	{
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case ORVEN:
 | 
			
		||||
				if (st.hasQuestItems(CRUCIFIX))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("success", "1");
 | 
			
		||||
					st.takeItems(CRUCIFIX, -1);
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					if (chance < 80)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1875, 19);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 95)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(952, 5);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(2437, 1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case GARVARENTZ:
 | 
			
		||||
				if (st.hasQuestItems(OLD_TOTEM))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("success", "1");
 | 
			
		||||
					st.takeItems(OLD_TOTEM, -1);
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					if (chance < 55)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1882, 70);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 99)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1881, 50);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(191, 1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case KAIEN:
 | 
			
		||||
				if (st.hasQuestItems(OLD_HILT))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("success", "1");
 | 
			
		||||
					st.takeItems(OLD_HILT, -1);
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					if (chance < 60)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1874, 25);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 85)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1887, 10);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 99)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(951, 1);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(133, 1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case RODEMAI:
 | 
			
		||||
				if (st.hasQuestItems(OLD_KEY))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("success", "1");
 | 
			
		||||
					st.takeItems(OLD_KEY, -1);
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					if (chance < 80)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(1879, 55);
 | 
			
		||||
					}
 | 
			
		||||
					else if (chance < 95)
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(951, 1);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.giveItems(885, 1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st.dropItems(ARTICLE_DEAD_HERO, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,242 +1,243 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q354_ConquestOfAlligatorIsland;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q354_ConquestOfAlligatorIsland extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q354_ConquestOfAlligatorIsland";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int ALLIGATOR_TOOTH = 5863;
 | 
			
		||||
	private static final int TORN_MAP_FRAGMENT = 5864;
 | 
			
		||||
	private static final int PIRATE_TREASURE_MAP = 5915;
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q354_ConquestOfAlligatorIsland;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q354_ConquestOfAlligatorIsland extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q354_ConquestOfAlligatorIsland";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int ALLIGATOR_TOOTH = 5863;
 | 
			
		||||
	private static final int TORN_MAP_FRAGMENT = 5864;
 | 
			
		||||
	private static final int PIRATE_TREASURE_MAP = 5915;
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, int[][]> DROPLIST = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(20804, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				490000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Crokian Lad
 | 
			
		||||
		DROPLIST.put(20805, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				560000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Dailaon Lad
 | 
			
		||||
		DROPLIST.put(20806, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				500000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Crokian Lad Warrior
 | 
			
		||||
		DROPLIST.put(20807, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				600000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Farhite Lad
 | 
			
		||||
		DROPLIST.put(20808, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				690000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Nos Lad
 | 
			
		||||
		DROPLIST.put(20991, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				600000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Swamp Tribe
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q354_ConquestOfAlligatorIsland()
 | 
			
		||||
	{
 | 
			
		||||
		super(354, qn, "Conquest of Alligator Island");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ALLIGATOR_TOOTH, TORN_MAP_FRAGMENT);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30895); // Kluck
 | 
			
		||||
		addTalkId(30895);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20804, 20805, 20806, 20807, 20808, 20991);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30895-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30895-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(TORN_MAP_FRAGMENT))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30895-03a.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30895-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int amount = st.getQuestItemsCount(ALLIGATOR_TOOTH);
 | 
			
		||||
			if (amount > 0)
 | 
			
		||||
			{
 | 
			
		||||
				int reward = (amount * 220) + 3100;
 | 
			
		||||
				if (amount >= 100)
 | 
			
		||||
				{
 | 
			
		||||
					reward += 7600;
 | 
			
		||||
					htmltext = "30895-05b.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30895-05a.htm";
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(ALLIGATOR_TOOTH, -1);
 | 
			
		||||
				st.rewardItems(57, reward);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30895-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TORN_MAP_FRAGMENT) >= 10)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30895-08.htm";
 | 
			
		||||
				st.takeItems(TORN_MAP_FRAGMENT, 10);
 | 
			
		||||
				st.giveItems(PIRATE_TREASURE_MAP, 1);
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30895-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 38) ? "30895-00.htm" : "30895-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (st.hasQuestItems(TORN_MAP_FRAGMENT)) ? "30895-03a.htm" : "30895-03.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropMultipleItems(DROPLIST.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(20804, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				490000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Crokian Lad
 | 
			
		||||
		DROPLIST.put(20805, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				560000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Dailaon Lad
 | 
			
		||||
		DROPLIST.put(20806, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				500000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Crokian Lad Warrior
 | 
			
		||||
		DROPLIST.put(20807, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				600000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Farhite Lad
 | 
			
		||||
		DROPLIST.put(20808, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				690000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Nos Lad
 | 
			
		||||
		DROPLIST.put(20991, new int[][]
 | 
			
		||||
		{
 | 
			
		||||
			{
 | 
			
		||||
				ALLIGATOR_TOOTH,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				600000
 | 
			
		||||
			},
 | 
			
		||||
			{
 | 
			
		||||
				TORN_MAP_FRAGMENT,
 | 
			
		||||
				1,
 | 
			
		||||
				0,
 | 
			
		||||
				100000
 | 
			
		||||
			}
 | 
			
		||||
		}); // Swamp Tribe
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q354_ConquestOfAlligatorIsland()
 | 
			
		||||
	{
 | 
			
		||||
		super(354, qn, "Conquest of Alligator Island");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ALLIGATOR_TOOTH, TORN_MAP_FRAGMENT);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30895); // Kluck
 | 
			
		||||
		addTalkId(30895);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20804, 20805, 20806, 20807, 20808, 20991);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30895-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30895-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(TORN_MAP_FRAGMENT))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30895-03a.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30895-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int amount = st.getQuestItemsCount(ALLIGATOR_TOOTH);
 | 
			
		||||
			if (amount > 0)
 | 
			
		||||
			{
 | 
			
		||||
				int reward = (amount * 220) + 3100;
 | 
			
		||||
				if (amount >= 100)
 | 
			
		||||
				{
 | 
			
		||||
					reward += 7600;
 | 
			
		||||
					htmltext = "30895-05b.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30895-05a.htm";
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(ALLIGATOR_TOOTH, -1);
 | 
			
		||||
				st.rewardItems(57, reward);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30895-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TORN_MAP_FRAGMENT) >= 10)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30895-08.htm";
 | 
			
		||||
				st.takeItems(TORN_MAP_FRAGMENT, 10);
 | 
			
		||||
				st.giveItems(PIRATE_TREASURE_MAP, 1);
 | 
			
		||||
				st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30895-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 38) ? "30895-00.htm" : "30895-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (st.hasQuestItems(TORN_MAP_FRAGMENT)) ? "30895-03a.htm" : "30895-03.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropMultipleItems(DROPLIST.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,222 +1,223 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q355_FamilyHonor;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q355_FamilyHonor extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q355_FamilyHonor";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int GALIBREDO = 30181;
 | 
			
		||||
	private static final int PATRIN = 30929;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int TIMAK_ORC_TROOP_LEADER = 20767;
 | 
			
		||||
	private static final int TIMAK_ORC_TROOP_SHAMAN = 20768;
 | 
			
		||||
	private static final int TIMAK_ORC_TROOP_WARRIOR = 20769;
 | 
			
		||||
	private static final int TIMAK_ORC_TROOP_ARCHER = 20770;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int GALIBREDO_BUST = 4252;
 | 
			
		||||
	private static final int WORK_OF_BERONA = 4350;
 | 
			
		||||
	private static final int STATUE_PROTOTYPE = 4351;
 | 
			
		||||
	private static final int STATUE_ORIGINAL = 4352;
 | 
			
		||||
	private static final int STATUE_REPLICA = 4353;
 | 
			
		||||
	private static final int STATUE_FORGERY = 4354;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q355_FamilyHonor;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q355_FamilyHonor extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q355_FamilyHonor";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int GALIBREDO = 30181;
 | 
			
		||||
	private static final int PATRIN = 30929;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int TIMAK_ORC_TROOP_LEADER = 20767;
 | 
			
		||||
	private static final int TIMAK_ORC_TROOP_SHAMAN = 20768;
 | 
			
		||||
	private static final int TIMAK_ORC_TROOP_WARRIOR = 20769;
 | 
			
		||||
	private static final int TIMAK_ORC_TROOP_ARCHER = 20770;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int GALIBREDO_BUST = 4252;
 | 
			
		||||
	private static final int WORK_OF_BERONA = 4350;
 | 
			
		||||
	private static final int STATUE_PROTOTYPE = 4351;
 | 
			
		||||
	private static final int STATUE_ORIGINAL = 4352;
 | 
			
		||||
	private static final int STATUE_REPLICA = 4353;
 | 
			
		||||
	private static final int STATUE_FORGERY = 4354;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, int[]> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(TIMAK_ORC_TROOP_LEADER, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			44,
 | 
			
		||||
			54
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(TIMAK_ORC_TROOP_SHAMAN, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			36,
 | 
			
		||||
			45
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(TIMAK_ORC_TROOP_WARRIOR, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			35,
 | 
			
		||||
			43
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(TIMAK_ORC_TROOP_ARCHER, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			32,
 | 
			
		||||
			42
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q355_FamilyHonor()
 | 
			
		||||
	{
 | 
			
		||||
		super(355, qn, "Family Honor");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(GALIBREDO_BUST);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(GALIBREDO);
 | 
			
		||||
		addTalkId(GALIBREDO, PATRIN);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(TIMAK_ORC_TROOP_LEADER, TIMAK_ORC_TROOP_SHAMAN, TIMAK_ORC_TROOP_WARRIOR, TIMAK_ORC_TROOP_ARCHER);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30181-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30181-4b.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int count = st.getQuestItemsCount(GALIBREDO_BUST);
 | 
			
		||||
			if (count > 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30181-4.htm";
 | 
			
		||||
				
 | 
			
		||||
				int reward = 2800 + (count * 120);
 | 
			
		||||
				if (count >= 100)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30181-4a.htm";
 | 
			
		||||
					reward += 5000;
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(GALIBREDO_BUST, count);
 | 
			
		||||
				st.rewardItems(57, reward);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30929-7.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(WORK_OF_BERONA))
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(WORK_OF_BERONA, 1);
 | 
			
		||||
				
 | 
			
		||||
				final int appraising = Rnd.get(100);
 | 
			
		||||
				if (appraising < 20)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-2.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (appraising < 40)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-3.htm";
 | 
			
		||||
					st.giveItems(STATUE_REPLICA, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (appraising < 60)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-4.htm";
 | 
			
		||||
					st.giveItems(STATUE_ORIGINAL, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (appraising < 80)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-5.htm";
 | 
			
		||||
					st.giveItems(STATUE_FORGERY, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-6.htm";
 | 
			
		||||
					st.giveItems(STATUE_PROTOTYPE, 1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30181-6.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 36) ? "30181-0a.htm" : "30181-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case GALIBREDO:
 | 
			
		||||
						htmltext = (st.hasQuestItems(GALIBREDO_BUST)) ? "30181-3a.htm" : "30181-3.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case PATRIN:
 | 
			
		||||
						htmltext = "30929-0.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int[] chances = CHANCES.get(npc.getNpcId());
 | 
			
		||||
		final int random = Rnd.get(100);
 | 
			
		||||
		
 | 
			
		||||
		if (random < chances[1])
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItemsAlways((random < chances[0]) ? GALIBREDO_BUST : WORK_OF_BERONA, 1, 0);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(TIMAK_ORC_TROOP_LEADER, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			44,
 | 
			
		||||
			54
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(TIMAK_ORC_TROOP_SHAMAN, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			36,
 | 
			
		||||
			45
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(TIMAK_ORC_TROOP_WARRIOR, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			35,
 | 
			
		||||
			43
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(TIMAK_ORC_TROOP_ARCHER, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			32,
 | 
			
		||||
			42
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q355_FamilyHonor()
 | 
			
		||||
	{
 | 
			
		||||
		super(355, qn, "Family Honor");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(GALIBREDO_BUST);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(GALIBREDO);
 | 
			
		||||
		addTalkId(GALIBREDO, PATRIN);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(TIMAK_ORC_TROOP_LEADER, TIMAK_ORC_TROOP_SHAMAN, TIMAK_ORC_TROOP_WARRIOR, TIMAK_ORC_TROOP_ARCHER);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30181-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30181-4b.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int count = st.getQuestItemsCount(GALIBREDO_BUST);
 | 
			
		||||
			if (count > 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30181-4.htm";
 | 
			
		||||
				
 | 
			
		||||
				int reward = 2800 + (count * 120);
 | 
			
		||||
				if (count >= 100)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30181-4a.htm";
 | 
			
		||||
					reward += 5000;
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(GALIBREDO_BUST, count);
 | 
			
		||||
				st.rewardItems(57, reward);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30929-7.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(WORK_OF_BERONA))
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(WORK_OF_BERONA, 1);
 | 
			
		||||
				
 | 
			
		||||
				final int appraising = Rnd.get(100);
 | 
			
		||||
				if (appraising < 20)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-2.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (appraising < 40)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-3.htm";
 | 
			
		||||
					st.giveItems(STATUE_REPLICA, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (appraising < 60)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-4.htm";
 | 
			
		||||
					st.giveItems(STATUE_ORIGINAL, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (appraising < 80)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-5.htm";
 | 
			
		||||
					st.giveItems(STATUE_FORGERY, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-6.htm";
 | 
			
		||||
					st.giveItems(STATUE_PROTOTYPE, 1);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30181-6.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 36) ? "30181-0a.htm" : "30181-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case GALIBREDO:
 | 
			
		||||
						htmltext = (st.hasQuestItems(GALIBREDO_BUST)) ? "30181-3a.htm" : "30181-3.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case PATRIN:
 | 
			
		||||
						htmltext = "30929-0.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int[] chances = CHANCES.get(npc.getNpcId());
 | 
			
		||||
		final int random = Rnd.get(100);
 | 
			
		||||
		
 | 
			
		||||
		if (random < chances[1])
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItemsAlways((random < chances[0]) ? GALIBREDO_BUST : WORK_OF_BERONA, 1, 0);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,143 +1,144 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q357_WarehouseKeepersAmbition;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q357_WarehouseKeepersAmbition extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q357_WarehouseKeepersAmbition";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int JADE_CRYSTAL = 5867;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int FOREST_RUNNER = 20594;
 | 
			
		||||
	private static final int FLINE_ELDER = 20595;
 | 
			
		||||
	private static final int LIELE_ELDER = 20596;
 | 
			
		||||
	private static final int VALLEY_TREANT_ELDER = 20597;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q357_WarehouseKeepersAmbition;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q357_WarehouseKeepersAmbition extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q357_WarehouseKeepersAmbition";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int JADE_CRYSTAL = 5867;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int FOREST_RUNNER = 20594;
 | 
			
		||||
	private static final int FLINE_ELDER = 20595;
 | 
			
		||||
	private static final int LIELE_ELDER = 20596;
 | 
			
		||||
	private static final int VALLEY_TREANT_ELDER = 20597;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(FOREST_RUNNER, 400000);
 | 
			
		||||
		CHANCES.put(FLINE_ELDER, 410000);
 | 
			
		||||
		CHANCES.put(LIELE_ELDER, 440000);
 | 
			
		||||
		CHANCES.put(VALLEY_TREANT_ELDER, 650000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q357_WarehouseKeepersAmbition()
 | 
			
		||||
	{
 | 
			
		||||
		super(357, qn, "Warehouse Keeper's Ambition");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(JADE_CRYSTAL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30686); // Silva
 | 
			
		||||
		addTalkId(30686);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(FOREST_RUNNER, FLINE_ELDER, LIELE_ELDER, VALLEY_TREANT_ELDER);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30686-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30686-7.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int count = st.getQuestItemsCount(JADE_CRYSTAL);
 | 
			
		||||
			if (count == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30686-4.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				int reward = (count * 425) + 3500;
 | 
			
		||||
				if (count >= 100)
 | 
			
		||||
				{
 | 
			
		||||
					reward += 7400;
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(JADE_CRYSTAL, -1);
 | 
			
		||||
				st.rewardItems(57, reward);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30686-8.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 47) ? "30686-0a.htm" : "30686-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (!st.hasQuestItems(JADE_CRYSTAL)) ? "30686-4.htm" : "30686-6.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(JADE_CRYSTAL, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(FOREST_RUNNER, 400000);
 | 
			
		||||
		CHANCES.put(FLINE_ELDER, 410000);
 | 
			
		||||
		CHANCES.put(LIELE_ELDER, 440000);
 | 
			
		||||
		CHANCES.put(VALLEY_TREANT_ELDER, 650000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q357_WarehouseKeepersAmbition()
 | 
			
		||||
	{
 | 
			
		||||
		super(357, qn, "Warehouse Keeper's Ambition");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(JADE_CRYSTAL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30686); // Silva
 | 
			
		||||
		addTalkId(30686);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(FOREST_RUNNER, FLINE_ELDER, LIELE_ELDER, VALLEY_TREANT_ELDER);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30686-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30686-7.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int count = st.getQuestItemsCount(JADE_CRYSTAL);
 | 
			
		||||
			if (count == 0)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30686-4.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				int reward = (count * 425) + 3500;
 | 
			
		||||
				if (count >= 100)
 | 
			
		||||
				{
 | 
			
		||||
					reward += 7400;
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(JADE_CRYSTAL, -1);
 | 
			
		||||
				st.rewardItems(57, reward);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30686-8.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 47) ? "30686-0a.htm" : "30686-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (!st.hasQuestItems(JADE_CRYSTAL)) ? "30686-4.htm" : "30686-6.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(JADE_CRYSTAL, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,155 +1,156 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q359_ForSleeplessDeadmen;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q359_ForSleeplessDeadmen extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q359_ForSleeplessDeadmen";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int REMAINS = 5869;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int DOOM_SERVANT = 21006;
 | 
			
		||||
	private static final int DOOM_GUARD = 21007;
 | 
			
		||||
	private static final int DOOM_ARCHER = 21008;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int REWARD[] =
 | 
			
		||||
	{
 | 
			
		||||
		6341,
 | 
			
		||||
		6342,
 | 
			
		||||
		6343,
 | 
			
		||||
		6344,
 | 
			
		||||
		6345,
 | 
			
		||||
		6346,
 | 
			
		||||
		5494,
 | 
			
		||||
		5495
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q359_ForSleeplessDeadmen;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q359_ForSleeplessDeadmen extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q359_ForSleeplessDeadmen";
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int REMAINS = 5869;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int DOOM_SERVANT = 21006;
 | 
			
		||||
	private static final int DOOM_GUARD = 21007;
 | 
			
		||||
	private static final int DOOM_ARCHER = 21008;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int REWARD[] =
 | 
			
		||||
	{
 | 
			
		||||
		6341,
 | 
			
		||||
		6342,
 | 
			
		||||
		6343,
 | 
			
		||||
		6344,
 | 
			
		||||
		6345,
 | 
			
		||||
		6346,
 | 
			
		||||
		5494,
 | 
			
		||||
		5495
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(DOOM_SERVANT, 320000);
 | 
			
		||||
		CHANCES.put(DOOM_GUARD, 340000);
 | 
			
		||||
		CHANCES.put(DOOM_ARCHER, 420000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q359_ForSleeplessDeadmen()
 | 
			
		||||
	{
 | 
			
		||||
		super(359, qn, "For Sleepless Deadmen");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(REMAINS);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30857); // Orven
 | 
			
		||||
		addTalkId(30857);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(DOOM_SERVANT, DOOM_GUARD, DOOM_ARCHER);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30857-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30857-10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.giveItems(REWARD[Rnd.get(REWARD.length)], 4);
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 60) ? "30857-01.htm" : "30857-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30857-07.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30857-08.htm";
 | 
			
		||||
					st.set("cond", "3");
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(REMAINS, -1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30857-09.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(REMAINS, 1, 60, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(DOOM_SERVANT, 320000);
 | 
			
		||||
		CHANCES.put(DOOM_GUARD, 340000);
 | 
			
		||||
		CHANCES.put(DOOM_ARCHER, 420000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q359_ForSleeplessDeadmen()
 | 
			
		||||
	{
 | 
			
		||||
		super(359, qn, "For Sleepless Deadmen");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(REMAINS);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30857); // Orven
 | 
			
		||||
		addTalkId(30857);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(DOOM_SERVANT, DOOM_GUARD, DOOM_ARCHER);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30857-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30857-10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.giveItems(REWARD[Rnd.get(REWARD.length)], 4);
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 60) ? "30857-01.htm" : "30857-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30857-07.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30857-08.htm";
 | 
			
		||||
					st.set("cond", "3");
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(REMAINS, -1);
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30857-09.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(REMAINS, 1, 60, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,130 +1,131 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q366_SilverHairedShaman;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q366_SilverHairedShaman extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q366_SilverHairedShaman";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int DIETER = 30111;
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int HAIR = 5874;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q366_SilverHairedShaman;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q366_SilverHairedShaman extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q366_SilverHairedShaman";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int DIETER = 30111;
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int HAIR = 5874;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20986, 560000);
 | 
			
		||||
		CHANCES.put(20987, 660000);
 | 
			
		||||
		CHANCES.put(20988, 620000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q366_SilverHairedShaman()
 | 
			
		||||
	{
 | 
			
		||||
		super(366, qn, "Silver Haired Shaman");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(HAIR);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(DIETER);
 | 
			
		||||
		addTalkId(DIETER);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20986, 20987, 20988);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30111-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30111-6.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 48) ? "30111-0.htm" : "30111-1.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int count = st.getQuestItemsCount(HAIR);
 | 
			
		||||
				if (count == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30111-3.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30111-4.htm";
 | 
			
		||||
					st.takeItems(HAIR, -1);
 | 
			
		||||
					st.rewardItems(57, 12070 + (500 * count));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(HAIR, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20986, 560000);
 | 
			
		||||
		CHANCES.put(20987, 660000);
 | 
			
		||||
		CHANCES.put(20988, 620000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q366_SilverHairedShaman()
 | 
			
		||||
	{
 | 
			
		||||
		super(366, qn, "Silver Haired Shaman");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(HAIR);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(DIETER);
 | 
			
		||||
		addTalkId(DIETER);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20986, 20987, 20988);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30111-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30111-6.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 48) ? "30111-0.htm" : "30111-1.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int count = st.getQuestItemsCount(HAIR);
 | 
			
		||||
				if (count == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30111-3.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30111-4.htm";
 | 
			
		||||
					st.takeItems(HAIR, -1);
 | 
			
		||||
					st.rewardItems(57, 12070 + (500 * count));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(HAIR, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,133 +1,134 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q368_TrespassingIntoTheSacredArea;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q368_TrespassingIntoTheSacredArea extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q368_TrespassingIntoTheSacredArea";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int RESTINA = 30926;
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int FANG = 5881;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q368_TrespassingIntoTheSacredArea;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q368_TrespassingIntoTheSacredArea extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q368_TrespassingIntoTheSacredArea";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int RESTINA = 30926;
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int FANG = 5881;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20794, 500000);
 | 
			
		||||
		CHANCES.put(20795, 770000);
 | 
			
		||||
		CHANCES.put(20796, 500000);
 | 
			
		||||
		CHANCES.put(20797, 480000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q368_TrespassingIntoTheSacredArea()
 | 
			
		||||
	{
 | 
			
		||||
		super(368, qn, "Trespassing into the Sacred Area");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(FANG);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(RESTINA);
 | 
			
		||||
		addTalkId(RESTINA);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20794, 20795, 20796, 20797);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30926-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30926-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 36) ? "30926-01a.htm" : "30926-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int fangs = st.getQuestItemsCount(FANG);
 | 
			
		||||
				if (fangs == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30926-03.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					final int reward = (250 * fangs) + (fangs > 10 ? 5730 : 2000);
 | 
			
		||||
					
 | 
			
		||||
					htmltext = "30926-04.htm";
 | 
			
		||||
					st.takeItems(5881, -1);
 | 
			
		||||
					st.rewardItems(57, reward);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(FANG, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20794, 500000);
 | 
			
		||||
		CHANCES.put(20795, 770000);
 | 
			
		||||
		CHANCES.put(20796, 500000);
 | 
			
		||||
		CHANCES.put(20797, 480000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q368_TrespassingIntoTheSacredArea()
 | 
			
		||||
	{
 | 
			
		||||
		super(368, qn, "Trespassing into the Sacred Area");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(FANG);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(RESTINA);
 | 
			
		||||
		addTalkId(RESTINA);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20794, 20795, 20796, 20797);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30926-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30926-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 36) ? "30926-01a.htm" : "30926-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int fangs = st.getQuestItemsCount(FANG);
 | 
			
		||||
				if (fangs == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30926-03.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					final int reward = (250 * fangs) + (fangs > 10 ? 5730 : 2000);
 | 
			
		||||
					
 | 
			
		||||
					htmltext = "30926-04.htm";
 | 
			
		||||
					st.takeItems(5881, -1);
 | 
			
		||||
					st.rewardItems(57, reward);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(FANG, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,206 +1,207 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q369_CollectorOfJewels;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q369_CollectorOfJewels extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q369_CollectorOfJewels";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int NELL = 30376;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int FLARE_SHARD = 5882;
 | 
			
		||||
	private static final int FREEZING_SHARD = 5883;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int ADENA = 57;
 | 
			
		||||
	
 | 
			
		||||
	// Droplist
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q369_CollectorOfJewels;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q369_CollectorOfJewels extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q369_CollectorOfJewels";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int NELL = 30376;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int FLARE_SHARD = 5882;
 | 
			
		||||
	private static final int FREEZING_SHARD = 5883;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int ADENA = 57;
 | 
			
		||||
	
 | 
			
		||||
	// Droplist
 | 
			
		||||
	private static final Map<Integer, int[]> DROPLIST = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(20609, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FLARE_SHARD,
 | 
			
		||||
			630000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20612, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FLARE_SHARD,
 | 
			
		||||
			770000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20749, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FLARE_SHARD,
 | 
			
		||||
			850000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20616, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FREEZING_SHARD,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20619, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FREEZING_SHARD,
 | 
			
		||||
			730000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20747, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FREEZING_SHARD,
 | 
			
		||||
			850000
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q369_CollectorOfJewels()
 | 
			
		||||
	{
 | 
			
		||||
		super(369, qn, "Collector of Jewels");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(FLARE_SHARD, FREEZING_SHARD);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(NELL);
 | 
			
		||||
		addTalkId(NELL);
 | 
			
		||||
		
 | 
			
		||||
		for (int mob : DROPLIST.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30376-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30376-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30376-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 25) ? "30376-01.htm" : "30376-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				final int flare = st.getQuestItemsCount(FLARE_SHARD);
 | 
			
		||||
				final int freezing = st.getQuestItemsCount(FREEZING_SHARD);
 | 
			
		||||
				
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30376-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 2) && (flare >= 50) && (freezing >= 50))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30376-05.htm";
 | 
			
		||||
					st.set("cond", "3");
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(FLARE_SHARD, -1);
 | 
			
		||||
					st.takeItems(FREEZING_SHARD, -1);
 | 
			
		||||
					st.rewardItems(ADENA, 12500);
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30376-09.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 4) && (flare >= 200) && (freezing >= 200))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30376-10.htm";
 | 
			
		||||
					st.takeItems(FLARE_SHARD, -1);
 | 
			
		||||
					st.takeItems(FREEZING_SHARD, -1);
 | 
			
		||||
					st.rewardItems(ADENA, 63500);
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int cond = st.getInt("cond");
 | 
			
		||||
		final int[] drop = DROPLIST.get(npc.getNpcId());
 | 
			
		||||
		
 | 
			
		||||
		if (cond == 1)
 | 
			
		||||
		{
 | 
			
		||||
			if (st.dropItems(drop[0], 1, 50, drop[1]) && (st.getQuestItemsCount((drop[0] == FLARE_SHARD) ? FREEZING_SHARD : FLARE_SHARD) >= 50))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if ((cond == 3) && st.dropItems(drop[0], 1, 200, drop[1]) && (st.getQuestItemsCount((drop[0] == FLARE_SHARD) ? FREEZING_SHARD : FLARE_SHARD) >= 200))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "4");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(20609, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FLARE_SHARD,
 | 
			
		||||
			630000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20612, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FLARE_SHARD,
 | 
			
		||||
			770000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20749, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FLARE_SHARD,
 | 
			
		||||
			850000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20616, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FREEZING_SHARD,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20619, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FREEZING_SHARD,
 | 
			
		||||
			730000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20747, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			FREEZING_SHARD,
 | 
			
		||||
			850000
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q369_CollectorOfJewels()
 | 
			
		||||
	{
 | 
			
		||||
		super(369, qn, "Collector of Jewels");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(FLARE_SHARD, FREEZING_SHARD);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(NELL);
 | 
			
		||||
		addTalkId(NELL);
 | 
			
		||||
		
 | 
			
		||||
		for (int mob : DROPLIST.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30376-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30376-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30376-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 25) ? "30376-01.htm" : "30376-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				final int flare = st.getQuestItemsCount(FLARE_SHARD);
 | 
			
		||||
				final int freezing = st.getQuestItemsCount(FREEZING_SHARD);
 | 
			
		||||
				
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30376-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 2) && (flare >= 50) && (freezing >= 50))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30376-05.htm";
 | 
			
		||||
					st.set("cond", "3");
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(FLARE_SHARD, -1);
 | 
			
		||||
					st.takeItems(FREEZING_SHARD, -1);
 | 
			
		||||
					st.rewardItems(ADENA, 12500);
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30376-09.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 4) && (flare >= 200) && (freezing >= 200))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30376-10.htm";
 | 
			
		||||
					st.takeItems(FLARE_SHARD, -1);
 | 
			
		||||
					st.takeItems(FREEZING_SHARD, -1);
 | 
			
		||||
					st.rewardItems(ADENA, 63500);
 | 
			
		||||
					st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int cond = st.getInt("cond");
 | 
			
		||||
		final int[] drop = DROPLIST.get(npc.getNpcId());
 | 
			
		||||
		
 | 
			
		||||
		if (cond == 1)
 | 
			
		||||
		{
 | 
			
		||||
			if (st.dropItems(drop[0], 1, 50, drop[1]) && (st.getQuestItemsCount((drop[0] == FLARE_SHARD) ? FREEZING_SHARD : FLARE_SHARD) >= 50))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if ((cond == 3) && st.dropItems(drop[0], 1, 200, drop[1]) && (st.getQuestItemsCount((drop[0] == FLARE_SHARD) ? FREEZING_SHARD : FLARE_SHARD) >= 200))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "4");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,138 +1,139 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q370_AnElderSowsSeeds;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q370_AnElderSowsSeeds extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q370_AnElderSowsSeeds";
 | 
			
		||||
	
 | 
			
		||||
	// 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;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q370_AnElderSowsSeeds;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q370_AnElderSowsSeeds extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q370_AnElderSowsSeeds";
 | 
			
		||||
	
 | 
			
		||||
	// 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;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20082, 86000);
 | 
			
		||||
		CHANCES.put(20084, 94000);
 | 
			
		||||
		CHANCES.put(20086, 90000);
 | 
			
		||||
		CHANCES.put(20089, 100000);
 | 
			
		||||
		CHANCES.put(20090, 202000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q370_AnElderSowsSeeds()
 | 
			
		||||
	{
 | 
			
		||||
		super(370, qn, "An Elder Sows Seeds");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(SPELLBOOK_PAGE, CHAPTER_OF_FIRE, CHAPTER_OF_WATER, CHAPTER_OF_WIND, CHAPTER_OF_EARTH);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(CASIAN);
 | 
			
		||||
		addTalkId(CASIAN);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20082, 20084, 20086, 20089, 20090);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30612-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30612-6.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(CHAPTER_OF_FIRE, CHAPTER_OF_WATER, CHAPTER_OF_WIND, CHAPTER_OF_EARTH))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30612-8.htm";
 | 
			
		||||
				st.takeItems(CHAPTER_OF_FIRE, 1);
 | 
			
		||||
				st.takeItems(CHAPTER_OF_WATER, 1);
 | 
			
		||||
				st.takeItems(CHAPTER_OF_WIND, 1);
 | 
			
		||||
				st.takeItems(CHAPTER_OF_EARTH, 1);
 | 
			
		||||
				st.rewardItems(57, 3600);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30612-9.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 28) ? "30612-0a.htm" : "30612-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = "30612-4.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(SPELLBOOK_PAGE, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20082, 86000);
 | 
			
		||||
		CHANCES.put(20084, 94000);
 | 
			
		||||
		CHANCES.put(20086, 90000);
 | 
			
		||||
		CHANCES.put(20089, 100000);
 | 
			
		||||
		CHANCES.put(20090, 202000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q370_AnElderSowsSeeds()
 | 
			
		||||
	{
 | 
			
		||||
		super(370, qn, "An Elder Sows Seeds");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(SPELLBOOK_PAGE, CHAPTER_OF_FIRE, CHAPTER_OF_WATER, CHAPTER_OF_WIND, CHAPTER_OF_EARTH);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(CASIAN);
 | 
			
		||||
		addTalkId(CASIAN);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20082, 20084, 20086, 20089, 20090);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30612-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30612-6.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(CHAPTER_OF_FIRE, CHAPTER_OF_WATER, CHAPTER_OF_WIND, CHAPTER_OF_EARTH))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30612-8.htm";
 | 
			
		||||
				st.takeItems(CHAPTER_OF_FIRE, 1);
 | 
			
		||||
				st.takeItems(CHAPTER_OF_WATER, 1);
 | 
			
		||||
				st.takeItems(CHAPTER_OF_WIND, 1);
 | 
			
		||||
				st.takeItems(CHAPTER_OF_EARTH, 1);
 | 
			
		||||
				st.rewardItems(57, 3600);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30612-9.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 28) ? "30612-0a.htm" : "30612-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = "30612-4.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(SPELLBOOK_PAGE, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,219 +1,220 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q371_ShriekOfGhosts;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q371_ShriekOfGhosts extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q371_ShriekOfGhosts";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int REVA = 30867;
 | 
			
		||||
	private static final int PATRIN = 30929;
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int URN = 5903;
 | 
			
		||||
	private static final int PORCELAIN = 6002;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q371_ShriekOfGhosts;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q371_ShriekOfGhosts extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q371_ShriekOfGhosts";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int REVA = 30867;
 | 
			
		||||
	private static final int PATRIN = 30929;
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int URN = 5903;
 | 
			
		||||
	private static final int PORCELAIN = 6002;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, int[]> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20818, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			38,
 | 
			
		||||
			43
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(20820, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			48,
 | 
			
		||||
			56
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(20824, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			58
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q371_ShriekOfGhosts()
 | 
			
		||||
	{
 | 
			
		||||
		super(371, qn, "Shriek of Ghosts");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(URN, PORCELAIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(REVA);
 | 
			
		||||
		addTalkId(REVA, PATRIN);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20818, 20820, 20824);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30867-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30867-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			int urns = st.getQuestItemsCount(URN);
 | 
			
		||||
			if (urns > 0)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(URN, urns);
 | 
			
		||||
				if (urns >= 100)
 | 
			
		||||
				{
 | 
			
		||||
					urns += 13;
 | 
			
		||||
					htmltext = "30867-08.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					urns += 7;
 | 
			
		||||
				}
 | 
			
		||||
				st.rewardItems(57, urns * 1000);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30867-10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("APPR"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(PORCELAIN))
 | 
			
		||||
			{
 | 
			
		||||
				int chance = Rnd.get(100);
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(PORCELAIN, 1);
 | 
			
		||||
				
 | 
			
		||||
				if (chance < 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(6003, 1);
 | 
			
		||||
					htmltext = "30929-03.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (chance < 32)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(6004, 1);
 | 
			
		||||
					htmltext = "30929-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (chance < 62)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(6005, 1);
 | 
			
		||||
					htmltext = "30929-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (chance < 77)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(6006, 1);
 | 
			
		||||
					htmltext = "30929-06.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-07.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30929-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 59) ? "30867-01.htm" : "30867-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case REVA:
 | 
			
		||||
						if (st.hasQuestItems(URN))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = (st.hasQuestItems(PORCELAIN)) ? "30867-05.htm" : "30867-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30867-06.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case PATRIN:
 | 
			
		||||
						htmltext = "30929-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int[] chances = CHANCES.get(npc.getNpcId());
 | 
			
		||||
		final int random = Rnd.get(100);
 | 
			
		||||
		
 | 
			
		||||
		if (random < chances[1])
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItemsAlways((random < chances[0]) ? URN : PORCELAIN, 1, 0);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20818, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			38,
 | 
			
		||||
			43
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(20820, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			48,
 | 
			
		||||
			56
 | 
			
		||||
		});
 | 
			
		||||
		CHANCES.put(20824, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			58
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q371_ShriekOfGhosts()
 | 
			
		||||
	{
 | 
			
		||||
		super(371, qn, "Shriek of Ghosts");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(URN, PORCELAIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(REVA);
 | 
			
		||||
		addTalkId(REVA, PATRIN);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(20818, 20820, 20824);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30867-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30867-07.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			int urns = st.getQuestItemsCount(URN);
 | 
			
		||||
			if (urns > 0)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(URN, urns);
 | 
			
		||||
				if (urns >= 100)
 | 
			
		||||
				{
 | 
			
		||||
					urns += 13;
 | 
			
		||||
					htmltext = "30867-08.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					urns += 7;
 | 
			
		||||
				}
 | 
			
		||||
				st.rewardItems(57, urns * 1000);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30867-10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("APPR"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(PORCELAIN))
 | 
			
		||||
			{
 | 
			
		||||
				int chance = Rnd.get(100);
 | 
			
		||||
				
 | 
			
		||||
				st.takeItems(PORCELAIN, 1);
 | 
			
		||||
				
 | 
			
		||||
				if (chance < 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(6003, 1);
 | 
			
		||||
					htmltext = "30929-03.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (chance < 32)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(6004, 1);
 | 
			
		||||
					htmltext = "30929-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (chance < 62)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(6005, 1);
 | 
			
		||||
					htmltext = "30929-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (chance < 77)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(6006, 1);
 | 
			
		||||
					htmltext = "30929-06.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30929-07.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30929-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 59) ? "30867-01.htm" : "30867-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case REVA:
 | 
			
		||||
						if (st.hasQuestItems(URN))
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = (st.hasQuestItems(PORCELAIN)) ? "30867-05.htm" : "30867-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30867-06.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case PATRIN:
 | 
			
		||||
						htmltext = "30929-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int[] chances = CHANCES.get(npc.getNpcId());
 | 
			
		||||
		final int random = Rnd.get(100);
 | 
			
		||||
		
 | 
			
		||||
		if (random < chances[1])
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItemsAlways((random < chances[0]) ? URN : PORCELAIN, 1, 0);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -98,7 +98,8 @@ public class Q373_SupplierOfReagents extends Quest
 | 
			
		||||
	 * <li>LAVA_WYRM : 75% chance to drop - wyrm's blood (50,5%) and lava stone (24,5%)</li>
 | 
			
		||||
	 * </ul>
 | 
			
		||||
	 */
 | 
			
		||||
	private static final Map<Integer, int[]> DROPLIST = new HashMap<>();
 | 
			
		||||
	private static final Map<Integer, int[]> DROPLIST = new HashMap<>();
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(PLATINUM_GUARDIAN_SHAMAN, new int[]
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -1,291 +1,292 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q378_MagnificentFeast;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q378_MagnificentFeast extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q378_MagnificentFeast";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int RANSPO = 30594;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int WINE_15 = 5956;
 | 
			
		||||
	private static final int WINE_30 = 5957;
 | 
			
		||||
	private static final int WINE_60 = 5958;
 | 
			
		||||
	private static final int MUSICAL_SCORE = 4421;
 | 
			
		||||
	private static final int SALAD_RECIPE = 1455;
 | 
			
		||||
	private static final int SAUCE_RECIPE = 1456;
 | 
			
		||||
	private static final int STEAK_RECIPE = 1457;
 | 
			
		||||
	private static final int RITRON_DESSERT = 5959;
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q378_MagnificentFeast;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q378_MagnificentFeast extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q378_MagnificentFeast";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int RANSPO = 30594;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int WINE_15 = 5956;
 | 
			
		||||
	private static final int WINE_30 = 5957;
 | 
			
		||||
	private static final int WINE_60 = 5958;
 | 
			
		||||
	private static final int MUSICAL_SCORE = 4421;
 | 
			
		||||
	private static final int SALAD_RECIPE = 1455;
 | 
			
		||||
	private static final int SAUCE_RECIPE = 1456;
 | 
			
		||||
	private static final int STEAK_RECIPE = 1457;
 | 
			
		||||
	private static final int RITRON_DESSERT = 5959;
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final Map<String, int[]> REWARDS = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		REWARDS.put("9", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			847,
 | 
			
		||||
			1,
 | 
			
		||||
			5700
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("10", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			846,
 | 
			
		||||
			2,
 | 
			
		||||
			0
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("12", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			909,
 | 
			
		||||
			1,
 | 
			
		||||
			25400
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("17", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			846,
 | 
			
		||||
			2,
 | 
			
		||||
			1200
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("18", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			879,
 | 
			
		||||
			1,
 | 
			
		||||
			6900
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("20", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			890,
 | 
			
		||||
			2,
 | 
			
		||||
			8500
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("33", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			879,
 | 
			
		||||
			1,
 | 
			
		||||
			8100
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("34", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			910,
 | 
			
		||||
			1,
 | 
			
		||||
			0
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("36", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			848,
 | 
			
		||||
			1,
 | 
			
		||||
			2200
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q378_MagnificentFeast()
 | 
			
		||||
	{
 | 
			
		||||
		super(378, qn, "Magnificent Feast");
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(RANSPO);
 | 
			
		||||
		addTalkId(RANSPO);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30594-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30594-4a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(WINE_15))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.set("score", "1");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(WINE_15, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30594-4.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30594-4b.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(WINE_30))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.set("score", "2");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(WINE_30, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30594-4.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30594-4c.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(WINE_60))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.set("score", "4");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(WINE_60, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30594-4.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30594-6.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(MUSICAL_SCORE))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(MUSICAL_SCORE, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30594-5.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			int score = st.getInt("score");
 | 
			
		||||
			if (event.equals("30594-8a.htm"))
 | 
			
		||||
			{
 | 
			
		||||
				if (st.hasQuestItems(SALAD_RECIPE))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "4");
 | 
			
		||||
					st.set("score", String.valueOf(score + 8));
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(SALAD_RECIPE, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-8.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else if (event.equals("30594-8b.htm"))
 | 
			
		||||
			{
 | 
			
		||||
				if (st.hasQuestItems(SAUCE_RECIPE))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "4");
 | 
			
		||||
					st.set("score", String.valueOf(score + 16));
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(SAUCE_RECIPE, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-8.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else if (event.equals("30594-8c.htm"))
 | 
			
		||||
			{
 | 
			
		||||
				if (st.hasQuestItems(STEAK_RECIPE))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "4");
 | 
			
		||||
					st.set("score", String.valueOf(score + 32));
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(STEAK_RECIPE, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-8.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 20) ? "30594-0.htm" : "30594-1.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-3.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = (!st.hasQuestItems(MUSICAL_SCORE)) ? "30594-5.htm" : "30594-5a.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-7.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					final String score = st.getString("score");
 | 
			
		||||
					if (REWARDS.containsKey(score) && st.hasQuestItems(RITRON_DESSERT))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "30594-10.htm";
 | 
			
		||||
						
 | 
			
		||||
						st.takeItems(RITRON_DESSERT, 1);
 | 
			
		||||
						st.giveItems(REWARDS.get(score)[0], REWARDS.get(score)[1]);
 | 
			
		||||
						
 | 
			
		||||
						int adena = REWARDS.get(score)[2];
 | 
			
		||||
						if (adena > 0)
 | 
			
		||||
						{
 | 
			
		||||
							st.rewardItems(57, adena);
 | 
			
		||||
						}
 | 
			
		||||
						
 | 
			
		||||
						st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
						st.exitQuest(true);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "30594-9.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		REWARDS.put("9", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			847,
 | 
			
		||||
			1,
 | 
			
		||||
			5700
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("10", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			846,
 | 
			
		||||
			2,
 | 
			
		||||
			0
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("12", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			909,
 | 
			
		||||
			1,
 | 
			
		||||
			25400
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("17", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			846,
 | 
			
		||||
			2,
 | 
			
		||||
			1200
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("18", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			879,
 | 
			
		||||
			1,
 | 
			
		||||
			6900
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("20", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			890,
 | 
			
		||||
			2,
 | 
			
		||||
			8500
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("33", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			879,
 | 
			
		||||
			1,
 | 
			
		||||
			8100
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("34", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			910,
 | 
			
		||||
			1,
 | 
			
		||||
			0
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("36", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			848,
 | 
			
		||||
			1,
 | 
			
		||||
			2200
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q378_MagnificentFeast()
 | 
			
		||||
	{
 | 
			
		||||
		super(378, qn, "Magnificent Feast");
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(RANSPO);
 | 
			
		||||
		addTalkId(RANSPO);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("30594-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30594-4a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(WINE_15))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.set("score", "1");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(WINE_15, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30594-4.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30594-4b.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(WINE_30))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.set("score", "2");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(WINE_30, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30594-4.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30594-4c.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(WINE_60))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.set("score", "4");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(WINE_60, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30594-4.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30594-6.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.hasQuestItems(MUSICAL_SCORE))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(MUSICAL_SCORE, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "30594-5.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			int score = st.getInt("score");
 | 
			
		||||
			if (event.equals("30594-8a.htm"))
 | 
			
		||||
			{
 | 
			
		||||
				if (st.hasQuestItems(SALAD_RECIPE))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "4");
 | 
			
		||||
					st.set("score", String.valueOf(score + 8));
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(SALAD_RECIPE, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-8.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else if (event.equals("30594-8b.htm"))
 | 
			
		||||
			{
 | 
			
		||||
				if (st.hasQuestItems(SAUCE_RECIPE))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "4");
 | 
			
		||||
					st.set("score", String.valueOf(score + 16));
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(SAUCE_RECIPE, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-8.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			else if (event.equals("30594-8c.htm"))
 | 
			
		||||
			{
 | 
			
		||||
				if (st.hasQuestItems(STEAK_RECIPE))
 | 
			
		||||
				{
 | 
			
		||||
					st.set("cond", "4");
 | 
			
		||||
					st.set("score", String.valueOf(score + 32));
 | 
			
		||||
					st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
					st.takeItems(STEAK_RECIPE, 1);
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-8.htm";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 20) ? "30594-0.htm" : "30594-1.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-3.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = (!st.hasQuestItems(MUSICAL_SCORE)) ? "30594-5.htm" : "30594-5a.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "30594-7.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					final String score = st.getString("score");
 | 
			
		||||
					if (REWARDS.containsKey(score) && st.hasQuestItems(RITRON_DESSERT))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "30594-10.htm";
 | 
			
		||||
						
 | 
			
		||||
						st.takeItems(RITRON_DESSERT, 1);
 | 
			
		||||
						st.giveItems(REWARDS.get(score)[0], REWARDS.get(score)[1]);
 | 
			
		||||
						
 | 
			
		||||
						int adena = REWARDS.get(score)[2];
 | 
			
		||||
						if (adena > 0)
 | 
			
		||||
						{
 | 
			
		||||
							st.rewardItems(57, adena);
 | 
			
		||||
						}
 | 
			
		||||
						
 | 
			
		||||
						st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
						st.exitQuest(true);
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "30594-9.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,452 +1,453 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q384_WarehouseKeepersPastime;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.commons.util.StringUtil;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
import com.l2jmobius.gameserver.util.Util;
 | 
			
		||||
 | 
			
		||||
public class Q384_WarehouseKeepersPastime extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q384_WarehouseKeepersPastime";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int CLIFF = 30182;
 | 
			
		||||
	private static final int BAXT = 30685;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int MEDAL = 5964;
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q384_WarehouseKeepersPastime;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.commons.util.StringUtil;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
import com.l2jmobius.gameserver.util.Util;
 | 
			
		||||
 | 
			
		||||
public class Q384_WarehouseKeepersPastime extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q384_WarehouseKeepersPastime";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int CLIFF = 30182;
 | 
			
		||||
	private static final int BAXT = 30685;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int MEDAL = 5964;
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20947, 160000); // Connabi
 | 
			
		||||
		CHANCES.put(20948, 180000); // Bartal
 | 
			
		||||
		CHANCES.put(20945, 120000); // Cadeine
 | 
			
		||||
		CHANCES.put(20946, 150000); // Sanhidro
 | 
			
		||||
		CHANCES.put(20635, 150000); // Carinkain
 | 
			
		||||
		CHANCES.put(20773, 610000); // Conjurer Bat Lord
 | 
			
		||||
		CHANCES.put(20774, 600000); // Conjurer Bat
 | 
			
		||||
		CHANCES.put(20760, 240000); // Dragon Bearer Archer
 | 
			
		||||
		CHANCES.put(20758, 240000); // Dragon Bearer Chief
 | 
			
		||||
		CHANCES.put(20759, 230000); // Dragon Bearer Warrior
 | 
			
		||||
		CHANCES.put(20242, 220000); // Dustwind Gargoyle
 | 
			
		||||
		CHANCES.put(20281, 220000); // Dustwind Gargoyle (2)
 | 
			
		||||
		CHANCES.put(20556, 140000); // Giant Monstereye
 | 
			
		||||
		CHANCES.put(20668, 210000); // Grave Guard
 | 
			
		||||
		CHANCES.put(20241, 220000); // Hunter Gargoyle
 | 
			
		||||
		CHANCES.put(20286, 220000); // Hunter Gargoyle (2)
 | 
			
		||||
		CHANCES.put(20949, 190000); // Luminun
 | 
			
		||||
		CHANCES.put(20950, 200000); // Innersen
 | 
			
		||||
		CHANCES.put(20942, 90000); // Nightmare Guide
 | 
			
		||||
		CHANCES.put(20943, 120000); // Nightmare Keeper
 | 
			
		||||
		CHANCES.put(20944, 110000); // Nightmare Lord
 | 
			
		||||
		CHANCES.put(20559, 140000); // Rotting Golem
 | 
			
		||||
		CHANCES.put(20243, 210000); // Thunder Wyrm
 | 
			
		||||
		CHANCES.put(20282, 210000); // Thunder Wyrm (2)
 | 
			
		||||
		CHANCES.put(20677, 340000); // Tulben
 | 
			
		||||
		CHANCES.put(20605, 150000); // Weird Drake
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] INDEX_MAP =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			1,
 | 
			
		||||
			2,
 | 
			
		||||
			3
 | 
			
		||||
		}, // line 1
 | 
			
		||||
		{
 | 
			
		||||
			4,
 | 
			
		||||
			5,
 | 
			
		||||
			6
 | 
			
		||||
		}, // line 2
 | 
			
		||||
		{
 | 
			
		||||
			7,
 | 
			
		||||
			8,
 | 
			
		||||
			9
 | 
			
		||||
		}, // line 3
 | 
			
		||||
		{
 | 
			
		||||
			1,
 | 
			
		||||
			4,
 | 
			
		||||
			7
 | 
			
		||||
		}, // column 1
 | 
			
		||||
		{
 | 
			
		||||
			2,
 | 
			
		||||
			5,
 | 
			
		||||
			8
 | 
			
		||||
		}, // column 2
 | 
			
		||||
		{
 | 
			
		||||
			3,
 | 
			
		||||
			6,
 | 
			
		||||
			9
 | 
			
		||||
		}, // column 3
 | 
			
		||||
		{
 | 
			
		||||
			1,
 | 
			
		||||
			5,
 | 
			
		||||
			9
 | 
			
		||||
		}, // diagonal 1
 | 
			
		||||
		{
 | 
			
		||||
			3,
 | 
			
		||||
			5,
 | 
			
		||||
			7
 | 
			
		||||
		}, // diagonal 2
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] _rewards_10_win =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			16,
 | 
			
		||||
			1888
 | 
			
		||||
		}, // Synthetic Cokes
 | 
			
		||||
		{
 | 
			
		||||
			32,
 | 
			
		||||
			1887
 | 
			
		||||
		}, // Varnish of Purity
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			1894
 | 
			
		||||
		}, // Crafted Leather
 | 
			
		||||
		{
 | 
			
		||||
			80,
 | 
			
		||||
			952
 | 
			
		||||
		}, // Scroll: Enchant Armor (C)
 | 
			
		||||
		{
 | 
			
		||||
			89,
 | 
			
		||||
			1890
 | 
			
		||||
		}, // Mithril Alloy
 | 
			
		||||
		{
 | 
			
		||||
			98,
 | 
			
		||||
			1893
 | 
			
		||||
		}, // Oriharukon
 | 
			
		||||
		{
 | 
			
		||||
			100,
 | 
			
		||||
			951
 | 
			
		||||
		}
 | 
			
		||||
		// Scroll: Enchant Weapon (C)
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] _rewards_10_lose =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			4041
 | 
			
		||||
		}, // Mold Hardener
 | 
			
		||||
		{
 | 
			
		||||
			80,
 | 
			
		||||
			952
 | 
			
		||||
		}, // Scroll: Enchant Armor (C)
 | 
			
		||||
		{
 | 
			
		||||
			98,
 | 
			
		||||
			1892
 | 
			
		||||
		}, // Blacksmith's Frame
 | 
			
		||||
		{
 | 
			
		||||
			100,
 | 
			
		||||
			917
 | 
			
		||||
		}
 | 
			
		||||
		// Necklace of Mermaid
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] _rewards_100_win =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			883
 | 
			
		||||
		}, // Aquastone Ring
 | 
			
		||||
		{
 | 
			
		||||
			80,
 | 
			
		||||
			951
 | 
			
		||||
		}, // Scroll: Enchant Weapon (C)
 | 
			
		||||
		{
 | 
			
		||||
			98,
 | 
			
		||||
			852
 | 
			
		||||
		}, // Moonstone Earring
 | 
			
		||||
		{
 | 
			
		||||
			100,
 | 
			
		||||
			401
 | 
			
		||||
		}
 | 
			
		||||
		// Drake Leather Armor
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] _rewards_100_lose =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			951
 | 
			
		||||
		}, // Scroll: Enchant Weapon (C)
 | 
			
		||||
		{
 | 
			
		||||
			80,
 | 
			
		||||
			500
 | 
			
		||||
		}, // Great Helmet
 | 
			
		||||
		{
 | 
			
		||||
			98,
 | 
			
		||||
			2437
 | 
			
		||||
		}, // Drake Leather Boots
 | 
			
		||||
		{
 | 
			
		||||
			100,
 | 
			
		||||
			135
 | 
			
		||||
		}
 | 
			
		||||
		// Samurai Longsword
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	public Q384_WarehouseKeepersPastime()
 | 
			
		||||
	{
 | 
			
		||||
		super(384, qn, "Warehouse Keeper's Pastime");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(MEDAL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(CLIFF);
 | 
			
		||||
		addTalkId(CLIFF, BAXT);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		if (event.equals("30182-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals(npcId + "-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals(npcId + "-11.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(MEDAL) < 10)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = npcId + "-12.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.set("bet", "10");
 | 
			
		||||
				st.set("board", StringUtil.scrambleString("123456789"));
 | 
			
		||||
				st.takeItems(MEDAL, 10);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals(npcId + "-13.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(MEDAL) < 100)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = npcId + "-12.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.set("bet", "100");
 | 
			
		||||
				st.set("board", StringUtil.scrambleString("123456789"));
 | 
			
		||||
				st.takeItems(MEDAL, 100);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("select_1-")) // first pick
 | 
			
		||||
		{
 | 
			
		||||
			// Register the first char.
 | 
			
		||||
			st.set("playerArray", event.substring(9));
 | 
			
		||||
			
 | 
			
		||||
			// Send back the finalized HTM with dynamic content.
 | 
			
		||||
			htmltext = fillBoard(st, getHtmlText(npcId + "-14.htm"));
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("select_2-")) // pick #2-5
 | 
			
		||||
		{
 | 
			
		||||
			// Stores the current event for future use.
 | 
			
		||||
			String number = event.substring(9);
 | 
			
		||||
			
 | 
			
		||||
			// Restore the player array.
 | 
			
		||||
			String playerArray = st.getString("playerArray");
 | 
			
		||||
			
 | 
			
		||||
			// Verify if the given number is already on the player array, if yes, it's invalid, otherwise register it.
 | 
			
		||||
			if (Util.contains(playerArray.split(""), number))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = fillBoard(st, getHtmlText(npcId + "-" + String.valueOf(14 + (2 * playerArray.length())) + ".htm"));
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				// Stores the final String.
 | 
			
		||||
				st.set("playerArray", playerArray.concat(number));
 | 
			
		||||
				
 | 
			
		||||
				htmltext = fillBoard(st, getHtmlText(npcId + "-" + String.valueOf(11 + (2 * (playerArray.length() + 1))) + ".htm"));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("select_3-")) // pick #6
 | 
			
		||||
		{
 | 
			
		||||
			// Stores the current event for future use.
 | 
			
		||||
			String number = event.substring(9);
 | 
			
		||||
			
 | 
			
		||||
			// Restore the player array.
 | 
			
		||||
			String playerArray = st.getString("playerArray");
 | 
			
		||||
			
 | 
			
		||||
			// Verify if the given number is already on the player array, if yes, it's invalid, otherwise calculate reward.
 | 
			
		||||
			if (Util.contains(playerArray.split(""), number))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = fillBoard(st, getHtmlText(npcId + "-26.htm"));
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				// No need to store the String on player db, but still need to update it.
 | 
			
		||||
				final String[] playerChoice = playerArray.concat(number).split("");
 | 
			
		||||
				
 | 
			
		||||
				// Transform the generated board (9 string length) into a 2d matrice (3x3 int).
 | 
			
		||||
				final String[] board = st.getString("board").split("");
 | 
			
		||||
				
 | 
			
		||||
				// test for all line combination
 | 
			
		||||
				int winningLines = 0;
 | 
			
		||||
				
 | 
			
		||||
				for (int[] map : INDEX_MAP)
 | 
			
		||||
				{
 | 
			
		||||
					// test line combination
 | 
			
		||||
					boolean won = true;
 | 
			
		||||
					for (int index : map)
 | 
			
		||||
					{
 | 
			
		||||
						won &= Util.contains(playerChoice, board[index]);
 | 
			
		||||
					}
 | 
			
		||||
					
 | 
			
		||||
					// cut the loop, when you won
 | 
			
		||||
					if (won)
 | 
			
		||||
					{
 | 
			
		||||
						winningLines++;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				if (winningLines == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = getHtmlText(npcId + "-23.htm");
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					for (int[] reward : ((st.get("bet") == "10") ? _rewards_10_win : _rewards_100_win))
 | 
			
		||||
					{
 | 
			
		||||
						if (chance < reward[0])
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(reward[1], 1);
 | 
			
		||||
							if (reward[1] == 2437)
 | 
			
		||||
							{
 | 
			
		||||
								st.giveItems(2463, 1);
 | 
			
		||||
							}
 | 
			
		||||
							
 | 
			
		||||
							break;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (winningLines == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = getHtmlText(npcId + "-25.htm");
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					for (int[] reward : ((st.get("bet") == "10") ? _rewards_10_lose : _rewards_100_lose))
 | 
			
		||||
					{
 | 
			
		||||
						if (chance < reward[0])
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(reward[1], 1);
 | 
			
		||||
							break;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = getHtmlText(npcId + "-24.htm");
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				for (int i = 1; i < 10; i++)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = htmltext.replace("<?Cell" + i + "?>", board[i]);
 | 
			
		||||
					htmltext = htmltext.replace("<?FontColor" + i + "?>", (Util.contains(playerChoice, board[i])) ? "ff0000" : "ffffff");
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 40) ? "30182-04.htm" : "30182-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case CLIFF:
 | 
			
		||||
						htmltext = (st.getQuestItemsCount(MEDAL) < 10) ? "30182-06.htm" : "30182-07.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case BAXT:
 | 
			
		||||
						htmltext = (st.getQuestItemsCount(MEDAL) < 10) ? "30685-01.htm" : "30685-02.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(MEDAL, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final String fillBoard(QuestState st, String htmltext)
 | 
			
		||||
	{
 | 
			
		||||
		final String[] playerArray = st.getString("playerArray").split("");
 | 
			
		||||
		final String[] board = st.getString("board").split("");
 | 
			
		||||
		
 | 
			
		||||
		for (int i = 1; i < 10; i++)
 | 
			
		||||
		{
 | 
			
		||||
			htmltext = htmltext.replace("<?Cell" + i + "?>", (Util.contains(playerArray, board[i])) ? board[i] : "?");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(20947, 160000); // Connabi
 | 
			
		||||
		CHANCES.put(20948, 180000); // Bartal
 | 
			
		||||
		CHANCES.put(20945, 120000); // Cadeine
 | 
			
		||||
		CHANCES.put(20946, 150000); // Sanhidro
 | 
			
		||||
		CHANCES.put(20635, 150000); // Carinkain
 | 
			
		||||
		CHANCES.put(20773, 610000); // Conjurer Bat Lord
 | 
			
		||||
		CHANCES.put(20774, 600000); // Conjurer Bat
 | 
			
		||||
		CHANCES.put(20760, 240000); // Dragon Bearer Archer
 | 
			
		||||
		CHANCES.put(20758, 240000); // Dragon Bearer Chief
 | 
			
		||||
		CHANCES.put(20759, 230000); // Dragon Bearer Warrior
 | 
			
		||||
		CHANCES.put(20242, 220000); // Dustwind Gargoyle
 | 
			
		||||
		CHANCES.put(20281, 220000); // Dustwind Gargoyle (2)
 | 
			
		||||
		CHANCES.put(20556, 140000); // Giant Monstereye
 | 
			
		||||
		CHANCES.put(20668, 210000); // Grave Guard
 | 
			
		||||
		CHANCES.put(20241, 220000); // Hunter Gargoyle
 | 
			
		||||
		CHANCES.put(20286, 220000); // Hunter Gargoyle (2)
 | 
			
		||||
		CHANCES.put(20949, 190000); // Luminun
 | 
			
		||||
		CHANCES.put(20950, 200000); // Innersen
 | 
			
		||||
		CHANCES.put(20942, 90000); // Nightmare Guide
 | 
			
		||||
		CHANCES.put(20943, 120000); // Nightmare Keeper
 | 
			
		||||
		CHANCES.put(20944, 110000); // Nightmare Lord
 | 
			
		||||
		CHANCES.put(20559, 140000); // Rotting Golem
 | 
			
		||||
		CHANCES.put(20243, 210000); // Thunder Wyrm
 | 
			
		||||
		CHANCES.put(20282, 210000); // Thunder Wyrm (2)
 | 
			
		||||
		CHANCES.put(20677, 340000); // Tulben
 | 
			
		||||
		CHANCES.put(20605, 150000); // Weird Drake
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] INDEX_MAP =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			1,
 | 
			
		||||
			2,
 | 
			
		||||
			3
 | 
			
		||||
		}, // line 1
 | 
			
		||||
		{
 | 
			
		||||
			4,
 | 
			
		||||
			5,
 | 
			
		||||
			6
 | 
			
		||||
		}, // line 2
 | 
			
		||||
		{
 | 
			
		||||
			7,
 | 
			
		||||
			8,
 | 
			
		||||
			9
 | 
			
		||||
		}, // line 3
 | 
			
		||||
		{
 | 
			
		||||
			1,
 | 
			
		||||
			4,
 | 
			
		||||
			7
 | 
			
		||||
		}, // column 1
 | 
			
		||||
		{
 | 
			
		||||
			2,
 | 
			
		||||
			5,
 | 
			
		||||
			8
 | 
			
		||||
		}, // column 2
 | 
			
		||||
		{
 | 
			
		||||
			3,
 | 
			
		||||
			6,
 | 
			
		||||
			9
 | 
			
		||||
		}, // column 3
 | 
			
		||||
		{
 | 
			
		||||
			1,
 | 
			
		||||
			5,
 | 
			
		||||
			9
 | 
			
		||||
		}, // diagonal 1
 | 
			
		||||
		{
 | 
			
		||||
			3,
 | 
			
		||||
			5,
 | 
			
		||||
			7
 | 
			
		||||
		}, // diagonal 2
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] _rewards_10_win =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			16,
 | 
			
		||||
			1888
 | 
			
		||||
		}, // Synthetic Cokes
 | 
			
		||||
		{
 | 
			
		||||
			32,
 | 
			
		||||
			1887
 | 
			
		||||
		}, // Varnish of Purity
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			1894
 | 
			
		||||
		}, // Crafted Leather
 | 
			
		||||
		{
 | 
			
		||||
			80,
 | 
			
		||||
			952
 | 
			
		||||
		}, // Scroll: Enchant Armor (C)
 | 
			
		||||
		{
 | 
			
		||||
			89,
 | 
			
		||||
			1890
 | 
			
		||||
		}, // Mithril Alloy
 | 
			
		||||
		{
 | 
			
		||||
			98,
 | 
			
		||||
			1893
 | 
			
		||||
		}, // Oriharukon
 | 
			
		||||
		{
 | 
			
		||||
			100,
 | 
			
		||||
			951
 | 
			
		||||
		}
 | 
			
		||||
		// Scroll: Enchant Weapon (C)
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] _rewards_10_lose =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			4041
 | 
			
		||||
		}, // Mold Hardener
 | 
			
		||||
		{
 | 
			
		||||
			80,
 | 
			
		||||
			952
 | 
			
		||||
		}, // Scroll: Enchant Armor (C)
 | 
			
		||||
		{
 | 
			
		||||
			98,
 | 
			
		||||
			1892
 | 
			
		||||
		}, // Blacksmith's Frame
 | 
			
		||||
		{
 | 
			
		||||
			100,
 | 
			
		||||
			917
 | 
			
		||||
		}
 | 
			
		||||
		// Necklace of Mermaid
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] _rewards_100_win =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			883
 | 
			
		||||
		}, // Aquastone Ring
 | 
			
		||||
		{
 | 
			
		||||
			80,
 | 
			
		||||
			951
 | 
			
		||||
		}, // Scroll: Enchant Weapon (C)
 | 
			
		||||
		{
 | 
			
		||||
			98,
 | 
			
		||||
			852
 | 
			
		||||
		}, // Moonstone Earring
 | 
			
		||||
		{
 | 
			
		||||
			100,
 | 
			
		||||
			401
 | 
			
		||||
		}
 | 
			
		||||
		// Drake Leather Armor
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	private static final int[][] _rewards_100_lose =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			50,
 | 
			
		||||
			951
 | 
			
		||||
		}, // Scroll: Enchant Weapon (C)
 | 
			
		||||
		{
 | 
			
		||||
			80,
 | 
			
		||||
			500
 | 
			
		||||
		}, // Great Helmet
 | 
			
		||||
		{
 | 
			
		||||
			98,
 | 
			
		||||
			2437
 | 
			
		||||
		}, // Drake Leather Boots
 | 
			
		||||
		{
 | 
			
		||||
			100,
 | 
			
		||||
			135
 | 
			
		||||
		}
 | 
			
		||||
		// Samurai Longsword
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	public Q384_WarehouseKeepersPastime()
 | 
			
		||||
	{
 | 
			
		||||
		super(384, qn, "Warehouse Keeper's Pastime");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(MEDAL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(CLIFF);
 | 
			
		||||
		addTalkId(CLIFF, BAXT);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		if (event.equals("30182-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals(npcId + "-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals(npcId + "-11.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(MEDAL) < 10)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = npcId + "-12.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.set("bet", "10");
 | 
			
		||||
				st.set("board", StringUtil.scrambleString("123456789"));
 | 
			
		||||
				st.takeItems(MEDAL, 10);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals(npcId + "-13.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(MEDAL) < 100)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = npcId + "-12.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.set("bet", "100");
 | 
			
		||||
				st.set("board", StringUtil.scrambleString("123456789"));
 | 
			
		||||
				st.takeItems(MEDAL, 100);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("select_1-")) // first pick
 | 
			
		||||
		{
 | 
			
		||||
			// Register the first char.
 | 
			
		||||
			st.set("playerArray", event.substring(9));
 | 
			
		||||
			
 | 
			
		||||
			// Send back the finalized HTM with dynamic content.
 | 
			
		||||
			htmltext = fillBoard(st, getHtmlText(npcId + "-14.htm"));
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("select_2-")) // pick #2-5
 | 
			
		||||
		{
 | 
			
		||||
			// Stores the current event for future use.
 | 
			
		||||
			String number = event.substring(9);
 | 
			
		||||
			
 | 
			
		||||
			// Restore the player array.
 | 
			
		||||
			String playerArray = st.getString("playerArray");
 | 
			
		||||
			
 | 
			
		||||
			// Verify if the given number is already on the player array, if yes, it's invalid, otherwise register it.
 | 
			
		||||
			if (Util.contains(playerArray.split(""), number))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = fillBoard(st, getHtmlText(npcId + "-" + String.valueOf(14 + (2 * playerArray.length())) + ".htm"));
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				// Stores the final String.
 | 
			
		||||
				st.set("playerArray", playerArray.concat(number));
 | 
			
		||||
				
 | 
			
		||||
				htmltext = fillBoard(st, getHtmlText(npcId + "-" + String.valueOf(11 + (2 * (playerArray.length() + 1))) + ".htm"));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.startsWith("select_3-")) // pick #6
 | 
			
		||||
		{
 | 
			
		||||
			// Stores the current event for future use.
 | 
			
		||||
			String number = event.substring(9);
 | 
			
		||||
			
 | 
			
		||||
			// Restore the player array.
 | 
			
		||||
			String playerArray = st.getString("playerArray");
 | 
			
		||||
			
 | 
			
		||||
			// Verify if the given number is already on the player array, if yes, it's invalid, otherwise calculate reward.
 | 
			
		||||
			if (Util.contains(playerArray.split(""), number))
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = fillBoard(st, getHtmlText(npcId + "-26.htm"));
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				// No need to store the String on player db, but still need to update it.
 | 
			
		||||
				final String[] playerChoice = playerArray.concat(number).split("");
 | 
			
		||||
				
 | 
			
		||||
				// Transform the generated board (9 string length) into a 2d matrice (3x3 int).
 | 
			
		||||
				final String[] board = st.getString("board").split("");
 | 
			
		||||
				
 | 
			
		||||
				// test for all line combination
 | 
			
		||||
				int winningLines = 0;
 | 
			
		||||
				
 | 
			
		||||
				for (int[] map : INDEX_MAP)
 | 
			
		||||
				{
 | 
			
		||||
					// test line combination
 | 
			
		||||
					boolean won = true;
 | 
			
		||||
					for (int index : map)
 | 
			
		||||
					{
 | 
			
		||||
						won &= Util.contains(playerChoice, board[index]);
 | 
			
		||||
					}
 | 
			
		||||
					
 | 
			
		||||
					// cut the loop, when you won
 | 
			
		||||
					if (won)
 | 
			
		||||
					{
 | 
			
		||||
						winningLines++;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				if (winningLines == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = getHtmlText(npcId + "-23.htm");
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					for (int[] reward : ((st.get("bet") == "10") ? _rewards_10_win : _rewards_100_win))
 | 
			
		||||
					{
 | 
			
		||||
						if (chance < reward[0])
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(reward[1], 1);
 | 
			
		||||
							if (reward[1] == 2437)
 | 
			
		||||
							{
 | 
			
		||||
								st.giveItems(2463, 1);
 | 
			
		||||
							}
 | 
			
		||||
							
 | 
			
		||||
							break;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (winningLines == 0)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = getHtmlText(npcId + "-25.htm");
 | 
			
		||||
					
 | 
			
		||||
					final int chance = Rnd.get(100);
 | 
			
		||||
					for (int[] reward : ((st.get("bet") == "10") ? _rewards_10_lose : _rewards_100_lose))
 | 
			
		||||
					{
 | 
			
		||||
						if (chance < reward[0])
 | 
			
		||||
						{
 | 
			
		||||
							st.giveItems(reward[1], 1);
 | 
			
		||||
							break;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = getHtmlText(npcId + "-24.htm");
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				for (int i = 1; i < 10; i++)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = htmltext.replace("<?Cell" + i + "?>", board[i]);
 | 
			
		||||
					htmltext = htmltext.replace("<?FontColor" + i + "?>", (Util.contains(playerChoice, board[i])) ? "ff0000" : "ffffff");
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 40) ? "30182-04.htm" : "30182-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case CLIFF:
 | 
			
		||||
						htmltext = (st.getQuestItemsCount(MEDAL) < 10) ? "30182-06.htm" : "30182-07.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case BAXT:
 | 
			
		||||
						htmltext = (st.getQuestItemsCount(MEDAL) < 10) ? "30685-01.htm" : "30685-02.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(MEDAL, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final String fillBoard(QuestState st, String htmltext)
 | 
			
		||||
	{
 | 
			
		||||
		final String[] playerArray = st.getString("playerArray").split("");
 | 
			
		||||
		final String[] board = st.getString("board").split("");
 | 
			
		||||
		
 | 
			
		||||
		for (int i = 1; i < 10; i++)
 | 
			
		||||
		{
 | 
			
		||||
			htmltext = htmltext.replace("<?Cell" + i + "?>", (Util.contains(playerArray, board[i])) ? board[i] : "?");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,205 +1,206 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q385_YokeOfThePast;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q385_YokeOfThePast extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q385_YokeOfThePast";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int GATEKEEPER_ZIGGURAT[] =
 | 
			
		||||
	{
 | 
			
		||||
		31095,
 | 
			
		||||
		31096,
 | 
			
		||||
		31097,
 | 
			
		||||
		31098,
 | 
			
		||||
		31099,
 | 
			
		||||
		31100,
 | 
			
		||||
		31101,
 | 
			
		||||
		31102,
 | 
			
		||||
		31103,
 | 
			
		||||
		31104,
 | 
			
		||||
		31105,
 | 
			
		||||
		31106,
 | 
			
		||||
		31107,
 | 
			
		||||
		31108,
 | 
			
		||||
		31109,
 | 
			
		||||
		31110,
 | 
			
		||||
		31114,
 | 
			
		||||
		31115,
 | 
			
		||||
		31116,
 | 
			
		||||
		31117,
 | 
			
		||||
		31118,
 | 
			
		||||
		31119,
 | 
			
		||||
		31120,
 | 
			
		||||
		31121,
 | 
			
		||||
		31122,
 | 
			
		||||
		31123,
 | 
			
		||||
		31124,
 | 
			
		||||
		31125,
 | 
			
		||||
		31126
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int ANCIENT_SCROLL = 5902;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int BLANK_SCROLL = 5965;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q385_YokeOfThePast;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q385_YokeOfThePast extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q385_YokeOfThePast";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int GATEKEEPER_ZIGGURAT[] =
 | 
			
		||||
	{
 | 
			
		||||
		31095,
 | 
			
		||||
		31096,
 | 
			
		||||
		31097,
 | 
			
		||||
		31098,
 | 
			
		||||
		31099,
 | 
			
		||||
		31100,
 | 
			
		||||
		31101,
 | 
			
		||||
		31102,
 | 
			
		||||
		31103,
 | 
			
		||||
		31104,
 | 
			
		||||
		31105,
 | 
			
		||||
		31106,
 | 
			
		||||
		31107,
 | 
			
		||||
		31108,
 | 
			
		||||
		31109,
 | 
			
		||||
		31110,
 | 
			
		||||
		31114,
 | 
			
		||||
		31115,
 | 
			
		||||
		31116,
 | 
			
		||||
		31117,
 | 
			
		||||
		31118,
 | 
			
		||||
		31119,
 | 
			
		||||
		31120,
 | 
			
		||||
		31121,
 | 
			
		||||
		31122,
 | 
			
		||||
		31123,
 | 
			
		||||
		31124,
 | 
			
		||||
		31125,
 | 
			
		||||
		31126
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int ANCIENT_SCROLL = 5902;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int BLANK_SCROLL = 5965;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21208, 70000);
 | 
			
		||||
		CHANCES.put(21209, 80000);
 | 
			
		||||
		CHANCES.put(21210, 110000);
 | 
			
		||||
		CHANCES.put(21211, 110000);
 | 
			
		||||
		CHANCES.put(21213, 140000);
 | 
			
		||||
		CHANCES.put(21214, 190000);
 | 
			
		||||
		CHANCES.put(21215, 190000);
 | 
			
		||||
		CHANCES.put(21217, 240000);
 | 
			
		||||
		CHANCES.put(21218, 300000);
 | 
			
		||||
		CHANCES.put(21219, 300000);
 | 
			
		||||
		CHANCES.put(21221, 370000);
 | 
			
		||||
		CHANCES.put(21222, 460000);
 | 
			
		||||
		CHANCES.put(21223, 450000);
 | 
			
		||||
		CHANCES.put(21224, 500000);
 | 
			
		||||
		CHANCES.put(21225, 540000);
 | 
			
		||||
		CHANCES.put(21226, 660000);
 | 
			
		||||
		CHANCES.put(21227, 640000);
 | 
			
		||||
		CHANCES.put(21228, 700000);
 | 
			
		||||
		CHANCES.put(21229, 750000);
 | 
			
		||||
		CHANCES.put(21230, 910000);
 | 
			
		||||
		CHANCES.put(21231, 860000);
 | 
			
		||||
		CHANCES.put(21236, 120000);
 | 
			
		||||
		CHANCES.put(21237, 140000);
 | 
			
		||||
		CHANCES.put(21238, 190000);
 | 
			
		||||
		CHANCES.put(21239, 190000);
 | 
			
		||||
		CHANCES.put(21240, 220000);
 | 
			
		||||
		CHANCES.put(21241, 240000);
 | 
			
		||||
		CHANCES.put(21242, 300000);
 | 
			
		||||
		CHANCES.put(21243, 300000);
 | 
			
		||||
		CHANCES.put(21244, 340000);
 | 
			
		||||
		CHANCES.put(21245, 370000);
 | 
			
		||||
		CHANCES.put(21246, 460000);
 | 
			
		||||
		CHANCES.put(21247, 450000);
 | 
			
		||||
		CHANCES.put(21248, 500000);
 | 
			
		||||
		CHANCES.put(21249, 540000);
 | 
			
		||||
		CHANCES.put(21250, 660000);
 | 
			
		||||
		CHANCES.put(21251, 640000);
 | 
			
		||||
		CHANCES.put(21252, 700000);
 | 
			
		||||
		CHANCES.put(21253, 750000);
 | 
			
		||||
		CHANCES.put(21254, 910000);
 | 
			
		||||
		CHANCES.put(21255, 860000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q385_YokeOfThePast()
 | 
			
		||||
	{
 | 
			
		||||
		super(385, qn, "Yoke of the Past");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ANCIENT_SCROLL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(GATEKEEPER_ZIGGURAT);
 | 
			
		||||
		addTalkId(GATEKEEPER_ZIGGURAT);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 20) ? "02.htm" : "01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				if (!st.hasQuestItems(ANCIENT_SCROLL))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "08.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "09.htm";
 | 
			
		||||
					int count = st.getQuestItemsCount(ANCIENT_SCROLL);
 | 
			
		||||
					st.takeItems(ANCIENT_SCROLL, -1);
 | 
			
		||||
					st.rewardItems(BLANK_SCROLL, count);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(ANCIENT_SCROLL, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21208, 70000);
 | 
			
		||||
		CHANCES.put(21209, 80000);
 | 
			
		||||
		CHANCES.put(21210, 110000);
 | 
			
		||||
		CHANCES.put(21211, 110000);
 | 
			
		||||
		CHANCES.put(21213, 140000);
 | 
			
		||||
		CHANCES.put(21214, 190000);
 | 
			
		||||
		CHANCES.put(21215, 190000);
 | 
			
		||||
		CHANCES.put(21217, 240000);
 | 
			
		||||
		CHANCES.put(21218, 300000);
 | 
			
		||||
		CHANCES.put(21219, 300000);
 | 
			
		||||
		CHANCES.put(21221, 370000);
 | 
			
		||||
		CHANCES.put(21222, 460000);
 | 
			
		||||
		CHANCES.put(21223, 450000);
 | 
			
		||||
		CHANCES.put(21224, 500000);
 | 
			
		||||
		CHANCES.put(21225, 540000);
 | 
			
		||||
		CHANCES.put(21226, 660000);
 | 
			
		||||
		CHANCES.put(21227, 640000);
 | 
			
		||||
		CHANCES.put(21228, 700000);
 | 
			
		||||
		CHANCES.put(21229, 750000);
 | 
			
		||||
		CHANCES.put(21230, 910000);
 | 
			
		||||
		CHANCES.put(21231, 860000);
 | 
			
		||||
		CHANCES.put(21236, 120000);
 | 
			
		||||
		CHANCES.put(21237, 140000);
 | 
			
		||||
		CHANCES.put(21238, 190000);
 | 
			
		||||
		CHANCES.put(21239, 190000);
 | 
			
		||||
		CHANCES.put(21240, 220000);
 | 
			
		||||
		CHANCES.put(21241, 240000);
 | 
			
		||||
		CHANCES.put(21242, 300000);
 | 
			
		||||
		CHANCES.put(21243, 300000);
 | 
			
		||||
		CHANCES.put(21244, 340000);
 | 
			
		||||
		CHANCES.put(21245, 370000);
 | 
			
		||||
		CHANCES.put(21246, 460000);
 | 
			
		||||
		CHANCES.put(21247, 450000);
 | 
			
		||||
		CHANCES.put(21248, 500000);
 | 
			
		||||
		CHANCES.put(21249, 540000);
 | 
			
		||||
		CHANCES.put(21250, 660000);
 | 
			
		||||
		CHANCES.put(21251, 640000);
 | 
			
		||||
		CHANCES.put(21252, 700000);
 | 
			
		||||
		CHANCES.put(21253, 750000);
 | 
			
		||||
		CHANCES.put(21254, 910000);
 | 
			
		||||
		CHANCES.put(21255, 860000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q385_YokeOfThePast()
 | 
			
		||||
	{
 | 
			
		||||
		super(385, qn, "Yoke of the Past");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ANCIENT_SCROLL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(GATEKEEPER_ZIGGURAT);
 | 
			
		||||
		addTalkId(GATEKEEPER_ZIGGURAT);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 20) ? "02.htm" : "01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				if (!st.hasQuestItems(ANCIENT_SCROLL))
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "08.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "09.htm";
 | 
			
		||||
					int count = st.getQuestItemsCount(ANCIENT_SCROLL);
 | 
			
		||||
					st.takeItems(ANCIENT_SCROLL, -1);
 | 
			
		||||
					st.rewardItems(BLANK_SCROLL, count);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(ANCIENT_SCROLL, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,343 +1,344 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q419_GetAPet;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q419_GetAPet extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q419_GetAPet";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int ANIMAL_LOVER_LIST = 3417;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_1 = 3418;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_2 = 3419;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_3 = 3420;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_4 = 3421;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_5 = 3422;
 | 
			
		||||
	private static final int BLOODY_FANG = 3423;
 | 
			
		||||
	private static final int BLOODY_CLAW = 3424;
 | 
			
		||||
	private static final int BLOODY_NAIL = 3425;
 | 
			
		||||
	private static final int BLOODY_KASHA_FANG = 3426;
 | 
			
		||||
	private static final int BLOODY_TARANTULA_NAIL = 3427;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int WOLF_COLLAR = 2375;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int MARTIN = 30731;
 | 
			
		||||
	private static final int BELLA = 30256;
 | 
			
		||||
	private static final int METTY = 30072;
 | 
			
		||||
	private static final int ELLIE = 30091;
 | 
			
		||||
	
 | 
			
		||||
	// Droplist
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q419_GetAPet;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q419_GetAPet extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q419_GetAPet";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int ANIMAL_LOVER_LIST = 3417;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_1 = 3418;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_2 = 3419;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_3 = 3420;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_4 = 3421;
 | 
			
		||||
	private static final int ANIMAL_SLAYER_LIST_5 = 3422;
 | 
			
		||||
	private static final int BLOODY_FANG = 3423;
 | 
			
		||||
	private static final int BLOODY_CLAW = 3424;
 | 
			
		||||
	private static final int BLOODY_NAIL = 3425;
 | 
			
		||||
	private static final int BLOODY_KASHA_FANG = 3426;
 | 
			
		||||
	private static final int BLOODY_TARANTULA_NAIL = 3427;
 | 
			
		||||
	
 | 
			
		||||
	// Reward
 | 
			
		||||
	private static final int WOLF_COLLAR = 2375;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int MARTIN = 30731;
 | 
			
		||||
	private static final int BELLA = 30256;
 | 
			
		||||
	private static final int METTY = 30072;
 | 
			
		||||
	private static final int ELLIE = 30091;
 | 
			
		||||
	
 | 
			
		||||
	// Droplist
 | 
			
		||||
	private static final Map<Integer, int[]> DROPLIST = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(20103, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_FANG,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20106, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_FANG,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20108, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_FANG,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20460, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_CLAW,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20308, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_CLAW,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20466, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_CLAW,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20025, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_NAIL,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20105, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_NAIL,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20034, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_NAIL,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20474, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_KASHA_FANG,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20476, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_KASHA_FANG,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20478, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_KASHA_FANG,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20403, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_TARANTULA_NAIL,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20508, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_TARANTULA_NAIL,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q419_GetAPet()
 | 
			
		||||
	{
 | 
			
		||||
		super(419, qn, "Get a Pet");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ANIMAL_LOVER_LIST, ANIMAL_SLAYER_LIST_1, ANIMAL_SLAYER_LIST_2, ANIMAL_SLAYER_LIST_3, ANIMAL_SLAYER_LIST_4, ANIMAL_SLAYER_LIST_5, BLOODY_FANG, BLOODY_CLAW, BLOODY_NAIL, BLOODY_KASHA_FANG, BLOODY_TARANTULA_NAIL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(MARTIN);
 | 
			
		||||
		addTalkId(MARTIN, BELLA, ELLIE, METTY);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : DROPLIST.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("task"))
 | 
			
		||||
		{
 | 
			
		||||
			final int race = player.getRace().ordinal();
 | 
			
		||||
			
 | 
			
		||||
			htmltext = "30731-0" + (race + 4) + ".htm";
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
			st.giveItems(ANIMAL_SLAYER_LIST_1 + race, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30731-12.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_1, 1);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_2, 1);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_3, 1);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_4, 1);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_5, 1);
 | 
			
		||||
			st.takeItems(BLOODY_FANG, -1);
 | 
			
		||||
			st.takeItems(BLOODY_CLAW, -1);
 | 
			
		||||
			st.takeItems(BLOODY_NAIL, -1);
 | 
			
		||||
			st.takeItems(BLOODY_KASHA_FANG, -1);
 | 
			
		||||
			st.takeItems(BLOODY_TARANTULA_NAIL, -1);
 | 
			
		||||
			st.giveItems(ANIMAL_LOVER_LIST, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30256-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("progress", String.valueOf(st.getInt("progress") | 1));
 | 
			
		||||
			if (st.getInt("progress") == 7)
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30072-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("progress", String.valueOf(st.getInt("progress") | 2));
 | 
			
		||||
			if (st.getInt("progress") == 7)
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30091-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("progress", String.valueOf(st.getInt("progress") | 4));
 | 
			
		||||
			if (st.getInt("progress") == 7)
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("test"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("answers", "0");
 | 
			
		||||
			st.set("quiz", "20 21 22 23 24 25 26 27 28 29 30 31 32 33");
 | 
			
		||||
			return checkQuestions(st);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("wrong"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("wrong", String.valueOf(st.getInt("wrong") + 1));
 | 
			
		||||
			return checkQuestions(st);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("right"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("correct", String.valueOf(st.getInt("correct") + 1));
 | 
			
		||||
			return checkQuestions(st);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 15) ? "30731-01.htm" : "30731-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case MARTIN:
 | 
			
		||||
						if (st.hasAtLeastOneQuestItem(ANIMAL_SLAYER_LIST_1, ANIMAL_SLAYER_LIST_2, ANIMAL_SLAYER_LIST_3, ANIMAL_SLAYER_LIST_4, ANIMAL_SLAYER_LIST_5))
 | 
			
		||||
						{
 | 
			
		||||
							final int proofs = st.getQuestItemsCount(BLOODY_FANG) + st.getQuestItemsCount(BLOODY_CLAW) + st.getQuestItemsCount(BLOODY_NAIL) + st.getQuestItemsCount(BLOODY_KASHA_FANG) + st.getQuestItemsCount(BLOODY_TARANTULA_NAIL);
 | 
			
		||||
							if (proofs == 0)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30731-09.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else if (proofs < 50)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30731-10.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30731-11.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (st.getInt("progress") == 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30731-13.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30731-16.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case BELLA:
 | 
			
		||||
						htmltext = "30256-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case METTY:
 | 
			
		||||
						htmltext = "30072-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ELLIE:
 | 
			
		||||
						htmltext = "30091-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int[] drop = DROPLIST.get(npc.getNpcId());
 | 
			
		||||
		
 | 
			
		||||
		if (st.hasQuestItems(drop[0] - 5))
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItems(drop[0], 1, 50, drop[1]);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static String checkQuestions(QuestState st)
 | 
			
		||||
	{
 | 
			
		||||
		final int answers = st.getInt("correct") + (st.getInt("wrong"));
 | 
			
		||||
		if (answers < 10)
 | 
			
		||||
		{
 | 
			
		||||
			String[] questions = st.getString("quiz").split(" ");
 | 
			
		||||
			int index = Rnd.get(questions.length - 1);
 | 
			
		||||
			String question = questions[index];
 | 
			
		||||
			
 | 
			
		||||
			if (questions.length > (10 - answers))
 | 
			
		||||
			{
 | 
			
		||||
				questions[index] = questions[questions.length - 1];
 | 
			
		||||
				
 | 
			
		||||
				st.set("quiz", String.join(" ", Arrays.copyOf(questions, questions.length - 1)));
 | 
			
		||||
			}
 | 
			
		||||
			return "30731-" + question + ".htm";
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.getInt("wrong") > 0)
 | 
			
		||||
		{
 | 
			
		||||
			st.unset("progress");
 | 
			
		||||
			st.unset("answers");
 | 
			
		||||
			st.unset("quiz");
 | 
			
		||||
			st.unset("wrong");
 | 
			
		||||
			st.unset("correct");
 | 
			
		||||
			return "30731-14.htm";
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st.takeItems(ANIMAL_LOVER_LIST, 1);
 | 
			
		||||
		st.giveItems(WOLF_COLLAR, 1);
 | 
			
		||||
		st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
		st.exitQuest(true);
 | 
			
		||||
		
 | 
			
		||||
		return "30731-15.htm";
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		DROPLIST.put(20103, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_FANG,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20106, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_FANG,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20108, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_FANG,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20460, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_CLAW,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20308, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_CLAW,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20466, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_CLAW,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20025, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_NAIL,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20105, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_NAIL,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20034, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_NAIL,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20474, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_KASHA_FANG,
 | 
			
		||||
			600000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20476, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_KASHA_FANG,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20478, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_KASHA_FANG,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20403, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_TARANTULA_NAIL,
 | 
			
		||||
			750000
 | 
			
		||||
		});
 | 
			
		||||
		DROPLIST.put(20508, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			BLOODY_TARANTULA_NAIL,
 | 
			
		||||
			1000000
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q419_GetAPet()
 | 
			
		||||
	{
 | 
			
		||||
		super(419, qn, "Get a Pet");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(ANIMAL_LOVER_LIST, ANIMAL_SLAYER_LIST_1, ANIMAL_SLAYER_LIST_2, ANIMAL_SLAYER_LIST_3, ANIMAL_SLAYER_LIST_4, ANIMAL_SLAYER_LIST_5, BLOODY_FANG, BLOODY_CLAW, BLOODY_NAIL, BLOODY_KASHA_FANG, BLOODY_TARANTULA_NAIL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(MARTIN);
 | 
			
		||||
		addTalkId(MARTIN, BELLA, ELLIE, METTY);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : DROPLIST.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("task"))
 | 
			
		||||
		{
 | 
			
		||||
			final int race = player.getRace().ordinal();
 | 
			
		||||
			
 | 
			
		||||
			htmltext = "30731-0" + (race + 4) + ".htm";
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
			st.giveItems(ANIMAL_SLAYER_LIST_1 + race, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30731-12.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_1, 1);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_2, 1);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_3, 1);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_4, 1);
 | 
			
		||||
			st.takeItems(ANIMAL_SLAYER_LIST_5, 1);
 | 
			
		||||
			st.takeItems(BLOODY_FANG, -1);
 | 
			
		||||
			st.takeItems(BLOODY_CLAW, -1);
 | 
			
		||||
			st.takeItems(BLOODY_NAIL, -1);
 | 
			
		||||
			st.takeItems(BLOODY_KASHA_FANG, -1);
 | 
			
		||||
			st.takeItems(BLOODY_TARANTULA_NAIL, -1);
 | 
			
		||||
			st.giveItems(ANIMAL_LOVER_LIST, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30256-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("progress", String.valueOf(st.getInt("progress") | 1));
 | 
			
		||||
			if (st.getInt("progress") == 7)
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30072-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("progress", String.valueOf(st.getInt("progress") | 2));
 | 
			
		||||
			if (st.getInt("progress") == 7)
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("30091-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("progress", String.valueOf(st.getInt("progress") | 4));
 | 
			
		||||
			if (st.getInt("progress") == 7)
 | 
			
		||||
			{
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("test"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("answers", "0");
 | 
			
		||||
			st.set("quiz", "20 21 22 23 24 25 26 27 28 29 30 31 32 33");
 | 
			
		||||
			return checkQuestions(st);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("wrong"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("wrong", String.valueOf(st.getInt("wrong") + 1));
 | 
			
		||||
			return checkQuestions(st);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("right"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("correct", String.valueOf(st.getInt("correct") + 1));
 | 
			
		||||
			return checkQuestions(st);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 15) ? "30731-01.htm" : "30731-02.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case MARTIN:
 | 
			
		||||
						if (st.hasAtLeastOneQuestItem(ANIMAL_SLAYER_LIST_1, ANIMAL_SLAYER_LIST_2, ANIMAL_SLAYER_LIST_3, ANIMAL_SLAYER_LIST_4, ANIMAL_SLAYER_LIST_5))
 | 
			
		||||
						{
 | 
			
		||||
							final int proofs = st.getQuestItemsCount(BLOODY_FANG) + st.getQuestItemsCount(BLOODY_CLAW) + st.getQuestItemsCount(BLOODY_NAIL) + st.getQuestItemsCount(BLOODY_KASHA_FANG) + st.getQuestItemsCount(BLOODY_TARANTULA_NAIL);
 | 
			
		||||
							if (proofs == 0)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30731-09.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else if (proofs < 50)
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30731-10.htm";
 | 
			
		||||
							}
 | 
			
		||||
							else
 | 
			
		||||
							{
 | 
			
		||||
								htmltext = "30731-11.htm";
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						else if (st.getInt("progress") == 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30731-13.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "30731-16.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case BELLA:
 | 
			
		||||
						htmltext = "30256-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case METTY:
 | 
			
		||||
						htmltext = "30072-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ELLIE:
 | 
			
		||||
						htmltext = "30091-01.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerState(player, npc, State.STARTED);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int[] drop = DROPLIST.get(npc.getNpcId());
 | 
			
		||||
		
 | 
			
		||||
		if (st.hasQuestItems(drop[0] - 5))
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItems(drop[0], 1, 50, drop[1]);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static String checkQuestions(QuestState st)
 | 
			
		||||
	{
 | 
			
		||||
		final int answers = st.getInt("correct") + (st.getInt("wrong"));
 | 
			
		||||
		if (answers < 10)
 | 
			
		||||
		{
 | 
			
		||||
			String[] questions = st.getString("quiz").split(" ");
 | 
			
		||||
			int index = Rnd.get(questions.length - 1);
 | 
			
		||||
			String question = questions[index];
 | 
			
		||||
			
 | 
			
		||||
			if (questions.length > (10 - answers))
 | 
			
		||||
			{
 | 
			
		||||
				questions[index] = questions[questions.length - 1];
 | 
			
		||||
				
 | 
			
		||||
				st.set("quiz", String.join(" ", Arrays.copyOf(questions, questions.length - 1)));
 | 
			
		||||
			}
 | 
			
		||||
			return "30731-" + question + ".htm";
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.getInt("wrong") > 0)
 | 
			
		||||
		{
 | 
			
		||||
			st.unset("progress");
 | 
			
		||||
			st.unset("answers");
 | 
			
		||||
			st.unset("quiz");
 | 
			
		||||
			st.unset("wrong");
 | 
			
		||||
			st.unset("correct");
 | 
			
		||||
			return "30731-14.htm";
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st.takeItems(ANIMAL_LOVER_LIST, 1);
 | 
			
		||||
		st.giveItems(WOLF_COLLAR, 1);
 | 
			
		||||
		st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
		st.exitQuest(true);
 | 
			
		||||
		
 | 
			
		||||
		return "30731-15.htm";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,468 +1,474 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q426_QuestForFishingShot;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q426_QuestForFishingShot extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q426_QuestForFishingShot";
 | 
			
		||||
	
 | 
			
		||||
	private static final int SWEET_FLUID = 7586;
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q426_QuestForFishingShot;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q426_QuestForFishingShot extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q426_QuestForFishingShot";
 | 
			
		||||
	
 | 
			
		||||
	private static final int SWEET_FLUID = 7586;
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> MOBS1 = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		MOBS1.put(20005, 45);
 | 
			
		||||
		MOBS1.put(20013, 100);
 | 
			
		||||
		MOBS1.put(20016, 100);
 | 
			
		||||
		MOBS1.put(20017, 115);
 | 
			
		||||
		MOBS1.put(20030, 105);
 | 
			
		||||
		MOBS1.put(20132, 70);
 | 
			
		||||
		MOBS1.put(20038, 135);
 | 
			
		||||
		MOBS1.put(20044, 125);
 | 
			
		||||
		MOBS1.put(20046, 100);
 | 
			
		||||
		MOBS1.put(20047, 100);
 | 
			
		||||
		MOBS1.put(20050, 140);
 | 
			
		||||
		MOBS1.put(20058, 140);
 | 
			
		||||
		MOBS1.put(20063, 160);
 | 
			
		||||
		MOBS1.put(20066, 170);
 | 
			
		||||
		MOBS1.put(20070, 180);
 | 
			
		||||
		MOBS1.put(20074, 195);
 | 
			
		||||
		MOBS1.put(20077, 205);
 | 
			
		||||
		MOBS1.put(20078, 205);
 | 
			
		||||
		MOBS1.put(20079, 205);
 | 
			
		||||
		MOBS1.put(20080, 220);
 | 
			
		||||
		MOBS1.put(20081, 370);
 | 
			
		||||
		MOBS1.put(20083, 245);
 | 
			
		||||
		MOBS1.put(20084, 255);
 | 
			
		||||
		MOBS1.put(20085, 265);
 | 
			
		||||
		MOBS1.put(20087, 565);
 | 
			
		||||
		MOBS1.put(20088, 605);
 | 
			
		||||
		MOBS1.put(20089, 250);
 | 
			
		||||
		MOBS1.put(20100, 85);
 | 
			
		||||
		MOBS1.put(20103, 110);
 | 
			
		||||
		MOBS1.put(20105, 110);
 | 
			
		||||
		MOBS1.put(20115, 190);
 | 
			
		||||
		MOBS1.put(20120, 20);
 | 
			
		||||
		MOBS1.put(20131, 45);
 | 
			
		||||
		MOBS1.put(20135, 360);
 | 
			
		||||
		MOBS1.put(20157, 235);
 | 
			
		||||
		MOBS1.put(20162, 195);
 | 
			
		||||
		MOBS1.put(20176, 280);
 | 
			
		||||
		MOBS1.put(20211, 170);
 | 
			
		||||
		MOBS1.put(20225, 160);
 | 
			
		||||
		MOBS1.put(20227, 180);
 | 
			
		||||
		MOBS1.put(20230, 260);
 | 
			
		||||
		MOBS1.put(20232, 245);
 | 
			
		||||
		MOBS1.put(20234, 290);
 | 
			
		||||
		MOBS1.put(20241, 700);
 | 
			
		||||
		MOBS1.put(20267, 215);
 | 
			
		||||
		MOBS1.put(20268, 295);
 | 
			
		||||
		MOBS1.put(20269, 255);
 | 
			
		||||
		MOBS1.put(20270, 365);
 | 
			
		||||
		MOBS1.put(20271, 295);
 | 
			
		||||
		MOBS1.put(20286, 700);
 | 
			
		||||
		MOBS1.put(20308, 110);
 | 
			
		||||
		MOBS1.put(20312, 45);
 | 
			
		||||
		MOBS1.put(20317, 20);
 | 
			
		||||
		MOBS1.put(20324, 85);
 | 
			
		||||
		MOBS1.put(20333, 100);
 | 
			
		||||
		MOBS1.put(20341, 100);
 | 
			
		||||
		MOBS1.put(20346, 85);
 | 
			
		||||
		MOBS1.put(20349, 850);
 | 
			
		||||
		MOBS1.put(20356, 165);
 | 
			
		||||
		MOBS1.put(20357, 140);
 | 
			
		||||
		MOBS1.put(20363, 70);
 | 
			
		||||
		MOBS1.put(20368, 85);
 | 
			
		||||
		MOBS1.put(20371, 100);
 | 
			
		||||
		MOBS1.put(20386, 85);
 | 
			
		||||
		MOBS1.put(20389, 90);
 | 
			
		||||
		MOBS1.put(20403, 110);
 | 
			
		||||
		MOBS1.put(20404, 95);
 | 
			
		||||
		MOBS1.put(20433, 100);
 | 
			
		||||
		MOBS1.put(20436, 140);
 | 
			
		||||
		MOBS1.put(20448, 45);
 | 
			
		||||
		MOBS1.put(20456, 20);
 | 
			
		||||
		MOBS1.put(20463, 85);
 | 
			
		||||
		MOBS1.put(20470, 45);
 | 
			
		||||
		MOBS1.put(20471, 85);
 | 
			
		||||
		MOBS1.put(20475, 20);
 | 
			
		||||
		MOBS1.put(20478, 110);
 | 
			
		||||
		MOBS1.put(20487, 90);
 | 
			
		||||
		MOBS1.put(20511, 100);
 | 
			
		||||
		MOBS1.put(20525, 20);
 | 
			
		||||
		MOBS1.put(20528, 100);
 | 
			
		||||
		MOBS1.put(20536, 15);
 | 
			
		||||
		MOBS1.put(20537, 15);
 | 
			
		||||
		MOBS1.put(20538, 15);
 | 
			
		||||
		MOBS1.put(20539, 15);
 | 
			
		||||
		MOBS1.put(20544, 15);
 | 
			
		||||
		MOBS1.put(20550, 300);
 | 
			
		||||
		MOBS1.put(20551, 300);
 | 
			
		||||
		MOBS1.put(20552, 650);
 | 
			
		||||
		MOBS1.put(20553, 335);
 | 
			
		||||
		MOBS1.put(20554, 390);
 | 
			
		||||
		MOBS1.put(20555, 350);
 | 
			
		||||
		MOBS1.put(20557, 390);
 | 
			
		||||
		MOBS1.put(20559, 420);
 | 
			
		||||
		MOBS1.put(20560, 440);
 | 
			
		||||
		MOBS1.put(20562, 485);
 | 
			
		||||
		MOBS1.put(20573, 545);
 | 
			
		||||
		MOBS1.put(20575, 645);
 | 
			
		||||
		MOBS1.put(20630, 350);
 | 
			
		||||
		MOBS1.put(20632, 475);
 | 
			
		||||
		MOBS1.put(20634, 960);
 | 
			
		||||
		MOBS1.put(20636, 495);
 | 
			
		||||
		MOBS1.put(20638, 540);
 | 
			
		||||
		MOBS1.put(20641, 680);
 | 
			
		||||
		MOBS1.put(20643, 660);
 | 
			
		||||
		MOBS1.put(20644, 645);
 | 
			
		||||
		MOBS1.put(20659, 440);
 | 
			
		||||
		MOBS1.put(20661, 575);
 | 
			
		||||
		MOBS1.put(20663, 525);
 | 
			
		||||
		MOBS1.put(20665, 680);
 | 
			
		||||
		MOBS1.put(20667, 730);
 | 
			
		||||
		MOBS1.put(20766, 210);
 | 
			
		||||
		MOBS1.put(20781, 270);
 | 
			
		||||
		MOBS1.put(20783, 140);
 | 
			
		||||
		MOBS1.put(20784, 155);
 | 
			
		||||
		MOBS1.put(20786, 170);
 | 
			
		||||
		MOBS1.put(20788, 325);
 | 
			
		||||
		MOBS1.put(20790, 390);
 | 
			
		||||
		MOBS1.put(20792, 620);
 | 
			
		||||
		MOBS1.put(20794, 635);
 | 
			
		||||
		MOBS1.put(20796, 640);
 | 
			
		||||
		MOBS1.put(20798, 850);
 | 
			
		||||
		MOBS1.put(20800, 740);
 | 
			
		||||
		MOBS1.put(20802, 900);
 | 
			
		||||
		MOBS1.put(20804, 775);
 | 
			
		||||
		MOBS1.put(20806, 805);
 | 
			
		||||
		MOBS1.put(20833, 455);
 | 
			
		||||
		MOBS1.put(20834, 680);
 | 
			
		||||
		MOBS1.put(20836, 785);
 | 
			
		||||
		MOBS1.put(20837, 835);
 | 
			
		||||
		MOBS1.put(20839, 430);
 | 
			
		||||
		MOBS1.put(20841, 460);
 | 
			
		||||
		MOBS1.put(20845, 605);
 | 
			
		||||
		MOBS1.put(20847, 570);
 | 
			
		||||
		MOBS1.put(20849, 585);
 | 
			
		||||
		MOBS1.put(20936, 290);
 | 
			
		||||
		MOBS1.put(20937, 315);
 | 
			
		||||
		MOBS1.put(20939, 385);
 | 
			
		||||
		MOBS1.put(20940, 500);
 | 
			
		||||
		MOBS1.put(20941, 460);
 | 
			
		||||
		MOBS1.put(20943, 345);
 | 
			
		||||
		MOBS1.put(20944, 335);
 | 
			
		||||
		MOBS1.put(21100, 125);
 | 
			
		||||
		MOBS1.put(21101, 155);
 | 
			
		||||
		MOBS1.put(21103, 215);
 | 
			
		||||
		MOBS1.put(21105, 310);
 | 
			
		||||
		MOBS1.put(21107, 600);
 | 
			
		||||
		MOBS1.put(21117, 120);
 | 
			
		||||
		MOBS1.put(21023, 170);
 | 
			
		||||
		MOBS1.put(21024, 175);
 | 
			
		||||
		MOBS1.put(21025, 185);
 | 
			
		||||
		MOBS1.put(21026, 200);
 | 
			
		||||
		MOBS1.put(21034, 195);
 | 
			
		||||
		MOBS1.put(21125, 12);
 | 
			
		||||
		MOBS1.put(21263, 650);
 | 
			
		||||
		MOBS1.put(21520, 880);
 | 
			
		||||
		MOBS1.put(21526, 970);
 | 
			
		||||
		MOBS1.put(21536, 985);
 | 
			
		||||
		MOBS1.put(21602, 555);
 | 
			
		||||
		MOBS1.put(21603, 750);
 | 
			
		||||
		MOBS1.put(21605, 620);
 | 
			
		||||
		MOBS1.put(21606, 875);
 | 
			
		||||
		MOBS1.put(21611, 590);
 | 
			
		||||
		MOBS1.put(21612, 835);
 | 
			
		||||
		MOBS1.put(21617, 615);
 | 
			
		||||
		MOBS1.put(21618, 875);
 | 
			
		||||
		MOBS1.put(21635, 775);
 | 
			
		||||
		MOBS1.put(21638, 165);
 | 
			
		||||
		MOBS1.put(21639, 185);
 | 
			
		||||
		MOBS1.put(21641, 195);
 | 
			
		||||
		MOBS1.put(21644, 170);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		MOBS1.put(20005, 45);
 | 
			
		||||
		MOBS1.put(20013, 100);
 | 
			
		||||
		MOBS1.put(20016, 100);
 | 
			
		||||
		MOBS1.put(20017, 115);
 | 
			
		||||
		MOBS1.put(20030, 105);
 | 
			
		||||
		MOBS1.put(20132, 70);
 | 
			
		||||
		MOBS1.put(20038, 135);
 | 
			
		||||
		MOBS1.put(20044, 125);
 | 
			
		||||
		MOBS1.put(20046, 100);
 | 
			
		||||
		MOBS1.put(20047, 100);
 | 
			
		||||
		MOBS1.put(20050, 140);
 | 
			
		||||
		MOBS1.put(20058, 140);
 | 
			
		||||
		MOBS1.put(20063, 160);
 | 
			
		||||
		MOBS1.put(20066, 170);
 | 
			
		||||
		MOBS1.put(20070, 180);
 | 
			
		||||
		MOBS1.put(20074, 195);
 | 
			
		||||
		MOBS1.put(20077, 205);
 | 
			
		||||
		MOBS1.put(20078, 205);
 | 
			
		||||
		MOBS1.put(20079, 205);
 | 
			
		||||
		MOBS1.put(20080, 220);
 | 
			
		||||
		MOBS1.put(20081, 370);
 | 
			
		||||
		MOBS1.put(20083, 245);
 | 
			
		||||
		MOBS1.put(20084, 255);
 | 
			
		||||
		MOBS1.put(20085, 265);
 | 
			
		||||
		MOBS1.put(20087, 565);
 | 
			
		||||
		MOBS1.put(20088, 605);
 | 
			
		||||
		MOBS1.put(20089, 250);
 | 
			
		||||
		MOBS1.put(20100, 85);
 | 
			
		||||
		MOBS1.put(20103, 110);
 | 
			
		||||
		MOBS1.put(20105, 110);
 | 
			
		||||
		MOBS1.put(20115, 190);
 | 
			
		||||
		MOBS1.put(20120, 20);
 | 
			
		||||
		MOBS1.put(20131, 45);
 | 
			
		||||
		MOBS1.put(20135, 360);
 | 
			
		||||
		MOBS1.put(20157, 235);
 | 
			
		||||
		MOBS1.put(20162, 195);
 | 
			
		||||
		MOBS1.put(20176, 280);
 | 
			
		||||
		MOBS1.put(20211, 170);
 | 
			
		||||
		MOBS1.put(20225, 160);
 | 
			
		||||
		MOBS1.put(20227, 180);
 | 
			
		||||
		MOBS1.put(20230, 260);
 | 
			
		||||
		MOBS1.put(20232, 245);
 | 
			
		||||
		MOBS1.put(20234, 290);
 | 
			
		||||
		MOBS1.put(20241, 700);
 | 
			
		||||
		MOBS1.put(20267, 215);
 | 
			
		||||
		MOBS1.put(20268, 295);
 | 
			
		||||
		MOBS1.put(20269, 255);
 | 
			
		||||
		MOBS1.put(20270, 365);
 | 
			
		||||
		MOBS1.put(20271, 295);
 | 
			
		||||
		MOBS1.put(20286, 700);
 | 
			
		||||
		MOBS1.put(20308, 110);
 | 
			
		||||
		MOBS1.put(20312, 45);
 | 
			
		||||
		MOBS1.put(20317, 20);
 | 
			
		||||
		MOBS1.put(20324, 85);
 | 
			
		||||
		MOBS1.put(20333, 100);
 | 
			
		||||
		MOBS1.put(20341, 100);
 | 
			
		||||
		MOBS1.put(20346, 85);
 | 
			
		||||
		MOBS1.put(20349, 850);
 | 
			
		||||
		MOBS1.put(20356, 165);
 | 
			
		||||
		MOBS1.put(20357, 140);
 | 
			
		||||
		MOBS1.put(20363, 70);
 | 
			
		||||
		MOBS1.put(20368, 85);
 | 
			
		||||
		MOBS1.put(20371, 100);
 | 
			
		||||
		MOBS1.put(20386, 85);
 | 
			
		||||
		MOBS1.put(20389, 90);
 | 
			
		||||
		MOBS1.put(20403, 110);
 | 
			
		||||
		MOBS1.put(20404, 95);
 | 
			
		||||
		MOBS1.put(20433, 100);
 | 
			
		||||
		MOBS1.put(20436, 140);
 | 
			
		||||
		MOBS1.put(20448, 45);
 | 
			
		||||
		MOBS1.put(20456, 20);
 | 
			
		||||
		MOBS1.put(20463, 85);
 | 
			
		||||
		MOBS1.put(20470, 45);
 | 
			
		||||
		MOBS1.put(20471, 85);
 | 
			
		||||
		MOBS1.put(20475, 20);
 | 
			
		||||
		MOBS1.put(20478, 110);
 | 
			
		||||
		MOBS1.put(20487, 90);
 | 
			
		||||
		MOBS1.put(20511, 100);
 | 
			
		||||
		MOBS1.put(20525, 20);
 | 
			
		||||
		MOBS1.put(20528, 100);
 | 
			
		||||
		MOBS1.put(20536, 15);
 | 
			
		||||
		MOBS1.put(20537, 15);
 | 
			
		||||
		MOBS1.put(20538, 15);
 | 
			
		||||
		MOBS1.put(20539, 15);
 | 
			
		||||
		MOBS1.put(20544, 15);
 | 
			
		||||
		MOBS1.put(20550, 300);
 | 
			
		||||
		MOBS1.put(20551, 300);
 | 
			
		||||
		MOBS1.put(20552, 650);
 | 
			
		||||
		MOBS1.put(20553, 335);
 | 
			
		||||
		MOBS1.put(20554, 390);
 | 
			
		||||
		MOBS1.put(20555, 350);
 | 
			
		||||
		MOBS1.put(20557, 390);
 | 
			
		||||
		MOBS1.put(20559, 420);
 | 
			
		||||
		MOBS1.put(20560, 440);
 | 
			
		||||
		MOBS1.put(20562, 485);
 | 
			
		||||
		MOBS1.put(20573, 545);
 | 
			
		||||
		MOBS1.put(20575, 645);
 | 
			
		||||
		MOBS1.put(20630, 350);
 | 
			
		||||
		MOBS1.put(20632, 475);
 | 
			
		||||
		MOBS1.put(20634, 960);
 | 
			
		||||
		MOBS1.put(20636, 495);
 | 
			
		||||
		MOBS1.put(20638, 540);
 | 
			
		||||
		MOBS1.put(20641, 680);
 | 
			
		||||
		MOBS1.put(20643, 660);
 | 
			
		||||
		MOBS1.put(20644, 645);
 | 
			
		||||
		MOBS1.put(20659, 440);
 | 
			
		||||
		MOBS1.put(20661, 575);
 | 
			
		||||
		MOBS1.put(20663, 525);
 | 
			
		||||
		MOBS1.put(20665, 680);
 | 
			
		||||
		MOBS1.put(20667, 730);
 | 
			
		||||
		MOBS1.put(20766, 210);
 | 
			
		||||
		MOBS1.put(20781, 270);
 | 
			
		||||
		MOBS1.put(20783, 140);
 | 
			
		||||
		MOBS1.put(20784, 155);
 | 
			
		||||
		MOBS1.put(20786, 170);
 | 
			
		||||
		MOBS1.put(20788, 325);
 | 
			
		||||
		MOBS1.put(20790, 390);
 | 
			
		||||
		MOBS1.put(20792, 620);
 | 
			
		||||
		MOBS1.put(20794, 635);
 | 
			
		||||
		MOBS1.put(20796, 640);
 | 
			
		||||
		MOBS1.put(20798, 850);
 | 
			
		||||
		MOBS1.put(20800, 740);
 | 
			
		||||
		MOBS1.put(20802, 900);
 | 
			
		||||
		MOBS1.put(20804, 775);
 | 
			
		||||
		MOBS1.put(20806, 805);
 | 
			
		||||
		MOBS1.put(20833, 455);
 | 
			
		||||
		MOBS1.put(20834, 680);
 | 
			
		||||
		MOBS1.put(20836, 785);
 | 
			
		||||
		MOBS1.put(20837, 835);
 | 
			
		||||
		MOBS1.put(20839, 430);
 | 
			
		||||
		MOBS1.put(20841, 460);
 | 
			
		||||
		MOBS1.put(20845, 605);
 | 
			
		||||
		MOBS1.put(20847, 570);
 | 
			
		||||
		MOBS1.put(20849, 585);
 | 
			
		||||
		MOBS1.put(20936, 290);
 | 
			
		||||
		MOBS1.put(20937, 315);
 | 
			
		||||
		MOBS1.put(20939, 385);
 | 
			
		||||
		MOBS1.put(20940, 500);
 | 
			
		||||
		MOBS1.put(20941, 460);
 | 
			
		||||
		MOBS1.put(20943, 345);
 | 
			
		||||
		MOBS1.put(20944, 335);
 | 
			
		||||
		MOBS1.put(21100, 125);
 | 
			
		||||
		MOBS1.put(21101, 155);
 | 
			
		||||
		MOBS1.put(21103, 215);
 | 
			
		||||
		MOBS1.put(21105, 310);
 | 
			
		||||
		MOBS1.put(21107, 600);
 | 
			
		||||
		MOBS1.put(21117, 120);
 | 
			
		||||
		MOBS1.put(21023, 170);
 | 
			
		||||
		MOBS1.put(21024, 175);
 | 
			
		||||
		MOBS1.put(21025, 185);
 | 
			
		||||
		MOBS1.put(21026, 200);
 | 
			
		||||
		MOBS1.put(21034, 195);
 | 
			
		||||
		MOBS1.put(21125, 12);
 | 
			
		||||
		MOBS1.put(21263, 650);
 | 
			
		||||
		MOBS1.put(21520, 880);
 | 
			
		||||
		MOBS1.put(21526, 970);
 | 
			
		||||
		MOBS1.put(21536, 985);
 | 
			
		||||
		MOBS1.put(21602, 555);
 | 
			
		||||
		MOBS1.put(21603, 750);
 | 
			
		||||
		MOBS1.put(21605, 620);
 | 
			
		||||
		MOBS1.put(21606, 875);
 | 
			
		||||
		MOBS1.put(21611, 590);
 | 
			
		||||
		MOBS1.put(21612, 835);
 | 
			
		||||
		MOBS1.put(21617, 615);
 | 
			
		||||
		MOBS1.put(21618, 875);
 | 
			
		||||
		MOBS1.put(21635, 775);
 | 
			
		||||
		MOBS1.put(21638, 165);
 | 
			
		||||
		MOBS1.put(21639, 185);
 | 
			
		||||
		MOBS1.put(21641, 195);
 | 
			
		||||
		MOBS1.put(21644, 170);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> MOBS2 = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		MOBS2.put(20579, 420);
 | 
			
		||||
		MOBS2.put(20639, 280);
 | 
			
		||||
		MOBS2.put(20646, 145);
 | 
			
		||||
		MOBS2.put(20648, 120);
 | 
			
		||||
		MOBS2.put(20650, 460);
 | 
			
		||||
		MOBS2.put(20651, 260);
 | 
			
		||||
		MOBS2.put(20652, 335);
 | 
			
		||||
		MOBS2.put(20657, 630);
 | 
			
		||||
		MOBS2.put(20658, 570);
 | 
			
		||||
		MOBS2.put(20808, 50);
 | 
			
		||||
		MOBS2.put(20809, 865);
 | 
			
		||||
		MOBS2.put(20832, 700);
 | 
			
		||||
		MOBS2.put(20979, 980);
 | 
			
		||||
		MOBS2.put(20991, 665);
 | 
			
		||||
		MOBS2.put(20994, 590);
 | 
			
		||||
		MOBS2.put(21261, 170);
 | 
			
		||||
		MOBS2.put(21263, 795);
 | 
			
		||||
		MOBS2.put(21508, 100);
 | 
			
		||||
		MOBS2.put(21510, 280);
 | 
			
		||||
		MOBS2.put(21511, 995);
 | 
			
		||||
		MOBS2.put(21512, 995);
 | 
			
		||||
		MOBS2.put(21514, 185);
 | 
			
		||||
		MOBS2.put(21516, 495);
 | 
			
		||||
		MOBS2.put(21517, 495);
 | 
			
		||||
		MOBS2.put(21518, 255);
 | 
			
		||||
		MOBS2.put(21636, 950);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		MOBS2.put(20579, 420);
 | 
			
		||||
		MOBS2.put(20639, 280);
 | 
			
		||||
		MOBS2.put(20646, 145);
 | 
			
		||||
		MOBS2.put(20648, 120);
 | 
			
		||||
		MOBS2.put(20650, 460);
 | 
			
		||||
		MOBS2.put(20651, 260);
 | 
			
		||||
		MOBS2.put(20652, 335);
 | 
			
		||||
		MOBS2.put(20657, 630);
 | 
			
		||||
		MOBS2.put(20658, 570);
 | 
			
		||||
		MOBS2.put(20808, 50);
 | 
			
		||||
		MOBS2.put(20809, 865);
 | 
			
		||||
		MOBS2.put(20832, 700);
 | 
			
		||||
		MOBS2.put(20979, 980);
 | 
			
		||||
		MOBS2.put(20991, 665);
 | 
			
		||||
		MOBS2.put(20994, 590);
 | 
			
		||||
		MOBS2.put(21261, 170);
 | 
			
		||||
		MOBS2.put(21263, 795);
 | 
			
		||||
		MOBS2.put(21508, 100);
 | 
			
		||||
		MOBS2.put(21510, 280);
 | 
			
		||||
		MOBS2.put(21511, 995);
 | 
			
		||||
		MOBS2.put(21512, 995);
 | 
			
		||||
		MOBS2.put(21514, 185);
 | 
			
		||||
		MOBS2.put(21516, 495);
 | 
			
		||||
		MOBS2.put(21517, 495);
 | 
			
		||||
		MOBS2.put(21518, 255);
 | 
			
		||||
		MOBS2.put(21636, 950);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> MOBS3 = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		MOBS3.put(20655, 110);
 | 
			
		||||
		MOBS3.put(20656, 150);
 | 
			
		||||
		MOBS3.put(20772, 105);
 | 
			
		||||
		MOBS3.put(20810, 50);
 | 
			
		||||
		MOBS3.put(20812, 490);
 | 
			
		||||
		MOBS3.put(20814, 775);
 | 
			
		||||
		MOBS3.put(20816, 875);
 | 
			
		||||
		MOBS3.put(20819, 280);
 | 
			
		||||
		MOBS3.put(20955, 670);
 | 
			
		||||
		MOBS3.put(20978, 555);
 | 
			
		||||
		MOBS3.put(21058, 355);
 | 
			
		||||
		MOBS3.put(21060, 45);
 | 
			
		||||
		MOBS3.put(21075, 110);
 | 
			
		||||
		MOBS3.put(21078, 610);
 | 
			
		||||
		MOBS3.put(21081, 955);
 | 
			
		||||
		MOBS3.put(21264, 920);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		MOBS3.put(20655, 110);
 | 
			
		||||
		MOBS3.put(20656, 150);
 | 
			
		||||
		MOBS3.put(20772, 105);
 | 
			
		||||
		MOBS3.put(20810, 50);
 | 
			
		||||
		MOBS3.put(20812, 490);
 | 
			
		||||
		MOBS3.put(20814, 775);
 | 
			
		||||
		MOBS3.put(20816, 875);
 | 
			
		||||
		MOBS3.put(20819, 280);
 | 
			
		||||
		MOBS3.put(20955, 670);
 | 
			
		||||
		MOBS3.put(20978, 555);
 | 
			
		||||
		MOBS3.put(21058, 355);
 | 
			
		||||
		MOBS3.put(21060, 45);
 | 
			
		||||
		MOBS3.put(21075, 110);
 | 
			
		||||
		MOBS3.put(21078, 610);
 | 
			
		||||
		MOBS3.put(21081, 955);
 | 
			
		||||
		MOBS3.put(21264, 920);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> MOBS4 = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		MOBS4.put(20815, 205);
 | 
			
		||||
		MOBS4.put(20822, 100);
 | 
			
		||||
		MOBS4.put(20824, 665);
 | 
			
		||||
		MOBS4.put(20825, 620);
 | 
			
		||||
		MOBS4.put(20983, 205);
 | 
			
		||||
		MOBS4.put(21314, 145);
 | 
			
		||||
		MOBS4.put(21316, 235);
 | 
			
		||||
		MOBS4.put(21318, 280);
 | 
			
		||||
		MOBS4.put(21320, 355);
 | 
			
		||||
		MOBS4.put(21322, 430);
 | 
			
		||||
		MOBS4.put(21376, 280);
 | 
			
		||||
		MOBS4.put(21378, 375);
 | 
			
		||||
		MOBS4.put(21380, 375);
 | 
			
		||||
		MOBS4.put(21387, 640);
 | 
			
		||||
		MOBS4.put(21393, 935);
 | 
			
		||||
		MOBS4.put(21395, 855);
 | 
			
		||||
		MOBS4.put(21652, 375);
 | 
			
		||||
		MOBS4.put(21655, 640);
 | 
			
		||||
		MOBS4.put(21657, 935);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		MOBS4.put(20815, 205);
 | 
			
		||||
		MOBS4.put(20822, 100);
 | 
			
		||||
		MOBS4.put(20824, 665);
 | 
			
		||||
		MOBS4.put(20825, 620);
 | 
			
		||||
		MOBS4.put(20983, 205);
 | 
			
		||||
		MOBS4.put(21314, 145);
 | 
			
		||||
		MOBS4.put(21316, 235);
 | 
			
		||||
		MOBS4.put(21318, 280);
 | 
			
		||||
		MOBS4.put(21320, 355);
 | 
			
		||||
		MOBS4.put(21322, 430);
 | 
			
		||||
		MOBS4.put(21376, 280);
 | 
			
		||||
		MOBS4.put(21378, 375);
 | 
			
		||||
		MOBS4.put(21380, 375);
 | 
			
		||||
		MOBS4.put(21387, 640);
 | 
			
		||||
		MOBS4.put(21393, 935);
 | 
			
		||||
		MOBS4.put(21395, 855);
 | 
			
		||||
		MOBS4.put(21652, 375);
 | 
			
		||||
		MOBS4.put(21655, 640);
 | 
			
		||||
		MOBS4.put(21657, 935);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> MOBS5 = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		MOBS5.put(20828, 935);
 | 
			
		||||
		MOBS5.put(21061, 530);
 | 
			
		||||
		MOBS5.put(21069, 825);
 | 
			
		||||
		MOBS5.put(21382, 125);
 | 
			
		||||
		MOBS5.put(21384, 400);
 | 
			
		||||
		MOBS5.put(21390, 750);
 | 
			
		||||
		MOBS5.put(21654, 400);
 | 
			
		||||
		MOBS5.put(21656, 750);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		MOBS5.put(20828, 935);
 | 
			
		||||
		MOBS5.put(21061, 530);
 | 
			
		||||
		MOBS5.put(21069, 825);
 | 
			
		||||
		MOBS5.put(21382, 125);
 | 
			
		||||
		MOBS5.put(21384, 400);
 | 
			
		||||
		MOBS5.put(21390, 750);
 | 
			
		||||
		MOBS5.put(21654, 400);
 | 
			
		||||
		MOBS5.put(21656, 750);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, int[]> MOBSspecial = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		MOBSspecial.put(20829, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			115,
 | 
			
		||||
			6
 | 
			
		||||
		});
 | 
			
		||||
		MOBSspecial.put(20859, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			890,
 | 
			
		||||
			8
 | 
			
		||||
		});
 | 
			
		||||
		MOBSspecial.put(21066, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			5,
 | 
			
		||||
			5
 | 
			
		||||
		});
 | 
			
		||||
		MOBSspecial.put(21068, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			565,
 | 
			
		||||
			11
 | 
			
		||||
		});
 | 
			
		||||
		MOBSspecial.put(21071, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			400,
 | 
			
		||||
			12
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q426_QuestForFishingShot()
 | 
			
		||||
	{
 | 
			
		||||
		super(426, qn, "Quest for Fishing Shot");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(SWEET_FLUID);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31562, 31563, 31564, 31565, 31566, 31567, 31568, 31569, 31570, 31571, 31572, 31573, 31574, 31575, 31576, 31577, 31578, 31579, 31696, 31697, 31989, 32007);
 | 
			
		||||
		addTalkId(31562, 31563, 31564, 31565, 31566, 31567, 31568, 31569, 31570, 31571, 31572, 31573, 31574, 31575, 31576, 31577, 31578, 31579, 31696, 31697, 31989, 32007);
 | 
			
		||||
		
 | 
			
		||||
		for (int mob : MOBS1.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBS2.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBS3.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBS4.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBS5.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBSspecial.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			st = newQuestState(player);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = "01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (st.hasQuestItems(SWEET_FLUID)) ? "05.htm" : "04.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		int npcId = npc.getNpcId();
 | 
			
		||||
		int drop = 0;
 | 
			
		||||
		int chance = 0;
 | 
			
		||||
		
 | 
			
		||||
		if (MOBS1.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS1.get(npcId);
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS2.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS2.get(npcId);
 | 
			
		||||
			drop = 1;
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS3.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS3.get(npcId);
 | 
			
		||||
			drop = 2;
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS4.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS4.get(npcId);
 | 
			
		||||
			drop = 3;
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS5.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS5.get(npcId);
 | 
			
		||||
			drop = 4;
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBSspecial.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBSspecial.get(npcId)[0];
 | 
			
		||||
			drop = MOBSspecial.get(npcId)[1];
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (Rnd.get(1000) <= chance)
 | 
			
		||||
		{
 | 
			
		||||
			drop++;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (drop != 0)
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			st.rewardItems(SWEET_FLUID, drop);
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		MOBSspecial.put(20829, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			115,
 | 
			
		||||
			6
 | 
			
		||||
		});
 | 
			
		||||
		MOBSspecial.put(20859, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			890,
 | 
			
		||||
			8
 | 
			
		||||
		});
 | 
			
		||||
		MOBSspecial.put(21066, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			5,
 | 
			
		||||
			5
 | 
			
		||||
		});
 | 
			
		||||
		MOBSspecial.put(21068, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			565,
 | 
			
		||||
			11
 | 
			
		||||
		});
 | 
			
		||||
		MOBSspecial.put(21071, new int[]
 | 
			
		||||
		{
 | 
			
		||||
			400,
 | 
			
		||||
			12
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q426_QuestForFishingShot()
 | 
			
		||||
	{
 | 
			
		||||
		super(426, qn, "Quest for Fishing Shot");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(SWEET_FLUID);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31562, 31563, 31564, 31565, 31566, 31567, 31568, 31569, 31570, 31571, 31572, 31573, 31574, 31575, 31576, 31577, 31578, 31579, 31696, 31697, 31989, 32007);
 | 
			
		||||
		addTalkId(31562, 31563, 31564, 31565, 31566, 31567, 31568, 31569, 31570, 31571, 31572, 31573, 31574, 31575, 31576, 31577, 31578, 31579, 31696, 31697, 31989, 32007);
 | 
			
		||||
		
 | 
			
		||||
		for (int mob : MOBS1.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBS2.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBS3.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBS4.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBS5.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
		for (int mob : MOBSspecial.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mob);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			st = newQuestState(player);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = "01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (st.hasQuestItems(SWEET_FLUID)) ? "05.htm" : "04.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		int npcId = npc.getNpcId();
 | 
			
		||||
		int drop = 0;
 | 
			
		||||
		int chance = 0;
 | 
			
		||||
		
 | 
			
		||||
		if (MOBS1.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS1.get(npcId);
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS2.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS2.get(npcId);
 | 
			
		||||
			drop = 1;
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS3.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS3.get(npcId);
 | 
			
		||||
			drop = 2;
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS4.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS4.get(npcId);
 | 
			
		||||
			drop = 3;
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS5.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBS5.get(npcId);
 | 
			
		||||
			drop = 4;
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBSspecial.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			chance = MOBSspecial.get(npcId)[0];
 | 
			
		||||
			drop = MOBSspecial.get(npcId)[1];
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (Rnd.get(1000) <= chance)
 | 
			
		||||
		{
 | 
			
		||||
			drop++;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (drop != 0)
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_ITEMGET);
 | 
			
		||||
			st.rewardItems(SWEET_FLUID, drop);
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,272 +1,273 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q603_DaimonTheWhiteEyed_Part1;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q603_DaimonTheWhiteEyed_Part1 extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q603_DaimonTheWhiteEyed_Part1";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int EVIL_SPIRIT_BEADS = 7190;
 | 
			
		||||
	private static final int BROKEN_CRYSTAL = 7191;
 | 
			
		||||
	private static final int UNFINISHED_SUMMON_CRYSTAL = 7192;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int EYE_OF_ARGOS = 31683;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_1 = 31548;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_2 = 31549;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_3 = 31550;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_4 = 31551;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_5 = 31552;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int CANYON_BANDERSNATCH_SLAVE = 21297;
 | 
			
		||||
	private static final int BUFFALO_SLAVE = 21299;
 | 
			
		||||
	private static final int GRENDEL_SLAVE = 21304;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q603_DaimonTheWhiteEyed_Part1;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q603_DaimonTheWhiteEyed_Part1 extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q603_DaimonTheWhiteEyed_Part1";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int EVIL_SPIRIT_BEADS = 7190;
 | 
			
		||||
	private static final int BROKEN_CRYSTAL = 7191;
 | 
			
		||||
	private static final int UNFINISHED_SUMMON_CRYSTAL = 7192;
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int EYE_OF_ARGOS = 31683;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_1 = 31548;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_2 = 31549;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_3 = 31550;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_4 = 31551;
 | 
			
		||||
	private static final int MYSTERIOUS_TABLET_5 = 31552;
 | 
			
		||||
	
 | 
			
		||||
	// Monsters
 | 
			
		||||
	private static final int CANYON_BANDERSNATCH_SLAVE = 21297;
 | 
			
		||||
	private static final int BUFFALO_SLAVE = 21299;
 | 
			
		||||
	private static final int GRENDEL_SLAVE = 21304;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(CANYON_BANDERSNATCH_SLAVE, 500000);
 | 
			
		||||
		CHANCES.put(BUFFALO_SLAVE, 519000);
 | 
			
		||||
		CHANCES.put(GRENDEL_SLAVE, 673000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q603_DaimonTheWhiteEyed_Part1()
 | 
			
		||||
	{
 | 
			
		||||
		super(603, qn, "Daimon the White-Eyed - Part 1");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(EVIL_SPIRIT_BEADS, BROKEN_CRYSTAL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(EYE_OF_ARGOS);
 | 
			
		||||
		addTalkId(EYE_OF_ARGOS, MYSTERIOUS_TABLET_1, MYSTERIOUS_TABLET_2, MYSTERIOUS_TABLET_3, MYSTERIOUS_TABLET_4, MYSTERIOUS_TABLET_5);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(BUFFALO_SLAVE, GRENDEL_SLAVE, CANYON_BANDERSNATCH_SLAVE);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// Eye of Argos
 | 
			
		||||
		if (event.equals("31683-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31683-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BROKEN_CRYSTAL) > 4)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "7");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(BROKEN_CRYSTAL, -1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31683-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31683-10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(EVIL_SPIRIT_BEADS) > 199)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(EVIL_SPIRIT_BEADS, -1);
 | 
			
		||||
				st.giveItems(UNFINISHED_SUMMON_CRYSTAL, 1);
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "7");
 | 
			
		||||
				htmltext = "31683-11.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Mysterious tablets
 | 
			
		||||
		else if (event.equals("31548-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31549-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "3");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31550-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "4");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31551-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "5");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31552-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "6");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 73) ? "31683-02.htm" : "31683-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case EYE_OF_ARGOS:
 | 
			
		||||
						if (cond < 6)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31683-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 6)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31683-05.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31683-08.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 8)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31683-09.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_1:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31548-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31548-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_2:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31549-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31549-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_3:
 | 
			
		||||
						if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31550-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31550-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_4:
 | 
			
		||||
						if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31551-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31551-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_5:
 | 
			
		||||
						if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31552-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31552-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMember(player, npc, "7");
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(EVIL_SPIRIT_BEADS, 1, 200, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "8");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(CANYON_BANDERSNATCH_SLAVE, 500000);
 | 
			
		||||
		CHANCES.put(BUFFALO_SLAVE, 519000);
 | 
			
		||||
		CHANCES.put(GRENDEL_SLAVE, 673000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q603_DaimonTheWhiteEyed_Part1()
 | 
			
		||||
	{
 | 
			
		||||
		super(603, qn, "Daimon the White-Eyed - Part 1");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(EVIL_SPIRIT_BEADS, BROKEN_CRYSTAL);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(EYE_OF_ARGOS);
 | 
			
		||||
		addTalkId(EYE_OF_ARGOS, MYSTERIOUS_TABLET_1, MYSTERIOUS_TABLET_2, MYSTERIOUS_TABLET_3, MYSTERIOUS_TABLET_4, MYSTERIOUS_TABLET_5);
 | 
			
		||||
		
 | 
			
		||||
		addKillId(BUFFALO_SLAVE, GRENDEL_SLAVE, CANYON_BANDERSNATCH_SLAVE);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// Eye of Argos
 | 
			
		||||
		if (event.equals("31683-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31683-06.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BROKEN_CRYSTAL) > 4)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "7");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(BROKEN_CRYSTAL, -1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31683-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31683-10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(EVIL_SPIRIT_BEADS) > 199)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(EVIL_SPIRIT_BEADS, -1);
 | 
			
		||||
				st.giveItems(UNFINISHED_SUMMON_CRYSTAL, 1);
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "7");
 | 
			
		||||
				htmltext = "31683-11.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Mysterious tablets
 | 
			
		||||
		else if (event.equals("31548-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31549-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "3");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31550-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "4");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31551-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "5");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31552-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "6");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(BROKEN_CRYSTAL, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 73) ? "31683-02.htm" : "31683-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case EYE_OF_ARGOS:
 | 
			
		||||
						if (cond < 6)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31683-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 6)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31683-05.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 7)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31683-08.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 8)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31683-09.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_1:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31548-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31548-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_2:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31549-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31549-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_3:
 | 
			
		||||
						if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31550-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31550-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_4:
 | 
			
		||||
						if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31551-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31551-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case MYSTERIOUS_TABLET_5:
 | 
			
		||||
						if (cond == 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31552-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 5)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31552-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMember(player, npc, "7");
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(EVIL_SPIRIT_BEADS, 1, 200, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "8");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,434 +1,436 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q605_AllianceWithKetraOrcs;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This quest supports both Q605 && Q606 onKill sections.
 | 
			
		||||
 */
 | 
			
		||||
public class Q605_AllianceWithKetraOrcs extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q605_AllianceWithKetraOrcs";
 | 
			
		||||
	private static final String qn2 = "Q606_WarWithVarkaSilenos";
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q605_AllianceWithKetraOrcs;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This quest supports both Q605 && Q606 onKill sections.
 | 
			
		||||
 */
 | 
			
		||||
public class Q605_AllianceWithKetraOrcs extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q605_AllianceWithKetraOrcs";
 | 
			
		||||
	private static final String qn2 = "Q606_WarWithVarkaSilenos";
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21350, 500000);
 | 
			
		||||
		CHANCES.put(21351, 500000);
 | 
			
		||||
		CHANCES.put(21353, 509000);
 | 
			
		||||
		CHANCES.put(21354, 521000);
 | 
			
		||||
		CHANCES.put(21355, 519000);
 | 
			
		||||
		CHANCES.put(21357, 500000);
 | 
			
		||||
		CHANCES.put(21358, 500000);
 | 
			
		||||
		CHANCES.put(21360, 509000);
 | 
			
		||||
		CHANCES.put(21361, 518000);
 | 
			
		||||
		CHANCES.put(21362, 518000);
 | 
			
		||||
		CHANCES.put(21364, 527000);
 | 
			
		||||
		CHANCES.put(21365, 500000);
 | 
			
		||||
		CHANCES.put(21366, 500000);
 | 
			
		||||
		CHANCES.put(21368, 508000);
 | 
			
		||||
		CHANCES.put(21369, 628000);
 | 
			
		||||
		CHANCES.put(21370, 604000);
 | 
			
		||||
		CHANCES.put(21371, 627000);
 | 
			
		||||
		CHANCES.put(21372, 604000);
 | 
			
		||||
		CHANCES.put(21373, 649000);
 | 
			
		||||
		CHANCES.put(21374, 626000);
 | 
			
		||||
		CHANCES.put(21375, 626000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21350, 500000);
 | 
			
		||||
		CHANCES.put(21351, 500000);
 | 
			
		||||
		CHANCES.put(21353, 509000);
 | 
			
		||||
		CHANCES.put(21354, 521000);
 | 
			
		||||
		CHANCES.put(21355, 519000);
 | 
			
		||||
		CHANCES.put(21357, 500000);
 | 
			
		||||
		CHANCES.put(21358, 500000);
 | 
			
		||||
		CHANCES.put(21360, 509000);
 | 
			
		||||
		CHANCES.put(21361, 518000);
 | 
			
		||||
		CHANCES.put(21362, 518000);
 | 
			
		||||
		CHANCES.put(21364, 527000);
 | 
			
		||||
		CHANCES.put(21365, 500000);
 | 
			
		||||
		CHANCES.put(21366, 500000);
 | 
			
		||||
		CHANCES.put(21368, 508000);
 | 
			
		||||
		CHANCES.put(21369, 628000);
 | 
			
		||||
		CHANCES.put(21370, 604000);
 | 
			
		||||
		CHANCES.put(21371, 627000);
 | 
			
		||||
		CHANCES.put(21372, 604000);
 | 
			
		||||
		CHANCES.put(21373, 649000);
 | 
			
		||||
		CHANCES.put(21374, 626000);
 | 
			
		||||
		CHANCES.put(21375, 626000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES_MANE = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES_MANE.put(21350, 500000);
 | 
			
		||||
		CHANCES_MANE.put(21353, 510000);
 | 
			
		||||
		CHANCES_MANE.put(21354, 522000);
 | 
			
		||||
		CHANCES_MANE.put(21355, 519000);
 | 
			
		||||
		CHANCES_MANE.put(21357, 529000);
 | 
			
		||||
		CHANCES_MANE.put(21358, 529000);
 | 
			
		||||
		CHANCES_MANE.put(21360, 539000);
 | 
			
		||||
		CHANCES_MANE.put(21362, 548000);
 | 
			
		||||
		CHANCES_MANE.put(21364, 558000);
 | 
			
		||||
		CHANCES_MANE.put(21365, 568000);
 | 
			
		||||
		CHANCES_MANE.put(21366, 568000);
 | 
			
		||||
		CHANCES_MANE.put(21368, 568000);
 | 
			
		||||
		CHANCES_MANE.put(21369, 664000);
 | 
			
		||||
		CHANCES_MANE.put(21371, 713000);
 | 
			
		||||
		CHANCES_MANE.put(21373, 738000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Quest Items
 | 
			
		||||
	private static final int VARKA_BADGE_SOLDIER = 7216;
 | 
			
		||||
	private static final int VARKA_BADGE_OFFICER = 7217;
 | 
			
		||||
	private static final int VARKA_BADGE_CAPTAIN = 7218;
 | 
			
		||||
	
 | 
			
		||||
	private static final int KETRA_ALLIANCE_1 = 7211;
 | 
			
		||||
	private static final int KETRA_ALLIANCE_2 = 7212;
 | 
			
		||||
	private static final int KETRA_ALLIANCE_3 = 7213;
 | 
			
		||||
	private static final int KETRA_ALLIANCE_4 = 7214;
 | 
			
		||||
	private static final int KETRA_ALLIANCE_5 = 7215;
 | 
			
		||||
	
 | 
			
		||||
	private static final int TOTEM_OF_VALOR = 7219;
 | 
			
		||||
	private static final int TOTEM_OF_WISDOM = 7220;
 | 
			
		||||
	
 | 
			
		||||
	private static final int VARKA_MANE = 7233;
 | 
			
		||||
	
 | 
			
		||||
	public Q605_AllianceWithKetraOrcs()
 | 
			
		||||
	{
 | 
			
		||||
		super(605, qn, "Alliance with Ketra Orcs");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(VARKA_BADGE_SOLDIER, VARKA_BADGE_OFFICER, VARKA_BADGE_CAPTAIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31371); // Wahkan
 | 
			
		||||
		addTalkId(31371);
 | 
			
		||||
		
 | 
			
		||||
		for (int mobs : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mobs);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31371-03a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (player.isAlliedWithVarka())
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-02a.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.setState(State.STARTED);
 | 
			
		||||
				st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
				for (int i = KETRA_ALLIANCE_1; i <= KETRA_ALLIANCE_5; i++)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.hasQuestItems(i))
 | 
			
		||||
					{
 | 
			
		||||
						st.set("cond", String.valueOf(i - 7209));
 | 
			
		||||
						player.setAllianceWithVarkaKetra(i - 7210);
 | 
			
		||||
						return "31371-0" + (i - 7207) + ".htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 1
 | 
			
		||||
		else if (event.equals("31371-10-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= 100)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.giveItems(KETRA_ALLIANCE_1, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-03b.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 2
 | 
			
		||||
		else if (event.equals("31371-10-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= 200) && (st.getQuestItemsCount(VARKA_BADGE_OFFICER) >= 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(KETRA_ALLIANCE_1, -1);
 | 
			
		||||
				st.giveItems(KETRA_ALLIANCE_2, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(2);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-12.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 3
 | 
			
		||||
		else if (event.equals("31371-10-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= 300) && (st.getQuestItemsCount(VARKA_BADGE_OFFICER) >= 200) && (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) >= 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "4");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_CAPTAIN, -1);
 | 
			
		||||
				st.takeItems(KETRA_ALLIANCE_2, -1);
 | 
			
		||||
				st.giveItems(KETRA_ALLIANCE_3, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(3);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-15.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 4
 | 
			
		||||
		else if (event.equals("31371-10-4.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= 300) && (st.getQuestItemsCount(VARKA_BADGE_OFFICER) >= 300) && (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) >= 200) && (st.getQuestItemsCount(TOTEM_OF_VALOR) >= 1))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "5");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_CAPTAIN, -1);
 | 
			
		||||
				st.takeItems(TOTEM_OF_VALOR, -1);
 | 
			
		||||
				st.takeItems(KETRA_ALLIANCE_3, -1);
 | 
			
		||||
				st.giveItems(KETRA_ALLIANCE_4, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(4);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-21.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Leave quest
 | 
			
		||||
		else if (event.equals("31371-20.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_1, -1);
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_2, -1);
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_3, -1);
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_4, -1);
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_5, -1);
 | 
			
		||||
			st.takeItems(TOTEM_OF_VALOR, -1);
 | 
			
		||||
			st.takeItems(TOTEM_OF_WISDOM, -1);
 | 
			
		||||
			player.setAllianceWithVarkaKetra(0);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				if (player.getLevel() >= 74)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31371-01.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31371-02b.htm";
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
					player.setAllianceWithVarkaKetra(0);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 100)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-03b.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-09.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 200) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-12.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-13.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 300) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < 200) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-15.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-16.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 300) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < 300) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < 200) || !st.hasQuestItems(TOTEM_OF_VALOR))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-21.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-22.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 400) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < 400) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < 200) || !st.hasQuestItems(TOTEM_OF_WISDOM))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-17.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-10-5.htm";
 | 
			
		||||
						st.set("cond", "6");
 | 
			
		||||
						st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						st.takeItems(VARKA_BADGE_SOLDIER, 400);
 | 
			
		||||
						st.takeItems(VARKA_BADGE_OFFICER, 400);
 | 
			
		||||
						st.takeItems(VARKA_BADGE_CAPTAIN, 200);
 | 
			
		||||
						st.takeItems(TOTEM_OF_WISDOM, -1);
 | 
			
		||||
						st.takeItems(KETRA_ALLIANCE_4, -1);
 | 
			
		||||
						st.giveItems(KETRA_ALLIANCE_5, 1);
 | 
			
		||||
						player.setAllianceWithVarkaKetra(5);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 6)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31371-08.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		// Support for Q606.
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn2);
 | 
			
		||||
		if ((st != null) && Rnd.nextBoolean() && CHANCES_MANE.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItems(VARKA_MANE, 1, 0, CHANCES_MANE.get(npcId));
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st = partyMember.getQuestState(qn);
 | 
			
		||||
		
 | 
			
		||||
		int cond = st.getInt("cond");
 | 
			
		||||
		if (cond == 6)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case 21350:
 | 
			
		||||
			case 21351:
 | 
			
		||||
			case 21353:
 | 
			
		||||
			case 21354:
 | 
			
		||||
			case 21355:
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_SOLDIER, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_SOLDIER, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 3) || (cond == 4))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_SOLDIER, 1, 300, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_SOLDIER, 1, 400, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21357:
 | 
			
		||||
			case 21358:
 | 
			
		||||
			case 21360:
 | 
			
		||||
			case 21361:
 | 
			
		||||
			case 21362:
 | 
			
		||||
			case 21364:
 | 
			
		||||
			case 21369:
 | 
			
		||||
			case 21370:
 | 
			
		||||
				if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_OFFICER, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_OFFICER, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_OFFICER, 1, 300, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_OFFICER, 1, 400, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21365:
 | 
			
		||||
			case 21366:
 | 
			
		||||
			case 21368:
 | 
			
		||||
			case 21371:
 | 
			
		||||
			case 21372:
 | 
			
		||||
			case 21373:
 | 
			
		||||
			case 21374:
 | 
			
		||||
			case 21375:
 | 
			
		||||
				if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_CAPTAIN, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 4) || (cond == 5))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_CAPTAIN, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES_MANE.put(21350, 500000);
 | 
			
		||||
		CHANCES_MANE.put(21353, 510000);
 | 
			
		||||
		CHANCES_MANE.put(21354, 522000);
 | 
			
		||||
		CHANCES_MANE.put(21355, 519000);
 | 
			
		||||
		CHANCES_MANE.put(21357, 529000);
 | 
			
		||||
		CHANCES_MANE.put(21358, 529000);
 | 
			
		||||
		CHANCES_MANE.put(21360, 539000);
 | 
			
		||||
		CHANCES_MANE.put(21362, 548000);
 | 
			
		||||
		CHANCES_MANE.put(21364, 558000);
 | 
			
		||||
		CHANCES_MANE.put(21365, 568000);
 | 
			
		||||
		CHANCES_MANE.put(21366, 568000);
 | 
			
		||||
		CHANCES_MANE.put(21368, 568000);
 | 
			
		||||
		CHANCES_MANE.put(21369, 664000);
 | 
			
		||||
		CHANCES_MANE.put(21371, 713000);
 | 
			
		||||
		CHANCES_MANE.put(21373, 738000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Quest Items
 | 
			
		||||
	private static final int VARKA_BADGE_SOLDIER = 7216;
 | 
			
		||||
	private static final int VARKA_BADGE_OFFICER = 7217;
 | 
			
		||||
	private static final int VARKA_BADGE_CAPTAIN = 7218;
 | 
			
		||||
	
 | 
			
		||||
	private static final int KETRA_ALLIANCE_1 = 7211;
 | 
			
		||||
	private static final int KETRA_ALLIANCE_2 = 7212;
 | 
			
		||||
	private static final int KETRA_ALLIANCE_3 = 7213;
 | 
			
		||||
	private static final int KETRA_ALLIANCE_4 = 7214;
 | 
			
		||||
	private static final int KETRA_ALLIANCE_5 = 7215;
 | 
			
		||||
	
 | 
			
		||||
	private static final int TOTEM_OF_VALOR = 7219;
 | 
			
		||||
	private static final int TOTEM_OF_WISDOM = 7220;
 | 
			
		||||
	
 | 
			
		||||
	private static final int VARKA_MANE = 7233;
 | 
			
		||||
	
 | 
			
		||||
	public Q605_AllianceWithKetraOrcs()
 | 
			
		||||
	{
 | 
			
		||||
		super(605, qn, "Alliance with Ketra Orcs");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(VARKA_BADGE_SOLDIER, VARKA_BADGE_OFFICER, VARKA_BADGE_CAPTAIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31371); // Wahkan
 | 
			
		||||
		addTalkId(31371);
 | 
			
		||||
		
 | 
			
		||||
		for (int mobs : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mobs);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31371-03a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (player.isAlliedWithVarka())
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-02a.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.setState(State.STARTED);
 | 
			
		||||
				st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
				for (int i = KETRA_ALLIANCE_1; i <= KETRA_ALLIANCE_5; i++)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.hasQuestItems(i))
 | 
			
		||||
					{
 | 
			
		||||
						st.set("cond", String.valueOf(i - 7209));
 | 
			
		||||
						player.setAllianceWithVarkaKetra(i - 7210);
 | 
			
		||||
						return "31371-0" + (i - 7207) + ".htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 1
 | 
			
		||||
		else if (event.equals("31371-10-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= 100)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.giveItems(KETRA_ALLIANCE_1, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-03b.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 2
 | 
			
		||||
		else if (event.equals("31371-10-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= 200) && (st.getQuestItemsCount(VARKA_BADGE_OFFICER) >= 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(KETRA_ALLIANCE_1, -1);
 | 
			
		||||
				st.giveItems(KETRA_ALLIANCE_2, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(2);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-12.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 3
 | 
			
		||||
		else if (event.equals("31371-10-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= 300) && (st.getQuestItemsCount(VARKA_BADGE_OFFICER) >= 200) && (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) >= 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "4");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_CAPTAIN, -1);
 | 
			
		||||
				st.takeItems(KETRA_ALLIANCE_2, -1);
 | 
			
		||||
				st.giveItems(KETRA_ALLIANCE_3, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(3);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-15.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 4
 | 
			
		||||
		else if (event.equals("31371-10-4.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) >= 300) && (st.getQuestItemsCount(VARKA_BADGE_OFFICER) >= 300) && (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) >= 200) && (st.getQuestItemsCount(TOTEM_OF_VALOR) >= 1))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "5");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(VARKA_BADGE_CAPTAIN, -1);
 | 
			
		||||
				st.takeItems(TOTEM_OF_VALOR, -1);
 | 
			
		||||
				st.takeItems(KETRA_ALLIANCE_3, -1);
 | 
			
		||||
				st.giveItems(KETRA_ALLIANCE_4, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(4);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31371-21.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Leave quest
 | 
			
		||||
		else if (event.equals("31371-20.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_1, -1);
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_2, -1);
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_3, -1);
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_4, -1);
 | 
			
		||||
			st.takeItems(KETRA_ALLIANCE_5, -1);
 | 
			
		||||
			st.takeItems(TOTEM_OF_VALOR, -1);
 | 
			
		||||
			st.takeItems(TOTEM_OF_WISDOM, -1);
 | 
			
		||||
			player.setAllianceWithVarkaKetra(0);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				if (player.getLevel() >= 74)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31371-01.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31371-02b.htm";
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
					player.setAllianceWithVarkaKetra(0);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 100)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-03b.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-09.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 200) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-12.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-13.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 300) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < 200) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-15.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-16.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 300) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < 300) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < 200) || !st.hasQuestItems(TOTEM_OF_VALOR))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-21.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-22.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(VARKA_BADGE_SOLDIER) < 400) || (st.getQuestItemsCount(VARKA_BADGE_OFFICER) < 400) || (st.getQuestItemsCount(VARKA_BADGE_CAPTAIN) < 200) || !st.hasQuestItems(TOTEM_OF_WISDOM))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-17.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31371-10-5.htm";
 | 
			
		||||
						st.set("cond", "6");
 | 
			
		||||
						st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						st.takeItems(VARKA_BADGE_SOLDIER, 400);
 | 
			
		||||
						st.takeItems(VARKA_BADGE_OFFICER, 400);
 | 
			
		||||
						st.takeItems(VARKA_BADGE_CAPTAIN, 200);
 | 
			
		||||
						st.takeItems(TOTEM_OF_WISDOM, -1);
 | 
			
		||||
						st.takeItems(KETRA_ALLIANCE_4, -1);
 | 
			
		||||
						st.giveItems(KETRA_ALLIANCE_5, 1);
 | 
			
		||||
						player.setAllianceWithVarkaKetra(5);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 6)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31371-08.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		// Support for Q606.
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn2);
 | 
			
		||||
		if ((st != null) && Rnd.nextBoolean() && CHANCES_MANE.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItems(VARKA_MANE, 1, 0, CHANCES_MANE.get(npcId));
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st = partyMember.getQuestState(qn);
 | 
			
		||||
		
 | 
			
		||||
		int cond = st.getInt("cond");
 | 
			
		||||
		if (cond == 6)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case 21350:
 | 
			
		||||
			case 21351:
 | 
			
		||||
			case 21353:
 | 
			
		||||
			case 21354:
 | 
			
		||||
			case 21355:
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_SOLDIER, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_SOLDIER, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 3) || (cond == 4))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_SOLDIER, 1, 300, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_SOLDIER, 1, 400, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21357:
 | 
			
		||||
			case 21358:
 | 
			
		||||
			case 21360:
 | 
			
		||||
			case 21361:
 | 
			
		||||
			case 21362:
 | 
			
		||||
			case 21364:
 | 
			
		||||
			case 21369:
 | 
			
		||||
			case 21370:
 | 
			
		||||
				if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_OFFICER, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_OFFICER, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_OFFICER, 1, 300, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_OFFICER, 1, 400, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21365:
 | 
			
		||||
			case 21366:
 | 
			
		||||
			case 21368:
 | 
			
		||||
			case 21371:
 | 
			
		||||
			case 21372:
 | 
			
		||||
			case 21373:
 | 
			
		||||
			case 21374:
 | 
			
		||||
			case 21375:
 | 
			
		||||
				if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_CAPTAIN, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 4) || (cond == 5))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(VARKA_BADGE_CAPTAIN, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,434 +1,436 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q611_AllianceWithVarkaSilenos;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This quest supports both Q611 && Q612 onKill sections.
 | 
			
		||||
 */
 | 
			
		||||
public class Q611_AllianceWithVarkaSilenos extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q611_AllianceWithVarkaSilenos";
 | 
			
		||||
	private static final String qn2 = "Q612_WarWithKetraOrcs";
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q611_AllianceWithVarkaSilenos;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This quest supports both Q611 && Q612 onKill sections.
 | 
			
		||||
 */
 | 
			
		||||
public class Q611_AllianceWithVarkaSilenos extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q611_AllianceWithVarkaSilenos";
 | 
			
		||||
	private static final String qn2 = "Q612_WarWithKetraOrcs";
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21324, 500000);
 | 
			
		||||
		CHANCES.put(21325, 500000);
 | 
			
		||||
		CHANCES.put(21327, 509000);
 | 
			
		||||
		CHANCES.put(21328, 521000);
 | 
			
		||||
		CHANCES.put(21329, 519000);
 | 
			
		||||
		CHANCES.put(21331, 500000);
 | 
			
		||||
		CHANCES.put(21332, 500000);
 | 
			
		||||
		CHANCES.put(21334, 509000);
 | 
			
		||||
		CHANCES.put(21335, 518000);
 | 
			
		||||
		CHANCES.put(21336, 518000);
 | 
			
		||||
		CHANCES.put(21338, 527000);
 | 
			
		||||
		CHANCES.put(21339, 500000);
 | 
			
		||||
		CHANCES.put(21340, 500000);
 | 
			
		||||
		CHANCES.put(21342, 508000);
 | 
			
		||||
		CHANCES.put(21343, 628000);
 | 
			
		||||
		CHANCES.put(21344, 604000);
 | 
			
		||||
		CHANCES.put(21345, 627000);
 | 
			
		||||
		CHANCES.put(21346, 604000);
 | 
			
		||||
		CHANCES.put(21347, 649000);
 | 
			
		||||
		CHANCES.put(21348, 626000);
 | 
			
		||||
		CHANCES.put(21349, 626000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21324, 500000);
 | 
			
		||||
		CHANCES.put(21325, 500000);
 | 
			
		||||
		CHANCES.put(21327, 509000);
 | 
			
		||||
		CHANCES.put(21328, 521000);
 | 
			
		||||
		CHANCES.put(21329, 519000);
 | 
			
		||||
		CHANCES.put(21331, 500000);
 | 
			
		||||
		CHANCES.put(21332, 500000);
 | 
			
		||||
		CHANCES.put(21334, 509000);
 | 
			
		||||
		CHANCES.put(21335, 518000);
 | 
			
		||||
		CHANCES.put(21336, 518000);
 | 
			
		||||
		CHANCES.put(21338, 527000);
 | 
			
		||||
		CHANCES.put(21339, 500000);
 | 
			
		||||
		CHANCES.put(21340, 500000);
 | 
			
		||||
		CHANCES.put(21342, 508000);
 | 
			
		||||
		CHANCES.put(21343, 628000);
 | 
			
		||||
		CHANCES.put(21344, 604000);
 | 
			
		||||
		CHANCES.put(21345, 627000);
 | 
			
		||||
		CHANCES.put(21346, 604000);
 | 
			
		||||
		CHANCES.put(21347, 649000);
 | 
			
		||||
		CHANCES.put(21348, 626000);
 | 
			
		||||
		CHANCES.put(21349, 626000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES_MOLAR = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES_MOLAR.put(21324, 500000);
 | 
			
		||||
		CHANCES_MOLAR.put(21327, 510000);
 | 
			
		||||
		CHANCES_MOLAR.put(21328, 522000);
 | 
			
		||||
		CHANCES_MOLAR.put(21329, 519000);
 | 
			
		||||
		CHANCES_MOLAR.put(21331, 529000);
 | 
			
		||||
		CHANCES_MOLAR.put(21332, 529000);
 | 
			
		||||
		CHANCES_MOLAR.put(21334, 539000);
 | 
			
		||||
		CHANCES_MOLAR.put(21336, 548000);
 | 
			
		||||
		CHANCES_MOLAR.put(21338, 558000);
 | 
			
		||||
		CHANCES_MOLAR.put(21339, 568000);
 | 
			
		||||
		CHANCES_MOLAR.put(21340, 568000);
 | 
			
		||||
		CHANCES_MOLAR.put(21342, 578000);
 | 
			
		||||
		CHANCES_MOLAR.put(21343, 664000);
 | 
			
		||||
		CHANCES_MOLAR.put(21345, 713000);
 | 
			
		||||
		CHANCES_MOLAR.put(21347, 738000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Quest Items
 | 
			
		||||
	private static final int KETRA_BADGE_SOLDIER = 7226;
 | 
			
		||||
	private static final int KETRA_BADGE_OFFICER = 7227;
 | 
			
		||||
	private static final int KETRA_BADGE_CAPTAIN = 7228;
 | 
			
		||||
	
 | 
			
		||||
	private static final int VARKA_ALLIANCE_1 = 7221;
 | 
			
		||||
	private static final int VARKA_ALLIANCE_2 = 7222;
 | 
			
		||||
	private static final int VARKA_ALLIANCE_3 = 7223;
 | 
			
		||||
	private static final int VARKA_ALLIANCE_4 = 7224;
 | 
			
		||||
	private static final int VARKA_ALLIANCE_5 = 7225;
 | 
			
		||||
	
 | 
			
		||||
	private static final int VALOR_FEATHER = 7229;
 | 
			
		||||
	private static final int WISDOM_FEATHER = 7230;
 | 
			
		||||
	
 | 
			
		||||
	private static final int MOLAR_OF_KETRA_ORC = 7234;
 | 
			
		||||
	
 | 
			
		||||
	public Q611_AllianceWithVarkaSilenos()
 | 
			
		||||
	{
 | 
			
		||||
		super(611, qn, "Alliance with Varka Silenos");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(KETRA_BADGE_SOLDIER, KETRA_BADGE_OFFICER, KETRA_BADGE_CAPTAIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31378); // Naran Ashanuk
 | 
			
		||||
		addTalkId(31378);
 | 
			
		||||
		
 | 
			
		||||
		for (int mobs : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mobs);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31378-03a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (player.isAlliedWithKetra())
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-02a.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.setState(State.STARTED);
 | 
			
		||||
				st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
				for (int i = VARKA_ALLIANCE_1; i <= VARKA_ALLIANCE_5; i++)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.hasQuestItems(i))
 | 
			
		||||
					{
 | 
			
		||||
						st.set("cond", String.valueOf(i - 7219));
 | 
			
		||||
						player.setAllianceWithVarkaKetra(7220 - i);
 | 
			
		||||
						return "31378-0" + (i - 7217) + ".htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 1
 | 
			
		||||
		else if (event.equals("31378-10-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= 100)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.giveItems(VARKA_ALLIANCE_1, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(-1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-03b.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 2
 | 
			
		||||
		else if (event.equals("31378-10-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= 200) && (st.getQuestItemsCount(KETRA_BADGE_OFFICER) >= 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(VARKA_ALLIANCE_1, -1);
 | 
			
		||||
				st.giveItems(VARKA_ALLIANCE_2, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(-2);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-12.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 3
 | 
			
		||||
		else if (event.equals("31378-10-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= 300) && (st.getQuestItemsCount(KETRA_BADGE_OFFICER) >= 200) && (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) >= 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "4");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_CAPTAIN, -1);
 | 
			
		||||
				st.takeItems(VARKA_ALLIANCE_2, -1);
 | 
			
		||||
				st.giveItems(VARKA_ALLIANCE_3, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(-3);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-15.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 4
 | 
			
		||||
		else if (event.equals("31378-10-4.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= 300) && (st.getQuestItemsCount(KETRA_BADGE_OFFICER) >= 300) && (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) >= 200) && (st.getQuestItemsCount(VALOR_FEATHER) >= 1))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "5");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_CAPTAIN, -1);
 | 
			
		||||
				st.takeItems(VALOR_FEATHER, -1);
 | 
			
		||||
				st.takeItems(VARKA_ALLIANCE_3, -1);
 | 
			
		||||
				st.giveItems(VARKA_ALLIANCE_4, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(-4);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-21.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Leave quest
 | 
			
		||||
		else if (event.equals("31378-20.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_1, -1);
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_2, -1);
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_3, -1);
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_4, -1);
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_5, -1);
 | 
			
		||||
			st.takeItems(VALOR_FEATHER, -1);
 | 
			
		||||
			st.takeItems(WISDOM_FEATHER, -1);
 | 
			
		||||
			player.setAllianceWithVarkaKetra(0);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				if (player.getLevel() >= 74)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31378-01.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31378-02b.htm";
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
					player.setAllianceWithVarkaKetra(0);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 100)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-03b.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-09.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 200) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-12.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-13.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 300) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < 200) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-15.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-16.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 300) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < 300) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < 200) || !st.hasQuestItems(VALOR_FEATHER))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-21.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-22.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 400) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < 400) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < 200) || !st.hasQuestItems(WISDOM_FEATHER))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-17.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-10-5.htm";
 | 
			
		||||
						st.set("cond", "6");
 | 
			
		||||
						st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						st.takeItems(KETRA_BADGE_SOLDIER, 400);
 | 
			
		||||
						st.takeItems(KETRA_BADGE_OFFICER, 400);
 | 
			
		||||
						st.takeItems(KETRA_BADGE_CAPTAIN, 200);
 | 
			
		||||
						st.takeItems(WISDOM_FEATHER, -1);
 | 
			
		||||
						st.takeItems(VARKA_ALLIANCE_4, -1);
 | 
			
		||||
						st.giveItems(VARKA_ALLIANCE_5, 1);
 | 
			
		||||
						player.setAllianceWithVarkaKetra(-5);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 6)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31378-08.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		// Support for Q612.
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn2);
 | 
			
		||||
		if ((st != null) && Rnd.nextBoolean() && CHANCES_MOLAR.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItems(MOLAR_OF_KETRA_ORC, 1, 0, CHANCES_MOLAR.get(npcId));
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st = partyMember.getQuestState(qn);
 | 
			
		||||
		
 | 
			
		||||
		int cond = st.getInt("cond");
 | 
			
		||||
		if (cond == 6)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case 21324:
 | 
			
		||||
			case 21325:
 | 
			
		||||
			case 21327:
 | 
			
		||||
			case 21328:
 | 
			
		||||
			case 21329:
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_SOLDIER, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_SOLDIER, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 3) || (cond == 4))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_SOLDIER, 1, 300, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_SOLDIER, 1, 400, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21331:
 | 
			
		||||
			case 21332:
 | 
			
		||||
			case 21334:
 | 
			
		||||
			case 21335:
 | 
			
		||||
			case 21336:
 | 
			
		||||
			case 21338:
 | 
			
		||||
			case 21343:
 | 
			
		||||
			case 21344:
 | 
			
		||||
				if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_OFFICER, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_OFFICER, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_OFFICER, 1, 300, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_OFFICER, 1, 400, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21339:
 | 
			
		||||
			case 21340:
 | 
			
		||||
			case 21342:
 | 
			
		||||
			case 21345:
 | 
			
		||||
			case 21346:
 | 
			
		||||
			case 21347:
 | 
			
		||||
			case 21348:
 | 
			
		||||
			case 21349:
 | 
			
		||||
				if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_CAPTAIN, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 4) || (cond == 5))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_CAPTAIN, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES_MOLAR.put(21324, 500000);
 | 
			
		||||
		CHANCES_MOLAR.put(21327, 510000);
 | 
			
		||||
		CHANCES_MOLAR.put(21328, 522000);
 | 
			
		||||
		CHANCES_MOLAR.put(21329, 519000);
 | 
			
		||||
		CHANCES_MOLAR.put(21331, 529000);
 | 
			
		||||
		CHANCES_MOLAR.put(21332, 529000);
 | 
			
		||||
		CHANCES_MOLAR.put(21334, 539000);
 | 
			
		||||
		CHANCES_MOLAR.put(21336, 548000);
 | 
			
		||||
		CHANCES_MOLAR.put(21338, 558000);
 | 
			
		||||
		CHANCES_MOLAR.put(21339, 568000);
 | 
			
		||||
		CHANCES_MOLAR.put(21340, 568000);
 | 
			
		||||
		CHANCES_MOLAR.put(21342, 578000);
 | 
			
		||||
		CHANCES_MOLAR.put(21343, 664000);
 | 
			
		||||
		CHANCES_MOLAR.put(21345, 713000);
 | 
			
		||||
		CHANCES_MOLAR.put(21347, 738000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Quest Items
 | 
			
		||||
	private static final int KETRA_BADGE_SOLDIER = 7226;
 | 
			
		||||
	private static final int KETRA_BADGE_OFFICER = 7227;
 | 
			
		||||
	private static final int KETRA_BADGE_CAPTAIN = 7228;
 | 
			
		||||
	
 | 
			
		||||
	private static final int VARKA_ALLIANCE_1 = 7221;
 | 
			
		||||
	private static final int VARKA_ALLIANCE_2 = 7222;
 | 
			
		||||
	private static final int VARKA_ALLIANCE_3 = 7223;
 | 
			
		||||
	private static final int VARKA_ALLIANCE_4 = 7224;
 | 
			
		||||
	private static final int VARKA_ALLIANCE_5 = 7225;
 | 
			
		||||
	
 | 
			
		||||
	private static final int VALOR_FEATHER = 7229;
 | 
			
		||||
	private static final int WISDOM_FEATHER = 7230;
 | 
			
		||||
	
 | 
			
		||||
	private static final int MOLAR_OF_KETRA_ORC = 7234;
 | 
			
		||||
	
 | 
			
		||||
	public Q611_AllianceWithVarkaSilenos()
 | 
			
		||||
	{
 | 
			
		||||
		super(611, qn, "Alliance with Varka Silenos");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(KETRA_BADGE_SOLDIER, KETRA_BADGE_OFFICER, KETRA_BADGE_CAPTAIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(31378); // Naran Ashanuk
 | 
			
		||||
		addTalkId(31378);
 | 
			
		||||
		
 | 
			
		||||
		for (int mobs : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mobs);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31378-03a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (player.isAlliedWithKetra())
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-02a.htm";
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.setState(State.STARTED);
 | 
			
		||||
				st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
				for (int i = VARKA_ALLIANCE_1; i <= VARKA_ALLIANCE_5; i++)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.hasQuestItems(i))
 | 
			
		||||
					{
 | 
			
		||||
						st.set("cond", String.valueOf(i - 7219));
 | 
			
		||||
						player.setAllianceWithVarkaKetra(7220 - i);
 | 
			
		||||
						return "31378-0" + (i - 7217) + ".htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 1
 | 
			
		||||
		else if (event.equals("31378-10-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= 100)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.giveItems(VARKA_ALLIANCE_1, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(-1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-03b.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 2
 | 
			
		||||
		else if (event.equals("31378-10-2.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= 200) && (st.getQuestItemsCount(KETRA_BADGE_OFFICER) >= 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(VARKA_ALLIANCE_1, -1);
 | 
			
		||||
				st.giveItems(VARKA_ALLIANCE_2, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(-2);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-12.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 3
 | 
			
		||||
		else if (event.equals("31378-10-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= 300) && (st.getQuestItemsCount(KETRA_BADGE_OFFICER) >= 200) && (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) >= 100))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "4");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_CAPTAIN, -1);
 | 
			
		||||
				st.takeItems(VARKA_ALLIANCE_2, -1);
 | 
			
		||||
				st.giveItems(VARKA_ALLIANCE_3, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(-3);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-15.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Stage 4
 | 
			
		||||
		else if (event.equals("31378-10-4.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) >= 300) && (st.getQuestItemsCount(KETRA_BADGE_OFFICER) >= 300) && (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) >= 200) && (st.getQuestItemsCount(VALOR_FEATHER) >= 1))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "5");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_SOLDIER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_OFFICER, -1);
 | 
			
		||||
				st.takeItems(KETRA_BADGE_CAPTAIN, -1);
 | 
			
		||||
				st.takeItems(VALOR_FEATHER, -1);
 | 
			
		||||
				st.takeItems(VARKA_ALLIANCE_3, -1);
 | 
			
		||||
				st.giveItems(VARKA_ALLIANCE_4, 1);
 | 
			
		||||
				player.setAllianceWithVarkaKetra(-4);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31378-21.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// Leave quest
 | 
			
		||||
		else if (event.equals("31378-20.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_1, -1);
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_2, -1);
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_3, -1);
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_4, -1);
 | 
			
		||||
			st.takeItems(VARKA_ALLIANCE_5, -1);
 | 
			
		||||
			st.takeItems(VALOR_FEATHER, -1);
 | 
			
		||||
			st.takeItems(WISDOM_FEATHER, -1);
 | 
			
		||||
			player.setAllianceWithVarkaKetra(0);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				if (player.getLevel() >= 74)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31378-01.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31378-02b.htm";
 | 
			
		||||
					st.exitQuest(true);
 | 
			
		||||
					player.setAllianceWithVarkaKetra(0);
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 100)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-03b.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-09.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 200) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-12.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-13.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 300) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < 200) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-15.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-16.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 300) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < 300) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < 200) || !st.hasQuestItems(VALOR_FEATHER))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-21.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-22.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(KETRA_BADGE_SOLDIER) < 400) || (st.getQuestItemsCount(KETRA_BADGE_OFFICER) < 400) || (st.getQuestItemsCount(KETRA_BADGE_CAPTAIN) < 200) || !st.hasQuestItems(WISDOM_FEATHER))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-17.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31378-10-5.htm";
 | 
			
		||||
						st.set("cond", "6");
 | 
			
		||||
						st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
						st.takeItems(KETRA_BADGE_SOLDIER, 400);
 | 
			
		||||
						st.takeItems(KETRA_BADGE_OFFICER, 400);
 | 
			
		||||
						st.takeItems(KETRA_BADGE_CAPTAIN, 200);
 | 
			
		||||
						st.takeItems(WISDOM_FEATHER, -1);
 | 
			
		||||
						st.takeItems(VARKA_ALLIANCE_4, -1);
 | 
			
		||||
						st.giveItems(VARKA_ALLIANCE_5, 1);
 | 
			
		||||
						player.setAllianceWithVarkaKetra(-5);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 6)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31378-08.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		// Support for Q612.
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn2);
 | 
			
		||||
		if ((st != null) && Rnd.nextBoolean() && CHANCES_MOLAR.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			st.dropItems(MOLAR_OF_KETRA_ORC, 1, 0, CHANCES_MOLAR.get(npcId));
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		st = partyMember.getQuestState(qn);
 | 
			
		||||
		
 | 
			
		||||
		int cond = st.getInt("cond");
 | 
			
		||||
		if (cond == 6)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case 21324:
 | 
			
		||||
			case 21325:
 | 
			
		||||
			case 21327:
 | 
			
		||||
			case 21328:
 | 
			
		||||
			case 21329:
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_SOLDIER, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_SOLDIER, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 3) || (cond == 4))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_SOLDIER, 1, 300, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_SOLDIER, 1, 400, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21331:
 | 
			
		||||
			case 21332:
 | 
			
		||||
			case 21334:
 | 
			
		||||
			case 21335:
 | 
			
		||||
			case 21336:
 | 
			
		||||
			case 21338:
 | 
			
		||||
			case 21343:
 | 
			
		||||
			case 21344:
 | 
			
		||||
				if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_OFFICER, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_OFFICER, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 4)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_OFFICER, 1, 300, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 5)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_OFFICER, 1, 400, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21339:
 | 
			
		||||
			case 21340:
 | 
			
		||||
			case 21342:
 | 
			
		||||
			case 21345:
 | 
			
		||||
			case 21346:
 | 
			
		||||
			case 21347:
 | 
			
		||||
			case 21348:
 | 
			
		||||
			case 21349:
 | 
			
		||||
				if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_CAPTAIN, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				else if ((cond == 4) || (cond == 5))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(KETRA_BADGE_CAPTAIN, 1, 200, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,200 +1,201 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q617_GatherTheFlames;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
import com.l2jmobius.gameserver.util.Util;
 | 
			
		||||
 | 
			
		||||
public class Q617_GatherTheFlames extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q617_GatherTheFlames";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int HILDA = 31271;
 | 
			
		||||
	private static final int VULCAN = 31539;
 | 
			
		||||
	private static final int ROONEY = 32049;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int TORCH = 7264;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q617_GatherTheFlames;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.commons.util.Rnd;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
import com.l2jmobius.gameserver.util.Util;
 | 
			
		||||
 | 
			
		||||
public class Q617_GatherTheFlames extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q617_GatherTheFlames";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int HILDA = 31271;
 | 
			
		||||
	private static final int VULCAN = 31539;
 | 
			
		||||
	private static final int ROONEY = 32049;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int TORCH = 7264;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21381, 510000);
 | 
			
		||||
		CHANCES.put(21653, 510000);
 | 
			
		||||
		CHANCES.put(21387, 530000);
 | 
			
		||||
		CHANCES.put(21655, 530000);
 | 
			
		||||
		CHANCES.put(21390, 560000);
 | 
			
		||||
		CHANCES.put(21656, 690000);
 | 
			
		||||
		CHANCES.put(21389, 550000);
 | 
			
		||||
		CHANCES.put(21388, 530000);
 | 
			
		||||
		CHANCES.put(21383, 510000);
 | 
			
		||||
		CHANCES.put(21392, 560000);
 | 
			
		||||
		CHANCES.put(21382, 600000);
 | 
			
		||||
		CHANCES.put(21654, 520000);
 | 
			
		||||
		CHANCES.put(21384, 640000);
 | 
			
		||||
		CHANCES.put(21394, 510000);
 | 
			
		||||
		CHANCES.put(21395, 560000);
 | 
			
		||||
		CHANCES.put(21385, 520000);
 | 
			
		||||
		CHANCES.put(21391, 550000);
 | 
			
		||||
		CHANCES.put(21393, 580000);
 | 
			
		||||
		CHANCES.put(21657, 570000);
 | 
			
		||||
		CHANCES.put(21386, 520000);
 | 
			
		||||
		CHANCES.put(21652, 490000);
 | 
			
		||||
		CHANCES.put(21378, 490000);
 | 
			
		||||
		CHANCES.put(21376, 480000);
 | 
			
		||||
		CHANCES.put(21377, 480000);
 | 
			
		||||
		CHANCES.put(21379, 590000);
 | 
			
		||||
		CHANCES.put(21380, 490000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int REWARD[] =
 | 
			
		||||
	{
 | 
			
		||||
		6881,
 | 
			
		||||
		6883,
 | 
			
		||||
		6885,
 | 
			
		||||
		6887,
 | 
			
		||||
		6891,
 | 
			
		||||
		6893,
 | 
			
		||||
		6895,
 | 
			
		||||
		6897,
 | 
			
		||||
		6899,
 | 
			
		||||
		7580
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	public Q617_GatherTheFlames()
 | 
			
		||||
	{
 | 
			
		||||
		super(617, qn, "Gather the Flames");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(TORCH);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(VULCAN, HILDA);
 | 
			
		||||
		addTalkId(VULCAN, HILDA, ROONEY);
 | 
			
		||||
		
 | 
			
		||||
		for (int mobs : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mobs);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31539-03.htm") || event.equals("31271-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31539-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TORCH) >= 1000)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31539-07.htm";
 | 
			
		||||
				st.takeItems(TORCH, 1000);
 | 
			
		||||
				st.giveItems(REWARD[Rnd.get(REWARD.length)], 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31539-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(TORCH, -1);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (Util.isDigit(event))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TORCH) >= 1200)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "32049-03.htm";
 | 
			
		||||
				st.takeItems(TORCH, 1200);
 | 
			
		||||
				st.giveItems(Integer.valueOf(event), 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "32049-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = npc.getNpcId() + ((player.getLevel() >= 74) ? "-01.htm" : "-02.htm");
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case VULCAN:
 | 
			
		||||
						htmltext = (st.getQuestItemsCount(TORCH) >= 1000) ? "31539-04.htm" : "31539-05.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case HILDA:
 | 
			
		||||
						htmltext = "31271-04.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ROONEY:
 | 
			
		||||
						htmltext = (st.getQuestItemsCount(TORCH) >= 1200) ? "32049-01.htm" : "32049-02.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(TORCH, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21381, 510000);
 | 
			
		||||
		CHANCES.put(21653, 510000);
 | 
			
		||||
		CHANCES.put(21387, 530000);
 | 
			
		||||
		CHANCES.put(21655, 530000);
 | 
			
		||||
		CHANCES.put(21390, 560000);
 | 
			
		||||
		CHANCES.put(21656, 690000);
 | 
			
		||||
		CHANCES.put(21389, 550000);
 | 
			
		||||
		CHANCES.put(21388, 530000);
 | 
			
		||||
		CHANCES.put(21383, 510000);
 | 
			
		||||
		CHANCES.put(21392, 560000);
 | 
			
		||||
		CHANCES.put(21382, 600000);
 | 
			
		||||
		CHANCES.put(21654, 520000);
 | 
			
		||||
		CHANCES.put(21384, 640000);
 | 
			
		||||
		CHANCES.put(21394, 510000);
 | 
			
		||||
		CHANCES.put(21395, 560000);
 | 
			
		||||
		CHANCES.put(21385, 520000);
 | 
			
		||||
		CHANCES.put(21391, 550000);
 | 
			
		||||
		CHANCES.put(21393, 580000);
 | 
			
		||||
		CHANCES.put(21657, 570000);
 | 
			
		||||
		CHANCES.put(21386, 520000);
 | 
			
		||||
		CHANCES.put(21652, 490000);
 | 
			
		||||
		CHANCES.put(21378, 490000);
 | 
			
		||||
		CHANCES.put(21376, 480000);
 | 
			
		||||
		CHANCES.put(21377, 480000);
 | 
			
		||||
		CHANCES.put(21379, 590000);
 | 
			
		||||
		CHANCES.put(21380, 490000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int REWARD[] =
 | 
			
		||||
	{
 | 
			
		||||
		6881,
 | 
			
		||||
		6883,
 | 
			
		||||
		6885,
 | 
			
		||||
		6887,
 | 
			
		||||
		6891,
 | 
			
		||||
		6893,
 | 
			
		||||
		6895,
 | 
			
		||||
		6897,
 | 
			
		||||
		6899,
 | 
			
		||||
		7580
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	public Q617_GatherTheFlames()
 | 
			
		||||
	{
 | 
			
		||||
		super(617, qn, "Gather the Flames");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(TORCH);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(VULCAN, HILDA);
 | 
			
		||||
		addTalkId(VULCAN, HILDA, ROONEY);
 | 
			
		||||
		
 | 
			
		||||
		for (int mobs : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(mobs);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31539-03.htm") || event.equals("31271-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31539-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TORCH) >= 1000)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31539-07.htm";
 | 
			
		||||
				st.takeItems(TORCH, 1000);
 | 
			
		||||
				st.giveItems(REWARD[Rnd.get(REWARD.length)], 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31539-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(TORCH, -1);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (Util.isDigit(event))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TORCH) >= 1200)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "32049-03.htm";
 | 
			
		||||
				st.takeItems(TORCH, 1200);
 | 
			
		||||
				st.giveItems(Integer.valueOf(event), 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "32049-02.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = npc.getNpcId() + ((player.getLevel() >= 74) ? "-01.htm" : "-02.htm");
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case VULCAN:
 | 
			
		||||
						htmltext = (st.getQuestItemsCount(TORCH) >= 1000) ? "31539-04.htm" : "31539-05.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case HILDA:
 | 
			
		||||
						htmltext = "31271-04.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ROONEY:
 | 
			
		||||
						htmltext = (st.getQuestItemsCount(TORCH) >= 1200) ? "32049-01.htm" : "32049-02.htm";
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(TORCH, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,173 +1,174 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q626_ADarkTwilight;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q626_ADarkTwilight extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q626_ADarkTwilight";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int BLOOD_OF_SAINT = 7169;
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int HIERARCH = 31517;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q626_ADarkTwilight;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q626_ADarkTwilight extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q626_ADarkTwilight";
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int BLOOD_OF_SAINT = 7169;
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int HIERARCH = 31517;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21520, 533000);
 | 
			
		||||
		CHANCES.put(21523, 566000);
 | 
			
		||||
		CHANCES.put(21524, 603000);
 | 
			
		||||
		CHANCES.put(21525, 603000);
 | 
			
		||||
		CHANCES.put(21526, 587000);
 | 
			
		||||
		CHANCES.put(21529, 606000);
 | 
			
		||||
		CHANCES.put(21530, 560000);
 | 
			
		||||
		CHANCES.put(21531, 669000);
 | 
			
		||||
		CHANCES.put(21532, 651000);
 | 
			
		||||
		CHANCES.put(21535, 672000);
 | 
			
		||||
		CHANCES.put(21536, 597000);
 | 
			
		||||
		CHANCES.put(21539, 739000);
 | 
			
		||||
		CHANCES.put(21540, 739000);
 | 
			
		||||
		CHANCES.put(21658, 669000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q626_ADarkTwilight()
 | 
			
		||||
	{
 | 
			
		||||
		super(626, qn, "A Dark Twilight");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BLOOD_OF_SAINT);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(HIERARCH);
 | 
			
		||||
		addTalkId(HIERARCH);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31517-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("reward1"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BLOOD_OF_SAINT) == 300)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31517-07.htm";
 | 
			
		||||
				st.takeItems(BLOOD_OF_SAINT, 300);
 | 
			
		||||
				st.rewardExpAndSp(162773, 12500);
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(false);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31517-08.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("reward2"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BLOOD_OF_SAINT) == 300)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31517-07.htm";
 | 
			
		||||
				st.takeItems(BLOOD_OF_SAINT, 300);
 | 
			
		||||
				st.rewardItems(57, 100000);
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(false);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31517-08.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 60) ? "31517-02.htm" : "31517-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31517-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31517-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(BLOOD_OF_SAINT, 1, 300, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21520, 533000);
 | 
			
		||||
		CHANCES.put(21523, 566000);
 | 
			
		||||
		CHANCES.put(21524, 603000);
 | 
			
		||||
		CHANCES.put(21525, 603000);
 | 
			
		||||
		CHANCES.put(21526, 587000);
 | 
			
		||||
		CHANCES.put(21529, 606000);
 | 
			
		||||
		CHANCES.put(21530, 560000);
 | 
			
		||||
		CHANCES.put(21531, 669000);
 | 
			
		||||
		CHANCES.put(21532, 651000);
 | 
			
		||||
		CHANCES.put(21535, 672000);
 | 
			
		||||
		CHANCES.put(21536, 597000);
 | 
			
		||||
		CHANCES.put(21539, 739000);
 | 
			
		||||
		CHANCES.put(21540, 739000);
 | 
			
		||||
		CHANCES.put(21658, 669000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q626_ADarkTwilight()
 | 
			
		||||
	{
 | 
			
		||||
		super(626, qn, "A Dark Twilight");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BLOOD_OF_SAINT);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(HIERARCH);
 | 
			
		||||
		addTalkId(HIERARCH);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31517-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("reward1"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BLOOD_OF_SAINT) == 300)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31517-07.htm";
 | 
			
		||||
				st.takeItems(BLOOD_OF_SAINT, 300);
 | 
			
		||||
				st.rewardExpAndSp(162773, 12500);
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(false);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31517-08.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("reward2"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BLOOD_OF_SAINT) == 300)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31517-07.htm";
 | 
			
		||||
				st.takeItems(BLOOD_OF_SAINT, 300);
 | 
			
		||||
				st.rewardItems(57, 100000);
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(false);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31517-08.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 60) ? "31517-02.htm" : "31517-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31517-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31517-04.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.COMPLETED:
 | 
			
		||||
				htmltext = getAlreadyCompletedMsg();
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(BLOOD_OF_SAINT, 1, 300, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,250 +1,252 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q627_HeartInSearchOfPower;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q627_HeartInSearchOfPower extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q627_HeartInSearchOfPower";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int NECROMANCER = 31518;
 | 
			
		||||
	private static final int ENFEUX = 31519;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int SEAL_OF_LIGHT = 7170;
 | 
			
		||||
	private static final int BEAD_OF_OBEDIENCE = 7171;
 | 
			
		||||
	private static final int GEM_OF_SAINTS = 7172;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q627_HeartInSearchOfPower;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q627_HeartInSearchOfPower extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q627_HeartInSearchOfPower";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int NECROMANCER = 31518;
 | 
			
		||||
	private static final int ENFEUX = 31519;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int SEAL_OF_LIGHT = 7170;
 | 
			
		||||
	private static final int BEAD_OF_OBEDIENCE = 7171;
 | 
			
		||||
	private static final int GEM_OF_SAINTS = 7172;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21520, 550000);
 | 
			
		||||
		CHANCES.put(21523, 584000);
 | 
			
		||||
		CHANCES.put(21524, 621000);
 | 
			
		||||
		CHANCES.put(21525, 621000);
 | 
			
		||||
		CHANCES.put(21526, 606000);
 | 
			
		||||
		CHANCES.put(21529, 625000);
 | 
			
		||||
		CHANCES.put(21530, 578000);
 | 
			
		||||
		CHANCES.put(21531, 690000);
 | 
			
		||||
		CHANCES.put(21532, 671000);
 | 
			
		||||
		CHANCES.put(21535, 693000);
 | 
			
		||||
		CHANCES.put(21536, 615000);
 | 
			
		||||
		CHANCES.put(21539, 762000);
 | 
			
		||||
		CHANCES.put(21540, 762000);
 | 
			
		||||
		CHANCES.put(21658, 690000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21520, 550000);
 | 
			
		||||
		CHANCES.put(21523, 584000);
 | 
			
		||||
		CHANCES.put(21524, 621000);
 | 
			
		||||
		CHANCES.put(21525, 621000);
 | 
			
		||||
		CHANCES.put(21526, 606000);
 | 
			
		||||
		CHANCES.put(21529, 625000);
 | 
			
		||||
		CHANCES.put(21530, 578000);
 | 
			
		||||
		CHANCES.put(21531, 690000);
 | 
			
		||||
		CHANCES.put(21532, 671000);
 | 
			
		||||
		CHANCES.put(21535, 693000);
 | 
			
		||||
		CHANCES.put(21536, 615000);
 | 
			
		||||
		CHANCES.put(21539, 762000);
 | 
			
		||||
		CHANCES.put(21540, 762000);
 | 
			
		||||
		CHANCES.put(21658, 690000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final Map<String, int[]> REWARDS = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		REWARDS.put("adena", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			0,
 | 
			
		||||
			0,
 | 
			
		||||
			100000
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("asofe", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			4043,
 | 
			
		||||
			13,
 | 
			
		||||
			6400
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("thon", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			4044,
 | 
			
		||||
			13,
 | 
			
		||||
			6400
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("enria", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			4042,
 | 
			
		||||
			6,
 | 
			
		||||
			13600
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("mold", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			4041,
 | 
			
		||||
			3,
 | 
			
		||||
			17200
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q627_HeartInSearchOfPower()
 | 
			
		||||
	{
 | 
			
		||||
		super(627, qn, "Heart in Search of Power");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BEAD_OF_OBEDIENCE);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(NECROMANCER);
 | 
			
		||||
		addTalkId(NECROMANCER, ENFEUX);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31518-01.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31518-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BEAD_OF_OBEDIENCE) == 300)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(BEAD_OF_OBEDIENCE, -1);
 | 
			
		||||
				st.giveItems(SEAL_OF_LIGHT, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31518-03a.htm";
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				st.takeItems(BEAD_OF_OBEDIENCE, -1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31519-01.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(SEAL_OF_LIGHT) == 1)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "4");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(SEAL_OF_LIGHT, 1);
 | 
			
		||||
				st.giveItems(GEM_OF_SAINTS, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (REWARDS.containsKey(event))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(GEM_OF_SAINTS) == 1)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31518-07.htm";
 | 
			
		||||
				st.takeItems(GEM_OF_SAINTS, 1);
 | 
			
		||||
				
 | 
			
		||||
				if (REWARDS.get(event)[0] > 0)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(REWARDS.get(event)[0], REWARDS.get(event)[1]);
 | 
			
		||||
				}
 | 
			
		||||
				st.rewardItems(57, REWARDS.get(event)[2]);
 | 
			
		||||
				
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31518-7.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 60) ? "31518-00a.htm" : "31518-00.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case NECROMANCER:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31518-01a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31518-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31518-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31518-05.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ENFEUX:
 | 
			
		||||
						if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31519-00.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31519-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(BEAD_OF_OBEDIENCE, 1, 300, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		REWARDS.put("adena", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			0,
 | 
			
		||||
			0,
 | 
			
		||||
			100000
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("asofe", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			4043,
 | 
			
		||||
			13,
 | 
			
		||||
			6400
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("thon", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			4044,
 | 
			
		||||
			13,
 | 
			
		||||
			6400
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("enria", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			4042,
 | 
			
		||||
			6,
 | 
			
		||||
			13600
 | 
			
		||||
		});
 | 
			
		||||
		REWARDS.put("mold", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			4041,
 | 
			
		||||
			3,
 | 
			
		||||
			17200
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q627_HeartInSearchOfPower()
 | 
			
		||||
	{
 | 
			
		||||
		super(627, qn, "Heart in Search of Power");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(BEAD_OF_OBEDIENCE);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(NECROMANCER);
 | 
			
		||||
		addTalkId(NECROMANCER, ENFEUX);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31518-01.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31518-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(BEAD_OF_OBEDIENCE) == 300)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "3");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(BEAD_OF_OBEDIENCE, -1);
 | 
			
		||||
				st.giveItems(SEAL_OF_LIGHT, 1);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31518-03a.htm";
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				st.takeItems(BEAD_OF_OBEDIENCE, -1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31519-01.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(SEAL_OF_LIGHT) == 1)
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "4");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(SEAL_OF_LIGHT, 1);
 | 
			
		||||
				st.giveItems(GEM_OF_SAINTS, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (REWARDS.containsKey(event))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(GEM_OF_SAINTS) == 1)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31518-07.htm";
 | 
			
		||||
				st.takeItems(GEM_OF_SAINTS, 1);
 | 
			
		||||
				
 | 
			
		||||
				if (REWARDS.get(event)[0] > 0)
 | 
			
		||||
				{
 | 
			
		||||
					st.giveItems(REWARDS.get(event)[0], REWARDS.get(event)[1]);
 | 
			
		||||
				}
 | 
			
		||||
				st.rewardItems(57, REWARDS.get(event)[2]);
 | 
			
		||||
				
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31518-7.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 60) ? "31518-00a.htm" : "31518-00.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case NECROMANCER:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31518-01a.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31518-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31518-04.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31518-05.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case ENFEUX:
 | 
			
		||||
						if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31519-00.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "31519-02.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = checkPlayerCondition(player, npc, "cond", "1");
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(BEAD_OF_OBEDIENCE, 1, 300, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,212 +1,213 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q628_HuntOfTheGoldenRamMercenaryForce;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q628_HuntOfTheGoldenRamMercenaryForce extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q628_HuntOfTheGoldenRamMercenaryForce";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int KAHMAN = 31554;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int SPLINTER_STAKATO_CHITIN = 7248;
 | 
			
		||||
	private static final int NEEDLE_STAKATO_CHITIN = 7249;
 | 
			
		||||
	private static final int GOLDEN_RAM_BADGE_RECRUIT = 7246;
 | 
			
		||||
	private static final int GOLDEN_RAM_BADGE_SOLDIER = 7247;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q628_HuntOfTheGoldenRamMercenaryForce;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q628_HuntOfTheGoldenRamMercenaryForce extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q628_HuntOfTheGoldenRamMercenaryForce";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int KAHMAN = 31554;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int SPLINTER_STAKATO_CHITIN = 7248;
 | 
			
		||||
	private static final int NEEDLE_STAKATO_CHITIN = 7249;
 | 
			
		||||
	private static final int GOLDEN_RAM_BADGE_RECRUIT = 7246;
 | 
			
		||||
	private static final int GOLDEN_RAM_BADGE_SOLDIER = 7247;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21508, 500000);
 | 
			
		||||
		CHANCES.put(21509, 430000);
 | 
			
		||||
		CHANCES.put(21510, 521000);
 | 
			
		||||
		CHANCES.put(21511, 575000);
 | 
			
		||||
		CHANCES.put(21512, 746000);
 | 
			
		||||
		CHANCES.put(21513, 500000);
 | 
			
		||||
		CHANCES.put(21514, 430000);
 | 
			
		||||
		CHANCES.put(21515, 520000);
 | 
			
		||||
		CHANCES.put(21516, 531000);
 | 
			
		||||
		CHANCES.put(21517, 744000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q628_HuntOfTheGoldenRamMercenaryForce()
 | 
			
		||||
	{
 | 
			
		||||
		super(628, qn, "Hunt of the Golden Ram Mercenary Force");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(SPLINTER_STAKATO_CHITIN, NEEDLE_STAKATO_CHITIN, GOLDEN_RAM_BADGE_RECRUIT, GOLDEN_RAM_BADGE_SOLDIER);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(KAHMAN);
 | 
			
		||||
		addTalkId(KAHMAN);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31554-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31554-03a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(SPLINTER_STAKATO_CHITIN) >= 100) && (st.getInt("cond") == 1)) // Giving GOLDEN_RAM_BADGE_RECRUIT Medals
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31554-04.htm";
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(SPLINTER_STAKATO_CHITIN, -1);
 | 
			
		||||
				st.giveItems(GOLDEN_RAM_BADGE_RECRUIT, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31554-07.htm")) // Cancel Quest
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 66) ? "31554-01a.htm" : "31554-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.getQuestItemsCount(SPLINTER_STAKATO_CHITIN) >= 100)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-03.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-03a.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(SPLINTER_STAKATO_CHITIN) >= 100) && (st.getQuestItemsCount(NEEDLE_STAKATO_CHITIN) >= 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-05.htm";
 | 
			
		||||
						st.set("cond", "3");
 | 
			
		||||
						st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
						st.takeItems(SPLINTER_STAKATO_CHITIN, -1);
 | 
			
		||||
						st.takeItems(NEEDLE_STAKATO_CHITIN, -1);
 | 
			
		||||
						st.takeItems(GOLDEN_RAM_BADGE_RECRUIT, 1);
 | 
			
		||||
						st.giveItems(GOLDEN_RAM_BADGE_SOLDIER, 1);
 | 
			
		||||
					}
 | 
			
		||||
					else if (!st.hasQuestItems(SPLINTER_STAKATO_CHITIN) && !st.hasQuestItems(NEEDLE_STAKATO_CHITIN))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-04b.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-04a.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31554-05a.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int cond = st.getInt("cond");
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case 21508:
 | 
			
		||||
			case 21509:
 | 
			
		||||
			case 21510:
 | 
			
		||||
			case 21511:
 | 
			
		||||
			case 21512:
 | 
			
		||||
				if ((cond == 1) || (cond == 2))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(SPLINTER_STAKATO_CHITIN, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21513:
 | 
			
		||||
			case 21514:
 | 
			
		||||
			case 21515:
 | 
			
		||||
			case 21516:
 | 
			
		||||
			case 21517:
 | 
			
		||||
				if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(NEEDLE_STAKATO_CHITIN, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21508, 500000);
 | 
			
		||||
		CHANCES.put(21509, 430000);
 | 
			
		||||
		CHANCES.put(21510, 521000);
 | 
			
		||||
		CHANCES.put(21511, 575000);
 | 
			
		||||
		CHANCES.put(21512, 746000);
 | 
			
		||||
		CHANCES.put(21513, 500000);
 | 
			
		||||
		CHANCES.put(21514, 430000);
 | 
			
		||||
		CHANCES.put(21515, 520000);
 | 
			
		||||
		CHANCES.put(21516, 531000);
 | 
			
		||||
		CHANCES.put(21517, 744000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q628_HuntOfTheGoldenRamMercenaryForce()
 | 
			
		||||
	{
 | 
			
		||||
		super(628, qn, "Hunt of the Golden Ram Mercenary Force");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(SPLINTER_STAKATO_CHITIN, NEEDLE_STAKATO_CHITIN, GOLDEN_RAM_BADGE_RECRUIT, GOLDEN_RAM_BADGE_SOLDIER);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(KAHMAN);
 | 
			
		||||
		addTalkId(KAHMAN);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31554-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31554-03a.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if ((st.getQuestItemsCount(SPLINTER_STAKATO_CHITIN) >= 100) && (st.getInt("cond") == 1)) // Giving GOLDEN_RAM_BADGE_RECRUIT Medals
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31554-04.htm";
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
				st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
				st.takeItems(SPLINTER_STAKATO_CHITIN, -1);
 | 
			
		||||
				st.giveItems(GOLDEN_RAM_BADGE_RECRUIT, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31554-07.htm")) // Cancel Quest
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 66) ? "31554-01a.htm" : "31554-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.getQuestItemsCount(SPLINTER_STAKATO_CHITIN) >= 100)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-03.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-03a.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					if ((st.getQuestItemsCount(SPLINTER_STAKATO_CHITIN) >= 100) && (st.getQuestItemsCount(NEEDLE_STAKATO_CHITIN) >= 100))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-05.htm";
 | 
			
		||||
						st.set("cond", "3");
 | 
			
		||||
						st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
						st.takeItems(SPLINTER_STAKATO_CHITIN, -1);
 | 
			
		||||
						st.takeItems(NEEDLE_STAKATO_CHITIN, -1);
 | 
			
		||||
						st.takeItems(GOLDEN_RAM_BADGE_RECRUIT, 1);
 | 
			
		||||
						st.giveItems(GOLDEN_RAM_BADGE_SOLDIER, 1);
 | 
			
		||||
					}
 | 
			
		||||
					else if (!st.hasQuestItems(SPLINTER_STAKATO_CHITIN) && !st.hasQuestItems(NEEDLE_STAKATO_CHITIN))
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-04b.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31554-04a.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 3)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31554-05a.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		final int cond = st.getInt("cond");
 | 
			
		||||
		final int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		switch (npcId)
 | 
			
		||||
		{
 | 
			
		||||
			case 21508:
 | 
			
		||||
			case 21509:
 | 
			
		||||
			case 21510:
 | 
			
		||||
			case 21511:
 | 
			
		||||
			case 21512:
 | 
			
		||||
				if ((cond == 1) || (cond == 2))
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(SPLINTER_STAKATO_CHITIN, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case 21513:
 | 
			
		||||
			case 21514:
 | 
			
		||||
			case 21515:
 | 
			
		||||
			case 21516:
 | 
			
		||||
			case 21517:
 | 
			
		||||
				if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					st.dropItems(NEEDLE_STAKATO_CHITIN, 1, 100, CHANCES.get(npcId));
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,156 +1,157 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q629_CleanUpTheSwampOfScreams;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q629_CleanUpTheSwampOfScreams extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q629_CleanUpTheSwampOfScreams";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int PIERCE = 31553;
 | 
			
		||||
	
 | 
			
		||||
	// ITEMS
 | 
			
		||||
	private static final int TALON_OF_STAKATO = 7250;
 | 
			
		||||
	private static final int GOLDEN_RAM_COIN = 7251;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q629_CleanUpTheSwampOfScreams;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q629_CleanUpTheSwampOfScreams extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q629_CleanUpTheSwampOfScreams";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int PIERCE = 31553;
 | 
			
		||||
	
 | 
			
		||||
	// ITEMS
 | 
			
		||||
	private static final int TALON_OF_STAKATO = 7250;
 | 
			
		||||
	private static final int GOLDEN_RAM_COIN = 7251;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21508, 500000);
 | 
			
		||||
		CHANCES.put(21509, 431000);
 | 
			
		||||
		CHANCES.put(21510, 521000);
 | 
			
		||||
		CHANCES.put(21511, 576000);
 | 
			
		||||
		CHANCES.put(21512, 746000);
 | 
			
		||||
		CHANCES.put(21513, 530000);
 | 
			
		||||
		CHANCES.put(21514, 538000);
 | 
			
		||||
		CHANCES.put(21515, 545000);
 | 
			
		||||
		CHANCES.put(21516, 553000);
 | 
			
		||||
		CHANCES.put(21517, 560000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q629_CleanUpTheSwampOfScreams()
 | 
			
		||||
	{
 | 
			
		||||
		super(629, qn, "Clean up the Swamp of Screams");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(TALON_OF_STAKATO, GOLDEN_RAM_COIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(PIERCE);
 | 
			
		||||
		addTalkId(PIERCE);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31553-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (player.getLevel() >= 66)
 | 
			
		||||
			{
 | 
			
		||||
				st.setState(State.STARTED);
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31553-0a.htm";
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31553-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TALON_OF_STAKATO) >= 100)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(TALON_OF_STAKATO, 100);
 | 
			
		||||
				st.giveItems(GOLDEN_RAM_COIN, 20);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31553-3a.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31553-5.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (!st.hasAtLeastOneQuestItem(7246, 7247))
 | 
			
		||||
		{
 | 
			
		||||
			return "31553-6.htm";
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 66) ? "31553-0a.htm" : "31553-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (st.getQuestItemsCount(TALON_OF_STAKATO) >= 100) ? "31553-2.htm" : "31553-1a.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(TALON_OF_STAKATO, 1, 100, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21508, 500000);
 | 
			
		||||
		CHANCES.put(21509, 431000);
 | 
			
		||||
		CHANCES.put(21510, 521000);
 | 
			
		||||
		CHANCES.put(21511, 576000);
 | 
			
		||||
		CHANCES.put(21512, 746000);
 | 
			
		||||
		CHANCES.put(21513, 530000);
 | 
			
		||||
		CHANCES.put(21514, 538000);
 | 
			
		||||
		CHANCES.put(21515, 545000);
 | 
			
		||||
		CHANCES.put(21516, 553000);
 | 
			
		||||
		CHANCES.put(21517, 560000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q629_CleanUpTheSwampOfScreams()
 | 
			
		||||
	{
 | 
			
		||||
		super(629, qn, "Clean up the Swamp of Screams");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(TALON_OF_STAKATO, GOLDEN_RAM_COIN);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(PIERCE);
 | 
			
		||||
		addTalkId(PIERCE);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31553-1.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (player.getLevel() >= 66)
 | 
			
		||||
			{
 | 
			
		||||
				st.setState(State.STARTED);
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31553-0a.htm";
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31553-3.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TALON_OF_STAKATO) >= 100)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(TALON_OF_STAKATO, 100);
 | 
			
		||||
				st.giveItems(GOLDEN_RAM_COIN, 20);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31553-3a.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31553-5.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (!st.hasAtLeastOneQuestItem(7246, 7247))
 | 
			
		||||
		{
 | 
			
		||||
			return "31553-6.htm";
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 66) ? "31553-0a.htm" : "31553-0.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				htmltext = (st.getQuestItemsCount(TALON_OF_STAKATO) >= 100) ? "31553-2.htm" : "31553-1a.htm";
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(TALON_OF_STAKATO, 1, 100, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,221 +1,222 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q631_DeliciousTopChoiceMeat;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
import com.l2jmobius.gameserver.util.Util;
 | 
			
		||||
 | 
			
		||||
public class Q631_DeliciousTopChoiceMeat extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q631_DeliciousTopChoiceMeat";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int TUNATUN = 31537;
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int TOP_QUALITY_MEAT = 7546;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q631_DeliciousTopChoiceMeat;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
import com.l2jmobius.gameserver.util.Util;
 | 
			
		||||
 | 
			
		||||
public class Q631_DeliciousTopChoiceMeat extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q631_DeliciousTopChoiceMeat";
 | 
			
		||||
	
 | 
			
		||||
	// NPC
 | 
			
		||||
	private static final int TUNATUN = 31537;
 | 
			
		||||
	
 | 
			
		||||
	// Item
 | 
			
		||||
	private static final int TOP_QUALITY_MEAT = 7546;
 | 
			
		||||
	
 | 
			
		||||
	// Drop chances
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21460, 601000);
 | 
			
		||||
		CHANCES.put(21461, 480000);
 | 
			
		||||
		CHANCES.put(21462, 447000);
 | 
			
		||||
		CHANCES.put(21463, 808000);
 | 
			
		||||
		CHANCES.put(21464, 447000);
 | 
			
		||||
		CHANCES.put(21465, 808000);
 | 
			
		||||
		CHANCES.put(21466, 447000);
 | 
			
		||||
		CHANCES.put(21467, 808000);
 | 
			
		||||
		CHANCES.put(21479, 477000);
 | 
			
		||||
		CHANCES.put(21480, 863000);
 | 
			
		||||
		CHANCES.put(21481, 477000);
 | 
			
		||||
		CHANCES.put(21482, 863000);
 | 
			
		||||
		CHANCES.put(21483, 477000);
 | 
			
		||||
		CHANCES.put(21484, 863000);
 | 
			
		||||
		CHANCES.put(21485, 477000);
 | 
			
		||||
		CHANCES.put(21486, 863000);
 | 
			
		||||
		CHANCES.put(21498, 509000);
 | 
			
		||||
		CHANCES.put(21499, 920000);
 | 
			
		||||
		CHANCES.put(21500, 509000);
 | 
			
		||||
		CHANCES.put(21501, 920000);
 | 
			
		||||
		CHANCES.put(21502, 509000);
 | 
			
		||||
		CHANCES.put(21503, 920000);
 | 
			
		||||
		CHANCES.put(21504, 509000);
 | 
			
		||||
		CHANCES.put(21505, 920000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int[][] REWARDS =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			4039,
 | 
			
		||||
			15
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4043,
 | 
			
		||||
			15
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4044,
 | 
			
		||||
			15
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4040,
 | 
			
		||||
			10
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4042,
 | 
			
		||||
			10
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4041,
 | 
			
		||||
			5
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	public Q631_DeliciousTopChoiceMeat()
 | 
			
		||||
	{
 | 
			
		||||
		super(631, qn, "Delicious Top Choice Meat");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(TOP_QUALITY_MEAT);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(TUNATUN);
 | 
			
		||||
		addTalkId(TUNATUN);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31537-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (player.getLevel() >= 65)
 | 
			
		||||
			{
 | 
			
		||||
				st.setState(State.STARTED);
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31537-02.htm";
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (Util.isDigit(event))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TOP_QUALITY_MEAT) >= 120)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31537-06.htm";
 | 
			
		||||
				st.takeItems(TOP_QUALITY_MEAT, -1);
 | 
			
		||||
				
 | 
			
		||||
				int[] reward = REWARDS[Integer.parseInt(event)];
 | 
			
		||||
				st.rewardItems(reward[0], reward[1]);
 | 
			
		||||
				
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				htmltext = "31537-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = "31537-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31537-03a.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.getQuestItemsCount(TOP_QUALITY_MEAT) >= 120)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31537-04.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.set("cond", "1");
 | 
			
		||||
						htmltext = "31537-03a.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMember(player, npc, "1");
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(TOP_QUALITY_MEAT, 1, 120, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(21460, 601000);
 | 
			
		||||
		CHANCES.put(21461, 480000);
 | 
			
		||||
		CHANCES.put(21462, 447000);
 | 
			
		||||
		CHANCES.put(21463, 808000);
 | 
			
		||||
		CHANCES.put(21464, 447000);
 | 
			
		||||
		CHANCES.put(21465, 808000);
 | 
			
		||||
		CHANCES.put(21466, 447000);
 | 
			
		||||
		CHANCES.put(21467, 808000);
 | 
			
		||||
		CHANCES.put(21479, 477000);
 | 
			
		||||
		CHANCES.put(21480, 863000);
 | 
			
		||||
		CHANCES.put(21481, 477000);
 | 
			
		||||
		CHANCES.put(21482, 863000);
 | 
			
		||||
		CHANCES.put(21483, 477000);
 | 
			
		||||
		CHANCES.put(21484, 863000);
 | 
			
		||||
		CHANCES.put(21485, 477000);
 | 
			
		||||
		CHANCES.put(21486, 863000);
 | 
			
		||||
		CHANCES.put(21498, 509000);
 | 
			
		||||
		CHANCES.put(21499, 920000);
 | 
			
		||||
		CHANCES.put(21500, 509000);
 | 
			
		||||
		CHANCES.put(21501, 920000);
 | 
			
		||||
		CHANCES.put(21502, 509000);
 | 
			
		||||
		CHANCES.put(21503, 920000);
 | 
			
		||||
		CHANCES.put(21504, 509000);
 | 
			
		||||
		CHANCES.put(21505, 920000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Rewards
 | 
			
		||||
	private static final int[][] REWARDS =
 | 
			
		||||
	{
 | 
			
		||||
		{
 | 
			
		||||
			4039,
 | 
			
		||||
			15
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4043,
 | 
			
		||||
			15
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4044,
 | 
			
		||||
			15
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4040,
 | 
			
		||||
			10
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4042,
 | 
			
		||||
			10
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			4041,
 | 
			
		||||
			5
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	public Q631_DeliciousTopChoiceMeat()
 | 
			
		||||
	{
 | 
			
		||||
		super(631, qn, "Delicious Top Choice Meat");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(TOP_QUALITY_MEAT);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(TUNATUN);
 | 
			
		||||
		addTalkId(TUNATUN);
 | 
			
		||||
		
 | 
			
		||||
		for (int npcId : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(npcId);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31537-03.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (player.getLevel() >= 65)
 | 
			
		||||
			{
 | 
			
		||||
				st.setState(State.STARTED);
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31537-02.htm";
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (Util.isDigit(event))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(TOP_QUALITY_MEAT) >= 120)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31537-06.htm";
 | 
			
		||||
				st.takeItems(TOP_QUALITY_MEAT, -1);
 | 
			
		||||
				
 | 
			
		||||
				int[] reward = REWARDS[Integer.parseInt(event)];
 | 
			
		||||
				st.rewardItems(reward[0], reward[1]);
 | 
			
		||||
				
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
				st.exitQuest(true);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "1");
 | 
			
		||||
				htmltext = "31537-07.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = "31537-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31537-03a.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					if (st.getQuestItemsCount(TOP_QUALITY_MEAT) >= 120)
 | 
			
		||||
					{
 | 
			
		||||
						htmltext = "31537-04.htm";
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
						st.set("cond", "1");
 | 
			
		||||
						htmltext = "31537-03a.htm";
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMember(player, npc, "1");
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (st.dropItems(TOP_QUALITY_MEAT, 1, 120, CHANCES.get(npc.getNpcId())))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,201 +1,203 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q633_InTheForgottenVillage;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q633_InTheForgottenVillage extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q633_InTheForgottenVillage";
 | 
			
		||||
	
 | 
			
		||||
	// NPCS
 | 
			
		||||
	private static final int MINA = 31388;
 | 
			
		||||
	
 | 
			
		||||
	// ITEMS
 | 
			
		||||
	private static final int RIB_BONE = 7544;
 | 
			
		||||
	private static final int ZOMBIE_LIVER = 7545;
 | 
			
		||||
	
 | 
			
		||||
	// MOBS / DROP chances
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q633_InTheForgottenVillage;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q633_InTheForgottenVillage extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q633_InTheForgottenVillage";
 | 
			
		||||
	
 | 
			
		||||
	// NPCS
 | 
			
		||||
	private static final int MINA = 31388;
 | 
			
		||||
	
 | 
			
		||||
	// ITEMS
 | 
			
		||||
	private static final int RIB_BONE = 7544;
 | 
			
		||||
	private static final int ZOMBIE_LIVER = 7545;
 | 
			
		||||
	
 | 
			
		||||
	// MOBS / DROP chances
 | 
			
		||||
	private static final Map<Integer, Integer> MOBS = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		MOBS.put(21557, 328000); // Bone Snatcher
 | 
			
		||||
		MOBS.put(21558, 328000); // Bone Snatcher
 | 
			
		||||
		MOBS.put(21559, 337000); // Bone Maker
 | 
			
		||||
		MOBS.put(21560, 337000); // Bone Shaper
 | 
			
		||||
		MOBS.put(21563, 342000); // Bone Collector
 | 
			
		||||
		MOBS.put(21564, 348000); // Skull Collector
 | 
			
		||||
		MOBS.put(21565, 351000); // Bone Animator
 | 
			
		||||
		MOBS.put(21566, 359000); // Skull Animator
 | 
			
		||||
		MOBS.put(21567, 359000); // Bone Slayer
 | 
			
		||||
		MOBS.put(21572, 365000); // Bone Sweeper
 | 
			
		||||
		MOBS.put(21574, 383000); // Bone Grinder
 | 
			
		||||
		MOBS.put(21575, 383000); // Bone Grinder
 | 
			
		||||
		MOBS.put(21580, 385000); // Bone Caster
 | 
			
		||||
		MOBS.put(21581, 395000); // Bone Puppeteer
 | 
			
		||||
		MOBS.put(21583, 397000); // Bone Scavenger
 | 
			
		||||
		MOBS.put(21584, 401000); // Bone Scavenger
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		MOBS.put(21557, 328000); // Bone Snatcher
 | 
			
		||||
		MOBS.put(21558, 328000); // Bone Snatcher
 | 
			
		||||
		MOBS.put(21559, 337000); // Bone Maker
 | 
			
		||||
		MOBS.put(21560, 337000); // Bone Shaper
 | 
			
		||||
		MOBS.put(21563, 342000); // Bone Collector
 | 
			
		||||
		MOBS.put(21564, 348000); // Skull Collector
 | 
			
		||||
		MOBS.put(21565, 351000); // Bone Animator
 | 
			
		||||
		MOBS.put(21566, 359000); // Skull Animator
 | 
			
		||||
		MOBS.put(21567, 359000); // Bone Slayer
 | 
			
		||||
		MOBS.put(21572, 365000); // Bone Sweeper
 | 
			
		||||
		MOBS.put(21574, 383000); // Bone Grinder
 | 
			
		||||
		MOBS.put(21575, 383000); // Bone Grinder
 | 
			
		||||
		MOBS.put(21580, 385000); // Bone Caster
 | 
			
		||||
		MOBS.put(21581, 395000); // Bone Puppeteer
 | 
			
		||||
		MOBS.put(21583, 397000); // Bone Scavenger
 | 
			
		||||
		MOBS.put(21584, 401000); // Bone Scavenger
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> UNDEADS = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		UNDEADS.put(21553, 347000); // Trampled Man
 | 
			
		||||
		UNDEADS.put(21554, 347000); // Trampled Man
 | 
			
		||||
		UNDEADS.put(21561, 450000); // Sacrificed Man
 | 
			
		||||
		UNDEADS.put(21578, 501000); // Behemoth Zombie
 | 
			
		||||
		UNDEADS.put(21596, 359000); // Requiem Lord
 | 
			
		||||
		UNDEADS.put(21597, 370000); // Requiem Behemoth
 | 
			
		||||
		UNDEADS.put(21598, 441000); // Requiem Behemoth
 | 
			
		||||
		UNDEADS.put(21599, 395000); // Requiem Priest
 | 
			
		||||
		UNDEADS.put(21600, 408000); // Requiem Behemoth
 | 
			
		||||
		UNDEADS.put(21601, 411000); // Requiem Behemoth
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q633_InTheForgottenVillage()
 | 
			
		||||
	{
 | 
			
		||||
		super(633, qn, "In the Forgotten Village");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(RIB_BONE, ZOMBIE_LIVER);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(MINA);
 | 
			
		||||
		addTalkId(MINA);
 | 
			
		||||
		
 | 
			
		||||
		for (int i : MOBS.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(i);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for (int i : UNDEADS.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(i);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31388-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31388-10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(RIB_BONE, -1);
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31388-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(RIB_BONE) >= 200)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31388-08.htm";
 | 
			
		||||
				st.takeItems(RIB_BONE, 200);
 | 
			
		||||
				st.rewardItems(57, 25000);
 | 
			
		||||
				st.rewardExpAndSp(305235, 0);
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			}
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 65) ? "31388-03.htm" : "31388-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31388-06.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31388-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		if (UNDEADS.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
			if (partyMember == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			partyMember.getQuestState(qn).dropItems(ZOMBIE_LIVER, 1, 0, UNDEADS.get(npcId));
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			PlayerInstance partyMember = getRandomPartyMember(player, npc, "1");
 | 
			
		||||
			if (partyMember == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
			if (st == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
			if (st.dropItems(RIB_BONE, 1, 200, MOBS.get(npcId)))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		UNDEADS.put(21553, 347000); // Trampled Man
 | 
			
		||||
		UNDEADS.put(21554, 347000); // Trampled Man
 | 
			
		||||
		UNDEADS.put(21561, 450000); // Sacrificed Man
 | 
			
		||||
		UNDEADS.put(21578, 501000); // Behemoth Zombie
 | 
			
		||||
		UNDEADS.put(21596, 359000); // Requiem Lord
 | 
			
		||||
		UNDEADS.put(21597, 370000); // Requiem Behemoth
 | 
			
		||||
		UNDEADS.put(21598, 441000); // Requiem Behemoth
 | 
			
		||||
		UNDEADS.put(21599, 395000); // Requiem Priest
 | 
			
		||||
		UNDEADS.put(21600, 408000); // Requiem Behemoth
 | 
			
		||||
		UNDEADS.put(21601, 411000); // Requiem Behemoth
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q633_InTheForgottenVillage()
 | 
			
		||||
	{
 | 
			
		||||
		super(633, qn, "In the Forgotten Village");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(RIB_BONE, ZOMBIE_LIVER);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(MINA);
 | 
			
		||||
		addTalkId(MINA);
 | 
			
		||||
		
 | 
			
		||||
		for (int i : MOBS.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(i);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for (int i : UNDEADS.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(i);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (event.equals("31388-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31388-10.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.takeItems(RIB_BONE, -1);
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31388-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(RIB_BONE) >= 200)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "31388-08.htm";
 | 
			
		||||
				st.takeItems(RIB_BONE, 200);
 | 
			
		||||
				st.rewardItems(57, 25000);
 | 
			
		||||
				st.rewardExpAndSp(305235, 0);
 | 
			
		||||
				st.playSound(QuestState.SOUND_FINISH);
 | 
			
		||||
			}
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 65) ? "31388-03.htm" : "31388-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				if (cond == 1)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31388-06.htm";
 | 
			
		||||
				}
 | 
			
		||||
				else if (cond == 2)
 | 
			
		||||
				{
 | 
			
		||||
					htmltext = "31388-05.htm";
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		if (UNDEADS.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
			if (partyMember == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			partyMember.getQuestState(qn).dropItems(ZOMBIE_LIVER, 1, 0, UNDEADS.get(npcId));
 | 
			
		||||
		}
 | 
			
		||||
		else if (MOBS.containsKey(npcId))
 | 
			
		||||
		{
 | 
			
		||||
			PlayerInstance partyMember = getRandomPartyMember(player, npc, "1");
 | 
			
		||||
			if (partyMember == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			QuestState st = partyMember.getQuestState(qn);
 | 
			
		||||
			if (st == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
			if (st.dropItems(RIB_BONE, 1, 200, MOBS.get(npcId)))
 | 
			
		||||
			{
 | 
			
		||||
				st.set("cond", "2");
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,220 +1,221 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q639_GuardiansOfTheHolyGrail;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q639_GuardiansOfTheHolyGrail extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q639_GuardiansOfTheHolyGrail";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int DOMINIC = 31350;
 | 
			
		||||
	private static final int GREMORY = 32008;
 | 
			
		||||
	private static final int HOLY_GRAIL = 32028;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int SCRIPTURE = 8069;
 | 
			
		||||
	private static final int WATER_BOTTLE = 8070;
 | 
			
		||||
	private static final int HOLY_WATER_BOTTLE = 8071;
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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.Q639_GuardiansOfTheHolyGrail;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class Q639_GuardiansOfTheHolyGrail extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final String qn = "Q639_GuardiansOfTheHolyGrail";
 | 
			
		||||
	
 | 
			
		||||
	// NPCs
 | 
			
		||||
	private static final int DOMINIC = 31350;
 | 
			
		||||
	private static final int GREMORY = 32008;
 | 
			
		||||
	private static final int HOLY_GRAIL = 32028;
 | 
			
		||||
	
 | 
			
		||||
	// Items
 | 
			
		||||
	private static final int SCRIPTURE = 8069;
 | 
			
		||||
	private static final int WATER_BOTTLE = 8070;
 | 
			
		||||
	private static final int HOLY_WATER_BOTTLE = 8071;
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Integer> CHANCES = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(22122, 760000);
 | 
			
		||||
		CHANCES.put(22123, 750000);
 | 
			
		||||
		CHANCES.put(22124, 590000);
 | 
			
		||||
		CHANCES.put(22125, 580000);
 | 
			
		||||
		CHANCES.put(22126, 590000);
 | 
			
		||||
		CHANCES.put(22127, 580000);
 | 
			
		||||
		CHANCES.put(22128, 170000);
 | 
			
		||||
		CHANCES.put(22129, 590000);
 | 
			
		||||
		CHANCES.put(22130, 850000);
 | 
			
		||||
		CHANCES.put(22131, 920000);
 | 
			
		||||
		CHANCES.put(22132, 580000);
 | 
			
		||||
		CHANCES.put(22133, 930000);
 | 
			
		||||
		CHANCES.put(22134, 230000);
 | 
			
		||||
		CHANCES.put(22135, 580000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q639_GuardiansOfTheHolyGrail()
 | 
			
		||||
	{
 | 
			
		||||
		super(639, qn, "Guardians of the Holy Grail");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(SCRIPTURE, WATER_BOTTLE, HOLY_WATER_BOTTLE);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(DOMINIC);
 | 
			
		||||
		addTalkId(DOMINIC, GREMORY, HOLY_GRAIL);
 | 
			
		||||
		
 | 
			
		||||
		for (int id : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(id);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// DOMINIC
 | 
			
		||||
		if (event.equals("31350-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31350-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int count = st.getQuestItemsCount(SCRIPTURE);
 | 
			
		||||
			
 | 
			
		||||
			st.takeItems(SCRIPTURE, -1);
 | 
			
		||||
			st.rewardItems(57, (1625 * count) + ((count >= 10) ? 33940 : 0));
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31350-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		// GREMORY
 | 
			
		||||
		else if (event.equals("32008-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(WATER_BOTTLE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("32008-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "4");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(HOLY_WATER_BOTTLE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("32008-12.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(SCRIPTURE) >= 4000)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "32008-11.htm";
 | 
			
		||||
				st.takeItems(SCRIPTURE, 4000);
 | 
			
		||||
				st.rewardItems(959, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("32008-14.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(SCRIPTURE) >= 400)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "32008-13.htm";
 | 
			
		||||
				st.takeItems(SCRIPTURE, 400);
 | 
			
		||||
				st.rewardItems(960, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// HOLY GRAIL
 | 
			
		||||
		else if (event.equals("32028-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "3");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(WATER_BOTTLE, 1);
 | 
			
		||||
			st.giveItems(HOLY_WATER_BOTTLE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 73) ? "31350-02.htm" : "31350-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case DOMINIC:
 | 
			
		||||
						htmltext = (st.hasQuestItems(SCRIPTURE)) ? "31350-05.htm" : "31350-06.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case GREMORY:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32008-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32008-06.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32008-08.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32008-10.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case HOLY_GRAIL:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32028-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32028-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(SCRIPTURE, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		CHANCES.put(22122, 760000);
 | 
			
		||||
		CHANCES.put(22123, 750000);
 | 
			
		||||
		CHANCES.put(22124, 590000);
 | 
			
		||||
		CHANCES.put(22125, 580000);
 | 
			
		||||
		CHANCES.put(22126, 590000);
 | 
			
		||||
		CHANCES.put(22127, 580000);
 | 
			
		||||
		CHANCES.put(22128, 170000);
 | 
			
		||||
		CHANCES.put(22129, 590000);
 | 
			
		||||
		CHANCES.put(22130, 850000);
 | 
			
		||||
		CHANCES.put(22131, 920000);
 | 
			
		||||
		CHANCES.put(22132, 580000);
 | 
			
		||||
		CHANCES.put(22133, 930000);
 | 
			
		||||
		CHANCES.put(22134, 230000);
 | 
			
		||||
		CHANCES.put(22135, 580000);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Q639_GuardiansOfTheHolyGrail()
 | 
			
		||||
	{
 | 
			
		||||
		super(639, qn, "Guardians of the Holy Grail");
 | 
			
		||||
		
 | 
			
		||||
		registerQuestItems(SCRIPTURE, WATER_BOTTLE, HOLY_WATER_BOTTLE);
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(DOMINIC);
 | 
			
		||||
		addTalkId(DOMINIC, GREMORY, HOLY_GRAIL);
 | 
			
		||||
		
 | 
			
		||||
		for (int id : CHANCES.keySet())
 | 
			
		||||
		{
 | 
			
		||||
			addKillId(id);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = event;
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		// DOMINIC
 | 
			
		||||
		if (event.equals("31350-04.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("cond", "1");
 | 
			
		||||
			st.playSound(QuestState.SOUND_ACCEPT);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31350-08.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			final int count = st.getQuestItemsCount(SCRIPTURE);
 | 
			
		||||
			
 | 
			
		||||
			st.takeItems(SCRIPTURE, -1);
 | 
			
		||||
			st.rewardItems(57, (1625 * count) + ((count >= 10) ? 33940 : 0));
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("31350-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.playSound(QuestState.SOUND_GIVEUP);
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		// GREMORY
 | 
			
		||||
		else if (event.equals("32008-05.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "2");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.giveItems(WATER_BOTTLE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("32008-09.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "4");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(HOLY_WATER_BOTTLE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("32008-12.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(SCRIPTURE) >= 4000)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "32008-11.htm";
 | 
			
		||||
				st.takeItems(SCRIPTURE, 4000);
 | 
			
		||||
				st.rewardItems(959, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		else if (event.equals("32008-14.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			if (st.getQuestItemsCount(SCRIPTURE) >= 400)
 | 
			
		||||
			{
 | 
			
		||||
				htmltext = "32008-13.htm";
 | 
			
		||||
				st.takeItems(SCRIPTURE, 400);
 | 
			
		||||
				st.rewardItems(960, 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		// HOLY GRAIL
 | 
			
		||||
		else if (event.equals("32028-02.htm"))
 | 
			
		||||
		{
 | 
			
		||||
			st.set("cond", "3");
 | 
			
		||||
			st.playSound(QuestState.SOUND_MIDDLE);
 | 
			
		||||
			st.takeItems(WATER_BOTTLE, 1);
 | 
			
		||||
			st.giveItems(HOLY_WATER_BOTTLE, 1);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(qn);
 | 
			
		||||
		String htmltext = getNoQuestMsg();
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			return htmltext;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		switch (st.getState())
 | 
			
		||||
		{
 | 
			
		||||
			case State.CREATED:
 | 
			
		||||
				htmltext = (player.getLevel() < 73) ? "31350-02.htm" : "31350-01.htm";
 | 
			
		||||
				break;
 | 
			
		||||
			
 | 
			
		||||
			case State.STARTED:
 | 
			
		||||
				final int cond = st.getInt("cond");
 | 
			
		||||
				switch (npc.getNpcId())
 | 
			
		||||
				{
 | 
			
		||||
					case DOMINIC:
 | 
			
		||||
						htmltext = (st.hasQuestItems(SCRIPTURE)) ? "31350-05.htm" : "31350-06.htm";
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case GREMORY:
 | 
			
		||||
						if (cond == 1)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32008-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32008-06.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 3)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32008-08.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond == 4)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32008-10.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
					
 | 
			
		||||
					case HOLY_GRAIL:
 | 
			
		||||
						if (cond == 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32028-01.htm";
 | 
			
		||||
						}
 | 
			
		||||
						else if (cond > 2)
 | 
			
		||||
						{
 | 
			
		||||
							htmltext = "32028-03.htm";
 | 
			
		||||
						}
 | 
			
		||||
						break;
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onKill(NpcInstance npc, PlayerInstance player, boolean isPet)
 | 
			
		||||
	{
 | 
			
		||||
		PlayerInstance partyMember = getRandomPartyMemberState(player, npc, State.STARTED);
 | 
			
		||||
		if (partyMember == null)
 | 
			
		||||
		{
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		partyMember.getQuestState(qn).dropItems(SCRIPTURE, 1, 0, CHANCES.get(npc.getNpcId()));
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,126 +1,127 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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 teleports.NewbieTravelToken;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
 | 
			
		||||
public class NewbieTravelToken extends Quest
 | 
			
		||||
{
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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 teleports.NewbieTravelToken;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
 | 
			
		||||
public class NewbieTravelToken extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final Map<String, int[]> data = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		data.put("30600", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			12160,
 | 
			
		||||
			16554,
 | 
			
		||||
			-4583
 | 
			
		||||
		}); // DE
 | 
			
		||||
		data.put("30601", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			115594,
 | 
			
		||||
			-177993,
 | 
			
		||||
			-912
 | 
			
		||||
		}); // DW
 | 
			
		||||
		data.put("30599", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			45470,
 | 
			
		||||
			48328,
 | 
			
		||||
			-3059
 | 
			
		||||
		}); // EV
 | 
			
		||||
		data.put("30602", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			-45067,
 | 
			
		||||
			-113563,
 | 
			
		||||
			-199
 | 
			
		||||
		}); // OV
 | 
			
		||||
		data.put("30598", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			-84053,
 | 
			
		||||
			243343,
 | 
			
		||||
			-3729
 | 
			
		||||
		}); // TI
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final int TOKEN = 8542;
 | 
			
		||||
	
 | 
			
		||||
	public NewbieTravelToken()
 | 
			
		||||
	{
 | 
			
		||||
		super(-1, "NewbieTravelToken", "teleports");
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30598, 30599, 30600, 30601, 30602);
 | 
			
		||||
		addTalkId(30598, 30599, 30600, 30601, 30602);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(getName());
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			st = newQuestState(player);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (data.containsKey(event))
 | 
			
		||||
		{
 | 
			
		||||
			int x = data.get(event)[0];
 | 
			
		||||
			int y = data.get(event)[1];
 | 
			
		||||
			int z = data.get(event)[2];
 | 
			
		||||
			
 | 
			
		||||
			if (st.getQuestItemsCount(TOKEN) != 0)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(TOKEN, 1);
 | 
			
		||||
				st.getPlayer().teleToLocation(x, y, z);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				return "notoken.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		st.exitQuest(true);
 | 
			
		||||
		return super.onAdvEvent(event, npc, player);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = "";
 | 
			
		||||
		QuestState st = player.getQuestState(getName());
 | 
			
		||||
		int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		if (player.getLevel() >= 20)
 | 
			
		||||
		{
 | 
			
		||||
			htmltext = "wronglevel.htm";
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			htmltext = npcId + ".htm";
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static void main(String[] args)
 | 
			
		||||
	{
 | 
			
		||||
		new NewbieTravelToken();
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		data.put("30600", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			12160,
 | 
			
		||||
			16554,
 | 
			
		||||
			-4583
 | 
			
		||||
		}); // DE
 | 
			
		||||
		data.put("30601", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			115594,
 | 
			
		||||
			-177993,
 | 
			
		||||
			-912
 | 
			
		||||
		}); // DW
 | 
			
		||||
		data.put("30599", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			45470,
 | 
			
		||||
			48328,
 | 
			
		||||
			-3059
 | 
			
		||||
		}); // EV
 | 
			
		||||
		data.put("30602", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			-45067,
 | 
			
		||||
			-113563,
 | 
			
		||||
			-199
 | 
			
		||||
		}); // OV
 | 
			
		||||
		data.put("30598", new int[]
 | 
			
		||||
		{
 | 
			
		||||
			-84053,
 | 
			
		||||
			243343,
 | 
			
		||||
			-3729
 | 
			
		||||
		}); // TI
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static final int TOKEN = 8542;
 | 
			
		||||
	
 | 
			
		||||
	public NewbieTravelToken()
 | 
			
		||||
	{
 | 
			
		||||
		super(-1, "NewbieTravelToken", "teleports");
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30598, 30599, 30600, 30601, 30602);
 | 
			
		||||
		addTalkId(30598, 30599, 30600, 30601, 30602);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(getName());
 | 
			
		||||
		if (st == null)
 | 
			
		||||
		{
 | 
			
		||||
			st = newQuestState(player);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (data.containsKey(event))
 | 
			
		||||
		{
 | 
			
		||||
			int x = data.get(event)[0];
 | 
			
		||||
			int y = data.get(event)[1];
 | 
			
		||||
			int z = data.get(event)[2];
 | 
			
		||||
			
 | 
			
		||||
			if (st.getQuestItemsCount(TOKEN) != 0)
 | 
			
		||||
			{
 | 
			
		||||
				st.takeItems(TOKEN, 1);
 | 
			
		||||
				st.getPlayer().teleToLocation(x, y, z);
 | 
			
		||||
			}
 | 
			
		||||
			else
 | 
			
		||||
			{
 | 
			
		||||
				return "notoken.htm";
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		st.exitQuest(true);
 | 
			
		||||
		return super.onAdvEvent(event, npc, player);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		String htmltext = "";
 | 
			
		||||
		QuestState st = player.getQuestState(getName());
 | 
			
		||||
		int npcId = npc.getNpcId();
 | 
			
		||||
		
 | 
			
		||||
		if (player.getLevel() >= 20)
 | 
			
		||||
		{
 | 
			
		||||
			htmltext = "wronglevel.htm";
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			htmltext = npcId + ".htm";
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return htmltext;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static void main(String[] args)
 | 
			
		||||
	{
 | 
			
		||||
		new NewbieTravelToken();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,82 +1,83 @@
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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 teleports.RaceTrack;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.position.Location;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class RaceTrack extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final int RACE_MANAGER = 30995;
 | 
			
		||||
	
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the L2J Mobius project.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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 teleports.RaceTrack;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.NpcInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
 | 
			
		||||
import com.l2jmobius.gameserver.model.actor.position.Location;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.Quest;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.QuestState;
 | 
			
		||||
import com.l2jmobius.gameserver.model.quest.State;
 | 
			
		||||
 | 
			
		||||
public class RaceTrack extends Quest
 | 
			
		||||
{
 | 
			
		||||
	private static final int RACE_MANAGER = 30995;
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<Integer, Location> RETURN_LOCATIONS = new HashMap<>();
 | 
			
		||||
	{
 | 
			
		||||
		RETURN_LOCATIONS.put(30320, new Location(-80826, 149775, -3043)); // RICHLIN
 | 
			
		||||
		RETURN_LOCATIONS.put(30256, new Location(-12672, 122776, -3116)); // BELLA
 | 
			
		||||
		RETURN_LOCATIONS.put(30059, new Location(15670, 142983, -2705)); // TRISHA
 | 
			
		||||
		RETURN_LOCATIONS.put(30080, new Location(83400, 147943, -3404)); // CLARISSA
 | 
			
		||||
		RETURN_LOCATIONS.put(30899, new Location(111409, 219364, -3545)); // FLAUEN
 | 
			
		||||
		RETURN_LOCATIONS.put(30177, new Location(82956, 53162, -1495)); // VALENTIA
 | 
			
		||||
		RETURN_LOCATIONS.put(30848, new Location(146331, 25762, -2018)); // ELISA
 | 
			
		||||
		RETURN_LOCATIONS.put(30233, new Location(116819, 76994, -2714)); // ESMERALDA
 | 
			
		||||
		RETURN_LOCATIONS.put(31320, new Location(43835, -47749, -792)); // ILYANA
 | 
			
		||||
		RETURN_LOCATIONS.put(31275, new Location(147930, -55281, -2728)); // TATIANA
 | 
			
		||||
		RETURN_LOCATIONS.put(31964, new Location(87386, -143246, -1293)); // BILIA
 | 
			
		||||
		RETURN_LOCATIONS.put(31210, new Location(12882, 181053, -3560)); // RACE TRACK GK
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public RaceTrack()
 | 
			
		||||
	{
 | 
			
		||||
		super(-1, "RaceTrack", "teleports");
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30320, 30256, 30059, 30080, 30899, 30177, 30848, 30233, 31320, 31275, 31964, 31210);
 | 
			
		||||
		addTalkId(RACE_MANAGER, 30320, 30256, 30059, 30080, 30899, 30177, 30848, 30233, 31320, 31275, 31964, 31210);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(getName());
 | 
			
		||||
		
 | 
			
		||||
		if (RETURN_LOCATIONS.containsKey(npc.getNpcId()))
 | 
			
		||||
		{
 | 
			
		||||
			player.teleToLocation(12661, 181687, -3560);
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("id", Integer.toString(npc.getNpcId()));
 | 
			
		||||
		}
 | 
			
		||||
		else if (st.isStarted() && (npc.getNpcId() == RACE_MANAGER))
 | 
			
		||||
		{
 | 
			
		||||
			final Location loc = RETURN_LOCATIONS.get(st.getInt("id"));
 | 
			
		||||
			player.teleToLocation(loc.getX(), loc.getY(), loc.getZ());
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static void main(String[] args)
 | 
			
		||||
	{
 | 
			
		||||
		new RaceTrack();
 | 
			
		||||
	}
 | 
			
		||||
	static
 | 
			
		||||
	{
 | 
			
		||||
		RETURN_LOCATIONS.put(30320, new Location(-80826, 149775, -3043)); // RICHLIN
 | 
			
		||||
		RETURN_LOCATIONS.put(30256, new Location(-12672, 122776, -3116)); // BELLA
 | 
			
		||||
		RETURN_LOCATIONS.put(30059, new Location(15670, 142983, -2705)); // TRISHA
 | 
			
		||||
		RETURN_LOCATIONS.put(30080, new Location(83400, 147943, -3404)); // CLARISSA
 | 
			
		||||
		RETURN_LOCATIONS.put(30899, new Location(111409, 219364, -3545)); // FLAUEN
 | 
			
		||||
		RETURN_LOCATIONS.put(30177, new Location(82956, 53162, -1495)); // VALENTIA
 | 
			
		||||
		RETURN_LOCATIONS.put(30848, new Location(146331, 25762, -2018)); // ELISA
 | 
			
		||||
		RETURN_LOCATIONS.put(30233, new Location(116819, 76994, -2714)); // ESMERALDA
 | 
			
		||||
		RETURN_LOCATIONS.put(31320, new Location(43835, -47749, -792)); // ILYANA
 | 
			
		||||
		RETURN_LOCATIONS.put(31275, new Location(147930, -55281, -2728)); // TATIANA
 | 
			
		||||
		RETURN_LOCATIONS.put(31964, new Location(87386, -143246, -1293)); // BILIA
 | 
			
		||||
		RETURN_LOCATIONS.put(31210, new Location(12882, 181053, -3560)); // RACE TRACK GK
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public RaceTrack()
 | 
			
		||||
	{
 | 
			
		||||
		super(-1, "RaceTrack", "teleports");
 | 
			
		||||
		
 | 
			
		||||
		addStartNpc(30320, 30256, 30059, 30080, 30899, 30177, 30848, 30233, 31320, 31275, 31964, 31210);
 | 
			
		||||
		addTalkId(RACE_MANAGER, 30320, 30256, 30059, 30080, 30899, 30177, 30848, 30233, 31320, 31275, 31964, 31210);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public String onTalk(NpcInstance npc, PlayerInstance player)
 | 
			
		||||
	{
 | 
			
		||||
		QuestState st = player.getQuestState(getName());
 | 
			
		||||
		
 | 
			
		||||
		if (RETURN_LOCATIONS.containsKey(npc.getNpcId()))
 | 
			
		||||
		{
 | 
			
		||||
			player.teleToLocation(12661, 181687, -3560);
 | 
			
		||||
			st.setState(State.STARTED);
 | 
			
		||||
			st.set("id", Integer.toString(npc.getNpcId()));
 | 
			
		||||
		}
 | 
			
		||||
		else if (st.isStarted() && (npc.getNpcId() == RACE_MANAGER))
 | 
			
		||||
		{
 | 
			
		||||
			final Location loc = RETURN_LOCATIONS.get(st.getInt("id"));
 | 
			
		||||
			player.teleToLocation(loc.getX(), loc.getY(), loc.getZ());
 | 
			
		||||
			st.exitQuest(true);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static void main(String[] args)
 | 
			
		||||
	{
 | 
			
		||||
		new RaceTrack();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user