From 59f73e6ccc3582e96d854cf5c19e9c3fe513b864 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 30 Mar 2021 07:36:20 +0000 Subject: [PATCH] Tomb Raider (933) quest adjustments. Contributed by Neith. --- .../Q00933_TombRaiders.java | 66 ++++++++++++++----- .../dist/game/data/zones/custom_script.xml | 3 + .../Q00933_TombRaiders.java | 66 ++++++++++++++----- .../dist/game/data/zones/custom_script.xml | 3 + 4 files changed, 104 insertions(+), 34 deletions(-) diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/quests/Q00933_TombRaiders/Q00933_TombRaiders.java b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/quests/Q00933_TombRaiders/Q00933_TombRaiders.java index ce7aecd3a5..3b0c5eed91 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/quests/Q00933_TombRaiders/Q00933_TombRaiders.java +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/quests/Q00933_TombRaiders/Q00933_TombRaiders.java @@ -21,18 +21,23 @@ import java.util.Set; import org.l2jmobius.gameserver.enums.QuestSound; import org.l2jmobius.gameserver.enums.QuestType; +import org.l2jmobius.gameserver.instancemanager.ZoneManager; +import org.l2jmobius.gameserver.model.Party; +import org.l2jmobius.gameserver.model.actor.Creature; // Imports belov needed for onEnterZone import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.holders.NpcLogListHolder; import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.State; +import org.l2jmobius.gameserver.model.zone.ZoneType; +import org.l2jmobius.gameserver.model.zone.type.ScriptZone; import org.l2jmobius.gameserver.network.NpcStringId; /** * Tomb Raiders (933) * @URL https://l2wiki.com/Tomb_Raiders - * @author Sero + * @author Sero, retail like modifications by Neith and CostyKiller */ public class Q00933_TombRaiders extends Quest { @@ -49,10 +54,13 @@ public class Q00933_TombRaiders extends Quest private static final int BENUSTA_REWARD_BOX = 81151; // Misc private static final String KILL_COUNT_VAR = "KillCount"; + // Zone + private static final ScriptZone QUEST_ZONE = ZoneManager.getInstance().getZoneById(93300, ScriptZone.class); // Session Zone - Imperial Tomb public Q00933_TombRaiders() { super(933); + addEnterZoneId(QUEST_ZONE.getId()); addStartNpc(SEARCH_TEAM_TELEPORTER); addTalkId(SEARCH_TEAM_TELEPORTER, LEOPARD); addKillId(TOMB_GUARDIAN, TOMB_RAIDER, TOMB_WATCHER, TOMB_SOULTAKER, TOMB_PATROL); @@ -141,30 +149,54 @@ public class Q00933_TombRaiders extends Quest return htmltext; } + @Override + public String onEnterZone(Creature creature, ZoneType zone) + { + if (creature.isPlayer()) + { + final QuestState qs = getQuestState(creature.getActingPlayer(), true); + if ((qs != null) && qs.isCreated()) + { + qs.startQuest(); + } + } + return super.onEnterZone(creature, zone); + } + @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isCond(1)) + final Party party = killer.getParty(); + if (party != null) { - final int killCount = qs.getInt(KILL_COUNT_VAR); - if (killCount < 150) - { - qs.set(KILL_COUNT_VAR, killCount + 1); - playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); - sendNpcLogList(killer); - } - else - { - qs.setCond(2); - qs.unset(KILL_COUNT_VAR); - } + party.getMembers().forEach(p -> processKill(npc, p)); + } + else + { + processKill(npc, killer); } return super.onKill(npc, killer, isSummon); } - // TODO: - // public String onEnterZone(Creature creature, ZoneType zone) + private void processKill(Npc npc, PlayerInstance killer) + { + final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); + if (qs != null) + { + final PlayerInstance player = qs.getPlayer(); + int killCount = qs.getInt(KILL_COUNT_VAR); + if (killCount < 150) + { + qs.set(KILL_COUNT_VAR, killCount + 1); + playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET); + } + if (killCount >= 150) + { + qs.setCond(2, true); + } + sendNpcLogList(player); + } + } @Override public Set getNpcLogList(PlayerInstance player) diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/zones/custom_script.xml b/L2J_Mobius_8.0_Homunculus/dist/game/data/zones/custom_script.xml index 66678b3676..9b3d25ab42 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/zones/custom_script.xml +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/zones/custom_script.xml @@ -1158,4 +1158,7 @@ + + + \ No newline at end of file diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/quests/Q00933_TombRaiders/Q00933_TombRaiders.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/quests/Q00933_TombRaiders/Q00933_TombRaiders.java index ce7aecd3a5..3b0c5eed91 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/quests/Q00933_TombRaiders/Q00933_TombRaiders.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/quests/Q00933_TombRaiders/Q00933_TombRaiders.java @@ -21,18 +21,23 @@ import java.util.Set; import org.l2jmobius.gameserver.enums.QuestSound; import org.l2jmobius.gameserver.enums.QuestType; +import org.l2jmobius.gameserver.instancemanager.ZoneManager; +import org.l2jmobius.gameserver.model.Party; +import org.l2jmobius.gameserver.model.actor.Creature; // Imports belov needed for onEnterZone import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.holders.NpcLogListHolder; import org.l2jmobius.gameserver.model.quest.Quest; import org.l2jmobius.gameserver.model.quest.QuestState; import org.l2jmobius.gameserver.model.quest.State; +import org.l2jmobius.gameserver.model.zone.ZoneType; +import org.l2jmobius.gameserver.model.zone.type.ScriptZone; import org.l2jmobius.gameserver.network.NpcStringId; /** * Tomb Raiders (933) * @URL https://l2wiki.com/Tomb_Raiders - * @author Sero + * @author Sero, retail like modifications by Neith and CostyKiller */ public class Q00933_TombRaiders extends Quest { @@ -49,10 +54,13 @@ public class Q00933_TombRaiders extends Quest private static final int BENUSTA_REWARD_BOX = 81151; // Misc private static final String KILL_COUNT_VAR = "KillCount"; + // Zone + private static final ScriptZone QUEST_ZONE = ZoneManager.getInstance().getZoneById(93300, ScriptZone.class); // Session Zone - Imperial Tomb public Q00933_TombRaiders() { super(933); + addEnterZoneId(QUEST_ZONE.getId()); addStartNpc(SEARCH_TEAM_TELEPORTER); addTalkId(SEARCH_TEAM_TELEPORTER, LEOPARD); addKillId(TOMB_GUARDIAN, TOMB_RAIDER, TOMB_WATCHER, TOMB_SOULTAKER, TOMB_PATROL); @@ -141,30 +149,54 @@ public class Q00933_TombRaiders extends Quest return htmltext; } + @Override + public String onEnterZone(Creature creature, ZoneType zone) + { + if (creature.isPlayer()) + { + final QuestState qs = getQuestState(creature.getActingPlayer(), true); + if ((qs != null) && qs.isCreated()) + { + qs.startQuest(); + } + } + return super.onEnterZone(creature, zone); + } + @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isCond(1)) + final Party party = killer.getParty(); + if (party != null) { - final int killCount = qs.getInt(KILL_COUNT_VAR); - if (killCount < 150) - { - qs.set(KILL_COUNT_VAR, killCount + 1); - playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET); - sendNpcLogList(killer); - } - else - { - qs.setCond(2); - qs.unset(KILL_COUNT_VAR); - } + party.getMembers().forEach(p -> processKill(npc, p)); + } + else + { + processKill(npc, killer); } return super.onKill(npc, killer, isSummon); } - // TODO: - // public String onEnterZone(Creature creature, ZoneType zone) + private void processKill(Npc npc, PlayerInstance killer) + { + final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); + if (qs != null) + { + final PlayerInstance player = qs.getPlayer(); + int killCount = qs.getInt(KILL_COUNT_VAR); + if (killCount < 150) + { + qs.set(KILL_COUNT_VAR, killCount + 1); + playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET); + } + if (killCount >= 150) + { + qs.setCond(2, true); + } + sendNpcLogList(player); + } + } @Override public Set getNpcLogList(PlayerInstance player) diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/zones/custom_script.xml b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/zones/custom_script.xml index 66678b3676..9b3d25ab42 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/zones/custom_script.xml +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/zones/custom_script.xml @@ -1158,4 +1158,7 @@ + + + \ No newline at end of file