From 32df4e178a3c0655241312fb1e06c9e82d1df7fc Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 4 May 2018 15:29:40 +0000 Subject: [PATCH] Retail like quest Diamond the White-eyed (10417). Contributed by Iris. --- .../Q10417_DaimonTheWhiteEyed.java | 153 ++++++++++++++++-- 1 file changed, 136 insertions(+), 17 deletions(-) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q10417_DaimonTheWhiteEyed/Q10417_DaimonTheWhiteEyed.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q10417_DaimonTheWhiteEyed/Q10417_DaimonTheWhiteEyed.java index 1e59ea9823..38af93a0b6 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q10417_DaimonTheWhiteEyed/Q10417_DaimonTheWhiteEyed.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q10417_DaimonTheWhiteEyed/Q10417_DaimonTheWhiteEyed.java @@ -1,4 +1,4 @@ -/* +/* * This file is part of the L2J Mobius project. * * This program is free software: you can redistribute it and/or modify @@ -16,18 +16,27 @@ */ package quests.Q10417_DaimonTheWhiteEyed; -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.quest.Quest; -import com.l2jmobius.gameserver.model.quest.QuestState; -import com.l2jmobius.gameserver.model.quest.State; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import quests.Q10416_InSearchOfTheEyeOfArgos.Q10416_InSearchOfTheEyeOfArgos; +import com.l2jmobius.commons.util.CommonUtil; +import com.l2jmobius.gameserver.enums.QuestSound; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.L2Party; +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; + /** * Daimon the White-eyed (10417) - * @author St3eT + * @author St3eT, Iris */ public final class Q10417_DaimonTheWhiteEyed extends Quest { @@ -41,12 +50,25 @@ public final class Q10417_DaimonTheWhiteEyed extends Quest private static final int MIN_LEVEL = 70; private static final int MAX_LEVEL = 75; + private static final int[] MONSTER_TO_KILL = + { + 21294, // Canyon Antelope + 21295, // Canyon Antelope Slave + 21296, // Canyon Bandersnatch + 21297, // Canyon Bandersnatch Slave + 21304, // Valley Grendel Slave + 23312, // Valley Grendel + 21299, // Valley Buffalo Slave + 23311, // Valley Buffalo + }; + public Q10417_DaimonTheWhiteEyed() { super(10417); addStartNpc(EYE_OF_ARGOS); addTalkId(EYE_OF_ARGOS, JANITT); addKillId(DAIMON_THE_WHITEEYED); + addKillId(MONSTER_TO_KILL); addCondNotRace(Race.ERTHEIA, "31683-09.html"); addCondLevel(MIN_LEVEL, MAX_LEVEL, "31683-08.htm"); addCondCompletedQuest(Q10416_InSearchOfTheEyeOfArgos.class.getSimpleName(), "31683-08.htm"); @@ -78,23 +100,23 @@ public final class Q10417_DaimonTheWhiteEyed extends Quest } case "31683-07.html": { - if (st.isCond(2)) + if (st.isCond(3)) { - st.setCond(3, true); + st.setCond(4, true); htmltext = event; } break; } case "31683-03.html": { - if (st.isCond(3)) + if (st.isCond(4)) { st.exitQuest(false, true); giveItems(player, EAA, 5); giveStoryQuestReward(player, 26); if (player.getLevel() > MIN_LEVEL) { - addExpAndSp(player, 2_721_600, 653); + addExpAndSp(player, 306_167_814, 3265); } htmltext = event; } @@ -128,10 +150,15 @@ public final class Q10417_DaimonTheWhiteEyed extends Quest } case 2: { - htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-06.html" : "33851-01.html"; + htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-05.html" : "33851-01.html"; break; } case 3: + { + htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-06.html" : "33851-01.html"; + break; + } + case 4: { htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-07.html" : "33851-02.html"; break; @@ -144,12 +171,104 @@ public final class Q10417_DaimonTheWhiteEyed extends Quest @Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { - final QuestState st = getQuestState(killer, false); - - if ((st != null) && st.isCond(1)) + int npcHolder = npc.getId(); + if (killer.isInParty()) { - st.setCond(2, true); + final L2Party party = killer.getParty(); + final List partyMember = party.getMembers(); + + for (L2PcInstance singleMember : partyMember) + { + QuestState qsPartyMember = getQuestState(singleMember, false); + double distance = npc.calculateDistance(singleMember, true, false); + if ((qsPartyMember != null) && qsPartyMember.isCond(1) && (distance <= 1000)) + { + int mobCount = qsPartyMember.getInt("KillCount_MOBS"); + if (mobCount < 100) + { + if (CommonUtil.contains(MONSTER_TO_KILL, npcHolder)) + { + mobCount++; + qsPartyMember.set("KillCount_MOBS", mobCount); + playSound(singleMember, QuestSound.ITEMSOUND_QUEST_ITEMGET); + } + sendNpcLogList(singleMember); + } + + if (mobCount == 100) + { + qsPartyMember.setCond(2, true); + } + } + + if ((qsPartyMember != null) && qsPartyMember.isCond(2)) + { + if (npcHolder == DAIMON_THE_WHITEEYED) + { + playSound(singleMember, QuestSound.ITEMSOUND_QUEST_ITEMGET); + qsPartyMember.setCond(3, true); + } + sendNpcLogList(singleMember); + } + } } + else + { + final QuestState qs = getQuestState(killer, false); + if ((qs != null) && qs.isCond(1)) + { + int mobCount = qs.getInt("KillCount_MOBS"); + if (mobCount < 100) + { + if (CommonUtil.contains(MONSTER_TO_KILL, npcHolder)) + { + mobCount++; + qs.set("KillCount_MOBS", mobCount); + playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); + } + sendNpcLogList(killer); + } + + if (mobCount == 100) + { + qs.setCond(2, true); + } + } + + if ((qs != null) && qs.isCond(2)) + { + if (npcHolder == DAIMON_THE_WHITEEYED) + { + playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); + qs.setCond(3, true); + } + sendNpcLogList(killer); + } + } + return super.onKill(npc, killer, isSummon); } + + @Override + public Set getNpcLogList(L2PcInstance player) + { + final QuestState qs = getQuestState(player, false); + if ((qs != null) && qs.isCond(1)) + { + final int killCount = qs.getInt("KillCount_MOBS"); + if ((killCount > 0) && (killCount != 200)) + { + final Set holder = new HashSet<>(); + holder.add(new NpcLogListHolder(NpcStringId.DEFEAT_THE_BEASTS_OF_THE_VALLEY, killCount)); + return holder; + } + if (qs.isCond(3)) + { + final Set holder = new HashSet<>(); + holder.add(new NpcLogListHolder(DAIMON_THE_WHITEEYED, false, killCount)); + return holder; + } + } + return super.getNpcLogList(player); + } } \ No newline at end of file