Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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.Q10417_DaimonTheWhiteEyed;
- import java.util.HashSet;
- import java.util.Set;
- import com.l2jmobius.commons.util.CommonUtil;
- import com.l2jmobius.gameserver.enums.QuestSound;
- import com.l2jmobius.gameserver.enums.QuestType;
- import com.l2jmobius.gameserver.enums.Race;
- import com.l2jmobius.gameserver.model.actor.L2Npc;
- import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jmobius.gameserver.model.holders.NpcLogListHolder;
- 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.NpcStringId;
- import quests.Q10416_InSearchOfTheEyeOfArgos.Q10416_InSearchOfTheEyeOfArgos;
- /**
- * Daimon the White-eyed (10417)
- * @author St3eT
- */
- public final class Q10417_DaimonTheWhiteEyed extends Quest
- {
- // Monsters
- private static final int[] MONSTERS =
- {
- 21294, // Canyon Antelope
- 21296, // Canyon Bandersnatch
- 23311, // Valley Buffalo
- 23312, // Valley Grendel
- 21295, // Canyon Antelope Slave
- 21297, // Canyon Bandersnatch Slave
- 21299, // Valley Buffalo Slave
- 21304 // Valley Grendel Slave
- };
- // NPCs
- private static final int EYE_OF_ARGOS = 31683;
- private static final int JANITT = 33851;
- private static final int DAIMON_THE_WHITEEYED = 27499;
- // Misc
- private static final int MIN_LEVEL = 70;
- private static final int MAX_LEVEL = 75;
- private static final String KILL_COUNT_VAR = "KillCount";
- private static final String KILL_COUNT_VAR1 = "KillCount1";
- public Q10417_DaimonTheWhiteEyed()
- {
- super(10417);
- addStartNpc(EYE_OF_ARGOS);
- addTalkId(EYE_OF_ARGOS, JANITT);
- addKillId(MONSTERS);
- addKillId(DAIMON_THE_WHITEEYED);
- addCondNotRace(Race.ERTHEIA, "31683-09.html");
- addCondLevel(MIN_LEVEL, MAX_LEVEL, "31683-08.htm");
- addCondCompletedQuest(Q10416_InSearchOfTheEyeOfArgos.class.getSimpleName(), "31683-08.htm");
- }
- @Override
- public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
- {
- final QuestState st = getQuestState(player, false);
- if (st == null)
- {
- return null;
- }
- String htmltext = null;
- switch (event)
- {
- case "31683-02.htm":
- case "31683-03.htm":
- {
- htmltext = event;
- break;
- }
- case "31683-04.htm":
- {
- st.startQuest();
- htmltext = event;
- break;
- }
- case "31683-07.html":
- {
- if (st.isCond(2))
- {
- st.setCond(3, true);
- htmltext = event;
- }
- break;
- }
- case "31683-03.html":
- {
- if (st.isCond(3))
- {
- if (player.getLevel() >= MIN_LEVEL)
- {
- addExpAndSp(player, 178_732_196, 261);
- giveStoryQuestReward(npc, player);
- st.exitQuest(QuestType.ONE_TIME, true);
- htmltext = event;
- }
- else
- {
- htmltext = getNoQuestLevelRewardMsg(player);
- }
- }
- break;
- }
- }
- return htmltext;
- }
- @Override
- public String onTalk(L2Npc npc, L2PcInstance player)
- {
- final QuestState st = getQuestState(player, true);
- String htmltext = getNoQuestMsg(player);
- if (st.getState() == State.CREATED)
- {
- if (npc.getId() == EYE_OF_ARGOS)
- {
- htmltext = "31683-01.htm";
- }
- }
- else if (st.getState() == State.STARTED)
- {
- switch (st.getCond())
- {
- case 1:
- {
- htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-05.html" : "33851-01.html";
- break;
- }
- case 2:
- {
- htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-06.html" : "33851-01.html";
- break;
- }
- case 3:
- {
- htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-07.html" : "33851-02.html";
- break;
- }
- }
- }
- return htmltext;
- }
- @Override
- public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
- {
- final QuestState st = getQuestState(killer, false);
- if ((st != null) && st.isCond(2))
- {
- if ((npc.getId() == DAIMON_THE_WHITEEYED) || (CommonUtil.contains(MONSTERS, npc.getId())))
- {
- int raidCount = st.getInt("KillCount_" + DAIMON_THE_WHITEEYED);
- int monsterCount = st.getInt("KillCount_" + MONSTERS);
- if (npc.getId() == DAIMON_THE_WHITEEYED)
- {
- if (raidCount < 1)
- {
- st.set("KillCount_" + DAIMON_THE_WHITEEYED, ++raidCount);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- }
- else if (monsterCount < 100)
- {
- st.set("KillCount_" + MONSTERS, ++monsterCount);
- playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
- }
- if (monsterCount >= 100)
- {
- st.setCond(2, true);
- }
- else if ((monsterCount >= 100) && (raidCount >= 1))
- {
- st.setCond(3, true);
- }
- }
- }
- return super.onKill(npc, killer, isSummon);
- }
- @Override
- public Set<NpcLogListHolder> getNpcLogList(L2PcInstance activeChar)
- {
- final QuestState st = getQuestState(activeChar, false);
- if ((st != null) && st.isCond(1))
- {
- final int killCount = st.getInt(KILL_COUNT_VAR);
- if (killCount > 0)
- {
- final Set<NpcLogListHolder> holder = new HashSet<>();
- holder.add(new NpcLogListHolder(NpcStringId.DEFEAT_THE_BEASTS_OF_THE_VALLEY, killCount));
- return holder;
- }
- else if ((st != null) && st.isCond(2))
- {
- final Set<NpcLogListHolder> npcLogList = new HashSet<>();
- npcLogList.add(new NpcLogListHolder(DAIMON_THE_WHITEEYED, false, st.getInt("KillCount_" + DAIMON_THE_WHITEEYED)));
- return npcLogList;
- }
- return super.getNpcLogList(activeChar);
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement