diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java index 250742c433..92321be894 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java @@ -1,114 +1,114 @@ -/* - * 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 . - */ -package ai.areas.DragonValley; - -import java.util.ArrayList; -import java.util.List; - -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; - -import ai.AbstractNpcAI; - -/** - * Leopard Dragon Hachling AI. - * @author Mobius - */ -public final class LeopardDragonHachling extends AbstractNpcAI -{ - // NPCs - private static final int DRAGON_HACHLING = 23434; - private static final int LEOPARD_DRAGON = 23435; - // Locations - private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); - - { - TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); - TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); - TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); - TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); - } - - private LeopardDragonHachling() - { - addAttackId(DRAGON_HACHLING); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) - { - if (npc.calculateDistance2D(nearestLocation(npc)) < 100) - { - final int random = getRandom(1, 4); - for (int counter = 1; counter < random; counter++) - { - final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time - leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); - addAttackDesire(leopard, player); - } - cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); - npc.deleteMe(); - } - else - { - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - } - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getScriptValue() == 0) - { - npc.setScriptValue(1); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); - startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); - } - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - return null; - } - - private Location nearestLocation(Npc npc) - { - Location gotoLoc = TRANSFORM_LOCATIONS.get(0); - for (Location loc : TRANSFORM_LOCATIONS) - { - if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) - { - gotoLoc = loc; - } - } - return gotoLoc; - } - - public static void main(String[] args) - { - new LeopardDragonHachling(); - } -} +/* + * 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 . + */ +package ai.areas.DragonValley; + +import java.util.ArrayList; +import java.util.List; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; + +import ai.AbstractNpcAI; + +/** + * Leopard Dragon Hachling AI. + * @author Mobius + */ +public final class LeopardDragonHachling extends AbstractNpcAI +{ + // NPCs + private static final int DRAGON_HACHLING = 23434; + private static final int LEOPARD_DRAGON = 23435; + // Locations + private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); + static + { + TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); + TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); + TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); + TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); + } + + private LeopardDragonHachling() + { + addAttackId(DRAGON_HACHLING); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) + { + if (npc.calculateDistance2D(nearestLocation(npc)) < 100) + { + final int random = getRandom(1, 4); + for (int counter = 1; counter < random; counter++) + { + final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time + leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); + addAttackDesire(leopard, player); + } + cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); + npc.deleteMe(); + } + else + { + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getScriptValue() == 0) + { + npc.setScriptValue(1); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); + startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); + } + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + return null; + } + + private Location nearestLocation(Npc npc) + { + Location gotoLoc = TRANSFORM_LOCATIONS.get(0); + for (Location loc : TRANSFORM_LOCATIONS) + { + if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) + { + gotoLoc = loc; + } + } + return gotoLoc; + } + + public static void main(String[] args) + { + new LeopardDragonHachling(); + } +} diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 56d5e6f72b..6ee86b5890 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -109,7 +109,8 @@ public final class Raina extends AbstractNpcAI subclassSetMap.put(PlayerClass.Spellhowler, subclasseSet5); } - private static final Map classCloak = new HashMap<>(); + private static final Map classCloak = new HashMap<>(); + static { classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak classCloak.put(CategoryType.SIXTH_TIR_GROUP, 30311); // Sapyros Cloak Grade @@ -121,7 +122,8 @@ public final class Raina extends AbstractNpcAI classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade } - private static final List dualClassList = new ArrayList<>(); + private static final List dualClassList = new ArrayList<>(); + static { dualClassList.addAll(Arrays.asList(PlayerClass.sigelPhoenixKnight, PlayerClass.sigelHellKnight, PlayerClass.sigelEvasTemplar, PlayerClass.sigelShilenTemplar)); dualClassList.addAll(Arrays.asList(PlayerClass.tyrrDuelist, PlayerClass.tyrrDreadnought, PlayerClass.tyrrTitan, PlayerClass.tyrrGrandKhavatari, PlayerClass.tyrrDoombringer)); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 50cde6735a..5f00d31b76 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java index 43e4f39c22..cdf1faf2e5 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java @@ -55,7 +55,8 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler // NPC private static final int MANAGER = 31688; // Misc - private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + static { EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917); EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_TIR_GROUP, 918); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/AirBind.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/AirBind.java index 72502bc106..9dd9a94a48 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/AirBind.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/AirBind.java @@ -1,121 +1,122 @@ -/* - * 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 . - */ -package handlers.effecthandlers; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.enums.CategoryType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -import com.l2jmobius.gameserver.model.effects.AbstractEffect; -import com.l2jmobius.gameserver.model.effects.EffectType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; - -/** - * @author Mobius - */ -public final class AirBind extends AbstractEffect -{ - // skill data +/* + * 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 . + */ +package handlers.effecthandlers; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.ai.CtrlEvent; +import com.l2jmobius.gameserver.enums.CategoryType; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.effects.EffectType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; + +/** + * @author Mobius + */ +public final class AirBind extends AbstractEffect +{ + // skill data private static final Map _chainedAirSkills = new HashMap<>(36); - { - _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit - } - - public AirBind(StatsSet params) - { - } - - @Override - public boolean isInstant() - { - return false; - } - - @Override - public EffectType getEffectType() - { - return EffectType.KNOCK; - } - - @Override - public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) - { - if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // - && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) - { - final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); - if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) - { - nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); - } - } - } - } - - @Override - public void onExit(Creature effector, Creature effected, Skill skill) - { - if (!effected.isPlayer()) - { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); - } - } -} + static + { + _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit + } + + public AirBind(StatsSet params) + { + } + + @Override + public boolean isInstant() + { + return false; + } + + @Override + public EffectType getEffectType() + { + return EffectType.KNOCK; + } + + @Override + public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) + { + for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) + { + if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // + && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) + { + final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); + if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) + { + nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); + } + } + } + } + + @Override + public void onExit(Creature effector, Creature effected, Skill skill) + { + if (!effected.isPlayer()) + { + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + } + } +} diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java index 0db7363b7a..dad2c3ab1b 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java @@ -55,7 +55,8 @@ public final class KnockBack extends AbstractEffect private final FlyType _type; // skill data - private static final Map _chainKnockSkills = new HashMap<>(36); + private static final Map _chainKnockSkills = new HashMap<>(36); + static { _chainKnockSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10250); // Heavy Hit _chainKnockSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10250); // Heavy Hit diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index 4adcae3410..843796d5fb 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,86 +1,87 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index 7095ed3e8f..5579e917ad 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -46,7 +46,8 @@ public final class Q00032_AnObviousLie extends Quest // Misc private static final int MIN_LVL = 45; // Reward - private static final Map EARS = new HashMap<>(); + private static final Map EARS = new HashMap<>(); + static { EARS.put("cat", 6843); // Cat Ears EARS.put("raccoon", 7680); // Raccoon ears diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 9dc74f2400..48a298ea2e 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -45,7 +45,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - + static { MONSTER_CHANCES.put(20236, 0.58); // Cave Servant MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java index d0eff540a6..de442f202a 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -106,7 +106,8 @@ public final class Q00420_LittleWing extends Quest private static final int HATCHLING_FOOD = 4038; private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); // Drake Drops - private static final Map EGG_DROPS = new HashMap<>(); + private static final Map EGG_DROPS = new HashMap<>(); + static { EGG_DROPS.put(LESSER_BASILISK, SHAMHAI_EGG); EGG_DROPS.put(BASILISK, SHAMHAI_EGG); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q10790_AMercenaryHelper/Q10790_AMercenaryHelper.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q10790_AMercenaryHelper/Q10790_AMercenaryHelper.java index 8bbe632111..2708f8af09 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q10790_AMercenaryHelper/Q10790_AMercenaryHelper.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/quests/Q10790_AMercenaryHelper/Q10790_AMercenaryHelper.java @@ -1,194 +1,195 @@ -/* - * 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 . - */ -package quests.Q10790_AMercenaryHelper; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -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; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.ExQuestNpcLogList; -import com.l2jmobius.gameserver.util.Util; - -/** - * A Mercenary Helper (10790) - * @author Stayway - */ -public class Q10790_AMercenaryHelper extends Quest -{ - // NPC - private static final int DOKARA = 33847; - // Monsters - private static final int SPLINTER_STAKATO = 21508; - private static final int SPLINTER_STAKATO_WORKER = 21509; - private static final int SPLINTER_STAKATO_SOLDIER = 21510; - private static final int SPLINTER_STAKATO_DRONE = 21511; - private static final int NEEDLE_STAKATO = 21513; - private static final int NEEDLE_STAKATO_WORKER = 21514; - private static final int NEEDLE_STAKATO_SOLDIER = 21515; - private static final int NEEDLE_STAKATO_DRONE = 21516; +/* + * 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 . + */ +package quests.Q10790_AMercenaryHelper; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +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; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.ExQuestNpcLogList; +import com.l2jmobius.gameserver.util.Util; + +/** + * A Mercenary Helper (10790) + * @author Stayway + */ +public class Q10790_AMercenaryHelper extends Quest +{ + // NPC + private static final int DOKARA = 33847; + // Monsters + private static final int SPLINTER_STAKATO = 21508; + private static final int SPLINTER_STAKATO_WORKER = 21509; + private static final int SPLINTER_STAKATO_SOLDIER = 21510; + private static final int SPLINTER_STAKATO_DRONE = 21511; + private static final int NEEDLE_STAKATO = 21513; + private static final int NEEDLE_STAKATO_WORKER = 21514; + private static final int NEEDLE_STAKATO_SOLDIER = 21515; + private static final int NEEDLE_STAKATO_DRONE = 21516; private static final Map MOBS_REQUIRED = new HashMap<>(); - { - MOBS_REQUIRED.put(SPLINTER_STAKATO, 50); - } - // Item - private static final ItemHolder GUILD_COIN = new ItemHolder(37045, 3); - private static final ItemHolder ENCHANT_ARMOR_A = new ItemHolder(26351, 3); - // Rewards - private static final int EXP_REWARD = 942690; - private static final int SP_REWARD = 226; - // Other - private static final int MIN_LEVEL = 65; - private static final int MAX_LEVEL = 70; - - public Q10790_AMercenaryHelper() - { - super(10790); - addStartNpc(DOKARA); - addTalkId(DOKARA); - addKillId(SPLINTER_STAKATO, SPLINTER_STAKATO_WORKER, SPLINTER_STAKATO_SOLDIER, SPLINTER_STAKATO_DRONE, NEEDLE_STAKATO, NEEDLE_STAKATO_WORKER, NEEDLE_STAKATO_SOLDIER, NEEDLE_STAKATO_DRONE); - addCondMinLevel(MIN_LEVEL, "no_level.htm"); - addCondRace(Race.ERTHEIA, "no Ertheia.html"); - addCondClassId(ClassId.MARAUDER, "no_class.html"); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs == null) - { - return null; - } - - String htmltext = null; - switch (event) - { - case "33847-02.htm": - case "33847-03.htm": - { - htmltext = event; - break; - } - case "33847-04.htm": // start the quest - { - qs.startQuest(); - qs.set(Integer.toString(SPLINTER_STAKATO), 0); - htmltext = event; - break; - } - case "33847-07.html": - { - if (qs.isCond(2)) - { - giveItems(player, GUILD_COIN); - giveItems(player, ENCHANT_ARMOR_A); - addExpAndSp(player, EXP_REWARD, SP_REWARD); - qs.exitQuest(false, true); - htmltext = event; - } - break; - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, true); - String htmltext = null; - switch (qs.getState()) - { - case State.CREATED: - { - if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL)) - { - htmltext = "no_level.html"; - } - else - { - htmltext = "33847-01.htm"; - } - break; - } - case State.STARTED: - { - if (qs.isCond(1)) - { - htmltext = "33847-05.html"; // Need find proper html - } - else if (qs.isCond(2)) - { - htmltext = "33847-06.html"; - } - break; - } - case State.COMPLETED: - { - htmltext = getAlreadyCompletedMsg(player); - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if ((qs != null) && qs.isStarted() && qs.isCond(1) && Util.checkIfInRange(1500, npc, qs.getPlayer(), false)) - { - int kills = 0; - switch (npc.getId()) - { - case SPLINTER_STAKATO: - case SPLINTER_STAKATO_WORKER: - case SPLINTER_STAKATO_SOLDIER: - case SPLINTER_STAKATO_DRONE: - case NEEDLE_STAKATO: - case NEEDLE_STAKATO_WORKER: - case NEEDLE_STAKATO_SOLDIER: - case NEEDLE_STAKATO_DRONE: - { - kills = qs.getInt(Integer.toString(SPLINTER_STAKATO)); - kills++; - qs.set(Integer.toString(SPLINTER_STAKATO), kills); - break; - } - } - - final ExQuestNpcLogList log = new ExQuestNpcLogList(getId()); - log.addNpc(SPLINTER_STAKATO, qs.getInt(Integer.toString(SPLINTER_STAKATO))); - log.addNpcString(NpcStringId.KILL_STAKATOS, qs.getInt(Integer.toString(SPLINTER_STAKATO))); - killer.sendPacket(log); - - if ((qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO)) && (qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO))) - { - qs.setCond(2); - } - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MOBS_REQUIRED.put(SPLINTER_STAKATO, 50); + } + // Item + private static final ItemHolder GUILD_COIN = new ItemHolder(37045, 3); + private static final ItemHolder ENCHANT_ARMOR_A = new ItemHolder(26351, 3); + // Rewards + private static final int EXP_REWARD = 942690; + private static final int SP_REWARD = 226; + // Other + private static final int MIN_LEVEL = 65; + private static final int MAX_LEVEL = 70; + + public Q10790_AMercenaryHelper() + { + super(10790); + addStartNpc(DOKARA); + addTalkId(DOKARA); + addKillId(SPLINTER_STAKATO, SPLINTER_STAKATO_WORKER, SPLINTER_STAKATO_SOLDIER, SPLINTER_STAKATO_DRONE, NEEDLE_STAKATO, NEEDLE_STAKATO_WORKER, NEEDLE_STAKATO_SOLDIER, NEEDLE_STAKATO_DRONE); + addCondMinLevel(MIN_LEVEL, "no_level.htm"); + addCondRace(Race.ERTHEIA, "no Ertheia.html"); + addCondClassId(ClassId.MARAUDER, "no_class.html"); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return null; + } + + String htmltext = null; + switch (event) + { + case "33847-02.htm": + case "33847-03.htm": + { + htmltext = event; + break; + } + case "33847-04.htm": // start the quest + { + qs.startQuest(); + qs.set(Integer.toString(SPLINTER_STAKATO), 0); + htmltext = event; + break; + } + case "33847-07.html": + { + if (qs.isCond(2)) + { + giveItems(player, GUILD_COIN); + giveItems(player, ENCHANT_ARMOR_A); + addExpAndSp(player, EXP_REWARD, SP_REWARD); + qs.exitQuest(false, true); + htmltext = event; + } + break; + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, true); + String htmltext = null; + switch (qs.getState()) + { + case State.CREATED: + { + if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL)) + { + htmltext = "no_level.html"; + } + else + { + htmltext = "33847-01.htm"; + } + break; + } + case State.STARTED: + { + if (qs.isCond(1)) + { + htmltext = "33847-05.html"; // Need find proper html + } + else if (qs.isCond(2)) + { + htmltext = "33847-06.html"; + } + break; + } + case State.COMPLETED: + { + htmltext = getAlreadyCompletedMsg(player); + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); + if ((qs != null) && qs.isStarted() && qs.isCond(1) && Util.checkIfInRange(1500, npc, qs.getPlayer(), false)) + { + int kills = 0; + switch (npc.getId()) + { + case SPLINTER_STAKATO: + case SPLINTER_STAKATO_WORKER: + case SPLINTER_STAKATO_SOLDIER: + case SPLINTER_STAKATO_DRONE: + case NEEDLE_STAKATO: + case NEEDLE_STAKATO_WORKER: + case NEEDLE_STAKATO_SOLDIER: + case NEEDLE_STAKATO_DRONE: + { + kills = qs.getInt(Integer.toString(SPLINTER_STAKATO)); + kills++; + qs.set(Integer.toString(SPLINTER_STAKATO), kills); + break; + } + } + + final ExQuestNpcLogList log = new ExQuestNpcLogList(getId()); + log.addNpc(SPLINTER_STAKATO, qs.getInt(Integer.toString(SPLINTER_STAKATO))); + log.addNpcString(NpcStringId.KILL_STAKATOS, qs.getInt(Integer.toString(SPLINTER_STAKATO))); + killer.sendPacket(log); + + if ((qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO)) && (qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO))) + { + qs.setCond(2); + } + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/exp4j/Operators.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/exp4j/Operators.java index ca28599f0c..649327cd88 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/exp4j/Operators.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/exp4j/Operators.java @@ -27,7 +27,6 @@ public abstract class Operators private static final int INDEX_UNARYPLUS = 7; private static final Operator[] builtinOperators = new Operator[8]; - static { builtinOperators[INDEX_ADDITION] = new Operator("+", 2, true, Operator.PRECEDENCE_ADDITION) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java index 250742c433..92321be894 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java @@ -1,114 +1,114 @@ -/* - * 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 . - */ -package ai.areas.DragonValley; - -import java.util.ArrayList; -import java.util.List; - -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; - -import ai.AbstractNpcAI; - -/** - * Leopard Dragon Hachling AI. - * @author Mobius - */ -public final class LeopardDragonHachling extends AbstractNpcAI -{ - // NPCs - private static final int DRAGON_HACHLING = 23434; - private static final int LEOPARD_DRAGON = 23435; - // Locations - private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); - - { - TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); - TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); - TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); - TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); - } - - private LeopardDragonHachling() - { - addAttackId(DRAGON_HACHLING); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) - { - if (npc.calculateDistance2D(nearestLocation(npc)) < 100) - { - final int random = getRandom(1, 4); - for (int counter = 1; counter < random; counter++) - { - final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time - leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); - addAttackDesire(leopard, player); - } - cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); - npc.deleteMe(); - } - else - { - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - } - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getScriptValue() == 0) - { - npc.setScriptValue(1); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); - startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); - } - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - return null; - } - - private Location nearestLocation(Npc npc) - { - Location gotoLoc = TRANSFORM_LOCATIONS.get(0); - for (Location loc : TRANSFORM_LOCATIONS) - { - if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) - { - gotoLoc = loc; - } - } - return gotoLoc; - } - - public static void main(String[] args) - { - new LeopardDragonHachling(); - } -} +/* + * 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 . + */ +package ai.areas.DragonValley; + +import java.util.ArrayList; +import java.util.List; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; + +import ai.AbstractNpcAI; + +/** + * Leopard Dragon Hachling AI. + * @author Mobius + */ +public final class LeopardDragonHachling extends AbstractNpcAI +{ + // NPCs + private static final int DRAGON_HACHLING = 23434; + private static final int LEOPARD_DRAGON = 23435; + // Locations + private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); + static + { + TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); + TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); + TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); + TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); + } + + private LeopardDragonHachling() + { + addAttackId(DRAGON_HACHLING); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) + { + if (npc.calculateDistance2D(nearestLocation(npc)) < 100) + { + final int random = getRandom(1, 4); + for (int counter = 1; counter < random; counter++) + { + final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time + leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); + addAttackDesire(leopard, player); + } + cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); + npc.deleteMe(); + } + else + { + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getScriptValue() == 0) + { + npc.setScriptValue(1); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); + startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); + } + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + return null; + } + + private Location nearestLocation(Npc npc) + { + Location gotoLoc = TRANSFORM_LOCATIONS.get(0); + for (Location loc : TRANSFORM_LOCATIONS) + { + if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) + { + gotoLoc = loc; + } + } + return gotoLoc; + } + + public static void main(String[] args) + { + new LeopardDragonHachling(); + } +} diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 56d5e6f72b..6ee86b5890 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -109,7 +109,8 @@ public final class Raina extends AbstractNpcAI subclassSetMap.put(PlayerClass.Spellhowler, subclasseSet5); } - private static final Map classCloak = new HashMap<>(); + private static final Map classCloak = new HashMap<>(); + static { classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak classCloak.put(CategoryType.SIXTH_TIR_GROUP, 30311); // Sapyros Cloak Grade @@ -121,7 +122,8 @@ public final class Raina extends AbstractNpcAI classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade } - private static final List dualClassList = new ArrayList<>(); + private static final List dualClassList = new ArrayList<>(); + static { dualClassList.addAll(Arrays.asList(PlayerClass.sigelPhoenixKnight, PlayerClass.sigelHellKnight, PlayerClass.sigelEvasTemplar, PlayerClass.sigelShilenTemplar)); dualClassList.addAll(Arrays.asList(PlayerClass.tyrrDuelist, PlayerClass.tyrrDreadnought, PlayerClass.tyrrTitan, PlayerClass.tyrrGrandKhavatari, PlayerClass.tyrrDoombringer)); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 5a1d30c11d..5d532b9704 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java index f85993288a..206e585ab2 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java @@ -55,7 +55,8 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler // NPC private static final int MANAGER = 31688; // Misc - private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + static { EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917); EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_TIR_GROUP, 918); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/AirBind.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/AirBind.java index 72502bc106..9dd9a94a48 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/AirBind.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/AirBind.java @@ -1,121 +1,122 @@ -/* - * 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 . - */ -package handlers.effecthandlers; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.enums.CategoryType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -import com.l2jmobius.gameserver.model.effects.AbstractEffect; -import com.l2jmobius.gameserver.model.effects.EffectType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; - -/** - * @author Mobius - */ -public final class AirBind extends AbstractEffect -{ - // skill data +/* + * 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 . + */ +package handlers.effecthandlers; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.ai.CtrlEvent; +import com.l2jmobius.gameserver.enums.CategoryType; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.effects.EffectType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; + +/** + * @author Mobius + */ +public final class AirBind extends AbstractEffect +{ + // skill data private static final Map _chainedAirSkills = new HashMap<>(36); - { - _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit - } - - public AirBind(StatsSet params) - { - } - - @Override - public boolean isInstant() - { - return false; - } - - @Override - public EffectType getEffectType() - { - return EffectType.KNOCK; - } - - @Override - public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) - { - if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // - && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) - { - final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); - if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) - { - nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); - } - } - } - } - - @Override - public void onExit(Creature effector, Creature effected, Skill skill) - { - if (!effected.isPlayer()) - { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); - } - } -} + static + { + _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit + } + + public AirBind(StatsSet params) + { + } + + @Override + public boolean isInstant() + { + return false; + } + + @Override + public EffectType getEffectType() + { + return EffectType.KNOCK; + } + + @Override + public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) + { + for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) + { + if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // + && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) + { + final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); + if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) + { + nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); + } + } + } + } + + @Override + public void onExit(Creature effector, Creature effected, Skill skill) + { + if (!effected.isPlayer()) + { + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + } + } +} diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java index 0db7363b7a..dad2c3ab1b 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java @@ -55,7 +55,8 @@ public final class KnockBack extends AbstractEffect private final FlyType _type; // skill data - private static final Map _chainKnockSkills = new HashMap<>(36); + private static final Map _chainKnockSkills = new HashMap<>(36); + static { _chainKnockSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10250); // Heavy Hit _chainKnockSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10250); // Heavy Hit diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index 7095ed3e8f..5579e917ad 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -46,7 +46,8 @@ public final class Q00032_AnObviousLie extends Quest // Misc private static final int MIN_LVL = 45; // Reward - private static final Map EARS = new HashMap<>(); + private static final Map EARS = new HashMap<>(); + static { EARS.put("cat", 6843); // Cat Ears EARS.put("raccoon", 7680); // Raccoon ears diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 9dc74f2400..48a298ea2e 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -45,7 +45,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - + static { MONSTER_CHANCES.put(20236, 0.58); // Cave Servant MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java index b5345ac8e9..90acf3183b 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -103,7 +103,8 @@ public final class Q00420_LittleWing extends Quest private static final int HATCHLING_FOOD = 4038; private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); // Drake Drops - private static final Map EGG_DROPS = new HashMap<>(); + private static final Map EGG_DROPS = new HashMap<>(); + static { EGG_DROPS.put(LESSER_BASILISK, SHAMHAI_EGG); EGG_DROPS.put(BASILISK, SHAMHAI_EGG); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q10790_AMercenaryHelper/Q10790_AMercenaryHelper.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q10790_AMercenaryHelper/Q10790_AMercenaryHelper.java index 8bbe632111..2708f8af09 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q10790_AMercenaryHelper/Q10790_AMercenaryHelper.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/quests/Q10790_AMercenaryHelper/Q10790_AMercenaryHelper.java @@ -1,194 +1,195 @@ -/* - * 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 . - */ -package quests.Q10790_AMercenaryHelper; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -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; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.ExQuestNpcLogList; -import com.l2jmobius.gameserver.util.Util; - -/** - * A Mercenary Helper (10790) - * @author Stayway - */ -public class Q10790_AMercenaryHelper extends Quest -{ - // NPC - private static final int DOKARA = 33847; - // Monsters - private static final int SPLINTER_STAKATO = 21508; - private static final int SPLINTER_STAKATO_WORKER = 21509; - private static final int SPLINTER_STAKATO_SOLDIER = 21510; - private static final int SPLINTER_STAKATO_DRONE = 21511; - private static final int NEEDLE_STAKATO = 21513; - private static final int NEEDLE_STAKATO_WORKER = 21514; - private static final int NEEDLE_STAKATO_SOLDIER = 21515; - private static final int NEEDLE_STAKATO_DRONE = 21516; +/* + * 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 . + */ +package quests.Q10790_AMercenaryHelper; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +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; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.ExQuestNpcLogList; +import com.l2jmobius.gameserver.util.Util; + +/** + * A Mercenary Helper (10790) + * @author Stayway + */ +public class Q10790_AMercenaryHelper extends Quest +{ + // NPC + private static final int DOKARA = 33847; + // Monsters + private static final int SPLINTER_STAKATO = 21508; + private static final int SPLINTER_STAKATO_WORKER = 21509; + private static final int SPLINTER_STAKATO_SOLDIER = 21510; + private static final int SPLINTER_STAKATO_DRONE = 21511; + private static final int NEEDLE_STAKATO = 21513; + private static final int NEEDLE_STAKATO_WORKER = 21514; + private static final int NEEDLE_STAKATO_SOLDIER = 21515; + private static final int NEEDLE_STAKATO_DRONE = 21516; private static final Map MOBS_REQUIRED = new HashMap<>(); - { - MOBS_REQUIRED.put(SPLINTER_STAKATO, 50); - } - // Item - private static final ItemHolder GUILD_COIN = new ItemHolder(37045, 3); - private static final ItemHolder ENCHANT_ARMOR_A = new ItemHolder(26351, 3); - // Rewards - private static final int EXP_REWARD = 942690; - private static final int SP_REWARD = 226; - // Other - private static final int MIN_LEVEL = 65; - private static final int MAX_LEVEL = 70; - - public Q10790_AMercenaryHelper() - { - super(10790); - addStartNpc(DOKARA); - addTalkId(DOKARA); - addKillId(SPLINTER_STAKATO, SPLINTER_STAKATO_WORKER, SPLINTER_STAKATO_SOLDIER, SPLINTER_STAKATO_DRONE, NEEDLE_STAKATO, NEEDLE_STAKATO_WORKER, NEEDLE_STAKATO_SOLDIER, NEEDLE_STAKATO_DRONE); - addCondMinLevel(MIN_LEVEL, "no_level.htm"); - addCondRace(Race.ERTHEIA, "no Ertheia.html"); - addCondClassId(ClassId.MARAUDER, "no_class.html"); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs == null) - { - return null; - } - - String htmltext = null; - switch (event) - { - case "33847-02.htm": - case "33847-03.htm": - { - htmltext = event; - break; - } - case "33847-04.htm": // start the quest - { - qs.startQuest(); - qs.set(Integer.toString(SPLINTER_STAKATO), 0); - htmltext = event; - break; - } - case "33847-07.html": - { - if (qs.isCond(2)) - { - giveItems(player, GUILD_COIN); - giveItems(player, ENCHANT_ARMOR_A); - addExpAndSp(player, EXP_REWARD, SP_REWARD); - qs.exitQuest(false, true); - htmltext = event; - } - break; - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, true); - String htmltext = null; - switch (qs.getState()) - { - case State.CREATED: - { - if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL)) - { - htmltext = "no_level.html"; - } - else - { - htmltext = "33847-01.htm"; - } - break; - } - case State.STARTED: - { - if (qs.isCond(1)) - { - htmltext = "33847-05.html"; // Need find proper html - } - else if (qs.isCond(2)) - { - htmltext = "33847-06.html"; - } - break; - } - case State.COMPLETED: - { - htmltext = getAlreadyCompletedMsg(player); - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if ((qs != null) && qs.isStarted() && qs.isCond(1) && Util.checkIfInRange(1500, npc, qs.getPlayer(), false)) - { - int kills = 0; - switch (npc.getId()) - { - case SPLINTER_STAKATO: - case SPLINTER_STAKATO_WORKER: - case SPLINTER_STAKATO_SOLDIER: - case SPLINTER_STAKATO_DRONE: - case NEEDLE_STAKATO: - case NEEDLE_STAKATO_WORKER: - case NEEDLE_STAKATO_SOLDIER: - case NEEDLE_STAKATO_DRONE: - { - kills = qs.getInt(Integer.toString(SPLINTER_STAKATO)); - kills++; - qs.set(Integer.toString(SPLINTER_STAKATO), kills); - break; - } - } - - final ExQuestNpcLogList log = new ExQuestNpcLogList(getId()); - log.addNpc(SPLINTER_STAKATO, qs.getInt(Integer.toString(SPLINTER_STAKATO))); - log.addNpcString(NpcStringId.KILL_STAKATOS, qs.getInt(Integer.toString(SPLINTER_STAKATO))); - killer.sendPacket(log); - - if ((qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO)) && (qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO))) - { - qs.setCond(2); - } - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MOBS_REQUIRED.put(SPLINTER_STAKATO, 50); + } + // Item + private static final ItemHolder GUILD_COIN = new ItemHolder(37045, 3); + private static final ItemHolder ENCHANT_ARMOR_A = new ItemHolder(26351, 3); + // Rewards + private static final int EXP_REWARD = 942690; + private static final int SP_REWARD = 226; + // Other + private static final int MIN_LEVEL = 65; + private static final int MAX_LEVEL = 70; + + public Q10790_AMercenaryHelper() + { + super(10790); + addStartNpc(DOKARA); + addTalkId(DOKARA); + addKillId(SPLINTER_STAKATO, SPLINTER_STAKATO_WORKER, SPLINTER_STAKATO_SOLDIER, SPLINTER_STAKATO_DRONE, NEEDLE_STAKATO, NEEDLE_STAKATO_WORKER, NEEDLE_STAKATO_SOLDIER, NEEDLE_STAKATO_DRONE); + addCondMinLevel(MIN_LEVEL, "no_level.htm"); + addCondRace(Race.ERTHEIA, "no Ertheia.html"); + addCondClassId(ClassId.MARAUDER, "no_class.html"); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return null; + } + + String htmltext = null; + switch (event) + { + case "33847-02.htm": + case "33847-03.htm": + { + htmltext = event; + break; + } + case "33847-04.htm": // start the quest + { + qs.startQuest(); + qs.set(Integer.toString(SPLINTER_STAKATO), 0); + htmltext = event; + break; + } + case "33847-07.html": + { + if (qs.isCond(2)) + { + giveItems(player, GUILD_COIN); + giveItems(player, ENCHANT_ARMOR_A); + addExpAndSp(player, EXP_REWARD, SP_REWARD); + qs.exitQuest(false, true); + htmltext = event; + } + break; + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, true); + String htmltext = null; + switch (qs.getState()) + { + case State.CREATED: + { + if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL)) + { + htmltext = "no_level.html"; + } + else + { + htmltext = "33847-01.htm"; + } + break; + } + case State.STARTED: + { + if (qs.isCond(1)) + { + htmltext = "33847-05.html"; // Need find proper html + } + else if (qs.isCond(2)) + { + htmltext = "33847-06.html"; + } + break; + } + case State.COMPLETED: + { + htmltext = getAlreadyCompletedMsg(player); + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); + if ((qs != null) && qs.isStarted() && qs.isCond(1) && Util.checkIfInRange(1500, npc, qs.getPlayer(), false)) + { + int kills = 0; + switch (npc.getId()) + { + case SPLINTER_STAKATO: + case SPLINTER_STAKATO_WORKER: + case SPLINTER_STAKATO_SOLDIER: + case SPLINTER_STAKATO_DRONE: + case NEEDLE_STAKATO: + case NEEDLE_STAKATO_WORKER: + case NEEDLE_STAKATO_SOLDIER: + case NEEDLE_STAKATO_DRONE: + { + kills = qs.getInt(Integer.toString(SPLINTER_STAKATO)); + kills++; + qs.set(Integer.toString(SPLINTER_STAKATO), kills); + break; + } + } + + final ExQuestNpcLogList log = new ExQuestNpcLogList(getId()); + log.addNpc(SPLINTER_STAKATO, qs.getInt(Integer.toString(SPLINTER_STAKATO))); + log.addNpcString(NpcStringId.KILL_STAKATOS, qs.getInt(Integer.toString(SPLINTER_STAKATO))); + killer.sendPacket(log); + + if ((qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO)) && (qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO))) + { + qs.setCond(2); + } + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/exp4j/Operators.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/exp4j/Operators.java index ca28599f0c..649327cd88 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/exp4j/Operators.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/exp4j/Operators.java @@ -27,7 +27,6 @@ public abstract class Operators private static final int INDEX_UNARYPLUS = 7; private static final Operator[] builtinOperators = new Operator[8]; - static { builtinOperators[INDEX_ADDITION] = new Operator("+", 2, true, Operator.PRECEDENCE_ADDITION) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java index 250742c433..92321be894 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java @@ -1,114 +1,114 @@ -/* - * 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 . - */ -package ai.areas.DragonValley; - -import java.util.ArrayList; -import java.util.List; - -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; - -import ai.AbstractNpcAI; - -/** - * Leopard Dragon Hachling AI. - * @author Mobius - */ -public final class LeopardDragonHachling extends AbstractNpcAI -{ - // NPCs - private static final int DRAGON_HACHLING = 23434; - private static final int LEOPARD_DRAGON = 23435; - // Locations - private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); - - { - TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); - TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); - TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); - TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); - } - - private LeopardDragonHachling() - { - addAttackId(DRAGON_HACHLING); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) - { - if (npc.calculateDistance2D(nearestLocation(npc)) < 100) - { - final int random = getRandom(1, 4); - for (int counter = 1; counter < random; counter++) - { - final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time - leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); - addAttackDesire(leopard, player); - } - cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); - npc.deleteMe(); - } - else - { - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - } - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getScriptValue() == 0) - { - npc.setScriptValue(1); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); - startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); - } - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - return null; - } - - private Location nearestLocation(Npc npc) - { - Location gotoLoc = TRANSFORM_LOCATIONS.get(0); - for (Location loc : TRANSFORM_LOCATIONS) - { - if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) - { - gotoLoc = loc; - } - } - return gotoLoc; - } - - public static void main(String[] args) - { - new LeopardDragonHachling(); - } -} +/* + * 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 . + */ +package ai.areas.DragonValley; + +import java.util.ArrayList; +import java.util.List; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; + +import ai.AbstractNpcAI; + +/** + * Leopard Dragon Hachling AI. + * @author Mobius + */ +public final class LeopardDragonHachling extends AbstractNpcAI +{ + // NPCs + private static final int DRAGON_HACHLING = 23434; + private static final int LEOPARD_DRAGON = 23435; + // Locations + private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); + static + { + TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); + TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); + TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); + TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); + } + + private LeopardDragonHachling() + { + addAttackId(DRAGON_HACHLING); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) + { + if (npc.calculateDistance2D(nearestLocation(npc)) < 100) + { + final int random = getRandom(1, 4); + for (int counter = 1; counter < random; counter++) + { + final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time + leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); + addAttackDesire(leopard, player); + } + cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); + npc.deleteMe(); + } + else + { + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getScriptValue() == 0) + { + npc.setScriptValue(1); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); + startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); + } + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + return null; + } + + private Location nearestLocation(Npc npc) + { + Location gotoLoc = TRANSFORM_LOCATIONS.get(0); + for (Location loc : TRANSFORM_LOCATIONS) + { + if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) + { + gotoLoc = loc; + } + } + return gotoLoc; + } + + public static void main(String[] args) + { + new LeopardDragonHachling(); + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 56d5e6f72b..6ee86b5890 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -109,7 +109,8 @@ public final class Raina extends AbstractNpcAI subclassSetMap.put(PlayerClass.Spellhowler, subclasseSet5); } - private static final Map classCloak = new HashMap<>(); + private static final Map classCloak = new HashMap<>(); + static { classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak classCloak.put(CategoryType.SIXTH_TIR_GROUP, 30311); // Sapyros Cloak Grade @@ -121,7 +122,8 @@ public final class Raina extends AbstractNpcAI classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade } - private static final List dualClassList = new ArrayList<>(); + private static final List dualClassList = new ArrayList<>(); + static { dualClassList.addAll(Arrays.asList(PlayerClass.sigelPhoenixKnight, PlayerClass.sigelHellKnight, PlayerClass.sigelEvasTemplar, PlayerClass.sigelShilenTemplar)); dualClassList.addAll(Arrays.asList(PlayerClass.tyrrDuelist, PlayerClass.tyrrDreadnought, PlayerClass.tyrrTitan, PlayerClass.tyrrGrandKhavatari, PlayerClass.tyrrDoombringer)); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java index 9446ef4413..4f046f6532 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java @@ -1,491 +1,495 @@ -/* - * 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 . - */ -package ai.others.AdventureGuildsman; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.util.CommonUtil; -import com.l2jmobius.gameserver.data.xml.impl.MultisellData; -import com.l2jmobius.gameserver.enums.CategoryType; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.holders.SkillHolder; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.skills.SkillCaster; -import com.l2jmobius.gameserver.network.serverpackets.ExShowQuestInfo; - -import ai.AbstractNpcAI; - -/** - * Adventure Guildsman AI. - * @author ChaosPaladin - */ -public class AdventureGuildsman extends AbstractNpcAI -{ - // NPC - private static final int ADVENTURE_GUILDSMAN = 33946; - // Items - private static final int PCCAFE_LOTTERY_TICKET_30DAYS = 15358; - private static final int PCCAFE_1ST_LOTTERY_TICKET_30DAYS = 15359; - private static final int PCCAFE_2ND_LOTTERY_TICKET_30DAYS = 15360; - private static final int PCCAFE_3RD_LOTTERY_TICKET_30DAYS = 15361; - private static final int PCCAFE_4TH_LOTTERY_TICKET_30DAYS = 15362; - private static final int PCCAFE_5TH_LOTTERY_TICKET_30DAYS = 15363; - private static final int VOUCHER_LEV_85 = 17739; - private static final int VOUCHER_LEV_90 = 17740; - private static final int VOUCHER_LEV_95 = 17741; - private static final int VOUCHER_LEV_97 = 17742; - private static final int SEAL_LEV_85 = 17743; - private static final int SEAL_LEV_90 = 17744; - private static final int SEAL_LEV_95 = 17745; - private static final int SEAL_LEV_97 = 17746; - // Skills - private static final SkillHolder KNIGHT = new SkillHolder(17294, 1); // Player Commendation - Knight's Harmony - private static final SkillHolder WARRIOR = new SkillHolder(17295, 1); // Player Commendation - Warrior's Harmony - private static final SkillHolder WIZARD = new SkillHolder(17296, 1); // Player Commendation - Wizard's Harmony - private static final SkillHolder[] GROUP_MELODY = - { - new SkillHolder(9273, 1), // Player Commendation - Horn Melody - new SkillHolder(9274, 1), // Player Commendation - Drum Melody - new SkillHolder(9275, 1), // Player Commendation - Lute Melody - new SkillHolder(9276, 1), // Player Commendation - Pipe Organ Melody - new SkillHolder(9277, 1), // Player Commendation - Guitar Melody - new SkillHolder(9278, 1), // Player Commendation - Harp Melody - }; - private static final SkillHolder[] GROUP_SONATA = - { - new SkillHolder(17291, 1), // Player Commendation - Prevailing Sonata - new SkillHolder(17292, 1), // Player Commendation - Daring Sonata - new SkillHolder(17293, 1), // Player Commendation - Refreshing Sonata - }; - // Misc - //@formatter:off +/* + * 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 . + */ +package ai.others.AdventureGuildsman; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.util.CommonUtil; +import com.l2jmobius.gameserver.data.xml.impl.MultisellData; +import com.l2jmobius.gameserver.enums.CategoryType; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.skills.SkillCaster; +import com.l2jmobius.gameserver.network.serverpackets.ExShowQuestInfo; + +import ai.AbstractNpcAI; + +/** + * Adventure Guildsman AI. + * @author ChaosPaladin + */ +public class AdventureGuildsman extends AbstractNpcAI +{ + // NPC + private static final int ADVENTURE_GUILDSMAN = 33946; + // Items + private static final int PCCAFE_LOTTERY_TICKET_30DAYS = 15358; + private static final int PCCAFE_1ST_LOTTERY_TICKET_30DAYS = 15359; + private static final int PCCAFE_2ND_LOTTERY_TICKET_30DAYS = 15360; + private static final int PCCAFE_3RD_LOTTERY_TICKET_30DAYS = 15361; + private static final int PCCAFE_4TH_LOTTERY_TICKET_30DAYS = 15362; + private static final int PCCAFE_5TH_LOTTERY_TICKET_30DAYS = 15363; + private static final int VOUCHER_LEV_85 = 17739; + private static final int VOUCHER_LEV_90 = 17740; + private static final int VOUCHER_LEV_95 = 17741; + private static final int VOUCHER_LEV_97 = 17742; + private static final int SEAL_LEV_85 = 17743; + private static final int SEAL_LEV_90 = 17744; + private static final int SEAL_LEV_95 = 17745; + private static final int SEAL_LEV_97 = 17746; + // Skills + private static final SkillHolder KNIGHT = new SkillHolder(17294, 1); // Player Commendation - Knight's Harmony + private static final SkillHolder WARRIOR = new SkillHolder(17295, 1); // Player Commendation - Warrior's Harmony + private static final SkillHolder WIZARD = new SkillHolder(17296, 1); // Player Commendation - Wizard's Harmony + private static final SkillHolder[] GROUP_MELODY = + { + new SkillHolder(9273, 1), // Player Commendation - Horn Melody + new SkillHolder(9274, 1), // Player Commendation - Drum Melody + new SkillHolder(9275, 1), // Player Commendation - Lute Melody + new SkillHolder(9276, 1), // Player Commendation - Pipe Organ Melody + new SkillHolder(9277, 1), // Player Commendation - Guitar Melody + new SkillHolder(9278, 1), // Player Commendation - Harp Melody + }; + private static final SkillHolder[] GROUP_SONATA = + { + new SkillHolder(17291, 1), // Player Commendation - Prevailing Sonata + new SkillHolder(17292, 1), // Player Commendation - Daring Sonata + new SkillHolder(17293, 1), // Player Commendation - Refreshing Sonata + }; + // Misc + //@formatter:off private static final Map R_CLASS_TALISMAN = new HashMap<>(); - { - R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735); - R_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 736); - R_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 737); - R_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 738); - R_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 739); - R_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 740); - R_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 741); - R_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 742); - R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736); - R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741); - } + static + { + R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735); + R_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 736); + R_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 737); + R_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 738); + R_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 739); + R_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 740); + R_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 741); + R_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 742); + R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736); + R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741); + } private static final Map R90_CLASS_TALISMAN = new HashMap<>(); - { - R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743); - R90_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 744); - R90_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 745); - R90_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 746); - R90_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 747); - R90_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 748); - R90_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 749); - R90_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 750); - R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744); - R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749); - } + static + { + R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743); + R90_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 744); + R90_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 745); + R90_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 746); + R90_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 747); + R90_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 748); + R90_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 749); + R90_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 750); + R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744); + R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749); + } private static final Map R95_CLASS_TALISMAN = new HashMap<>(); - { - R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751); - R95_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 752); - R95_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 753); - R95_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 754); - R95_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 755); - R95_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 756); - R95_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 757); - R95_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 758); - R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752); - R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757); - } + static + { + R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751); + R95_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 752); + R95_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 753); + R95_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 754); + R95_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 755); + R95_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 756); + R95_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 757); + R95_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 758); + R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752); + R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757); + } private static final Map R99_CLASS_TALISMAN = new HashMap<>(); - { - R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759); - R99_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 760); - R99_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 761); - R99_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 762); - R99_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 763); - R99_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 764); - R99_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 765); - R99_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 766); - R99_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 760); - R99_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 765); - } - //@formatter:on - private static final String USED_PC_LOTTERY_TICKET = "USED_PC_LOTTERY_TICKET"; - - private AdventureGuildsman() - { - addStartNpc(ADVENTURE_GUILDSMAN); - addTalkId(ADVENTURE_GUILDSMAN); - addFirstTalkId(ADVENTURE_GUILDSMAN); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - String htmltext = null; - - switch (event) - { - case "pccafe_list": - { - htmltext = "pccafe_list001.htm"; - break; - } - case "quest_list": - { - player.sendPacket(ExShowQuestInfo.STATIC_PACKET); - break; - } - case "buff_list": - { - htmltext = "pccafe_buff_1001.htm"; - break; - } - case "item_list": - { - htmltext = "pccafe_item001.htm"; - break; - } - case "pccafe_help_inzone001.htm": - case "pccafe_help_lottery001.htm": - case "pccafe_help_lottery002.htm": - case "adventurer_agent_town_voucher_change.htm": - case "life_crystal_merge001.htm": - case "life_crystal_merge002.htm": - case "voucher_trader1001.htm": - case "voucher_trader2001.htm": - case "voucher_trader3001.htm": - case "voucher_trader4001.htm": - case "voucher_trader1004.htm": - case "voucher_trader2004.htm": - case "voucher_trader3004.htm": - case "voucher_trader4004.htm": - case "voucher_trader1005.htm": - case "voucher_trader2005.htm": - case "voucher_trader3005.htm": - case "voucher_trader4005.htm": - case "voucher_trader1006.htm": - case "voucher_trader2006.htm": - case "voucher_trader3006.htm": - case "voucher_trader4006.htm": - { - htmltext = event; - break; - } - case "index": - { - htmltext = player.getLevel() < 40 ? "adventurer_agent_town_77001.htm" : "adventurer_agent_town_77001e.htm"; - break; - } - case "buff_setlist": - { - htmltext = "pccafe_newbuff_001.htm"; - break; - } - case "buff_group": - { - htmltext = player.getPcCafePoints() >= 120 ? applyBuffsGroup(npc, player, GROUP_MELODY.length) : "pccafe_buff_1001.htm"; - break; - } - case "knight": - { - htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, KNIGHT.getSkill()) : "pccafe_buff_1001.htm"; - break; - } - case "warrior": - { - htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, WARRIOR.getSkill()) : "pccafe_buff_1001.htm"; - break; - } - case "wizard": - { - htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, WIZARD.getSkill()) : "pccafe_buff_1001.htm"; - break; - } - case "give_lottery_ticket": - { - if (!player.getVariables().getBoolean(USED_PC_LOTTERY_TICKET, false)) - { - player.getVariables().set(USED_PC_LOTTERY_TICKET, true); - giveItems(player, PCCAFE_LOTTERY_TICKET_30DAYS, 1); - } - else - { - htmltext = "pccafe_help_lottery_notoneday.htm"; - } - break; - } - case "trade_10": - { - htmltext = tradeItem(player, PCCAFE_5TH_LOTTERY_TICKET_30DAYS, 10); - break; - } - case "trade_100": - { - htmltext = tradeItem(player, PCCAFE_4TH_LOTTERY_TICKET_30DAYS, 100); - break; - } - case "trade_200": - { - htmltext = tradeItem(player, PCCAFE_3RD_LOTTERY_TICKET_30DAYS, 200); - break; - } - case "trade_1000": - { - htmltext = tradeItem(player, PCCAFE_2ND_LOTTERY_TICKET_30DAYS, 1000); - break; - } - case "trade_10000": - { - htmltext = tradeItem(player, PCCAFE_1ST_LOTTERY_TICKET_30DAYS, 10000); - break; - } - case "trade_seal85": - { - if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) - { - if (hasQuestItems(player, VOUCHER_LEV_85)) - { - takeItems(player, VOUCHER_LEV_85, 1); - giveItems(player, SEAL_LEV_85, 20); - addExpAndSp(player, 60000000, 0); - } - else - { - htmltext = "voucher_trader1003b.htm"; - } - } - else - { - htmltext = "voucher_trader1007.htm"; - } - break; - } - case "trade_seal90": - { - if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) - { - if (hasQuestItems(player, VOUCHER_LEV_90)) - { - takeItems(player, VOUCHER_LEV_90, 1); - giveItems(player, SEAL_LEV_90, 20); - addExpAndSp(player, 66000000, 0); - } - else - { - htmltext = "voucher_trader2003b.htm"; - } - } - else - { - htmltext = "voucher_trader1007.htm"; - } - break; - } - case "trade_seal95": - { - if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) - { - if (hasQuestItems(player, VOUCHER_LEV_95)) - { - takeItems(player, VOUCHER_LEV_95, 1); - giveItems(player, SEAL_LEV_95, 20); - addExpAndSp(player, 68000000, 0); - } - else - { - htmltext = "voucher_trader3003b.htm"; - } - } - else - { - htmltext = "voucher_trader1007.htm"; - } - break; - } - case "trade_seal97": - { - if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) - { - if (hasQuestItems(player, VOUCHER_LEV_97)) - { - takeItems(player, VOUCHER_LEV_97, 1); - giveItems(player, SEAL_LEV_97, 20); - addExpAndSp(player, 76000000, 0); - } - else - { - htmltext = "voucher_trader3003b.htm"; - } - } - else - { - htmltext = "voucher_trader1007.htm"; - } - break; - } - case "give_talismanR_by_class": - { - int multisellId = -1; - - for (CategoryType type : R_CLASS_TALISMAN.keySet()) - { - if (player.isInCategory(type)) - { - multisellId = R_CLASS_TALISMAN.get(type); - break; - } - } - - if (multisellId > 0) - { - MultisellData.getInstance().separateAndSend(multisellId, player, npc, false); - } - break; - } - case "give_talismanR90_by_class": - { - int multisellId = -1; - - for (CategoryType type : R90_CLASS_TALISMAN.keySet()) - { - if (player.isInCategory(type)) - { - multisellId = R90_CLASS_TALISMAN.get(type); - break; - } - } - - if (multisellId > 0) - { - MultisellData.getInstance().separateAndSend(multisellId, player, npc, false); - } - break; - } - case "give_talismanR95_by_class": - { - int multisellId = -1; - for (CategoryType type : R95_CLASS_TALISMAN.keySet()) - { - if (player.isInCategory(type)) - { - multisellId = R95_CLASS_TALISMAN.get(type); - break; - } - } - - if (multisellId > 0) - { - MultisellData.getInstance().separateAndSend(multisellId, player, npc, false); - } - break; - } - - case "give_talismanR99_by_class": - { - int multisellId = -1; - - for (CategoryType type : R99_CLASS_TALISMAN.keySet()) - { - if (player.isInCategory(type)) - { - multisellId = R99_CLASS_TALISMAN.get(type); - break; - } - } - - if (multisellId > 0) - { - MultisellData.getInstance().separateAndSend(multisellId, player, npc, false); - } - break; - } - } - if (event.startsWith("melody")) - { - final int buffOffset = CommonUtil.constrain(Integer.parseInt(event.substring(event.indexOf(" ") + 1)), 0, GROUP_MELODY.length); - if (player.getPcCafePoints() >= 20) - { - npc.setTarget(player); - npc.doCast(GROUP_MELODY[buffOffset].getSkill()); - player.setPcCafePoints(player.getPcCafePoints() - 20); - htmltext = "pccafe_buff_1001.htm"; - } - else - { - htmltext = "pccafe_notpoint001.htm"; - } - - } - return htmltext; - } - - private String applyBuffs(Npc npc, PlayerInstance player, Skill skill) - { - for (SkillHolder holder : GROUP_MELODY) - { - SkillCaster.triggerCast(npc, player, holder.getSkill()); - } - for (SkillHolder holder : GROUP_SONATA) - { - SkillCaster.triggerCast(npc, player, holder.getSkill()); - } - SkillCaster.triggerCast(npc, player, skill); - player.setPcCafePoints(player.getPcCafePoints() - 200); - return null; - } - - private String applyBuffsGroup(Npc npc, PlayerInstance player, int length) - { - for (SkillHolder holder : GROUP_MELODY) - { - SkillCaster.triggerCast(npc, player, holder.getSkill()); - } - player.setPcCafePoints(player.getPcCafePoints() - 120); - return null; - } - - private String tradeItem(PlayerInstance player, int itemId, int points) - { - if (player.getPcCafePoints() >= 200000) - { - return "pccafe_help_lottery_fail2.htm"; - } - - if (takeItems(player, itemId, 1)) - { - player.setPcCafePoints(player.getPcCafePoints() + points); - return "pccafe_help_lottery003.htm"; - } - return "pccafe_help_lottery_fail.htm"; - } - - @Override - public String onFirstTalk(Npc npc, PlayerInstance player) - { - return player.getLevel() < 40 ? "adventurer_agent_town_77001.htm" : "adventurer_agent_town_77001e.htm"; - } - - public static void main(String[] args) - { - new AdventureGuildsman(); - } -} + static + { + R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759); + R99_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 760); + R99_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 761); + R99_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 762); + R99_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 763); + R99_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 764); + R99_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 765); + R99_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 766); + R99_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 760); + R99_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 765); + } + //@formatter:on + private static final String USED_PC_LOTTERY_TICKET = "USED_PC_LOTTERY_TICKET"; + + private AdventureGuildsman() + { + addStartNpc(ADVENTURE_GUILDSMAN); + addTalkId(ADVENTURE_GUILDSMAN); + addFirstTalkId(ADVENTURE_GUILDSMAN); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + String htmltext = null; + + switch (event) + { + case "pccafe_list": + { + htmltext = "pccafe_list001.htm"; + break; + } + case "quest_list": + { + player.sendPacket(ExShowQuestInfo.STATIC_PACKET); + break; + } + case "buff_list": + { + htmltext = "pccafe_buff_1001.htm"; + break; + } + case "item_list": + { + htmltext = "pccafe_item001.htm"; + break; + } + case "pccafe_help_inzone001.htm": + case "pccafe_help_lottery001.htm": + case "pccafe_help_lottery002.htm": + case "adventurer_agent_town_voucher_change.htm": + case "life_crystal_merge001.htm": + case "life_crystal_merge002.htm": + case "voucher_trader1001.htm": + case "voucher_trader2001.htm": + case "voucher_trader3001.htm": + case "voucher_trader4001.htm": + case "voucher_trader1004.htm": + case "voucher_trader2004.htm": + case "voucher_trader3004.htm": + case "voucher_trader4004.htm": + case "voucher_trader1005.htm": + case "voucher_trader2005.htm": + case "voucher_trader3005.htm": + case "voucher_trader4005.htm": + case "voucher_trader1006.htm": + case "voucher_trader2006.htm": + case "voucher_trader3006.htm": + case "voucher_trader4006.htm": + { + htmltext = event; + break; + } + case "index": + { + htmltext = player.getLevel() < 40 ? "adventurer_agent_town_77001.htm" : "adventurer_agent_town_77001e.htm"; + break; + } + case "buff_setlist": + { + htmltext = "pccafe_newbuff_001.htm"; + break; + } + case "buff_group": + { + htmltext = player.getPcCafePoints() >= 120 ? applyBuffsGroup(npc, player, GROUP_MELODY.length) : "pccafe_buff_1001.htm"; + break; + } + case "knight": + { + htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, KNIGHT.getSkill()) : "pccafe_buff_1001.htm"; + break; + } + case "warrior": + { + htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, WARRIOR.getSkill()) : "pccafe_buff_1001.htm"; + break; + } + case "wizard": + { + htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, WIZARD.getSkill()) : "pccafe_buff_1001.htm"; + break; + } + case "give_lottery_ticket": + { + if (!player.getVariables().getBoolean(USED_PC_LOTTERY_TICKET, false)) + { + player.getVariables().set(USED_PC_LOTTERY_TICKET, true); + giveItems(player, PCCAFE_LOTTERY_TICKET_30DAYS, 1); + } + else + { + htmltext = "pccafe_help_lottery_notoneday.htm"; + } + break; + } + case "trade_10": + { + htmltext = tradeItem(player, PCCAFE_5TH_LOTTERY_TICKET_30DAYS, 10); + break; + } + case "trade_100": + { + htmltext = tradeItem(player, PCCAFE_4TH_LOTTERY_TICKET_30DAYS, 100); + break; + } + case "trade_200": + { + htmltext = tradeItem(player, PCCAFE_3RD_LOTTERY_TICKET_30DAYS, 200); + break; + } + case "trade_1000": + { + htmltext = tradeItem(player, PCCAFE_2ND_LOTTERY_TICKET_30DAYS, 1000); + break; + } + case "trade_10000": + { + htmltext = tradeItem(player, PCCAFE_1ST_LOTTERY_TICKET_30DAYS, 10000); + break; + } + case "trade_seal85": + { + if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + if (hasQuestItems(player, VOUCHER_LEV_85)) + { + takeItems(player, VOUCHER_LEV_85, 1); + giveItems(player, SEAL_LEV_85, 20); + addExpAndSp(player, 60000000, 0); + } + else + { + htmltext = "voucher_trader1003b.htm"; + } + } + else + { + htmltext = "voucher_trader1007.htm"; + } + break; + } + case "trade_seal90": + { + if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + if (hasQuestItems(player, VOUCHER_LEV_90)) + { + takeItems(player, VOUCHER_LEV_90, 1); + giveItems(player, SEAL_LEV_90, 20); + addExpAndSp(player, 66000000, 0); + } + else + { + htmltext = "voucher_trader2003b.htm"; + } + } + else + { + htmltext = "voucher_trader1007.htm"; + } + break; + } + case "trade_seal95": + { + if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + if (hasQuestItems(player, VOUCHER_LEV_95)) + { + takeItems(player, VOUCHER_LEV_95, 1); + giveItems(player, SEAL_LEV_95, 20); + addExpAndSp(player, 68000000, 0); + } + else + { + htmltext = "voucher_trader3003b.htm"; + } + } + else + { + htmltext = "voucher_trader1007.htm"; + } + break; + } + case "trade_seal97": + { + if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + if (hasQuestItems(player, VOUCHER_LEV_97)) + { + takeItems(player, VOUCHER_LEV_97, 1); + giveItems(player, SEAL_LEV_97, 20); + addExpAndSp(player, 76000000, 0); + } + else + { + htmltext = "voucher_trader3003b.htm"; + } + } + else + { + htmltext = "voucher_trader1007.htm"; + } + break; + } + case "give_talismanR_by_class": + { + int multisellId = -1; + + for (CategoryType type : R_CLASS_TALISMAN.keySet()) + { + if (player.isInCategory(type)) + { + multisellId = R_CLASS_TALISMAN.get(type); + break; + } + } + + if (multisellId > 0) + { + MultisellData.getInstance().separateAndSend(multisellId, player, npc, false); + } + break; + } + case "give_talismanR90_by_class": + { + int multisellId = -1; + + for (CategoryType type : R90_CLASS_TALISMAN.keySet()) + { + if (player.isInCategory(type)) + { + multisellId = R90_CLASS_TALISMAN.get(type); + break; + } + } + + if (multisellId > 0) + { + MultisellData.getInstance().separateAndSend(multisellId, player, npc, false); + } + break; + } + case "give_talismanR95_by_class": + { + int multisellId = -1; + for (CategoryType type : R95_CLASS_TALISMAN.keySet()) + { + if (player.isInCategory(type)) + { + multisellId = R95_CLASS_TALISMAN.get(type); + break; + } + } + + if (multisellId > 0) + { + MultisellData.getInstance().separateAndSend(multisellId, player, npc, false); + } + break; + } + + case "give_talismanR99_by_class": + { + int multisellId = -1; + + for (CategoryType type : R99_CLASS_TALISMAN.keySet()) + { + if (player.isInCategory(type)) + { + multisellId = R99_CLASS_TALISMAN.get(type); + break; + } + } + + if (multisellId > 0) + { + MultisellData.getInstance().separateAndSend(multisellId, player, npc, false); + } + break; + } + } + if (event.startsWith("melody")) + { + final int buffOffset = CommonUtil.constrain(Integer.parseInt(event.substring(event.indexOf(" ") + 1)), 0, GROUP_MELODY.length); + if (player.getPcCafePoints() >= 20) + { + npc.setTarget(player); + npc.doCast(GROUP_MELODY[buffOffset].getSkill()); + player.setPcCafePoints(player.getPcCafePoints() - 20); + htmltext = "pccafe_buff_1001.htm"; + } + else + { + htmltext = "pccafe_notpoint001.htm"; + } + + } + return htmltext; + } + + private String applyBuffs(Npc npc, PlayerInstance player, Skill skill) + { + for (SkillHolder holder : GROUP_MELODY) + { + SkillCaster.triggerCast(npc, player, holder.getSkill()); + } + for (SkillHolder holder : GROUP_SONATA) + { + SkillCaster.triggerCast(npc, player, holder.getSkill()); + } + SkillCaster.triggerCast(npc, player, skill); + player.setPcCafePoints(player.getPcCafePoints() - 200); + return null; + } + + private String applyBuffsGroup(Npc npc, PlayerInstance player, int length) + { + for (SkillHolder holder : GROUP_MELODY) + { + SkillCaster.triggerCast(npc, player, holder.getSkill()); + } + player.setPcCafePoints(player.getPcCafePoints() - 120); + return null; + } + + private String tradeItem(PlayerInstance player, int itemId, int points) + { + if (player.getPcCafePoints() >= 200000) + { + return "pccafe_help_lottery_fail2.htm"; + } + + if (takeItems(player, itemId, 1)) + { + player.setPcCafePoints(player.getPcCafePoints() + points); + return "pccafe_help_lottery003.htm"; + } + return "pccafe_help_lottery_fail.htm"; + } + + @Override + public String onFirstTalk(Npc npc, PlayerInstance player) + { + return player.getLevel() < 40 ? "adventurer_agent_town_77001.htm" : "adventurer_agent_town_77001e.htm"; + } + + public static void main(String[] args) + { + new AdventureGuildsman(); + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 1abb859d66..c6431dabea 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java index f85993288a..206e585ab2 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java @@ -55,7 +55,8 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler // NPC private static final int MANAGER = 31688; // Misc - private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + static { EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917); EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_TIR_GROUP, 918); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/AirBind.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/AirBind.java index 72502bc106..9dd9a94a48 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/AirBind.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/AirBind.java @@ -1,121 +1,122 @@ -/* - * 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 . - */ -package handlers.effecthandlers; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.enums.CategoryType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -import com.l2jmobius.gameserver.model.effects.AbstractEffect; -import com.l2jmobius.gameserver.model.effects.EffectType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; - -/** - * @author Mobius - */ -public final class AirBind extends AbstractEffect -{ - // skill data +/* + * 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 . + */ +package handlers.effecthandlers; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.ai.CtrlEvent; +import com.l2jmobius.gameserver.enums.CategoryType; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.effects.EffectType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; + +/** + * @author Mobius + */ +public final class AirBind extends AbstractEffect +{ + // skill data private static final Map _chainedAirSkills = new HashMap<>(36); - { - _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit - } - - public AirBind(StatsSet params) - { - } - - @Override - public boolean isInstant() - { - return false; - } - - @Override - public EffectType getEffectType() - { - return EffectType.KNOCK; - } - - @Override - public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) - { - if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // - && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) - { - final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); - if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) - { - nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); - } - } - } - } - - @Override - public void onExit(Creature effector, Creature effected, Skill skill) - { - if (!effected.isPlayer()) - { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); - } - } -} + static + { + _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit + } + + public AirBind(StatsSet params) + { + } + + @Override + public boolean isInstant() + { + return false; + } + + @Override + public EffectType getEffectType() + { + return EffectType.KNOCK; + } + + @Override + public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) + { + for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) + { + if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // + && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) + { + final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); + if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) + { + nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); + } + } + } + } + + @Override + public void onExit(Creature effector, Creature effected, Skill skill) + { + if (!effected.isPlayer()) + { + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + } + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java index 0db7363b7a..dad2c3ab1b 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java @@ -55,7 +55,8 @@ public final class KnockBack extends AbstractEffect private final FlyType _type; // skill data - private static final Map _chainKnockSkills = new HashMap<>(36); + private static final Map _chainKnockSkills = new HashMap<>(36); + static { _chainKnockSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10250); // Heavy Hit _chainKnockSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10250); // Heavy Hit diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index 7095ed3e8f..5579e917ad 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -46,7 +46,8 @@ public final class Q00032_AnObviousLie extends Quest // Misc private static final int MIN_LVL = 45; // Reward - private static final Map EARS = new HashMap<>(); + private static final Map EARS = new HashMap<>(); + static { EARS.put("cat", 6843); // Cat Ears EARS.put("raccoon", 7680); // Raccoon ears diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 9dc74f2400..48a298ea2e 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -45,7 +45,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - + static { MONSTER_CHANCES.put(20236, 0.58); // Cave Servant MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java index b5345ac8e9..90acf3183b 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -103,7 +103,8 @@ public final class Q00420_LittleWing extends Quest private static final int HATCHLING_FOOD = 4038; private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); // Drake Drops - private static final Map EGG_DROPS = new HashMap<>(); + private static final Map EGG_DROPS = new HashMap<>(); + static { EGG_DROPS.put(LESSER_BASILISK, SHAMHAI_EGG); EGG_DROPS.put(BASILISK, SHAMHAI_EGG); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/exp4j/Operators.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/exp4j/Operators.java index ca28599f0c..649327cd88 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/exp4j/Operators.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/exp4j/Operators.java @@ -27,7 +27,6 @@ public abstract class Operators private static final int INDEX_UNARYPLUS = 7; private static final Operator[] builtinOperators = new Operator[8]; - static { builtinOperators[INDEX_ADDITION] = new Operator("+", 2, true, Operator.PRECEDENCE_ADDITION) diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java index 250742c433..92321be894 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java @@ -1,114 +1,114 @@ -/* - * 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 . - */ -package ai.areas.DragonValley; - -import java.util.ArrayList; -import java.util.List; - -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; - -import ai.AbstractNpcAI; - -/** - * Leopard Dragon Hachling AI. - * @author Mobius - */ -public final class LeopardDragonHachling extends AbstractNpcAI -{ - // NPCs - private static final int DRAGON_HACHLING = 23434; - private static final int LEOPARD_DRAGON = 23435; - // Locations - private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); - - { - TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); - TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); - TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); - TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); - } - - private LeopardDragonHachling() - { - addAttackId(DRAGON_HACHLING); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) - { - if (npc.calculateDistance2D(nearestLocation(npc)) < 100) - { - final int random = getRandom(1, 4); - for (int counter = 1; counter < random; counter++) - { - final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time - leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); - addAttackDesire(leopard, player); - } - cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); - npc.deleteMe(); - } - else - { - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - } - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getScriptValue() == 0) - { - npc.setScriptValue(1); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); - startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); - } - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - return null; - } - - private Location nearestLocation(Npc npc) - { - Location gotoLoc = TRANSFORM_LOCATIONS.get(0); - for (Location loc : TRANSFORM_LOCATIONS) - { - if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) - { - gotoLoc = loc; - } - } - return gotoLoc; - } - - public static void main(String[] args) - { - new LeopardDragonHachling(); - } -} +/* + * 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 . + */ +package ai.areas.DragonValley; + +import java.util.ArrayList; +import java.util.List; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; + +import ai.AbstractNpcAI; + +/** + * Leopard Dragon Hachling AI. + * @author Mobius + */ +public final class LeopardDragonHachling extends AbstractNpcAI +{ + // NPCs + private static final int DRAGON_HACHLING = 23434; + private static final int LEOPARD_DRAGON = 23435; + // Locations + private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); + static + { + TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); + TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); + TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); + TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); + } + + private LeopardDragonHachling() + { + addAttackId(DRAGON_HACHLING); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) + { + if (npc.calculateDistance2D(nearestLocation(npc)) < 100) + { + final int random = getRandom(1, 4); + for (int counter = 1; counter < random; counter++) + { + final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time + leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); + addAttackDesire(leopard, player); + } + cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); + npc.deleteMe(); + } + else + { + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getScriptValue() == 0) + { + npc.setScriptValue(1); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); + startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); + } + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + return null; + } + + private Location nearestLocation(Npc npc) + { + Location gotoLoc = TRANSFORM_LOCATIONS.get(0); + for (Location loc : TRANSFORM_LOCATIONS) + { + if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) + { + gotoLoc = loc; + } + } + return gotoLoc; + } + + public static void main(String[] args) + { + new LeopardDragonHachling(); + } +} diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 56d5e6f72b..6ee86b5890 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -109,7 +109,8 @@ public final class Raina extends AbstractNpcAI subclassSetMap.put(PlayerClass.Spellhowler, subclasseSet5); } - private static final Map classCloak = new HashMap<>(); + private static final Map classCloak = new HashMap<>(); + static { classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak classCloak.put(CategoryType.SIXTH_TIR_GROUP, 30311); // Sapyros Cloak Grade @@ -121,7 +122,8 @@ public final class Raina extends AbstractNpcAI classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade } - private static final List dualClassList = new ArrayList<>(); + private static final List dualClassList = new ArrayList<>(); + static { dualClassList.addAll(Arrays.asList(PlayerClass.sigelPhoenixKnight, PlayerClass.sigelHellKnight, PlayerClass.sigelEvasTemplar, PlayerClass.sigelShilenTemplar)); dualClassList.addAll(Arrays.asList(PlayerClass.tyrrDuelist, PlayerClass.tyrrDreadnought, PlayerClass.tyrrTitan, PlayerClass.tyrrGrandKhavatari, PlayerClass.tyrrDoombringer)); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java index 829a360773..4f046f6532 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java @@ -75,7 +75,8 @@ public class AdventureGuildsman extends AbstractNpcAI }; // Misc //@formatter:off - private static final Map R_CLASS_TALISMAN = new HashMap<>(); + private static final Map R_CLASS_TALISMAN = new HashMap<>(); + static { R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735); R_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 736); @@ -88,7 +89,8 @@ public class AdventureGuildsman extends AbstractNpcAI R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736); R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741); } - private static final Map R90_CLASS_TALISMAN = new HashMap<>(); + private static final Map R90_CLASS_TALISMAN = new HashMap<>(); + static { R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743); R90_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 744); @@ -101,7 +103,8 @@ public class AdventureGuildsman extends AbstractNpcAI R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744); R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749); } - private static final Map R95_CLASS_TALISMAN = new HashMap<>(); + private static final Map R95_CLASS_TALISMAN = new HashMap<>(); + static { R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751); R95_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 752); @@ -114,7 +117,8 @@ public class AdventureGuildsman extends AbstractNpcAI R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752); R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757); } - private static final Map R99_CLASS_TALISMAN = new HashMap<>(); + private static final Map R99_CLASS_TALISMAN = new HashMap<>(); + static { R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759); R99_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 760); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 1abb859d66..c6431dabea 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java index f85993288a..206e585ab2 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java @@ -55,7 +55,8 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler // NPC private static final int MANAGER = 31688; // Misc - private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + static { EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917); EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_TIR_GROUP, 918); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/AirBind.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/AirBind.java index 72502bc106..9dd9a94a48 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/AirBind.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/AirBind.java @@ -1,121 +1,122 @@ -/* - * 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 . - */ -package handlers.effecthandlers; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.enums.CategoryType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -import com.l2jmobius.gameserver.model.effects.AbstractEffect; -import com.l2jmobius.gameserver.model.effects.EffectType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; - -/** - * @author Mobius - */ -public final class AirBind extends AbstractEffect -{ - // skill data +/* + * 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 . + */ +package handlers.effecthandlers; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.ai.CtrlEvent; +import com.l2jmobius.gameserver.enums.CategoryType; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.effects.EffectType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; + +/** + * @author Mobius + */ +public final class AirBind extends AbstractEffect +{ + // skill data private static final Map _chainedAirSkills = new HashMap<>(36); - { - _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit - } - - public AirBind(StatsSet params) - { - } - - @Override - public boolean isInstant() - { - return false; - } - - @Override - public EffectType getEffectType() - { - return EffectType.KNOCK; - } - - @Override - public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) - { - if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // - && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) - { - final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); - if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) - { - nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); - } - } - } - } - - @Override - public void onExit(Creature effector, Creature effected, Skill skill) - { - if (!effected.isPlayer()) - { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); - } - } -} + static + { + _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit + } + + public AirBind(StatsSet params) + { + } + + @Override + public boolean isInstant() + { + return false; + } + + @Override + public EffectType getEffectType() + { + return EffectType.KNOCK; + } + + @Override + public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) + { + for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) + { + if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // + && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) + { + final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); + if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) + { + nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); + } + } + } + } + + @Override + public void onExit(Creature effector, Creature effected, Skill skill) + { + if (!effected.isPlayer()) + { + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + } + } +} diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java index 0db7363b7a..dad2c3ab1b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java @@ -55,7 +55,8 @@ public final class KnockBack extends AbstractEffect private final FlyType _type; // skill data - private static final Map _chainKnockSkills = new HashMap<>(36); + private static final Map _chainKnockSkills = new HashMap<>(36); + static { _chainKnockSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10250); // Heavy Hit _chainKnockSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10250); // Heavy Hit diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index 7095ed3e8f..5579e917ad 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -46,7 +46,8 @@ public final class Q00032_AnObviousLie extends Quest // Misc private static final int MIN_LVL = 45; // Reward - private static final Map EARS = new HashMap<>(); + private static final Map EARS = new HashMap<>(); + static { EARS.put("cat", 6843); // Cat Ears EARS.put("raccoon", 7680); // Raccoon ears diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 9dc74f2400..48a298ea2e 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -45,7 +45,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - + static { MONSTER_CHANCES.put(20236, 0.58); // Cave Servant MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java index 525fe43474..d44f3c6aa6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -102,7 +102,8 @@ public final class Q00420_LittleWing extends Quest private static final int HATCHLING_FOOD = 4038; private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); // Drake Drops - private static final Map EGG_DROPS = new HashMap<>(); + private static final Map EGG_DROPS = new HashMap<>(); + static { EGG_DROPS.put(LESSER_BASILISK, SHAMHAI_EGG); EGG_DROPS.put(BASILISK, SHAMHAI_EGG); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/exp4j/Operators.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/exp4j/Operators.java index ca28599f0c..649327cd88 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/exp4j/Operators.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/exp4j/Operators.java @@ -27,7 +27,6 @@ public abstract class Operators private static final int INDEX_UNARYPLUS = 7; private static final Operator[] builtinOperators = new Operator[8]; - static { builtinOperators[INDEX_ADDITION] = new Operator("+", 2, true, Operator.PRECEDENCE_ADDITION) diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java index 250742c433..92321be894 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java @@ -1,114 +1,114 @@ -/* - * 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 . - */ -package ai.areas.DragonValley; - -import java.util.ArrayList; -import java.util.List; - -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; - -import ai.AbstractNpcAI; - -/** - * Leopard Dragon Hachling AI. - * @author Mobius - */ -public final class LeopardDragonHachling extends AbstractNpcAI -{ - // NPCs - private static final int DRAGON_HACHLING = 23434; - private static final int LEOPARD_DRAGON = 23435; - // Locations - private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); - - { - TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); - TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); - TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); - TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); - } - - private LeopardDragonHachling() - { - addAttackId(DRAGON_HACHLING); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) - { - if (npc.calculateDistance2D(nearestLocation(npc)) < 100) - { - final int random = getRandom(1, 4); - for (int counter = 1; counter < random; counter++) - { - final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time - leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); - addAttackDesire(leopard, player); - } - cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); - npc.deleteMe(); - } - else - { - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - } - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getScriptValue() == 0) - { - npc.setScriptValue(1); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); - startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); - } - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - return null; - } - - private Location nearestLocation(Npc npc) - { - Location gotoLoc = TRANSFORM_LOCATIONS.get(0); - for (Location loc : TRANSFORM_LOCATIONS) - { - if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) - { - gotoLoc = loc; - } - } - return gotoLoc; - } - - public static void main(String[] args) - { - new LeopardDragonHachling(); - } -} +/* + * 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 . + */ +package ai.areas.DragonValley; + +import java.util.ArrayList; +import java.util.List; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; + +import ai.AbstractNpcAI; + +/** + * Leopard Dragon Hachling AI. + * @author Mobius + */ +public final class LeopardDragonHachling extends AbstractNpcAI +{ + // NPCs + private static final int DRAGON_HACHLING = 23434; + private static final int LEOPARD_DRAGON = 23435; + // Locations + private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); + static + { + TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); + TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); + TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); + TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); + } + + private LeopardDragonHachling() + { + addAttackId(DRAGON_HACHLING); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) + { + if (npc.calculateDistance2D(nearestLocation(npc)) < 100) + { + final int random = getRandom(1, 4); + for (int counter = 1; counter < random; counter++) + { + final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time + leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); + addAttackDesire(leopard, player); + } + cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); + npc.deleteMe(); + } + else + { + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getScriptValue() == 0) + { + npc.setScriptValue(1); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); + startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); + } + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + return null; + } + + private Location nearestLocation(Npc npc) + { + Location gotoLoc = TRANSFORM_LOCATIONS.get(0); + for (Location loc : TRANSFORM_LOCATIONS) + { + if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) + { + gotoLoc = loc; + } + } + return gotoLoc; + } + + public static void main(String[] args) + { + new LeopardDragonHachling(); + } +} diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 56d5e6f72b..6ee86b5890 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -109,7 +109,8 @@ public final class Raina extends AbstractNpcAI subclassSetMap.put(PlayerClass.Spellhowler, subclasseSet5); } - private static final Map classCloak = new HashMap<>(); + private static final Map classCloak = new HashMap<>(); + static { classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak classCloak.put(CategoryType.SIXTH_TIR_GROUP, 30311); // Sapyros Cloak Grade @@ -121,7 +122,8 @@ public final class Raina extends AbstractNpcAI classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade } - private static final List dualClassList = new ArrayList<>(); + private static final List dualClassList = new ArrayList<>(); + static { dualClassList.addAll(Arrays.asList(PlayerClass.sigelPhoenixKnight, PlayerClass.sigelHellKnight, PlayerClass.sigelEvasTemplar, PlayerClass.sigelShilenTemplar)); dualClassList.addAll(Arrays.asList(PlayerClass.tyrrDuelist, PlayerClass.tyrrDreadnought, PlayerClass.tyrrTitan, PlayerClass.tyrrGrandKhavatari, PlayerClass.tyrrDoombringer)); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java index db35665c98..c9e88ac760 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java @@ -73,7 +73,8 @@ public class AdventureGuildsman extends AbstractNpcAI }; // Misc //@formatter:off - private static final Map R_CLASS_TALISMAN = new HashMap<>(); + private static final Map R_CLASS_TALISMAN = new HashMap<>(); + static { R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735); R_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 736); @@ -86,7 +87,8 @@ public class AdventureGuildsman extends AbstractNpcAI R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736); R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741); } - private static final Map R90_CLASS_TALISMAN = new HashMap<>(); + private static final Map R90_CLASS_TALISMAN = new HashMap<>(); + static { R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743); R90_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 744); @@ -99,7 +101,8 @@ public class AdventureGuildsman extends AbstractNpcAI R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744); R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749); } - private static final Map R95_CLASS_TALISMAN = new HashMap<>(); + private static final Map R95_CLASS_TALISMAN = new HashMap<>(); + static { R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751); R95_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 752); @@ -112,7 +115,8 @@ public class AdventureGuildsman extends AbstractNpcAI R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752); R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757); } - private static final Map R99_CLASS_TALISMAN = new HashMap<>(); + private static final Map R99_CLASS_TALISMAN = new HashMap<>(); + static { R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759); R99_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 760); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 1abb859d66..c6431dabea 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java index f85993288a..206e585ab2 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java @@ -55,7 +55,8 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler // NPC private static final int MANAGER = 31688; // Misc - private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + static { EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917); EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_TIR_GROUP, 918); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/AirBind.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/AirBind.java index 72502bc106..9dd9a94a48 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/AirBind.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/AirBind.java @@ -1,121 +1,122 @@ -/* - * 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 . - */ -package handlers.effecthandlers; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.enums.CategoryType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -import com.l2jmobius.gameserver.model.effects.AbstractEffect; -import com.l2jmobius.gameserver.model.effects.EffectType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; - -/** - * @author Mobius - */ -public final class AirBind extends AbstractEffect -{ - // skill data +/* + * 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 . + */ +package handlers.effecthandlers; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.ai.CtrlEvent; +import com.l2jmobius.gameserver.enums.CategoryType; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.effects.EffectType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; + +/** + * @author Mobius + */ +public final class AirBind extends AbstractEffect +{ + // skill data private static final Map _chainedAirSkills = new HashMap<>(36); - { - _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit - } - - public AirBind(StatsSet params) - { - } - - @Override - public boolean isInstant() - { - return false; - } - - @Override - public EffectType getEffectType() - { - return EffectType.KNOCK; - } - - @Override - public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) - { - if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // - && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) - { - final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); - if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) - { - nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); - } - } - } - } - - @Override - public void onExit(Creature effector, Creature effected, Skill skill) - { - if (!effected.isPlayer()) - { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); - } - } -} + static + { + _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit + } + + public AirBind(StatsSet params) + { + } + + @Override + public boolean isInstant() + { + return false; + } + + @Override + public EffectType getEffectType() + { + return EffectType.KNOCK; + } + + @Override + public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) + { + for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) + { + if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // + && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) + { + final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); + if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) + { + nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); + } + } + } + } + + @Override + public void onExit(Creature effector, Creature effected, Skill skill) + { + if (!effected.isPlayer()) + { + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + } + } +} diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java index 0db7363b7a..dad2c3ab1b 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java @@ -55,7 +55,8 @@ public final class KnockBack extends AbstractEffect private final FlyType _type; // skill data - private static final Map _chainKnockSkills = new HashMap<>(36); + private static final Map _chainKnockSkills = new HashMap<>(36); + static { _chainKnockSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10250); // Heavy Hit _chainKnockSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10250); // Heavy Hit diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index 7095ed3e8f..5579e917ad 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -46,7 +46,8 @@ public final class Q00032_AnObviousLie extends Quest // Misc private static final int MIN_LVL = 45; // Reward - private static final Map EARS = new HashMap<>(); + private static final Map EARS = new HashMap<>(); + static { EARS.put("cat", 6843); // Cat Ears EARS.put("raccoon", 7680); // Raccoon ears diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 9dc74f2400..48a298ea2e 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -45,7 +45,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - + static { MONSTER_CHANCES.put(20236, 0.58); // Cave Servant MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java index 525fe43474..d44f3c6aa6 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -102,7 +102,8 @@ public final class Q00420_LittleWing extends Quest private static final int HATCHLING_FOOD = 4038; private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); // Drake Drops - private static final Map EGG_DROPS = new HashMap<>(); + private static final Map EGG_DROPS = new HashMap<>(); + static { EGG_DROPS.put(LESSER_BASILISK, SHAMHAI_EGG); EGG_DROPS.put(BASILISK, SHAMHAI_EGG); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/util/exp4j/Operators.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/util/exp4j/Operators.java index ca28599f0c..649327cd88 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/util/exp4j/Operators.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/util/exp4j/Operators.java @@ -27,7 +27,6 @@ public abstract class Operators private static final int INDEX_UNARYPLUS = 7; private static final Operator[] builtinOperators = new Operator[8]; - static { builtinOperators[INDEX_ADDITION] = new Operator("+", 2, true, Operator.PRECEDENCE_ADDITION) diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java index 250742c433..92321be894 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java @@ -1,114 +1,114 @@ -/* - * 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 . - */ -package ai.areas.DragonValley; - -import java.util.ArrayList; -import java.util.List; - -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; - -import ai.AbstractNpcAI; - -/** - * Leopard Dragon Hachling AI. - * @author Mobius - */ -public final class LeopardDragonHachling extends AbstractNpcAI -{ - // NPCs - private static final int DRAGON_HACHLING = 23434; - private static final int LEOPARD_DRAGON = 23435; - // Locations - private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); - - { - TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); - TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); - TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); - TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); - } - - private LeopardDragonHachling() - { - addAttackId(DRAGON_HACHLING); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) - { - if (npc.calculateDistance2D(nearestLocation(npc)) < 100) - { - final int random = getRandom(1, 4); - for (int counter = 1; counter < random; counter++) - { - final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time - leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); - addAttackDesire(leopard, player); - } - cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); - npc.deleteMe(); - } - else - { - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - } - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getScriptValue() == 0) - { - npc.setScriptValue(1); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); - startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); - } - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - return null; - } - - private Location nearestLocation(Npc npc) - { - Location gotoLoc = TRANSFORM_LOCATIONS.get(0); - for (Location loc : TRANSFORM_LOCATIONS) - { - if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) - { - gotoLoc = loc; - } - } - return gotoLoc; - } - - public static void main(String[] args) - { - new LeopardDragonHachling(); - } -} +/* + * 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 . + */ +package ai.areas.DragonValley; + +import java.util.ArrayList; +import java.util.List; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; + +import ai.AbstractNpcAI; + +/** + * Leopard Dragon Hachling AI. + * @author Mobius + */ +public final class LeopardDragonHachling extends AbstractNpcAI +{ + // NPCs + private static final int DRAGON_HACHLING = 23434; + private static final int LEOPARD_DRAGON = 23435; + // Locations + private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); + static + { + TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); + TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); + TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); + TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); + } + + private LeopardDragonHachling() + { + addAttackId(DRAGON_HACHLING); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) + { + if (npc.calculateDistance2D(nearestLocation(npc)) < 100) + { + final int random = getRandom(1, 4); + for (int counter = 1; counter < random; counter++) + { + final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time + leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); + addAttackDesire(leopard, player); + } + cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); + npc.deleteMe(); + } + else + { + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getScriptValue() == 0) + { + npc.setScriptValue(1); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); + startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); + } + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + return null; + } + + private Location nearestLocation(Npc npc) + { + Location gotoLoc = TRANSFORM_LOCATIONS.get(0); + for (Location loc : TRANSFORM_LOCATIONS) + { + if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) + { + gotoLoc = loc; + } + } + return gotoLoc; + } + + public static void main(String[] args) + { + new LeopardDragonHachling(); + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 56d5e6f72b..6ee86b5890 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -109,7 +109,8 @@ public final class Raina extends AbstractNpcAI subclassSetMap.put(PlayerClass.Spellhowler, subclasseSet5); } - private static final Map classCloak = new HashMap<>(); + private static final Map classCloak = new HashMap<>(); + static { classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak classCloak.put(CategoryType.SIXTH_TIR_GROUP, 30311); // Sapyros Cloak Grade @@ -121,7 +122,8 @@ public final class Raina extends AbstractNpcAI classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade } - private static final List dualClassList = new ArrayList<>(); + private static final List dualClassList = new ArrayList<>(); + static { dualClassList.addAll(Arrays.asList(PlayerClass.sigelPhoenixKnight, PlayerClass.sigelHellKnight, PlayerClass.sigelEvasTemplar, PlayerClass.sigelShilenTemplar)); dualClassList.addAll(Arrays.asList(PlayerClass.tyrrDuelist, PlayerClass.tyrrDreadnought, PlayerClass.tyrrTitan, PlayerClass.tyrrGrandKhavatari, PlayerClass.tyrrDoombringer)); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java index db35665c98..c9e88ac760 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java @@ -73,7 +73,8 @@ public class AdventureGuildsman extends AbstractNpcAI }; // Misc //@formatter:off - private static final Map R_CLASS_TALISMAN = new HashMap<>(); + private static final Map R_CLASS_TALISMAN = new HashMap<>(); + static { R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735); R_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 736); @@ -86,7 +87,8 @@ public class AdventureGuildsman extends AbstractNpcAI R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736); R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741); } - private static final Map R90_CLASS_TALISMAN = new HashMap<>(); + private static final Map R90_CLASS_TALISMAN = new HashMap<>(); + static { R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743); R90_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 744); @@ -99,7 +101,8 @@ public class AdventureGuildsman extends AbstractNpcAI R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744); R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749); } - private static final Map R95_CLASS_TALISMAN = new HashMap<>(); + private static final Map R95_CLASS_TALISMAN = new HashMap<>(); + static { R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751); R95_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 752); @@ -112,7 +115,8 @@ public class AdventureGuildsman extends AbstractNpcAI R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752); R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757); } - private static final Map R99_CLASS_TALISMAN = new HashMap<>(); + private static final Map R99_CLASS_TALISMAN = new HashMap<>(); + static { R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759); R99_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 760); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 1abb859d66..c6431dabea 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java index 83775af1c1..3dfd2d48ff 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java @@ -55,7 +55,8 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler // NPC private static final int MANAGER = 31688; // Misc - private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + static { EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917); EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_TIR_GROUP, 918); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/AirBind.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/AirBind.java index 72502bc106..9dd9a94a48 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/AirBind.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/AirBind.java @@ -1,121 +1,122 @@ -/* - * 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 . - */ -package handlers.effecthandlers; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.enums.CategoryType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -import com.l2jmobius.gameserver.model.effects.AbstractEffect; -import com.l2jmobius.gameserver.model.effects.EffectType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; - -/** - * @author Mobius - */ -public final class AirBind extends AbstractEffect -{ - // skill data +/* + * 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 . + */ +package handlers.effecthandlers; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.ai.CtrlEvent; +import com.l2jmobius.gameserver.enums.CategoryType; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.effects.EffectType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; + +/** + * @author Mobius + */ +public final class AirBind extends AbstractEffect +{ + // skill data private static final Map _chainedAirSkills = new HashMap<>(36); - { - _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit - } - - public AirBind(StatsSet params) - { - } - - @Override - public boolean isInstant() - { - return false; - } - - @Override - public EffectType getEffectType() - { - return EffectType.KNOCK; - } - - @Override - public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) - { - if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // - && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) - { - final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); - if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) - { - nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); - } - } - } - } - - @Override - public void onExit(Creature effector, Creature effected, Skill skill) - { - if (!effected.isPlayer()) - { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); - } - } -} + static + { + _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit + } + + public AirBind(StatsSet params) + { + } + + @Override + public boolean isInstant() + { + return false; + } + + @Override + public EffectType getEffectType() + { + return EffectType.KNOCK; + } + + @Override + public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) + { + for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) + { + if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // + && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) + { + final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); + if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) + { + nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); + } + } + } + } + + @Override + public void onExit(Creature effector, Creature effected, Skill skill) + { + if (!effected.isPlayer()) + { + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + } + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java index 0db7363b7a..dad2c3ab1b 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java @@ -55,7 +55,8 @@ public final class KnockBack extends AbstractEffect private final FlyType _type; // skill data - private static final Map _chainKnockSkills = new HashMap<>(36); + private static final Map _chainKnockSkills = new HashMap<>(36); + static { _chainKnockSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10250); // Heavy Hit _chainKnockSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10250); // Heavy Hit diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index 7095ed3e8f..5579e917ad 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -46,7 +46,8 @@ public final class Q00032_AnObviousLie extends Quest // Misc private static final int MIN_LVL = 45; // Reward - private static final Map EARS = new HashMap<>(); + private static final Map EARS = new HashMap<>(); + static { EARS.put("cat", 6843); // Cat Ears EARS.put("raccoon", 7680); // Raccoon ears diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 9dc74f2400..48a298ea2e 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -45,7 +45,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - + static { MONSTER_CHANCES.put(20236, 0.58); // Cave Servant MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java index 525fe43474..d44f3c6aa6 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -102,7 +102,8 @@ public final class Q00420_LittleWing extends Quest private static final int HATCHLING_FOOD = 4038; private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); // Drake Drops - private static final Map EGG_DROPS = new HashMap<>(); + private static final Map EGG_DROPS = new HashMap<>(); + static { EGG_DROPS.put(LESSER_BASILISK, SHAMHAI_EGG); EGG_DROPS.put(BASILISK, SHAMHAI_EGG); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/util/exp4j/Operators.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/util/exp4j/Operators.java index ca28599f0c..649327cd88 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/util/exp4j/Operators.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/util/exp4j/Operators.java @@ -27,7 +27,6 @@ public abstract class Operators private static final int INDEX_UNARYPLUS = 7; private static final Operator[] builtinOperators = new Operator[8]; - static { builtinOperators[INDEX_ADDITION] = new Operator("+", 2, true, Operator.PRECEDENCE_ADDITION) diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java index 250742c433..92321be894 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/DragonValley/LeopardDragonHachling.java @@ -1,114 +1,114 @@ -/* - * 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 . - */ -package ai.areas.DragonValley; - -import java.util.ArrayList; -import java.util.List; - -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; - -import ai.AbstractNpcAI; - -/** - * Leopard Dragon Hachling AI. - * @author Mobius - */ -public final class LeopardDragonHachling extends AbstractNpcAI -{ - // NPCs - private static final int DRAGON_HACHLING = 23434; - private static final int LEOPARD_DRAGON = 23435; - // Locations - private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); - - { - TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); - TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); - TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); - TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); - } - - private LeopardDragonHachling() - { - addAttackId(DRAGON_HACHLING); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) - { - if (npc.calculateDistance2D(nearestLocation(npc)) < 100) - { - final int random = getRandom(1, 4); - for (int counter = 1; counter < random; counter++) - { - final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time - leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); - addAttackDesire(leopard, player); - } - cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); - npc.deleteMe(); - } - else - { - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - } - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) - { - if (npc.getScriptValue() == 0) - { - npc.setScriptValue(1); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); - startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); - } - npc.abortAttack(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); - return null; - } - - private Location nearestLocation(Npc npc) - { - Location gotoLoc = TRANSFORM_LOCATIONS.get(0); - for (Location loc : TRANSFORM_LOCATIONS) - { - if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) - { - gotoLoc = loc; - } - } - return gotoLoc; - } - - public static void main(String[] args) - { - new LeopardDragonHachling(); - } -} +/* + * 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 . + */ +package ai.areas.DragonValley; + +import java.util.ArrayList; +import java.util.List; + +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; + +import ai.AbstractNpcAI; + +/** + * Leopard Dragon Hachling AI. + * @author Mobius + */ +public final class LeopardDragonHachling extends AbstractNpcAI +{ + // NPCs + private static final int DRAGON_HACHLING = 23434; + private static final int LEOPARD_DRAGON = 23435; + // Locations + private static final List TRANSFORM_LOCATIONS = new ArrayList<>(); + static + { + TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944)); + TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076)); + TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776)); + TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648)); + } + + private LeopardDragonHachling() + { + addAttackId(DRAGON_HACHLING); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if ((npc != null) && event.equals("MOVE_TO_TRANSFORM")) + { + if (npc.calculateDistance2D(nearestLocation(npc)) < 100) + { + final int random = getRandom(1, 4); + for (int counter = 1; counter < random; counter++) + { + final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time + leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH)); + addAttackDesire(leopard, player); + } + cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player); + npc.deleteMe(); + } + else + { + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getScriptValue() == 0) + { + npc.setScriptValue(1); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON)); + startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true); + } + npc.abortAttack(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc)); + return null; + } + + private Location nearestLocation(Npc npc) + { + Location gotoLoc = TRANSFORM_LOCATIONS.get(0); + for (Location loc : TRANSFORM_LOCATIONS) + { + if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc)) + { + gotoLoc = loc; + } + } + return gotoLoc; + } + + public static void main(String[] args) + { + new LeopardDragonHachling(); + } +} diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java index 56d5e6f72b..6ee86b5890 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/areas/TalkingIsland/Raina/Raina.java @@ -109,7 +109,8 @@ public final class Raina extends AbstractNpcAI subclassSetMap.put(PlayerClass.Spellhowler, subclasseSet5); } - private static final Map classCloak = new HashMap<>(); + private static final Map classCloak = new HashMap<>(); + static { classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak classCloak.put(CategoryType.SIXTH_TIR_GROUP, 30311); // Sapyros Cloak Grade @@ -121,7 +122,8 @@ public final class Raina extends AbstractNpcAI classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade } - private static final List dualClassList = new ArrayList<>(); + private static final List dualClassList = new ArrayList<>(); + static { dualClassList.addAll(Arrays.asList(PlayerClass.sigelPhoenixKnight, PlayerClass.sigelHellKnight, PlayerClass.sigelEvasTemplar, PlayerClass.sigelShilenTemplar)); dualClassList.addAll(Arrays.asList(PlayerClass.tyrrDuelist, PlayerClass.tyrrDreadnought, PlayerClass.tyrrTitan, PlayerClass.tyrrGrandKhavatari, PlayerClass.tyrrDoombringer)); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java index db35665c98..c9e88ac760 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/AdventureGuildsman/AdventureGuildsman.java @@ -73,7 +73,8 @@ public class AdventureGuildsman extends AbstractNpcAI }; // Misc //@formatter:off - private static final Map R_CLASS_TALISMAN = new HashMap<>(); + private static final Map R_CLASS_TALISMAN = new HashMap<>(); + static { R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735); R_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 736); @@ -86,7 +87,8 @@ public class AdventureGuildsman extends AbstractNpcAI R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736); R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741); } - private static final Map R90_CLASS_TALISMAN = new HashMap<>(); + private static final Map R90_CLASS_TALISMAN = new HashMap<>(); + static { R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743); R90_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 744); @@ -99,7 +101,8 @@ public class AdventureGuildsman extends AbstractNpcAI R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744); R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749); } - private static final Map R95_CLASS_TALISMAN = new HashMap<>(); + private static final Map R95_CLASS_TALISMAN = new HashMap<>(); + static { R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751); R95_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 752); @@ -112,7 +115,8 @@ public class AdventureGuildsman extends AbstractNpcAI R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752); R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757); } - private static final Map R99_CLASS_TALISMAN = new HashMap<>(); + private static final Map R99_CLASS_TALISMAN = new HashMap<>(); + static { R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759); R99_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 760); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index c74cba2e07..5a664e103d 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java index 83775af1c1..3dfd2d48ff 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/others/OlyManager/OlyManager.java @@ -55,7 +55,8 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler // NPC private static final int MANAGER = 31688; // Misc - private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + private static final Map EQUIPMENT_MULTISELL = new HashMap<>(); + static { EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917); EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_TIR_GROUP, 918); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/AirBind.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/AirBind.java index 72502bc106..9dd9a94a48 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/AirBind.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/AirBind.java @@ -1,121 +1,122 @@ -/* - * 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 . - */ -package handlers.effecthandlers; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.enums.CategoryType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.base.ClassId; -import com.l2jmobius.gameserver.model.effects.AbstractEffect; -import com.l2jmobius.gameserver.model.effects.EffectType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; - -/** - * @author Mobius - */ -public final class AirBind extends AbstractEffect -{ - // skill data +/* + * 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 . + */ +package handlers.effecthandlers; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.ai.CtrlEvent; +import com.l2jmobius.gameserver.enums.CategoryType; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.base.ClassId; +import com.l2jmobius.gameserver.model.effects.AbstractEffect; +import com.l2jmobius.gameserver.model.effects.EffectType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest; + +/** + * @author Mobius + */ +public final class AirBind extends AbstractEffect +{ + // skill data private static final Map _chainedAirSkills = new HashMap<>(36); - { - _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit - _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit - } - - public AirBind(StatsSet params) - { - } - - @Override - public boolean isInstant() - { - return false; - } - - @Override - public EffectType getEffectType() - { - return EffectType.KNOCK; - } - - @Override - public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) - { - if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // - && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) - { - final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); - if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) - { - nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); - } - } - } - } - - @Override - public void onExit(Creature effector, Creature effected, Skill skill) - { - if (!effected.isPlayer()) - { - effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); - } - } -} + static + { + _chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit + _chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit + } + + public AirBind(StatsSet params) + { + } + + @Override + public boolean isInstant() + { + return false; + } + + @Override + public EffectType getEffectType() + { + return EffectType.KNOCK; + } + + @Override + public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item) + { + for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200)) + { + if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) // + && nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive()) + { + final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId()); + if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1) + { + nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5)); + } + } + } + } + + @Override + public void onExit(Creature effector, Creature effected, Skill skill) + { + if (!effected.isPlayer()) + { + effected.getAI().notifyEvent(CtrlEvent.EVT_THINK); + } + } +} diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java index 0db7363b7a..dad2c3ab1b 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/effecthandlers/KnockBack.java @@ -55,7 +55,8 @@ public final class KnockBack extends AbstractEffect private final FlyType _type; // skill data - private static final Map _chainKnockSkills = new HashMap<>(36); + private static final Map _chainKnockSkills = new HashMap<>(36); + static { _chainKnockSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10250); // Heavy Hit _chainKnockSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10250); // Heavy Hit diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index 7095ed3e8f..5579e917ad 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -46,7 +46,8 @@ public final class Q00032_AnObviousLie extends Quest // Misc private static final int MIN_LVL = 45; // Reward - private static final Map EARS = new HashMap<>(); + private static final Map EARS = new HashMap<>(); + static { EARS.put("cat", 6843); // Cat Ears EARS.put("raccoon", 7680); // Raccoon ears diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 9dc74f2400..48a298ea2e 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -45,7 +45,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - + static { MONSTER_CHANCES.put(20236, 0.58); // Cave Servant MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java index de5db207d8..27fb0c3f6d 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -100,7 +100,8 @@ public final class Q00420_LittleWing extends Quest private static final int HATCHLING_FOOD = 4038; private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); // Drake Drops - private static final Map EGG_DROPS = new HashMap<>(); + private static final Map EGG_DROPS = new HashMap<>(); + static { EGG_DROPS.put(LESSER_BASILISK, SHAMHAI_EGG); EGG_DROPS.put(BASILISK, SHAMHAI_EGG); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/util/exp4j/Operators.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/util/exp4j/Operators.java index ca28599f0c..649327cd88 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/util/exp4j/Operators.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/util/exp4j/Operators.java @@ -27,7 +27,6 @@ public abstract class Operators private static final int INDEX_UNARYPLUS = 7; private static final Operator[] builtinOperators = new Operator[8]; - static { builtinOperators[INDEX_ADDITION] = new Operator("+", 2, true, Operator.PRECEDENCE_ADDITION) diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/ai/bosses/Core.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/ai/bosses/Core.java index 9b6b7ad164..31f61ed762 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/ai/bosses/Core.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/ai/bosses/Core.java @@ -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 MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/custom/EchoCrystals/EchoCrystals.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/custom/EchoCrystals/EchoCrystals.java index 10a50dcd09..94e6910b42 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/custom/EchoCrystals/EchoCrystals.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/custom/EchoCrystals/EchoCrystals.java @@ -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 . - */ -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 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 . + */ +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 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(); + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q004_LongliveThePaagrioLord/Q004_LongliveThePaagrioLord.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q004_LongliveThePaagrioLord/Q004_LongliveThePaagrioLord.java index 8415e5a6e6..d1816a71f9 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q004_LongliveThePaagrioLord/Q004_LongliveThePaagrioLord.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q004_LongliveThePaagrioLord/Q004_LongliveThePaagrioLord.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q038_DragonFangs/Q038_DragonFangs.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q038_DragonFangs/Q038_DragonFangs.java index d546ba957c..417b6086f9 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q038_DragonFangs/Q038_DragonFangs.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q038_DragonFangs/Q038_DragonFangs.java @@ -64,7 +64,8 @@ public class Q038_DragonFangs extends Quest }; // Droplist - private static final Map DROPLIST = new HashMap<>(); + private static final Map DROPLIST = new HashMap<>(); + static { DROPLIST.put(21100, new int[] { diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q039_RedEyedInvaders/Q039_RedEyedInvaders.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q039_RedEyedInvaders/Q039_RedEyedInvaders.java index f37809158b..0fc0e5c8c7 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q039_RedEyedInvaders/Q039_RedEyedInvaders.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q039_RedEyedInvaders/Q039_RedEyedInvaders.java @@ -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 . - */ -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 . + */ +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 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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q162_CurseOfTheUndergroundFortress/Q162_CurseOfTheUndergroundFortress.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q162_CurseOfTheUndergroundFortress/Q162_CurseOfTheUndergroundFortress.java index fc2c790725..d7185e9503 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q162_CurseOfTheUndergroundFortress/Q162_CurseOfTheUndergroundFortress.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q162_CurseOfTheUndergroundFortress/Q162_CurseOfTheUndergroundFortress.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q165_ShilensHunt/Q165_ShilensHunt.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q165_ShilensHunt/Q165_ShilensHunt.java index 3d01be98b8..7d50b8ffd8 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q165_ShilensHunt/Q165_ShilensHunt.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q165_ShilensHunt/Q165_ShilensHunt.java @@ -41,7 +41,8 @@ public class Q165_ShilensHunt extends Quest private static final int LESSER_HEALING_POTION = 1060; // Drop chances - private static final Map CHANCES = new HashMap<>(); + private static final Map CHANCES = new HashMap<>(); + static { CHANCES.put(ASHEN_WOLF, 1000000); CHANCES.put(YOUNG_BROWN_KELTIR, 333333); diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q171_ActsOfEvil/Q171_ActsOfEvil.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q171_ActsOfEvil/Q171_ActsOfEvil.java index 5d83f9e6d0..e12453e2af 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q171_ActsOfEvil/Q171_ActsOfEvil.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q171_ActsOfEvil/Q171_ActsOfEvil.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q219_TestimonyOfFate/Q219_TestimonyOfFate.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q219_TestimonyOfFate/Q219_TestimonyOfFate.java index cd6a155be3..f1df3fea2d 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q219_TestimonyOfFate/Q219_TestimonyOfFate.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q219_TestimonyOfFate/Q219_TestimonyOfFate.java @@ -1,646 +1,647 @@ -/* - * 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 . - */ -package quests.Q219_TestimonyOfFate; - -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; -import com.l2jmobius.gameserver.network.serverpackets.SocialAction; - -public class Q219_TestimonyOfFate extends Quest -{ - private static final String qn = "Q219_TestimonyOfFate"; - - // NPCs - private static final int KAIRA = 30476; - private static final int METHEUS = 30614; - private static final int IXIA = 30463; - private static final int ALDER_SPIRIT = 30613; - private static final int ROA = 30114; - private static final int NORMAN = 30210; - private static final int THIFIELL = 30358; - private static final int ARKENIA = 30419; - private static final int BLOODY_PIXY = 31845; - private static final int BLIGHT_TREANT = 31850; - - // Items - private static final int KAIRA_LETTER = 3173; - private static final int METHEUS_FUNERAL_JAR = 3174; - private static final int KASANDRA_REMAINS = 3175; - private static final int HERBALISM_TEXTBOOK = 3176; - private static final int IXIA_LIST = 3177; - private static final int MEDUSA_ICHOR = 3178; - private static final int MARSH_SPIDER_FLUIDS = 3179; - private static final int DEAD_SEEKER_DUNG = 3180; - private static final int TYRANT_BLOOD = 3181; - private static final int NIGHTSHADE_ROOT = 3182; - private static final int BELLADONNA = 3183; - private static final int ALDER_SKULL_1 = 3184; - private static final int ALDER_SKULL_2 = 3185; - private static final int ALDER_RECEIPT = 3186; - private static final int REVELATIONS_MANUSCRIPT = 3187; - private static final int KAIRA_RECOMMENDATION = 3189; - private static final int KAIRA_INSTRUCTIONS = 3188; - private static final int PALUS_CHARM = 3190; - private static final int THIFIELL_LETTER = 3191; - private static final int ARKENIA_NOTE = 3192; - private static final int PIXY_GARNET = 3193; - private static final int GRANDIS_SKULL = 3194; - private static final int KARUL_BUGBEAR_SKULL = 3195; - private static final int BREKA_OVERLORD_SKULL = 3196; - private static final int LETO_OVERLORD_SKULL = 3197; - private static final int RED_FAIRY_DUST = 3198; - private static final int BLIGHT_TREANT_SEED = 3199; - private static final int BLACK_WILLOW_LEAF = 3200; - private static final int BLIGHT_TREANT_SAP = 3201; - private static final int ARKENIA_LETTER = 3202; - - // Rewards - private static final int MARK_OF_FATE = 3172; - private static final int DIMENSIONAL_DIAMOND = 7562; - - // Monsters - private static final int HANGMAN_TREE = 20144; - private static final int MARSH_STAKATO = 20157; - private static final int MEDUSA = 20158; - private static final int TYRANT = 20192; - private static final int TYRANT_KINGPIN = 20193; - private static final int DEAD_SEEKER = 20202; - private static final int MARSH_STAKATO_WORKER = 20230; - private static final int MARSH_STAKATO_SOLDIER = 20232; - private static final int MARSH_SPIDER = 20233; - private static final int MARSH_STAKATO_DRONE = 20234; - private static final int BREKA_ORC_OVERLORD = 20270; - private static final int GRANDIS = 20554; - private static final int LETO_LIZARDMAN_OVERLORD = 20582; - private static final int KARUL_BUGBEAR = 20600; - private static final int BLACK_WILLOW_LURKER = 27079; - - // Cond 6 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 . + */ +package quests.Q219_TestimonyOfFate; + +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; +import com.l2jmobius.gameserver.network.serverpackets.SocialAction; + +public class Q219_TestimonyOfFate extends Quest +{ + private static final String qn = "Q219_TestimonyOfFate"; + + // NPCs + private static final int KAIRA = 30476; + private static final int METHEUS = 30614; + private static final int IXIA = 30463; + private static final int ALDER_SPIRIT = 30613; + private static final int ROA = 30114; + private static final int NORMAN = 30210; + private static final int THIFIELL = 30358; + private static final int ARKENIA = 30419; + private static final int BLOODY_PIXY = 31845; + private static final int BLIGHT_TREANT = 31850; + + // Items + private static final int KAIRA_LETTER = 3173; + private static final int METHEUS_FUNERAL_JAR = 3174; + private static final int KASANDRA_REMAINS = 3175; + private static final int HERBALISM_TEXTBOOK = 3176; + private static final int IXIA_LIST = 3177; + private static final int MEDUSA_ICHOR = 3178; + private static final int MARSH_SPIDER_FLUIDS = 3179; + private static final int DEAD_SEEKER_DUNG = 3180; + private static final int TYRANT_BLOOD = 3181; + private static final int NIGHTSHADE_ROOT = 3182; + private static final int BELLADONNA = 3183; + private static final int ALDER_SKULL_1 = 3184; + private static final int ALDER_SKULL_2 = 3185; + private static final int ALDER_RECEIPT = 3186; + private static final int REVELATIONS_MANUSCRIPT = 3187; + private static final int KAIRA_RECOMMENDATION = 3189; + private static final int KAIRA_INSTRUCTIONS = 3188; + private static final int PALUS_CHARM = 3190; + private static final int THIFIELL_LETTER = 3191; + private static final int ARKENIA_NOTE = 3192; + private static final int PIXY_GARNET = 3193; + private static final int GRANDIS_SKULL = 3194; + private static final int KARUL_BUGBEAR_SKULL = 3195; + private static final int BREKA_OVERLORD_SKULL = 3196; + private static final int LETO_OVERLORD_SKULL = 3197; + private static final int RED_FAIRY_DUST = 3198; + private static final int BLIGHT_TREANT_SEED = 3199; + private static final int BLACK_WILLOW_LEAF = 3200; + private static final int BLIGHT_TREANT_SAP = 3201; + private static final int ARKENIA_LETTER = 3202; + + // Rewards + private static final int MARK_OF_FATE = 3172; + private static final int DIMENSIONAL_DIAMOND = 7562; + + // Monsters + private static final int HANGMAN_TREE = 20144; + private static final int MARSH_STAKATO = 20157; + private static final int MEDUSA = 20158; + private static final int TYRANT = 20192; + private static final int TYRANT_KINGPIN = 20193; + private static final int DEAD_SEEKER = 20202; + private static final int MARSH_STAKATO_WORKER = 20230; + private static final int MARSH_STAKATO_SOLDIER = 20232; + private static final int MARSH_SPIDER = 20233; + private static final int MARSH_STAKATO_DRONE = 20234; + private static final int BREKA_ORC_OVERLORD = 20270; + private static final int GRANDIS = 20554; + private static final int LETO_LIZARDMAN_OVERLORD = 20582; + private static final int KARUL_BUGBEAR = 20600; + private static final int BLACK_WILLOW_LURKER = 27079; + + // Cond 6 drop chances private static final Map CHANCES = new HashMap<>(); - { - CHANCES.put(DEAD_SEEKER, 500000); - CHANCES.put(TYRANT, 500000); - CHANCES.put(TYRANT_KINGPIN, 600000); - CHANCES.put(MEDUSA, 500000); - CHANCES.put(MARSH_STAKATO, 400000); - CHANCES.put(MARSH_STAKATO_WORKER, 300000); - CHANCES.put(MARSH_STAKATO_SOLDIER, 500000); - CHANCES.put(MARSH_STAKATO_DRONE, 600000); - CHANCES.put(MARSH_SPIDER, 500000); - } - - public Q219_TestimonyOfFate() - { - super(219, qn, "Testimony of Fate"); - - registerQuestItems(KAIRA_LETTER, METHEUS_FUNERAL_JAR, KASANDRA_REMAINS, HERBALISM_TEXTBOOK, IXIA_LIST, MEDUSA_ICHOR, MARSH_SPIDER_FLUIDS, DEAD_SEEKER_DUNG, TYRANT_BLOOD, NIGHTSHADE_ROOT, BELLADONNA, ALDER_SKULL_1, ALDER_SKULL_2, ALDER_RECEIPT, REVELATIONS_MANUSCRIPT, KAIRA_RECOMMENDATION, KAIRA_INSTRUCTIONS, PALUS_CHARM, THIFIELL_LETTER, ARKENIA_NOTE, PIXY_GARNET, GRANDIS_SKULL, KARUL_BUGBEAR_SKULL, BREKA_OVERLORD_SKULL, LETO_OVERLORD_SKULL, RED_FAIRY_DUST, BLIGHT_TREANT_SEED, BLACK_WILLOW_LEAF, BLIGHT_TREANT_SAP, ARKENIA_LETTER); - - addStartNpc(KAIRA); - addTalkId(KAIRA, METHEUS, IXIA, ALDER_SPIRIT, ROA, NORMAN, THIFIELL, ARKENIA, BLOODY_PIXY, BLIGHT_TREANT); - - addKillId(HANGMAN_TREE, MARSH_STAKATO, MEDUSA, TYRANT, TYRANT_KINGPIN, DEAD_SEEKER, MARSH_STAKATO_WORKER, MARSH_STAKATO_SOLDIER, MARSH_SPIDER, MARSH_STAKATO_DRONE, BREKA_ORC_OVERLORD, GRANDIS, LETO_LIZARDMAN_OVERLORD, KARUL_BUGBEAR, BLACK_WILLOW_LURKER); - } - - @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("30476-05.htm")) - { - st.setState(State.STARTED); - st.set("cond", "1"); - st.playSound(QuestState.SOUND_ACCEPT); - st.giveItems(KAIRA_LETTER, 1); - - if (!player.getVariables().getBool("secondClassChange37", false)) - { - htmltext = "30476-05a.htm"; - st.giveItems(DIMENSIONAL_DIAMOND, DF_REWARD_37.get(player.getRace().ordinal())); - player.getVariables().set("secondClassChange37", true); - } - } - else if (event.equals("30114-04.htm")) - { - st.set("cond", "12"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(ALDER_SKULL_2, 1); - st.giveItems(ALDER_RECEIPT, 1); - } - else if (event.equals("30476-12.htm")) - { - st.playSound(QuestState.SOUND_MIDDLE); - - if (player.getLevel() < 38) - { - htmltext = "30476-13.htm"; - st.set("cond", "14"); - st.giveItems(KAIRA_INSTRUCTIONS, 1); - } - else - { - st.set("cond", "15"); - st.takeItems(REVELATIONS_MANUSCRIPT, 1); - st.giveItems(KAIRA_RECOMMENDATION, 1); - } - } - else if (event.equals("30419-02.htm")) - { - st.set("cond", "17"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(THIFIELL_LETTER, 1); - st.giveItems(ARKENIA_NOTE, 1); - } - else if (event.equals("31845-02.htm")) - { - st.playSound(QuestState.SOUND_ITEMGET); - st.giveItems(PIXY_GARNET, 1); - } - else if (event.equals("31850-02.htm")) - { - st.playSound(QuestState.SOUND_ITEMGET); - st.giveItems(BLIGHT_TREANT_SEED, 1); - } - else if (event.equals("30419-05.htm")) - { - st.set("cond", "18"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(ARKENIA_NOTE, 1); - st.takeItems(BLIGHT_TREANT_SAP, 1); - st.takeItems(RED_FAIRY_DUST, 1); - st.giveItems(ARKENIA_LETTER, 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: - if (player.getRace() != Race.darkelf) - { - htmltext = "30476-02.htm"; - } - else if ((player.getLevel() < 37) || (player.getClassId().level() != 1)) - { - htmltext = "30476-01.htm"; - } - else - { - htmltext = "30476-03.htm"; - } - break; - - case State.STARTED: - int cond = st.getInt("cond"); - switch (npc.getNpcId()) - { - case KAIRA: - if (cond == 1) - { - htmltext = "30476-06.htm"; - } - else if ((cond == 2) || (cond == 3)) - { - htmltext = "30476-07.htm"; - } - else if ((cond > 3) && (cond < 9)) - { - htmltext = "30476-08.htm"; - } - else if (cond == 9) - { - htmltext = "30476-09.htm"; - st.set("cond", "10"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(ALDER_SKULL_1, 1); - addSpawn(ALDER_SPIRIT, player, false, 0); - } - else if ((cond > 9) && (cond < 13)) - { - htmltext = "30476-10.htm"; - } - else if (cond == 13) - { - htmltext = "30476-11.htm"; - } - else if (cond == 14) - { - if (player.getLevel() < 38) - { - htmltext = "30476-14.htm"; - } - else - { - htmltext = "30476-12.htm"; - st.set("cond", "15"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(KAIRA_INSTRUCTIONS, 1); - st.takeItems(REVELATIONS_MANUSCRIPT, 1); - st.giveItems(KAIRA_RECOMMENDATION, 1); - } - } - else if (cond == 15) - { - htmltext = "30476-16.htm"; - } - else if (cond > 15) - { - htmltext = "30476-17.htm"; - } - break; - - case METHEUS: - if (cond == 1) - { - htmltext = "30614-01.htm"; - st.set("cond", "2"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(KAIRA_LETTER, 1); - st.giveItems(METHEUS_FUNERAL_JAR, 1); - } - else if (cond == 2) - { - htmltext = "30614-02.htm"; - } - else if (cond == 3) - { - htmltext = "30614-03.htm"; - st.set("cond", "4"); - st.set("cond", "5"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(KASANDRA_REMAINS, 1); - st.giveItems(HERBALISM_TEXTBOOK, 1); - } - else if ((cond > 3) && (cond < 8)) - { - htmltext = "30614-04.htm"; - } - else if (cond == 8) - { - htmltext = "30614-05.htm"; - st.set("cond", "9"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(BELLADONNA, 1); - st.giveItems(ALDER_SKULL_1, 1); - } - else if (cond > 8) - { - htmltext = "30614-06.htm"; - } - break; - - case IXIA: - if (cond == 5) - { - htmltext = "30463-01.htm"; - st.set("cond", "6"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(HERBALISM_TEXTBOOK, 1); - st.giveItems(IXIA_LIST, 1); - } - else if (cond == 6) - { - htmltext = "30463-02.htm"; - } - else if (cond == 7) - { - htmltext = "30463-03.htm"; - st.set("cond", "8"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(IXIA_LIST, 1); - st.takeItems(DEAD_SEEKER_DUNG, -1); - st.takeItems(MARSH_SPIDER_FLUIDS, -1); - st.takeItems(MEDUSA_ICHOR, -1); - st.takeItems(NIGHTSHADE_ROOT, -1); - st.takeItems(TYRANT_BLOOD, -1); - st.giveItems(BELLADONNA, 1); - } - else if (cond == 8) - { - htmltext = "30463-04.htm"; - } - else if (cond > 8) - { - htmltext = "30463-05.htm"; - } - break; - - case ALDER_SPIRIT: - if (cond == 10) - { - htmltext = "30613-01.htm"; - st.set("cond", "11"); - st.playSound(QuestState.SOUND_MIDDLE); - st.giveItems(ALDER_SKULL_2, 1); - npc.deleteMe(); - } - break; - - case ROA: - if (cond == 11) - { - htmltext = "30114-01.htm"; - } - else if (cond == 12) - { - htmltext = "30114-05.htm"; - } - else if (cond > 12) - { - htmltext = "30114-06.htm"; - } - break; - - case NORMAN: - if (cond == 12) - { - htmltext = "30210-01.htm"; - st.set("cond", "13"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(ALDER_RECEIPT, 1); - st.giveItems(REVELATIONS_MANUSCRIPT, 1); - } - else if (cond > 12) - { - htmltext = "30210-02.htm"; - } - break; - - case THIFIELL: - if (cond == 15) - { - htmltext = "30358-01.htm"; - st.set("cond", "16"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(KAIRA_RECOMMENDATION, 1); - st.giveItems(PALUS_CHARM, 1); - st.giveItems(THIFIELL_LETTER, 1); - } - else if (cond == 16) - { - htmltext = "30358-02.htm"; - } - else if (cond == 17) - { - htmltext = "30358-03.htm"; - } - else if (cond == 18) - { - htmltext = "30358-04.htm"; - st.takeItems(PALUS_CHARM, 1); - st.takeItems(ARKENIA_LETTER, 1); - st.giveItems(MARK_OF_FATE, 1); - st.rewardExpAndSp(68183, 1750); - player.broadcastPacket(new SocialAction(player.getObjectId(), 3)); - st.playSound(QuestState.SOUND_FINISH); - st.exitQuest(false); - } - break; - - case ARKENIA: - if (cond == 16) - { - htmltext = "30419-01.htm"; - } - else if (cond == 17) - { - htmltext = (st.hasQuestItems(BLIGHT_TREANT_SAP) && st.hasQuestItems(RED_FAIRY_DUST)) ? "30419-04.htm" : "30419-03.htm"; - } - else if (cond == 18) - { - htmltext = "30419-06.htm"; - } - break; - - case BLOODY_PIXY: - if (cond == 17) - { - if (st.hasQuestItems(PIXY_GARNET)) - { - if ((st.getQuestItemsCount(GRANDIS_SKULL) >= 10) && (st.getQuestItemsCount(KARUL_BUGBEAR_SKULL) >= 10) && (st.getQuestItemsCount(BREKA_OVERLORD_SKULL) >= 10) && (st.getQuestItemsCount(LETO_OVERLORD_SKULL) >= 10)) - { - htmltext = "31845-04.htm"; - st.playSound(QuestState.SOUND_ITEMGET); - st.takeItems(BREKA_OVERLORD_SKULL, -1); - st.takeItems(GRANDIS_SKULL, -1); - st.takeItems(KARUL_BUGBEAR_SKULL, -1); - st.takeItems(LETO_OVERLORD_SKULL, -1); - st.takeItems(PIXY_GARNET, 1); - st.giveItems(RED_FAIRY_DUST, 1); - } - else - { - htmltext = "31845-03.htm"; - } - } - else if (st.hasQuestItems(RED_FAIRY_DUST)) - { - htmltext = "31845-05.htm"; - } - else - { - htmltext = "31845-01.htm"; - } - } - else if (cond == 18) - { - htmltext = "31845-05.htm"; - } - break; - - case BLIGHT_TREANT: - if (cond == 17) - { - if (st.hasQuestItems(BLIGHT_TREANT_SEED)) - { - if (st.hasQuestItems(BLACK_WILLOW_LEAF)) - { - htmltext = "31850-04.htm"; - st.playSound(QuestState.SOUND_ITEMGET); - st.takeItems(BLACK_WILLOW_LEAF, 1); - st.takeItems(BLIGHT_TREANT_SEED, 1); - st.giveItems(BLIGHT_TREANT_SAP, 1); - } - else - { - htmltext = "31850-03.htm"; - } - } - else if (st.hasQuestItems(BLIGHT_TREANT_SAP)) - { - htmltext = "31850-05.htm"; - } - else - { - htmltext = "31850-01.htm"; - } - } - else if (cond == 18) - { - htmltext = "31850-05.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 HANGMAN_TREE: - if (st.getInt("cond") == 2) - { - st.set("cond", "3"); - st.playSound(QuestState.SOUND_MIDDLE); - st.takeItems(METHEUS_FUNERAL_JAR, 1); - st.giveItems(KASANDRA_REMAINS, 1); - } - break; - - case DEAD_SEEKER: - if ((st.getInt("cond") == 6) && st.dropItems(DEAD_SEEKER_DUNG, 1, 10, CHANCES.get(npcId))) - { - if ((st.getQuestItemsCount(TYRANT_BLOOD) >= 10) && (st.getQuestItemsCount(MEDUSA_ICHOR) >= 10) && (st.getQuestItemsCount(NIGHTSHADE_ROOT) >= 10) && (st.getQuestItemsCount(MARSH_SPIDER_FLUIDS) >= 10)) - { - st.set("cond", "7"); - } - } - break; - - case TYRANT: - case TYRANT_KINGPIN: - if ((st.getInt("cond") == 6) && st.dropItems(TYRANT_BLOOD, 1, 10, CHANCES.get(npcId))) - { - if ((st.getQuestItemsCount(DEAD_SEEKER_DUNG) >= 10) && (st.getQuestItemsCount(MEDUSA_ICHOR) >= 10) && (st.getQuestItemsCount(NIGHTSHADE_ROOT) >= 10) && (st.getQuestItemsCount(MARSH_SPIDER_FLUIDS) >= 10)) - { - st.set("cond", "7"); - } - } - break; - - case MEDUSA: - if ((st.getInt("cond") == 6) && st.dropItems(MEDUSA_ICHOR, 1, 10, CHANCES.get(npcId))) - { - if ((st.getQuestItemsCount(DEAD_SEEKER_DUNG) >= 10) && (st.getQuestItemsCount(TYRANT_BLOOD) >= 10) && (st.getQuestItemsCount(NIGHTSHADE_ROOT) >= 10) && (st.getQuestItemsCount(MARSH_SPIDER_FLUIDS) >= 10)) - { - st.set("cond", "7"); - } - } - break; - - case MARSH_STAKATO: - case MARSH_STAKATO_WORKER: - case MARSH_STAKATO_SOLDIER: - case MARSH_STAKATO_DRONE: - if ((st.getInt("cond") == 6) && st.dropItems(NIGHTSHADE_ROOT, 1, 10, CHANCES.get(npcId))) - { - if ((st.getQuestItemsCount(DEAD_SEEKER_DUNG) >= 10) && (st.getQuestItemsCount(TYRANT_BLOOD) >= 10) && (st.getQuestItemsCount(MEDUSA_ICHOR) >= 10) && (st.getQuestItemsCount(MARSH_SPIDER_FLUIDS) >= 10)) - { - st.set("cond", "7"); - } - } - break; - - case MARSH_SPIDER: - if ((st.getInt("cond") == 6) && st.dropItems(MARSH_SPIDER_FLUIDS, 1, 10, CHANCES.get(npcId))) - { - if ((st.getQuestItemsCount(DEAD_SEEKER_DUNG) >= 10) && (st.getQuestItemsCount(TYRANT_BLOOD) >= 10) && (st.getQuestItemsCount(MEDUSA_ICHOR) >= 10) && (st.getQuestItemsCount(NIGHTSHADE_ROOT) >= 10)) - { - st.set("cond", "7"); - } - } - break; - - case GRANDIS: - if (st.hasQuestItems(PIXY_GARNET)) - { - st.dropItemsAlways(GRANDIS_SKULL, 1, 10); - } - break; - - case LETO_LIZARDMAN_OVERLORD: - if (st.hasQuestItems(PIXY_GARNET)) - { - st.dropItemsAlways(LETO_OVERLORD_SKULL, 1, 10); - } - break; - - case BREKA_ORC_OVERLORD: - if (st.hasQuestItems(PIXY_GARNET)) - { - st.dropItemsAlways(BREKA_OVERLORD_SKULL, 1, 10); - } - break; - - case KARUL_BUGBEAR: - if (st.hasQuestItems(PIXY_GARNET)) - { - st.dropItemsAlways(KARUL_BUGBEAR_SKULL, 1, 10); - } - break; - - case BLACK_WILLOW_LURKER: - if (st.hasQuestItems(BLIGHT_TREANT_SEED)) - { - st.dropItemsAlways(BLACK_WILLOW_LEAF, 1, 1); - } - break; - } - - return null; - } + static + { + CHANCES.put(DEAD_SEEKER, 500000); + CHANCES.put(TYRANT, 500000); + CHANCES.put(TYRANT_KINGPIN, 600000); + CHANCES.put(MEDUSA, 500000); + CHANCES.put(MARSH_STAKATO, 400000); + CHANCES.put(MARSH_STAKATO_WORKER, 300000); + CHANCES.put(MARSH_STAKATO_SOLDIER, 500000); + CHANCES.put(MARSH_STAKATO_DRONE, 600000); + CHANCES.put(MARSH_SPIDER, 500000); + } + + public Q219_TestimonyOfFate() + { + super(219, qn, "Testimony of Fate"); + + registerQuestItems(KAIRA_LETTER, METHEUS_FUNERAL_JAR, KASANDRA_REMAINS, HERBALISM_TEXTBOOK, IXIA_LIST, MEDUSA_ICHOR, MARSH_SPIDER_FLUIDS, DEAD_SEEKER_DUNG, TYRANT_BLOOD, NIGHTSHADE_ROOT, BELLADONNA, ALDER_SKULL_1, ALDER_SKULL_2, ALDER_RECEIPT, REVELATIONS_MANUSCRIPT, KAIRA_RECOMMENDATION, KAIRA_INSTRUCTIONS, PALUS_CHARM, THIFIELL_LETTER, ARKENIA_NOTE, PIXY_GARNET, GRANDIS_SKULL, KARUL_BUGBEAR_SKULL, BREKA_OVERLORD_SKULL, LETO_OVERLORD_SKULL, RED_FAIRY_DUST, BLIGHT_TREANT_SEED, BLACK_WILLOW_LEAF, BLIGHT_TREANT_SAP, ARKENIA_LETTER); + + addStartNpc(KAIRA); + addTalkId(KAIRA, METHEUS, IXIA, ALDER_SPIRIT, ROA, NORMAN, THIFIELL, ARKENIA, BLOODY_PIXY, BLIGHT_TREANT); + + addKillId(HANGMAN_TREE, MARSH_STAKATO, MEDUSA, TYRANT, TYRANT_KINGPIN, DEAD_SEEKER, MARSH_STAKATO_WORKER, MARSH_STAKATO_SOLDIER, MARSH_SPIDER, MARSH_STAKATO_DRONE, BREKA_ORC_OVERLORD, GRANDIS, LETO_LIZARDMAN_OVERLORD, KARUL_BUGBEAR, BLACK_WILLOW_LURKER); + } + + @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("30476-05.htm")) + { + st.setState(State.STARTED); + st.set("cond", "1"); + st.playSound(QuestState.SOUND_ACCEPT); + st.giveItems(KAIRA_LETTER, 1); + + if (!player.getVariables().getBool("secondClassChange37", false)) + { + htmltext = "30476-05a.htm"; + st.giveItems(DIMENSIONAL_DIAMOND, DF_REWARD_37.get(player.getRace().ordinal())); + player.getVariables().set("secondClassChange37", true); + } + } + else if (event.equals("30114-04.htm")) + { + st.set("cond", "12"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(ALDER_SKULL_2, 1); + st.giveItems(ALDER_RECEIPT, 1); + } + else if (event.equals("30476-12.htm")) + { + st.playSound(QuestState.SOUND_MIDDLE); + + if (player.getLevel() < 38) + { + htmltext = "30476-13.htm"; + st.set("cond", "14"); + st.giveItems(KAIRA_INSTRUCTIONS, 1); + } + else + { + st.set("cond", "15"); + st.takeItems(REVELATIONS_MANUSCRIPT, 1); + st.giveItems(KAIRA_RECOMMENDATION, 1); + } + } + else if (event.equals("30419-02.htm")) + { + st.set("cond", "17"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(THIFIELL_LETTER, 1); + st.giveItems(ARKENIA_NOTE, 1); + } + else if (event.equals("31845-02.htm")) + { + st.playSound(QuestState.SOUND_ITEMGET); + st.giveItems(PIXY_GARNET, 1); + } + else if (event.equals("31850-02.htm")) + { + st.playSound(QuestState.SOUND_ITEMGET); + st.giveItems(BLIGHT_TREANT_SEED, 1); + } + else if (event.equals("30419-05.htm")) + { + st.set("cond", "18"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(ARKENIA_NOTE, 1); + st.takeItems(BLIGHT_TREANT_SAP, 1); + st.takeItems(RED_FAIRY_DUST, 1); + st.giveItems(ARKENIA_LETTER, 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: + if (player.getRace() != Race.darkelf) + { + htmltext = "30476-02.htm"; + } + else if ((player.getLevel() < 37) || (player.getClassId().level() != 1)) + { + htmltext = "30476-01.htm"; + } + else + { + htmltext = "30476-03.htm"; + } + break; + + case State.STARTED: + int cond = st.getInt("cond"); + switch (npc.getNpcId()) + { + case KAIRA: + if (cond == 1) + { + htmltext = "30476-06.htm"; + } + else if ((cond == 2) || (cond == 3)) + { + htmltext = "30476-07.htm"; + } + else if ((cond > 3) && (cond < 9)) + { + htmltext = "30476-08.htm"; + } + else if (cond == 9) + { + htmltext = "30476-09.htm"; + st.set("cond", "10"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(ALDER_SKULL_1, 1); + addSpawn(ALDER_SPIRIT, player, false, 0); + } + else if ((cond > 9) && (cond < 13)) + { + htmltext = "30476-10.htm"; + } + else if (cond == 13) + { + htmltext = "30476-11.htm"; + } + else if (cond == 14) + { + if (player.getLevel() < 38) + { + htmltext = "30476-14.htm"; + } + else + { + htmltext = "30476-12.htm"; + st.set("cond", "15"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(KAIRA_INSTRUCTIONS, 1); + st.takeItems(REVELATIONS_MANUSCRIPT, 1); + st.giveItems(KAIRA_RECOMMENDATION, 1); + } + } + else if (cond == 15) + { + htmltext = "30476-16.htm"; + } + else if (cond > 15) + { + htmltext = "30476-17.htm"; + } + break; + + case METHEUS: + if (cond == 1) + { + htmltext = "30614-01.htm"; + st.set("cond", "2"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(KAIRA_LETTER, 1); + st.giveItems(METHEUS_FUNERAL_JAR, 1); + } + else if (cond == 2) + { + htmltext = "30614-02.htm"; + } + else if (cond == 3) + { + htmltext = "30614-03.htm"; + st.set("cond", "4"); + st.set("cond", "5"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(KASANDRA_REMAINS, 1); + st.giveItems(HERBALISM_TEXTBOOK, 1); + } + else if ((cond > 3) && (cond < 8)) + { + htmltext = "30614-04.htm"; + } + else if (cond == 8) + { + htmltext = "30614-05.htm"; + st.set("cond", "9"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(BELLADONNA, 1); + st.giveItems(ALDER_SKULL_1, 1); + } + else if (cond > 8) + { + htmltext = "30614-06.htm"; + } + break; + + case IXIA: + if (cond == 5) + { + htmltext = "30463-01.htm"; + st.set("cond", "6"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(HERBALISM_TEXTBOOK, 1); + st.giveItems(IXIA_LIST, 1); + } + else if (cond == 6) + { + htmltext = "30463-02.htm"; + } + else if (cond == 7) + { + htmltext = "30463-03.htm"; + st.set("cond", "8"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(IXIA_LIST, 1); + st.takeItems(DEAD_SEEKER_DUNG, -1); + st.takeItems(MARSH_SPIDER_FLUIDS, -1); + st.takeItems(MEDUSA_ICHOR, -1); + st.takeItems(NIGHTSHADE_ROOT, -1); + st.takeItems(TYRANT_BLOOD, -1); + st.giveItems(BELLADONNA, 1); + } + else if (cond == 8) + { + htmltext = "30463-04.htm"; + } + else if (cond > 8) + { + htmltext = "30463-05.htm"; + } + break; + + case ALDER_SPIRIT: + if (cond == 10) + { + htmltext = "30613-01.htm"; + st.set("cond", "11"); + st.playSound(QuestState.SOUND_MIDDLE); + st.giveItems(ALDER_SKULL_2, 1); + npc.deleteMe(); + } + break; + + case ROA: + if (cond == 11) + { + htmltext = "30114-01.htm"; + } + else if (cond == 12) + { + htmltext = "30114-05.htm"; + } + else if (cond > 12) + { + htmltext = "30114-06.htm"; + } + break; + + case NORMAN: + if (cond == 12) + { + htmltext = "30210-01.htm"; + st.set("cond", "13"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(ALDER_RECEIPT, 1); + st.giveItems(REVELATIONS_MANUSCRIPT, 1); + } + else if (cond > 12) + { + htmltext = "30210-02.htm"; + } + break; + + case THIFIELL: + if (cond == 15) + { + htmltext = "30358-01.htm"; + st.set("cond", "16"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(KAIRA_RECOMMENDATION, 1); + st.giveItems(PALUS_CHARM, 1); + st.giveItems(THIFIELL_LETTER, 1); + } + else if (cond == 16) + { + htmltext = "30358-02.htm"; + } + else if (cond == 17) + { + htmltext = "30358-03.htm"; + } + else if (cond == 18) + { + htmltext = "30358-04.htm"; + st.takeItems(PALUS_CHARM, 1); + st.takeItems(ARKENIA_LETTER, 1); + st.giveItems(MARK_OF_FATE, 1); + st.rewardExpAndSp(68183, 1750); + player.broadcastPacket(new SocialAction(player.getObjectId(), 3)); + st.playSound(QuestState.SOUND_FINISH); + st.exitQuest(false); + } + break; + + case ARKENIA: + if (cond == 16) + { + htmltext = "30419-01.htm"; + } + else if (cond == 17) + { + htmltext = (st.hasQuestItems(BLIGHT_TREANT_SAP) && st.hasQuestItems(RED_FAIRY_DUST)) ? "30419-04.htm" : "30419-03.htm"; + } + else if (cond == 18) + { + htmltext = "30419-06.htm"; + } + break; + + case BLOODY_PIXY: + if (cond == 17) + { + if (st.hasQuestItems(PIXY_GARNET)) + { + if ((st.getQuestItemsCount(GRANDIS_SKULL) >= 10) && (st.getQuestItemsCount(KARUL_BUGBEAR_SKULL) >= 10) && (st.getQuestItemsCount(BREKA_OVERLORD_SKULL) >= 10) && (st.getQuestItemsCount(LETO_OVERLORD_SKULL) >= 10)) + { + htmltext = "31845-04.htm"; + st.playSound(QuestState.SOUND_ITEMGET); + st.takeItems(BREKA_OVERLORD_SKULL, -1); + st.takeItems(GRANDIS_SKULL, -1); + st.takeItems(KARUL_BUGBEAR_SKULL, -1); + st.takeItems(LETO_OVERLORD_SKULL, -1); + st.takeItems(PIXY_GARNET, 1); + st.giveItems(RED_FAIRY_DUST, 1); + } + else + { + htmltext = "31845-03.htm"; + } + } + else if (st.hasQuestItems(RED_FAIRY_DUST)) + { + htmltext = "31845-05.htm"; + } + else + { + htmltext = "31845-01.htm"; + } + } + else if (cond == 18) + { + htmltext = "31845-05.htm"; + } + break; + + case BLIGHT_TREANT: + if (cond == 17) + { + if (st.hasQuestItems(BLIGHT_TREANT_SEED)) + { + if (st.hasQuestItems(BLACK_WILLOW_LEAF)) + { + htmltext = "31850-04.htm"; + st.playSound(QuestState.SOUND_ITEMGET); + st.takeItems(BLACK_WILLOW_LEAF, 1); + st.takeItems(BLIGHT_TREANT_SEED, 1); + st.giveItems(BLIGHT_TREANT_SAP, 1); + } + else + { + htmltext = "31850-03.htm"; + } + } + else if (st.hasQuestItems(BLIGHT_TREANT_SAP)) + { + htmltext = "31850-05.htm"; + } + else + { + htmltext = "31850-01.htm"; + } + } + else if (cond == 18) + { + htmltext = "31850-05.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 HANGMAN_TREE: + if (st.getInt("cond") == 2) + { + st.set("cond", "3"); + st.playSound(QuestState.SOUND_MIDDLE); + st.takeItems(METHEUS_FUNERAL_JAR, 1); + st.giveItems(KASANDRA_REMAINS, 1); + } + break; + + case DEAD_SEEKER: + if ((st.getInt("cond") == 6) && st.dropItems(DEAD_SEEKER_DUNG, 1, 10, CHANCES.get(npcId))) + { + if ((st.getQuestItemsCount(TYRANT_BLOOD) >= 10) && (st.getQuestItemsCount(MEDUSA_ICHOR) >= 10) && (st.getQuestItemsCount(NIGHTSHADE_ROOT) >= 10) && (st.getQuestItemsCount(MARSH_SPIDER_FLUIDS) >= 10)) + { + st.set("cond", "7"); + } + } + break; + + case TYRANT: + case TYRANT_KINGPIN: + if ((st.getInt("cond") == 6) && st.dropItems(TYRANT_BLOOD, 1, 10, CHANCES.get(npcId))) + { + if ((st.getQuestItemsCount(DEAD_SEEKER_DUNG) >= 10) && (st.getQuestItemsCount(MEDUSA_ICHOR) >= 10) && (st.getQuestItemsCount(NIGHTSHADE_ROOT) >= 10) && (st.getQuestItemsCount(MARSH_SPIDER_FLUIDS) >= 10)) + { + st.set("cond", "7"); + } + } + break; + + case MEDUSA: + if ((st.getInt("cond") == 6) && st.dropItems(MEDUSA_ICHOR, 1, 10, CHANCES.get(npcId))) + { + if ((st.getQuestItemsCount(DEAD_SEEKER_DUNG) >= 10) && (st.getQuestItemsCount(TYRANT_BLOOD) >= 10) && (st.getQuestItemsCount(NIGHTSHADE_ROOT) >= 10) && (st.getQuestItemsCount(MARSH_SPIDER_FLUIDS) >= 10)) + { + st.set("cond", "7"); + } + } + break; + + case MARSH_STAKATO: + case MARSH_STAKATO_WORKER: + case MARSH_STAKATO_SOLDIER: + case MARSH_STAKATO_DRONE: + if ((st.getInt("cond") == 6) && st.dropItems(NIGHTSHADE_ROOT, 1, 10, CHANCES.get(npcId))) + { + if ((st.getQuestItemsCount(DEAD_SEEKER_DUNG) >= 10) && (st.getQuestItemsCount(TYRANT_BLOOD) >= 10) && (st.getQuestItemsCount(MEDUSA_ICHOR) >= 10) && (st.getQuestItemsCount(MARSH_SPIDER_FLUIDS) >= 10)) + { + st.set("cond", "7"); + } + } + break; + + case MARSH_SPIDER: + if ((st.getInt("cond") == 6) && st.dropItems(MARSH_SPIDER_FLUIDS, 1, 10, CHANCES.get(npcId))) + { + if ((st.getQuestItemsCount(DEAD_SEEKER_DUNG) >= 10) && (st.getQuestItemsCount(TYRANT_BLOOD) >= 10) && (st.getQuestItemsCount(MEDUSA_ICHOR) >= 10) && (st.getQuestItemsCount(NIGHTSHADE_ROOT) >= 10)) + { + st.set("cond", "7"); + } + } + break; + + case GRANDIS: + if (st.hasQuestItems(PIXY_GARNET)) + { + st.dropItemsAlways(GRANDIS_SKULL, 1, 10); + } + break; + + case LETO_LIZARDMAN_OVERLORD: + if (st.hasQuestItems(PIXY_GARNET)) + { + st.dropItemsAlways(LETO_OVERLORD_SKULL, 1, 10); + } + break; + + case BREKA_ORC_OVERLORD: + if (st.hasQuestItems(PIXY_GARNET)) + { + st.dropItemsAlways(BREKA_OVERLORD_SKULL, 1, 10); + } + break; + + case KARUL_BUGBEAR: + if (st.hasQuestItems(PIXY_GARNET)) + { + st.dropItemsAlways(KARUL_BUGBEAR_SKULL, 1, 10); + } + break; + + case BLACK_WILLOW_LURKER: + if (st.hasQuestItems(BLIGHT_TREANT_SEED)) + { + st.dropItemsAlways(BLACK_WILLOW_LEAF, 1, 1); + } + break; + } + + return null; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q234_FatesWhisper/Q234_FatesWhisper.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q234_FatesWhisper/Q234_FatesWhisper.java index 33ebb5c5e2..d7cbb85897 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q234_FatesWhisper/Q234_FatesWhisper.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q234_FatesWhisper/Q234_FatesWhisper.java @@ -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 . - */ -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 . + */ +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 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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q300_HuntingLetoLizardman/Q300_HuntingLetoLizardman.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q300_HuntingLetoLizardman/Q300_HuntingLetoLizardman.java index 301bf23b80..034e9507f1 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q300_HuntingLetoLizardman/Q300_HuntingLetoLizardman.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q300_HuntingLetoLizardman/Q300_HuntingLetoLizardman.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q324_SweetestVenom/Q324_SweetestVenom.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q324_SweetestVenom/Q324_SweetestVenom.java index b43efd4837..6d2126d706 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q324_SweetestVenom/Q324_SweetestVenom.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q324_SweetestVenom/Q324_SweetestVenom.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q325_GrimCollector/Q325_GrimCollector.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q325_GrimCollector/Q325_GrimCollector.java index 3a9304cad0..1977a44ecf 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q325_GrimCollector/Q325_GrimCollector.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q325_GrimCollector/Q325_GrimCollector.java @@ -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 . - */ -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 . + */ +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> 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q327_RecoverTheFarmland/Q327_RecoverTheFarmland.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q327_RecoverTheFarmland/Q327_RecoverTheFarmland.java index 65a6ba9087..2c0e67e237 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q327_RecoverTheFarmland/Q327_RecoverTheFarmland.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q327_RecoverTheFarmland/Q327_RecoverTheFarmland.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q328_SenseForBusiness/Q328_SenseForBusiness.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q328_SenseForBusiness/Q328_SenseForBusiness.java index e616886593..a94e07d59f 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q328_SenseForBusiness/Q328_SenseForBusiness.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q328_SenseForBusiness/Q328_SenseForBusiness.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q330_AdeptOfTaste/Q330_AdeptOfTaste.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q330_AdeptOfTaste/Q330_AdeptOfTaste.java index 60af2c1de8..61c781fdca 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q330_AdeptOfTaste/Q330_AdeptOfTaste.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q330_AdeptOfTaste/Q330_AdeptOfTaste.java @@ -1,593 +1,594 @@ -/* - * 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 . - */ -package quests.Q330_AdeptOfTaste; - -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 Q330_AdeptOfTaste extends Quest -{ - private static final String qn = "Q330_AdeptOfTaste"; - - // NPCs - private static final int SONIA = 30062; - private static final int GLYVKA = 30067; - private static final int ROLLANT = 30069; - private static final int JACOB = 30073; - private static final int PANO = 30078; - private static final int MIRIEN = 30461; - private static final int JONAS = 30469; - - // Items - private static final int INGREDIENT_LIST = 1420; - private static final int SONIA_BOTANY_BOOK = 1421; - private static final int RED_MANDRAGORA_ROOT = 1422; - private static final int WHITE_MANDRAGORA_ROOT = 1423; - private static final int RED_MANDRAGORA_SAP = 1424; - private static final int WHITE_MANDRAGORA_SAP = 1425; - private static final int JACOB_INSECT_BOOK = 1426; - private static final int NECTAR = 1427; - private static final int ROYAL_JELLY = 1428; - private static final int HONEY = 1429; - private static final int GOLDEN_HONEY = 1430; - private static final int PANO_CONTRACT = 1431; - private static final int HOBGOBLIN_AMULET = 1432; - private static final int DIONIAN_POTATO = 1433; - private static final int GLYVKA_BOTANY_BOOK = 1434; - private static final int GREEN_MARSH_MOSS = 1435; - private static final int BROWN_MARSH_MOSS = 1436; - private static final int GREEN_MOSS_BUNDLE = 1437; - private static final int BROWN_MOSS_BUNDLE = 1438; - private static final int ROLANT_CREATURE_BOOK = 1439; - private static final int MONSTER_EYE_BODY = 1440; - private static final int MONSTER_EYE_MEAT = 1441; - private static final int JONAS_STEAK_DISH_1 = 1442; - private static final int JONAS_STEAK_DISH_2 = 1443; - private static final int JONAS_STEAK_DISH_3 = 1444; - private static final int JONAS_STEAK_DISH_4 = 1445; - private static final int JONAS_STEAK_DISH_5 = 1446; - private static final int MIRIEN_REVIEW_1 = 1447; - private static final int MIRIEN_REVIEW_2 = 1448; - private static final int MIRIEN_REVIEW_3 = 1449; - private static final int MIRIEN_REVIEW_4 = 1450; - private static final int MIRIEN_REVIEW_5 = 1451; - - // Rewards - private static final int JONAS_SALAD_RECIPE = 1455; - private static final int JONAS_SAUCE_RECIPE = 1456; - private static final int JONAS_STEAK_RECIPE = 1457; - - // 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 . + */ +package quests.Q330_AdeptOfTaste; + +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 Q330_AdeptOfTaste extends Quest +{ + private static final String qn = "Q330_AdeptOfTaste"; + + // NPCs + private static final int SONIA = 30062; + private static final int GLYVKA = 30067; + private static final int ROLLANT = 30069; + private static final int JACOB = 30073; + private static final int PANO = 30078; + private static final int MIRIEN = 30461; + private static final int JONAS = 30469; + + // Items + private static final int INGREDIENT_LIST = 1420; + private static final int SONIA_BOTANY_BOOK = 1421; + private static final int RED_MANDRAGORA_ROOT = 1422; + private static final int WHITE_MANDRAGORA_ROOT = 1423; + private static final int RED_MANDRAGORA_SAP = 1424; + private static final int WHITE_MANDRAGORA_SAP = 1425; + private static final int JACOB_INSECT_BOOK = 1426; + private static final int NECTAR = 1427; + private static final int ROYAL_JELLY = 1428; + private static final int HONEY = 1429; + private static final int GOLDEN_HONEY = 1430; + private static final int PANO_CONTRACT = 1431; + private static final int HOBGOBLIN_AMULET = 1432; + private static final int DIONIAN_POTATO = 1433; + private static final int GLYVKA_BOTANY_BOOK = 1434; + private static final int GREEN_MARSH_MOSS = 1435; + private static final int BROWN_MARSH_MOSS = 1436; + private static final int GREEN_MOSS_BUNDLE = 1437; + private static final int BROWN_MOSS_BUNDLE = 1438; + private static final int ROLANT_CREATURE_BOOK = 1439; + private static final int MONSTER_EYE_BODY = 1440; + private static final int MONSTER_EYE_MEAT = 1441; + private static final int JONAS_STEAK_DISH_1 = 1442; + private static final int JONAS_STEAK_DISH_2 = 1443; + private static final int JONAS_STEAK_DISH_3 = 1444; + private static final int JONAS_STEAK_DISH_4 = 1445; + private static final int JONAS_STEAK_DISH_5 = 1446; + private static final int MIRIEN_REVIEW_1 = 1447; + private static final int MIRIEN_REVIEW_2 = 1448; + private static final int MIRIEN_REVIEW_3 = 1449; + private static final int MIRIEN_REVIEW_4 = 1450; + private static final int MIRIEN_REVIEW_5 = 1451; + + // Rewards + private static final int JONAS_SALAD_RECIPE = 1455; + private static final int JONAS_SAUCE_RECIPE = 1456; + private static final int JONAS_STEAK_RECIPE = 1457; + + // Drop chances private static final Map CHANCES = new HashMap<>(); - { - CHANCES.put(20204, new int[] - { - 92, - 100 - }); - CHANCES.put(20229, new int[] - { - 80, - 95 - }); - CHANCES.put(20223, new int[] - { - 70, - 77 - }); - CHANCES.put(20154, new int[] - { - 70, - 77 - }); - CHANCES.put(20155, new int[] - { - 87, - 96 - }); - CHANCES.put(20156, new int[] - { - 77, - 85 - }); - } - - public Q330_AdeptOfTaste() - { - super(330, qn, "Adept of Taste"); - - registerQuestItems(INGREDIENT_LIST, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP, HONEY, GOLDEN_HONEY, DIONIAN_POTATO, GREEN_MOSS_BUNDLE, BROWN_MOSS_BUNDLE, MONSTER_EYE_MEAT, MIRIEN_REVIEW_1, MIRIEN_REVIEW_2, MIRIEN_REVIEW_3, MIRIEN_REVIEW_4, MIRIEN_REVIEW_5, JONAS_STEAK_DISH_1, JONAS_STEAK_DISH_2, JONAS_STEAK_DISH_3, JONAS_STEAK_DISH_4, JONAS_STEAK_DISH_5, SONIA_BOTANY_BOOK, RED_MANDRAGORA_ROOT, WHITE_MANDRAGORA_ROOT, JACOB_INSECT_BOOK, NECTAR, ROYAL_JELLY, PANO_CONTRACT, HOBGOBLIN_AMULET, GLYVKA_BOTANY_BOOK, GREEN_MARSH_MOSS, BROWN_MARSH_MOSS, ROLANT_CREATURE_BOOK, MONSTER_EYE_BODY); - - addStartNpc(JONAS); // Jonas - addTalkId(JONAS, SONIA, GLYVKA, ROLLANT, JACOB, PANO, MIRIEN); - - addKillId(20147, 20154, 20155, 20156, 20204, 20223, 20226, 20228, 20229, 20265, 20266); - } - - @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("30469-03.htm")) - { - st.setState(State.STARTED); - st.set("cond", "1"); - st.playSound(QuestState.SOUND_ACCEPT); - st.giveItems(INGREDIENT_LIST, 1); - } - else if (event.equals("30062-05.htm")) - { - st.playSound(QuestState.SOUND_ITEMGET); - st.takeItems(SONIA_BOTANY_BOOK, 1); - st.takeItems(RED_MANDRAGORA_ROOT, -1); - st.takeItems(WHITE_MANDRAGORA_ROOT, -1); - st.giveItems(RED_MANDRAGORA_SAP, 1); - - } - else if (event.equals("30073-05.htm")) - { - st.playSound(QuestState.SOUND_ITEMGET); - st.takeItems(JACOB_INSECT_BOOK, 1); - st.takeItems(NECTAR, -1); - st.takeItems(ROYAL_JELLY, -1); - st.giveItems(HONEY, 1); - } - else if (event.equals("30067-05.htm")) - { - st.playSound(QuestState.SOUND_ITEMGET); - st.takeItems(GLYVKA_BOTANY_BOOK, 1); - st.takeItems(GREEN_MARSH_MOSS, -1); - st.takeItems(BROWN_MARSH_MOSS, -1); - st.giveItems(GREEN_MOSS_BUNDLE, 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() < 24) ? "30469-01.htm" : "30469-02.htm"; - break; - - case State.STARTED: - switch (npc.getNpcId()) - { - case JONAS: - if (st.hasQuestItems(INGREDIENT_LIST)) - { - if (!hasAllIngredients(st)) - { - htmltext = "30469-04.htm"; - } - else - { - int dish; - - final int specialIngredientsNumber = st.getQuestItemsCount(WHITE_MANDRAGORA_SAP) + st.getQuestItemsCount(GOLDEN_HONEY) + st.getQuestItemsCount(BROWN_MOSS_BUNDLE); - - if (Rnd.nextBoolean()) - { - htmltext = "30469-05t" + Integer.toString(specialIngredientsNumber + 2) + ".htm"; - dish = 1443 + specialIngredientsNumber; - } - else - { - htmltext = "30469-05t" + Integer.toString(specialIngredientsNumber + 1) + ".htm"; - dish = 1442 + specialIngredientsNumber; - } - - // Sound according dish. - st.playSound((dish == JONAS_STEAK_DISH_5) ? QuestState.SOUND_JACKPOT : QuestState.SOUND_ITEMGET); - - st.takeItems(INGREDIENT_LIST, 1); - st.takeItems(RED_MANDRAGORA_SAP, 1); - st.takeItems(WHITE_MANDRAGORA_SAP, 1); - st.takeItems(HONEY, 1); - st.takeItems(GOLDEN_HONEY, 1); - st.takeItems(DIONIAN_POTATO, 1); - st.takeItems(GREEN_MOSS_BUNDLE, 1); - st.takeItems(BROWN_MOSS_BUNDLE, 1); - st.takeItems(MONSTER_EYE_MEAT, 1); - st.giveItems(dish, 1); - } - } - else if (st.hasAtLeastOneQuestItem(JONAS_STEAK_DISH_1, JONAS_STEAK_DISH_2, JONAS_STEAK_DISH_3, JONAS_STEAK_DISH_4, JONAS_STEAK_DISH_5)) - { - htmltext = "30469-06.htm"; - } - else if (st.hasAtLeastOneQuestItem(MIRIEN_REVIEW_1, MIRIEN_REVIEW_2, MIRIEN_REVIEW_3, MIRIEN_REVIEW_4, MIRIEN_REVIEW_5)) - { - if (st.hasQuestItems(MIRIEN_REVIEW_1)) - { - htmltext = "30469-06t1.htm"; - st.takeItems(MIRIEN_REVIEW_1, 1); - st.rewardItems(57, 7500); - st.rewardExpAndSp(6000, 0); - } - else if (st.hasQuestItems(MIRIEN_REVIEW_2)) - { - htmltext = "30469-06t2.htm"; - st.takeItems(MIRIEN_REVIEW_2, 1); - st.rewardItems(57, 9000); - st.rewardExpAndSp(7000, 0); - } - else if (st.hasQuestItems(MIRIEN_REVIEW_3)) - { - htmltext = "30469-06t3.htm"; - st.takeItems(MIRIEN_REVIEW_3, 1); - st.rewardItems(57, 5800); - st.giveItems(JONAS_SALAD_RECIPE, 1); - st.rewardExpAndSp(9000, 0); - } - else if (st.hasQuestItems(MIRIEN_REVIEW_4)) - { - htmltext = "30469-06t4.htm"; - st.takeItems(MIRIEN_REVIEW_4, 1); - st.rewardItems(57, 6800); - st.giveItems(JONAS_SAUCE_RECIPE, 1); - st.rewardExpAndSp(10500, 0); - } - else if (st.hasQuestItems(MIRIEN_REVIEW_5)) - { - htmltext = "30469-06t5.htm"; - st.takeItems(MIRIEN_REVIEW_5, 1); - st.rewardItems(57, 7800); - st.giveItems(JONAS_STEAK_RECIPE, 1); - st.rewardExpAndSp(12000, 0); - } - st.playSound(QuestState.SOUND_FINISH); - st.exitQuest(true); - } - break; - - case MIRIEN: - if (st.hasQuestItems(INGREDIENT_LIST)) - { - htmltext = "30461-01.htm"; - } - else if (st.hasAtLeastOneQuestItem(JONAS_STEAK_DISH_1, JONAS_STEAK_DISH_2, JONAS_STEAK_DISH_3, JONAS_STEAK_DISH_4, JONAS_STEAK_DISH_5)) - { - st.playSound(QuestState.SOUND_ITEMGET); - if (st.hasQuestItems(JONAS_STEAK_DISH_1)) - { - htmltext = "30461-02t1.htm"; - st.takeItems(JONAS_STEAK_DISH_1, 1); - st.giveItems(MIRIEN_REVIEW_1, 1); - } - else if (st.hasQuestItems(JONAS_STEAK_DISH_2)) - { - htmltext = "30461-02t2.htm"; - st.takeItems(JONAS_STEAK_DISH_2, 1); - st.giveItems(MIRIEN_REVIEW_2, 1); - } - else if (st.hasQuestItems(JONAS_STEAK_DISH_3)) - { - htmltext = "30461-02t3.htm"; - st.takeItems(JONAS_STEAK_DISH_3, 1); - st.giveItems(MIRIEN_REVIEW_3, 1); - } - else if (st.hasQuestItems(JONAS_STEAK_DISH_4)) - { - htmltext = "30461-02t4.htm"; - st.takeItems(JONAS_STEAK_DISH_4, 1); - st.giveItems(MIRIEN_REVIEW_4, 1); - } - else if (st.hasQuestItems(JONAS_STEAK_DISH_5)) - { - htmltext = "30461-02t5.htm"; - st.takeItems(JONAS_STEAK_DISH_5, 1); - st.giveItems(MIRIEN_REVIEW_5, 1); - } - } - else if (st.hasAtLeastOneQuestItem(MIRIEN_REVIEW_1, MIRIEN_REVIEW_2, MIRIEN_REVIEW_3, MIRIEN_REVIEW_4, MIRIEN_REVIEW_5)) - { - htmltext = "30461-04.htm"; - } - break; - - case SONIA: - if (!st.hasQuestItems(RED_MANDRAGORA_SAP) && !st.hasQuestItems(WHITE_MANDRAGORA_SAP)) - { - if (!st.hasQuestItems(SONIA_BOTANY_BOOK)) - { - htmltext = "30062-01.htm"; - st.giveItems(SONIA_BOTANY_BOOK, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - else - { - if ((st.getQuestItemsCount(RED_MANDRAGORA_ROOT) < 40) || (st.getQuestItemsCount(WHITE_MANDRAGORA_ROOT) < 40)) - { - htmltext = "30062-02.htm"; - } - else if (st.getQuestItemsCount(WHITE_MANDRAGORA_ROOT) >= 40) - { - htmltext = "30062-06.htm"; - st.takeItems(SONIA_BOTANY_BOOK, 1); - st.takeItems(RED_MANDRAGORA_ROOT, -1); - st.takeItems(WHITE_MANDRAGORA_ROOT, -1); - st.giveItems(WHITE_MANDRAGORA_SAP, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - else - { - htmltext = "30062-03.htm"; - } - } - } - else - { - htmltext = "30062-07.htm"; - } - break; - - case JACOB: - if (!st.hasQuestItems(HONEY) && !st.hasQuestItems(GOLDEN_HONEY)) - { - if (!st.hasQuestItems(JACOB_INSECT_BOOK)) - { - htmltext = "30073-01.htm"; - st.giveItems(JACOB_INSECT_BOOK, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - else - { - if (st.getQuestItemsCount(NECTAR) < 20) - { - htmltext = "30073-02.htm"; - } - else - { - if (st.getQuestItemsCount(ROYAL_JELLY) < 10) - { - htmltext = "30073-03.htm"; - } - else - { - htmltext = "30073-06.htm"; - st.takeItems(JACOB_INSECT_BOOK, 1); - st.takeItems(NECTAR, -1); - st.takeItems(ROYAL_JELLY, -1); - st.giveItems(GOLDEN_HONEY, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - } - } - } - else - { - htmltext = "30073-07.htm"; - } - break; - - case PANO: - if (!st.hasQuestItems(DIONIAN_POTATO)) - { - if (!st.hasQuestItems(PANO_CONTRACT)) - { - htmltext = "30078-01.htm"; - st.giveItems(PANO_CONTRACT, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - else - { - if (st.getQuestItemsCount(HOBGOBLIN_AMULET) < 30) - { - htmltext = "30078-02.htm"; - } - else - { - htmltext = "30078-03.htm"; - st.takeItems(PANO_CONTRACT, 1); - st.takeItems(HOBGOBLIN_AMULET, -1); - st.giveItems(DIONIAN_POTATO, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - } - } - else - { - htmltext = "30078-04.htm"; - } - break; - - case GLYVKA: - if (!st.hasQuestItems(GREEN_MOSS_BUNDLE) && !st.hasQuestItems(BROWN_MOSS_BUNDLE)) - { - if (!st.hasQuestItems(GLYVKA_BOTANY_BOOK)) - { - st.giveItems(GLYVKA_BOTANY_BOOK, 1); - htmltext = "30067-01.htm"; - st.playSound(QuestState.SOUND_ITEMGET); - } - else - { - if ((st.getQuestItemsCount(GREEN_MARSH_MOSS) < 20) || (st.getQuestItemsCount(BROWN_MARSH_MOSS) < 20)) - { - htmltext = "30067-02.htm"; - } - else if (st.getQuestItemsCount(BROWN_MARSH_MOSS) >= 20) - { - htmltext = "30067-06.htm"; - st.takeItems(GLYVKA_BOTANY_BOOK, 1); - st.takeItems(GREEN_MARSH_MOSS, -1); - st.takeItems(BROWN_MARSH_MOSS, -1); - st.giveItems(BROWN_MOSS_BUNDLE, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - else - { - htmltext = "30067-03.htm"; - } - } - } - else - { - htmltext = "30067-07.htm"; - } - break; - - case ROLLANT: - if (!st.hasQuestItems(MONSTER_EYE_MEAT)) - { - if (!st.hasQuestItems(ROLANT_CREATURE_BOOK)) - { - htmltext = "30069-01.htm"; - st.giveItems(ROLANT_CREATURE_BOOK, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - else - { - if (st.getQuestItemsCount(MONSTER_EYE_BODY) < 30) - { - htmltext = "30069-02.htm"; - } - else - { - htmltext = "30069-03.htm"; - st.takeItems(ROLANT_CREATURE_BOOK, 1); - st.takeItems(MONSTER_EYE_BODY, -1); - st.giveItems(MONSTER_EYE_MEAT, 1); - st.playSound(QuestState.SOUND_ITEMGET); - } - } - } - else - { - htmltext = "30069-04.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 npcId = npc.getNpcId(); - - switch (npcId) - { - case 20265: - if (st.hasQuestItems(ROLANT_CREATURE_BOOK)) - { - st.dropItems(MONSTER_EYE_BODY, (Rnd.get(97) < 77) ? 2 : 3, 30, 970000); - } - break; - - case 20266: - if (st.hasQuestItems(ROLANT_CREATURE_BOOK)) - { - st.dropItemsAlways(MONSTER_EYE_BODY, (Rnd.get(10) < 7) ? 1 : 2, 30); - } - break; - - case 20226: - if (st.hasQuestItems(GLYVKA_BOTANY_BOOK)) - { - st.dropItems(((Rnd.get(96) < 87) ? GREEN_MARSH_MOSS : BROWN_MARSH_MOSS), 1, 20, 960000); - } - break; - - case 20228: - if (st.hasQuestItems(GLYVKA_BOTANY_BOOK)) - { - st.dropItemsAlways(((Rnd.get(10) < 9) ? GREEN_MARSH_MOSS : BROWN_MARSH_MOSS), 1, 20); - } - break; - - case 20147: - if (st.hasQuestItems(PANO_CONTRACT)) - { - st.dropItemsAlways(HOBGOBLIN_AMULET, 1, 30); - } - break; - - case 20204: - case 20229: - if (st.hasQuestItems(JACOB_INSECT_BOOK)) - { - final int random = Rnd.get(100); - final int[] chances = CHANCES.get(npcId); - if (random < chances[0]) - { - st.dropItemsAlways(NECTAR, 1, 20); - } - else if (random < chances[1]) - { - st.dropItemsAlways(ROYAL_JELLY, 1, 10); - } - } - break; - - case 20223: - case 20154: - case 20155: - case 20156: - if (st.hasQuestItems(SONIA_BOTANY_BOOK)) - { - final int random = Rnd.get(100); - final int[] chances = CHANCES.get(npcId); - if (random < chances[1]) - { - st.dropItemsAlways((random < chances[0]) ? RED_MANDRAGORA_ROOT : WHITE_MANDRAGORA_ROOT, 1, 40); - } - } - break; - } - - return null; - } - - private static boolean hasAllIngredients(QuestState st) - { - return st.hasQuestItems(DIONIAN_POTATO, MONSTER_EYE_MEAT) && st.hasAtLeastOneQuestItem(WHITE_MANDRAGORA_SAP, RED_MANDRAGORA_SAP) && st.hasAtLeastOneQuestItem(GOLDEN_HONEY, HONEY) && st.hasAtLeastOneQuestItem(BROWN_MOSS_BUNDLE, GREEN_MOSS_BUNDLE); - } + static + { + CHANCES.put(20204, new int[] + { + 92, + 100 + }); + CHANCES.put(20229, new int[] + { + 80, + 95 + }); + CHANCES.put(20223, new int[] + { + 70, + 77 + }); + CHANCES.put(20154, new int[] + { + 70, + 77 + }); + CHANCES.put(20155, new int[] + { + 87, + 96 + }); + CHANCES.put(20156, new int[] + { + 77, + 85 + }); + } + + public Q330_AdeptOfTaste() + { + super(330, qn, "Adept of Taste"); + + registerQuestItems(INGREDIENT_LIST, RED_MANDRAGORA_SAP, WHITE_MANDRAGORA_SAP, HONEY, GOLDEN_HONEY, DIONIAN_POTATO, GREEN_MOSS_BUNDLE, BROWN_MOSS_BUNDLE, MONSTER_EYE_MEAT, MIRIEN_REVIEW_1, MIRIEN_REVIEW_2, MIRIEN_REVIEW_3, MIRIEN_REVIEW_4, MIRIEN_REVIEW_5, JONAS_STEAK_DISH_1, JONAS_STEAK_DISH_2, JONAS_STEAK_DISH_3, JONAS_STEAK_DISH_4, JONAS_STEAK_DISH_5, SONIA_BOTANY_BOOK, RED_MANDRAGORA_ROOT, WHITE_MANDRAGORA_ROOT, JACOB_INSECT_BOOK, NECTAR, ROYAL_JELLY, PANO_CONTRACT, HOBGOBLIN_AMULET, GLYVKA_BOTANY_BOOK, GREEN_MARSH_MOSS, BROWN_MARSH_MOSS, ROLANT_CREATURE_BOOK, MONSTER_EYE_BODY); + + addStartNpc(JONAS); // Jonas + addTalkId(JONAS, SONIA, GLYVKA, ROLLANT, JACOB, PANO, MIRIEN); + + addKillId(20147, 20154, 20155, 20156, 20204, 20223, 20226, 20228, 20229, 20265, 20266); + } + + @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("30469-03.htm")) + { + st.setState(State.STARTED); + st.set("cond", "1"); + st.playSound(QuestState.SOUND_ACCEPT); + st.giveItems(INGREDIENT_LIST, 1); + } + else if (event.equals("30062-05.htm")) + { + st.playSound(QuestState.SOUND_ITEMGET); + st.takeItems(SONIA_BOTANY_BOOK, 1); + st.takeItems(RED_MANDRAGORA_ROOT, -1); + st.takeItems(WHITE_MANDRAGORA_ROOT, -1); + st.giveItems(RED_MANDRAGORA_SAP, 1); + + } + else if (event.equals("30073-05.htm")) + { + st.playSound(QuestState.SOUND_ITEMGET); + st.takeItems(JACOB_INSECT_BOOK, 1); + st.takeItems(NECTAR, -1); + st.takeItems(ROYAL_JELLY, -1); + st.giveItems(HONEY, 1); + } + else if (event.equals("30067-05.htm")) + { + st.playSound(QuestState.SOUND_ITEMGET); + st.takeItems(GLYVKA_BOTANY_BOOK, 1); + st.takeItems(GREEN_MARSH_MOSS, -1); + st.takeItems(BROWN_MARSH_MOSS, -1); + st.giveItems(GREEN_MOSS_BUNDLE, 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() < 24) ? "30469-01.htm" : "30469-02.htm"; + break; + + case State.STARTED: + switch (npc.getNpcId()) + { + case JONAS: + if (st.hasQuestItems(INGREDIENT_LIST)) + { + if (!hasAllIngredients(st)) + { + htmltext = "30469-04.htm"; + } + else + { + int dish; + + final int specialIngredientsNumber = st.getQuestItemsCount(WHITE_MANDRAGORA_SAP) + st.getQuestItemsCount(GOLDEN_HONEY) + st.getQuestItemsCount(BROWN_MOSS_BUNDLE); + + if (Rnd.nextBoolean()) + { + htmltext = "30469-05t" + Integer.toString(specialIngredientsNumber + 2) + ".htm"; + dish = 1443 + specialIngredientsNumber; + } + else + { + htmltext = "30469-05t" + Integer.toString(specialIngredientsNumber + 1) + ".htm"; + dish = 1442 + specialIngredientsNumber; + } + + // Sound according dish. + st.playSound((dish == JONAS_STEAK_DISH_5) ? QuestState.SOUND_JACKPOT : QuestState.SOUND_ITEMGET); + + st.takeItems(INGREDIENT_LIST, 1); + st.takeItems(RED_MANDRAGORA_SAP, 1); + st.takeItems(WHITE_MANDRAGORA_SAP, 1); + st.takeItems(HONEY, 1); + st.takeItems(GOLDEN_HONEY, 1); + st.takeItems(DIONIAN_POTATO, 1); + st.takeItems(GREEN_MOSS_BUNDLE, 1); + st.takeItems(BROWN_MOSS_BUNDLE, 1); + st.takeItems(MONSTER_EYE_MEAT, 1); + st.giveItems(dish, 1); + } + } + else if (st.hasAtLeastOneQuestItem(JONAS_STEAK_DISH_1, JONAS_STEAK_DISH_2, JONAS_STEAK_DISH_3, JONAS_STEAK_DISH_4, JONAS_STEAK_DISH_5)) + { + htmltext = "30469-06.htm"; + } + else if (st.hasAtLeastOneQuestItem(MIRIEN_REVIEW_1, MIRIEN_REVIEW_2, MIRIEN_REVIEW_3, MIRIEN_REVIEW_4, MIRIEN_REVIEW_5)) + { + if (st.hasQuestItems(MIRIEN_REVIEW_1)) + { + htmltext = "30469-06t1.htm"; + st.takeItems(MIRIEN_REVIEW_1, 1); + st.rewardItems(57, 7500); + st.rewardExpAndSp(6000, 0); + } + else if (st.hasQuestItems(MIRIEN_REVIEW_2)) + { + htmltext = "30469-06t2.htm"; + st.takeItems(MIRIEN_REVIEW_2, 1); + st.rewardItems(57, 9000); + st.rewardExpAndSp(7000, 0); + } + else if (st.hasQuestItems(MIRIEN_REVIEW_3)) + { + htmltext = "30469-06t3.htm"; + st.takeItems(MIRIEN_REVIEW_3, 1); + st.rewardItems(57, 5800); + st.giveItems(JONAS_SALAD_RECIPE, 1); + st.rewardExpAndSp(9000, 0); + } + else if (st.hasQuestItems(MIRIEN_REVIEW_4)) + { + htmltext = "30469-06t4.htm"; + st.takeItems(MIRIEN_REVIEW_4, 1); + st.rewardItems(57, 6800); + st.giveItems(JONAS_SAUCE_RECIPE, 1); + st.rewardExpAndSp(10500, 0); + } + else if (st.hasQuestItems(MIRIEN_REVIEW_5)) + { + htmltext = "30469-06t5.htm"; + st.takeItems(MIRIEN_REVIEW_5, 1); + st.rewardItems(57, 7800); + st.giveItems(JONAS_STEAK_RECIPE, 1); + st.rewardExpAndSp(12000, 0); + } + st.playSound(QuestState.SOUND_FINISH); + st.exitQuest(true); + } + break; + + case MIRIEN: + if (st.hasQuestItems(INGREDIENT_LIST)) + { + htmltext = "30461-01.htm"; + } + else if (st.hasAtLeastOneQuestItem(JONAS_STEAK_DISH_1, JONAS_STEAK_DISH_2, JONAS_STEAK_DISH_3, JONAS_STEAK_DISH_4, JONAS_STEAK_DISH_5)) + { + st.playSound(QuestState.SOUND_ITEMGET); + if (st.hasQuestItems(JONAS_STEAK_DISH_1)) + { + htmltext = "30461-02t1.htm"; + st.takeItems(JONAS_STEAK_DISH_1, 1); + st.giveItems(MIRIEN_REVIEW_1, 1); + } + else if (st.hasQuestItems(JONAS_STEAK_DISH_2)) + { + htmltext = "30461-02t2.htm"; + st.takeItems(JONAS_STEAK_DISH_2, 1); + st.giveItems(MIRIEN_REVIEW_2, 1); + } + else if (st.hasQuestItems(JONAS_STEAK_DISH_3)) + { + htmltext = "30461-02t3.htm"; + st.takeItems(JONAS_STEAK_DISH_3, 1); + st.giveItems(MIRIEN_REVIEW_3, 1); + } + else if (st.hasQuestItems(JONAS_STEAK_DISH_4)) + { + htmltext = "30461-02t4.htm"; + st.takeItems(JONAS_STEAK_DISH_4, 1); + st.giveItems(MIRIEN_REVIEW_4, 1); + } + else if (st.hasQuestItems(JONAS_STEAK_DISH_5)) + { + htmltext = "30461-02t5.htm"; + st.takeItems(JONAS_STEAK_DISH_5, 1); + st.giveItems(MIRIEN_REVIEW_5, 1); + } + } + else if (st.hasAtLeastOneQuestItem(MIRIEN_REVIEW_1, MIRIEN_REVIEW_2, MIRIEN_REVIEW_3, MIRIEN_REVIEW_4, MIRIEN_REVIEW_5)) + { + htmltext = "30461-04.htm"; + } + break; + + case SONIA: + if (!st.hasQuestItems(RED_MANDRAGORA_SAP) && !st.hasQuestItems(WHITE_MANDRAGORA_SAP)) + { + if (!st.hasQuestItems(SONIA_BOTANY_BOOK)) + { + htmltext = "30062-01.htm"; + st.giveItems(SONIA_BOTANY_BOOK, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + else + { + if ((st.getQuestItemsCount(RED_MANDRAGORA_ROOT) < 40) || (st.getQuestItemsCount(WHITE_MANDRAGORA_ROOT) < 40)) + { + htmltext = "30062-02.htm"; + } + else if (st.getQuestItemsCount(WHITE_MANDRAGORA_ROOT) >= 40) + { + htmltext = "30062-06.htm"; + st.takeItems(SONIA_BOTANY_BOOK, 1); + st.takeItems(RED_MANDRAGORA_ROOT, -1); + st.takeItems(WHITE_MANDRAGORA_ROOT, -1); + st.giveItems(WHITE_MANDRAGORA_SAP, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + else + { + htmltext = "30062-03.htm"; + } + } + } + else + { + htmltext = "30062-07.htm"; + } + break; + + case JACOB: + if (!st.hasQuestItems(HONEY) && !st.hasQuestItems(GOLDEN_HONEY)) + { + if (!st.hasQuestItems(JACOB_INSECT_BOOK)) + { + htmltext = "30073-01.htm"; + st.giveItems(JACOB_INSECT_BOOK, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + else + { + if (st.getQuestItemsCount(NECTAR) < 20) + { + htmltext = "30073-02.htm"; + } + else + { + if (st.getQuestItemsCount(ROYAL_JELLY) < 10) + { + htmltext = "30073-03.htm"; + } + else + { + htmltext = "30073-06.htm"; + st.takeItems(JACOB_INSECT_BOOK, 1); + st.takeItems(NECTAR, -1); + st.takeItems(ROYAL_JELLY, -1); + st.giveItems(GOLDEN_HONEY, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + } + } + } + else + { + htmltext = "30073-07.htm"; + } + break; + + case PANO: + if (!st.hasQuestItems(DIONIAN_POTATO)) + { + if (!st.hasQuestItems(PANO_CONTRACT)) + { + htmltext = "30078-01.htm"; + st.giveItems(PANO_CONTRACT, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + else + { + if (st.getQuestItemsCount(HOBGOBLIN_AMULET) < 30) + { + htmltext = "30078-02.htm"; + } + else + { + htmltext = "30078-03.htm"; + st.takeItems(PANO_CONTRACT, 1); + st.takeItems(HOBGOBLIN_AMULET, -1); + st.giveItems(DIONIAN_POTATO, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + } + } + else + { + htmltext = "30078-04.htm"; + } + break; + + case GLYVKA: + if (!st.hasQuestItems(GREEN_MOSS_BUNDLE) && !st.hasQuestItems(BROWN_MOSS_BUNDLE)) + { + if (!st.hasQuestItems(GLYVKA_BOTANY_BOOK)) + { + st.giveItems(GLYVKA_BOTANY_BOOK, 1); + htmltext = "30067-01.htm"; + st.playSound(QuestState.SOUND_ITEMGET); + } + else + { + if ((st.getQuestItemsCount(GREEN_MARSH_MOSS) < 20) || (st.getQuestItemsCount(BROWN_MARSH_MOSS) < 20)) + { + htmltext = "30067-02.htm"; + } + else if (st.getQuestItemsCount(BROWN_MARSH_MOSS) >= 20) + { + htmltext = "30067-06.htm"; + st.takeItems(GLYVKA_BOTANY_BOOK, 1); + st.takeItems(GREEN_MARSH_MOSS, -1); + st.takeItems(BROWN_MARSH_MOSS, -1); + st.giveItems(BROWN_MOSS_BUNDLE, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + else + { + htmltext = "30067-03.htm"; + } + } + } + else + { + htmltext = "30067-07.htm"; + } + break; + + case ROLLANT: + if (!st.hasQuestItems(MONSTER_EYE_MEAT)) + { + if (!st.hasQuestItems(ROLANT_CREATURE_BOOK)) + { + htmltext = "30069-01.htm"; + st.giveItems(ROLANT_CREATURE_BOOK, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + else + { + if (st.getQuestItemsCount(MONSTER_EYE_BODY) < 30) + { + htmltext = "30069-02.htm"; + } + else + { + htmltext = "30069-03.htm"; + st.takeItems(ROLANT_CREATURE_BOOK, 1); + st.takeItems(MONSTER_EYE_BODY, -1); + st.giveItems(MONSTER_EYE_MEAT, 1); + st.playSound(QuestState.SOUND_ITEMGET); + } + } + } + else + { + htmltext = "30069-04.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 npcId = npc.getNpcId(); + + switch (npcId) + { + case 20265: + if (st.hasQuestItems(ROLANT_CREATURE_BOOK)) + { + st.dropItems(MONSTER_EYE_BODY, (Rnd.get(97) < 77) ? 2 : 3, 30, 970000); + } + break; + + case 20266: + if (st.hasQuestItems(ROLANT_CREATURE_BOOK)) + { + st.dropItemsAlways(MONSTER_EYE_BODY, (Rnd.get(10) < 7) ? 1 : 2, 30); + } + break; + + case 20226: + if (st.hasQuestItems(GLYVKA_BOTANY_BOOK)) + { + st.dropItems(((Rnd.get(96) < 87) ? GREEN_MARSH_MOSS : BROWN_MARSH_MOSS), 1, 20, 960000); + } + break; + + case 20228: + if (st.hasQuestItems(GLYVKA_BOTANY_BOOK)) + { + st.dropItemsAlways(((Rnd.get(10) < 9) ? GREEN_MARSH_MOSS : BROWN_MARSH_MOSS), 1, 20); + } + break; + + case 20147: + if (st.hasQuestItems(PANO_CONTRACT)) + { + st.dropItemsAlways(HOBGOBLIN_AMULET, 1, 30); + } + break; + + case 20204: + case 20229: + if (st.hasQuestItems(JACOB_INSECT_BOOK)) + { + final int random = Rnd.get(100); + final int[] chances = CHANCES.get(npcId); + if (random < chances[0]) + { + st.dropItemsAlways(NECTAR, 1, 20); + } + else if (random < chances[1]) + { + st.dropItemsAlways(ROYAL_JELLY, 1, 10); + } + } + break; + + case 20223: + case 20154: + case 20155: + case 20156: + if (st.hasQuestItems(SONIA_BOTANY_BOOK)) + { + final int random = Rnd.get(100); + final int[] chances = CHANCES.get(npcId); + if (random < chances[1]) + { + st.dropItemsAlways((random < chances[0]) ? RED_MANDRAGORA_ROOT : WHITE_MANDRAGORA_ROOT, 1, 40); + } + } + break; + } + + return null; + } + + private static boolean hasAllIngredients(QuestState st) + { + return st.hasQuestItems(DIONIAN_POTATO, MONSTER_EYE_MEAT) && st.hasAtLeastOneQuestItem(WHITE_MANDRAGORA_SAP, RED_MANDRAGORA_SAP) && st.hasAtLeastOneQuestItem(GOLDEN_HONEY, HONEY) && st.hasAtLeastOneQuestItem(BROWN_MOSS_BUNDLE, GREEN_MOSS_BUNDLE); + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q341_HuntingForWildBeasts/Q341_HuntingForWildBeasts.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q341_HuntingForWildBeasts/Q341_HuntingForWildBeasts.java index 5ce4a1bca2..f8b3ecd030 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q341_HuntingForWildBeasts/Q341_HuntingForWildBeasts.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q341_HuntingForWildBeasts/Q341_HuntingForWildBeasts.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q344_1000YearsTheEndOfLamentation/Q344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q344_1000YearsTheEndOfLamentation/Q344_1000YearsTheEndOfLamentation.java index 64a50b2568..369bc31def 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q344_1000YearsTheEndOfLamentation/Q344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q344_1000YearsTheEndOfLamentation/Q344_1000YearsTheEndOfLamentation.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q354_ConquestOfAlligatorIsland/Q354_ConquestOfAlligatorIsland.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q354_ConquestOfAlligatorIsland/Q354_ConquestOfAlligatorIsland.java index e11649245d..e517a537a9 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q354_ConquestOfAlligatorIsland/Q354_ConquestOfAlligatorIsland.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q354_ConquestOfAlligatorIsland/Q354_ConquestOfAlligatorIsland.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q355_FamilyHonor/Q355_FamilyHonor.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q355_FamilyHonor/Q355_FamilyHonor.java index fee6bd76ab..168ffd4a44 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q355_FamilyHonor/Q355_FamilyHonor.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q355_FamilyHonor/Q355_FamilyHonor.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q357_WarehouseKeepersAmbition/Q357_WarehouseKeepersAmbition.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q357_WarehouseKeepersAmbition/Q357_WarehouseKeepersAmbition.java index 793742b7ac..6939df49c8 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q357_WarehouseKeepersAmbition/Q357_WarehouseKeepersAmbition.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q357_WarehouseKeepersAmbition/Q357_WarehouseKeepersAmbition.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q359_ForSleeplessDeadmen/Q359_ForSleeplessDeadmen.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q359_ForSleeplessDeadmen/Q359_ForSleeplessDeadmen.java index 80556233fa..fd572b33e5 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q359_ForSleeplessDeadmen/Q359_ForSleeplessDeadmen.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q359_ForSleeplessDeadmen/Q359_ForSleeplessDeadmen.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q366_SilverHairedShaman/Q366_SilverHairedShaman.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q366_SilverHairedShaman/Q366_SilverHairedShaman.java index ac61c9d692..232aeadca0 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q366_SilverHairedShaman/Q366_SilverHairedShaman.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q366_SilverHairedShaman/Q366_SilverHairedShaman.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q368_TrespassingIntoTheSacredArea/Q368_TrespassingIntoTheSacredArea.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q368_TrespassingIntoTheSacredArea/Q368_TrespassingIntoTheSacredArea.java index b9fb59e9b9..ccd8d5f655 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q368_TrespassingIntoTheSacredArea/Q368_TrespassingIntoTheSacredArea.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q368_TrespassingIntoTheSacredArea/Q368_TrespassingIntoTheSacredArea.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q369_CollectorOfJewels/Q369_CollectorOfJewels.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q369_CollectorOfJewels/Q369_CollectorOfJewels.java index 23e51be6f3..1b1b0d6c43 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q369_CollectorOfJewels/Q369_CollectorOfJewels.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q369_CollectorOfJewels/Q369_CollectorOfJewels.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q370_AnElderSowsSeeds/Q370_AnElderSowsSeeds.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q370_AnElderSowsSeeds/Q370_AnElderSowsSeeds.java index b7056e634d..950efedd9f 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q370_AnElderSowsSeeds/Q370_AnElderSowsSeeds.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q370_AnElderSowsSeeds/Q370_AnElderSowsSeeds.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q371_ShriekOfGhosts/Q371_ShriekOfGhosts.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q371_ShriekOfGhosts/Q371_ShriekOfGhosts.java index 4024a127b8..4af5ca6847 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q371_ShriekOfGhosts/Q371_ShriekOfGhosts.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q371_ShriekOfGhosts/Q371_ShriekOfGhosts.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q373_SupplierOfReagents/Q373_SupplierOfReagents.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q373_SupplierOfReagents/Q373_SupplierOfReagents.java index 124c815c51..8910ffd6cf 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q373_SupplierOfReagents/Q373_SupplierOfReagents.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q373_SupplierOfReagents/Q373_SupplierOfReagents.java @@ -98,7 +98,8 @@ public class Q373_SupplierOfReagents extends Quest *
  • LAVA_WYRM : 75% chance to drop - wyrm's blood (50,5%) and lava stone (24,5%)
  • * */ - private static final Map DROPLIST = new HashMap<>(); + private static final Map DROPLIST = new HashMap<>(); + static { DROPLIST.put(PLATINUM_GUARDIAN_SHAMAN, new int[] { diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q378_MagnificentFeast/Q378_MagnificentFeast.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q378_MagnificentFeast/Q378_MagnificentFeast.java index 322ab16e91..2a7ac95a39 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q378_MagnificentFeast/Q378_MagnificentFeast.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q378_MagnificentFeast/Q378_MagnificentFeast.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q384_WarehouseKeepersPastime/Q384_WarehouseKeepersPastime.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q384_WarehouseKeepersPastime/Q384_WarehouseKeepersPastime.java index dee9b33f2e..97f8307608 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q384_WarehouseKeepersPastime/Q384_WarehouseKeepersPastime.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q384_WarehouseKeepersPastime/Q384_WarehouseKeepersPastime.java @@ -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 . - */ -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 . + */ +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 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("", board[i]); - htmltext = htmltext.replace("", (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("", (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("", board[i]); + htmltext = htmltext.replace("", (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("", (Util.contains(playerArray, board[i])) ? board[i] : "?"); + } + + return htmltext; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q385_YokeOfThePast/Q385_YokeOfThePast.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q385_YokeOfThePast/Q385_YokeOfThePast.java index 5eb09db7cc..2fbc17e6d1 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q385_YokeOfThePast/Q385_YokeOfThePast.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q385_YokeOfThePast/Q385_YokeOfThePast.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q419_GetAPet/Q419_GetAPet.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q419_GetAPet/Q419_GetAPet.java index 9c09147d63..f2ecb2abf8 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q419_GetAPet/Q419_GetAPet.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q419_GetAPet/Q419_GetAPet.java @@ -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 . - */ -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 . + */ +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 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"; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q426_QuestForFishingShot/Q426_QuestForFishingShot.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q426_QuestForFishingShot/Q426_QuestForFishingShot.java index ca9563ddaf..d5d374cafa 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q426_QuestForFishingShot/Q426_QuestForFishingShot.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q426_QuestForFishingShot/Q426_QuestForFishingShot.java @@ -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 . - */ -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 . + */ +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 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 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 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 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 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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q603_DaimonTheWhiteEyed_Part1/Q603_DaimonTheWhiteEyed_Part1.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q603_DaimonTheWhiteEyed_Part1/Q603_DaimonTheWhiteEyed_Part1.java index a298c92dbd..0c5fdff8cc 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q603_DaimonTheWhiteEyed_Part1/Q603_DaimonTheWhiteEyed_Part1.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q603_DaimonTheWhiteEyed_Part1/Q603_DaimonTheWhiteEyed_Part1.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q605_AllianceWithKetraOrcs/Q605_AllianceWithKetraOrcs.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q605_AllianceWithKetraOrcs/Q605_AllianceWithKetraOrcs.java index 3d8e66d804..40ba3bfc59 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q605_AllianceWithKetraOrcs/Q605_AllianceWithKetraOrcs.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q605_AllianceWithKetraOrcs/Q605_AllianceWithKetraOrcs.java @@ -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 . - */ -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 . + */ +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 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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q611_AllianceWithVarkaSilenos/Q611_AllianceWithVarkaSilenos.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q611_AllianceWithVarkaSilenos/Q611_AllianceWithVarkaSilenos.java index 8c934a1329..8fb3f3bc4b 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q611_AllianceWithVarkaSilenos/Q611_AllianceWithVarkaSilenos.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q611_AllianceWithVarkaSilenos/Q611_AllianceWithVarkaSilenos.java @@ -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 . - */ -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 . + */ +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 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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q617_GatherTheFlames/Q617_GatherTheFlames.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q617_GatherTheFlames/Q617_GatherTheFlames.java index 5bbf5b62e7..77f36b2077 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q617_GatherTheFlames/Q617_GatherTheFlames.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q617_GatherTheFlames/Q617_GatherTheFlames.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q626_ADarkTwilight/Q626_ADarkTwilight.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q626_ADarkTwilight/Q626_ADarkTwilight.java index 9e9d74a27a..78a7685131 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q626_ADarkTwilight/Q626_ADarkTwilight.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q626_ADarkTwilight/Q626_ADarkTwilight.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q627_HeartInSearchOfPower/Q627_HeartInSearchOfPower.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q627_HeartInSearchOfPower/Q627_HeartInSearchOfPower.java index e5d1e009e8..c20ae2bc06 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q627_HeartInSearchOfPower/Q627_HeartInSearchOfPower.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q627_HeartInSearchOfPower/Q627_HeartInSearchOfPower.java @@ -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 . - */ -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 . + */ +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 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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q628_HuntOfTheGoldenRamMercenaryForce/Q628_HuntOfTheGoldenRamMercenaryForce.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q628_HuntOfTheGoldenRamMercenaryForce/Q628_HuntOfTheGoldenRamMercenaryForce.java index 24f5874868..d02dda5464 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q628_HuntOfTheGoldenRamMercenaryForce/Q628_HuntOfTheGoldenRamMercenaryForce.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q628_HuntOfTheGoldenRamMercenaryForce/Q628_HuntOfTheGoldenRamMercenaryForce.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q629_CleanUpTheSwampOfScreams/Q629_CleanUpTheSwampOfScreams.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q629_CleanUpTheSwampOfScreams/Q629_CleanUpTheSwampOfScreams.java index 162c6b9b01..d9446f46c4 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q629_CleanUpTheSwampOfScreams/Q629_CleanUpTheSwampOfScreams.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q629_CleanUpTheSwampOfScreams/Q629_CleanUpTheSwampOfScreams.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q631_DeliciousTopChoiceMeat/Q631_DeliciousTopChoiceMeat.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q631_DeliciousTopChoiceMeat/Q631_DeliciousTopChoiceMeat.java index 0b954a922c..98c83d2e84 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q631_DeliciousTopChoiceMeat/Q631_DeliciousTopChoiceMeat.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q631_DeliciousTopChoiceMeat/Q631_DeliciousTopChoiceMeat.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q633_InTheForgottenVillage/Q633_InTheForgottenVillage.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q633_InTheForgottenVillage/Q633_InTheForgottenVillage.java index 825380bd0d..f548d75eca 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q633_InTheForgottenVillage/Q633_InTheForgottenVillage.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q633_InTheForgottenVillage/Q633_InTheForgottenVillage.java @@ -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 . - */ -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 . + */ +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 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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q639_GuardiansOfTheHolyGrail/Q639_GuardiansOfTheHolyGrail.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q639_GuardiansOfTheHolyGrail/Q639_GuardiansOfTheHolyGrail.java index fd0c02c1b7..2d6da478d2 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q639_GuardiansOfTheHolyGrail/Q639_GuardiansOfTheHolyGrail.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q639_GuardiansOfTheHolyGrail/Q639_GuardiansOfTheHolyGrail.java @@ -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 . - */ -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 . + */ +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 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; + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q662_AGameOfCards/Q662_AGameOfCards.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q662_AGameOfCards/Q662_AGameOfCards.java index e33fbd0cd3..83c4e4cb1c 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q662_AGameOfCards/Q662_AGameOfCards.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q662_AGameOfCards/Q662_AGameOfCards.java @@ -1,651 +1,653 @@ -/* - * 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 . - */ -package quests.Q662_AGameOfCards; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.util.Rnd; -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.templates.item.Item; - -public class Q662_AGameOfCards extends Quest -{ - private static final String qn = "Q662_AGameOfCards"; - - // NPC - private static final int KLUMP = 30845; - - // Quest Item - private static final int RED_GEM = 8765; - - // Reward Items - private static final int EW_S = 959; - private static final int EW_A = 729; - private static final int EW_B = 947; - private static final int EW_C = 951; - private static final int EW_D = 955; - private static final int EA_D = 956; - private static final int ZIGGO_GEMSTONE = 8868; - - // All cards +/* + * 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 . + */ +package quests.Q662_AGameOfCards; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.util.Rnd; +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.templates.item.Item; + +public class Q662_AGameOfCards extends Quest +{ + private static final String qn = "Q662_AGameOfCards"; + + // NPC + private static final int KLUMP = 30845; + + // Quest Item + private static final int RED_GEM = 8765; + + // Reward Items + private static final int EW_S = 959; + private static final int EW_A = 729; + private static final int EW_B = 947; + private static final int EW_C = 951; + private static final int EW_D = 955; + private static final int EA_D = 956; + private static final int ZIGGO_GEMSTONE = 8868; + + // All cards private static final Map CARDS = new HashMap<>(); - { - CARDS.put(0, "?"); - CARDS.put(1, "!"); - CARDS.put(2, "="); - CARDS.put(3, "T"); - CARDS.put(4, "V"); - CARDS.put(5, "O"); - CARDS.put(6, "P"); - CARDS.put(7, "S"); - CARDS.put(8, "E"); - CARDS.put(9, "H"); - CARDS.put(10, "A"); - CARDS.put(11, "R"); - CARDS.put(12, "D"); - CARDS.put(13, "I"); - CARDS.put(14, "N"); - } - - // Drop chances + static + { + CARDS.put(0, "?"); + CARDS.put(1, "!"); + CARDS.put(2, "="); + CARDS.put(3, "T"); + CARDS.put(4, "V"); + CARDS.put(5, "O"); + CARDS.put(6, "P"); + CARDS.put(7, "S"); + CARDS.put(8, "E"); + CARDS.put(9, "H"); + CARDS.put(10, "A"); + CARDS.put(11, "R"); + CARDS.put(12, "D"); + CARDS.put(13, "I"); + CARDS.put(14, "N"); + } + + // Drop chances private static final Map CHANCES = new HashMap<>(); - { - CHANCES.put(18001, 232000); // Blood Queen - CHANCES.put(20672, 357000); // Trives - CHANCES.put(20673, 373000); // Falibati - CHANCES.put(20674, 583000); // Doom Knight - CHANCES.put(20677, 435000); // Tulben - CHANCES.put(20955, 358000); // Ghostly Warrior - CHANCES.put(20958, 283000); // Death Agent - CHANCES.put(20959, 455000); // Dark Guard - CHANCES.put(20961, 365000); // Bloody Knight - CHANCES.put(20962, 348000); // Bloody Priest - CHANCES.put(20965, 457000); // Chimera Piece - CHANCES.put(20966, 493000); // Changed Creation - CHANCES.put(20968, 418000); // Nonexistant Man - CHANCES.put(20972, 350000); // Shaman of Ancient Times - CHANCES.put(20973, 453000); // Forgotten Ancient People - CHANCES.put(21002, 315000); // Doom Scout - CHANCES.put(21004, 320000); // Dismal Pole - CHANCES.put(21006, 335000); // Doom Servant - CHANCES.put(21008, 462000); // Doom Archer - CHANCES.put(21010, 397000); // Doom Warrior - CHANCES.put(21109, 507000); // Hames Orc Scout - CHANCES.put(21112, 552000); // Hames Orc Footman - CHANCES.put(21114, 587000); // Cursed Guardian - CHANCES.put(21116, 812000); // Hames Orc Overlord - CHANCES.put(21278, 483000); // Antelope - CHANCES.put(21279, 483000); // Antelope - CHANCES.put(21280, 483000); // Antelope - CHANCES.put(21281, 483000); // Antelope - CHANCES.put(21286, 515000); // Buffalo - CHANCES.put(21287, 515000); // Buffalo - CHANCES.put(21288, 515000); // Buffalo - CHANCES.put(21289, 515000); // Buffalo - CHANCES.put(21508, 493000); // Splinter Stakato - CHANCES.put(21510, 527000); // Splinter Stakato Soldier - CHANCES.put(21513, 562000); // Needle Stakato - CHANCES.put(21515, 598000); // Needle Stakato Soldier - CHANCES.put(21520, 458000); // Eye of Splendor - CHANCES.put(21526, 552000); // Wisdom of Splendor - CHANCES.put(21530, 488000); // Victory of Splendor - CHANCES.put(21535, 573000); // Signet of Splendor - } - - public Q662_AGameOfCards() - { - super(662, qn, "A Game Of Cards"); - - registerQuestItems(RED_GEM); - - addStartNpc(KLUMP); - addTalkId(KLUMP); - - for (int monster : CHANCES.keySet()) - { - addKillId(monster); - } - } - - @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("30845-03.htm")) - { - st.setState(State.STARTED); - st.set("cond", "1"); - st.set("state", "0"); - st.set("stateEx", "0"); - st.playSound(QuestState.SOUND_ACCEPT); - } - else if (event.equals("30845-04.htm")) - { - int state = st.getInt("state"); - int stateEx = st.getInt("stateEx"); - - if ((state == 0) && (stateEx == 0) && (st.getQuestItemsCount(RED_GEM) >= 50)) - { - htmltext = "30845-05.htm"; - } - } - else if (event.equals("30845-07.htm")) - { - st.playSound(QuestState.SOUND_FINISH); - st.exitQuest(true); - } - else if (event.equals("30845-11.htm")) - { - int state = st.getInt("state"); - int stateEx = st.getInt("stateEx"); - - if ((state == 0) && (stateEx == 0) && (st.getQuestItemsCount(RED_GEM) >= 50)) - { - int i1 = Rnd.get(70) + 1; - int i2 = Rnd.get(70) + 1; - int i3 = Rnd.get(70) + 1; - int i4 = Rnd.get(70) + 1; - int i5 = Rnd.get(70) + 1; - - if (i1 >= 57) - { - i1 = i1 - 56; - } - else if (i1 >= 43) - { - i1 = i1 - 42; - } - else if (i1 >= 29) - { - i1 = i1 - 28; - } - else if (i1 >= 15) - { - i1 = i1 - 14; - } - - if (i2 >= 57) - { - i2 = i2 - 56; - } - else if (i2 >= 43) - { - i2 = i2 - 42; - } - else if (i2 >= 29) - { - i2 = i2 - 28; - } - else if (i2 >= 15) - { - i2 = i2 - 14; - } - - if (i3 >= 57) - { - i3 = i3 - 56; - } - else if (i3 >= 43) - { - i3 = i3 - 42; - } - else if (i3 >= 29) - { - i3 = i3 - 28; - } - else if (i3 >= 15) - { - i3 = i3 - 14; - } - - if (i4 >= 57) - { - i4 = i4 - 56; - } - else if (i4 >= 43) - { - i4 = i4 - 42; - } - else if (i4 >= 29) - { - i4 = i4 - 28; - } - else if (i4 >= 15) - { - i4 = i4 - 14; - } - - if (i5 >= 57) - { - i5 = i5 - 56; - } - else if (i5 >= 43) - { - i5 = i5 - 42; - } - else if (i5 >= 29) - { - i5 = i5 - 28; - } - else if (i5 >= 15) - { - i5 = i5 - 14; - } - - st.set("state", String.valueOf((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1)); - st.set("stateEx", String.valueOf(i5)); - - st.takeItems(RED_GEM, 50); - } - } - else if (event.equals("First") || event.equals("Second") || event.equals("Third") || event.equals("Fourth") || event.equals("Fifth")) // reply 11 12 13 14 15 - { - int state = st.getInt("state"); - int stateEx = st.getInt("stateEx"); - - int i0; - int i1; - int i2; - int i3; - int i4; - int i5; - int i6; - int i8; - int i9; - - i0 = state; - i1 = stateEx; - i5 = i1 % 100; - i9 = i1 / 100; - i1 = i0 % 100; - i2 = (i0 % 10000) / 100; - i3 = (i0 % 1000000) / 10000; - i4 = (i0 % 100000000) / 1000000; - - if (event.equals("First")) - { - if ((i9 % 2) < 1) - { - i9 = i9 + 1; - } - } - else if (event.equals("Second")) - { - if ((i9 % 4) < 2) - { - i9 = i9 + 2; - } - } - else if (event.equals("Third")) - { - if ((i9 % 8) < 4) - { - i9 = i9 + 4; - } - } - else if (event.equals("Fourth")) - { - if ((i9 % 16) < 8) - { - i9 = i9 + 8; - } - } - else if (event.equals("Fifth")) - { - if ((i9 % 32) < 16) - { - i9 = i9 + 16; - } - } - - if ((i9 % 32) < 31) - { - st.set("stateEx", String.valueOf((i9 * 100) + i5)); - htmltext = getHtmlText("30845-12.htm"); - } - else if ((i9 % 32) == 31) - { - i6 = 0; - i8 = 0; - - if ((i1 >= 1) && (i1 <= 14) && (i2 >= 1) && (i2 <= 14) && (i3 >= 1) && (i3 <= 14) && (i4 >= 1) && (i4 <= 14) && (i5 >= 1) && (i5 <= 14)) - { - if (i1 == i2) - { - i6 = i6 + 10; - i8 = i8 + 8; - } - - if (i1 == i3) - { - i6 = i6 + 10; - i8 = i8 + 4; - } - - if (i1 == i4) - { - i6 = i6 + 10; - i8 = i8 + 2; - } - - if (i1 == i5) - { - i6 = i6 + 10; - i8 = i8 + 1; - } - - if ((i6 % 100) < 10) - { - if ((i8 % 16) < 8) - { - if ((i8 % 8) < 4) - { - if (i2 == i3) - { - i6 = i6 + 10; - i8 = i8 + 4; - } - } - - if ((i8 % 4) < 2) - { - if (i2 == i4) - { - i6 = i6 + 10; - i8 = i8 + 2; - } - } - - if ((i8 % 2) < 1) - { - if (i2 == i5) - { - i6 = i6 + 10; - i8 = i8 + 1; - } - } - } - } - else if ((i6 % 10) == 0) - { - if ((i8 % 16) < 8) - { - if ((i8 % 8) < 4) - { - if (i2 == i3) - { - i6 = i6 + 1; - i8 = i8 + 4; - } - } - - if ((i8 % 4) < 2) - { - if (i2 == i4) - { - i6 = i6 + 1; - i8 = i8 + 2; - } - } - - if ((i8 % 2) < 1) - { - if (i2 == i5) - { - i6 = i6 + 1; - i8 = i8 + 1; - } - } - } - } - - if ((i6 % 100) < 10) - { - if ((i8 % 8) < 4) - { - if ((i8 % 4) < 2) - { - if (i3 == i4) - { - i6 = i6 + 10; - i8 = i8 + 2; - } - } - - if ((i8 % 2) < 1) - { - if (i3 == i5) - { - i6 = i6 + 10; - i8 = i8 + 1; - } - } - } - } - else if ((i6 % 10) == 0) - { - if ((i8 % 8) < 4) - { - if ((i8 % 4) < 2) - { - if (i3 == i4) - { - i6 = i6 + 1; - i8 = i8 + 2; - } - } - - if ((i8 % 2) < 1) - { - if (i3 == i5) - { - i6 = i6 + 1; - i8 = i8 + 1; - } - } - } - } - - if ((i6 % 100) < 10) - { - if ((i8 % 4) < 2) - { - if ((i8 % 2) < 1) - { - if (i4 == i5) - { - i6 = i6 + 10; - i8 = i8 + 1; - } - } - } - } - else if ((i6 % 10) == 0) - { - if ((i8 % 4) < 2) - { - if ((i8 % 2) < 1) - { - if (i4 == i5) - { - i6 = i6 + 1; - i8 = i8 + 1; - } - } - } - } - } - - if (i6 == 40) - { - giveReward(st, ZIGGO_GEMSTONE, 43); - giveReward(st, EW_S, 3); - giveReward(st, EW_A, 1); - htmltext = getHtmlText("30845-13.htm"); - } - else if (i6 == 30) - { - giveReward(st, EW_S, 2); - giveReward(st, EW_C, 2); - htmltext = getHtmlText("30845-14.htm"); - } - else if ((i6 == 21) || (i6 == 12)) - { - giveReward(st, EW_A, 1); - giveReward(st, EW_B, 2); - giveReward(st, EW_D, 1); - htmltext = getHtmlText("30845-15.htm"); - } - else if (i6 == 20) - { - giveReward(st, EW_C, 2); - htmltext = getHtmlText("30845-16.htm"); - } - else if (i6 == 11) - { - giveReward(st, EW_C, 1); - htmltext = getHtmlText("30845-17.htm"); - } - else if (i6 == 10) - { - giveReward(st, EA_D, 2); - htmltext = getHtmlText("30845-18.htm"); - } - else if (i6 == 0) - { - htmltext = getHtmlText("30845-19.htm"); - } - - st.set("state", "0"); - st.set("stateEx", "0"); - } - - htmltext = htmltext.replace("%FontColor1%", ((i9 % 2) < 1) ? "ffff00" : "ff6f6f").replace("%Cell1%", ((i9 % 2) < 1) ? CARDS.get(0) : CARDS.get(i1)); - htmltext = htmltext.replace("%FontColor2%", ((i9 % 4) < 2) ? "ffff00" : "ff6f6f").replace("%Cell2%", ((i9 % 4) < 2) ? CARDS.get(0) : CARDS.get(i2)); - htmltext = htmltext.replace("%FontColor3%", ((i9 % 8) < 4) ? "ffff00" : "ff6f6f").replace("%Cell3%", ((i9 % 8) < 4) ? CARDS.get(0) : CARDS.get(i3)); - htmltext = htmltext.replace("%FontColor4%", ((i9 % 16) < 8) ? "ffff00" : "ff6f6f").replace("%Cell4%", ((i9 % 16) < 8) ? CARDS.get(0) : CARDS.get(i4)); - htmltext = htmltext.replace("%FontColor5%", ((i9 % 32) < 16) ? "ffff00" : "ff6f6f").replace("%Cell5%", ((i9 % 32) < 16) ? CARDS.get(0) : CARDS.get(i5)); - } - else if (event.equals("30845-20.htm")) // reply 20 - { - if (st.getQuestItemsCount(RED_GEM) < 50) - { - htmltext = "30845-21.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() < 61) ? "30845-02.htm" : "30845-01.htm"; - break; - - case State.STARTED: - int state = st.getInt("state"); - int stateEx = st.getInt("stateEx"); - - if ((state == 0) && (stateEx == 0)) - { - htmltext = (st.getQuestItemsCount(RED_GEM) < 50) ? "30845-04.htm" : "30845-05.htm"; - } - else if ((state != 0) && (stateEx != 0)) - { - int i0; - int i1; - int i2; - int i3; - int i4; - int i5; - int i9; - - i0 = state; - i1 = stateEx; - i5 = i1 % 100; - i9 = i1 / 100; - i1 = i0 % 100; - i2 = (i0 % 10000) / 100; - i3 = (i0 % 1000000) / 10000; - i4 = (i0 % 100000000) / 1000000; - - htmltext = getHtmlText("30845-11a.htm"); - htmltext = htmltext.replace("%FontColor1%", ((i9 % 2) < 1) ? "ffff00" : "ff6f6f").replace("%Cell1%", ((i9 % 2) < 1) ? CARDS.get(0) : CARDS.get(i1)); - htmltext = htmltext.replace("%FontColor2%", ((i9 % 4) < 2) ? "ffff00" : "ff6f6f").replace("%Cell2%", ((i9 % 4) < 2) ? CARDS.get(0) : CARDS.get(i2)); - htmltext = htmltext.replace("%FontColor3%", ((i9 % 8) < 4) ? "ffff00" : "ff6f6f").replace("%Cell3%", ((i9 % 8) < 4) ? CARDS.get(0) : CARDS.get(i3)); - htmltext = htmltext.replace("%FontColor4%", ((i9 % 16) < 8) ? "ffff00" : "ff6f6f").replace("%Cell4%", ((i9 % 16) < 8) ? CARDS.get(0) : CARDS.get(i4)); - htmltext = htmltext.replace("%FontColor5%", ((i9 % 32) < 16) ? "ffff00" : "ff6f6f").replace("%Cell5%", ((i9 % 32) < 16) ? CARDS.get(0) : CARDS.get(i5)); - } - 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(RED_GEM, 1, 0, CHANCES.get(npc.getNpcId())); - return null; - } - - private static void giveReward(QuestState st, int item, int count) - { - final Item template = ItemTable.getInstance().getTemplate(item); - - if (template.isStackable()) - { - st.giveItems(item, count); - } - else - { - for (int i = 0; i < count; i++) - { - st.giveItems(item, 1); - } - } - } + static + { + CHANCES.put(18001, 232000); // Blood Queen + CHANCES.put(20672, 357000); // Trives + CHANCES.put(20673, 373000); // Falibati + CHANCES.put(20674, 583000); // Doom Knight + CHANCES.put(20677, 435000); // Tulben + CHANCES.put(20955, 358000); // Ghostly Warrior + CHANCES.put(20958, 283000); // Death Agent + CHANCES.put(20959, 455000); // Dark Guard + CHANCES.put(20961, 365000); // Bloody Knight + CHANCES.put(20962, 348000); // Bloody Priest + CHANCES.put(20965, 457000); // Chimera Piece + CHANCES.put(20966, 493000); // Changed Creation + CHANCES.put(20968, 418000); // Nonexistant Man + CHANCES.put(20972, 350000); // Shaman of Ancient Times + CHANCES.put(20973, 453000); // Forgotten Ancient People + CHANCES.put(21002, 315000); // Doom Scout + CHANCES.put(21004, 320000); // Dismal Pole + CHANCES.put(21006, 335000); // Doom Servant + CHANCES.put(21008, 462000); // Doom Archer + CHANCES.put(21010, 397000); // Doom Warrior + CHANCES.put(21109, 507000); // Hames Orc Scout + CHANCES.put(21112, 552000); // Hames Orc Footman + CHANCES.put(21114, 587000); // Cursed Guardian + CHANCES.put(21116, 812000); // Hames Orc Overlord + CHANCES.put(21278, 483000); // Antelope + CHANCES.put(21279, 483000); // Antelope + CHANCES.put(21280, 483000); // Antelope + CHANCES.put(21281, 483000); // Antelope + CHANCES.put(21286, 515000); // Buffalo + CHANCES.put(21287, 515000); // Buffalo + CHANCES.put(21288, 515000); // Buffalo + CHANCES.put(21289, 515000); // Buffalo + CHANCES.put(21508, 493000); // Splinter Stakato + CHANCES.put(21510, 527000); // Splinter Stakato Soldier + CHANCES.put(21513, 562000); // Needle Stakato + CHANCES.put(21515, 598000); // Needle Stakato Soldier + CHANCES.put(21520, 458000); // Eye of Splendor + CHANCES.put(21526, 552000); // Wisdom of Splendor + CHANCES.put(21530, 488000); // Victory of Splendor + CHANCES.put(21535, 573000); // Signet of Splendor + } + + public Q662_AGameOfCards() + { + super(662, qn, "A Game Of Cards"); + + registerQuestItems(RED_GEM); + + addStartNpc(KLUMP); + addTalkId(KLUMP); + + for (int monster : CHANCES.keySet()) + { + addKillId(monster); + } + } + + @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("30845-03.htm")) + { + st.setState(State.STARTED); + st.set("cond", "1"); + st.set("state", "0"); + st.set("stateEx", "0"); + st.playSound(QuestState.SOUND_ACCEPT); + } + else if (event.equals("30845-04.htm")) + { + int state = st.getInt("state"); + int stateEx = st.getInt("stateEx"); + + if ((state == 0) && (stateEx == 0) && (st.getQuestItemsCount(RED_GEM) >= 50)) + { + htmltext = "30845-05.htm"; + } + } + else if (event.equals("30845-07.htm")) + { + st.playSound(QuestState.SOUND_FINISH); + st.exitQuest(true); + } + else if (event.equals("30845-11.htm")) + { + int state = st.getInt("state"); + int stateEx = st.getInt("stateEx"); + + if ((state == 0) && (stateEx == 0) && (st.getQuestItemsCount(RED_GEM) >= 50)) + { + int i1 = Rnd.get(70) + 1; + int i2 = Rnd.get(70) + 1; + int i3 = Rnd.get(70) + 1; + int i4 = Rnd.get(70) + 1; + int i5 = Rnd.get(70) + 1; + + if (i1 >= 57) + { + i1 = i1 - 56; + } + else if (i1 >= 43) + { + i1 = i1 - 42; + } + else if (i1 >= 29) + { + i1 = i1 - 28; + } + else if (i1 >= 15) + { + i1 = i1 - 14; + } + + if (i2 >= 57) + { + i2 = i2 - 56; + } + else if (i2 >= 43) + { + i2 = i2 - 42; + } + else if (i2 >= 29) + { + i2 = i2 - 28; + } + else if (i2 >= 15) + { + i2 = i2 - 14; + } + + if (i3 >= 57) + { + i3 = i3 - 56; + } + else if (i3 >= 43) + { + i3 = i3 - 42; + } + else if (i3 >= 29) + { + i3 = i3 - 28; + } + else if (i3 >= 15) + { + i3 = i3 - 14; + } + + if (i4 >= 57) + { + i4 = i4 - 56; + } + else if (i4 >= 43) + { + i4 = i4 - 42; + } + else if (i4 >= 29) + { + i4 = i4 - 28; + } + else if (i4 >= 15) + { + i4 = i4 - 14; + } + + if (i5 >= 57) + { + i5 = i5 - 56; + } + else if (i5 >= 43) + { + i5 = i5 - 42; + } + else if (i5 >= 29) + { + i5 = i5 - 28; + } + else if (i5 >= 15) + { + i5 = i5 - 14; + } + + st.set("state", String.valueOf((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1)); + st.set("stateEx", String.valueOf(i5)); + + st.takeItems(RED_GEM, 50); + } + } + else if (event.equals("First") || event.equals("Second") || event.equals("Third") || event.equals("Fourth") || event.equals("Fifth")) // reply 11 12 13 14 15 + { + int state = st.getInt("state"); + int stateEx = st.getInt("stateEx"); + + int i0; + int i1; + int i2; + int i3; + int i4; + int i5; + int i6; + int i8; + int i9; + + i0 = state; + i1 = stateEx; + i5 = i1 % 100; + i9 = i1 / 100; + i1 = i0 % 100; + i2 = (i0 % 10000) / 100; + i3 = (i0 % 1000000) / 10000; + i4 = (i0 % 100000000) / 1000000; + + if (event.equals("First")) + { + if ((i9 % 2) < 1) + { + i9 = i9 + 1; + } + } + else if (event.equals("Second")) + { + if ((i9 % 4) < 2) + { + i9 = i9 + 2; + } + } + else if (event.equals("Third")) + { + if ((i9 % 8) < 4) + { + i9 = i9 + 4; + } + } + else if (event.equals("Fourth")) + { + if ((i9 % 16) < 8) + { + i9 = i9 + 8; + } + } + else if (event.equals("Fifth")) + { + if ((i9 % 32) < 16) + { + i9 = i9 + 16; + } + } + + if ((i9 % 32) < 31) + { + st.set("stateEx", String.valueOf((i9 * 100) + i5)); + htmltext = getHtmlText("30845-12.htm"); + } + else if ((i9 % 32) == 31) + { + i6 = 0; + i8 = 0; + + if ((i1 >= 1) && (i1 <= 14) && (i2 >= 1) && (i2 <= 14) && (i3 >= 1) && (i3 <= 14) && (i4 >= 1) && (i4 <= 14) && (i5 >= 1) && (i5 <= 14)) + { + if (i1 == i2) + { + i6 = i6 + 10; + i8 = i8 + 8; + } + + if (i1 == i3) + { + i6 = i6 + 10; + i8 = i8 + 4; + } + + if (i1 == i4) + { + i6 = i6 + 10; + i8 = i8 + 2; + } + + if (i1 == i5) + { + i6 = i6 + 10; + i8 = i8 + 1; + } + + if ((i6 % 100) < 10) + { + if ((i8 % 16) < 8) + { + if ((i8 % 8) < 4) + { + if (i2 == i3) + { + i6 = i6 + 10; + i8 = i8 + 4; + } + } + + if ((i8 % 4) < 2) + { + if (i2 == i4) + { + i6 = i6 + 10; + i8 = i8 + 2; + } + } + + if ((i8 % 2) < 1) + { + if (i2 == i5) + { + i6 = i6 + 10; + i8 = i8 + 1; + } + } + } + } + else if ((i6 % 10) == 0) + { + if ((i8 % 16) < 8) + { + if ((i8 % 8) < 4) + { + if (i2 == i3) + { + i6 = i6 + 1; + i8 = i8 + 4; + } + } + + if ((i8 % 4) < 2) + { + if (i2 == i4) + { + i6 = i6 + 1; + i8 = i8 + 2; + } + } + + if ((i8 % 2) < 1) + { + if (i2 == i5) + { + i6 = i6 + 1; + i8 = i8 + 1; + } + } + } + } + + if ((i6 % 100) < 10) + { + if ((i8 % 8) < 4) + { + if ((i8 % 4) < 2) + { + if (i3 == i4) + { + i6 = i6 + 10; + i8 = i8 + 2; + } + } + + if ((i8 % 2) < 1) + { + if (i3 == i5) + { + i6 = i6 + 10; + i8 = i8 + 1; + } + } + } + } + else if ((i6 % 10) == 0) + { + if ((i8 % 8) < 4) + { + if ((i8 % 4) < 2) + { + if (i3 == i4) + { + i6 = i6 + 1; + i8 = i8 + 2; + } + } + + if ((i8 % 2) < 1) + { + if (i3 == i5) + { + i6 = i6 + 1; + i8 = i8 + 1; + } + } + } + } + + if ((i6 % 100) < 10) + { + if ((i8 % 4) < 2) + { + if ((i8 % 2) < 1) + { + if (i4 == i5) + { + i6 = i6 + 10; + i8 = i8 + 1; + } + } + } + } + else if ((i6 % 10) == 0) + { + if ((i8 % 4) < 2) + { + if ((i8 % 2) < 1) + { + if (i4 == i5) + { + i6 = i6 + 1; + i8 = i8 + 1; + } + } + } + } + } + + if (i6 == 40) + { + giveReward(st, ZIGGO_GEMSTONE, 43); + giveReward(st, EW_S, 3); + giveReward(st, EW_A, 1); + htmltext = getHtmlText("30845-13.htm"); + } + else if (i6 == 30) + { + giveReward(st, EW_S, 2); + giveReward(st, EW_C, 2); + htmltext = getHtmlText("30845-14.htm"); + } + else if ((i6 == 21) || (i6 == 12)) + { + giveReward(st, EW_A, 1); + giveReward(st, EW_B, 2); + giveReward(st, EW_D, 1); + htmltext = getHtmlText("30845-15.htm"); + } + else if (i6 == 20) + { + giveReward(st, EW_C, 2); + htmltext = getHtmlText("30845-16.htm"); + } + else if (i6 == 11) + { + giveReward(st, EW_C, 1); + htmltext = getHtmlText("30845-17.htm"); + } + else if (i6 == 10) + { + giveReward(st, EA_D, 2); + htmltext = getHtmlText("30845-18.htm"); + } + else if (i6 == 0) + { + htmltext = getHtmlText("30845-19.htm"); + } + + st.set("state", "0"); + st.set("stateEx", "0"); + } + + htmltext = htmltext.replace("%FontColor1%", ((i9 % 2) < 1) ? "ffff00" : "ff6f6f").replace("%Cell1%", ((i9 % 2) < 1) ? CARDS.get(0) : CARDS.get(i1)); + htmltext = htmltext.replace("%FontColor2%", ((i9 % 4) < 2) ? "ffff00" : "ff6f6f").replace("%Cell2%", ((i9 % 4) < 2) ? CARDS.get(0) : CARDS.get(i2)); + htmltext = htmltext.replace("%FontColor3%", ((i9 % 8) < 4) ? "ffff00" : "ff6f6f").replace("%Cell3%", ((i9 % 8) < 4) ? CARDS.get(0) : CARDS.get(i3)); + htmltext = htmltext.replace("%FontColor4%", ((i9 % 16) < 8) ? "ffff00" : "ff6f6f").replace("%Cell4%", ((i9 % 16) < 8) ? CARDS.get(0) : CARDS.get(i4)); + htmltext = htmltext.replace("%FontColor5%", ((i9 % 32) < 16) ? "ffff00" : "ff6f6f").replace("%Cell5%", ((i9 % 32) < 16) ? CARDS.get(0) : CARDS.get(i5)); + } + else if (event.equals("30845-20.htm")) // reply 20 + { + if (st.getQuestItemsCount(RED_GEM) < 50) + { + htmltext = "30845-21.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() < 61) ? "30845-02.htm" : "30845-01.htm"; + break; + + case State.STARTED: + int state = st.getInt("state"); + int stateEx = st.getInt("stateEx"); + + if ((state == 0) && (stateEx == 0)) + { + htmltext = (st.getQuestItemsCount(RED_GEM) < 50) ? "30845-04.htm" : "30845-05.htm"; + } + else if ((state != 0) && (stateEx != 0)) + { + int i0; + int i1; + int i2; + int i3; + int i4; + int i5; + int i9; + + i0 = state; + i1 = stateEx; + i5 = i1 % 100; + i9 = i1 / 100; + i1 = i0 % 100; + i2 = (i0 % 10000) / 100; + i3 = (i0 % 1000000) / 10000; + i4 = (i0 % 100000000) / 1000000; + + htmltext = getHtmlText("30845-11a.htm"); + htmltext = htmltext.replace("%FontColor1%", ((i9 % 2) < 1) ? "ffff00" : "ff6f6f").replace("%Cell1%", ((i9 % 2) < 1) ? CARDS.get(0) : CARDS.get(i1)); + htmltext = htmltext.replace("%FontColor2%", ((i9 % 4) < 2) ? "ffff00" : "ff6f6f").replace("%Cell2%", ((i9 % 4) < 2) ? CARDS.get(0) : CARDS.get(i2)); + htmltext = htmltext.replace("%FontColor3%", ((i9 % 8) < 4) ? "ffff00" : "ff6f6f").replace("%Cell3%", ((i9 % 8) < 4) ? CARDS.get(0) : CARDS.get(i3)); + htmltext = htmltext.replace("%FontColor4%", ((i9 % 16) < 8) ? "ffff00" : "ff6f6f").replace("%Cell4%", ((i9 % 16) < 8) ? CARDS.get(0) : CARDS.get(i4)); + htmltext = htmltext.replace("%FontColor5%", ((i9 % 32) < 16) ? "ffff00" : "ff6f6f").replace("%Cell5%", ((i9 % 32) < 16) ? CARDS.get(0) : CARDS.get(i5)); + } + 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(RED_GEM, 1, 0, CHANCES.get(npc.getNpcId())); + return null; + } + + private static void giveReward(QuestState st, int item, int count) + { + final Item template = ItemTable.getInstance().getTemplate(item); + + if (template.isStackable()) + { + st.giveItems(item, count); + } + else + { + for (int i = 0; i < count; i++) + { + st.giveItems(item, 1); + } + } + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q663_SeductiveWhispers/Q663_SeductiveWhispers.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q663_SeductiveWhispers/Q663_SeductiveWhispers.java index 1b2b2cf2f8..76c439ed51 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q663_SeductiveWhispers/Q663_SeductiveWhispers.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/Q663_SeductiveWhispers/Q663_SeductiveWhispers.java @@ -1,544 +1,546 @@ -/* - * 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 . - */ -package quests.Q663_SeductiveWhispers; - -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 Q663_SeductiveWhispers extends Quest -{ - private static final String qn = "Q663_SeductiveWhispers"; - - // NPC - private static final int WILBERT = 30846; - - // Quest item - private static final int SPIRIT_BEAD = 8766; - - // Rewards - private static final int ADENA = 57; - private static final int ENCHANT_WEAPON_A = 729; - private static final int ENCHANT_ARMOR_A = 730; - private static final int ENCHANT_WEAPON_B = 947; - private static final int ENCHANT_ARMOR_B = 948; - private static final int ENCHANT_WEAPON_C = 951; - private static final int ENCHANT_WEAPON_D = 955; - - private static final int RECIPES[] = - { - 2353, - 4963, - 4967, - 5000, - 5001, - 5002, - 5004, - 5005, - 5006, - 5007 - }; - - private static final int BLADES[] = - { - 2115, - 4104, - 4108, - 4114, - 4115, - 4116, - 4118, - 4119, - 4120, - 4121 - }; - - // Text of cards +/* + * 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 . + */ +package quests.Q663_SeductiveWhispers; + +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 Q663_SeductiveWhispers extends Quest +{ + private static final String qn = "Q663_SeductiveWhispers"; + + // NPC + private static final int WILBERT = 30846; + + // Quest item + private static final int SPIRIT_BEAD = 8766; + + // Rewards + private static final int ADENA = 57; + private static final int ENCHANT_WEAPON_A = 729; + private static final int ENCHANT_ARMOR_A = 730; + private static final int ENCHANT_WEAPON_B = 947; + private static final int ENCHANT_ARMOR_B = 948; + private static final int ENCHANT_WEAPON_C = 951; + private static final int ENCHANT_WEAPON_D = 955; + + private static final int RECIPES[] = + { + 2353, + 4963, + 4967, + 5000, + 5001, + 5002, + 5004, + 5005, + 5006, + 5007 + }; + + private static final int BLADES[] = + { + 2115, + 4104, + 4108, + 4114, + 4115, + 4116, + 4118, + 4119, + 4120, + 4121 + }; + + // Text of cards private static final Map CARDS = new HashMap<>(); - { - CARDS.put(0, "No such card"); - CARDS.put(11, " Sun Card: 1 "); - CARDS.put(12, " Sun Card: 2 "); - CARDS.put(13, " Sun Card: 3 "); - CARDS.put(14, " Sun Card: 4 "); - CARDS.put(15, " Sun Card: 5 "); - CARDS.put(21, " Moon Card: 1 "); - CARDS.put(22, " Moon Card: 2 "); - CARDS.put(23, " Moon Card: 3 "); - CARDS.put(24, " Moon Card: 4 "); - CARDS.put(25, " Moon Card: 5 "); - } - - // Drop chances + static + { + CARDS.put(0, "No such card"); + CARDS.put(11, " Sun Card: 1 "); + CARDS.put(12, " Sun Card: 2 "); + CARDS.put(13, " Sun Card: 3 "); + CARDS.put(14, " Sun Card: 4 "); + CARDS.put(15, " Sun Card: 5 "); + CARDS.put(21, " Moon Card: 1 "); + CARDS.put(22, " Moon Card: 2 "); + CARDS.put(23, " Moon Card: 3 "); + CARDS.put(24, " Moon Card: 4 "); + CARDS.put(25, " Moon Card: 5 "); + } + + // Drop chances private static final Map CHANCES = new HashMap<>(); - { - CHANCES.put(20674, 807000); // Doom Knight - CHANCES.put(20678, 372000); // Tortured Undead - CHANCES.put(20954, 460000); // Hungered Corpse - CHANCES.put(20955, 537000); // Ghost War - CHANCES.put(20956, 540000); // Past Knight - CHANCES.put(20957, 565000); // Nihil Invader - CHANCES.put(20958, 425000); // Death Agent - CHANCES.put(20959, 682000); // Dark Guard - CHANCES.put(20960, 372000); // Bloody Ghost - CHANCES.put(20961, 547000); // Bloody Knight - CHANCES.put(20962, 522000); // Bloody Priest - CHANCES.put(20963, 498000); // Bloody Lord - CHANCES.put(20974, 1000000); // Spiteful Soul Leader - CHANCES.put(20975, 975000); // Spiteful Soul Wizard - CHANCES.put(20976, 825000); // Spiteful Soul Fighter - CHANCES.put(20996, 385000); // Spiteful Ghost of Ruins - CHANCES.put(20997, 342000); // Soldier of Grief - CHANCES.put(20998, 377000); // Cruel Punisher - CHANCES.put(20999, 450000); // Roving Soul - CHANCES.put(21000, 395000); // Soul of Ruins - CHANCES.put(21001, 535000); // Wretched Archer - CHANCES.put(21002, 472000); // Doom Scout - CHANCES.put(21006, 502000); // Doom Servant - CHANCES.put(21007, 540000); // Doom Guard - CHANCES.put(21008, 692000); // Doom Archer - CHANCES.put(21009, 740000); // Doom Trooper - CHANCES.put(21010, 595000); // Doom Warrior - } - - public Q663_SeductiveWhispers() - { - super(663, qn, "Seductive Whispers"); - - registerQuestItems(SPIRIT_BEAD); - - addStartNpc(WILBERT); - addTalkId(WILBERT); - - 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; - } - - int state = st.getInt("state"); - - if (event.equals("30846-03.htm")) - { - st.setState(State.STARTED); - st.set("cond", "1"); - st.set("state", "1"); - st.playSound(QuestState.SOUND_ACCEPT); - } - else if (event.equals("30846-09.htm") && ((state % 10) <= 4)) - { - if ((state / 10) < 1) - { - if (st.getQuestItemsCount(SPIRIT_BEAD) >= 50) - { - st.takeItems(SPIRIT_BEAD, 50); - st.set("state", "5"); - } - else - { - htmltext = "30846-10.htm"; - } - } - else - { - st.set("state", String.valueOf(((state / 10) * 10) + 5)); - st.set("stateEx", "0"); - htmltext = "30846-09a.htm"; - } - } - else if (event.equals("30846-14.htm") && ((state % 10) == 5) && ((state / 1000) == 0)) - { - int i0 = st.getInt("stateEx"); - - int i1 = i0 % 10; - int i2 = (i0 - i1) / 10; - - int param1 = Rnd.get(2) + 1; - int param2 = Rnd.get(5) + 1; - - int i5 = state / 10; - - int param3 = (param1 * 10) + param2; - - if (param1 == i2) - { - int i3 = param2 + i1; - - if (((i3 % 5) == 0) && (i3 != 10)) - { - if (((state % 100) / 10) >= 7) - { - st.set("state", "4"); - st.rewardItems(ADENA, 2384000); - st.rewardItems(ENCHANT_WEAPON_A, 1); - st.rewardItems(ENCHANT_ARMOR_A, 1); - st.rewardItems(ENCHANT_ARMOR_A, 1); - htmltext = getHTML("30846-14.htm", i0, param3, player.getName()); - } - else - { - st.set("state", String.valueOf(((state / 10) * 10) + 7)); - htmltext = getHTML("30846-13.htm", i0, param3, player.getName()).replace("%wincount%", String.valueOf(i5 + 1)); - } - } - else - { - st.set("state", String.valueOf(((state / 10) * 10) + 6)); - st.set("stateEx", String.valueOf(param3)); - htmltext = getHTML("30846-12.htm", i0, param3, player.getName()); - } - } - else - { - if ((param2 == 5) || (i1 == 5)) - { - if (((state % 100) / 10) >= 7) - { - st.set("state", "4"); - st.rewardItems(ADENA, 2384000); - st.rewardItems(ENCHANT_WEAPON_A, 1); - st.rewardItems(ENCHANT_ARMOR_A, 1); - st.rewardItems(ENCHANT_ARMOR_A, 1); - htmltext = getHTML("30846-14.htm", i0, param3, player.getName()); - } - else - { - st.set("state", String.valueOf(((state / 10) * 10) + 7)); - htmltext = getHTML("30846-13.htm", i0, param3, player.getName()).replace("%wincount%", String.valueOf(i5 + 1)); - } - } - else - { - st.set("state", String.valueOf(((state / 10) * 10) + 6)); - st.set("stateEx", String.valueOf((param1 * 10) + param2)); - htmltext = getHTML("30846-12.htm", i0, param3, player.getName()); - } - } - } - else if (event.equals("30846-19.htm") && ((state % 10) == 6) && ((state / 1000) == 0)) - { - int i0 = st.getInt("stateEx"); - - int i1 = i0 % 10; - int i2 = (i0 - i1) / 10; - - int param1 = Rnd.get(2) + 1; - int param2 = Rnd.get(5) + 1; - int param3 = (param1 * 10) + param2; - - if (param1 == i2) - { - int i3 = param1 + i1; - - if (((i3 % 5) == 0) && (i3 != 10)) - { - st.set("state", "1"); - st.set("stateEx", "0"); - htmltext = getHTML("30846-19.htm", i0, param3, player.getName()); - } - else - { - st.set("state", String.valueOf(((state / 10) * 10) + 5)); - st.set("stateEx", String.valueOf(param3)); - htmltext = getHTML("30846-18.htm", i0, param3, player.getName()); - } - } - else - { - if ((param2 == 5) || (i1 == 5)) - { - st.set("state", "1"); - htmltext = getHTML("30846-19.htm", i0, param3, player.getName()); - } - else - { - st.set("state", String.valueOf(((state / 10) * 10) + 5)); - st.set("stateEx", String.valueOf(param3)); - htmltext = getHTML("30846-18.htm", i0, param3, player.getName()); - } - } - } - else if (event.equals("30846-20.htm") && ((state % 10) == 7) && ((state / 1000) == 0)) - { - st.set("state", String.valueOf((((state / 10) + 1) * 10) + 4)); - st.set("stateEx", "0"); - } - else if (event.equals("30846-21.htm") && ((state % 10) == 7) && ((state / 1000) == 0)) - { - int round = state / 10; - - if (round == 0) - { - st.rewardItems(ADENA, 40000); - } - else if (round == 1) - { - st.rewardItems(ADENA, 80000); - } - else if (round == 2) - { - st.rewardItems(ADENA, 110000); - st.rewardItems(ENCHANT_WEAPON_D, 1); - } - else if (round == 3) - { - st.rewardItems(ADENA, 199000); - st.rewardItems(ENCHANT_WEAPON_C, 1); - } - else if (round == 4) - { - st.rewardItems(ADENA, 388000); - st.rewardItems(RECIPES[Rnd.get(RECIPES.length)], 1); - } - else if (round == 5) - { - st.rewardItems(ADENA, 675000); - st.rewardItems(BLADES[Rnd.get(BLADES.length)], 1); - } - else if (round == 6) - { - st.rewardItems(ADENA, 1284000); - st.rewardItems(ENCHANT_WEAPON_B, 1); - st.rewardItems(ENCHANT_ARMOR_B, 1); - st.rewardItems(ENCHANT_WEAPON_B, 1); - st.rewardItems(ENCHANT_ARMOR_B, 1); - } - - st.set("state", "1"); - st.set("stateEx", "0"); - } - else if (event.equals("30846-22.htm") && ((state % 10) == 1)) - { - if (st.hasQuestItems(SPIRIT_BEAD)) - { - st.set("state", "1005"); - st.takeItems(SPIRIT_BEAD, 1); - } - else - { - htmltext = "30846-22a.htm"; - } - } - else if (event.equals("30846-25.htm") && (state == 1005)) - { - int i0 = st.getInt("stateEx"); - - int i1 = i0 % 10; - int i2 = (i0 - i1) / 10; - - int param1 = Rnd.get(2) + 1; - int param2 = Rnd.get(5) + 1; - int param3 = (param1 * 10) + param2; - - if (param1 == i2) - { - int i3 = param2 + i1; - - if (((i3 % 5) == 0) && (i3 != 10)) - { - st.set("state", "1"); - st.set("stateEx", "0"); - st.rewardItems(ADENA, 800); - htmltext = getHTML("30846-25.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1)); - } - else - { - st.set("state", "1006"); - st.set("stateEx", String.valueOf(param3)); - htmltext = getHTML("30846-24.htm", i0, param3, player.getName()); - } - } - else - { - if ((param2 == 5) || (i2 == 5)) - { - st.set("state", "1"); - st.set("stateEx", "0"); - st.rewardItems(ADENA, 800); - htmltext = getHTML("30846-25.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1)); - } - else - { - st.set("state", "1006"); - st.set("stateEx", String.valueOf(param3)); - htmltext = getHTML("30846-24.htm", i0, param3, player.getName()); - } - } - } - else if (event.equals("30846-29.htm") && (state == 1006)) - { - int i0 = st.getInt("stateEx"); - - int i1 = i0 % 10; - int i2 = (i0 - i1) / 10; - - int param1 = Rnd.get(2) + 1; - int param2 = Rnd.get(5) + 1; - int param3 = (param1 * 10) + param2; - - if (param1 == i2) - { - int i3 = param2 + i1; - - if (((i3 % 5) == 0) && (i3 != 10)) - { - st.set("state", "1"); - st.set("stateEx", "0"); - st.rewardItems(ADENA, 800); - htmltext = getHTML("30846-29.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1)); - } - else - { - st.set("state", "1005"); - st.set("stateEx", String.valueOf(param3)); - htmltext = getHTML("30846-28.htm", i0, param3, player.getName()); - } - } - else - { - if ((param2 == 5) || (i1 == 5)) - { - st.set("state", "1"); - st.set("stateEx", "0"); - htmltext = getHTML("30846-29.htm", i0, param3, player.getName()); - } - else - { - st.set("state", "1005"); - st.set("stateEx", String.valueOf(param3)); - htmltext = getHTML("30846-28.htm", i0, param3, player.getName()); - } - } - } - else if (event.equals("30846-30.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() < 50) ? "30846-02.htm" : "30846-01.htm"; - break; - - case State.STARTED: - int state = st.getInt("state"); - - if (state < 4) - { - if (st.hasQuestItems(SPIRIT_BEAD)) - { - htmltext = "30846-05.htm"; - } - else - { - htmltext = "30846-04.htm"; - } - } - else if ((state % 10) == 4) - { - htmltext = "30846-05a.htm"; - } - else if ((state % 10) == 5) - { - htmltext = "30846-11.htm"; - } - else if ((state % 10) == 6) - { - htmltext = "30846-15.htm"; - } - else if ((state % 10) == 7) - { - int round = (state % 100) / 10; - - if (round >= 7) - { - st.rewardItems(ADENA, 2384000); - st.rewardItems(ENCHANT_WEAPON_A, 1); - st.rewardItems(ENCHANT_ARMOR_A, 1); - st.rewardItems(ENCHANT_ARMOR_A, 1); - htmltext = "30846-17.htm"; - } - else - { - htmltext = getHtmlText("30846-16.htm").replace("%wincount%", String.valueOf((state / 10) + 1)); - } - } - else if (state == 1005) - { - htmltext = "30846-23.htm"; - } - else if (state == 1006) - { - htmltext = "30846-26.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(SPIRIT_BEAD, 1, 0, CHANCES.get(npc.getNpcId())); - - return null; - } - - private String getHTML(String html, int index, int param3, String name) - { - return getHtmlText(html).replace("%card1pic%", CARDS.get(index)).replace("%card2pic%", CARDS.get(param3)).replace("%name%", name); - } + static + { + CHANCES.put(20674, 807000); // Doom Knight + CHANCES.put(20678, 372000); // Tortured Undead + CHANCES.put(20954, 460000); // Hungered Corpse + CHANCES.put(20955, 537000); // Ghost War + CHANCES.put(20956, 540000); // Past Knight + CHANCES.put(20957, 565000); // Nihil Invader + CHANCES.put(20958, 425000); // Death Agent + CHANCES.put(20959, 682000); // Dark Guard + CHANCES.put(20960, 372000); // Bloody Ghost + CHANCES.put(20961, 547000); // Bloody Knight + CHANCES.put(20962, 522000); // Bloody Priest + CHANCES.put(20963, 498000); // Bloody Lord + CHANCES.put(20974, 1000000); // Spiteful Soul Leader + CHANCES.put(20975, 975000); // Spiteful Soul Wizard + CHANCES.put(20976, 825000); // Spiteful Soul Fighter + CHANCES.put(20996, 385000); // Spiteful Ghost of Ruins + CHANCES.put(20997, 342000); // Soldier of Grief + CHANCES.put(20998, 377000); // Cruel Punisher + CHANCES.put(20999, 450000); // Roving Soul + CHANCES.put(21000, 395000); // Soul of Ruins + CHANCES.put(21001, 535000); // Wretched Archer + CHANCES.put(21002, 472000); // Doom Scout + CHANCES.put(21006, 502000); // Doom Servant + CHANCES.put(21007, 540000); // Doom Guard + CHANCES.put(21008, 692000); // Doom Archer + CHANCES.put(21009, 740000); // Doom Trooper + CHANCES.put(21010, 595000); // Doom Warrior + } + + public Q663_SeductiveWhispers() + { + super(663, qn, "Seductive Whispers"); + + registerQuestItems(SPIRIT_BEAD); + + addStartNpc(WILBERT); + addTalkId(WILBERT); + + 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; + } + + int state = st.getInt("state"); + + if (event.equals("30846-03.htm")) + { + st.setState(State.STARTED); + st.set("cond", "1"); + st.set("state", "1"); + st.playSound(QuestState.SOUND_ACCEPT); + } + else if (event.equals("30846-09.htm") && ((state % 10) <= 4)) + { + if ((state / 10) < 1) + { + if (st.getQuestItemsCount(SPIRIT_BEAD) >= 50) + { + st.takeItems(SPIRIT_BEAD, 50); + st.set("state", "5"); + } + else + { + htmltext = "30846-10.htm"; + } + } + else + { + st.set("state", String.valueOf(((state / 10) * 10) + 5)); + st.set("stateEx", "0"); + htmltext = "30846-09a.htm"; + } + } + else if (event.equals("30846-14.htm") && ((state % 10) == 5) && ((state / 1000) == 0)) + { + int i0 = st.getInt("stateEx"); + + int i1 = i0 % 10; + int i2 = (i0 - i1) / 10; + + int param1 = Rnd.get(2) + 1; + int param2 = Rnd.get(5) + 1; + + int i5 = state / 10; + + int param3 = (param1 * 10) + param2; + + if (param1 == i2) + { + int i3 = param2 + i1; + + if (((i3 % 5) == 0) && (i3 != 10)) + { + if (((state % 100) / 10) >= 7) + { + st.set("state", "4"); + st.rewardItems(ADENA, 2384000); + st.rewardItems(ENCHANT_WEAPON_A, 1); + st.rewardItems(ENCHANT_ARMOR_A, 1); + st.rewardItems(ENCHANT_ARMOR_A, 1); + htmltext = getHTML("30846-14.htm", i0, param3, player.getName()); + } + else + { + st.set("state", String.valueOf(((state / 10) * 10) + 7)); + htmltext = getHTML("30846-13.htm", i0, param3, player.getName()).replace("%wincount%", String.valueOf(i5 + 1)); + } + } + else + { + st.set("state", String.valueOf(((state / 10) * 10) + 6)); + st.set("stateEx", String.valueOf(param3)); + htmltext = getHTML("30846-12.htm", i0, param3, player.getName()); + } + } + else + { + if ((param2 == 5) || (i1 == 5)) + { + if (((state % 100) / 10) >= 7) + { + st.set("state", "4"); + st.rewardItems(ADENA, 2384000); + st.rewardItems(ENCHANT_WEAPON_A, 1); + st.rewardItems(ENCHANT_ARMOR_A, 1); + st.rewardItems(ENCHANT_ARMOR_A, 1); + htmltext = getHTML("30846-14.htm", i0, param3, player.getName()); + } + else + { + st.set("state", String.valueOf(((state / 10) * 10) + 7)); + htmltext = getHTML("30846-13.htm", i0, param3, player.getName()).replace("%wincount%", String.valueOf(i5 + 1)); + } + } + else + { + st.set("state", String.valueOf(((state / 10) * 10) + 6)); + st.set("stateEx", String.valueOf((param1 * 10) + param2)); + htmltext = getHTML("30846-12.htm", i0, param3, player.getName()); + } + } + } + else if (event.equals("30846-19.htm") && ((state % 10) == 6) && ((state / 1000) == 0)) + { + int i0 = st.getInt("stateEx"); + + int i1 = i0 % 10; + int i2 = (i0 - i1) / 10; + + int param1 = Rnd.get(2) + 1; + int param2 = Rnd.get(5) + 1; + int param3 = (param1 * 10) + param2; + + if (param1 == i2) + { + int i3 = param1 + i1; + + if (((i3 % 5) == 0) && (i3 != 10)) + { + st.set("state", "1"); + st.set("stateEx", "0"); + htmltext = getHTML("30846-19.htm", i0, param3, player.getName()); + } + else + { + st.set("state", String.valueOf(((state / 10) * 10) + 5)); + st.set("stateEx", String.valueOf(param3)); + htmltext = getHTML("30846-18.htm", i0, param3, player.getName()); + } + } + else + { + if ((param2 == 5) || (i1 == 5)) + { + st.set("state", "1"); + htmltext = getHTML("30846-19.htm", i0, param3, player.getName()); + } + else + { + st.set("state", String.valueOf(((state / 10) * 10) + 5)); + st.set("stateEx", String.valueOf(param3)); + htmltext = getHTML("30846-18.htm", i0, param3, player.getName()); + } + } + } + else if (event.equals("30846-20.htm") && ((state % 10) == 7) && ((state / 1000) == 0)) + { + st.set("state", String.valueOf((((state / 10) + 1) * 10) + 4)); + st.set("stateEx", "0"); + } + else if (event.equals("30846-21.htm") && ((state % 10) == 7) && ((state / 1000) == 0)) + { + int round = state / 10; + + if (round == 0) + { + st.rewardItems(ADENA, 40000); + } + else if (round == 1) + { + st.rewardItems(ADENA, 80000); + } + else if (round == 2) + { + st.rewardItems(ADENA, 110000); + st.rewardItems(ENCHANT_WEAPON_D, 1); + } + else if (round == 3) + { + st.rewardItems(ADENA, 199000); + st.rewardItems(ENCHANT_WEAPON_C, 1); + } + else if (round == 4) + { + st.rewardItems(ADENA, 388000); + st.rewardItems(RECIPES[Rnd.get(RECIPES.length)], 1); + } + else if (round == 5) + { + st.rewardItems(ADENA, 675000); + st.rewardItems(BLADES[Rnd.get(BLADES.length)], 1); + } + else if (round == 6) + { + st.rewardItems(ADENA, 1284000); + st.rewardItems(ENCHANT_WEAPON_B, 1); + st.rewardItems(ENCHANT_ARMOR_B, 1); + st.rewardItems(ENCHANT_WEAPON_B, 1); + st.rewardItems(ENCHANT_ARMOR_B, 1); + } + + st.set("state", "1"); + st.set("stateEx", "0"); + } + else if (event.equals("30846-22.htm") && ((state % 10) == 1)) + { + if (st.hasQuestItems(SPIRIT_BEAD)) + { + st.set("state", "1005"); + st.takeItems(SPIRIT_BEAD, 1); + } + else + { + htmltext = "30846-22a.htm"; + } + } + else if (event.equals("30846-25.htm") && (state == 1005)) + { + int i0 = st.getInt("stateEx"); + + int i1 = i0 % 10; + int i2 = (i0 - i1) / 10; + + int param1 = Rnd.get(2) + 1; + int param2 = Rnd.get(5) + 1; + int param3 = (param1 * 10) + param2; + + if (param1 == i2) + { + int i3 = param2 + i1; + + if (((i3 % 5) == 0) && (i3 != 10)) + { + st.set("state", "1"); + st.set("stateEx", "0"); + st.rewardItems(ADENA, 800); + htmltext = getHTML("30846-25.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1)); + } + else + { + st.set("state", "1006"); + st.set("stateEx", String.valueOf(param3)); + htmltext = getHTML("30846-24.htm", i0, param3, player.getName()); + } + } + else + { + if ((param2 == 5) || (i2 == 5)) + { + st.set("state", "1"); + st.set("stateEx", "0"); + st.rewardItems(ADENA, 800); + htmltext = getHTML("30846-25.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1)); + } + else + { + st.set("state", "1006"); + st.set("stateEx", String.valueOf(param3)); + htmltext = getHTML("30846-24.htm", i0, param3, player.getName()); + } + } + } + else if (event.equals("30846-29.htm") && (state == 1006)) + { + int i0 = st.getInt("stateEx"); + + int i1 = i0 % 10; + int i2 = (i0 - i1) / 10; + + int param1 = Rnd.get(2) + 1; + int param2 = Rnd.get(5) + 1; + int param3 = (param1 * 10) + param2; + + if (param1 == i2) + { + int i3 = param2 + i1; + + if (((i3 % 5) == 0) && (i3 != 10)) + { + st.set("state", "1"); + st.set("stateEx", "0"); + st.rewardItems(ADENA, 800); + htmltext = getHTML("30846-29.htm", i0, param3, player.getName()).replace("%card1%", String.valueOf(i1)); + } + else + { + st.set("state", "1005"); + st.set("stateEx", String.valueOf(param3)); + htmltext = getHTML("30846-28.htm", i0, param3, player.getName()); + } + } + else + { + if ((param2 == 5) || (i1 == 5)) + { + st.set("state", "1"); + st.set("stateEx", "0"); + htmltext = getHTML("30846-29.htm", i0, param3, player.getName()); + } + else + { + st.set("state", "1005"); + st.set("stateEx", String.valueOf(param3)); + htmltext = getHTML("30846-28.htm", i0, param3, player.getName()); + } + } + } + else if (event.equals("30846-30.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() < 50) ? "30846-02.htm" : "30846-01.htm"; + break; + + case State.STARTED: + int state = st.getInt("state"); + + if (state < 4) + { + if (st.hasQuestItems(SPIRIT_BEAD)) + { + htmltext = "30846-05.htm"; + } + else + { + htmltext = "30846-04.htm"; + } + } + else if ((state % 10) == 4) + { + htmltext = "30846-05a.htm"; + } + else if ((state % 10) == 5) + { + htmltext = "30846-11.htm"; + } + else if ((state % 10) == 6) + { + htmltext = "30846-15.htm"; + } + else if ((state % 10) == 7) + { + int round = (state % 100) / 10; + + if (round >= 7) + { + st.rewardItems(ADENA, 2384000); + st.rewardItems(ENCHANT_WEAPON_A, 1); + st.rewardItems(ENCHANT_ARMOR_A, 1); + st.rewardItems(ENCHANT_ARMOR_A, 1); + htmltext = "30846-17.htm"; + } + else + { + htmltext = getHtmlText("30846-16.htm").replace("%wincount%", String.valueOf((state / 10) + 1)); + } + } + else if (state == 1005) + { + htmltext = "30846-23.htm"; + } + else if (state == 1006) + { + htmltext = "30846-26.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(SPIRIT_BEAD, 1, 0, CHANCES.get(npc.getNpcId())); + + return null; + } + + private String getHTML(String html, int index, int param3, String name) + { + return getHtmlText(html).replace("%card1pic%", CARDS.get(index)).replace("%card2pic%", CARDS.get(param3)).replace("%name%", name); + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/teleports/NewbieTravelToken/NewbieTravelToken.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/teleports/NewbieTravelToken/NewbieTravelToken.java index 0a7a809064..9fd6aa296c 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/teleports/NewbieTravelToken/NewbieTravelToken.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/teleports/NewbieTravelToken/NewbieTravelToken.java @@ -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 . - */ -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 . + */ +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 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(); + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/teleports/RaceTrack/RaceTrack.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/teleports/RaceTrack/RaceTrack.java index 25f777d14b..95409ec169 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/teleports/RaceTrack/RaceTrack.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/teleports/RaceTrack/RaceTrack.java @@ -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 . - */ -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 . + */ +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 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(); + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/village_master/FirstClassChange/FirstClassChange.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/village_master/FirstClassChange/FirstClassChange.java index 08232f86d2..c350699069 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/village_master/FirstClassChange/FirstClassChange.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/village_master/FirstClassChange/FirstClassChange.java @@ -1,583 +1,584 @@ -/* - * 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 . - */ -package village_master.FirstClassChange; - -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.network.serverpackets.HennaInfo; - -/** - * @author fernandopm - */ -public class FirstClassChange extends Quest -{ - // Quest Items Dark Elf - private static final int GAZE_OF_ABYSS = 1244; - private static final int IRON_HEART = 1252; - private static final int JEWEL_OF_DARKNESS = 1261; - private static final int ORB_OF_ABYSS = 1270; - - // Quest Items Orcs - private static final int MARK_OF_RAIDER = 1592; - private static final int KHAVATARI_TOTEM = 1615; - private static final int MASK_OF_MEDIUM = 1631; - - // Quest Items Dwarf - private static final int ARTI_MARKS = 1635; - private static final int SCAV_MARKS = 1642; - - // Quest Items Light Elf - private static final int ELVEN_KNIGHT_BROOCH = 1204; - private static final int REORIA_RECOMMENDATION = 1217; - private static final int ETERNITY_DIAMOND = 1230; - private static final int LEAF_OF_ORACLE = 1235; - - // Quest Items Human - private static final int MEDALLION_OF_WARRIOR = 1145; - private static final int SWORD_OF_RITUAL = 1161; - private static final int BEZIQUES_RECOMMENDATION = 1190; - private static final int BEAD_OF_SEASON = 1292; - private static final int MARK_OF_FAITH = 1201; - - // Reward Item - private static final int SHADOW_WEAPON_COUPON_DGRADE = 8869; - - // @formatter:off - - // Classes +/* + * 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 . + */ +package village_master.FirstClassChange; + +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.network.serverpackets.HennaInfo; + +/** + * @author fernandopm + */ +public class FirstClassChange extends Quest +{ + // Quest Items Dark Elf + private static final int GAZE_OF_ABYSS = 1244; + private static final int IRON_HEART = 1252; + private static final int JEWEL_OF_DARKNESS = 1261; + private static final int ORB_OF_ABYSS = 1270; + + // Quest Items Orcs + private static final int MARK_OF_RAIDER = 1592; + private static final int KHAVATARI_TOTEM = 1615; + private static final int MASK_OF_MEDIUM = 1631; + + // Quest Items Dwarf + private static final int ARTI_MARKS = 1635; + private static final int SCAV_MARKS = 1642; + + // Quest Items Light Elf + private static final int ELVEN_KNIGHT_BROOCH = 1204; + private static final int REORIA_RECOMMENDATION = 1217; + private static final int ETERNITY_DIAMOND = 1230; + private static final int LEAF_OF_ORACLE = 1235; + + // Quest Items Human + private static final int MEDALLION_OF_WARRIOR = 1145; + private static final int SWORD_OF_RITUAL = 1161; + private static final int BEZIQUES_RECOMMENDATION = 1190; + private static final int BEAD_OF_SEASON = 1292; + private static final int MARK_OF_FAITH = 1201; + + // Reward Item + private static final int SHADOW_WEAPON_COUPON_DGRADE = 8869; + + // @formatter:off + + // Classes private static final Map Classes = new HashMap<>(); - { - // Dark Elf - Classes.put("PK", new int[] {32, 31, 2, 15, 16, 17, 18, GAZE_OF_ABYSS, 33}); - Classes.put("AS", new int[] {35, 31, 2, 19, 20, 21, 22, IRON_HEART, 33}); - Classes.put("DW", new int[] {39, 38, 2, 23, 24, 25, 26, JEWEL_OF_DARKNESS, 33}); - Classes.put("SO", new int[] {42, 38, 2, 27, 28, 29, 30, ORB_OF_ABYSS, 33}); - - // Orc - Classes.put("OR", new int[] {45, 44, 3, 9, 10, 11, 12, MARK_OF_RAIDER, 23}); - Classes.put("OM", new int[] {47, 44, 3, 13, 14, 15, 16, KHAVATARI_TOTEM, 23}); - Classes.put("OS", new int[] {50, 49, 3, 17, 18, 19, 20, MASK_OF_MEDIUM, 23}); - - // Dwarf - Classes.put("SC", new int[] {54, 53, 4, 5, 6, 7, 8, SCAV_MARKS, 11}); - Classes.put("AR", new int[] {56, 53, 4, 5, 6, 7, 8, ARTI_MARKS, 11}); - - // Light Elf - Classes.put("EK", new int[] {19, 18, 1, 18, 19, 20, 21, ELVEN_KNIGHT_BROOCH, 40}); - Classes.put("ES", new int[] {22, 18, 1, 22, 23, 24, 25, REORIA_RECOMMENDATION, 40}); - Classes.put("EW", new int[] {26, 25, 1, 15, 16, 17, 18, ETERNITY_DIAMOND, 33}); - Classes.put("EO", new int[] {29, 25, 1, 19, 20, 21, 22, LEAF_OF_ORACLE, 33}); - - // Human - Classes.put("HW", new int[] {1, 0, 0, 26, 27, 28, 29, MEDALLION_OF_WARRIOR, 40}); - Classes.put("HK", new int[] {4, 0, 0, 30, 31, 32, 33, SWORD_OF_RITUAL, 40}); - Classes.put("HR", new int[] {7, 0, 0, 34, 35, 36, 37, BEZIQUES_RECOMMENDATION, 40}); - Classes.put("HWI", new int[] {11, 10, 0, 23, 24, 25, 26, BEAD_OF_SEASON, 33}); - Classes.put("HC", new int[] {15, 10, 0, 27, 28, 29, 30, MARK_OF_FAITH, 33}); - } - - // Also used by ShadowWeapon script. - public static final int[] FIRSTCLASSNPCS = - { - 30026, 30031, 30037, 30066, 30070, 30154, 30288, 30289, 30290, 30297, 30358, 30373, 30462, 30498, 30499, 30500, 30503, 30504, 30505, 30508, 30520, 30525, 30565, 30594, 30595, 32092, 32093, 32097, 32098 - }; - - // @formatter:on - - public FirstClassChange() - { - super(-1, "FirstClassChange", "village_master"); - - addStartNpc(FIRSTCLASSNPCS); - addTalkId(FIRSTCLASSNPCS); - } - - @Override - public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player) - { - String htmltext = event; - QuestState st = player.getQuestState("FirstClassChange"); - if (st == null) - { - return htmltext; - } - - String suffix = ""; - - if (Classes.containsKey(event)) - { - // 0 = newClass, 1 = reqClass, 2 = reqRace, 3 = no/no, 4 = no/ok, 5 = ok/no, 6 = ok/ok, 7 = reqItem, 8 = deniedClass - final int[] array = Classes.get(event); - - if ((player.getClassId().getId() == array[1]) && (player.getRace().ordinal() == array[2])) - { - final boolean gotItem = st.hasQuestItems(array[7]); - - if (player.getLevel() < 20) - { - suffix = "-" + ((gotItem) ? array[4] : array[3]); - } - else - { - if (gotItem) - { - suffix = "-" + array[6]; - - st.takeItems(array[7], 1); - st.giveItems(SHADOW_WEAPON_COUPON_DGRADE, 15); - st.playSound(QuestState.SOUND_FANFARE); - - player.setClassId(array[0]); - player.setBaseClass(array[0]); - player.sendPacket(new HennaInfo(player)); - player.broadcastUserInfo(); - } - else - { - suffix = "-" + array[5]; - } - } - - htmltext = npc.getNpcId() + suffix + ".htm"; - st.exitQuest(true); - } - else - { - htmltext = npc.getNpcId() + "-" + array[8] + ".htm"; - } - } - - return htmltext; - } - - @Override - public String onTalk(NpcInstance npc, PlayerInstance player) - { - String htmltext = Quest.getNoQuestMsg(); - QuestState st = player.getQuestState("FirstClassChange"); - if (st == null) - { - return htmltext; - } - - if (player.isSubClassActive()) - { - st.exitQuest(true); - return htmltext; - } - - final int npcId = npc.getNpcId(); - switch (npcId) - { - case 30290: // Dark Elf - case 30297: - case 30462: - if (player.getRace() == Race.darkelf) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 31) - { - htmltext = npcId + "-01.htm"; - } - else if (player.getClassId().getId() == 38) - { - htmltext = npcId + "-08.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-32.htm"; - } - else - { - htmltext = npcId + "-31.htm"; - } - } - else - { - htmltext = npcId + "-33.htm"; - } - break; - - case 30358: // Thifiell (dark elf) - if (player.getRace() == Race.darkelf) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 31) - { - htmltext = npcId + "-01.htm"; - } - else if (player.getClassId().getId() == 38) - { - htmltext = npcId + "-02.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-12.htm"; - } - else - { - htmltext = npcId + "-13.htm"; - } - } - else - { - htmltext = npcId + "-11.htm"; - } - break; - - case 30500: // Orcs - case 30505: - case 30508: - case 32097: - if (player.getRace() == Race.orc) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 44) - { - htmltext = npcId + "-01.htm"; - } - else if (player.getClassId().getId() == 49) - { - htmltext = npcId + "-06.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-21.htm"; - } - else - { - htmltext = npcId + "-22.htm"; - } - } - else - { - htmltext = npcId + "-23.htm"; - } - break; - - case 30565: // Kakai (Orcs) - if (player.getRace() == Race.orc) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 44) - { - htmltext = npcId + "-01.htm"; - } - else if (player.getClassId().getId() == 49) - { - htmltext = npcId + "-06.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-09.htm"; - } - else - { - htmltext = npcId + "-10.htm"; - } - } - else - { - htmltext = npcId + "-11.htm"; - } - break; - - case 30503: // Dwarf - case 30594: - case 30498: - case 32092: - case 32093: - case 30504: - case 30595: - case 30499: - if (player.getRace() == Race.dwarf) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 53) - { - htmltext = npcId + "-01.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-09.htm"; - } - else - { - htmltext = npcId + "-10.htm"; - } - } - else - { - htmltext = npcId + "-11.htm"; - } - break; - - case 30525: // Bronk and Reed(dwarf) - case 30520: - if (player.getRace() == Race.dwarf) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 53) - { - htmltext = npcId + "-01.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-05.htm"; - } - else - { - htmltext = npcId + "-06.htm"; - } - } - else - { - htmltext = npcId + "-07.htm"; - } - break; - - case 30070: // Elfs and humans mages - case 30037: - case 30289: - case 32098: - if (player.getRace() == Race.elf) - { - if (player.isMageClass()) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 25) - { - htmltext = npcId + "-01.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-31.htm"; - } - else - { - htmltext = npcId + "-32.htm"; - } - } - else - { - htmltext = npcId + "-33.htm"; - } - } - else if (player.getRace() == Race.human) - { - if (player.isMageClass()) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 10) - { - htmltext = npcId + "-08.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-31.htm"; - } - else - { - htmltext = npcId + "-32.htm"; - } - } - else - { - htmltext = npcId + "-33.htm"; - } - } - else - { - htmltext = npcId + "-33.htm"; - } - break; - - case 30154: // Asterios (Elf fighters and mages) - if (player.getRace() == Race.elf) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 18) - { - htmltext = npcId + "-01.htm"; - } - else if (player.getClassId().getId() == 25) - { - htmltext = npcId + "-02.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-12.htm"; - } - else - { - htmltext = npcId + "-13.htm"; - } - } - else - { - htmltext = npcId + "-11.htm"; - } - break; - - case 30031: // Biotin (Human mages) - if (player.getRace() == Race.human) - { - if (player.isMageClass()) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 10) - { - htmltext = npcId + "-01.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-06.htm"; - } - else - { - htmltext = npcId + "-07.htm"; - } - } - else - { - htmltext = npcId + "-08.htm"; - } - } - else - { - htmltext = npcId + "-08.htm"; - } - break; - - case 30373: // Human and Elfs fighters - case 30288: - case 30066: - if (player.getRace() == Race.human) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 0) - { - htmltext = npcId + "-08.htm"; - } - else - { - htmltext = npcId + "-40.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-38.htm"; - } - else - { - htmltext = npcId + "-39.htm"; - } - } - else if (player.getRace() == Race.elf) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 18) - { - htmltext = npcId + "-01.htm"; - } - else - { - htmltext = npcId + "-40.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-38.htm"; - } - else - { - htmltext = npcId + "-39.htm"; - } - } - else - { - htmltext = npcId + "-40.htm"; - } - break; - - case 30026: // Bitz (Human fighters) - if (player.getRace() == Race.human) - { - if (player.getClassId().level() == 0) - { - if (player.getClassId().getId() == 0) - { - htmltext = npcId + "-01.htm"; - } - else - { - htmltext = npcId + "-10.htm"; - } - } - else if (player.getClassId().level() == 1) - { - htmltext = npcId + "-08.htm"; - } - else - { - htmltext = npcId + "-09.htm"; - } - } - else - { - htmltext = npcId + "-10.htm"; - } - break; - } - st.exitQuest(true); - - return htmltext; - } - - public static void main(String[] args) - { - new FirstClassChange(); - } + static + { + // Dark Elf + Classes.put("PK", new int[] {32, 31, 2, 15, 16, 17, 18, GAZE_OF_ABYSS, 33}); + Classes.put("AS", new int[] {35, 31, 2, 19, 20, 21, 22, IRON_HEART, 33}); + Classes.put("DW", new int[] {39, 38, 2, 23, 24, 25, 26, JEWEL_OF_DARKNESS, 33}); + Classes.put("SO", new int[] {42, 38, 2, 27, 28, 29, 30, ORB_OF_ABYSS, 33}); + + // Orc + Classes.put("OR", new int[] {45, 44, 3, 9, 10, 11, 12, MARK_OF_RAIDER, 23}); + Classes.put("OM", new int[] {47, 44, 3, 13, 14, 15, 16, KHAVATARI_TOTEM, 23}); + Classes.put("OS", new int[] {50, 49, 3, 17, 18, 19, 20, MASK_OF_MEDIUM, 23}); + + // Dwarf + Classes.put("SC", new int[] {54, 53, 4, 5, 6, 7, 8, SCAV_MARKS, 11}); + Classes.put("AR", new int[] {56, 53, 4, 5, 6, 7, 8, ARTI_MARKS, 11}); + + // Light Elf + Classes.put("EK", new int[] {19, 18, 1, 18, 19, 20, 21, ELVEN_KNIGHT_BROOCH, 40}); + Classes.put("ES", new int[] {22, 18, 1, 22, 23, 24, 25, REORIA_RECOMMENDATION, 40}); + Classes.put("EW", new int[] {26, 25, 1, 15, 16, 17, 18, ETERNITY_DIAMOND, 33}); + Classes.put("EO", new int[] {29, 25, 1, 19, 20, 21, 22, LEAF_OF_ORACLE, 33}); + + // Human + Classes.put("HW", new int[] {1, 0, 0, 26, 27, 28, 29, MEDALLION_OF_WARRIOR, 40}); + Classes.put("HK", new int[] {4, 0, 0, 30, 31, 32, 33, SWORD_OF_RITUAL, 40}); + Classes.put("HR", new int[] {7, 0, 0, 34, 35, 36, 37, BEZIQUES_RECOMMENDATION, 40}); + Classes.put("HWI", new int[] {11, 10, 0, 23, 24, 25, 26, BEAD_OF_SEASON, 33}); + Classes.put("HC", new int[] {15, 10, 0, 27, 28, 29, 30, MARK_OF_FAITH, 33}); + } + + // Also used by ShadowWeapon script. + public static final int[] FIRSTCLASSNPCS = + { + 30026, 30031, 30037, 30066, 30070, 30154, 30288, 30289, 30290, 30297, 30358, 30373, 30462, 30498, 30499, 30500, 30503, 30504, 30505, 30508, 30520, 30525, 30565, 30594, 30595, 32092, 32093, 32097, 32098 + }; + + // @formatter:on + + public FirstClassChange() + { + super(-1, "FirstClassChange", "village_master"); + + addStartNpc(FIRSTCLASSNPCS); + addTalkId(FIRSTCLASSNPCS); + } + + @Override + public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player) + { + String htmltext = event; + QuestState st = player.getQuestState("FirstClassChange"); + if (st == null) + { + return htmltext; + } + + String suffix = ""; + + if (Classes.containsKey(event)) + { + // 0 = newClass, 1 = reqClass, 2 = reqRace, 3 = no/no, 4 = no/ok, 5 = ok/no, 6 = ok/ok, 7 = reqItem, 8 = deniedClass + final int[] array = Classes.get(event); + + if ((player.getClassId().getId() == array[1]) && (player.getRace().ordinal() == array[2])) + { + final boolean gotItem = st.hasQuestItems(array[7]); + + if (player.getLevel() < 20) + { + suffix = "-" + ((gotItem) ? array[4] : array[3]); + } + else + { + if (gotItem) + { + suffix = "-" + array[6]; + + st.takeItems(array[7], 1); + st.giveItems(SHADOW_WEAPON_COUPON_DGRADE, 15); + st.playSound(QuestState.SOUND_FANFARE); + + player.setClassId(array[0]); + player.setBaseClass(array[0]); + player.sendPacket(new HennaInfo(player)); + player.broadcastUserInfo(); + } + else + { + suffix = "-" + array[5]; + } + } + + htmltext = npc.getNpcId() + suffix + ".htm"; + st.exitQuest(true); + } + else + { + htmltext = npc.getNpcId() + "-" + array[8] + ".htm"; + } + } + + return htmltext; + } + + @Override + public String onTalk(NpcInstance npc, PlayerInstance player) + { + String htmltext = Quest.getNoQuestMsg(); + QuestState st = player.getQuestState("FirstClassChange"); + if (st == null) + { + return htmltext; + } + + if (player.isSubClassActive()) + { + st.exitQuest(true); + return htmltext; + } + + final int npcId = npc.getNpcId(); + switch (npcId) + { + case 30290: // Dark Elf + case 30297: + case 30462: + if (player.getRace() == Race.darkelf) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 31) + { + htmltext = npcId + "-01.htm"; + } + else if (player.getClassId().getId() == 38) + { + htmltext = npcId + "-08.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-32.htm"; + } + else + { + htmltext = npcId + "-31.htm"; + } + } + else + { + htmltext = npcId + "-33.htm"; + } + break; + + case 30358: // Thifiell (dark elf) + if (player.getRace() == Race.darkelf) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 31) + { + htmltext = npcId + "-01.htm"; + } + else if (player.getClassId().getId() == 38) + { + htmltext = npcId + "-02.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-12.htm"; + } + else + { + htmltext = npcId + "-13.htm"; + } + } + else + { + htmltext = npcId + "-11.htm"; + } + break; + + case 30500: // Orcs + case 30505: + case 30508: + case 32097: + if (player.getRace() == Race.orc) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 44) + { + htmltext = npcId + "-01.htm"; + } + else if (player.getClassId().getId() == 49) + { + htmltext = npcId + "-06.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-21.htm"; + } + else + { + htmltext = npcId + "-22.htm"; + } + } + else + { + htmltext = npcId + "-23.htm"; + } + break; + + case 30565: // Kakai (Orcs) + if (player.getRace() == Race.orc) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 44) + { + htmltext = npcId + "-01.htm"; + } + else if (player.getClassId().getId() == 49) + { + htmltext = npcId + "-06.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-09.htm"; + } + else + { + htmltext = npcId + "-10.htm"; + } + } + else + { + htmltext = npcId + "-11.htm"; + } + break; + + case 30503: // Dwarf + case 30594: + case 30498: + case 32092: + case 32093: + case 30504: + case 30595: + case 30499: + if (player.getRace() == Race.dwarf) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 53) + { + htmltext = npcId + "-01.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-09.htm"; + } + else + { + htmltext = npcId + "-10.htm"; + } + } + else + { + htmltext = npcId + "-11.htm"; + } + break; + + case 30525: // Bronk and Reed(dwarf) + case 30520: + if (player.getRace() == Race.dwarf) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 53) + { + htmltext = npcId + "-01.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-05.htm"; + } + else + { + htmltext = npcId + "-06.htm"; + } + } + else + { + htmltext = npcId + "-07.htm"; + } + break; + + case 30070: // Elfs and humans mages + case 30037: + case 30289: + case 32098: + if (player.getRace() == Race.elf) + { + if (player.isMageClass()) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 25) + { + htmltext = npcId + "-01.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-31.htm"; + } + else + { + htmltext = npcId + "-32.htm"; + } + } + else + { + htmltext = npcId + "-33.htm"; + } + } + else if (player.getRace() == Race.human) + { + if (player.isMageClass()) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 10) + { + htmltext = npcId + "-08.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-31.htm"; + } + else + { + htmltext = npcId + "-32.htm"; + } + } + else + { + htmltext = npcId + "-33.htm"; + } + } + else + { + htmltext = npcId + "-33.htm"; + } + break; + + case 30154: // Asterios (Elf fighters and mages) + if (player.getRace() == Race.elf) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 18) + { + htmltext = npcId + "-01.htm"; + } + else if (player.getClassId().getId() == 25) + { + htmltext = npcId + "-02.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-12.htm"; + } + else + { + htmltext = npcId + "-13.htm"; + } + } + else + { + htmltext = npcId + "-11.htm"; + } + break; + + case 30031: // Biotin (Human mages) + if (player.getRace() == Race.human) + { + if (player.isMageClass()) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 10) + { + htmltext = npcId + "-01.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-06.htm"; + } + else + { + htmltext = npcId + "-07.htm"; + } + } + else + { + htmltext = npcId + "-08.htm"; + } + } + else + { + htmltext = npcId + "-08.htm"; + } + break; + + case 30373: // Human and Elfs fighters + case 30288: + case 30066: + if (player.getRace() == Race.human) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 0) + { + htmltext = npcId + "-08.htm"; + } + else + { + htmltext = npcId + "-40.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-38.htm"; + } + else + { + htmltext = npcId + "-39.htm"; + } + } + else if (player.getRace() == Race.elf) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 18) + { + htmltext = npcId + "-01.htm"; + } + else + { + htmltext = npcId + "-40.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-38.htm"; + } + else + { + htmltext = npcId + "-39.htm"; + } + } + else + { + htmltext = npcId + "-40.htm"; + } + break; + + case 30026: // Bitz (Human fighters) + if (player.getRace() == Race.human) + { + if (player.getClassId().level() == 0) + { + if (player.getClassId().getId() == 0) + { + htmltext = npcId + "-01.htm"; + } + else + { + htmltext = npcId + "-10.htm"; + } + } + else if (player.getClassId().level() == 1) + { + htmltext = npcId + "-08.htm"; + } + else + { + htmltext = npcId + "-09.htm"; + } + } + else + { + htmltext = npcId + "-10.htm"; + } + break; + } + st.exitQuest(true); + + return htmltext; + } + + public static void main(String[] args) + { + new FirstClassChange(); + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/village_master/SecondClassChange/SecondClassChange.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/village_master/SecondClassChange/SecondClassChange.java index b08cfb71a5..a814c0af3f 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/village_master/SecondClassChange/SecondClassChange.java +++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/village_master/SecondClassChange/SecondClassChange.java @@ -1,511 +1,512 @@ -/* - * 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 . - */ -package village_master.SecondClassChange; - -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.ClassId; -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.network.serverpackets.HennaInfo; - -/** - * @author fernandopm - */ -public class SecondClassChange extends Quest -{ - private static final String qn = "SecondClassChange"; - - // 2nd class change items - private static final int MARK_OF_CHALLENGER = 2627; - private static final int MARK_OF_DUTY = 2633; - private static final int MARK_OF_SEEKER = 2673; - private static final int MARK_OF_SCHOLAR = 2674; - private static final int MARK_OF_PILGRIM = 2721; - private static final int MARK_OF_DUELIST = 2762; - private static final int MARK_OF_SEARCHER = 2809; - private static final int MARK_OF_REFORMER = 2821; - private static final int MARK_OF_MAGUS = 2840; - private static final int MARK_OF_FATE = 3172; - private static final int MARK_OF_SAGITTARIUS = 3293; - private static final int MARK_OF_WITCHCRAFT = 3307; - private static final int MARK_OF_SUMMONER = 3336; - private static final int MARK_OF_WARSPIRIT = 2879; - private static final int MARK_OF_GLORY = 3203; - private static final int MARK_OF_CHAMPION = 3276; - private static final int MARK_OF_LORD = 3390; - private static final int MARK_OF_GUILDSMAN = 3119; - private static final int MARK_OF_PROSPERITY = 3238; - private static final int MARK_OF_MAESTRO = 2867; - private static final int MARK_OF_TRUST = 2734; - private static final int MARK_OF_HEALER = 2820; - private static final int MARK_OF_LIFE = 3140; - - // @formatter:off +/* + * 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 . + */ +package village_master.SecondClassChange; + +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.ClassId; +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.network.serverpackets.HennaInfo; + +/** + * @author fernandopm + */ +public class SecondClassChange extends Quest +{ + private static final String qn = "SecondClassChange"; + + // 2nd class change items + private static final int MARK_OF_CHALLENGER = 2627; + private static final int MARK_OF_DUTY = 2633; + private static final int MARK_OF_SEEKER = 2673; + private static final int MARK_OF_SCHOLAR = 2674; + private static final int MARK_OF_PILGRIM = 2721; + private static final int MARK_OF_DUELIST = 2762; + private static final int MARK_OF_SEARCHER = 2809; + private static final int MARK_OF_REFORMER = 2821; + private static final int MARK_OF_MAGUS = 2840; + private static final int MARK_OF_FATE = 3172; + private static final int MARK_OF_SAGITTARIUS = 3293; + private static final int MARK_OF_WITCHCRAFT = 3307; + private static final int MARK_OF_SUMMONER = 3336; + private static final int MARK_OF_WARSPIRIT = 2879; + private static final int MARK_OF_GLORY = 3203; + private static final int MARK_OF_CHAMPION = 3276; + private static final int MARK_OF_LORD = 3390; + private static final int MARK_OF_GUILDSMAN = 3119; + private static final int MARK_OF_PROSPERITY = 3238; + private static final int MARK_OF_MAESTRO = 2867; + private static final int MARK_OF_TRUST = 2734; + private static final int MARK_OF_HEALER = 2820; + private static final int MARK_OF_LIFE = 3140; + + // @formatter:off private static final Map Classes = new HashMap<>(); - { - // Dark Elfs - Classes.put("SK", new int[] {33, 32, 2, 26, 27, 28, 29, MARK_OF_DUTY, MARK_OF_FATE, MARK_OF_WITCHCRAFT, 56}); - Classes.put("BD", new int[] {34, 32, 2, 30, 31, 32, 33, MARK_OF_CHALLENGER, MARK_OF_FATE, MARK_OF_DUELIST, 56}); - Classes.put("SE", new int[] {43, 42, 2, 34, 35, 36, 37, MARK_OF_PILGRIM, MARK_OF_FATE, MARK_OF_REFORMER, 56}); - Classes.put("AW", new int[] {36, 35, 2, 38, 39, 40, 41, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SEARCHER, 56}); - Classes.put("PR", new int[] {37, 35, 2, 42, 43, 44, 45, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SAGITTARIUS, 56}); - Classes.put("SH", new int[] {40, 39, 2, 46, 47, 48, 49, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_MAGUS, 56}); - Classes.put("PS", new int[] {41, 39, 2, 50, 51, 52, 53, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_SUMMONER, 56}); - // Orcs - Classes.put("TY", new int[] {48, 47, 3, 16, 17, 18, 19, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST, 34}); - Classes.put("DE", new int[] {46, 45, 3, 20, 21, 22, 23, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION, 34}); - Classes.put("OL", new int[] {51, 50, 3, 24, 25, 26, 27, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD, 34}); - Classes.put("WC", new int[] {52, 50, 3, 28, 29, 30, 31, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT, 34}); - // Dwarf - Classes.put("BH", new int[] {55, 54, 4, 109, 10, 11, 12, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER, 15}); // I can't use 09 so I put 109 :P - Classes.put("WS", new int[] {57, 56, 4, 16, 17, 18, 19, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_MAESTRO, 22}); - // Human & Elf Fighters - Classes.put("TK", new int[] {20, 19, 1, 36, 37, 38, 39, MARK_OF_DUTY, MARK_OF_LIFE, MARK_OF_HEALER, 78}); - Classes.put("SS", new int[] {21, 19, 1, 40, 41, 42, 43, MARK_OF_CHALLENGER, MARK_OF_LIFE, MARK_OF_DUELIST, 78}); - Classes.put("PL", new int[] {5, 4, 0, 44, 45, 46, 47, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_HEALER, 78}); - Classes.put("DA", new int[] {6, 4, 0, 48, 49, 50, 51, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_WITCHCRAFT, 78}); - Classes.put("TH", new int[] {8, 7, 0, 52, 53, 54, 55, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SEARCHER, 78}); - Classes.put("HE", new int[] {9, 7, 0, 56, 57, 58, 59, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SAGITTARIUS, 78}); - Classes.put("PW", new int[] {23, 22, 1, 60, 61, 62, 63, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SEARCHER, 78}); - Classes.put("SR", new int[] {24, 22, 1, 64, 65, 66, 67, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SAGITTARIUS, 78}); - Classes.put("GL", new int[] {2, 1, 0, 68, 69, 70, 71, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_DUELIST, 78}); - Classes.put("WL", new int[] {3, 1, 0, 72, 73, 74, 75, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_CHAMPION, 78}); - // Human & Elf Mages (nukers) - Classes.put("EW", new int[] {27, 26, 1, 18, 19, 20, 21, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS, 40}); - Classes.put("ES", new int[] {28, 26, 1, 22, 23, 24, 25, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER, 40}); - Classes.put("HS", new int[] {12, 11, 0, 26, 27, 28, 29, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS, 40}); - Classes.put("HN", new int[] {13, 11, 0, 30, 31, 32, 33, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT, 40}); - Classes.put("HW", new int[] {14, 11, 0, 34, 35, 36, 37, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER, 40}); - // Human & Elf Mages (buffers) - Classes.put("BI", new int[] {16, 15, 0, 16, 17, 18, 19, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER, 26}); - Classes.put("PH", new int[] {17, 15, 0, 20, 21, 22, 23, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER, 26}); - Classes.put("EE", new int[] {30, 29, 1, 12, 13, 14, 15, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER, 26}); - } - - public static final int[] SECONDCLASSNPCS = - { - // Dark Elfs - 31328, 30195, 30699, 30474, 31324, 30862, 30910, 31285, 31331, 31334, 31974, 32096, - // Orcs - 30513, 30681, 30704, 30865, 30913, 31288, 31326, 31977, - // Dwarf - 30511, 30676, 30685, 30845, 30894, 31269, 31314, 31958, 30512, 30677, 30687, 30847, 30897, 31272, 31317, 31961, - // Human & Elf Fighters - 30109, 30187, 30689, 30849, 30900, 31965, 32094, - // Human & Elf Mages (nukers) - 30115, 30174, 30176, 30694, 30854, 31996, - // Human & Elf Mages (buffers) - 30120, 30191, 30857, 30905, 31276, 31321, 31279, 31755, 31968, 32095, 31336 - }; - // @formatter:on - - public SecondClassChange() - { - super(-1, qn, "village_master"); - - addStartNpc(SECONDCLASSNPCS); - addTalkId(SECONDCLASSNPCS); - } - - @Override - public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player) - { - String htmltext = event; - QuestState st = player.getQuestState(qn); - if (st == null) - { - return htmltext; - } - - String suffix = ""; - if (Classes.containsKey(event)) - { - // 0 = newClass, 1 = reqClass, 2 = reqRace, 3 = no/no, 4 = no/ok, 5 = ok/no, 6 = ok/ok, 7,8,9 = Required Items 10 = denied class - final int[] array = Classes.get(event); - if ((player.getClassId().getId() == array[1]) && (player.getRace().ordinal() == array[2])) - { - if (player.getLevel() < 40) - { - suffix = "-" + ((st.hasQuestItems(array[7], array[8], array[9])) ? array[4] : array[3]); - } - else - { - if (st.hasQuestItems(array[7], array[8], array[9])) - { - st.playSound(QuestState.SOUND_FANFARE); - st.takeItems(array[7], -1); - st.takeItems(array[8], -1); - st.takeItems(array[9], -1); - player.setClassId(array[0]); - player.setBaseClass(array[0]); - player.sendPacket(new HennaInfo(player)); - player.broadcastUserInfo(); - suffix = "-" + array[6]; - } - else - { - suffix = "-" + array[5]; - } - } - - htmltext = getClassHtml(player) + suffix + ".htm"; - st.exitQuest(true); - } - else - { - htmltext = getClassHtml(player) + "-" + array[10] + ".htm"; - } - } - - return htmltext; - } - - @Override - public String onTalk(NpcInstance npc, PlayerInstance player) - { - String htmltext = Quest.getNoQuestMsg(); - QuestState st = player.getQuestState(qn); - if (st == null) - { - return htmltext; - } - - if (player.isSubClassActive()) - { - st.exitQuest(true); - return htmltext; - } - - switch (npc.getNpcId()) - { - case 31328: // Dark Elfs - case 30195: - case 30699: - case 30474: - case 31324: - case 30862: - case 30910: - case 31285: - case 31331: - case 31334: - case 31974: - case 32096: - if (player.getRace() == Race.darkelf) - { - if (player.getClassId().level() == 1) - { - if (player.getClassId() == ClassId.palusKnight) - { - htmltext = "master_de-01.htm"; - } - else if (player.getClassId() == ClassId.shillienOracle) - { - htmltext = "master_de-08.htm"; - } - else if (player.getClassId() == ClassId.assassin) - { - htmltext = "master_de-12.htm"; - } - else if (player.getClassId() == ClassId.darkWizard) - { - htmltext = "master_de-19.htm"; - } - } - else - { - htmltext = (player.getClassId().level() == 0) ? "master_de-55.htm" : "master_de-54.htm"; - } - } - else - { - htmltext = "master_de-56.htm"; - } - break; - - case 30513: // Orcs - case 30681: - case 30704: - case 30865: - case 30913: - case 31288: - case 31326: - case 31977: - if (player.getRace() == Race.orc) - { - if (player.getClassId().level() == 1) - { - if (player.getClassId() == ClassId.orcMonk) - { - htmltext = "master_orc-01.htm"; - } - else if (player.getClassId() == ClassId.orcRaider) - { - htmltext = "master_orc-05.htm"; - } - else if (player.getClassId() == ClassId.orcShaman) - { - htmltext = "master_orc-09.htm"; - } - } - else - { - htmltext = (player.getClassId().level() == 0) ? "master_orc-33.htm" : "master_orc-32.htm"; - } - } - else - { - htmltext = "master_orc-34.htm"; - } - break; - - case 30511: // Dwarf for Bounty Hunter - case 30676: - case 30685: - case 30845: - case 30894: - case 31269: - case 31314: - case 31958: - if (player.getRace() == Race.dwarf) - { - if (player.getClassId().level() == 1) - { - if (player.getClassId() == ClassId.scavenger) - { - htmltext = "master_dwarf-01.htm"; - } - else if (player.getClassId() == ClassId.artisan) - { - htmltext = "master_dwarf-15.htm"; - } - } - else - { - htmltext = (player.getClassId().level() == 0) ? "master_dwarf-13.htm" : "master_dwarf-14.htm"; - } - } - else - { - htmltext = "master_dwarf-15.htm"; - } - break; - - case 30512: // Dwarf for Warsmith - case 30677: - case 30687: - case 30847: - case 30897: - case 31272: - case 31317: - case 31961: - if (player.getRace() == Race.dwarf) - { - if (player.getClassId().level() == 1) - { - if (player.getClassId() == ClassId.scavenger) - { - htmltext = "master_dwarf-22.htm"; - } - else if (player.getClassId() == ClassId.artisan) - { - htmltext = "master_dwarf-05.htm"; - } - } - else - { - htmltext = (player.getClassId().level() == 0) ? "master_dwarf-20.htm" : "master_dwarf-21.htm"; - } - } - else - { - htmltext = "master_dwarf-22.htm"; - } - break; - - case 30109: // Human & Elfs Fighters - case 30187: - case 30689: - case 30849: - case 30900: - case 31965: - case 32094: - if ((player.getRace() == Race.human) || (player.getRace() == Race.elf)) - { - if (player.getClassId().level() == 1) - { - if (player.getClassId() == ClassId.elvenKnight) - { - htmltext = "master_human_elf_fighter-01.htm"; - } - else if (player.getClassId() == ClassId.knight) - { - htmltext = "master_human_elf_fighter-08.htm"; - } - else if (player.getClassId() == ClassId.rogue) - { - htmltext = "master_human_elf_fighter-15.htm"; - } - else if (player.getClassId() == ClassId.elvenScout) - { - htmltext = "master_human_elf_fighter-22.htm"; - } - else if (player.getClassId() == ClassId.warrior) - { - htmltext = "master_human_elf_fighter-29.htm"; - } - else - { - htmltext = "master_human_elf_fighter-78.htm"; - } - } - else - { - htmltext = (player.getClassId().level() == 0) ? "master_human_elf_fighter-76.htm" : "master_human_elf_fighter-77.htm"; - } - } - else - { - htmltext = "master_human_elf_fighter-78.htm"; - } - break; - - case 30115: // Human & Elfs Mages (nukers) - case 30174: - case 30176: - case 30694: - case 30854: - case 31996: - if ((player.getRace() == Race.elf) || (player.getRace() == Race.human)) - { - if (player.getClassId().level() == 1) - { - if (player.getClassId() == ClassId.elvenWizard) - { - htmltext = "master_human_elf_mystic-01.htm"; - } - else if (player.getClassId() == ClassId.wizard) - { - htmltext = "master_human_elf_mystic-08.htm"; - } - else - { - htmltext = "master_human_elf_mystic-40.htm"; - } - } - else - { - htmltext = (player.getClassId().level() == 0) ? "master_human_elf_mystic-38.htm" : "master_human_elf_mystic-39.htm"; - } - } - else - { - htmltext = "master_human_elf_mystic-40.htm"; - } - break; - - case 30120: // Human & Elfs Mages (buffers) - case 30191: - case 30857: - case 30905: - case 31276: - case 31321: - case 31279: - case 31755: - case 31968: - case 32095: - case 31336: - if ((player.getRace() == Race.human) || (player.getRace() == Race.elf)) - { - if (player.getClassId().level() == 1) - { - if (player.getClassId() == ClassId.oracle) - { - htmltext = "master_human_elf_buffer-01.htm"; - } - else if (player.getClassId() == ClassId.cleric) - { - htmltext = "master_human_elf_buffer-05.htm"; - } - else - { - htmltext = "master_human_elf_buffer-26.htm"; - } - } - else - { - htmltext = (player.getClassId().level() == 0) ? "master_human_elf_buffer-24.htm" : "master_human_elf_buffer-25.htm"; - } - } - else - { - htmltext = "master_human_elf_buffer-26.htm"; - } - break; - } - st.exitQuest(true); - - return htmltext; - } - - /** - * @param player : The player to make checks on. - * @return a String corresponding to html directory. - */ - private static String getClassHtml(PlayerInstance player) - { - String change = ""; - - switch (player.getRace()) - { - case darkelf: - change = "master_de"; - break; - - case dwarf: - change = "master_dwarf"; - break; - - case orc: - change = "master_orc"; - break; - - case human: - case elf: - if (player.isMageClass()) - { - change = ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.elvenWizard)) ? "master_human_elf_mystic" : "master_human_elf_buffer"; - } - else - { - change = "master_human_elf_fighter"; - } - break; - } - - return change; - } - - public static void main(String[] args) - { - new SecondClassChange(); - } + static + { + // Dark Elfs + Classes.put("SK", new int[] {33, 32, 2, 26, 27, 28, 29, MARK_OF_DUTY, MARK_OF_FATE, MARK_OF_WITCHCRAFT, 56}); + Classes.put("BD", new int[] {34, 32, 2, 30, 31, 32, 33, MARK_OF_CHALLENGER, MARK_OF_FATE, MARK_OF_DUELIST, 56}); + Classes.put("SE", new int[] {43, 42, 2, 34, 35, 36, 37, MARK_OF_PILGRIM, MARK_OF_FATE, MARK_OF_REFORMER, 56}); + Classes.put("AW", new int[] {36, 35, 2, 38, 39, 40, 41, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SEARCHER, 56}); + Classes.put("PR", new int[] {37, 35, 2, 42, 43, 44, 45, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SAGITTARIUS, 56}); + Classes.put("SH", new int[] {40, 39, 2, 46, 47, 48, 49, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_MAGUS, 56}); + Classes.put("PS", new int[] {41, 39, 2, 50, 51, 52, 53, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_SUMMONER, 56}); + // Orcs + Classes.put("TY", new int[] {48, 47, 3, 16, 17, 18, 19, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST, 34}); + Classes.put("DE", new int[] {46, 45, 3, 20, 21, 22, 23, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION, 34}); + Classes.put("OL", new int[] {51, 50, 3, 24, 25, 26, 27, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD, 34}); + Classes.put("WC", new int[] {52, 50, 3, 28, 29, 30, 31, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT, 34}); + // Dwarf + Classes.put("BH", new int[] {55, 54, 4, 109, 10, 11, 12, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER, 15}); // I can't use 09 so I put 109 :P + Classes.put("WS", new int[] {57, 56, 4, 16, 17, 18, 19, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_MAESTRO, 22}); + // Human & Elf Fighters + Classes.put("TK", new int[] {20, 19, 1, 36, 37, 38, 39, MARK_OF_DUTY, MARK_OF_LIFE, MARK_OF_HEALER, 78}); + Classes.put("SS", new int[] {21, 19, 1, 40, 41, 42, 43, MARK_OF_CHALLENGER, MARK_OF_LIFE, MARK_OF_DUELIST, 78}); + Classes.put("PL", new int[] {5, 4, 0, 44, 45, 46, 47, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_HEALER, 78}); + Classes.put("DA", new int[] {6, 4, 0, 48, 49, 50, 51, MARK_OF_DUTY, MARK_OF_TRUST, MARK_OF_WITCHCRAFT, 78}); + Classes.put("TH", new int[] {8, 7, 0, 52, 53, 54, 55, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SEARCHER, 78}); + Classes.put("HE", new int[] {9, 7, 0, 56, 57, 58, 59, MARK_OF_SEEKER, MARK_OF_TRUST, MARK_OF_SAGITTARIUS, 78}); + Classes.put("PW", new int[] {23, 22, 1, 60, 61, 62, 63, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SEARCHER, 78}); + Classes.put("SR", new int[] {24, 22, 1, 64, 65, 66, 67, MARK_OF_SEEKER, MARK_OF_LIFE, MARK_OF_SAGITTARIUS, 78}); + Classes.put("GL", new int[] {2, 1, 0, 68, 69, 70, 71, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_DUELIST, 78}); + Classes.put("WL", new int[] {3, 1, 0, 72, 73, 74, 75, MARK_OF_CHALLENGER, MARK_OF_TRUST, MARK_OF_CHAMPION, 78}); + // Human & Elf Mages (nukers) + Classes.put("EW", new int[] {27, 26, 1, 18, 19, 20, 21, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS, 40}); + Classes.put("ES", new int[] {28, 26, 1, 22, 23, 24, 25, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER, 40}); + Classes.put("HS", new int[] {12, 11, 0, 26, 27, 28, 29, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS, 40}); + Classes.put("HN", new int[] {13, 11, 0, 30, 31, 32, 33, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT, 40}); + Classes.put("HW", new int[] {14, 11, 0, 34, 35, 36, 37, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER, 40}); + // Human & Elf Mages (buffers) + Classes.put("BI", new int[] {16, 15, 0, 16, 17, 18, 19, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER, 26}); + Classes.put("PH", new int[] {17, 15, 0, 20, 21, 22, 23, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER, 26}); + Classes.put("EE", new int[] {30, 29, 1, 12, 13, 14, 15, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER, 26}); + } + + public static final int[] SECONDCLASSNPCS = + { + // Dark Elfs + 31328, 30195, 30699, 30474, 31324, 30862, 30910, 31285, 31331, 31334, 31974, 32096, + // Orcs + 30513, 30681, 30704, 30865, 30913, 31288, 31326, 31977, + // Dwarf + 30511, 30676, 30685, 30845, 30894, 31269, 31314, 31958, 30512, 30677, 30687, 30847, 30897, 31272, 31317, 31961, + // Human & Elf Fighters + 30109, 30187, 30689, 30849, 30900, 31965, 32094, + // Human & Elf Mages (nukers) + 30115, 30174, 30176, 30694, 30854, 31996, + // Human & Elf Mages (buffers) + 30120, 30191, 30857, 30905, 31276, 31321, 31279, 31755, 31968, 32095, 31336 + }; + // @formatter:on + + public SecondClassChange() + { + super(-1, qn, "village_master"); + + addStartNpc(SECONDCLASSNPCS); + addTalkId(SECONDCLASSNPCS); + } + + @Override + public String onAdvEvent(String event, NpcInstance npc, PlayerInstance player) + { + String htmltext = event; + QuestState st = player.getQuestState(qn); + if (st == null) + { + return htmltext; + } + + String suffix = ""; + if (Classes.containsKey(event)) + { + // 0 = newClass, 1 = reqClass, 2 = reqRace, 3 = no/no, 4 = no/ok, 5 = ok/no, 6 = ok/ok, 7,8,9 = Required Items 10 = denied class + final int[] array = Classes.get(event); + if ((player.getClassId().getId() == array[1]) && (player.getRace().ordinal() == array[2])) + { + if (player.getLevel() < 40) + { + suffix = "-" + ((st.hasQuestItems(array[7], array[8], array[9])) ? array[4] : array[3]); + } + else + { + if (st.hasQuestItems(array[7], array[8], array[9])) + { + st.playSound(QuestState.SOUND_FANFARE); + st.takeItems(array[7], -1); + st.takeItems(array[8], -1); + st.takeItems(array[9], -1); + player.setClassId(array[0]); + player.setBaseClass(array[0]); + player.sendPacket(new HennaInfo(player)); + player.broadcastUserInfo(); + suffix = "-" + array[6]; + } + else + { + suffix = "-" + array[5]; + } + } + + htmltext = getClassHtml(player) + suffix + ".htm"; + st.exitQuest(true); + } + else + { + htmltext = getClassHtml(player) + "-" + array[10] + ".htm"; + } + } + + return htmltext; + } + + @Override + public String onTalk(NpcInstance npc, PlayerInstance player) + { + String htmltext = Quest.getNoQuestMsg(); + QuestState st = player.getQuestState(qn); + if (st == null) + { + return htmltext; + } + + if (player.isSubClassActive()) + { + st.exitQuest(true); + return htmltext; + } + + switch (npc.getNpcId()) + { + case 31328: // Dark Elfs + case 30195: + case 30699: + case 30474: + case 31324: + case 30862: + case 30910: + case 31285: + case 31331: + case 31334: + case 31974: + case 32096: + if (player.getRace() == Race.darkelf) + { + if (player.getClassId().level() == 1) + { + if (player.getClassId() == ClassId.palusKnight) + { + htmltext = "master_de-01.htm"; + } + else if (player.getClassId() == ClassId.shillienOracle) + { + htmltext = "master_de-08.htm"; + } + else if (player.getClassId() == ClassId.assassin) + { + htmltext = "master_de-12.htm"; + } + else if (player.getClassId() == ClassId.darkWizard) + { + htmltext = "master_de-19.htm"; + } + } + else + { + htmltext = (player.getClassId().level() == 0) ? "master_de-55.htm" : "master_de-54.htm"; + } + } + else + { + htmltext = "master_de-56.htm"; + } + break; + + case 30513: // Orcs + case 30681: + case 30704: + case 30865: + case 30913: + case 31288: + case 31326: + case 31977: + if (player.getRace() == Race.orc) + { + if (player.getClassId().level() == 1) + { + if (player.getClassId() == ClassId.orcMonk) + { + htmltext = "master_orc-01.htm"; + } + else if (player.getClassId() == ClassId.orcRaider) + { + htmltext = "master_orc-05.htm"; + } + else if (player.getClassId() == ClassId.orcShaman) + { + htmltext = "master_orc-09.htm"; + } + } + else + { + htmltext = (player.getClassId().level() == 0) ? "master_orc-33.htm" : "master_orc-32.htm"; + } + } + else + { + htmltext = "master_orc-34.htm"; + } + break; + + case 30511: // Dwarf for Bounty Hunter + case 30676: + case 30685: + case 30845: + case 30894: + case 31269: + case 31314: + case 31958: + if (player.getRace() == Race.dwarf) + { + if (player.getClassId().level() == 1) + { + if (player.getClassId() == ClassId.scavenger) + { + htmltext = "master_dwarf-01.htm"; + } + else if (player.getClassId() == ClassId.artisan) + { + htmltext = "master_dwarf-15.htm"; + } + } + else + { + htmltext = (player.getClassId().level() == 0) ? "master_dwarf-13.htm" : "master_dwarf-14.htm"; + } + } + else + { + htmltext = "master_dwarf-15.htm"; + } + break; + + case 30512: // Dwarf for Warsmith + case 30677: + case 30687: + case 30847: + case 30897: + case 31272: + case 31317: + case 31961: + if (player.getRace() == Race.dwarf) + { + if (player.getClassId().level() == 1) + { + if (player.getClassId() == ClassId.scavenger) + { + htmltext = "master_dwarf-22.htm"; + } + else if (player.getClassId() == ClassId.artisan) + { + htmltext = "master_dwarf-05.htm"; + } + } + else + { + htmltext = (player.getClassId().level() == 0) ? "master_dwarf-20.htm" : "master_dwarf-21.htm"; + } + } + else + { + htmltext = "master_dwarf-22.htm"; + } + break; + + case 30109: // Human & Elfs Fighters + case 30187: + case 30689: + case 30849: + case 30900: + case 31965: + case 32094: + if ((player.getRace() == Race.human) || (player.getRace() == Race.elf)) + { + if (player.getClassId().level() == 1) + { + if (player.getClassId() == ClassId.elvenKnight) + { + htmltext = "master_human_elf_fighter-01.htm"; + } + else if (player.getClassId() == ClassId.knight) + { + htmltext = "master_human_elf_fighter-08.htm"; + } + else if (player.getClassId() == ClassId.rogue) + { + htmltext = "master_human_elf_fighter-15.htm"; + } + else if (player.getClassId() == ClassId.elvenScout) + { + htmltext = "master_human_elf_fighter-22.htm"; + } + else if (player.getClassId() == ClassId.warrior) + { + htmltext = "master_human_elf_fighter-29.htm"; + } + else + { + htmltext = "master_human_elf_fighter-78.htm"; + } + } + else + { + htmltext = (player.getClassId().level() == 0) ? "master_human_elf_fighter-76.htm" : "master_human_elf_fighter-77.htm"; + } + } + else + { + htmltext = "master_human_elf_fighter-78.htm"; + } + break; + + case 30115: // Human & Elfs Mages (nukers) + case 30174: + case 30176: + case 30694: + case 30854: + case 31996: + if ((player.getRace() == Race.elf) || (player.getRace() == Race.human)) + { + if (player.getClassId().level() == 1) + { + if (player.getClassId() == ClassId.elvenWizard) + { + htmltext = "master_human_elf_mystic-01.htm"; + } + else if (player.getClassId() == ClassId.wizard) + { + htmltext = "master_human_elf_mystic-08.htm"; + } + else + { + htmltext = "master_human_elf_mystic-40.htm"; + } + } + else + { + htmltext = (player.getClassId().level() == 0) ? "master_human_elf_mystic-38.htm" : "master_human_elf_mystic-39.htm"; + } + } + else + { + htmltext = "master_human_elf_mystic-40.htm"; + } + break; + + case 30120: // Human & Elfs Mages (buffers) + case 30191: + case 30857: + case 30905: + case 31276: + case 31321: + case 31279: + case 31755: + case 31968: + case 32095: + case 31336: + if ((player.getRace() == Race.human) || (player.getRace() == Race.elf)) + { + if (player.getClassId().level() == 1) + { + if (player.getClassId() == ClassId.oracle) + { + htmltext = "master_human_elf_buffer-01.htm"; + } + else if (player.getClassId() == ClassId.cleric) + { + htmltext = "master_human_elf_buffer-05.htm"; + } + else + { + htmltext = "master_human_elf_buffer-26.htm"; + } + } + else + { + htmltext = (player.getClassId().level() == 0) ? "master_human_elf_buffer-24.htm" : "master_human_elf_buffer-25.htm"; + } + } + else + { + htmltext = "master_human_elf_buffer-26.htm"; + } + break; + } + st.exitQuest(true); + + return htmltext; + } + + /** + * @param player : The player to make checks on. + * @return a String corresponding to html directory. + */ + private static String getClassHtml(PlayerInstance player) + { + String change = ""; + + switch (player.getRace()) + { + case darkelf: + change = "master_de"; + break; + + case dwarf: + change = "master_dwarf"; + break; + + case orc: + change = "master_orc"; + break; + + case human: + case elf: + if (player.isMageClass()) + { + change = ((player.getClassId() == ClassId.wizard) || (player.getClassId() == ClassId.elvenWizard)) ? "master_human_elf_mystic" : "master_human_elf_buffer"; + } + else + { + change = "master_human_elf_fighter"; + } + break; + } + + return change; + } + + public static void main(String[] args) + { + new SecondClassChange(); + } } \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/holders/ScoreDataHolder.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/holders/ScoreDataHolder.java new file mode 100644 index 0000000000..6d16121d6d --- /dev/null +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/holders/ScoreDataHolder.java @@ -0,0 +1,56 @@ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.holders; + +/** + * @author Mobius + */ +public class ScoreDataHolder +{ + private final int _crystalId; + private final String _okMsg; + private final String _noAdenaMsg; + private final String _noScoreMsg; + + public ScoreDataHolder(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; + } +} \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/quest/Quest.java index 97669ff33b..2f97539e65 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/quest/Quest.java @@ -81,7 +81,8 @@ public class Quest extends ManagedScript public int[] questItemIds = null; // Dimensional Diamond Rewards by Class for 2nd class transfer quest (35) - protected static final Map DF_REWARD_35 = new HashMap<>(); + protected static final Map DF_REWARD_35 = new HashMap<>(); + static { DF_REWARD_35.put(1, 61); DF_REWARD_35.put(4, 45); @@ -104,7 +105,8 @@ public class Quest extends ManagedScript } // Dimensional Diamond Rewards by Race for 2nd class transfer quest (37) - protected static final Map DF_REWARD_37 = new HashMap<>(); + protected static final Map DF_REWARD_37 = new HashMap<>(); + static { DF_REWARD_37.put(0, 96); DF_REWARD_37.put(1, 102); @@ -114,7 +116,8 @@ public class Quest extends ManagedScript } // Dimensional Diamond Rewards by Class for 2nd class transfer quest (39) - protected static final Map DF_REWARD_39 = new HashMap<>(); + protected static final Map DF_REWARD_39 = new HashMap<>(); + static { DF_REWARD_39.put(1, 72); DF_REWARD_39.put(4, 104); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 72766a710c..e15ef8ea27 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -1,1043 +1,1044 @@ -/* - * 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 . - */ -package ai.bosses.Antharas; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.Config; -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.MountType; -import com.l2jmobius.gameserver.instancemanager.GrandBossManager; -import com.l2jmobius.gameserver.instancemanager.ZoneManager; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.Party; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Attackable; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.GrandBossInstance; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.holders.SkillHolder; -import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.model.zone.type.NoRestartZone; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.Earthquake; -import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; -import com.l2jmobius.gameserver.network.serverpackets.PlaySound; -import com.l2jmobius.gameserver.network.serverpackets.SocialAction; -import com.l2jmobius.gameserver.network.serverpackets.SpecialCamera; -import com.l2jmobius.gameserver.util.Broadcast; -import com.l2jmobius.gameserver.util.Util; - -import ai.AbstractNpcAI; - -/** - * Antharas AI. - * @author St3eT - */ -public final class Antharas extends AbstractNpcAI -{ - // NPCs - private static final int ANTHARAS = 29068; // Antharas - private static final int BEHEMOTH = 29069; // Behemoth Dragon - private static final int TERASQUE = 29190; // Tarask Dragon - private static final int BOMBER = 29070; // Dragon Bomber - private static final int HEART = 13001; // Heart of Warding - private static final int CUBE = 31859; // Teleportation Cubic +/* + * 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 . + */ +package ai.bosses.Antharas; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.Config; +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.MountType; +import com.l2jmobius.gameserver.instancemanager.GrandBossManager; +import com.l2jmobius.gameserver.instancemanager.ZoneManager; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.Party; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Attackable; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.GrandBossInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; +import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.zone.type.NoRestartZone; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.Earthquake; +import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; +import com.l2jmobius.gameserver.network.serverpackets.PlaySound; +import com.l2jmobius.gameserver.network.serverpackets.SocialAction; +import com.l2jmobius.gameserver.network.serverpackets.SpecialCamera; +import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; + +import ai.AbstractNpcAI; + +/** + * Antharas AI. + * @author St3eT + */ +public final class Antharas extends AbstractNpcAI +{ + // NPCs + private static final int ANTHARAS = 29068; // Antharas + private static final int BEHEMOTH = 29069; // Behemoth Dragon + private static final int TERASQUE = 29190; // Tarask Dragon + private static final int BOMBER = 29070; // Dragon Bomber + private static final int HEART = 13001; // Heart of Warding + private static final int CUBE = 31859; // Teleportation Cubic private static final Map INVISIBLE_NPC = new HashMap<>(); - { - INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); // antaras_clear_npc_1 - INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); // antaras_clear_npc_2 - INVISIBLE_NPC.put(29079, new Location(176385, 113889, -7735)); // antaras_clear_npc_3 - INVISIBLE_NPC.put(29080, new Location(176082, 114241, -7735)); // antaras_clear_npc_4 - INVISIBLE_NPC.put(29081, new Location(176066, 114802, -7735)); // antaras_clear_npc_5 - INVISIBLE_NPC.put(29082, new Location(176095, 115313, -7735)); // antaras_clear_npc_6 - INVISIBLE_NPC.put(29083, new Location(176425, 115829, -7735)); // antaras_clear_npc_7 - INVISIBLE_NPC.put(29084, new Location(176949, 116378, -7735)); // antaras_clear_npc_8 - INVISIBLE_NPC.put(29085, new Location(177655, 116402, -7735)); // antaras_clear_npc_9 - INVISIBLE_NPC.put(29086, new Location(178248, 116395, -7735)); // antaras_clear_npc_10 - INVISIBLE_NPC.put(29087, new Location(178706, 115998, -7735)); // antaras_clear_npc_11 - INVISIBLE_NPC.put(29088, new Location(179208, 115452, -7735)); // antaras_clear_npc_12 - INVISIBLE_NPC.put(29089, new Location(179191, 115079, -7735)); // antaras_clear_npc_13 - INVISIBLE_NPC.put(29090, new Location(179221, 114546, -7735)); // antaras_clear_npc_14 - INVISIBLE_NPC.put(29091, new Location(178916, 113925, -7735)); // antaras_clear_npc_15 - INVISIBLE_NPC.put(29092, new Location(178782, 113814, -7735)); // antaras_clear_npc_16 - INVISIBLE_NPC.put(29093, new Location(178419, 113417, -7735)); // antaras_clear_npc_17 - INVISIBLE_NPC.put(29094, new Location(177855, 113282, -7735)); // antaras_clear_npc_18 - } - // Item - private static final int STONE = 3865; // Portal Stone - // Skill - private static final SkillHolder ANTH_JUMP = new SkillHolder(4106, 1); // Antharas Stun - private static final SkillHolder ANTH_TAIL = new SkillHolder(4107, 1); // Antharas Stun - private static final SkillHolder ANTH_FEAR = new SkillHolder(4108, 1); // Antharas Terror - private static final SkillHolder ANTH_DEBUFF = new SkillHolder(4109, 1); // Curse of Antharas - private static final SkillHolder ANTH_MOUTH = new SkillHolder(4110, 2); // Breath Attack - private static final SkillHolder ANTH_BREATH = new SkillHolder(4111, 1); // Antharas Fossilization - private static final SkillHolder ANTH_NORM_ATTACK = new SkillHolder(4112, 1); // Ordinary Attack - private static final SkillHolder ANTH_NORM_ATTACK_EX = new SkillHolder(4113, 1); // Animal doing ordinary attack - private static final SkillHolder ANTH_REGEN_1 = new SkillHolder(4125, 1); // Antharas Regeneration - private static final SkillHolder ANTH_REGEN_2 = new SkillHolder(4239, 1); // Antharas Regeneration - private static final SkillHolder ANTH_REGEN_3 = new SkillHolder(4240, 1); // Antharas Regeneration - private static final SkillHolder ANTH_REGEN_4 = new SkillHolder(4241, 1); // Antharas Regeneration - private static final SkillHolder DISPEL_BOM = new SkillHolder(5042, 1); // NPC Dispel Bomb - private static final SkillHolder ANTH_ANTI_STRIDER = new SkillHolder(4258, 1); // Hinder Strider - private static final SkillHolder ANTH_FEAR_SHORT = new SkillHolder(5092, 1); // Antharas Terror - private static final SkillHolder ANTH_METEOR = new SkillHolder(5093, 1); // Antharas Meteor - // Zone - private static final NoRestartZone zone = ZoneManager.getInstance().getZoneById(70050, NoRestartZone.class); // Antharas Nest zone - // Status - private static final int ALIVE = 0; - private static final int WAITING = 1; - private static final int IN_FIGHT = 2; - private static final int DEAD = 3; - // Misc - private static final int MAX_PEOPLE = 200; // Max allowed players - private GrandBossInstance _antharas = null; - private static long _lastAttack = 0; - private static int _minionCount = 0; - private static int minionMultipler = 0; - private static int moveChance = 0; - private static int sandStorm = 0; - private static PlayerInstance attacker_1 = null; - private static PlayerInstance attacker_2 = null; - private static PlayerInstance attacker_3 = null; - private static int attacker_1_hate = 0; - private static int attacker_2_hate = 0; - private static int attacker_3_hate = 0; - - private Antharas() - { - addStartNpc(HEART, CUBE); - addTalkId(HEART, CUBE); - addFirstTalkId(HEART); - addSpawnId(INVISIBLE_NPC.keySet()); - addSpawnId(ANTHARAS); - addMoveFinishedId(BOMBER); - addAggroRangeEnterId(BOMBER); - addSpellFinishedId(ANTHARAS); - addAttackId(ANTHARAS, BOMBER, BEHEMOTH, TERASQUE); - addKillId(ANTHARAS, TERASQUE, BEHEMOTH); - - final StatsSet info = GrandBossManager.getInstance().getStatsSet(ANTHARAS); - final double curr_hp = info.getDouble("currentHP"); - final double curr_mp = info.getDouble("currentMP"); - final int loc_x = info.getInt("loc_x"); - final int loc_y = info.getInt("loc_y"); - final int loc_z = info.getInt("loc_z"); - final int heading = info.getInt("heading"); - final long respawnTime = info.getLong("respawn_time"); - - switch (getStatus()) - { - case ALIVE: - { - _antharas = (GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); - _antharas.setCurrentHpMp(curr_hp, curr_mp); - addBoss(_antharas); - break; - } - case WAITING: - { - _antharas = (GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); - _antharas.setCurrentHpMp(curr_hp, curr_mp); - addBoss(_antharas); - startQuestTimer("SPAWN_ANTHARAS", Config.ANTHARAS_WAIT_TIME * 60000, null, null); - break; - } - case IN_FIGHT: - { - _antharas = (GrandBossInstance) addSpawn(ANTHARAS, loc_x, loc_y, loc_z, heading, false, 0); - _antharas.setCurrentHpMp(curr_hp, curr_mp); - addBoss(_antharas); - _lastAttack = System.currentTimeMillis(); - startQuestTimer("CHECK_ATTACK", 60000, _antharas, null); - startQuestTimer("SPAWN_MINION", 300000, _antharas, null); - break; - } - case DEAD: - { - final long remain = respawnTime - System.currentTimeMillis(); - if (remain > 0) - { - startQuestTimer("CLEAR_STATUS", remain, null, null); - } - else - { - setStatus(ALIVE); - _antharas = (GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); - addBoss(_antharas); - } - break; - } - } - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - switch (event) - { - case "enter": - { - String htmltext = null; - if (getStatus() == DEAD) - { - htmltext = "13001-01.html"; - } - else if (getStatus() == IN_FIGHT) - { - htmltext = "13001-02.html"; - } - else if (zone.getPlayersInside().size() >= MAX_PEOPLE) - { - htmltext = "13001-04.html"; - } - else if (player.isInParty()) - { - final Party party = player.getParty(); - final boolean isInCC = party.isInCommandChannel(); - final List members = isInCC ? party.getCommandChannel().getMembers() : party.getMembers(); - final boolean isPartyLeader = isInCC ? party.getCommandChannel().isLeader(player) : party.isLeader(player); - if (!isPartyLeader) - { - htmltext = "13001-05.html"; - } - else if (!hasQuestItems(player, STONE)) - { - htmltext = "13001-03.html"; - } - else if (members.size() > (MAX_PEOPLE - zone.getPlayersInside().size())) - { - htmltext = "13001-04.html"; - } - else - { - for (PlayerInstance member : members) - { - if (member.isInsideRadius3D(npc, 1000)) - { - member.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709); - } - } - if (getStatus() != WAITING) - { - setStatus(WAITING); - startQuestTimer("SPAWN_ANTHARAS", Config.ANTHARAS_WAIT_TIME * 60000, null, null); - } - } - } - else if (!hasQuestItems(player, STONE)) - { - htmltext = "13001-03.html"; - } - else - { - player.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709); - if (getStatus() != WAITING) - { - setStatus(WAITING); - startQuestTimer("SPAWN_ANTHARAS", Config.ANTHARAS_WAIT_TIME * 60000, null, null); - } - } - return htmltext; - } - case "teleportOut": - { - player.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); - break; - } - case "SPAWN_ANTHARAS": - { - _antharas.teleToLocation(181323, 114850, -7623, 32542); - setStatus(IN_FIGHT); - _lastAttack = System.currentTimeMillis(); - zone.broadcastPacket(new PlaySound("BS02_A")); - startQuestTimer("CAMERA_1", 23, _antharas, null); - break; - } - case "CAMERA_1": - { - zone.broadcastPacket(new SpecialCamera(npc, 700, 13, -19, 0, 10000, 20000, 0, 0, 0, 0, 0)); - startQuestTimer("CAMERA_2", 3000, npc, null); - break; - } - case "CAMERA_2": - { - zone.broadcastPacket(new SpecialCamera(npc, 700, 13, 0, 6000, 10000, 20000, 0, 0, 0, 0, 0)); - startQuestTimer("CAMERA_3", 10000, npc, null); - break; - } - case "CAMERA_3": - { - zone.broadcastPacket(new SpecialCamera(npc, 3700, 0, -3, 0, 10000, 10000, 0, 0, 0, 0, 0)); - zone.broadcastPacket(new SocialAction(npc.getObjectId(), 1)); - startQuestTimer("CAMERA_4", 200, npc, null); - startQuestTimer("SOCIAL", 5200, npc, null); - break; - } - case "CAMERA_4": - { - zone.broadcastPacket(new SpecialCamera(npc, 1100, 0, -3, 22000, 10000, 30000, 0, 0, 0, 0, 0)); - startQuestTimer("CAMERA_5", 10800, npc, null); - break; - } - case "CAMERA_5": - { - zone.broadcastPacket(new SpecialCamera(npc, 1100, 0, -3, 300, 10000, 7000, 0, 0, 0, 0, 0)); - startQuestTimer("START_MOVE", 1900, npc, null); - break; - } - case "SOCIAL": - { - zone.broadcastPacket(new SocialAction(npc.getObjectId(), 2)); - break; - } - case "START_MOVE": - { - for (PlayerInstance players : World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 4000)) - { - if (players.isHero()) - { - zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_YOU_CANNOT_HOPE_TO_DEFEAT_ME_WITH_YOUR_MEAGER_STRENGTH, 2, 4000, players.getName())); - break; - } - } - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(179011, 114871, -7704)); - startQuestTimer("CHECK_ATTACK", 60000, npc, null); - startQuestTimer("SPAWN_MINION", 300000, npc, null); - break; - } - case "SET_REGEN": - { - if (npc != null) - { - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) - { - if (!npc.isAffectedBySkill(ANTH_REGEN_4.getSkillId())) - { - npc.doCast(ANTH_REGEN_4.getSkill()); - } - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) - { - if (!npc.isAffectedBySkill(ANTH_REGEN_3.getSkillId())) - { - npc.doCast(ANTH_REGEN_3.getSkill()); - } - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) - { - if (!npc.isAffectedBySkill(ANTH_REGEN_2.getSkillId())) - { - npc.doCast(ANTH_REGEN_2.getSkill()); - } - } - else if (!npc.isAffectedBySkill(ANTH_REGEN_1.getSkillId())) - { - npc.doCast(ANTH_REGEN_1.getSkill()); - } - startQuestTimer("SET_REGEN", 60000, npc, null); - } - break; - } - case "CHECK_ATTACK": - { - if ((npc != null) && ((_lastAttack + 900000) < System.currentTimeMillis())) - { - setStatus(ALIVE); - for (Creature creature : zone.getCharactersInside()) - { - if (creature != null) - { - if (creature.isNpc()) - { - if (creature.getId() == ANTHARAS) - { - creature.teleToLocation(185708, 114298, -8221); - } - else - { - creature.deleteMe(); - } - } - else if (creature.isPlayer()) - { - creature.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); - } - } - } - cancelQuestTimer("CHECK_ATTACK", npc, null); - cancelQuestTimer("SPAWN_MINION", npc, null); - } - else if (npc != null) - { - if (attacker_1_hate > 10) - { - attacker_1_hate -= getRandom(10); - } - if (attacker_2_hate > 10) - { - attacker_2_hate -= getRandom(10); - } - if (attacker_3_hate > 10) - { - attacker_3_hate -= getRandom(10); - } - manageSkills(npc); - startQuestTimer("CHECK_ATTACK", 60000, npc, null); - } - break; - } - case "SPAWN_MINION": - { - if ((minionMultipler > 1) && (_minionCount < (100 - (minionMultipler * 2)))) - { - for (int i = 0; i < minionMultipler; i++) - { - addSpawn(BEHEMOTH, npc, true); - addSpawn(TERASQUE, npc, true); - } - _minionCount += minionMultipler * 2; - } - else if (_minionCount < 98) - { - addSpawn(BEHEMOTH, npc, true); - addSpawn(TERASQUE, npc, true); - _minionCount += 2; - } - else if (_minionCount < 99) - { - addSpawn(getRandomBoolean() ? BEHEMOTH : TERASQUE, npc, true); - _minionCount++; - } - - if ((getRandom(100) > 10) && (minionMultipler < 4)) - { - minionMultipler++; - } - startQuestTimer("SPAWN_MINION", 300000, npc, null); - break; - } - case "CLEAR_ZONE": - { - for (Creature creature : zone.getCharactersInside()) - { - if (creature != null) - { - if (creature.isNpc()) - { - creature.deleteMe(); - } - else if (creature.isPlayer()) - { - creature.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); - } - } - } - break; - } - case "TID_USED_FEAR": - { - if ((npc != null) && (sandStorm == 0)) - { - sandStorm = 1; - npc.disableCoreAI(true); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(177648, 114816, -7735)); - startQuestTimer("TID_FEAR_MOVE_TIMEOVER", 2000, npc, null); - startQuestTimer("TID_FEAR_COOLTIME", 300000, npc, null); - } - break; - } - case "TID_FEAR_COOLTIME": - { - sandStorm = 0; - break; - } - case "TID_FEAR_MOVE_TIMEOVER": - { - if ((sandStorm == 1) && (npc.getX() == 177648) && (npc.getY() == 114816)) - { - sandStorm = 2; - moveChance = 0; - npc.disableCoreAI(false); - INVISIBLE_NPC.entrySet().forEach(entry -> addSpawn(entry.getKey(), entry.getValue())); - } - else if (sandStorm == 1) - { - if (moveChance <= 3) - { - moveChance++; - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(177648, 114816, -7735)); - startQuestTimer("TID_FEAR_MOVE_TIMEOVER", 5000, npc, null); - } - else - { - npc.teleToLocation(177648, 114816, -7735, npc.getHeading()); - startQuestTimer("TID_FEAR_MOVE_TIMEOVER", 1000, npc, null); - } - } - break; - } - case "CLEAR_STATUS": - { - _antharas = (GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); - addBoss(_antharas); - Broadcast.toAllOnlinePlayers(new Earthquake(185708, 114298, -8221, 20, 10)); - setStatus(ALIVE); - break; - } - case "SKIP_WAITING": - { - if (getStatus() == WAITING) - { - cancelQuestTimer("SPAWN_ANTHARAS", null, null); - notifyEvent("SPAWN_ANTHARAS", null, null); - player.sendMessage(getClass().getSimpleName() + ": Skipping waiting time ..."); - } - else - { - player.sendMessage(getClass().getSimpleName() + ": You can't skip waiting time right now!"); - } - break; - } - case "RESPAWN_ANTHARAS": - { - if (getStatus() == DEAD) - { - setRespawn(0); - cancelQuestTimer("CLEAR_STATUS", null, null); - notifyEvent("CLEAR_STATUS", null, null); - player.sendMessage(getClass().getSimpleName() + ": Antharas has been respawned."); - } - else - { - player.sendMessage(getClass().getSimpleName() + ": You can't respawn antharas while antharas is alive!"); - } - break; - } - case "DESPAWN_MINIONS": - { - if (getStatus() == IN_FIGHT) - { - _minionCount = 0; - for (Creature creature : zone.getCharactersInside()) - { - if ((creature != null) && creature.isNpc() && ((creature.getId() == BEHEMOTH) || (creature.getId() == TERASQUE))) - { - creature.deleteMe(); - } - } - if (player != null) // Player dont will be null just when is this event called from GM command - { - player.sendMessage(getClass().getSimpleName() + ": All minions have been deleted!"); - } - } - else if (player != null) // Player dont will be null just when is this event called from GM command - { - player.sendMessage(getClass().getSimpleName() + ": You can't despawn minions right now!"); - } - break; - } - case "ABORT_FIGHT": - { - if (getStatus() == IN_FIGHT) - { - setStatus(ALIVE); - cancelQuestTimer("CHECK_ATTACK", _antharas, null); - cancelQuestTimer("SPAWN_MINION", _antharas, null); - for (Creature creature : zone.getCharactersInside()) - { - if (creature != null) - { - if (creature.isNpc()) - { - if (creature.getId() == ANTHARAS) - { - creature.teleToLocation(185708, 114298, -8221); - } - else - { - creature.deleteMe(); - } - } - else if (creature.isPlayer() && !creature.isGM()) - { - creature.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); - } - } - } - player.sendMessage(getClass().getSimpleName() + ": Fight has been aborted!"); - } - else - { - player.sendMessage(getClass().getSimpleName() + ": You can't abort fight right now!"); - } - break; - } - case "MANAGE_SKILL": - { - manageSkills(npc); - break; - } - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAggroRangeEnter(Npc npc, PlayerInstance player, boolean isSummon) - { - npc.doCast(DISPEL_BOM.getSkill()); - npc.doDie(player); - return super.onAggroRangeEnter(npc, player, isSummon); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) - { - _lastAttack = System.currentTimeMillis(); - - if (npc.getId() == BOMBER) - { - if (npc.calculateDistance3D(attacker) < 230) - { - npc.doCast(DISPEL_BOM.getSkill()); - npc.doDie(attacker); - } - } - else if (npc.getId() == ANTHARAS) - { - if (!zone.isCharacterInZone(attacker) || (getStatus() != IN_FIGHT)) - { - LOGGER.warning(getClass().getSimpleName() + ": Player " + attacker.getName() + " attacked Antharas in invalid conditions!"); - attacker.teleToLocation(80464, 152294, -3534); - } - - if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTH_ANTI_STRIDER.getSkillId()) && npc.checkDoCastConditions(ANTH_ANTI_STRIDER.getSkill())) - { - npc.setTarget(attacker); - npc.doCast(ANTH_ANTI_STRIDER.getSkill()); - } - - if (skill == null) - { - refreshAiParams(attacker, damage * 1000); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) - { - refreshAiParams(attacker, (damage / 3) * 100); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) - { - refreshAiParams(attacker, damage * 20); - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) - { - refreshAiParams(attacker, damage * 10); - } - else - { - refreshAiParams(attacker, (damage / 3) * 20); - } - manageSkills(npc); - } - return super.onAttack(npc, attacker, damage, isSummon, skill); - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - if (zone.isCharacterInZone(killer)) - { - if (npc.getId() == ANTHARAS) - { - _antharas = null; - notifyEvent("DESPAWN_MINIONS", null, null); - zone.broadcastPacket(new SpecialCamera(npc, 1200, 20, -10, 0, 10000, 13000, 0, 0, 0, 0, 0)); - zone.broadcastPacket(new PlaySound("BS01_D")); - addSpawn(CUBE, 177615, 114941, -7709, 0, false, 900000); - final long respawnTime = (Config.ANTHARAS_SPAWN_INTERVAL + getRandom(-Config.ANTHARAS_SPAWN_RANDOM, Config.ANTHARAS_SPAWN_RANDOM)) * 3600000; - setRespawn(respawnTime); - startQuestTimer("CLEAR_STATUS", respawnTime, null, null); - cancelQuestTimer("SET_REGEN", npc, null); - cancelQuestTimer("CHECK_ATTACK", npc, null); - cancelQuestTimer("SPAWN_MINION", npc, null); - startQuestTimer("CLEAR_ZONE", 900000, null, null); - setStatus(DEAD); - } - else - { - _minionCount--; - } - } - return super.onKill(npc, killer, isSummon); - } - - @Override - public void onMoveFinished(Npc npc) - { - npc.doCast(DISPEL_BOM.getSkill()); - npc.doDie(null); - } - - @Override - public String onSpawn(Npc npc) - { - if (npc.getId() == ANTHARAS) - { - cancelQuestTimer("SET_REGEN", npc, null); - startQuestTimer("SET_REGEN", 60000, npc, null); - ((Attackable) npc).setOnKillDelay(0); - } - else - { - for (int i = 1; i <= 6; i++) - { - final int x = npc.getTemplate().getParameters().getInt("suicide" + i + "_x"); - final int y = npc.getTemplate().getParameters().getInt("suicide" + i + "_y"); - final Attackable bomber = (Attackable) addSpawn(BOMBER, npc.getX(), npc.getY(), npc.getZ(), 0, true, 15000, true); - bomber.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(x, y, npc.getZ())); - } - npc.deleteMe(); - } - return super.onSpawn(npc); - } - - @Override - public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill) - { - if ((skill.getId() == ANTH_FEAR.getSkillId()) || (skill.getId() == ANTH_FEAR_SHORT.getSkillId())) - { - startQuestTimer("TID_USED_FEAR", 7000, npc, null); - } - startQuestTimer("MANAGE_SKILL", 1000, npc, null); - return super.onSpellFinished(npc, player, skill); - } - - @Override - public boolean unload(boolean removeFromList) - { - if (_antharas != null) - { - _antharas.deleteMe(); - _antharas = null; - } - return super.unload(removeFromList); - } - - private int getStatus() - { - return GrandBossManager.getInstance().getBossStatus(ANTHARAS); - } - - private void addBoss(GrandBossInstance grandboss) - { - GrandBossManager.getInstance().addBoss(grandboss); - } - - private void setStatus(int status) - { - GrandBossManager.getInstance().setBossStatus(ANTHARAS, status); - } - - private void setRespawn(long respawnTime) - { - GrandBossManager.getInstance().getStatsSet(ANTHARAS).set("respawn_time", System.currentTimeMillis() + respawnTime); - } - - private final void refreshAiParams(PlayerInstance attacker, int damage) - { - if ((attacker_1 != null) && (attacker == attacker_1)) - { - if (attacker_1_hate < (damage + 1000)) - { - attacker_1_hate = damage + getRandom(3000); - } - } - else if ((attacker_2 != null) && (attacker == attacker_2)) - { - if (attacker_2_hate < (damage + 1000)) - { - attacker_2_hate = damage + getRandom(3000); - } - } - else if ((attacker_3 != null) && (attacker == attacker_3)) - { - if (attacker_3_hate < (damage + 1000)) - { - attacker_3_hate = damage + getRandom(3000); - } - } - else - { - final int i1 = Util.min(attacker_1_hate, attacker_2_hate, attacker_3_hate); - if (attacker_1_hate == i1) - { - attacker_1_hate = damage + getRandom(3000); - attacker_1 = attacker; - } - else if (attacker_2_hate == i1) - { - attacker_2_hate = damage + getRandom(3000); - attacker_2 = attacker; - } - else if (attacker_3_hate == i1) - { - attacker_3_hate = damage + getRandom(3000); - attacker_3 = attacker; - } - } - } - - private void manageSkills(Npc npc) - { - if (npc.isCastingNow() || npc.isCoreAIDisabled() || !npc.isInCombat()) - { - return; - } - - int i1 = 0; - int i2 = 0; - PlayerInstance c2 = null; - if ((attacker_1 == null) || (npc.calculateDistance3D(attacker_1) > 9000) || attacker_1.isDead()) - { - attacker_1_hate = 0; - } - - if ((attacker_2 == null) || (npc.calculateDistance3D(attacker_2) > 9000) || attacker_2.isDead()) - { - attacker_2_hate = 0; - } - - if ((attacker_3 == null) || (npc.calculateDistance3D(attacker_3) > 9000) || attacker_3.isDead()) - { - attacker_3_hate = 0; - } - - if (attacker_1_hate > attacker_2_hate) - { - i1 = 2; - i2 = attacker_1_hate; - c2 = attacker_1; - } - else if (attacker_2_hate > 0) - { - i1 = 3; - i2 = attacker_2_hate; - c2 = attacker_2; - } - - if (attacker_3_hate > i2) - { - i1 = 4; - i2 = attacker_3_hate; - c2 = attacker_3; - } - if (i2 > 0) - { - if (getRandom(100) < 70) - { - switch (i1) - { - case 2: - { - attacker_1_hate = 500; - break; - } - case 3: - { - attacker_2_hate = 500; - break; - } - case 4: - { - attacker_3_hate = 500; - break; - } - } - } - - final double distance_c2 = npc.calculateDistance3D(c2); - final double direction_c2 = npc.calculateDirectionTo(c2); - - SkillHolder skillToCast = null; - if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) - { - if (getRandom(100) < 30) - { - npc.setTarget(c2); - skillToCast = ANTH_MOUTH; - } - else if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) - { - skillToCast = ANTH_TAIL; - } - else if ((getRandom(100) < 40) && (((distance_c2 < 850) && (direction_c2 < 210) && (direction_c2 > 150)) || ((distance_c2 < 425) && (direction_c2 < 270) && (direction_c2 > 90)))) - { - skillToCast = ANTH_DEBUFF; - } - else if ((getRandom(100) < 10) && (distance_c2 < 1100)) - { - skillToCast = ANTH_JUMP; - } - else if (getRandom(100) < 10) - { - npc.setTarget(c2); - skillToCast = ANTH_METEOR; - } - else if (getRandom(100) < 6) - { - npc.setTarget(c2); - skillToCast = ANTH_BREATH; - } - else if (getRandomBoolean()) - { - npc.setTarget(c2); - skillToCast = ANTH_NORM_ATTACK_EX; - } - else if (getRandom(100) < 5) - { - npc.setTarget(c2); - skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; - } - else - { - npc.setTarget(c2); - skillToCast = ANTH_NORM_ATTACK; - } - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) - { - if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) - { - skillToCast = ANTH_TAIL; - } - else if ((getRandom(100) < 40) && (((distance_c2 < 850) && (direction_c2 < 210) && (direction_c2 > 150)) || ((distance_c2 < 425) && (direction_c2 < 270) && (direction_c2 > 90)))) - { - skillToCast = ANTH_DEBUFF; - } - else if ((getRandom(100) < 10) && (distance_c2 < 1100)) - { - skillToCast = ANTH_JUMP; - } - else if (getRandom(100) < 7) - { - npc.setTarget(c2); - skillToCast = ANTH_METEOR; - } - else if (getRandom(100) < 6) - { - npc.setTarget(c2); - skillToCast = ANTH_BREATH; - } - else if (getRandomBoolean()) - { - npc.setTarget(c2); - skillToCast = ANTH_NORM_ATTACK_EX; - } - else if (getRandom(100) < 5) - { - npc.setTarget(c2); - skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; - } - else - { - npc.setTarget(c2); - skillToCast = ANTH_NORM_ATTACK; - } - } - else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) - { - if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) - { - skillToCast = ANTH_TAIL; - } - else if ((getRandom(100) < 10) && (distance_c2 < 1100)) - { - skillToCast = ANTH_JUMP; - } - else if (getRandom(100) < 5) - { - npc.setTarget(c2); - skillToCast = ANTH_METEOR; - } - else if (getRandom(100) < 6) - { - npc.setTarget(c2); - skillToCast = ANTH_BREATH; - } - else if (getRandomBoolean()) - { - npc.setTarget(c2); - skillToCast = ANTH_NORM_ATTACK_EX; - } - else if (getRandom(100) < 5) - { - npc.setTarget(c2); - skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; - } - else - { - npc.setTarget(c2); - skillToCast = ANTH_NORM_ATTACK; - } - } - else if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) - { - skillToCast = ANTH_TAIL; - } - else if (getRandom(100) < 3) - { - npc.setTarget(c2); - skillToCast = ANTH_METEOR; - } - else if (getRandom(100) < 6) - { - npc.setTarget(c2); - skillToCast = ANTH_BREATH; - } - else if (getRandomBoolean()) - { - npc.setTarget(c2); - skillToCast = ANTH_NORM_ATTACK_EX; - } - else if (getRandom(100) < 5) - { - npc.setTarget(c2); - skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; - } - else - { - npc.setTarget(c2); - skillToCast = ANTH_NORM_ATTACK; - } - - if ((skillToCast != null) && npc.checkDoCastConditions(skillToCast.getSkill())) - { - npc.doCast(skillToCast.getSkill()); - } - } - } - - public static void main(String[] args) - { - new Antharas(); - } + static + { + INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); // antaras_clear_npc_1 + INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); // antaras_clear_npc_2 + INVISIBLE_NPC.put(29079, new Location(176385, 113889, -7735)); // antaras_clear_npc_3 + INVISIBLE_NPC.put(29080, new Location(176082, 114241, -7735)); // antaras_clear_npc_4 + INVISIBLE_NPC.put(29081, new Location(176066, 114802, -7735)); // antaras_clear_npc_5 + INVISIBLE_NPC.put(29082, new Location(176095, 115313, -7735)); // antaras_clear_npc_6 + INVISIBLE_NPC.put(29083, new Location(176425, 115829, -7735)); // antaras_clear_npc_7 + INVISIBLE_NPC.put(29084, new Location(176949, 116378, -7735)); // antaras_clear_npc_8 + INVISIBLE_NPC.put(29085, new Location(177655, 116402, -7735)); // antaras_clear_npc_9 + INVISIBLE_NPC.put(29086, new Location(178248, 116395, -7735)); // antaras_clear_npc_10 + INVISIBLE_NPC.put(29087, new Location(178706, 115998, -7735)); // antaras_clear_npc_11 + INVISIBLE_NPC.put(29088, new Location(179208, 115452, -7735)); // antaras_clear_npc_12 + INVISIBLE_NPC.put(29089, new Location(179191, 115079, -7735)); // antaras_clear_npc_13 + INVISIBLE_NPC.put(29090, new Location(179221, 114546, -7735)); // antaras_clear_npc_14 + INVISIBLE_NPC.put(29091, new Location(178916, 113925, -7735)); // antaras_clear_npc_15 + INVISIBLE_NPC.put(29092, new Location(178782, 113814, -7735)); // antaras_clear_npc_16 + INVISIBLE_NPC.put(29093, new Location(178419, 113417, -7735)); // antaras_clear_npc_17 + INVISIBLE_NPC.put(29094, new Location(177855, 113282, -7735)); // antaras_clear_npc_18 + } + // Item + private static final int STONE = 3865; // Portal Stone + // Skill + private static final SkillHolder ANTH_JUMP = new SkillHolder(4106, 1); // Antharas Stun + private static final SkillHolder ANTH_TAIL = new SkillHolder(4107, 1); // Antharas Stun + private static final SkillHolder ANTH_FEAR = new SkillHolder(4108, 1); // Antharas Terror + private static final SkillHolder ANTH_DEBUFF = new SkillHolder(4109, 1); // Curse of Antharas + private static final SkillHolder ANTH_MOUTH = new SkillHolder(4110, 2); // Breath Attack + private static final SkillHolder ANTH_BREATH = new SkillHolder(4111, 1); // Antharas Fossilization + private static final SkillHolder ANTH_NORM_ATTACK = new SkillHolder(4112, 1); // Ordinary Attack + private static final SkillHolder ANTH_NORM_ATTACK_EX = new SkillHolder(4113, 1); // Animal doing ordinary attack + private static final SkillHolder ANTH_REGEN_1 = new SkillHolder(4125, 1); // Antharas Regeneration + private static final SkillHolder ANTH_REGEN_2 = new SkillHolder(4239, 1); // Antharas Regeneration + private static final SkillHolder ANTH_REGEN_3 = new SkillHolder(4240, 1); // Antharas Regeneration + private static final SkillHolder ANTH_REGEN_4 = new SkillHolder(4241, 1); // Antharas Regeneration + private static final SkillHolder DISPEL_BOM = new SkillHolder(5042, 1); // NPC Dispel Bomb + private static final SkillHolder ANTH_ANTI_STRIDER = new SkillHolder(4258, 1); // Hinder Strider + private static final SkillHolder ANTH_FEAR_SHORT = new SkillHolder(5092, 1); // Antharas Terror + private static final SkillHolder ANTH_METEOR = new SkillHolder(5093, 1); // Antharas Meteor + // Zone + private static final NoRestartZone zone = ZoneManager.getInstance().getZoneById(70050, NoRestartZone.class); // Antharas Nest zone + // Status + private static final int ALIVE = 0; + private static final int WAITING = 1; + private static final int IN_FIGHT = 2; + private static final int DEAD = 3; + // Misc + private static final int MAX_PEOPLE = 200; // Max allowed players + private GrandBossInstance _antharas = null; + private static long _lastAttack = 0; + private static int _minionCount = 0; + private static int minionMultipler = 0; + private static int moveChance = 0; + private static int sandStorm = 0; + private static PlayerInstance attacker_1 = null; + private static PlayerInstance attacker_2 = null; + private static PlayerInstance attacker_3 = null; + private static int attacker_1_hate = 0; + private static int attacker_2_hate = 0; + private static int attacker_3_hate = 0; + + private Antharas() + { + addStartNpc(HEART, CUBE); + addTalkId(HEART, CUBE); + addFirstTalkId(HEART); + addSpawnId(INVISIBLE_NPC.keySet()); + addSpawnId(ANTHARAS); + addMoveFinishedId(BOMBER); + addAggroRangeEnterId(BOMBER); + addSpellFinishedId(ANTHARAS); + addAttackId(ANTHARAS, BOMBER, BEHEMOTH, TERASQUE); + addKillId(ANTHARAS, TERASQUE, BEHEMOTH); + + final StatsSet info = GrandBossManager.getInstance().getStatsSet(ANTHARAS); + final double curr_hp = info.getDouble("currentHP"); + final double curr_mp = info.getDouble("currentMP"); + final int loc_x = info.getInt("loc_x"); + final int loc_y = info.getInt("loc_y"); + final int loc_z = info.getInt("loc_z"); + final int heading = info.getInt("heading"); + final long respawnTime = info.getLong("respawn_time"); + + switch (getStatus()) + { + case ALIVE: + { + _antharas = (GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); + _antharas.setCurrentHpMp(curr_hp, curr_mp); + addBoss(_antharas); + break; + } + case WAITING: + { + _antharas = (GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); + _antharas.setCurrentHpMp(curr_hp, curr_mp); + addBoss(_antharas); + startQuestTimer("SPAWN_ANTHARAS", Config.ANTHARAS_WAIT_TIME * 60000, null, null); + break; + } + case IN_FIGHT: + { + _antharas = (GrandBossInstance) addSpawn(ANTHARAS, loc_x, loc_y, loc_z, heading, false, 0); + _antharas.setCurrentHpMp(curr_hp, curr_mp); + addBoss(_antharas); + _lastAttack = System.currentTimeMillis(); + startQuestTimer("CHECK_ATTACK", 60000, _antharas, null); + startQuestTimer("SPAWN_MINION", 300000, _antharas, null); + break; + } + case DEAD: + { + final long remain = respawnTime - System.currentTimeMillis(); + if (remain > 0) + { + startQuestTimer("CLEAR_STATUS", remain, null, null); + } + else + { + setStatus(ALIVE); + _antharas = (GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); + addBoss(_antharas); + } + break; + } + } + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + switch (event) + { + case "enter": + { + String htmltext = null; + if (getStatus() == DEAD) + { + htmltext = "13001-01.html"; + } + else if (getStatus() == IN_FIGHT) + { + htmltext = "13001-02.html"; + } + else if (zone.getPlayersInside().size() >= MAX_PEOPLE) + { + htmltext = "13001-04.html"; + } + else if (player.isInParty()) + { + final Party party = player.getParty(); + final boolean isInCC = party.isInCommandChannel(); + final List members = isInCC ? party.getCommandChannel().getMembers() : party.getMembers(); + final boolean isPartyLeader = isInCC ? party.getCommandChannel().isLeader(player) : party.isLeader(player); + if (!isPartyLeader) + { + htmltext = "13001-05.html"; + } + else if (!hasQuestItems(player, STONE)) + { + htmltext = "13001-03.html"; + } + else if (members.size() > (MAX_PEOPLE - zone.getPlayersInside().size())) + { + htmltext = "13001-04.html"; + } + else + { + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, 1000)) + { + member.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709); + } + } + if (getStatus() != WAITING) + { + setStatus(WAITING); + startQuestTimer("SPAWN_ANTHARAS", Config.ANTHARAS_WAIT_TIME * 60000, null, null); + } + } + } + else if (!hasQuestItems(player, STONE)) + { + htmltext = "13001-03.html"; + } + else + { + player.teleToLocation(179700 + getRandom(700), 113800 + getRandom(2100), -7709); + if (getStatus() != WAITING) + { + setStatus(WAITING); + startQuestTimer("SPAWN_ANTHARAS", Config.ANTHARAS_WAIT_TIME * 60000, null, null); + } + } + return htmltext; + } + case "teleportOut": + { + player.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); + break; + } + case "SPAWN_ANTHARAS": + { + _antharas.teleToLocation(181323, 114850, -7623, 32542); + setStatus(IN_FIGHT); + _lastAttack = System.currentTimeMillis(); + zone.broadcastPacket(new PlaySound("BS02_A")); + startQuestTimer("CAMERA_1", 23, _antharas, null); + break; + } + case "CAMERA_1": + { + zone.broadcastPacket(new SpecialCamera(npc, 700, 13, -19, 0, 10000, 20000, 0, 0, 0, 0, 0)); + startQuestTimer("CAMERA_2", 3000, npc, null); + break; + } + case "CAMERA_2": + { + zone.broadcastPacket(new SpecialCamera(npc, 700, 13, 0, 6000, 10000, 20000, 0, 0, 0, 0, 0)); + startQuestTimer("CAMERA_3", 10000, npc, null); + break; + } + case "CAMERA_3": + { + zone.broadcastPacket(new SpecialCamera(npc, 3700, 0, -3, 0, 10000, 10000, 0, 0, 0, 0, 0)); + zone.broadcastPacket(new SocialAction(npc.getObjectId(), 1)); + startQuestTimer("CAMERA_4", 200, npc, null); + startQuestTimer("SOCIAL", 5200, npc, null); + break; + } + case "CAMERA_4": + { + zone.broadcastPacket(new SpecialCamera(npc, 1100, 0, -3, 22000, 10000, 30000, 0, 0, 0, 0, 0)); + startQuestTimer("CAMERA_5", 10800, npc, null); + break; + } + case "CAMERA_5": + { + zone.broadcastPacket(new SpecialCamera(npc, 1100, 0, -3, 300, 10000, 7000, 0, 0, 0, 0, 0)); + startQuestTimer("START_MOVE", 1900, npc, null); + break; + } + case "SOCIAL": + { + zone.broadcastPacket(new SocialAction(npc.getObjectId(), 2)); + break; + } + case "START_MOVE": + { + for (PlayerInstance players : World.getInstance().getVisibleObjectsInRange(npc, PlayerInstance.class, 4000)) + { + if (players.isHero()) + { + zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_YOU_CANNOT_HOPE_TO_DEFEAT_ME_WITH_YOUR_MEAGER_STRENGTH, 2, 4000, players.getName())); + break; + } + } + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(179011, 114871, -7704)); + startQuestTimer("CHECK_ATTACK", 60000, npc, null); + startQuestTimer("SPAWN_MINION", 300000, npc, null); + break; + } + case "SET_REGEN": + { + if (npc != null) + { + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) + { + if (!npc.isAffectedBySkill(ANTH_REGEN_4.getSkillId())) + { + npc.doCast(ANTH_REGEN_4.getSkill()); + } + } + else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) + { + if (!npc.isAffectedBySkill(ANTH_REGEN_3.getSkillId())) + { + npc.doCast(ANTH_REGEN_3.getSkill()); + } + } + else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) + { + if (!npc.isAffectedBySkill(ANTH_REGEN_2.getSkillId())) + { + npc.doCast(ANTH_REGEN_2.getSkill()); + } + } + else if (!npc.isAffectedBySkill(ANTH_REGEN_1.getSkillId())) + { + npc.doCast(ANTH_REGEN_1.getSkill()); + } + startQuestTimer("SET_REGEN", 60000, npc, null); + } + break; + } + case "CHECK_ATTACK": + { + if ((npc != null) && ((_lastAttack + 900000) < System.currentTimeMillis())) + { + setStatus(ALIVE); + for (Creature creature : zone.getCharactersInside()) + { + if (creature != null) + { + if (creature.isNpc()) + { + if (creature.getId() == ANTHARAS) + { + creature.teleToLocation(185708, 114298, -8221); + } + else + { + creature.deleteMe(); + } + } + else if (creature.isPlayer()) + { + creature.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); + } + } + } + cancelQuestTimer("CHECK_ATTACK", npc, null); + cancelQuestTimer("SPAWN_MINION", npc, null); + } + else if (npc != null) + { + if (attacker_1_hate > 10) + { + attacker_1_hate -= getRandom(10); + } + if (attacker_2_hate > 10) + { + attacker_2_hate -= getRandom(10); + } + if (attacker_3_hate > 10) + { + attacker_3_hate -= getRandom(10); + } + manageSkills(npc); + startQuestTimer("CHECK_ATTACK", 60000, npc, null); + } + break; + } + case "SPAWN_MINION": + { + if ((minionMultipler > 1) && (_minionCount < (100 - (minionMultipler * 2)))) + { + for (int i = 0; i < minionMultipler; i++) + { + addSpawn(BEHEMOTH, npc, true); + addSpawn(TERASQUE, npc, true); + } + _minionCount += minionMultipler * 2; + } + else if (_minionCount < 98) + { + addSpawn(BEHEMOTH, npc, true); + addSpawn(TERASQUE, npc, true); + _minionCount += 2; + } + else if (_minionCount < 99) + { + addSpawn(getRandomBoolean() ? BEHEMOTH : TERASQUE, npc, true); + _minionCount++; + } + + if ((getRandom(100) > 10) && (minionMultipler < 4)) + { + minionMultipler++; + } + startQuestTimer("SPAWN_MINION", 300000, npc, null); + break; + } + case "CLEAR_ZONE": + { + for (Creature creature : zone.getCharactersInside()) + { + if (creature != null) + { + if (creature.isNpc()) + { + creature.deleteMe(); + } + else if (creature.isPlayer()) + { + creature.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); + } + } + } + break; + } + case "TID_USED_FEAR": + { + if ((npc != null) && (sandStorm == 0)) + { + sandStorm = 1; + npc.disableCoreAI(true); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(177648, 114816, -7735)); + startQuestTimer("TID_FEAR_MOVE_TIMEOVER", 2000, npc, null); + startQuestTimer("TID_FEAR_COOLTIME", 300000, npc, null); + } + break; + } + case "TID_FEAR_COOLTIME": + { + sandStorm = 0; + break; + } + case "TID_FEAR_MOVE_TIMEOVER": + { + if ((sandStorm == 1) && (npc.getX() == 177648) && (npc.getY() == 114816)) + { + sandStorm = 2; + moveChance = 0; + npc.disableCoreAI(false); + INVISIBLE_NPC.entrySet().forEach(entry -> addSpawn(entry.getKey(), entry.getValue())); + } + else if (sandStorm == 1) + { + if (moveChance <= 3) + { + moveChance++; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(177648, 114816, -7735)); + startQuestTimer("TID_FEAR_MOVE_TIMEOVER", 5000, npc, null); + } + else + { + npc.teleToLocation(177648, 114816, -7735, npc.getHeading()); + startQuestTimer("TID_FEAR_MOVE_TIMEOVER", 1000, npc, null); + } + } + break; + } + case "CLEAR_STATUS": + { + _antharas = (GrandBossInstance) addSpawn(ANTHARAS, 185708, 114298, -8221, 0, false, 0); + addBoss(_antharas); + Broadcast.toAllOnlinePlayers(new Earthquake(185708, 114298, -8221, 20, 10)); + setStatus(ALIVE); + break; + } + case "SKIP_WAITING": + { + if (getStatus() == WAITING) + { + cancelQuestTimer("SPAWN_ANTHARAS", null, null); + notifyEvent("SPAWN_ANTHARAS", null, null); + player.sendMessage(getClass().getSimpleName() + ": Skipping waiting time ..."); + } + else + { + player.sendMessage(getClass().getSimpleName() + ": You can't skip waiting time right now!"); + } + break; + } + case "RESPAWN_ANTHARAS": + { + if (getStatus() == DEAD) + { + setRespawn(0); + cancelQuestTimer("CLEAR_STATUS", null, null); + notifyEvent("CLEAR_STATUS", null, null); + player.sendMessage(getClass().getSimpleName() + ": Antharas has been respawned."); + } + else + { + player.sendMessage(getClass().getSimpleName() + ": You can't respawn antharas while antharas is alive!"); + } + break; + } + case "DESPAWN_MINIONS": + { + if (getStatus() == IN_FIGHT) + { + _minionCount = 0; + for (Creature creature : zone.getCharactersInside()) + { + if ((creature != null) && creature.isNpc() && ((creature.getId() == BEHEMOTH) || (creature.getId() == TERASQUE))) + { + creature.deleteMe(); + } + } + if (player != null) // Player dont will be null just when is this event called from GM command + { + player.sendMessage(getClass().getSimpleName() + ": All minions have been deleted!"); + } + } + else if (player != null) // Player dont will be null just when is this event called from GM command + { + player.sendMessage(getClass().getSimpleName() + ": You can't despawn minions right now!"); + } + break; + } + case "ABORT_FIGHT": + { + if (getStatus() == IN_FIGHT) + { + setStatus(ALIVE); + cancelQuestTimer("CHECK_ATTACK", _antharas, null); + cancelQuestTimer("SPAWN_MINION", _antharas, null); + for (Creature creature : zone.getCharactersInside()) + { + if (creature != null) + { + if (creature.isNpc()) + { + if (creature.getId() == ANTHARAS) + { + creature.teleToLocation(185708, 114298, -8221); + } + else + { + creature.deleteMe(); + } + } + else if (creature.isPlayer() && !creature.isGM()) + { + creature.teleToLocation(79800 + getRandom(600), 151200 + getRandom(1100), -3534); + } + } + } + player.sendMessage(getClass().getSimpleName() + ": Fight has been aborted!"); + } + else + { + player.sendMessage(getClass().getSimpleName() + ": You can't abort fight right now!"); + } + break; + } + case "MANAGE_SKILL": + { + manageSkills(npc); + break; + } + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAggroRangeEnter(Npc npc, PlayerInstance player, boolean isSummon) + { + npc.doCast(DISPEL_BOM.getSkill()); + npc.doDie(player); + return super.onAggroRangeEnter(npc, player, isSummon); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + _lastAttack = System.currentTimeMillis(); + + if (npc.getId() == BOMBER) + { + if (npc.calculateDistance3D(attacker) < 230) + { + npc.doCast(DISPEL_BOM.getSkill()); + npc.doDie(attacker); + } + } + else if (npc.getId() == ANTHARAS) + { + if (!zone.isCharacterInZone(attacker) || (getStatus() != IN_FIGHT)) + { + LOGGER.warning(getClass().getSimpleName() + ": Player " + attacker.getName() + " attacked Antharas in invalid conditions!"); + attacker.teleToLocation(80464, 152294, -3534); + } + + if ((attacker.getMountType() == MountType.STRIDER) && !attacker.isAffectedBySkill(ANTH_ANTI_STRIDER.getSkillId()) && npc.checkDoCastConditions(ANTH_ANTI_STRIDER.getSkill())) + { + npc.setTarget(attacker); + npc.doCast(ANTH_ANTI_STRIDER.getSkill()); + } + + if (skill == null) + { + refreshAiParams(attacker, damage * 1000); + } + else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) + { + refreshAiParams(attacker, (damage / 3) * 100); + } + else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) + { + refreshAiParams(attacker, damage * 20); + } + else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) + { + refreshAiParams(attacker, damage * 10); + } + else + { + refreshAiParams(attacker, (damage / 3) * 20); + } + manageSkills(npc); + } + return super.onAttack(npc, attacker, damage, isSummon, skill); + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + if (zone.isCharacterInZone(killer)) + { + if (npc.getId() == ANTHARAS) + { + _antharas = null; + notifyEvent("DESPAWN_MINIONS", null, null); + zone.broadcastPacket(new SpecialCamera(npc, 1200, 20, -10, 0, 10000, 13000, 0, 0, 0, 0, 0)); + zone.broadcastPacket(new PlaySound("BS01_D")); + addSpawn(CUBE, 177615, 114941, -7709, 0, false, 900000); + final long respawnTime = (Config.ANTHARAS_SPAWN_INTERVAL + getRandom(-Config.ANTHARAS_SPAWN_RANDOM, Config.ANTHARAS_SPAWN_RANDOM)) * 3600000; + setRespawn(respawnTime); + startQuestTimer("CLEAR_STATUS", respawnTime, null, null); + cancelQuestTimer("SET_REGEN", npc, null); + cancelQuestTimer("CHECK_ATTACK", npc, null); + cancelQuestTimer("SPAWN_MINION", npc, null); + startQuestTimer("CLEAR_ZONE", 900000, null, null); + setStatus(DEAD); + } + else + { + _minionCount--; + } + } + return super.onKill(npc, killer, isSummon); + } + + @Override + public void onMoveFinished(Npc npc) + { + npc.doCast(DISPEL_BOM.getSkill()); + npc.doDie(null); + } + + @Override + public String onSpawn(Npc npc) + { + if (npc.getId() == ANTHARAS) + { + cancelQuestTimer("SET_REGEN", npc, null); + startQuestTimer("SET_REGEN", 60000, npc, null); + ((Attackable) npc).setOnKillDelay(0); + } + else + { + for (int i = 1; i <= 6; i++) + { + final int x = npc.getTemplate().getParameters().getInt("suicide" + i + "_x"); + final int y = npc.getTemplate().getParameters().getInt("suicide" + i + "_y"); + final Attackable bomber = (Attackable) addSpawn(BOMBER, npc.getX(), npc.getY(), npc.getZ(), 0, true, 15000, true); + bomber.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(x, y, npc.getZ())); + } + npc.deleteMe(); + } + return super.onSpawn(npc); + } + + @Override + public String onSpellFinished(Npc npc, PlayerInstance player, Skill skill) + { + if ((skill.getId() == ANTH_FEAR.getSkillId()) || (skill.getId() == ANTH_FEAR_SHORT.getSkillId())) + { + startQuestTimer("TID_USED_FEAR", 7000, npc, null); + } + startQuestTimer("MANAGE_SKILL", 1000, npc, null); + return super.onSpellFinished(npc, player, skill); + } + + @Override + public boolean unload(boolean removeFromList) + { + if (_antharas != null) + { + _antharas.deleteMe(); + _antharas = null; + } + return super.unload(removeFromList); + } + + private int getStatus() + { + return GrandBossManager.getInstance().getBossStatus(ANTHARAS); + } + + private void addBoss(GrandBossInstance grandboss) + { + GrandBossManager.getInstance().addBoss(grandboss); + } + + private void setStatus(int status) + { + GrandBossManager.getInstance().setBossStatus(ANTHARAS, status); + } + + private void setRespawn(long respawnTime) + { + GrandBossManager.getInstance().getStatsSet(ANTHARAS).set("respawn_time", System.currentTimeMillis() + respawnTime); + } + + private final void refreshAiParams(PlayerInstance attacker, int damage) + { + if ((attacker_1 != null) && (attacker == attacker_1)) + { + if (attacker_1_hate < (damage + 1000)) + { + attacker_1_hate = damage + getRandom(3000); + } + } + else if ((attacker_2 != null) && (attacker == attacker_2)) + { + if (attacker_2_hate < (damage + 1000)) + { + attacker_2_hate = damage + getRandom(3000); + } + } + else if ((attacker_3 != null) && (attacker == attacker_3)) + { + if (attacker_3_hate < (damage + 1000)) + { + attacker_3_hate = damage + getRandom(3000); + } + } + else + { + final int i1 = Util.min(attacker_1_hate, attacker_2_hate, attacker_3_hate); + if (attacker_1_hate == i1) + { + attacker_1_hate = damage + getRandom(3000); + attacker_1 = attacker; + } + else if (attacker_2_hate == i1) + { + attacker_2_hate = damage + getRandom(3000); + attacker_2 = attacker; + } + else if (attacker_3_hate == i1) + { + attacker_3_hate = damage + getRandom(3000); + attacker_3 = attacker; + } + } + } + + private void manageSkills(Npc npc) + { + if (npc.isCastingNow() || npc.isCoreAIDisabled() || !npc.isInCombat()) + { + return; + } + + int i1 = 0; + int i2 = 0; + PlayerInstance c2 = null; + if ((attacker_1 == null) || (npc.calculateDistance3D(attacker_1) > 9000) || attacker_1.isDead()) + { + attacker_1_hate = 0; + } + + if ((attacker_2 == null) || (npc.calculateDistance3D(attacker_2) > 9000) || attacker_2.isDead()) + { + attacker_2_hate = 0; + } + + if ((attacker_3 == null) || (npc.calculateDistance3D(attacker_3) > 9000) || attacker_3.isDead()) + { + attacker_3_hate = 0; + } + + if (attacker_1_hate > attacker_2_hate) + { + i1 = 2; + i2 = attacker_1_hate; + c2 = attacker_1; + } + else if (attacker_2_hate > 0) + { + i1 = 3; + i2 = attacker_2_hate; + c2 = attacker_2; + } + + if (attacker_3_hate > i2) + { + i1 = 4; + i2 = attacker_3_hate; + c2 = attacker_3; + } + if (i2 > 0) + { + if (getRandom(100) < 70) + { + switch (i1) + { + case 2: + { + attacker_1_hate = 500; + break; + } + case 3: + { + attacker_2_hate = 500; + break; + } + case 4: + { + attacker_3_hate = 500; + break; + } + } + } + + final double distance_c2 = npc.calculateDistance3D(c2); + final double direction_c2 = npc.calculateDirectionTo(c2); + + SkillHolder skillToCast = null; + if (npc.getCurrentHp() < (npc.getMaxHp() * 0.25)) + { + if (getRandom(100) < 30) + { + npc.setTarget(c2); + skillToCast = ANTH_MOUTH; + } + else if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) + { + skillToCast = ANTH_TAIL; + } + else if ((getRandom(100) < 40) && (((distance_c2 < 850) && (direction_c2 < 210) && (direction_c2 > 150)) || ((distance_c2 < 425) && (direction_c2 < 270) && (direction_c2 > 90)))) + { + skillToCast = ANTH_DEBUFF; + } + else if ((getRandom(100) < 10) && (distance_c2 < 1100)) + { + skillToCast = ANTH_JUMP; + } + else if (getRandom(100) < 10) + { + npc.setTarget(c2); + skillToCast = ANTH_METEOR; + } + else if (getRandom(100) < 6) + { + npc.setTarget(c2); + skillToCast = ANTH_BREATH; + } + else if (getRandomBoolean()) + { + npc.setTarget(c2); + skillToCast = ANTH_NORM_ATTACK_EX; + } + else if (getRandom(100) < 5) + { + npc.setTarget(c2); + skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; + } + else + { + npc.setTarget(c2); + skillToCast = ANTH_NORM_ATTACK; + } + } + else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)) + { + if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) + { + skillToCast = ANTH_TAIL; + } + else if ((getRandom(100) < 40) && (((distance_c2 < 850) && (direction_c2 < 210) && (direction_c2 > 150)) || ((distance_c2 < 425) && (direction_c2 < 270) && (direction_c2 > 90)))) + { + skillToCast = ANTH_DEBUFF; + } + else if ((getRandom(100) < 10) && (distance_c2 < 1100)) + { + skillToCast = ANTH_JUMP; + } + else if (getRandom(100) < 7) + { + npc.setTarget(c2); + skillToCast = ANTH_METEOR; + } + else if (getRandom(100) < 6) + { + npc.setTarget(c2); + skillToCast = ANTH_BREATH; + } + else if (getRandomBoolean()) + { + npc.setTarget(c2); + skillToCast = ANTH_NORM_ATTACK_EX; + } + else if (getRandom(100) < 5) + { + npc.setTarget(c2); + skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; + } + else + { + npc.setTarget(c2); + skillToCast = ANTH_NORM_ATTACK; + } + } + else if (npc.getCurrentHp() < (npc.getMaxHp() * 0.75)) + { + if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) + { + skillToCast = ANTH_TAIL; + } + else if ((getRandom(100) < 10) && (distance_c2 < 1100)) + { + skillToCast = ANTH_JUMP; + } + else if (getRandom(100) < 5) + { + npc.setTarget(c2); + skillToCast = ANTH_METEOR; + } + else if (getRandom(100) < 6) + { + npc.setTarget(c2); + skillToCast = ANTH_BREATH; + } + else if (getRandomBoolean()) + { + npc.setTarget(c2); + skillToCast = ANTH_NORM_ATTACK_EX; + } + else if (getRandom(100) < 5) + { + npc.setTarget(c2); + skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; + } + else + { + npc.setTarget(c2); + skillToCast = ANTH_NORM_ATTACK; + } + } + else if ((getRandom(100) < 80) && (((distance_c2 < 1423) && (direction_c2 < 188) && (direction_c2 > 172)) || ((distance_c2 < 802) && (direction_c2 < 194) && (direction_c2 > 166)))) + { + skillToCast = ANTH_TAIL; + } + else if (getRandom(100) < 3) + { + npc.setTarget(c2); + skillToCast = ANTH_METEOR; + } + else if (getRandom(100) < 6) + { + npc.setTarget(c2); + skillToCast = ANTH_BREATH; + } + else if (getRandomBoolean()) + { + npc.setTarget(c2); + skillToCast = ANTH_NORM_ATTACK_EX; + } + else if (getRandom(100) < 5) + { + npc.setTarget(c2); + skillToCast = getRandomBoolean() ? ANTH_FEAR : ANTH_FEAR_SHORT; + } + else + { + npc.setTarget(c2); + skillToCast = ANTH_NORM_ATTACK; + } + + if ((skillToCast != null) && npc.checkDoCastConditions(skillToCast.getSkill())) + { + npc.doCast(skillToCast.getSkill()); + } + } + } + + public static void main(String[] args) + { + new Antharas(); + } } \ No newline at end of file diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Core/Core.java index 2215b0a6a9..8699cb7407 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -1,237 +1,238 @@ -/* - * 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 . - */ -package ai.bosses.Core; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.CopyOnWriteArrayList; - -import com.l2jmobius.Config; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager; -import com.l2jmobius.gameserver.instancemanager.GrandBossManager; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.actor.Attackable; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.GrandBossInstance; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; -import com.l2jmobius.gameserver.network.serverpackets.PlaySound; - -import ai.AbstractNpcAI; - -/** - * Core AI. - * @author DrLecter, Emperorc, Mobius - */ -public final class Core extends AbstractNpcAI -{ - // NPCs - private static final int CORE = 29006; - private static final int DEATH_KNIGHT = 29007; - private static final int DOOM_WRAITH = 29008; - private static final int SUSCEPTOR = 29011; - // Spawns +/* + * 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 . + */ +package ai.bosses.Core; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.CopyOnWriteArrayList; + +import com.l2jmobius.Config; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager; +import com.l2jmobius.gameserver.instancemanager.GrandBossManager; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.Attackable; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.GrandBossInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; +import com.l2jmobius.gameserver.network.serverpackets.PlaySound; + +import ai.AbstractNpcAI; + +/** + * Core AI. + * @author DrLecter, Emperorc, Mobius + */ +public final class Core extends AbstractNpcAI +{ + // NPCs + private static final int CORE = 29006; + private static final int DEATH_KNIGHT = 29007; + private static final int DOOM_WRAITH = 29008; + private static final int SUSCEPTOR = 29011; + // Spawns private static final Map MINNION_SPAWNS = new HashMap<>(); - { - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17191, 109298, -6488)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17564, 109548, -6488)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17855, 109552, -6488)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18280, 109202, -6488)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18784, 109253, -6488)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18059, 108314, -6488)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17300, 108444, -6488)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17148, 110071, -6648)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18318, 110077, -6648)); - MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17726, 110391, -6648)); - MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17113, 110970, -6648)); - MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17496, 110880, -6648)); - MINNION_SPAWNS.put(DOOM_WRAITH, new Location(18061, 110990, -6648)); - MINNION_SPAWNS.put(DOOM_WRAITH, new Location(18384, 110698, -6648)); - MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17993, 111458, -6584)); - MINNION_SPAWNS.put(SUSCEPTOR, new Location(17297, 111470, -6584)); - MINNION_SPAWNS.put(SUSCEPTOR, new Location(17893, 110198, -6648)); - MINNION_SPAWNS.put(SUSCEPTOR, new Location(17706, 109423, -6488)); - MINNION_SPAWNS.put(SUSCEPTOR, new Location(17849, 109388, -6480)); - } - // Misc - private static final byte ALIVE = 0; - private static final byte DEAD = 1; - - private static boolean _firstAttacked; - - private static final List _minions = new CopyOnWriteArrayList<>(); - - private Core() - { - registerMobs(CORE, DEATH_KNIGHT, DOOM_WRAITH, SUSCEPTOR); - - _firstAttacked = false; - final StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE); - if (GrandBossManager.getInstance().getBossStatus(CORE) == DEAD) - { - // Load the unlock date and time for Core from DB. - final long temp = info.getLong("respawn_time") - System.currentTimeMillis(); - // If Core is locked until a certain time, mark it so and start the unlock timer the unlock time has not yet expired. - if (temp > 0) - { - startQuestTimer("core_unlock", temp, null, null); - } - else - { - // The time has already expired while the server was offline. Immediately spawn Core. - final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0); - GrandBossManager.getInstance().setBossStatus(CORE, ALIVE); - spawnBoss(core); - } - } - else - { - final boolean test = GlobalVariablesManager.getInstance().getBoolean("Core_Attacked", false); - if (test) - { - _firstAttacked = true; - } - final int loc_x = info.getInt("loc_x"); - final int loc_y = info.getInt("loc_y"); - final int loc_z = info.getInt("loc_z"); - final int heading = info.getInt("heading"); - final double hp = info.getDouble("currentHP"); - final double mp = info.getDouble("currentMP"); - final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, loc_x, loc_y, loc_z, heading, false, 0); - core.setCurrentHpMp(hp, mp); - spawnBoss(core); - } - } - - @Override - public void onSave() - { - GlobalVariablesManager.getInstance().set("Core_Attacked", _firstAttacked); - } - - public void spawnBoss(GrandBossInstance npc) - { - GrandBossManager.getInstance().addBoss(npc); - npc.broadcastPacket(new PlaySound(1, "BS01_A", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ())); - // Spawn minions - Attackable mob; - Location spawnLocation; - for (Entry spawn : MINNION_SPAWNS.entrySet()) - { - spawnLocation = spawn.getValue(); - mob = (Attackable) addSpawn(spawn.getKey(), spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ(), getRandom(61794), false, 0); - mob.setIsRaidMinion(true); - _minions.add(mob); - } - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - if (event.equalsIgnoreCase("core_unlock")) - { - final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0); - GrandBossManager.getInstance().setBossStatus(CORE, ALIVE); - spawnBoss(core); - } - else if (event.equalsIgnoreCase("spawn_minion")) - { - final Attackable mob = (Attackable) addSpawn(npc.getId(), npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0); - mob.setIsRaidMinion(true); - _minions.add(mob); - } - else if (event.equalsIgnoreCase("despawn_minions")) - { - _minions.forEach(m -> m.decayMe()); - _minions.clear(); - } - return super.onAdvEvent(event, npc, player); - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) - { - if (npc.getId() == CORE) - { - if (_firstAttacked) - { - if (getRandom(100) == 0) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.REMOVING_INTRUDERS)); - } - } - else - { - _firstAttacked = true; - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.A_NON_PERMITTED_TARGET_HAS_BEEN_DISCOVERED)); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.INTRUDER_REMOVAL_SYSTEM_INITIATED)); - } - } - return super.onAttack(npc, attacker, damage, isSummon); - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - if (npc.getId() == CORE) - { - final int objId = npc.getObjectId(); - npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, objId, npc.getX(), npc.getY(), npc.getZ())); - npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.A_FATAL_ERROR_HAS_OCCURRED)); - npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SYSTEM_IS_BEING_SHUT_DOWN)); - npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.EMPTY)); - _firstAttacked = false; - - GrandBossManager.getInstance().setBossStatus(CORE, DEAD); - // Calculate Min and Max respawn times randomly. - final long respawnTime = (Config.CORE_SPAWN_INTERVAL + getRandom(-Config.CORE_SPAWN_RANDOM, Config.CORE_SPAWN_RANDOM)) * 3600000; - startQuestTimer("core_unlock", respawnTime, null, null); - // Also save the respawn time so that the info is maintained past reboots. - final StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE); - info.set("respawn_time", System.currentTimeMillis() + respawnTime); - GrandBossManager.getInstance().setStatsSet(CORE, info); - startQuestTimer("despawn_minions", 20000, null, null); - cancelQuestTimers("spawn_minion"); - } - else if ((GrandBossManager.getInstance().getBossStatus(CORE) == ALIVE) && _minions.contains(npc)) - { - _minions.remove(npc); - startQuestTimer("spawn_minion", 60000, npc, null); - } - return super.onKill(npc, killer, isSummon); - } - - @Override - public String onSpawn(Npc npc) - { - if (npc.getId() == CORE) - { - npc.setIsImmobilized(true); - } - return super.onSpawn(npc); - } - - public static void main(String[] args) - { - new Core(); - } -} + static + { + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17191, 109298, -6488)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17564, 109548, -6488)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17855, 109552, -6488)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18280, 109202, -6488)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18784, 109253, -6488)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18059, 108314, -6488)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17300, 108444, -6488)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17148, 110071, -6648)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(18318, 110077, -6648)); + MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17726, 110391, -6648)); + MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17113, 110970, -6648)); + MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17496, 110880, -6648)); + MINNION_SPAWNS.put(DOOM_WRAITH, new Location(18061, 110990, -6648)); + MINNION_SPAWNS.put(DOOM_WRAITH, new Location(18384, 110698, -6648)); + MINNION_SPAWNS.put(DOOM_WRAITH, new Location(17993, 111458, -6584)); + MINNION_SPAWNS.put(SUSCEPTOR, new Location(17297, 111470, -6584)); + MINNION_SPAWNS.put(SUSCEPTOR, new Location(17893, 110198, -6648)); + MINNION_SPAWNS.put(SUSCEPTOR, new Location(17706, 109423, -6488)); + MINNION_SPAWNS.put(SUSCEPTOR, new Location(17849, 109388, -6480)); + } + // Misc + private static final byte ALIVE = 0; + private static final byte DEAD = 1; + + private static boolean _firstAttacked; + + private static final List _minions = new CopyOnWriteArrayList<>(); + + private Core() + { + registerMobs(CORE, DEATH_KNIGHT, DOOM_WRAITH, SUSCEPTOR); + + _firstAttacked = false; + final StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE); + if (GrandBossManager.getInstance().getBossStatus(CORE) == DEAD) + { + // Load the unlock date and time for Core from DB. + final long temp = info.getLong("respawn_time") - System.currentTimeMillis(); + // If Core is locked until a certain time, mark it so and start the unlock timer the unlock time has not yet expired. + if (temp > 0) + { + startQuestTimer("core_unlock", temp, null, null); + } + else + { + // The time has already expired while the server was offline. Immediately spawn Core. + final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0); + GrandBossManager.getInstance().setBossStatus(CORE, ALIVE); + spawnBoss(core); + } + } + else + { + final boolean test = GlobalVariablesManager.getInstance().getBoolean("Core_Attacked", false); + if (test) + { + _firstAttacked = true; + } + final int loc_x = info.getInt("loc_x"); + final int loc_y = info.getInt("loc_y"); + final int loc_z = info.getInt("loc_z"); + final int heading = info.getInt("heading"); + final double hp = info.getDouble("currentHP"); + final double mp = info.getDouble("currentMP"); + final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, loc_x, loc_y, loc_z, heading, false, 0); + core.setCurrentHpMp(hp, mp); + spawnBoss(core); + } + } + + @Override + public void onSave() + { + GlobalVariablesManager.getInstance().set("Core_Attacked", _firstAttacked); + } + + public void spawnBoss(GrandBossInstance npc) + { + GrandBossManager.getInstance().addBoss(npc); + npc.broadcastPacket(new PlaySound(1, "BS01_A", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ())); + // Spawn minions + Attackable mob; + Location spawnLocation; + for (Entry spawn : MINNION_SPAWNS.entrySet()) + { + spawnLocation = spawn.getValue(); + mob = (Attackable) addSpawn(spawn.getKey(), spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ(), getRandom(61794), false, 0); + mob.setIsRaidMinion(true); + _minions.add(mob); + } + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if (event.equalsIgnoreCase("core_unlock")) + { + final GrandBossInstance core = (GrandBossInstance) addSpawn(CORE, 17726, 108915, -6480, 0, false, 0); + GrandBossManager.getInstance().setBossStatus(CORE, ALIVE); + spawnBoss(core); + } + else if (event.equalsIgnoreCase("spawn_minion")) + { + final Attackable mob = (Attackable) addSpawn(npc.getId(), npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0); + mob.setIsRaidMinion(true); + _minions.add(mob); + } + else if (event.equalsIgnoreCase("despawn_minions")) + { + _minions.forEach(m -> m.decayMe()); + _minions.clear(); + } + return super.onAdvEvent(event, npc, player); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) + { + if (npc.getId() == CORE) + { + if (_firstAttacked) + { + if (getRandom(100) == 0) + { + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.REMOVING_INTRUDERS)); + } + } + else + { + _firstAttacked = true; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.A_NON_PERMITTED_TARGET_HAS_BEEN_DISCOVERED)); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.INTRUDER_REMOVAL_SYSTEM_INITIATED)); + } + } + return super.onAttack(npc, attacker, damage, isSummon); + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + if (npc.getId() == CORE) + { + final int objId = npc.getObjectId(); + npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, objId, npc.getX(), npc.getY(), npc.getZ())); + npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.A_FATAL_ERROR_HAS_OCCURRED)); + npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SYSTEM_IS_BEING_SHUT_DOWN)); + npc.broadcastPacket(new NpcSay(objId, ChatType.NPC_GENERAL, npc.getId(), NpcStringId.EMPTY)); + _firstAttacked = false; + + GrandBossManager.getInstance().setBossStatus(CORE, DEAD); + // Calculate Min and Max respawn times randomly. + final long respawnTime = (Config.CORE_SPAWN_INTERVAL + getRandom(-Config.CORE_SPAWN_RANDOM, Config.CORE_SPAWN_RANDOM)) * 3600000; + startQuestTimer("core_unlock", respawnTime, null, null); + // Also save the respawn time so that the info is maintained past reboots. + final StatsSet info = GrandBossManager.getInstance().getStatsSet(CORE); + info.set("respawn_time", System.currentTimeMillis() + respawnTime); + GrandBossManager.getInstance().setStatsSet(CORE, info); + startQuestTimer("despawn_minions", 20000, null, null); + cancelQuestTimers("spawn_minion"); + } + else if ((GrandBossManager.getInstance().getBossStatus(CORE) == ALIVE) && _minions.contains(npc)) + { + _minions.remove(npc); + startQuestTimer("spawn_minion", 60000, npc, null); + } + return super.onKill(npc, killer, isSummon); + } + + @Override + public String onSpawn(Npc npc) + { + if (npc.getId() == CORE) + { + npc.setIsImmobilized(true); + } + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Core(); + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/DelusionTeleport/DelusionTeleport.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/DelusionTeleport/DelusionTeleport.java index 851e4085a9..d03f873190 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/DelusionTeleport/DelusionTeleport.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/DelusionTeleport/DelusionTeleport.java @@ -54,7 +54,6 @@ public final class DelusionTeleport extends AbstractNpcAI private static final String DELUSION_RETURN = "DELUSION_RETURN"; private static final Map RETURN_LOCATIONS = new HashMap<>(); - static { RETURN_LOCATIONS.put(0, new Location(43835, -47749, -792)); // Undefined origin, return to Rune diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/Selina/Selina.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/Selina/Selina.java index 7b2e8ca4a4..7b53a06ad7 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/Selina/Selina.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/Selina/Selina.java @@ -40,7 +40,6 @@ public final class Selina extends AbstractNpcAI private static final int GOLDEN_RAM_COIN = 7251; // Skills private static final Map BUFFS = new HashMap<>(); - static { BUFFS.put("4359", new BuffHolder(4359, 2, 2)); // Focus diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/events/L2Day/L2Day.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/events/L2Day/L2Day.java index d8a35f832b..48ccd6aafa 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/events/L2Day/L2Day.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/events/L2Day/L2Day.java @@ -1,257 +1,258 @@ -/* - * 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 . - */ -package events.L2Day; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.holders.QuestItemHolder; -import com.l2jmobius.gameserver.model.quest.LongTimeEvent; - -/** - * L2 Day event AI. - * @author Pandragon - */ -public final class L2Day extends LongTimeEvent -{ - // NPCs +/* + * 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 . + */ +package events.L2Day; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.holders.QuestItemHolder; +import com.l2jmobius.gameserver.model.quest.LongTimeEvent; + +/** + * L2 Day event AI. + * @author Pandragon + */ +public final class L2Day extends LongTimeEvent +{ + // NPCs private static final Map MANAGERS = new HashMap<>(); - { - MANAGERS.put(31854, 7117); // Talking Island Village - MANAGERS.put(31855, 7118); // Elven Village - MANAGERS.put(31856, 7119); // Dark Elven Village - MANAGERS.put(31857, 7121); // Dwarven Village - MANAGERS.put(31858, 7120); // Orc Village - } - // Items - private static final int A = 3875; - private static final int C = 3876; - private static final int E = 3877; - private static final int F = 3878; - private static final int G = 3879; - private static final int H = 3880; - private static final int I = 3881; - private static final int L = 3882; - private static final int N = 3883; - private static final int O = 3884; - private static final int R = 3885; - private static final int S = 3886; - private static final int T = 3887; - private static final int II = 3888; - // Rewards - private static final QuestItemHolder[] L2_REWARDS = - { - new QuestItemHolder(10260, 90, 3), // Alacrity Juice - new QuestItemHolder(10261, 85, 3), // Accuracy Juice - new QuestItemHolder(10262, 80, 3), // Critical Hit Juice - new QuestItemHolder(10263, 75, 3), // Critical Rate Juice - new QuestItemHolder(10264, 70, 3), // Casting Spd. Juice - new QuestItemHolder(10265, 65, 3), // Evasion Juice - new QuestItemHolder(10266, 60, 3), // M. Atk. Juice - new QuestItemHolder(10267, 55, 3), // Power Juice - new QuestItemHolder(10268, 50, 3), // Speed Juice - new QuestItemHolder(10269, 45, 3), // Defense Juice - new QuestItemHolder(10270, 40, 3), // MP Consumption Juice - new QuestItemHolder(9546, 37, 2), // Fire Stone - new QuestItemHolder(9547, 34, 2), // Water Stone - new QuestItemHolder(9548, 31, 2), // Earth Stone - new QuestItemHolder(9549, 28, 2), // Wind Stone - new QuestItemHolder(9550, 25, 2), // Dark Stone - new QuestItemHolder(9551, 22, 2), // Holy Stone - new QuestItemHolder(8947, 19, 1), // L2day - Rabbit Ears - new QuestItemHolder(8948, 16, 1), // L2day - Little Angel Wings - new QuestItemHolder(8949, 13, 1), // L2day - Fairy Antennae - new QuestItemHolder(3959, 10, 2), // Blessed Scroll of Resurrection (Event) - new QuestItemHolder(3958, 7, 2), // Blessed Scroll of Escape (Event) - new QuestItemHolder(8752, 4, 2), // High-Grade Life Stone - Level 76 - new QuestItemHolder(8762, 1, 1), // Top-Grade Life Stone - Level 76 - new QuestItemHolder(6660, 0, 1), // Ring of Queen Ant - }; - private static final QuestItemHolder[] NC_REWARDS = - { - new QuestItemHolder(10260, 90, 2), // Alacrity Juice - new QuestItemHolder(10261, 85, 2), // Accuracy Juice - new QuestItemHolder(10262, 80, 2), // Critical Hit Juice - new QuestItemHolder(10263, 75, 2), // Critical Rate Juice - new QuestItemHolder(10264, 70, 2), // Casting Spd. Juice - new QuestItemHolder(10265, 65, 2), // Evasion Juice - new QuestItemHolder(10266, 60, 2), // M. Atk. Juice - new QuestItemHolder(10267, 55, 2), // Power Juice - new QuestItemHolder(10268, 50, 2), // Speed Juice - new QuestItemHolder(10269, 45, 2), // Defense Juice - new QuestItemHolder(10270, 40, 2), // MP Consumption Juice - new QuestItemHolder(9546, 37, 1), // Fire Stone - new QuestItemHolder(9547, 34, 1), // Water Stone - new QuestItemHolder(9548, 31, 1), // Earth Stone - new QuestItemHolder(9549, 28, 1), // Wind Stone - new QuestItemHolder(9550, 25, 1), // Dark Stone - new QuestItemHolder(9551, 22, 1), // Holy Stone - new QuestItemHolder(8948, 19, 1), // L2day - Little Angel Wings - new QuestItemHolder(8949, 16, 1), // L2day - Fairy Antennae - new QuestItemHolder(8950, 13, 1), // L2day - Feathered Hat - new QuestItemHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event) - new QuestItemHolder(3958, 7, 1), // Blessed Scroll of Escape (Event) - new QuestItemHolder(8742, 4, 2), // Mid-Grade Life Stone - Level 76 - new QuestItemHolder(8752, 1, 1), // High-Grade Life Stone - Level 76 - new QuestItemHolder(6661, 0, 1), // Earring of Orfen - }; - private static final QuestItemHolder[] CH_REWARDS = - { - new QuestItemHolder(10260, 90, 1), // Alacrity Juice - new QuestItemHolder(10261, 85, 1), // Accuracy Juice - new QuestItemHolder(10262, 80, 1), // Critical Hit Juice - new QuestItemHolder(10263, 75, 1), // Critical Rate Juice - new QuestItemHolder(10264, 70, 1), // Casting Spd. Juice - new QuestItemHolder(10265, 65, 1), // Evasion Juice - new QuestItemHolder(10266, 60, 1), // M. Atk. Juice - new QuestItemHolder(10267, 55, 1), // Power Juice - new QuestItemHolder(10268, 50, 1), // Speed Juice - new QuestItemHolder(10269, 45, 1), // Defense Juice - new QuestItemHolder(10270, 40, 1), // MP Consumption Juice - new QuestItemHolder(9546, 37, 1), // Fire Stone - new QuestItemHolder(9547, 34, 1), // Water Stone - new QuestItemHolder(9548, 31, 1), // Earth Stone - new QuestItemHolder(9549, 28, 1), // Wind Stone - new QuestItemHolder(9550, 25, 1), // Dark Stone - new QuestItemHolder(9551, 22, 1), // Holy Stone - new QuestItemHolder(8949, 19, 1), // L2day - Fairy Antennae - new QuestItemHolder(8950, 16, 1), // L2day - Feathered Hat - new QuestItemHolder(8951, 13, 1), // L2day - Artisan's Goggles - new QuestItemHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event) - new QuestItemHolder(3958, 7, 1), // Blessed Scroll of Escape (Event) - new QuestItemHolder(8742, 4, 1), // Mid-Grade Life Stone - Level 76 - new QuestItemHolder(8752, 1, 1), // High-Grade Life Stone - Level 76 - new QuestItemHolder(6662, 0, 1), // Ring of Core - }; - - private L2Day() - { - addStartNpc(MANAGERS.keySet()); - addFirstTalkId(MANAGERS.keySet()); - addTalkId(MANAGERS.keySet()); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - String htmltext = event; - switch (event) - { - case "collect_l2": - { - if (hasQuestItems(player, L, I, N, E, A, G, II) && (getQuestItemsCount(player, E) > 1)) - { - takeItems(player, 1, L, I, N, E, A, G, E, II); - final int random = getRandom(100); - if (random >= 95) - { - rewardItems(player, MANAGERS.get(npc.getId()), 2); - } - else - { - for (QuestItemHolder holder : L2_REWARDS) - { - if (random >= holder.getChance()) - { - rewardItems(player, holder); - break; - } - } - } - htmltext = "manager-1.htm"; - } - else - { - htmltext = "manager-no.htm"; - } - break; - } - case "collect_nc": - { - if (hasQuestItems(player, N, C, S, O, F, T)) - { - takeItems(player, 1, N, C, S, O, F, T); - final int random = getRandom(100); - if (random >= 95) - { - rewardItems(player, MANAGERS.get(npc.getId()), 1); - } - else - { - for (QuestItemHolder holder : NC_REWARDS) - { - if (random >= holder.getChance()) - { - rewardItems(player, holder); - break; - } - } - } - htmltext = "manager-1.htm"; - } - else - { - htmltext = "manager-no.htm"; - } - break; - } - case "collect_ch": - { - if (hasQuestItems(player, C, H, R, O, N, I, L, E) && (getQuestItemsCount(player, C) > 1)) - { - takeItems(player, 1, C, H, R, O, N, I, C, L, E); - final int random = getRandom(100); - if (random >= 95) - { - rewardItems(player, MANAGERS.get(npc.getId()), 1); - } - else - { - for (QuestItemHolder holder : CH_REWARDS) - { - if (random >= holder.getChance()) - { - rewardItems(player, holder); - break; - } - } - } - htmltext = "manager-1.htm"; - } - else - { - htmltext = "manager-no.htm"; - } - break; - } - } - return htmltext; - } - - @Override - public String onFirstTalk(Npc npc, PlayerInstance player) - { - return "manager-1.htm"; - } - - public static void main(String[] args) - { - new L2Day(); - } -} + static + { + MANAGERS.put(31854, 7117); // Talking Island Village + MANAGERS.put(31855, 7118); // Elven Village + MANAGERS.put(31856, 7119); // Dark Elven Village + MANAGERS.put(31857, 7121); // Dwarven Village + MANAGERS.put(31858, 7120); // Orc Village + } + // Items + private static final int A = 3875; + private static final int C = 3876; + private static final int E = 3877; + private static final int F = 3878; + private static final int G = 3879; + private static final int H = 3880; + private static final int I = 3881; + private static final int L = 3882; + private static final int N = 3883; + private static final int O = 3884; + private static final int R = 3885; + private static final int S = 3886; + private static final int T = 3887; + private static final int II = 3888; + // Rewards + private static final QuestItemHolder[] L2_REWARDS = + { + new QuestItemHolder(10260, 90, 3), // Alacrity Juice + new QuestItemHolder(10261, 85, 3), // Accuracy Juice + new QuestItemHolder(10262, 80, 3), // Critical Hit Juice + new QuestItemHolder(10263, 75, 3), // Critical Rate Juice + new QuestItemHolder(10264, 70, 3), // Casting Spd. Juice + new QuestItemHolder(10265, 65, 3), // Evasion Juice + new QuestItemHolder(10266, 60, 3), // M. Atk. Juice + new QuestItemHolder(10267, 55, 3), // Power Juice + new QuestItemHolder(10268, 50, 3), // Speed Juice + new QuestItemHolder(10269, 45, 3), // Defense Juice + new QuestItemHolder(10270, 40, 3), // MP Consumption Juice + new QuestItemHolder(9546, 37, 2), // Fire Stone + new QuestItemHolder(9547, 34, 2), // Water Stone + new QuestItemHolder(9548, 31, 2), // Earth Stone + new QuestItemHolder(9549, 28, 2), // Wind Stone + new QuestItemHolder(9550, 25, 2), // Dark Stone + new QuestItemHolder(9551, 22, 2), // Holy Stone + new QuestItemHolder(8947, 19, 1), // L2day - Rabbit Ears + new QuestItemHolder(8948, 16, 1), // L2day - Little Angel Wings + new QuestItemHolder(8949, 13, 1), // L2day - Fairy Antennae + new QuestItemHolder(3959, 10, 2), // Blessed Scroll of Resurrection (Event) + new QuestItemHolder(3958, 7, 2), // Blessed Scroll of Escape (Event) + new QuestItemHolder(8752, 4, 2), // High-Grade Life Stone - Level 76 + new QuestItemHolder(8762, 1, 1), // Top-Grade Life Stone - Level 76 + new QuestItemHolder(6660, 0, 1), // Ring of Queen Ant + }; + private static final QuestItemHolder[] NC_REWARDS = + { + new QuestItemHolder(10260, 90, 2), // Alacrity Juice + new QuestItemHolder(10261, 85, 2), // Accuracy Juice + new QuestItemHolder(10262, 80, 2), // Critical Hit Juice + new QuestItemHolder(10263, 75, 2), // Critical Rate Juice + new QuestItemHolder(10264, 70, 2), // Casting Spd. Juice + new QuestItemHolder(10265, 65, 2), // Evasion Juice + new QuestItemHolder(10266, 60, 2), // M. Atk. Juice + new QuestItemHolder(10267, 55, 2), // Power Juice + new QuestItemHolder(10268, 50, 2), // Speed Juice + new QuestItemHolder(10269, 45, 2), // Defense Juice + new QuestItemHolder(10270, 40, 2), // MP Consumption Juice + new QuestItemHolder(9546, 37, 1), // Fire Stone + new QuestItemHolder(9547, 34, 1), // Water Stone + new QuestItemHolder(9548, 31, 1), // Earth Stone + new QuestItemHolder(9549, 28, 1), // Wind Stone + new QuestItemHolder(9550, 25, 1), // Dark Stone + new QuestItemHolder(9551, 22, 1), // Holy Stone + new QuestItemHolder(8948, 19, 1), // L2day - Little Angel Wings + new QuestItemHolder(8949, 16, 1), // L2day - Fairy Antennae + new QuestItemHolder(8950, 13, 1), // L2day - Feathered Hat + new QuestItemHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event) + new QuestItemHolder(3958, 7, 1), // Blessed Scroll of Escape (Event) + new QuestItemHolder(8742, 4, 2), // Mid-Grade Life Stone - Level 76 + new QuestItemHolder(8752, 1, 1), // High-Grade Life Stone - Level 76 + new QuestItemHolder(6661, 0, 1), // Earring of Orfen + }; + private static final QuestItemHolder[] CH_REWARDS = + { + new QuestItemHolder(10260, 90, 1), // Alacrity Juice + new QuestItemHolder(10261, 85, 1), // Accuracy Juice + new QuestItemHolder(10262, 80, 1), // Critical Hit Juice + new QuestItemHolder(10263, 75, 1), // Critical Rate Juice + new QuestItemHolder(10264, 70, 1), // Casting Spd. Juice + new QuestItemHolder(10265, 65, 1), // Evasion Juice + new QuestItemHolder(10266, 60, 1), // M. Atk. Juice + new QuestItemHolder(10267, 55, 1), // Power Juice + new QuestItemHolder(10268, 50, 1), // Speed Juice + new QuestItemHolder(10269, 45, 1), // Defense Juice + new QuestItemHolder(10270, 40, 1), // MP Consumption Juice + new QuestItemHolder(9546, 37, 1), // Fire Stone + new QuestItemHolder(9547, 34, 1), // Water Stone + new QuestItemHolder(9548, 31, 1), // Earth Stone + new QuestItemHolder(9549, 28, 1), // Wind Stone + new QuestItemHolder(9550, 25, 1), // Dark Stone + new QuestItemHolder(9551, 22, 1), // Holy Stone + new QuestItemHolder(8949, 19, 1), // L2day - Fairy Antennae + new QuestItemHolder(8950, 16, 1), // L2day - Feathered Hat + new QuestItemHolder(8951, 13, 1), // L2day - Artisan's Goggles + new QuestItemHolder(3959, 10, 1), // Blessed Scroll of Resurrection (Event) + new QuestItemHolder(3958, 7, 1), // Blessed Scroll of Escape (Event) + new QuestItemHolder(8742, 4, 1), // Mid-Grade Life Stone - Level 76 + new QuestItemHolder(8752, 1, 1), // High-Grade Life Stone - Level 76 + new QuestItemHolder(6662, 0, 1), // Ring of Core + }; + + private L2Day() + { + addStartNpc(MANAGERS.keySet()); + addFirstTalkId(MANAGERS.keySet()); + addTalkId(MANAGERS.keySet()); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + String htmltext = event; + switch (event) + { + case "collect_l2": + { + if (hasQuestItems(player, L, I, N, E, A, G, II) && (getQuestItemsCount(player, E) > 1)) + { + takeItems(player, 1, L, I, N, E, A, G, E, II); + final int random = getRandom(100); + if (random >= 95) + { + rewardItems(player, MANAGERS.get(npc.getId()), 2); + } + else + { + for (QuestItemHolder holder : L2_REWARDS) + { + if (random >= holder.getChance()) + { + rewardItems(player, holder); + break; + } + } + } + htmltext = "manager-1.htm"; + } + else + { + htmltext = "manager-no.htm"; + } + break; + } + case "collect_nc": + { + if (hasQuestItems(player, N, C, S, O, F, T)) + { + takeItems(player, 1, N, C, S, O, F, T); + final int random = getRandom(100); + if (random >= 95) + { + rewardItems(player, MANAGERS.get(npc.getId()), 1); + } + else + { + for (QuestItemHolder holder : NC_REWARDS) + { + if (random >= holder.getChance()) + { + rewardItems(player, holder); + break; + } + } + } + htmltext = "manager-1.htm"; + } + else + { + htmltext = "manager-no.htm"; + } + break; + } + case "collect_ch": + { + if (hasQuestItems(player, C, H, R, O, N, I, L, E) && (getQuestItemsCount(player, C) > 1)) + { + takeItems(player, 1, C, H, R, O, N, I, C, L, E); + final int random = getRandom(100); + if (random >= 95) + { + rewardItems(player, MANAGERS.get(npc.getId()), 1); + } + else + { + for (QuestItemHolder holder : CH_REWARDS) + { + if (random >= holder.getChance()) + { + rewardItems(player, holder); + break; + } + } + } + htmltext = "manager-1.htm"; + } + else + { + htmltext = "manager-no.htm"; + } + break; + } + } + return htmltext; + } + + @Override + public String onFirstTalk(Npc npc, PlayerInstance player) + { + return "manager-1.htm"; + } + + public static void main(String[] args) + { + new L2Day(); + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java index 5126f60816..5579e917ad 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00032_AnObviousLie/Q00032_AnObviousLie.java @@ -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 . - */ -package quests.Q00032_AnObviousLie; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -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; - -/** - * An Obvious Lie (32). - * @author janiko - */ -public final class Q00032_AnObviousLie extends Quest -{ - // NPCs - private static final int MAXIMILIAN = 30120; - private static final int GENTLER = 30094; - private static final int MIKI_THE_CAT = 31706; - // Monster - private static final int ALLIGATOR = 20135; - // Items - private static final int MAP_OF_GENTLER = 7165; - private static final ItemHolder MEDICINAL_HERB = new ItemHolder(7166, 20); - private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 500); - private static final ItemHolder THREAD = new ItemHolder(1868, 1000); - private static final ItemHolder SUEDE = new ItemHolder(1866, 500); - // Misc - private static final int MIN_LVL = 45; - // Reward +/* + * 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 . + */ +package quests.Q00032_AnObviousLie; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +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; + +/** + * An Obvious Lie (32). + * @author janiko + */ +public final class Q00032_AnObviousLie extends Quest +{ + // NPCs + private static final int MAXIMILIAN = 30120; + private static final int GENTLER = 30094; + private static final int MIKI_THE_CAT = 31706; + // Monster + private static final int ALLIGATOR = 20135; + // Items + private static final int MAP_OF_GENTLER = 7165; + private static final ItemHolder MEDICINAL_HERB = new ItemHolder(7166, 20); + private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 500); + private static final ItemHolder THREAD = new ItemHolder(1868, 1000); + private static final ItemHolder SUEDE = new ItemHolder(1866, 500); + // Misc + private static final int MIN_LVL = 45; + // Reward private static final Map EARS = new HashMap<>(); - { - EARS.put("cat", 6843); // Cat Ears - EARS.put("raccoon", 7680); // Raccoon ears - EARS.put("rabbit", 7683); // Rabbit ears - } - - public Q00032_AnObviousLie() - { - super(32); - addStartNpc(MAXIMILIAN); - addTalkId(MAXIMILIAN, GENTLER, MIKI_THE_CAT); - addKillId(ALLIGATOR); - registerQuestItems(MAP_OF_GENTLER, MEDICINAL_HERB.getId()); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs == null) - { - return htmltext; - } - - switch (event) - { - case "30120-02.html": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "30094-02.html": - { - if (qs.isCond(1)) - { - giveItems(player, MAP_OF_GENTLER, 1); - qs.setCond(2, true); - htmltext = event; - } - break; - } - case "31706-02.html": - { - if (qs.isCond(2) && hasQuestItems(player, MAP_OF_GENTLER)) - { - takeItems(player, MAP_OF_GENTLER, -1); - qs.setCond(3, true); - htmltext = event; - } - break; - } - case "30094-06.html": - { - if (qs.isCond(4) && hasItem(player, MEDICINAL_HERB)) - { - takeItem(player, MEDICINAL_HERB); - qs.setCond(5, true); - htmltext = event; - } - break; - } - case "30094-09.html": - { - if (qs.isCond(5) && hasItem(player, SPIRIT_ORE)) - { - takeItem(player, SPIRIT_ORE); - qs.setCond(6, true); - htmltext = event; - } - break; - } - case "30094-12.html": - { - if (qs.isCond(7)) - { - qs.setCond(8, true); - htmltext = event; - } - break; - } - case "30094-15.html": - { - htmltext = event; - break; - } - case "31706-05.html": - { - if (qs.isCond(6)) - { - qs.setCond(7, true); - htmltext = event; - } - break; - } - case "cat": - case "raccoon": - case "rabbit": - { - if (qs.isCond(8) && takeAllItems(player, THREAD, SUEDE)) - { - giveItems(player, EARS.get(event), 1); - qs.exitQuest(false, true); - htmltext = "30094-16.html"; - } - else - { - htmltext = "30094-17.html"; - } - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, 3, 3, npc); - if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, MEDICINAL_HERB.getId(), 1, MEDICINAL_HERB.getCount(), 1.0, true)) - { - qs.setCond(4); - } - return super.onKill(npc, killer, isSummon); - } - - @Override - public String onTalk(Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, true); - String htmltext = getNoQuestMsg(player); - - switch (npc.getId()) - { - case MAXIMILIAN: - { - if (qs.isCreated()) - { - htmltext = (player.getLevel() >= MIN_LVL) ? "30120-01.htm" : "30120-03.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { - htmltext = "30120-04.html"; - } - } - else - { - htmltext = getAlreadyCompletedMsg(player); - } - break; - } - case GENTLER: - { - switch (qs.getCond()) - { - case 1: - { - htmltext = "30094-01.html"; - break; - } - case 2: - { - htmltext = "30094-03.html"; - break; - } - case 4: - { - htmltext = hasItem(player, MEDICINAL_HERB) ? "30094-04.html" : "30094-05.html"; - break; - } - case 5: - { - htmltext = hasItem(player, SPIRIT_ORE) ? "30094-07.html" : "30094-08.html"; - break; - } - case 6: - { - htmltext = "30094-10.html"; - break; - } - case 7: - { - htmltext = "30094-11.html"; - break; - } - case 8: - { - if (hasAllItems(player, true, THREAD, SUEDE)) - { - htmltext = "30094-13.html"; - } - else - { - htmltext = "30094-14.html"; - } - break; - } - } - break; - } - case MIKI_THE_CAT: - { - switch (qs.getCond()) - { - case 2: - { - if (hasQuestItems(player, MAP_OF_GENTLER)) - { - htmltext = "31706-01.html"; - } - break; - } - case 3: - case 4: - case 5: - { - htmltext = "31706-03.html"; - break; - } - case 6: - { - htmltext = "31706-04.html"; - break; - } - case 7: - { - htmltext = "31706-06.html"; - break; - } - } - break; - } - } - return htmltext; - } -} + static + { + EARS.put("cat", 6843); // Cat Ears + EARS.put("raccoon", 7680); // Raccoon ears + EARS.put("rabbit", 7683); // Rabbit ears + } + + public Q00032_AnObviousLie() + { + super(32); + addStartNpc(MAXIMILIAN); + addTalkId(MAXIMILIAN, GENTLER, MIKI_THE_CAT); + addKillId(ALLIGATOR); + registerQuestItems(MAP_OF_GENTLER, MEDICINAL_HERB.getId()); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs == null) + { + return htmltext; + } + + switch (event) + { + case "30120-02.html": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "30094-02.html": + { + if (qs.isCond(1)) + { + giveItems(player, MAP_OF_GENTLER, 1); + qs.setCond(2, true); + htmltext = event; + } + break; + } + case "31706-02.html": + { + if (qs.isCond(2) && hasQuestItems(player, MAP_OF_GENTLER)) + { + takeItems(player, MAP_OF_GENTLER, -1); + qs.setCond(3, true); + htmltext = event; + } + break; + } + case "30094-06.html": + { + if (qs.isCond(4) && hasItem(player, MEDICINAL_HERB)) + { + takeItem(player, MEDICINAL_HERB); + qs.setCond(5, true); + htmltext = event; + } + break; + } + case "30094-09.html": + { + if (qs.isCond(5) && hasItem(player, SPIRIT_ORE)) + { + takeItem(player, SPIRIT_ORE); + qs.setCond(6, true); + htmltext = event; + } + break; + } + case "30094-12.html": + { + if (qs.isCond(7)) + { + qs.setCond(8, true); + htmltext = event; + } + break; + } + case "30094-15.html": + { + htmltext = event; + break; + } + case "31706-05.html": + { + if (qs.isCond(6)) + { + qs.setCond(7, true); + htmltext = event; + } + break; + } + case "cat": + case "raccoon": + case "rabbit": + { + if (qs.isCond(8) && takeAllItems(player, THREAD, SUEDE)) + { + giveItems(player, EARS.get(event), 1); + qs.exitQuest(false, true); + htmltext = "30094-16.html"; + } + else + { + htmltext = "30094-17.html"; + } + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, 3, 3, npc); + if ((qs != null) && giveItemRandomly(qs.getPlayer(), npc, MEDICINAL_HERB.getId(), 1, MEDICINAL_HERB.getCount(), 1.0, true)) + { + qs.setCond(4); + } + return super.onKill(npc, killer, isSummon); + } + + @Override + public String onTalk(Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, true); + String htmltext = getNoQuestMsg(player); + + switch (npc.getId()) + { + case MAXIMILIAN: + { + if (qs.isCreated()) + { + htmltext = (player.getLevel() >= MIN_LVL) ? "30120-01.htm" : "30120-03.htm"; + } + else if (qs.isStarted()) + { + if (qs.isCond(1)) + { + htmltext = "30120-04.html"; + } + } + else + { + htmltext = getAlreadyCompletedMsg(player); + } + break; + } + case GENTLER: + { + switch (qs.getCond()) + { + case 1: + { + htmltext = "30094-01.html"; + break; + } + case 2: + { + htmltext = "30094-03.html"; + break; + } + case 4: + { + htmltext = hasItem(player, MEDICINAL_HERB) ? "30094-04.html" : "30094-05.html"; + break; + } + case 5: + { + htmltext = hasItem(player, SPIRIT_ORE) ? "30094-07.html" : "30094-08.html"; + break; + } + case 6: + { + htmltext = "30094-10.html"; + break; + } + case 7: + { + htmltext = "30094-11.html"; + break; + } + case 8: + { + if (hasAllItems(player, true, THREAD, SUEDE)) + { + htmltext = "30094-13.html"; + } + else + { + htmltext = "30094-14.html"; + } + break; + } + } + break; + } + case MIKI_THE_CAT: + { + switch (qs.getCond()) + { + case 2: + { + if (hasQuestItems(player, MAP_OF_GENTLER)) + { + htmltext = "31706-01.html"; + } + break; + } + case 3: + case 4: + case 5: + { + htmltext = "31706-03.html"; + break; + } + case 6: + { + htmltext = "31706-04.html"; + break; + } + case 7: + { + htmltext = "31706-06.html"; + break; + } + } + break; + } + } + return htmltext; + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java index ca2c86e40d..4b9c397f20 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java @@ -1,979 +1,981 @@ -/* - * 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 . - */ -package quests.Q00144_PailakaInjuredDragon; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.commons.util.Rnd; -import com.l2jmobius.gameserver.ai.CtrlEvent; -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.data.xml.impl.SkillData; -import com.l2jmobius.gameserver.enums.QuestSound; -import com.l2jmobius.gameserver.instancemanager.InstanceManager; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.Summon; -import com.l2jmobius.gameserver.model.actor.instance.MonsterInstance; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; -import com.l2jmobius.gameserver.model.instancezone.Instance; -import com.l2jmobius.gameserver.model.instancezone.InstanceWorld; -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.model.zone.ZoneType; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SpecialCamera; -import com.l2jmobius.gameserver.util.Util; - -/** - * Pailaka Injured Dragon - * @author Pandragon - */ -public class Q00144_PailakaInjuredDragon extends Quest -{ - // NPCs - private static final int KETRA_ORC_SHAMAN = 32499; - private static final int KETRA_ORC_SUPPORTER = 32502; - private static final int KETRA_ORC_SUPPORTER2 = 32512; - private static final int KETRA_ORC_INTELIGENCE_OFFICER = 32509; - // Wall Mobs - private static final int VARKA_SILENOS_RECRUIT = 18635; - private static final int VARKA_SILENOS_FOOTMAN = 18636; - private static final int VARKA_SILENOS_WARRIOR = 18642; - private static final int VARKA_SILENOS_OFFICER = 18646; - private static final int VARKAS_COMMANDER = 18654; - private static final int VARKA_ELITE_GUARD = 18653; - private static final int VARKA_SILENOS_GREAT_MAGUS = 18649; - private static final int VARKA_SILENOS_GENERAL = 18650; - private static final int VARKA_SILENOS_HEAD_GUARD = 18655; - private static final int PROPHET_GUARD = 18657; - private static final int VARKAS_PROPHET = 18659; - // Extra Wall Silenos - private static final int VARKA_SILENOS_MEDIUM = 18644; - private static final int VARKA_SILENOS_PRIEST = 18641; - private static final int VARKA_SILENOS_SHAMAN = 18640; - private static final int VARKA_SILENOS_SEER = 18648; - private static final int VARKA_SILENOS_MAGNUS = 18645; - private static final int DISCIPLE_OF_PROPHET = 18658; - private static final int VARKA_HEAD_MAGUS = 18656; - private static final int VARKA_SILENOS_GREAT_SEER = 18652; - // Normal Mobs - private static final int ANTYLOPE_1 = 18637; - private static final int ANTYLOPE_2 = 18643; - private static final int ANTYLOPE_3 = 18651; - private static final int FLAVA = 18647; - // Boss - private static final int LATANA = 18660; - // Items - private static final int SPEAR = 13052; - private static final int ENCHSPEAR = 13053; - private static final int LASTSPEAR = 13054; - private static final int STAGE1 = 13056; - private static final int STAGE2 = 13057; - private static final int SHIELD_POTION = 13032; - private static final int HEAL_POTION = 13033; - // Rewards - private static final int PSHIRT = 13296; - private static final int SCROLL_OF_ESCAPE = 736; - // Arrays - private static final int[] WALL_MONSTERS = - { - // 1st Row Mobs - VARKA_SILENOS_FOOTMAN, - VARKA_SILENOS_WARRIOR, - VARKA_SILENOS_OFFICER, - VARKAS_COMMANDER, - VARKA_SILENOS_RECRUIT, - PROPHET_GUARD, - VARKA_ELITE_GUARD, - VARKA_SILENOS_GREAT_MAGUS, - VARKA_SILENOS_GENERAL, - VARKA_SILENOS_HEAD_GUARD, - PROPHET_GUARD, - VARKAS_PROPHET, - // 2nd Row Mobs - DISCIPLE_OF_PROPHET, - VARKA_HEAD_MAGUS, - VARKA_SILENOS_GREAT_SEER, - VARKA_SILENOS_SHAMAN, - VARKA_SILENOS_MAGNUS, - VARKA_SILENOS_SEER, - VARKA_SILENOS_MEDIUM, - VARKA_SILENOS_PRIEST - }; +/* + * 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 . + */ +package quests.Q00144_PailakaInjuredDragon; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.commons.util.Rnd; +import com.l2jmobius.gameserver.ai.CtrlEvent; +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.data.xml.impl.SkillData; +import com.l2jmobius.gameserver.enums.QuestSound; +import com.l2jmobius.gameserver.instancemanager.InstanceManager; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.Summon; +import com.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; +import com.l2jmobius.gameserver.model.instancezone.Instance; +import com.l2jmobius.gameserver.model.instancezone.InstanceWorld; +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.model.zone.ZoneType; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SpecialCamera; +import com.l2jmobius.gameserver.util.Util; + +/** + * Pailaka Injured Dragon + * @author Pandragon + */ +public class Q00144_PailakaInjuredDragon extends Quest +{ + // NPCs + private static final int KETRA_ORC_SHAMAN = 32499; + private static final int KETRA_ORC_SUPPORTER = 32502; + private static final int KETRA_ORC_SUPPORTER2 = 32512; + private static final int KETRA_ORC_INTELIGENCE_OFFICER = 32509; + // Wall Mobs + private static final int VARKA_SILENOS_RECRUIT = 18635; + private static final int VARKA_SILENOS_FOOTMAN = 18636; + private static final int VARKA_SILENOS_WARRIOR = 18642; + private static final int VARKA_SILENOS_OFFICER = 18646; + private static final int VARKAS_COMMANDER = 18654; + private static final int VARKA_ELITE_GUARD = 18653; + private static final int VARKA_SILENOS_GREAT_MAGUS = 18649; + private static final int VARKA_SILENOS_GENERAL = 18650; + private static final int VARKA_SILENOS_HEAD_GUARD = 18655; + private static final int PROPHET_GUARD = 18657; + private static final int VARKAS_PROPHET = 18659; + // Extra Wall Silenos + private static final int VARKA_SILENOS_MEDIUM = 18644; + private static final int VARKA_SILENOS_PRIEST = 18641; + private static final int VARKA_SILENOS_SHAMAN = 18640; + private static final int VARKA_SILENOS_SEER = 18648; + private static final int VARKA_SILENOS_MAGNUS = 18645; + private static final int DISCIPLE_OF_PROPHET = 18658; + private static final int VARKA_HEAD_MAGUS = 18656; + private static final int VARKA_SILENOS_GREAT_SEER = 18652; + // Normal Mobs + private static final int ANTYLOPE_1 = 18637; + private static final int ANTYLOPE_2 = 18643; + private static final int ANTYLOPE_3 = 18651; + private static final int FLAVA = 18647; + // Boss + private static final int LATANA = 18660; + // Items + private static final int SPEAR = 13052; + private static final int ENCHSPEAR = 13053; + private static final int LASTSPEAR = 13054; + private static final int STAGE1 = 13056; + private static final int STAGE2 = 13057; + private static final int SHIELD_POTION = 13032; + private static final int HEAL_POTION = 13033; + // Rewards + private static final int PSHIRT = 13296; + private static final int SCROLL_OF_ESCAPE = 736; + // Arrays + private static final int[] WALL_MONSTERS = + { + // 1st Row Mobs + VARKA_SILENOS_FOOTMAN, + VARKA_SILENOS_WARRIOR, + VARKA_SILENOS_OFFICER, + VARKAS_COMMANDER, + VARKA_SILENOS_RECRUIT, + PROPHET_GUARD, + VARKA_ELITE_GUARD, + VARKA_SILENOS_GREAT_MAGUS, + VARKA_SILENOS_GENERAL, + VARKA_SILENOS_HEAD_GUARD, + PROPHET_GUARD, + VARKAS_PROPHET, + // 2nd Row Mobs + DISCIPLE_OF_PROPHET, + VARKA_HEAD_MAGUS, + VARKA_SILENOS_GREAT_SEER, + VARKA_SILENOS_SHAMAN, + VARKA_SILENOS_MAGNUS, + VARKA_SILENOS_SEER, + VARKA_SILENOS_MEDIUM, + VARKA_SILENOS_PRIEST + }; private static final List DROPLIST = new ArrayList<>(); - { - DROPLIST.add(new ItemChanceHolder(HEAL_POTION, 80)); - DROPLIST.add(new ItemChanceHolder(SHIELD_POTION, 30)); - } - private static final int[] OTHER_MONSTERS = - { - ANTYLOPE_1, - ANTYLOPE_2, - ANTYLOPE_3, - FLAVA - }; - private static final int[] ITEMS = - { - SPEAR, - ENCHSPEAR, - LASTSPEAR, - STAGE1, - STAGE2, - SHIELD_POTION, - HEAL_POTION - }; - // @formatter:off + static + { + DROPLIST.add(new ItemChanceHolder(HEAL_POTION, 80)); + DROPLIST.add(new ItemChanceHolder(SHIELD_POTION, 30)); + } + private static final int[] OTHER_MONSTERS = + { + ANTYLOPE_1, + ANTYLOPE_2, + ANTYLOPE_3, + FLAVA + }; + private static final int[] ITEMS = + { + SPEAR, + ENCHSPEAR, + LASTSPEAR, + STAGE1, + STAGE2, + SHIELD_POTION, + HEAL_POTION + }; + // @formatter:off private static final Map NOEXIT_ZONES = new HashMap<>(); - { - NOEXIT_ZONES.put(200001, new int[]{123167, -45743, -3023}); - NOEXIT_ZONES.put(200002, new int[]{117783, -46398, -2560}); - NOEXIT_ZONES.put(200003, new int[]{116791, -51556, -2584}); - NOEXIT_ZONES.put(200004, new int[]{117993, -52505, -2480}); - NOEXIT_ZONES.put(200005, new int[]{113226, -44080, -2776}); - NOEXIT_ZONES.put(200006, new int[]{110326, -45016, -2444}); - NOEXIT_ZONES.put(200007, new int[]{118341, -55951, -2280}); - NOEXIT_ZONES.put(200008, new int[]{110127, -41562, -2332}); - } - private static final int[][] BUFFS = - { - {4357,2}, // Haste Lv2 - {4342,2}, // Wind Walk Lv2 - {4356,3}, // Empower Lv3 - {4355,3}, // Acumen Lv3 - {4351,6}, // Concentration Lv6 - {4345,3}, // Might Lv3 - {4358,3}, // Guidance Lv3 - {4359,3}, // Focus Lv3 - {4360,3}, // Death Wisper Lv3 - {4352,2}, // Berserker Spirit Lv2 - {4354,4}, // Vampiric Rage Lv4 - {4347,6} // Blessed Body Lv6 - }; - private static final int[][] HP_HERBS_DROPLIST = - { - // itemId, count, chance - { 8601, 1, 40 }, - { 8600, 1, 70 } - }; - private static final int[][] MP_HERBS_DROPLIST = - { - // itemId, count, chance - { 8604, 1, 40 }, - { 8603, 1, 70 } - }; - // @formatter:on - - static final Location TELEPORT = new Location(125757, -40928, -3736); - private static final int MIN_LEVEL = 73; - private static final int MAX_LEVEL = 77; - private static final int MAX_SUMMON_LEVEL = 80; - private static final int EXIT_TIME = 5; - private static final int INSTANCE_ID = 45; - private int buff_counter = 5; - - public Q00144_PailakaInjuredDragon() - { - super(144); - addStartNpc(KETRA_ORC_SHAMAN, KETRA_ORC_INTELIGENCE_OFFICER); - addFirstTalkId(KETRA_ORC_SUPPORTER, KETRA_ORC_INTELIGENCE_OFFICER, KETRA_ORC_SUPPORTER2); - addTalkId(KETRA_ORC_SHAMAN, KETRA_ORC_SUPPORTER, KETRA_ORC_INTELIGENCE_OFFICER, KETRA_ORC_SUPPORTER2); - addSpawnId(WALL_MONSTERS); - addKillId(WALL_MONSTERS); - addKillId(OTHER_MONSTERS); - addKillId(LATANA); - addSeeCreatureId(LATANA); - addEnterZoneId(NOEXIT_ZONES.keySet()); - registerQuestItems(ITEMS); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs == null) - { - return null; - } - - if (event.equals("enter")) - { - enterInstance(player); - return "32499-08.html"; - } - else if (event.equals("enters")) - { - enterInstance(player); - return "32499-10.html"; - } - else if (event.equals("32499-02.htm")) - { - if (qs.getCond() == 0) - { - qs.startQuest(); - } - } - else if (event.equals("32499-04.html")) - { - if (qs.isCond(1)) - { - qs.setCond(2, true); - } - } - else if (event.equals("32502-04.html")) - { - if (qs.isCond(2) && !hasQuestItems(player, SPEAR)) - { - qs.setCond(3, true); - giveItems(player, SPEAR, 1); - } - } - else if (event.equals("32509-02.html")) - { - if (qs.isCond(3) && hasQuestItems(player, SPEAR)) - { - if (!hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1)) - { - return "32509-07.html"; - } - if (hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1)) - { - return "32509-01.html"; - } - if (hasQuestItems(player, SPEAR) && hasQuestItems(player, STAGE1)) - { - takeItems(player, SPEAR, -1); - takeItems(player, STAGE1, -1); - giveItems(player, ENCHSPEAR, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); // TODO: Set proper cond. - return "32509-02.html"; - } - } - if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR)) - { - if (!hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2)) - { - return "32509-07.html"; - } - if (hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2)) - { - return "32509-01.html"; - } - if (hasQuestItems(player, ENCHSPEAR) && hasQuestItems(player, STAGE2)) - { - takeItems(player, ENCHSPEAR, -1); - takeItems(player, STAGE2, -1); - giveItems(player, LASTSPEAR, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); // TODO: Set proper cond. - addSpawn(LATANA, 105732, -41787, -1782, 35742, false, 0, false, npc.getInstanceId()); - return "32509-03.html"; - } - } - if (qs.isCond(3) && hasQuestItems(player, LASTSPEAR)) - { - if (hasQuestItems(player, LASTSPEAR)) - { - return "32509-03a.html"; - } - if (!hasQuestItems(player, LASTSPEAR)) - { - return "32509-07.html"; - } - } - return "32509-07.html"; - } - else if (event.equals("32509-06.html")) - { - if (buff_counter < 1) - { - return "32509-04.html"; - } - } - else if (event.equals("32512-02.html")) - { - final Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId()); - inst.setDuration(EXIT_TIME * 60000); - inst.setEmptyDestroyTime(0); - - if (inst.containsPlayer(player.getObjectId())) - { - player.setVitalityPoints(20000, true); - addExpAndSp(player, 28000000, 2850000); - giveItems(player, SCROLL_OF_ESCAPE, 1); - giveItems(player, PSHIRT, 1); - } - - qs.exitQuest(false, true); - } - else if (event.equals("LATANA_INTRO_CAMERA_START")) - { - npc.setScriptValue(1); - npc.abortAttack(); - npc.abortCast(); - npc.setIsInvul(true); - npc.setIsImmobilized(true); - npc.disableAllSkills(); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); - player.abortAttack(); - player.abortCast(); - player.stopMove(null); - player.setTarget(null); - if (player.hasSummon()) - { - player.getSummon().abortAttack(); - player.getSummon().abortCast(); - player.getSummon().stopMove(null); - player.getSummon().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); - } - player.sendPacket(new SpecialCamera(npc, 600, 200, 5, 0, 15000, 10000, (-10), 8, 1, 1, 1)); - startQuestTimer("LATANA_INTRO_CAMERA_2", 2000, npc, player); - return null; - } - else if (event.equals("LATANA_INTRO_CAMERA_2")) - { - player.sendPacket(new SpecialCamera(npc, 400, 200, 5, 4000, 15000, 10000, (-10), 8, 1, 1, 0)); - startQuestTimer("LATANA_INTRO_CAMERA_3", 4000, npc, player); - return null; - } - else if (event.equals("LATANA_INTRO_CAMERA_3")) - { - player.sendPacket(new SpecialCamera(npc, 300, 195, 4, 1500, 15000, 10000, (-5), 10, 1, 1, 0)); - startQuestTimer("LATANA_INTRO_CAMERA_4", 1700, npc, player); - return null; - } - else if (event.equals("LATANA_INTRO_CAMERA_4")) - { - player.sendPacket(new SpecialCamera(npc, 130, 2, 5, 0, 15000, 10000, 0, 0, 1, 0, 1)); - startQuestTimer("LATANA_INTRO_CAMERA_5", 2000, npc, player); - return null; - } - else if (event.equals("LATANA_INTRO_CAMERA_5")) - { - player.sendPacket(new SpecialCamera(npc, 220, 0, 4, 800, 15000, 10000, 5, 10, 1, 0, 0)); - startQuestTimer("LATANA_INTRO_CAMERA_6", 2000, npc, player); - return null; - } - else if (event.equals("LATANA_INTRO_CAMERA_6")) - { - player.sendPacket(new SpecialCamera(npc, 250, 185, 5, 4000, 15000, 10000, (-5), 10, 1, 1, 0)); - startQuestTimer("LATANA_INTRO_CAMERA_7", 4000, npc, player); - return null; - } - else if (event.equals("LATANA_INTRO_CAMERA_7")) - { - player.sendPacket(new SpecialCamera(npc, 200, 0, 5, 2000, 15000, 10000, 0, 25, 1, 0, 0)); - startQuestTimer("LATANA_INTRO_CAMERA_8", 4530, npc, player); - return null; - } - else if (event.equals("LATANA_INTRO_CAMERA_8")) - { - npc.doCast(SkillData.getInstance().getSkill(5759, 1)); - player.sendPacket(new SpecialCamera(npc, 300, (-3), 5, 3500, 15000, 6000, 0, 6, 1, 0, 0)); - startQuestTimer("LATANA_INTRO_CAMERA_9", 10000, npc, player); - return null; - } - else if (event.equals("LATANA_INTRO_CAMERA_9")) - { - npc.setIsInvul(false); - npc.setIsImmobilized(false); - npc.enableAllSkills(); - npc.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, player); - return null; - } - else if (event.equals("LATANA_DEATH_CAMERA_START")) - { - player.sendPacket(new SpecialCamera(npc, 450, 200, 3, 0, 15000, 10000, (-15), 20, 1, 1, 1)); - startQuestTimer("LATANA_DEATH_CAMERA_1", 100, npc, player); - return null; - } - else if (event.equals("LATANA_DEATH_CAMERA_1")) - { - player.sendPacket(new SpecialCamera(npc, 350, 200, 5, 5600, 15000, 10000, (-15), 10, 1, 1, 0)); - startQuestTimer("LATANA_DEATH_CAMERA_2", 5600, npc, player); - return null; - } - else if (event.equals("LATANA_DEATH_CAMERA_2")) - { - player.sendPacket(new SpecialCamera(npc, 360, 200, 5, 1000, 15000, 2000, (-15), 10, 1, 1, 0)); - return null; - } - else if (event.startsWith("buff")) - { - if (buff_counter > 0) - { - final int nr = Integer.parseInt(event.split("buff")[1]); - giveBuff(npc, player, BUFFS[nr - 1][0], BUFFS[nr - 1][1]); - return "32509-06a.html"; - } - return "32509-05.html"; - } - return event; - } - - @Override - public String onFirstTalk(Npc npc, PlayerInstance player) - { - return npc.getId() + ".html"; - } - - @Override - public String onTalk(Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, true); - - switch (npc.getId()) - { - case KETRA_ORC_SHAMAN: - { - switch (qs.getState()) - { - case State.CREATED: - { - if (player.getLevel() < MIN_LEVEL) - { - return "32499-no.html"; - } - if (player.getLevel() > MAX_LEVEL) - { - return "32499-over.html"; - } - return "32499-00.htm"; - } - case State.STARTED: - { - if (player.getLevel() < MIN_LEVEL) - { - return "32499-no.html"; - } - if (player.getLevel() > MAX_LEVEL) - { - return "32499-over.html"; - } - if (qs.isCond(1)) - { - return "32499-06.html"; - } - else if (qs.getCond() >= 2) - { - return "32499-09.html"; - } - } - case State.COMPLETED: - { - return "32499-completed.html"; - } - default: - { - return "32499-no.html"; - } - } - // break; - } - case KETRA_ORC_SUPPORTER: - { - if (qs.getCond() > 2) - { - return "32502-04.html"; - } - return "32502-00.html"; - } - case KETRA_ORC_SUPPORTER2: - { - if (qs.getState() == State.COMPLETED) - { - return "32512-03.html"; - } - else if (qs.isCond(4)) - { - return "32512-01.html"; - } - break; - } - } - return getNoQuestMsg(player); - } - - @Override - public String onKill(Npc npc, PlayerInstance player, boolean isSummon) - { - final QuestState qs = player.getQuestState(getName()); - if ((qs == null) || (qs.getState() != State.STARTED)) - { - return null; - } - - // There are lots of mobs walls, and item get is random, it could happen that you dont get the item until the last wall, and there's 4 different silenos groups. 1 enchant comes only from group 2 and the 2nd comes from group 4. Chances, lets say 20% of getting the enchant when killing the - // right mob When you kill a mob wall, another mage type appears behind. If all mobs from the front are killed then the ones that are behind are despawned. Also this mobs should be damaged, like with 30% of max HP, because they should be easy to kill. - switch (npc.getId()) - { - case VARKA_SILENOS_FOOTMAN: - case VARKA_SILENOS_RECRUIT: - { - dropHerb(npc, player, HP_HERBS_DROPLIST); - if (qs.isCond(3) && hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1) && (Rnd.get(100) < 25)) - { - giveItems(player, STAGE1, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); - } - // Spawns Mage Type silenos behind the one that was killed. - spawnMageBehind(npc, player, VARKA_SILENOS_MEDIUM); - // Check if all the first row have been killed. Despawn mages. - checkIfLastInWall(npc); - break; - } - case VARKA_SILENOS_WARRIOR: - { - dropHerb(npc, player, HP_HERBS_DROPLIST); - if (qs.isCond(3) && hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1) && (Rnd.get(100) < 25)) - { - giveItems(player, STAGE1, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); - } - // Spawns Mage Type silenos behind the one that was killed. - spawnMageBehind(npc, player, VARKA_SILENOS_PRIEST); - // Check if all the first row have been killed. Despawn mages. - checkIfLastInWall(npc); - break; - } - case VARKA_ELITE_GUARD: - { - dropHerb(npc, player, HP_HERBS_DROPLIST); - if (qs.isCond(3) && hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1) && (Rnd.get(100) < 25)) - { - giveItems(player, STAGE1, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); - } - // Spawns Mage Type silenos behind the one that was killed. - spawnMageBehind(npc, player, VARKA_SILENOS_SHAMAN); - // Check if all the first row have been killed. Despawn mages. - checkIfLastInWall(npc); - break; - } - case VARKAS_COMMANDER: - case VARKA_SILENOS_OFFICER: - { - dropHerb(npc, player, HP_HERBS_DROPLIST); - if (qs.isCond(3) && hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1) && (Rnd.get(100) < 25)) - { - giveItems(player, STAGE1, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); - } - // Spawns Mage Type silenos behind the one that was killed. - spawnMageBehind(npc, player, VARKA_SILENOS_SEER); - // Check if all the first row have been killed. Despawn mages. - checkIfLastInWall(npc); - break; - } - case VARKA_SILENOS_GREAT_MAGUS: - case VARKA_SILENOS_GENERAL: - { - dropHerb(npc, player, HP_HERBS_DROPLIST); - if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2) && (Rnd.get(100) < 25)) - { - giveItems(player, STAGE2, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); - } - // Spawns Mage Type silenos behind the one that was killed. - spawnMageBehind(npc, player, VARKA_SILENOS_MAGNUS); - // Check if all the first row have been killed. Despawn mages. - checkIfLastInWall(npc); - break; - } - case VARKAS_PROPHET: - { - dropHerb(npc, player, HP_HERBS_DROPLIST); - if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2) && (Rnd.get(100) < 25)) - { - giveItems(player, STAGE2, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); - } - // Spawns Mage Type silenos behind the one that was killed. - spawnMageBehind(npc, player, DISCIPLE_OF_PROPHET); - // Check if all the first row have been killed. Despawn mages. - checkIfLastInWall(npc); - break; - } - case VARKA_SILENOS_HEAD_GUARD: - { - dropHerb(npc, player, HP_HERBS_DROPLIST); - if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2) && (Rnd.get(100) < 25)) - { - giveItems(player, STAGE2, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); - } - // Spawns Mage Type silenos behind the one that was killed. - spawnMageBehind(npc, player, VARKA_HEAD_MAGUS); - // Check if all the first row have been killed. Despawn mages. - checkIfLastInWall(npc); - break; - } - case PROPHET_GUARD: - { - dropHerb(npc, player, HP_HERBS_DROPLIST); - if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2) && (Rnd.get(100) < 25)) - { - giveItems(player, STAGE2, 1); - player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); - } - // Spawns Mage Type silenos behind the one that was killed. - spawnMageBehind(npc, player, VARKA_SILENOS_GREAT_SEER); - // Check if all the first row have been killed. Despawn mages. - checkIfLastInWall(npc); - break; - } - case LATANA: - { - qs.setCond(4, true); - startQuestTimer("LATANA_DEATH_CAMERA_START", 1000, npc, player); - addSpawn(KETRA_ORC_SUPPORTER2, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, false, npc.getInstanceId()); - break; - } - case ANTYLOPE_1: - case ANTYLOPE_2: - case ANTYLOPE_3: - case FLAVA: - { - dropItem(npc, player); - break; - } - default: - { - // hardcoded herb drops. - dropHerb(npc, player, HP_HERBS_DROPLIST); - dropHerb(npc, player, MP_HERBS_DROPLIST); - break; - } - } - return super.onKill(npc, player, isSummon); - } - - // Spawns Mage Type silenos behind the one that was killed. Aggro against the player that kill the mob. - private void spawnMageBehind(Npc npc, PlayerInstance player, int mageId) - { - final double rads = Math.toRadians(Util.convertHeadingToDegree(npc.getSpawn().getHeading()) + 180); - final int mageX = (int) (npc.getX() + (150 * Math.cos(rads))); - final int mageY = (int) (npc.getY() + (150 * Math.sin(rads))); - final Npc mageBack = addSpawn(mageId, mageX, mageY, npc.getZ(), npc.getSpawn().getHeading(), false, 0, true, npc.getInstanceId()); - mageBack.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, player, 1000); - } - - // This function will check if there is other mob alive in this wall of mobs. If all mobs in the first row are dead then despawn the second row mobs, the mages. - private void checkIfLastInWall(Npc npc) - { - final Collection knowns = World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 700); - for (Npc npcs : knowns) - { - if (npcs.isDead()) - { - continue; - } - - switch (npc.getId()) - { - case VARKA_SILENOS_FOOTMAN: - case VARKA_SILENOS_RECRUIT: - case VARKA_SILENOS_WARRIOR: - { - switch (npcs.getId()) - { - case VARKA_SILENOS_FOOTMAN: - case VARKA_SILENOS_RECRUIT: - case VARKA_SILENOS_WARRIOR: - { - return; - } - } - break; - } - case VARKA_ELITE_GUARD: - case VARKAS_COMMANDER: - case VARKA_SILENOS_OFFICER: - { - switch (npcs.getId()) - { - case VARKA_ELITE_GUARD: - case VARKAS_COMMANDER: - case VARKA_SILENOS_OFFICER: - { - return; - } - } - break; - } - case VARKA_SILENOS_GREAT_MAGUS: - case VARKA_SILENOS_GENERAL: - case VARKAS_PROPHET: - { - switch (npcs.getId()) - { - case VARKA_SILENOS_GREAT_MAGUS: - case VARKA_SILENOS_GENERAL: - case VARKAS_PROPHET: - { - return; - } - } - break; - } - case VARKA_SILENOS_HEAD_GUARD: - case PROPHET_GUARD: - { - switch (npcs.getId()) - { - case VARKA_SILENOS_HEAD_GUARD: - case PROPHET_GUARD: - { - return; - } - } - break; - } - } - } - - // We didnt find any mob on the first row alive, so despawn the second row mobs. - for (Creature npcs : knowns) - { - if (npcs.isDead()) - { - continue; - } - - switch (npc.getId()) - { - case VARKA_SILENOS_FOOTMAN: - case VARKA_SILENOS_RECRUIT: - case VARKA_SILENOS_WARRIOR: - { - switch (npcs.getId()) - { - case VARKA_SILENOS_MEDIUM: - case VARKA_SILENOS_PRIEST: - { - npcs.abortCast(); - npcs.deleteMe(); - break; - } - } - break; - } - case VARKA_ELITE_GUARD: - case VARKAS_COMMANDER: - case VARKA_SILENOS_OFFICER: - { - switch (npcs.getId()) - { - case VARKA_SILENOS_SHAMAN: - case VARKA_SILENOS_SEER: - { - npcs.abortCast(); - npcs.deleteMe(); - break; - } - } - break; - } - case VARKA_SILENOS_GREAT_MAGUS: - case VARKA_SILENOS_GENERAL: - case VARKAS_PROPHET: - { - switch (npcs.getId()) - { - case VARKA_SILENOS_MAGNUS: - case DISCIPLE_OF_PROPHET: - { - npcs.abortCast(); - npcs.deleteMe(); - break; - } - } - break; - } - case VARKA_SILENOS_HEAD_GUARD: - case PROPHET_GUARD: - { - switch (npcs.getId()) - { - case VARKA_HEAD_MAGUS: - case VARKA_SILENOS_GREAT_SEER: - { - npcs.abortCast(); - npcs.deleteMe(); - break; - } - } - break; - } - } - } - } - - @Override - public String onSeeCreature(Npc npc, Creature creature, boolean isSummon) - { - if (creature.isPlayer() && npc.isScriptValue(0)) - { - final QuestState qs = getQuestState(creature.getActingPlayer(), false); - if ((qs == null) || (qs.getState() != State.STARTED) || isSummon) - { - return null; - } - startQuestTimer("LATANA_INTRO_CAMERA_START", 600, npc, creature.getActingPlayer()); - } - return super.onSeeCreature(npc, creature, isSummon); - } - - @Override - public String onSpawn(Npc npc) - { - if (npc.isMonster()) - { - for (int mobId : WALL_MONSTERS) - { - // Every monster on pailaka should be Aggresive and Active, with the same clan, also wall mobs cannot move, they all use magic from far, and if you get in combat range they hit. - if (mobId == npc.getId()) - { - final MonsterInstance monster = (MonsterInstance) npc; - monster.setIsImmobilized(true); - break; - } - } - } - return super.onSpawn(npc); - } - - @Override - public String onEnterZone(Creature creature, ZoneType zone) - { - if (creature.isPlayer() && !creature.isDead() && !creature.isTeleporting() && ((PlayerInstance) creature).isOnline()) - { - final InstanceWorld world = InstanceManager.getInstance().getWorld(creature); - if ((world != null) && (world.getTemplateId() == INSTANCE_ID)) - { - // If a player wants to go by a mob wall without kill it, he will be returned back to a spawn point. - final int[] zoneTeleport = NOEXIT_ZONES.get(zone.getId()); - if (zoneTeleport != null) - { - for (Creature npc : World.getInstance().getVisibleObjectsInRange(creature, Npc.class, 700)) - { - if (npc.isDead()) - { - continue; - } - teleportPlayer(creature.getActingPlayer(), zoneTeleport, world.getInstanceId()); - break; - } - } - } - } - return super.onEnterZone(creature, zone); - } - - private void dropHerb(Npc mob, PlayerInstance player, int[][] drop) - { - final int chance = Rnd.get(100); - for (int[] element : drop) - { - if (chance < element[2]) - { - ((MonsterInstance) mob).dropItem(player, element[0], element[1]); - return; - } - } - } - - private void dropItem(Npc mob, PlayerInstance player) - { - // To make random drops, we shuffle the droplist every time its used. - Collections.shuffle(DROPLIST); - for (ItemChanceHolder drop : DROPLIST) - { - if (Rnd.get(100) < drop.getChance()) - { - ((MonsterInstance) mob).dropItem(player, drop.getId(), Rnd.get(1, 6)); - return; - } - } - } - - private void giveBuff(Npc npc, PlayerInstance player, int skillId, int level) - { - buff_counter--; - npc.setTarget(player); - npc.doCast(SkillData.getInstance().getSkill(skillId, level)); - } - - private void teleportPlayer(PlayerInstance player, int[] coords, int instanceId) - { - player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); - player.setInstanceId(instanceId); - player.teleToLocation(coords[0], coords[1], coords[2], true); - } - - private synchronized void enterInstance(PlayerInstance player) - { - // Check for existing instances for this player. - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) - { - if (world.getTemplateId() != INSTANCE_ID) - { - player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANCE_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); - return; - } - if (InstanceManager.getInstance().getInstance(world.getInstanceId()) != null) - { - checkMaxSummonLevel(player); - teleportPlayer(player, TELEPORT, world.getInstanceId()); - } - } - // New instance. - else - { - world = new InstanceWorld(); - world.setInstance(InstanceManager.getInstance().createDynamicInstance(INSTANCE_ID)); - InstanceManager.getInstance().addWorld(world); - - // Check max summon levels. - checkMaxSummonLevel(player); - - world.addAllowed(player); - teleportPlayer(player, TELEPORT, world.getInstanceId()); - } - } - - // Checks if the summon or pet that the player has can be used. - private void checkMaxSummonLevel(PlayerInstance player) - { - final Summon pet = player.getSummon(); - if ((pet != null) && pet.isPet()) - { - if (pet.getLevel() > MAX_SUMMON_LEVEL) - { - pet.unSummon(player); - } - } - } -} + static + { + NOEXIT_ZONES.put(200001, new int[]{123167, -45743, -3023}); + NOEXIT_ZONES.put(200002, new int[]{117783, -46398, -2560}); + NOEXIT_ZONES.put(200003, new int[]{116791, -51556, -2584}); + NOEXIT_ZONES.put(200004, new int[]{117993, -52505, -2480}); + NOEXIT_ZONES.put(200005, new int[]{113226, -44080, -2776}); + NOEXIT_ZONES.put(200006, new int[]{110326, -45016, -2444}); + NOEXIT_ZONES.put(200007, new int[]{118341, -55951, -2280}); + NOEXIT_ZONES.put(200008, new int[]{110127, -41562, -2332}); + } + private static final int[][] BUFFS = + { + {4357,2}, // Haste Lv2 + {4342,2}, // Wind Walk Lv2 + {4356,3}, // Empower Lv3 + {4355,3}, // Acumen Lv3 + {4351,6}, // Concentration Lv6 + {4345,3}, // Might Lv3 + {4358,3}, // Guidance Lv3 + {4359,3}, // Focus Lv3 + {4360,3}, // Death Wisper Lv3 + {4352,2}, // Berserker Spirit Lv2 + {4354,4}, // Vampiric Rage Lv4 + {4347,6} // Blessed Body Lv6 + }; + private static final int[][] HP_HERBS_DROPLIST = + { + // itemId, count, chance + { 8601, 1, 40 }, + { 8600, 1, 70 } + }; + private static final int[][] MP_HERBS_DROPLIST = + { + // itemId, count, chance + { 8604, 1, 40 }, + { 8603, 1, 70 } + }; + // @formatter:on + + static final Location TELEPORT = new Location(125757, -40928, -3736); + private static final int MIN_LEVEL = 73; + private static final int MAX_LEVEL = 77; + private static final int MAX_SUMMON_LEVEL = 80; + private static final int EXIT_TIME = 5; + private static final int INSTANCE_ID = 45; + private int buff_counter = 5; + + public Q00144_PailakaInjuredDragon() + { + super(144); + addStartNpc(KETRA_ORC_SHAMAN, KETRA_ORC_INTELIGENCE_OFFICER); + addFirstTalkId(KETRA_ORC_SUPPORTER, KETRA_ORC_INTELIGENCE_OFFICER, KETRA_ORC_SUPPORTER2); + addTalkId(KETRA_ORC_SHAMAN, KETRA_ORC_SUPPORTER, KETRA_ORC_INTELIGENCE_OFFICER, KETRA_ORC_SUPPORTER2); + addSpawnId(WALL_MONSTERS); + addKillId(WALL_MONSTERS); + addKillId(OTHER_MONSTERS); + addKillId(LATANA); + addSeeCreatureId(LATANA); + addEnterZoneId(NOEXIT_ZONES.keySet()); + registerQuestItems(ITEMS); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return null; + } + + if (event.equals("enter")) + { + enterInstance(player); + return "32499-08.html"; + } + else if (event.equals("enters")) + { + enterInstance(player); + return "32499-10.html"; + } + else if (event.equals("32499-02.htm")) + { + if (qs.getCond() == 0) + { + qs.startQuest(); + } + } + else if (event.equals("32499-04.html")) + { + if (qs.isCond(1)) + { + qs.setCond(2, true); + } + } + else if (event.equals("32502-04.html")) + { + if (qs.isCond(2) && !hasQuestItems(player, SPEAR)) + { + qs.setCond(3, true); + giveItems(player, SPEAR, 1); + } + } + else if (event.equals("32509-02.html")) + { + if (qs.isCond(3) && hasQuestItems(player, SPEAR)) + { + if (!hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1)) + { + return "32509-07.html"; + } + if (hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1)) + { + return "32509-01.html"; + } + if (hasQuestItems(player, SPEAR) && hasQuestItems(player, STAGE1)) + { + takeItems(player, SPEAR, -1); + takeItems(player, STAGE1, -1); + giveItems(player, ENCHSPEAR, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); // TODO: Set proper cond. + return "32509-02.html"; + } + } + if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR)) + { + if (!hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2)) + { + return "32509-07.html"; + } + if (hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2)) + { + return "32509-01.html"; + } + if (hasQuestItems(player, ENCHSPEAR) && hasQuestItems(player, STAGE2)) + { + takeItems(player, ENCHSPEAR, -1); + takeItems(player, STAGE2, -1); + giveItems(player, LASTSPEAR, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_MIDDLE.getPacket()); // TODO: Set proper cond. + addSpawn(LATANA, 105732, -41787, -1782, 35742, false, 0, false, npc.getInstanceId()); + return "32509-03.html"; + } + } + if (qs.isCond(3) && hasQuestItems(player, LASTSPEAR)) + { + if (hasQuestItems(player, LASTSPEAR)) + { + return "32509-03a.html"; + } + if (!hasQuestItems(player, LASTSPEAR)) + { + return "32509-07.html"; + } + } + return "32509-07.html"; + } + else if (event.equals("32509-06.html")) + { + if (buff_counter < 1) + { + return "32509-04.html"; + } + } + else if (event.equals("32512-02.html")) + { + final Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId()); + inst.setDuration(EXIT_TIME * 60000); + inst.setEmptyDestroyTime(0); + + if (inst.containsPlayer(player.getObjectId())) + { + player.setVitalityPoints(20000, true); + addExpAndSp(player, 28000000, 2850000); + giveItems(player, SCROLL_OF_ESCAPE, 1); + giveItems(player, PSHIRT, 1); + } + + qs.exitQuest(false, true); + } + else if (event.equals("LATANA_INTRO_CAMERA_START")) + { + npc.setScriptValue(1); + npc.abortAttack(); + npc.abortCast(); + npc.setIsInvul(true); + npc.setIsImmobilized(true); + npc.disableAllSkills(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + player.abortAttack(); + player.abortCast(); + player.stopMove(null); + player.setTarget(null); + if (player.hasSummon()) + { + player.getSummon().abortAttack(); + player.getSummon().abortCast(); + player.getSummon().stopMove(null); + player.getSummon().getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + player.sendPacket(new SpecialCamera(npc, 600, 200, 5, 0, 15000, 10000, (-10), 8, 1, 1, 1)); + startQuestTimer("LATANA_INTRO_CAMERA_2", 2000, npc, player); + return null; + } + else if (event.equals("LATANA_INTRO_CAMERA_2")) + { + player.sendPacket(new SpecialCamera(npc, 400, 200, 5, 4000, 15000, 10000, (-10), 8, 1, 1, 0)); + startQuestTimer("LATANA_INTRO_CAMERA_3", 4000, npc, player); + return null; + } + else if (event.equals("LATANA_INTRO_CAMERA_3")) + { + player.sendPacket(new SpecialCamera(npc, 300, 195, 4, 1500, 15000, 10000, (-5), 10, 1, 1, 0)); + startQuestTimer("LATANA_INTRO_CAMERA_4", 1700, npc, player); + return null; + } + else if (event.equals("LATANA_INTRO_CAMERA_4")) + { + player.sendPacket(new SpecialCamera(npc, 130, 2, 5, 0, 15000, 10000, 0, 0, 1, 0, 1)); + startQuestTimer("LATANA_INTRO_CAMERA_5", 2000, npc, player); + return null; + } + else if (event.equals("LATANA_INTRO_CAMERA_5")) + { + player.sendPacket(new SpecialCamera(npc, 220, 0, 4, 800, 15000, 10000, 5, 10, 1, 0, 0)); + startQuestTimer("LATANA_INTRO_CAMERA_6", 2000, npc, player); + return null; + } + else if (event.equals("LATANA_INTRO_CAMERA_6")) + { + player.sendPacket(new SpecialCamera(npc, 250, 185, 5, 4000, 15000, 10000, (-5), 10, 1, 1, 0)); + startQuestTimer("LATANA_INTRO_CAMERA_7", 4000, npc, player); + return null; + } + else if (event.equals("LATANA_INTRO_CAMERA_7")) + { + player.sendPacket(new SpecialCamera(npc, 200, 0, 5, 2000, 15000, 10000, 0, 25, 1, 0, 0)); + startQuestTimer("LATANA_INTRO_CAMERA_8", 4530, npc, player); + return null; + } + else if (event.equals("LATANA_INTRO_CAMERA_8")) + { + npc.doCast(SkillData.getInstance().getSkill(5759, 1)); + player.sendPacket(new SpecialCamera(npc, 300, (-3), 5, 3500, 15000, 6000, 0, 6, 1, 0, 0)); + startQuestTimer("LATANA_INTRO_CAMERA_9", 10000, npc, player); + return null; + } + else if (event.equals("LATANA_INTRO_CAMERA_9")) + { + npc.setIsInvul(false); + npc.setIsImmobilized(false); + npc.enableAllSkills(); + npc.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, player); + return null; + } + else if (event.equals("LATANA_DEATH_CAMERA_START")) + { + player.sendPacket(new SpecialCamera(npc, 450, 200, 3, 0, 15000, 10000, (-15), 20, 1, 1, 1)); + startQuestTimer("LATANA_DEATH_CAMERA_1", 100, npc, player); + return null; + } + else if (event.equals("LATANA_DEATH_CAMERA_1")) + { + player.sendPacket(new SpecialCamera(npc, 350, 200, 5, 5600, 15000, 10000, (-15), 10, 1, 1, 0)); + startQuestTimer("LATANA_DEATH_CAMERA_2", 5600, npc, player); + return null; + } + else if (event.equals("LATANA_DEATH_CAMERA_2")) + { + player.sendPacket(new SpecialCamera(npc, 360, 200, 5, 1000, 15000, 2000, (-15), 10, 1, 1, 0)); + return null; + } + else if (event.startsWith("buff")) + { + if (buff_counter > 0) + { + final int nr = Integer.parseInt(event.split("buff")[1]); + giveBuff(npc, player, BUFFS[nr - 1][0], BUFFS[nr - 1][1]); + return "32509-06a.html"; + } + return "32509-05.html"; + } + return event; + } + + @Override + public String onFirstTalk(Npc npc, PlayerInstance player) + { + return npc.getId() + ".html"; + } + + @Override + public String onTalk(Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, true); + + switch (npc.getId()) + { + case KETRA_ORC_SHAMAN: + { + switch (qs.getState()) + { + case State.CREATED: + { + if (player.getLevel() < MIN_LEVEL) + { + return "32499-no.html"; + } + if (player.getLevel() > MAX_LEVEL) + { + return "32499-over.html"; + } + return "32499-00.htm"; + } + case State.STARTED: + { + if (player.getLevel() < MIN_LEVEL) + { + return "32499-no.html"; + } + if (player.getLevel() > MAX_LEVEL) + { + return "32499-over.html"; + } + if (qs.isCond(1)) + { + return "32499-06.html"; + } + else if (qs.getCond() >= 2) + { + return "32499-09.html"; + } + } + case State.COMPLETED: + { + return "32499-completed.html"; + } + default: + { + return "32499-no.html"; + } + } + // break; + } + case KETRA_ORC_SUPPORTER: + { + if (qs.getCond() > 2) + { + return "32502-04.html"; + } + return "32502-00.html"; + } + case KETRA_ORC_SUPPORTER2: + { + if (qs.getState() == State.COMPLETED) + { + return "32512-03.html"; + } + else if (qs.isCond(4)) + { + return "32512-01.html"; + } + break; + } + } + return getNoQuestMsg(player); + } + + @Override + public String onKill(Npc npc, PlayerInstance player, boolean isSummon) + { + final QuestState qs = player.getQuestState(getName()); + if ((qs == null) || (qs.getState() != State.STARTED)) + { + return null; + } + + // There are lots of mobs walls, and item get is random, it could happen that you dont get the item until the last wall, and there's 4 different silenos groups. 1 enchant comes only from group 2 and the 2nd comes from group 4. Chances, lets say 20% of getting the enchant when killing the + // right mob When you kill a mob wall, another mage type appears behind. If all mobs from the front are killed then the ones that are behind are despawned. Also this mobs should be damaged, like with 30% of max HP, because they should be easy to kill. + switch (npc.getId()) + { + case VARKA_SILENOS_FOOTMAN: + case VARKA_SILENOS_RECRUIT: + { + dropHerb(npc, player, HP_HERBS_DROPLIST); + if (qs.isCond(3) && hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1) && (Rnd.get(100) < 25)) + { + giveItems(player, STAGE1, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); + } + // Spawns Mage Type silenos behind the one that was killed. + spawnMageBehind(npc, player, VARKA_SILENOS_MEDIUM); + // Check if all the first row have been killed. Despawn mages. + checkIfLastInWall(npc); + break; + } + case VARKA_SILENOS_WARRIOR: + { + dropHerb(npc, player, HP_HERBS_DROPLIST); + if (qs.isCond(3) && hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1) && (Rnd.get(100) < 25)) + { + giveItems(player, STAGE1, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); + } + // Spawns Mage Type silenos behind the one that was killed. + spawnMageBehind(npc, player, VARKA_SILENOS_PRIEST); + // Check if all the first row have been killed. Despawn mages. + checkIfLastInWall(npc); + break; + } + case VARKA_ELITE_GUARD: + { + dropHerb(npc, player, HP_HERBS_DROPLIST); + if (qs.isCond(3) && hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1) && (Rnd.get(100) < 25)) + { + giveItems(player, STAGE1, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); + } + // Spawns Mage Type silenos behind the one that was killed. + spawnMageBehind(npc, player, VARKA_SILENOS_SHAMAN); + // Check if all the first row have been killed. Despawn mages. + checkIfLastInWall(npc); + break; + } + case VARKAS_COMMANDER: + case VARKA_SILENOS_OFFICER: + { + dropHerb(npc, player, HP_HERBS_DROPLIST); + if (qs.isCond(3) && hasQuestItems(player, SPEAR) && !hasQuestItems(player, STAGE1) && (Rnd.get(100) < 25)) + { + giveItems(player, STAGE1, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); + } + // Spawns Mage Type silenos behind the one that was killed. + spawnMageBehind(npc, player, VARKA_SILENOS_SEER); + // Check if all the first row have been killed. Despawn mages. + checkIfLastInWall(npc); + break; + } + case VARKA_SILENOS_GREAT_MAGUS: + case VARKA_SILENOS_GENERAL: + { + dropHerb(npc, player, HP_HERBS_DROPLIST); + if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2) && (Rnd.get(100) < 25)) + { + giveItems(player, STAGE2, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); + } + // Spawns Mage Type silenos behind the one that was killed. + spawnMageBehind(npc, player, VARKA_SILENOS_MAGNUS); + // Check if all the first row have been killed. Despawn mages. + checkIfLastInWall(npc); + break; + } + case VARKAS_PROPHET: + { + dropHerb(npc, player, HP_HERBS_DROPLIST); + if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2) && (Rnd.get(100) < 25)) + { + giveItems(player, STAGE2, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); + } + // Spawns Mage Type silenos behind the one that was killed. + spawnMageBehind(npc, player, DISCIPLE_OF_PROPHET); + // Check if all the first row have been killed. Despawn mages. + checkIfLastInWall(npc); + break; + } + case VARKA_SILENOS_HEAD_GUARD: + { + dropHerb(npc, player, HP_HERBS_DROPLIST); + if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2) && (Rnd.get(100) < 25)) + { + giveItems(player, STAGE2, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); + } + // Spawns Mage Type silenos behind the one that was killed. + spawnMageBehind(npc, player, VARKA_HEAD_MAGUS); + // Check if all the first row have been killed. Despawn mages. + checkIfLastInWall(npc); + break; + } + case PROPHET_GUARD: + { + dropHerb(npc, player, HP_HERBS_DROPLIST); + if (qs.isCond(3) && hasQuestItems(player, ENCHSPEAR) && !hasQuestItems(player, STAGE2) && (Rnd.get(100) < 25)) + { + giveItems(player, STAGE2, 1); + player.sendPacket(QuestSound.ITEMSOUND_QUEST_ITEMGET.getPacket()); + } + // Spawns Mage Type silenos behind the one that was killed. + spawnMageBehind(npc, player, VARKA_SILENOS_GREAT_SEER); + // Check if all the first row have been killed. Despawn mages. + checkIfLastInWall(npc); + break; + } + case LATANA: + { + qs.setCond(4, true); + startQuestTimer("LATANA_DEATH_CAMERA_START", 1000, npc, player); + addSpawn(KETRA_ORC_SUPPORTER2, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, false, npc.getInstanceId()); + break; + } + case ANTYLOPE_1: + case ANTYLOPE_2: + case ANTYLOPE_3: + case FLAVA: + { + dropItem(npc, player); + break; + } + default: + { + // hardcoded herb drops. + dropHerb(npc, player, HP_HERBS_DROPLIST); + dropHerb(npc, player, MP_HERBS_DROPLIST); + break; + } + } + return super.onKill(npc, player, isSummon); + } + + // Spawns Mage Type silenos behind the one that was killed. Aggro against the player that kill the mob. + private void spawnMageBehind(Npc npc, PlayerInstance player, int mageId) + { + final double rads = Math.toRadians(Util.convertHeadingToDegree(npc.getSpawn().getHeading()) + 180); + final int mageX = (int) (npc.getX() + (150 * Math.cos(rads))); + final int mageY = (int) (npc.getY() + (150 * Math.sin(rads))); + final Npc mageBack = addSpawn(mageId, mageX, mageY, npc.getZ(), npc.getSpawn().getHeading(), false, 0, true, npc.getInstanceId()); + mageBack.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, player, 1000); + } + + // This function will check if there is other mob alive in this wall of mobs. If all mobs in the first row are dead then despawn the second row mobs, the mages. + private void checkIfLastInWall(Npc npc) + { + final Collection knowns = World.getInstance().getVisibleObjectsInRange(npc, Npc.class, 700); + for (Npc npcs : knowns) + { + if (npcs.isDead()) + { + continue; + } + + switch (npc.getId()) + { + case VARKA_SILENOS_FOOTMAN: + case VARKA_SILENOS_RECRUIT: + case VARKA_SILENOS_WARRIOR: + { + switch (npcs.getId()) + { + case VARKA_SILENOS_FOOTMAN: + case VARKA_SILENOS_RECRUIT: + case VARKA_SILENOS_WARRIOR: + { + return; + } + } + break; + } + case VARKA_ELITE_GUARD: + case VARKAS_COMMANDER: + case VARKA_SILENOS_OFFICER: + { + switch (npcs.getId()) + { + case VARKA_ELITE_GUARD: + case VARKAS_COMMANDER: + case VARKA_SILENOS_OFFICER: + { + return; + } + } + break; + } + case VARKA_SILENOS_GREAT_MAGUS: + case VARKA_SILENOS_GENERAL: + case VARKAS_PROPHET: + { + switch (npcs.getId()) + { + case VARKA_SILENOS_GREAT_MAGUS: + case VARKA_SILENOS_GENERAL: + case VARKAS_PROPHET: + { + return; + } + } + break; + } + case VARKA_SILENOS_HEAD_GUARD: + case PROPHET_GUARD: + { + switch (npcs.getId()) + { + case VARKA_SILENOS_HEAD_GUARD: + case PROPHET_GUARD: + { + return; + } + } + break; + } + } + } + + // We didnt find any mob on the first row alive, so despawn the second row mobs. + for (Creature npcs : knowns) + { + if (npcs.isDead()) + { + continue; + } + + switch (npc.getId()) + { + case VARKA_SILENOS_FOOTMAN: + case VARKA_SILENOS_RECRUIT: + case VARKA_SILENOS_WARRIOR: + { + switch (npcs.getId()) + { + case VARKA_SILENOS_MEDIUM: + case VARKA_SILENOS_PRIEST: + { + npcs.abortCast(); + npcs.deleteMe(); + break; + } + } + break; + } + case VARKA_ELITE_GUARD: + case VARKAS_COMMANDER: + case VARKA_SILENOS_OFFICER: + { + switch (npcs.getId()) + { + case VARKA_SILENOS_SHAMAN: + case VARKA_SILENOS_SEER: + { + npcs.abortCast(); + npcs.deleteMe(); + break; + } + } + break; + } + case VARKA_SILENOS_GREAT_MAGUS: + case VARKA_SILENOS_GENERAL: + case VARKAS_PROPHET: + { + switch (npcs.getId()) + { + case VARKA_SILENOS_MAGNUS: + case DISCIPLE_OF_PROPHET: + { + npcs.abortCast(); + npcs.deleteMe(); + break; + } + } + break; + } + case VARKA_SILENOS_HEAD_GUARD: + case PROPHET_GUARD: + { + switch (npcs.getId()) + { + case VARKA_HEAD_MAGUS: + case VARKA_SILENOS_GREAT_SEER: + { + npcs.abortCast(); + npcs.deleteMe(); + break; + } + } + break; + } + } + } + } + + @Override + public String onSeeCreature(Npc npc, Creature creature, boolean isSummon) + { + if (creature.isPlayer() && npc.isScriptValue(0)) + { + final QuestState qs = getQuestState(creature.getActingPlayer(), false); + if ((qs == null) || (qs.getState() != State.STARTED) || isSummon) + { + return null; + } + startQuestTimer("LATANA_INTRO_CAMERA_START", 600, npc, creature.getActingPlayer()); + } + return super.onSeeCreature(npc, creature, isSummon); + } + + @Override + public String onSpawn(Npc npc) + { + if (npc.isMonster()) + { + for (int mobId : WALL_MONSTERS) + { + // Every monster on pailaka should be Aggresive and Active, with the same clan, also wall mobs cannot move, they all use magic from far, and if you get in combat range they hit. + if (mobId == npc.getId()) + { + final MonsterInstance monster = (MonsterInstance) npc; + monster.setIsImmobilized(true); + break; + } + } + } + return super.onSpawn(npc); + } + + @Override + public String onEnterZone(Creature creature, ZoneType zone) + { + if (creature.isPlayer() && !creature.isDead() && !creature.isTeleporting() && ((PlayerInstance) creature).isOnline()) + { + final InstanceWorld world = InstanceManager.getInstance().getWorld(creature); + if ((world != null) && (world.getTemplateId() == INSTANCE_ID)) + { + // If a player wants to go by a mob wall without kill it, he will be returned back to a spawn point. + final int[] zoneTeleport = NOEXIT_ZONES.get(zone.getId()); + if (zoneTeleport != null) + { + for (Creature npc : World.getInstance().getVisibleObjectsInRange(creature, Npc.class, 700)) + { + if (npc.isDead()) + { + continue; + } + teleportPlayer(creature.getActingPlayer(), zoneTeleport, world.getInstanceId()); + break; + } + } + } + } + return super.onEnterZone(creature, zone); + } + + private void dropHerb(Npc mob, PlayerInstance player, int[][] drop) + { + final int chance = Rnd.get(100); + for (int[] element : drop) + { + if (chance < element[2]) + { + ((MonsterInstance) mob).dropItem(player, element[0], element[1]); + return; + } + } + } + + private void dropItem(Npc mob, PlayerInstance player) + { + // To make random drops, we shuffle the droplist every time its used. + Collections.shuffle(DROPLIST); + for (ItemChanceHolder drop : DROPLIST) + { + if (Rnd.get(100) < drop.getChance()) + { + ((MonsterInstance) mob).dropItem(player, drop.getId(), Rnd.get(1, 6)); + return; + } + } + } + + private void giveBuff(Npc npc, PlayerInstance player, int skillId, int level) + { + buff_counter--; + npc.setTarget(player); + npc.doCast(SkillData.getInstance().getSkill(skillId, level)); + } + + private void teleportPlayer(PlayerInstance player, int[] coords, int instanceId) + { + player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + player.setInstanceId(instanceId); + player.teleToLocation(coords[0], coords[1], coords[2], true); + } + + private synchronized void enterInstance(PlayerInstance player) + { + // Check for existing instances for this player. + InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); + if (world != null) + { + if (world.getTemplateId() != INSTANCE_ID) + { + player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANCE_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); + return; + } + if (InstanceManager.getInstance().getInstance(world.getInstanceId()) != null) + { + checkMaxSummonLevel(player); + teleportPlayer(player, TELEPORT, world.getInstanceId()); + } + } + // New instance. + else + { + world = new InstanceWorld(); + world.setInstance(InstanceManager.getInstance().createDynamicInstance(INSTANCE_ID)); + InstanceManager.getInstance().addWorld(world); + + // Check max summon levels. + checkMaxSummonLevel(player); + + world.addAllowed(player); + teleportPlayer(player, TELEPORT, world.getInstanceId()); + } + } + + // Checks if the summon or pet that the player has can be used. + private void checkMaxSummonLevel(PlayerInstance player) + { + final Summon pet = player.getSummon(); + if ((pet != null) && pet.isPet()) + { + if (pet.getLevel() > MAX_SUMMON_LEVEL) + { + pet.unSummon(player); + } + } + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java index 2a8c81184f..d4da0c3af8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java @@ -1,715 +1,720 @@ -/* - * 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 . - */ -package quests.Q00255_Tutorial; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.Config; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.quest.Quest; -import com.l2jmobius.gameserver.model.quest.QuestState; - -public class Q00255_Tutorial extends Quest -{ - // @formatter:off - // table for Quest Timer ( Ex == -2 ) [raceId, voice, html] - private static final String[][] QTEXMTWO = - { - {"0", "tutorial_voice_001a", "tutorial_human_fighter001.htm"}, - {"10", "tutorial_voice_001b", "tutorial_human_mage001.htm"}, - {"18", "tutorial_voice_001c", "tutorial_elven_fighter001.htm"}, - {"25", "tutorial_voice_001d", "tutorial_elven_mage001.htm"}, - {"31", "tutorial_voice_001e", "tutorial_delf_fighter001.htm"}, - {"38", "tutorial_voice_001f", "tutorial_delf_mage001.htm"}, - {"44", "tutorial_voice_001g", "tutorial_orc_fighter001.htm"}, - {"49", "tutorial_voice_001h", "tutorial_orc_mage001.htm"}, - {"53", "tutorial_voice_001i", "tutorial_dwarven_fighter001.htm"}, - {"123", "tutorial_voice_001k", "tutorial_kamael_male001.htm"}, - {"124", "tutorial_voice_001j", "tutorial_kamael_female001.htm"} - }; - // table for Client Event Enable (8) [raceId, html, x, y, z] - private static final String[][] CEEa = - { - {"0", "tutorial_human_fighter007.htm", "-71424", "258336", "-3109"}, - {"10", "tutorial_human_mage007.htm", "-91036", "248044", "-3568"}, - {"18", "tutorial_elf007.htm", "46112", "41200", "-3504"}, - {"25", "tutorial_elf007.htm", "46112", "41200", "-3504"}, - {"31", "tutorial_delf007.htm", "28384", "11056", "-4233"}, - {"38", "tutorial_delf007.htm", "28384", "11056", "-4233"}, - {"44", "tutorial_orc007.htm", "-56736", "-113680", "-672"}, - {"49", "tutorial_orc007.htm", "-56736", "-113680", "-672"}, - {"53", "tutorial_dwarven_fighter007.htm", "108567", "-173994", "-406"}, - {"123", "tutorial_kamael007.htm", "-125872", "38016", "1251"}, - {"124", "tutorial_kamael007.htm", "-125872", "38016", "1251"} - }; - // table for Question Mark Clicked (9 & 11) learning skills [raceId, html, x, y, z] - private static final String[][] QMCa = - { - {"0", "tutorial_fighter017.htm", "-83165", "242711", "-3720"}, - {"10", "tutorial_mage017.htm", "-85247", "244718", "-3720"}, - {"18", "tutorial_fighter017.htm", "45610", "52206", "-2792"}, - {"25", "tutorial_mage017.htm", "45610", "52206", "-2792"}, - {"31", "tutorial_fighter017.htm", "10344", "14445", "-4242"}, - {"38", "tutorial_mage017.htm", "10344", "14445", "-4242"}, - {"44", "tutorial_fighter017.htm", "-46324", "-114384", "-200"}, - {"49", "tutorial_fighter017.htm", "-46305", "-112763", "-200"}, - {"53", "tutorial_fighter017.htm", "115447", "-182672", "-1440"}, - {"123", "tutorial_fighter017.htm", "-118132", "42788", "723"}, - {"124", "tutorial_fighter017.htm", "-118132", "42788", "723"}, - }; - // @formatter:on - // table for Question Mark Clicked (24) newbie lvl [raceId, html] +/* + * 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 . + */ +package quests.Q00255_Tutorial; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.Config; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; + +public class Q00255_Tutorial extends Quest +{ + // @formatter:off + // table for Quest Timer ( Ex == -2 ) [raceId, voice, html] + private static final String[][] QTEXMTWO = + { + {"0", "tutorial_voice_001a", "tutorial_human_fighter001.htm"}, + {"10", "tutorial_voice_001b", "tutorial_human_mage001.htm"}, + {"18", "tutorial_voice_001c", "tutorial_elven_fighter001.htm"}, + {"25", "tutorial_voice_001d", "tutorial_elven_mage001.htm"}, + {"31", "tutorial_voice_001e", "tutorial_delf_fighter001.htm"}, + {"38", "tutorial_voice_001f", "tutorial_delf_mage001.htm"}, + {"44", "tutorial_voice_001g", "tutorial_orc_fighter001.htm"}, + {"49", "tutorial_voice_001h", "tutorial_orc_mage001.htm"}, + {"53", "tutorial_voice_001i", "tutorial_dwarven_fighter001.htm"}, + {"123", "tutorial_voice_001k", "tutorial_kamael_male001.htm"}, + {"124", "tutorial_voice_001j", "tutorial_kamael_female001.htm"} + }; + // table for Client Event Enable (8) [raceId, html, x, y, z] + private static final String[][] CEEa = + { + {"0", "tutorial_human_fighter007.htm", "-71424", "258336", "-3109"}, + {"10", "tutorial_human_mage007.htm", "-91036", "248044", "-3568"}, + {"18", "tutorial_elf007.htm", "46112", "41200", "-3504"}, + {"25", "tutorial_elf007.htm", "46112", "41200", "-3504"}, + {"31", "tutorial_delf007.htm", "28384", "11056", "-4233"}, + {"38", "tutorial_delf007.htm", "28384", "11056", "-4233"}, + {"44", "tutorial_orc007.htm", "-56736", "-113680", "-672"}, + {"49", "tutorial_orc007.htm", "-56736", "-113680", "-672"}, + {"53", "tutorial_dwarven_fighter007.htm", "108567", "-173994", "-406"}, + {"123", "tutorial_kamael007.htm", "-125872", "38016", "1251"}, + {"124", "tutorial_kamael007.htm", "-125872", "38016", "1251"} + }; + // table for Question Mark Clicked (9 & 11) learning skills [raceId, html, x, y, z] + private static final String[][] QMCa = + { + {"0", "tutorial_fighter017.htm", "-83165", "242711", "-3720"}, + {"10", "tutorial_mage017.htm", "-85247", "244718", "-3720"}, + {"18", "tutorial_fighter017.htm", "45610", "52206", "-2792"}, + {"25", "tutorial_mage017.htm", "45610", "52206", "-2792"}, + {"31", "tutorial_fighter017.htm", "10344", "14445", "-4242"}, + {"38", "tutorial_mage017.htm", "10344", "14445", "-4242"}, + {"44", "tutorial_fighter017.htm", "-46324", "-114384", "-200"}, + {"49", "tutorial_fighter017.htm", "-46305", "-112763", "-200"}, + {"53", "tutorial_fighter017.htm", "115447", "-182672", "-1440"}, + {"123", "tutorial_fighter017.htm", "-118132", "42788", "723"}, + {"124", "tutorial_fighter017.htm", "-118132", "42788", "723"}, + }; + // @formatter:on + // table for Question Mark Clicked (24) newbie lvl [raceId, html] private static final Map QMCb = new HashMap<>(); - { - QMCb.put(0, "tutorial_human009.htm"); - QMCb.put(10, "tutorial_human009.htm"); - QMCb.put(18, "tutorial_elf009.htm"); - QMCb.put(25, "tutorial_elf009.htm"); - QMCb.put(31, "tutorial_delf009.htm"); - QMCb.put(38, "tutorial_delf009.htm"); - QMCb.put(44, "tutorial_orc009.htm"); - QMCb.put(49, "tutorial_orc009.htm"); - QMCb.put(53, "tutorial_dwarven009.htm"); - QMCb.put(123, "tutorial_kamael009.htm"); - QMCb.put(124, "tutorial_kamael009.htm"); - } - // table for Question Mark Clicked (35) 1st class transfer [raceId, html] + static + { + QMCb.put(0, "tutorial_human009.htm"); + QMCb.put(10, "tutorial_human009.htm"); + QMCb.put(18, "tutorial_elf009.htm"); + QMCb.put(25, "tutorial_elf009.htm"); + QMCb.put(31, "tutorial_delf009.htm"); + QMCb.put(38, "tutorial_delf009.htm"); + QMCb.put(44, "tutorial_orc009.htm"); + QMCb.put(49, "tutorial_orc009.htm"); + QMCb.put(53, "tutorial_dwarven009.htm"); + QMCb.put(123, "tutorial_kamael009.htm"); + QMCb.put(124, "tutorial_kamael009.htm"); + } + // table for Question Mark Clicked (35) 1st class transfer [raceId, html] private static final Map QMCc = new HashMap<>(); - { - QMCc.put(0, "tutorial_21.htm"); - QMCc.put(10, "tutorial_21a.htm"); - QMCc.put(18, "tutorial_21b.htm"); - QMCc.put(25, "tutorial_21c.htm"); - QMCc.put(31, "tutorial_21g.htm"); - QMCc.put(38, "tutorial_21h.htm"); - QMCc.put(44, "tutorial_21d.htm"); - QMCc.put(49, "tutorial_21e.htm"); - QMCc.put(53, "tutorial_21f.htm"); - QMCc.put(53, "tutorial_21f.htm"); - } - // table for Tutorial Close Link (26) 2nd class transfer [raceId, html] + static + { + QMCc.put(0, "tutorial_21.htm"); + QMCc.put(10, "tutorial_21a.htm"); + QMCc.put(18, "tutorial_21b.htm"); + QMCc.put(25, "tutorial_21c.htm"); + QMCc.put(31, "tutorial_21g.htm"); + QMCc.put(38, "tutorial_21h.htm"); + QMCc.put(44, "tutorial_21d.htm"); + QMCc.put(49, "tutorial_21e.htm"); + QMCc.put(53, "tutorial_21f.htm"); + QMCc.put(53, "tutorial_21f.htm"); + } + // table for Tutorial Close Link (26) 2nd class transfer [raceId, html] private static final Map TCLa = new HashMap<>(); - { - TCLa.put(1, "tutorial_22w.htm"); - TCLa.put(4, "tutorial_22.htm"); - TCLa.put(7, "tutorial_22b.htm"); - TCLa.put(11, "tutorial_22c.htm"); - TCLa.put(15, "tutorial_22d.htm"); - TCLa.put(19, "tutorial_22e.htm"); - TCLa.put(22, "tutorial_22f.htm"); - TCLa.put(26, "tutorial_22g.htm"); - TCLa.put(29, "tutorial_22h.htm"); - TCLa.put(32, "tutorial_22n.htm"); - TCLa.put(35, "tutorial_22o.htm"); - TCLa.put(39, "tutorial_22p.htm"); - TCLa.put(42, "tutorial_22q.htm"); - TCLa.put(45, "tutorial_22i.htm"); - TCLa.put(47, "tutorial_22j.htm"); - TCLa.put(50, "tutorial_22k.htm"); - TCLa.put(54, "tutorial_22l.htm"); - TCLa.put(56, "tutorial_22m.htm"); - } - // table for Tutorial Close Link (23) 2nd class transfer [raceId, html] + static + { + TCLa.put(1, "tutorial_22w.htm"); + TCLa.put(4, "tutorial_22.htm"); + TCLa.put(7, "tutorial_22b.htm"); + TCLa.put(11, "tutorial_22c.htm"); + TCLa.put(15, "tutorial_22d.htm"); + TCLa.put(19, "tutorial_22e.htm"); + TCLa.put(22, "tutorial_22f.htm"); + TCLa.put(26, "tutorial_22g.htm"); + TCLa.put(29, "tutorial_22h.htm"); + TCLa.put(32, "tutorial_22n.htm"); + TCLa.put(35, "tutorial_22o.htm"); + TCLa.put(39, "tutorial_22p.htm"); + TCLa.put(42, "tutorial_22q.htm"); + TCLa.put(45, "tutorial_22i.htm"); + TCLa.put(47, "tutorial_22j.htm"); + TCLa.put(50, "tutorial_22k.htm"); + TCLa.put(54, "tutorial_22l.htm"); + TCLa.put(56, "tutorial_22m.htm"); + } + // table for Tutorial Close Link (23) 2nd class transfer [raceId, html] private static final Map TCLb = new HashMap<>(); - { - TCLb.put(4, "tutorial_22aa.htm"); - TCLb.put(7, "tutorial_22ba.htm"); - TCLb.put(11, "tutorial_22ca.htm"); - TCLb.put(15, "tutorial_22da.htm"); - TCLb.put(19, "tutorial_22ea.htm"); - TCLb.put(22, "tutorial_22fa.htm"); - TCLb.put(26, "tutorial_22ga.htm"); - TCLb.put(32, "tutorial_22na.htm"); - TCLb.put(35, "tutorial_22oa.htm"); - TCLb.put(39, "tutorial_22pa.htm"); - TCLb.put(50, "tutorial_22ka.htm"); - } - // table for Tutorial Close Link (24) 2nd class transfer [raceId, html] + static + { + TCLb.put(4, "tutorial_22aa.htm"); + TCLb.put(7, "tutorial_22ba.htm"); + TCLb.put(11, "tutorial_22ca.htm"); + TCLb.put(15, "tutorial_22da.htm"); + TCLb.put(19, "tutorial_22ea.htm"); + TCLb.put(22, "tutorial_22fa.htm"); + TCLb.put(26, "tutorial_22ga.htm"); + TCLb.put(32, "tutorial_22na.htm"); + TCLb.put(35, "tutorial_22oa.htm"); + TCLb.put(39, "tutorial_22pa.htm"); + TCLb.put(50, "tutorial_22ka.htm"); + } + // table for Tutorial Close Link (24) 2nd class transfer [raceId, html] private static final Map TCLc = new HashMap<>(); - { - TCLc.put(4, "tutorial_22ab.htm"); - TCLc.put(7, "tutorial_22bb.htm"); - TCLc.put(11, "tutorial_22cb.htm"); - TCLc.put(15, "tutorial_22db.htm"); - TCLc.put(19, "tutorial_22eb.htm"); - TCLc.put(22, "tutorial_22fb.htm"); - TCLc.put(26, "tutorial_22gb.htm"); - TCLc.put(32, "tutorial_22nb.htm"); - TCLc.put(35, "tutorial_22ob.htm"); - TCLc.put(39, "tutorial_22pb.htm"); - TCLc.put(50, "tutorial_22kb.htm"); - } - - public Q00255_Tutorial() - { - super(-1); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - - if (Config.DISABLE_TUTORIAL) - { - return ""; - } - - if (qs == null) - { - return null; - } - - String html = ""; - - final int classId = player.getClassId().getId(); - final int Ex = qs.getInt("Ex"); - - if (event.startsWith("UC")) - { - if ((player.getLevel() < 6) && (qs.getInt("onlyone") == 0)) - { - switch (qs.getInt("ucMemo")) - { - case 0: - { - qs.set("ucMemo", "0"); - startQuestTimer("QT", 10000, null, player, false); - qs.set("Ex", "-2"); - break; - } - case 1: - { - qs.showQuestionMark(1); - qs.playTutorialVoice("tutorial_voice_006"); - playSound(player, "ItemSound.quest_tutorial"); - break; - } - case 2: - { - if (Ex == 2) - { - qs.showQuestionMark(3); - } - else if (getQuestItemsCount(player, 6353) > 0) - { - qs.showQuestionMark(5); - } - playSound(player, "ItemSound.quest_tutorial"); - break; - } - case 3: - { - qs.showQuestionMark(12); - playSound(player, "ItemSound.quest_tutorial"); - qs.onTutorialClientEvent(0); - break; - } - } - } - } - else if (event.startsWith("QT")) - { - if (Ex == -2) - { - String voice = ""; - for (String[] element : QTEXMTWO) - { - if (classId == Integer.valueOf(element[0])) - { - voice = element[1]; - html = element[2]; - } - } - qs.playTutorialVoice(voice); - qs.set("Ex", "-3"); - cancelQuestTimers("QT"); - startQuestTimer("QT", 30000, null, player, false); - } - else if (Ex == -3) - { - qs.playTutorialVoice("tutorial_voice_002"); - qs.set("Ex", "0"); - } - else if (Ex == -4) - { - qs.playTutorialVoice("tutorial_voice_008"); - qs.set("Ex", "-5"); - } - } - // Tutorial close - else if (event.startsWith("TE")) - { - cancelQuestTimers("TE"); - if (!event.equalsIgnoreCase("TE")) - { - switch (Integer.valueOf(event.substring(2))) - { - case 0: - { - qs.closeTutorialHtml(); - break; - } - case 1: - { - qs.closeTutorialHtml(); - qs.playTutorialVoice("tutorial_voice_006"); - qs.showQuestionMark(1); - playSound(player, "ItemSound.quest_tutorial"); - startQuestTimer("QT", 30000, null, player, false); - qs.set("Ex", "-4"); - break; - } - case 2: - { - qs.playTutorialVoice("tutorial_voice_003"); - html = "tutorial_02.htm"; - qs.onTutorialClientEvent(1); - qs.set("Ex", "-5"); - break; - } - case 3: - { - html = "tutorial_03.htm"; - qs.onTutorialClientEvent(2); - break; - } - case 5: - { - html = "tutorial_05.htm"; - qs.onTutorialClientEvent(8); - break; - } - case 7: - { - html = "tutorial_100.htm"; - qs.onTutorialClientEvent(0); - break; - } - case 8: - { - html = "tutorial_101.htm"; - qs.onTutorialClientEvent(0); - break; - } - case 10: - { - html = "tutorial_103.htm"; - qs.onTutorialClientEvent(0); - break; - } - case 12: - { - qs.closeTutorialHtml(); - break; - } - case 23: - { - if (TCLb.containsKey(classId)) - { - html = TCLb.get(classId); - } - break; - } - case 24: - { - if (TCLc.containsKey(classId)) - { - html = TCLc.get(classId); - } - break; - } - case 25: - { - html = "tutorial_22cc.htm"; - break; - } - case 26: - { - if (TCLa.containsKey(classId)) - { - html = TCLa.get(classId); - } - break; - } - case 27: - { - html = "tutorial_29.htm"; - break; - } - case 28: - { - html = "tutorial_28.htm"; - break; - } - } - } - } - // Client Event - else if (event.startsWith("CE")) - { - final int event_id = Integer.valueOf(event.substring(2)); - if ((event_id == 1) && (player.getLevel() < 6)) - { - qs.playTutorialVoice("tutorial_voice_004"); - html = "tutorial_03.htm"; - playSound(player, "ItemSound.quest_tutorial"); - qs.onTutorialClientEvent(2); - } - else if ((event_id == 2) && (player.getLevel() < 6)) - { - qs.playTutorialVoice("tutorial_voice_005"); - html = "tutorial_05.htm"; - playSound(player, "ItemSound.quest_tutorial"); - qs.onTutorialClientEvent(8); - } - else if ((event_id == 8) && (player.getLevel() < 6)) - { - int x = 0; - int y = 0; - int z = 0; - for (String[] element : CEEa) - { - if (classId == Integer.valueOf(element[0])) - { - html = element[1]; - x = Integer.valueOf(element[2]); - y = Integer.valueOf(element[3]); - z = Integer.valueOf(element[4]); - } - } - if (x != 0) - { - playSound(player, "ItemSound.quest_tutorial"); - addRadar(player, x, y, z); - qs.playTutorialVoice("tutorial_voice_007"); - qs.set("ucMemo", "1"); - qs.set("Ex", "-5"); - } - } - else if ((event_id == 30) && (player.getLevel() < 10) && (qs.getInt("Die") == 0)) - { - qs.playTutorialVoice("tutorial_voice_016"); - playSound(player, "ItemSound.quest_tutorial"); - qs.set("Die", "1"); - qs.showQuestionMark(8); - qs.onTutorialClientEvent(0); - } - else if ((event_id == 800000) && (player.getLevel() < 6) && (qs.getInt("sit") == 0)) - { - qs.playTutorialVoice("tutorial_voice_018"); - playSound(player, "ItemSound.quest_tutorial"); - qs.set("sit", "1"); - qs.onTutorialClientEvent(0); - html = "tutorial_21z.htm"; - } - else if (event_id == 40) - { - switch (player.getLevel()) - { - case 5: - { - if (((qs.getInt("lvl") < 5) && !player.isMageClass()) || (classId == 49)) - { - qs.playTutorialVoice("tutorial_voice_014"); - qs.showQuestionMark(9); - playSound(player, "ItemSound.quest_tutorial"); - qs.set("lvl", "5"); - } - break; - } - case 6: - { - if ((qs.getInt("lvl") < 6) && (player.getClassId().level() == 0)) - { - qs.playTutorialVoice("tutorial_voice_020"); - playSound(player, "ItemSound.quest_tutorial"); - qs.showQuestionMark(24); - qs.set("lvl", "6"); - } - break; - } - case 7: - { - if ((qs.getInt("lvl") < 7) && player.isMageClass() && (classId != 49) && (player.getClassId().level() == 0)) - { - qs.playTutorialVoice("tutorial_voice_019"); - playSound(player, "ItemSound.quest_tutorial"); - qs.set("lvl", "7"); - qs.showQuestionMark(11); - } - break; - } - case 15: - { - if (qs.getInt("lvl") < 15) - { - playSound(player, "ItemSound.quest_tutorial"); - qs.set("lvl", "15"); - qs.showQuestionMark(33); - } - break; - } - case 19: - { - if ((qs.getInt("lvl") < 19) && (player.getClassId().level() == 0)) - { - switch (classId) - { - case 0: - case 10: - case 18: - case 25: - case 31: - case 38: - case 44: - case 49: - case 52: - { - playSound(player, "ItemSound.quest_tutorial"); - qs.set("lvl", "19"); - qs.showQuestionMark(35); - break; - } - } - } - break; - } - case 35: - { - if ((qs.getInt("lvl") < 35) && (player.getClassId().level() == 1)) - { - switch (classId) - { - case 1: - case 4: - case 7: - case 11: - case 15: - case 19: - case 22: - case 26: - case 29: - case 32: - case 35: - case 39: - case 42: - case 45: - case 47: - case 50: - case 54: - case 56: - { - playSound(player, "ItemSound.quest_tutorial"); - qs.set("lvl", "35"); - qs.showQuestionMark(34); - break; - } - } - } - break; - } - } - } - else if ((event_id == 45) && (player.getLevel() < 10) && (qs.getInt("HP") == 0)) - { - qs.playTutorialVoice("tutorial_voice_017"); - playSound(player, "ItemSound.quest_tutorial"); - qs.set("HP", "1"); - qs.showQuestionMark(10); - qs.onTutorialClientEvent(800000); - } - else if ((event_id == 57) && (player.getLevel() < 6) && (qs.getInt("Adena") == 0)) - { - qs.playTutorialVoice("tutorial_voice_012"); - playSound(player, "ItemSound.quest_tutorial"); - qs.set("Adena", "1"); - qs.showQuestionMark(23); - } - else if ((event_id == 6353) && (player.getLevel() < 6) && (qs.getInt("Gemstone") == 0)) - { - qs.playTutorialVoice("tutorial_voice_013"); - playSound(player, "ItemSound.quest_tutorial"); - qs.set("Gemstone", "1"); - qs.showQuestionMark(5); - } - else if ((event_id == 1048576) && (player.getLevel() < 6)) - { - qs.showQuestionMark(5); - qs.playTutorialVoice("tutorial_voice_013"); - playSound(player, "ItemSound.quest_tutorial"); - } - } - // Question mark clicked - else if (event.startsWith("QM")) - { - int x = 0; - int y = 0; - int z = 0; - switch (Integer.valueOf(event.substring(2))) - { - case 1: - { - qs.playTutorialVoice("tutorial_voice_007"); - qs.set("Ex", "-5"); - for (String[] element : CEEa) - { - if (classId == Integer.valueOf(element[0])) - { - html = element[1]; - x = Integer.valueOf(element[2]); - y = Integer.valueOf(element[3]); - z = Integer.valueOf(element[4]); - } - } - addRadar(player, x, y, z); - break; - } - case 3: - { - html = "tutorial_09.htm"; - qs.onTutorialClientEvent(1048576); - break; - } - case 5: - { - for (String[] element : CEEa) - { - if (classId == Integer.valueOf(element[0])) - { - html = element[1]; - x = Integer.valueOf(element[2]); - y = Integer.valueOf(element[3]); - z = Integer.valueOf(element[4]); - } - } - addRadar(player, x, y, z); - html = "tutorial_11.htm"; - break; - } - case 7: - { - html = "tutorial_15.htm"; - qs.set("ucMemo", "3"); - break; - } - case 8: - { - html = "tutorial_18.htm"; - break; - } - case 9: - { - for (String[] element : QMCa) - { - if (classId == Integer.valueOf(element[0])) - { - html = element[1]; - x = Integer.valueOf(element[2]); - y = Integer.valueOf(element[3]); - z = Integer.valueOf(element[4]); - } - } - if (x != 0) - { - addRadar(player, x, y, z); - } - break; - } - case 10: - { - html = "tutorial_19.htm"; - break; - } - case 11: - { - for (String[] element : QMCa) - { - if (classId == Integer.valueOf(element[0])) - { - html = element[1]; - x = Integer.valueOf(element[2]); - y = Integer.valueOf(element[3]); - z = Integer.valueOf(element[4]); - } - } - if (x != 0) - { - addRadar(player, x, y, z); - } - break; - } - case 12: - { - html = "tutorial_15.htm"; - qs.set("ucMemo", "4"); - break; - } - case 17: - { - html = "tutorial_30.htm"; - break; - } - case 23: - { - html = "tutorial_24.htm"; - break; - } - case 24: - { - if (QMCb.containsKey(classId)) - { - html = QMCb.get(classId); - } - break; - } - case 26: - { - html = player.isMageClass() && (classId != 49) ? "tutorial_newbie004b.htm" : "tutorial_newbie004a.htm"; - break; - } - case 33: - { - html = "tutorial_27.htm"; - break; - } - case 34: - { - html = "tutorial_28.htm"; - break; - } - case 35: - { - if (QMCc.containsKey(classId)) - { - html = QMCc.get(classId); - } - break; - } - } - } - - if (html.isEmpty()) - { - return null; - } - qs.showTutorialHTML(html); - return null; - } + static + { + TCLc.put(4, "tutorial_22ab.htm"); + TCLc.put(7, "tutorial_22bb.htm"); + TCLc.put(11, "tutorial_22cb.htm"); + TCLc.put(15, "tutorial_22db.htm"); + TCLc.put(19, "tutorial_22eb.htm"); + TCLc.put(22, "tutorial_22fb.htm"); + TCLc.put(26, "tutorial_22gb.htm"); + TCLc.put(32, "tutorial_22nb.htm"); + TCLc.put(35, "tutorial_22ob.htm"); + TCLc.put(39, "tutorial_22pb.htm"); + TCLc.put(50, "tutorial_22kb.htm"); + } + + public Q00255_Tutorial() + { + super(-1); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + + if (Config.DISABLE_TUTORIAL) + { + return ""; + } + + if (qs == null) + { + return null; + } + + String html = ""; + + final int classId = player.getClassId().getId(); + final int Ex = qs.getInt("Ex"); + + if (event.startsWith("UC")) + { + if ((player.getLevel() < 6) && (qs.getInt("onlyone") == 0)) + { + switch (qs.getInt("ucMemo")) + { + case 0: + { + qs.set("ucMemo", "0"); + startQuestTimer("QT", 10000, null, player, false); + qs.set("Ex", "-2"); + break; + } + case 1: + { + qs.showQuestionMark(1); + qs.playTutorialVoice("tutorial_voice_006"); + playSound(player, "ItemSound.quest_tutorial"); + break; + } + case 2: + { + if (Ex == 2) + { + qs.showQuestionMark(3); + } + else if (getQuestItemsCount(player, 6353) > 0) + { + qs.showQuestionMark(5); + } + playSound(player, "ItemSound.quest_tutorial"); + break; + } + case 3: + { + qs.showQuestionMark(12); + playSound(player, "ItemSound.quest_tutorial"); + qs.onTutorialClientEvent(0); + break; + } + } + } + } + else if (event.startsWith("QT")) + { + if (Ex == -2) + { + String voice = ""; + for (String[] element : QTEXMTWO) + { + if (classId == Integer.valueOf(element[0])) + { + voice = element[1]; + html = element[2]; + } + } + qs.playTutorialVoice(voice); + qs.set("Ex", "-3"); + cancelQuestTimers("QT"); + startQuestTimer("QT", 30000, null, player, false); + } + else if (Ex == -3) + { + qs.playTutorialVoice("tutorial_voice_002"); + qs.set("Ex", "0"); + } + else if (Ex == -4) + { + qs.playTutorialVoice("tutorial_voice_008"); + qs.set("Ex", "-5"); + } + } + // Tutorial close + else if (event.startsWith("TE")) + { + cancelQuestTimers("TE"); + if (!event.equalsIgnoreCase("TE")) + { + switch (Integer.valueOf(event.substring(2))) + { + case 0: + { + qs.closeTutorialHtml(); + break; + } + case 1: + { + qs.closeTutorialHtml(); + qs.playTutorialVoice("tutorial_voice_006"); + qs.showQuestionMark(1); + playSound(player, "ItemSound.quest_tutorial"); + startQuestTimer("QT", 30000, null, player, false); + qs.set("Ex", "-4"); + break; + } + case 2: + { + qs.playTutorialVoice("tutorial_voice_003"); + html = "tutorial_02.htm"; + qs.onTutorialClientEvent(1); + qs.set("Ex", "-5"); + break; + } + case 3: + { + html = "tutorial_03.htm"; + qs.onTutorialClientEvent(2); + break; + } + case 5: + { + html = "tutorial_05.htm"; + qs.onTutorialClientEvent(8); + break; + } + case 7: + { + html = "tutorial_100.htm"; + qs.onTutorialClientEvent(0); + break; + } + case 8: + { + html = "tutorial_101.htm"; + qs.onTutorialClientEvent(0); + break; + } + case 10: + { + html = "tutorial_103.htm"; + qs.onTutorialClientEvent(0); + break; + } + case 12: + { + qs.closeTutorialHtml(); + break; + } + case 23: + { + if (TCLb.containsKey(classId)) + { + html = TCLb.get(classId); + } + break; + } + case 24: + { + if (TCLc.containsKey(classId)) + { + html = TCLc.get(classId); + } + break; + } + case 25: + { + html = "tutorial_22cc.htm"; + break; + } + case 26: + { + if (TCLa.containsKey(classId)) + { + html = TCLa.get(classId); + } + break; + } + case 27: + { + html = "tutorial_29.htm"; + break; + } + case 28: + { + html = "tutorial_28.htm"; + break; + } + } + } + } + // Client Event + else if (event.startsWith("CE")) + { + final int event_id = Integer.valueOf(event.substring(2)); + if ((event_id == 1) && (player.getLevel() < 6)) + { + qs.playTutorialVoice("tutorial_voice_004"); + html = "tutorial_03.htm"; + playSound(player, "ItemSound.quest_tutorial"); + qs.onTutorialClientEvent(2); + } + else if ((event_id == 2) && (player.getLevel() < 6)) + { + qs.playTutorialVoice("tutorial_voice_005"); + html = "tutorial_05.htm"; + playSound(player, "ItemSound.quest_tutorial"); + qs.onTutorialClientEvent(8); + } + else if ((event_id == 8) && (player.getLevel() < 6)) + { + int x = 0; + int y = 0; + int z = 0; + for (String[] element : CEEa) + { + if (classId == Integer.valueOf(element[0])) + { + html = element[1]; + x = Integer.valueOf(element[2]); + y = Integer.valueOf(element[3]); + z = Integer.valueOf(element[4]); + } + } + if (x != 0) + { + playSound(player, "ItemSound.quest_tutorial"); + addRadar(player, x, y, z); + qs.playTutorialVoice("tutorial_voice_007"); + qs.set("ucMemo", "1"); + qs.set("Ex", "-5"); + } + } + else if ((event_id == 30) && (player.getLevel() < 10) && (qs.getInt("Die") == 0)) + { + qs.playTutorialVoice("tutorial_voice_016"); + playSound(player, "ItemSound.quest_tutorial"); + qs.set("Die", "1"); + qs.showQuestionMark(8); + qs.onTutorialClientEvent(0); + } + else if ((event_id == 800000) && (player.getLevel() < 6) && (qs.getInt("sit") == 0)) + { + qs.playTutorialVoice("tutorial_voice_018"); + playSound(player, "ItemSound.quest_tutorial"); + qs.set("sit", "1"); + qs.onTutorialClientEvent(0); + html = "tutorial_21z.htm"; + } + else if (event_id == 40) + { + switch (player.getLevel()) + { + case 5: + { + if (((qs.getInt("lvl") < 5) && !player.isMageClass()) || (classId == 49)) + { + qs.playTutorialVoice("tutorial_voice_014"); + qs.showQuestionMark(9); + playSound(player, "ItemSound.quest_tutorial"); + qs.set("lvl", "5"); + } + break; + } + case 6: + { + if ((qs.getInt("lvl") < 6) && (player.getClassId().level() == 0)) + { + qs.playTutorialVoice("tutorial_voice_020"); + playSound(player, "ItemSound.quest_tutorial"); + qs.showQuestionMark(24); + qs.set("lvl", "6"); + } + break; + } + case 7: + { + if ((qs.getInt("lvl") < 7) && player.isMageClass() && (classId != 49) && (player.getClassId().level() == 0)) + { + qs.playTutorialVoice("tutorial_voice_019"); + playSound(player, "ItemSound.quest_tutorial"); + qs.set("lvl", "7"); + qs.showQuestionMark(11); + } + break; + } + case 15: + { + if (qs.getInt("lvl") < 15) + { + playSound(player, "ItemSound.quest_tutorial"); + qs.set("lvl", "15"); + qs.showQuestionMark(33); + } + break; + } + case 19: + { + if ((qs.getInt("lvl") < 19) && (player.getClassId().level() == 0)) + { + switch (classId) + { + case 0: + case 10: + case 18: + case 25: + case 31: + case 38: + case 44: + case 49: + case 52: + { + playSound(player, "ItemSound.quest_tutorial"); + qs.set("lvl", "19"); + qs.showQuestionMark(35); + break; + } + } + } + break; + } + case 35: + { + if ((qs.getInt("lvl") < 35) && (player.getClassId().level() == 1)) + { + switch (classId) + { + case 1: + case 4: + case 7: + case 11: + case 15: + case 19: + case 22: + case 26: + case 29: + case 32: + case 35: + case 39: + case 42: + case 45: + case 47: + case 50: + case 54: + case 56: + { + playSound(player, "ItemSound.quest_tutorial"); + qs.set("lvl", "35"); + qs.showQuestionMark(34); + break; + } + } + } + break; + } + } + } + else if ((event_id == 45) && (player.getLevel() < 10) && (qs.getInt("HP") == 0)) + { + qs.playTutorialVoice("tutorial_voice_017"); + playSound(player, "ItemSound.quest_tutorial"); + qs.set("HP", "1"); + qs.showQuestionMark(10); + qs.onTutorialClientEvent(800000); + } + else if ((event_id == 57) && (player.getLevel() < 6) && (qs.getInt("Adena") == 0)) + { + qs.playTutorialVoice("tutorial_voice_012"); + playSound(player, "ItemSound.quest_tutorial"); + qs.set("Adena", "1"); + qs.showQuestionMark(23); + } + else if ((event_id == 6353) && (player.getLevel() < 6) && (qs.getInt("Gemstone") == 0)) + { + qs.playTutorialVoice("tutorial_voice_013"); + playSound(player, "ItemSound.quest_tutorial"); + qs.set("Gemstone", "1"); + qs.showQuestionMark(5); + } + else if ((event_id == 1048576) && (player.getLevel() < 6)) + { + qs.showQuestionMark(5); + qs.playTutorialVoice("tutorial_voice_013"); + playSound(player, "ItemSound.quest_tutorial"); + } + } + // Question mark clicked + else if (event.startsWith("QM")) + { + int x = 0; + int y = 0; + int z = 0; + switch (Integer.valueOf(event.substring(2))) + { + case 1: + { + qs.playTutorialVoice("tutorial_voice_007"); + qs.set("Ex", "-5"); + for (String[] element : CEEa) + { + if (classId == Integer.valueOf(element[0])) + { + html = element[1]; + x = Integer.valueOf(element[2]); + y = Integer.valueOf(element[3]); + z = Integer.valueOf(element[4]); + } + } + addRadar(player, x, y, z); + break; + } + case 3: + { + html = "tutorial_09.htm"; + qs.onTutorialClientEvent(1048576); + break; + } + case 5: + { + for (String[] element : CEEa) + { + if (classId == Integer.valueOf(element[0])) + { + html = element[1]; + x = Integer.valueOf(element[2]); + y = Integer.valueOf(element[3]); + z = Integer.valueOf(element[4]); + } + } + addRadar(player, x, y, z); + html = "tutorial_11.htm"; + break; + } + case 7: + { + html = "tutorial_15.htm"; + qs.set("ucMemo", "3"); + break; + } + case 8: + { + html = "tutorial_18.htm"; + break; + } + case 9: + { + for (String[] element : QMCa) + { + if (classId == Integer.valueOf(element[0])) + { + html = element[1]; + x = Integer.valueOf(element[2]); + y = Integer.valueOf(element[3]); + z = Integer.valueOf(element[4]); + } + } + if (x != 0) + { + addRadar(player, x, y, z); + } + break; + } + case 10: + { + html = "tutorial_19.htm"; + break; + } + case 11: + { + for (String[] element : QMCa) + { + if (classId == Integer.valueOf(element[0])) + { + html = element[1]; + x = Integer.valueOf(element[2]); + y = Integer.valueOf(element[3]); + z = Integer.valueOf(element[4]); + } + } + if (x != 0) + { + addRadar(player, x, y, z); + } + break; + } + case 12: + { + html = "tutorial_15.htm"; + qs.set("ucMemo", "4"); + break; + } + case 17: + { + html = "tutorial_30.htm"; + break; + } + case 23: + { + html = "tutorial_24.htm"; + break; + } + case 24: + { + if (QMCb.containsKey(classId)) + { + html = QMCb.get(classId); + } + break; + } + case 26: + { + html = player.isMageClass() && (classId != 49) ? "tutorial_newbie004b.htm" : "tutorial_newbie004a.htm"; + break; + } + case 33: + { + html = "tutorial_27.htm"; + break; + } + case 34: + { + html = "tutorial_28.htm"; + break; + } + case 35: + { + if (QMCc.containsKey(classId)) + { + html = QMCc.get(classId); + } + break; + } + } + } + + if (html.isEmpty()) + { + return null; + } + qs.showTutorialHTML(html); + return null; + } } \ No newline at end of file diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java index fe027feceb..725feb86e2 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java @@ -66,7 +66,6 @@ public final class Q00257_TheGuardIsBusy extends Quest private static final int ORC_AMULET = 752; private static final int ORC_NECKLACE = 1085; private static final int WEREWOLF_FANG = 1086; - static { MONSTERS.put(20006, Arrays.asList(new MobDrop(10, 2, ORC_AMULET, 2), new MobDrop(10, 10, ORC_AMULET, 1))); // Orc Archer diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00262_TradeWithTheIvoryTower/Q00262_TradeWithTheIvoryTower.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00262_TradeWithTheIvoryTower/Q00262_TradeWithTheIvoryTower.java index 29f7171fe9..f244e02d61 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00262_TradeWithTheIvoryTower/Q00262_TradeWithTheIvoryTower.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00262_TradeWithTheIvoryTower/Q00262_TradeWithTheIvoryTower.java @@ -42,7 +42,6 @@ public final class Q00262_TradeWithTheIvoryTower extends Quest private static final int REQUIRED_ITEM_COUNT = 10; // Monsters private static final Map MOBS_SAC = new HashMap<>(); - static { MOBS_SAC.put(20007, 3); // Green Fungus diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java index e5820ab566..87fa42eb09 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java @@ -54,7 +54,6 @@ public final class Q00276_TotemOfTheHestui extends Quest // Misc private static final List SPAWN_CHANCES = new ArrayList<>(); private static final int MIN_LVL = 15; - static { SPAWN_CHANCES.add(new ItemHolder(79, 100)); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00281_HeadForTheHills/Q00281_HeadForTheHills.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00281_HeadForTheHills/Q00281_HeadForTheHills.java index 1510749844..d44e478160 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00281_HeadForTheHills/Q00281_HeadForTheHills.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00281_HeadForTheHills/Q00281_HeadForTheHills.java @@ -62,7 +62,6 @@ public final class Q00281_HeadForTheHills extends Quest }; private static final ItemHolder SOULSHOTS_NO_GRADE_FOR_ROOKIES = new ItemHolder(5789, 6000); private static final ItemHolder SPIRITSHOTS_NO_GRADE_FOR_ROOKIES = new ItemHolder(5790, 3000); - static { MONSTERS.put(22234, 390); // Green Goblin diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00287_FiguringItOut/Q00287_FiguringItOut.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00287_FiguringItOut/Q00287_FiguringItOut.java index 55c58c6526..ecf57b44c2 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00287_FiguringItOut/Q00287_FiguringItOut.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00287_FiguringItOut/Q00287_FiguringItOut.java @@ -38,7 +38,6 @@ public class Q00287_FiguringItOut extends Quest // NPCs private static final int LAKI = 32742; private static final Map MONSTERS = new HashMap<>(); - static { MONSTERS.put(22768, 509); // Tanta Lizardman Scout diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java index 84a86146dd..0417d88313 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00290_ThreatRemoval/Q00290_ThreatRemoval.java @@ -46,7 +46,6 @@ public class Q00290_ThreatRemoval extends Quest private static final int MIN_LEVEL = 82; private static final Map MOBS_TAG = new HashMap<>(); - static { MOBS_TAG.put(22775, 932); // Sel Mahum Drill Sergeant diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00300_HuntingLetoLizardman/Q00300_HuntingLetoLizardman.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00300_HuntingLetoLizardman/Q00300_HuntingLetoLizardman.java index a2c8494ce3..aff063e1e8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00300_HuntingLetoLizardman/Q00300_HuntingLetoLizardman.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00300_HuntingLetoLizardman/Q00300_HuntingLetoLizardman.java @@ -46,7 +46,6 @@ public final class Q00300_HuntingLetoLizardman extends Quest private static final int REQUIRED_BRACELET_COUNT = 60; // Monsters private static final Map MOBS_SAC = new HashMap<>(); - static { MOBS_SAC.put(20577, 360); // Leto Lizardman diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java index 47e344b884..aea1d4d0a5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java @@ -78,7 +78,6 @@ public final class Q00327_RecoverTheFarmland extends Quest new ItemHolder(ANCIENT_BRONZE_MIRROR, 3227), new ItemHolder(ANCIENT_JADE_NECKLACE, 3919) }; - static { FRAGMENTS_REWARD_DATA.put("30034-03.html", new ItemHolder(CLAY_URN_FRAGMENT, 307)); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 205193f1cf..a7c0af9e20 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -1,378 +1,379 @@ -/* - * 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 . - */ -package quests.Q00344_1000YearsTheEndOfLamentation; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -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; - -/** - * 1000 years, the End of Lamentation (344) - * @author Pandragon - */ -public final class Q00344_1000YearsTheEndOfLamentation extends Quest -{ - // NPCs - private static final int KAIEN = 30623; - private static final int GARVARENTZ = 30704; - private static final int GILMORE = 30754; - private static final int RODEMAI = 30756; - private static final int ORVEN = 30857; - // Items - private static final int ARTICLES = 4269; - private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); - private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); - private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); - private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); - // Monsters +/* + * 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 . + */ +package quests.Q00344_1000YearsTheEndOfLamentation; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +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; + +/** + * 1000 years, the End of Lamentation (344) + * @author Pandragon + */ +public final class Q00344_1000YearsTheEndOfLamentation extends Quest +{ + // NPCs + private static final int KAIEN = 30623; + private static final int GARVARENTZ = 30704; + private static final int GILMORE = 30754; + private static final int RODEMAI = 30756; + private static final int ORVEN = 30857; + // Items + private static final int ARTICLES = 4269; + private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); + private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); + private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); + private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); + // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - { - MONSTER_CHANCES.put(20236, 0.58); // Cave Servant - MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant - MONSTER_CHANCES.put(20272, 0.58); // Cave Servant - MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant - } - // Rewards - private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); - private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); - private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); - private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); - private static final ItemHolder COKES = new ItemHolder(1879, 55); - private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); - private static final ItemHolder LEATHER = new ItemHolder(1882, 70); - private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); - private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); - private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); - private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); - private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); - // Misc - private static final int MIN_LVL = 48; - - public Q00344_1000YearsTheEndOfLamentation() - { - super(344); - addStartNpc(GILMORE); - addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); - addKillId(MONSTER_CHANCES.keySet()); - registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs == null) - { - return htmltext; - } - - switch (event) - { - case "30754-03.htm": - case "30754-16.html": - { - htmltext = event; - break; - } - case "30754-04.htm": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "30754-08.html": - { - if (qs.isCond(1)) - { - final long count = getQuestItemsCount(player, ARTICLES); - if (count < 1) - { - htmltext = "30754-07.html"; - } - else - { - takeItems(player, ARTICLES, -1); - if (getRandom(1000) >= count) - { - giveAdena(player, count * 60, true); - htmltext = event; - } - else - { - qs.setCond(2, true); - switch (getRandom(4)) - { - case 0: - { - qs.setMemoState(1); - giveItems(player, OLD_HILT); - break; - } - case 1: - { - qs.setMemoState(2); - giveItems(player, OLD_KEY); - break; - } - case 2: - { - qs.setMemoState(3); - giveItems(player, TOTEM_NECKLACE); - break; - } - case 3: - { - qs.setMemoState(4); - giveItems(player, CRUCIFIX); - break; - } - } - htmltext = "30754-09.html"; - } - } - } - break; - } - case "30754-17.html": - { - if (qs.isCond(1)) - { - htmltext = event; - qs.exitQuest(true, true); - } - break; - } - case "relic_info": - { - switch (qs.getMemoState()) - { - case 1: - { - htmltext = "30754-10.html"; - break; - } - case 2: - { - htmltext = "30754-11.html"; - break; - } - case 3: - { - htmltext = "30754-12.html"; - break; - } - case 4: - { - htmltext = "30754-13.html"; - break; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance talker) - { - final QuestState qs = getQuestState(talker, true); - String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GILMORE: - { - if (qs.isCreated()) - { - htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { - htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; - } - else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) - { - htmltext = "30754-14.html"; - } - else - { - qs.setCond(1); - htmltext = "30754-15.html"; - } - } - else - { - htmltext = getAlreadyCompletedMsg(talker); - } - break; - } - case KAIEN: - { - if (qs.getMemoState() == 1) - { - if (hasItem(talker, OLD_HILT)) - { - takeItems(talker, OLD_HILT.getId(), -1); - final int rand = getRandom(100); - if (rand <= 52) - { - rewardItems(talker, ORIHARUKON_ORE); - } - else if (rand <= 76) - { - rewardItems(talker, VARNISH_OF_PURITY); - } - else if (rand <= 98) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RAID_SWORD); - } - qs.setCond(1); - htmltext = "30623-01.html"; - } - else - { - htmltext = "30623-02.html"; - } - } - break; - } - case RODEMAI: - { - if (qs.getMemoState() == 2) - { - if (hasItem(talker, OLD_KEY)) - { - takeItems(talker, OLD_KEY.getId(), -1); - final int rand = getRandom(100); - if (rand <= 39) - { - rewardItems(talker, COKES); - } - else if (rand <= 89) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RING_OF_AGES); - } - qs.setCond(1); - htmltext = "30756-01.html"; - } - else - { - htmltext = "30756-02.html"; - } - } - break; - } - case GARVARENTZ: - { - if (qs.getMemoState() == 3) - { - if (hasItem(talker, TOTEM_NECKLACE)) - { - takeItems(talker, TOTEM_NECKLACE.getId(), -1); - final int rand = getRandom(100); - if (rand <= 47) - { - rewardItems(talker, LEATHER); - } - else if (rand <= 97) - { - rewardItems(talker, COARSE_BONE_POWDER); - } - else - { - rewardItems(talker, HEAVY_DOOM_HAMMER); - } - qs.setCond(1); - htmltext = "30704-01.html"; - } - else - { - htmltext = "30704-02.html"; - } - } - break; - } - case ORVEN: - { - if (qs.getMemoState() == 4) - { - if (hasItem(talker, CRUCIFIX)) - { - takeItems(talker, CRUCIFIX.getId(), -1); - final int rand = getRandom(100); - if (rand <= 49) - { - rewardItems(talker, STONE_OF_PURITY); - } - else if (rand <= 69) - { - rewardItems(talker, SCROLL_EAC); - } - else - { - rewardItems(talker, DRAKE_LEATHER_BOOTS); - } - qs.setCond(1); - htmltext = "30857-01.html"; - } - else - { - htmltext = "30857-02.html"; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { - giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MONSTER_CHANCES.put(20236, 0.58); // Cave Servant + MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant + MONSTER_CHANCES.put(20272, 0.58); // Cave Servant + MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant + } + // Rewards + private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); + private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); + private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); + private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); + private static final ItemHolder COKES = new ItemHolder(1879, 55); + private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); + private static final ItemHolder LEATHER = new ItemHolder(1882, 70); + private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); + private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); + private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); + private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); + private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); + // Misc + private static final int MIN_LVL = 48; + + public Q00344_1000YearsTheEndOfLamentation() + { + super(344); + addStartNpc(GILMORE); + addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); + addKillId(MONSTER_CHANCES.keySet()); + registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs == null) + { + return htmltext; + } + + switch (event) + { + case "30754-03.htm": + case "30754-16.html": + { + htmltext = event; + break; + } + case "30754-04.htm": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "30754-08.html": + { + if (qs.isCond(1)) + { + final long count = getQuestItemsCount(player, ARTICLES); + if (count < 1) + { + htmltext = "30754-07.html"; + } + else + { + takeItems(player, ARTICLES, -1); + if (getRandom(1000) >= count) + { + giveAdena(player, count * 60, true); + htmltext = event; + } + else + { + qs.setCond(2, true); + switch (getRandom(4)) + { + case 0: + { + qs.setMemoState(1); + giveItems(player, OLD_HILT); + break; + } + case 1: + { + qs.setMemoState(2); + giveItems(player, OLD_KEY); + break; + } + case 2: + { + qs.setMemoState(3); + giveItems(player, TOTEM_NECKLACE); + break; + } + case 3: + { + qs.setMemoState(4); + giveItems(player, CRUCIFIX); + break; + } + } + htmltext = "30754-09.html"; + } + } + } + break; + } + case "30754-17.html": + { + if (qs.isCond(1)) + { + htmltext = event; + qs.exitQuest(true, true); + } + break; + } + case "relic_info": + { + switch (qs.getMemoState()) + { + case 1: + { + htmltext = "30754-10.html"; + break; + } + case 2: + { + htmltext = "30754-11.html"; + break; + } + case 3: + { + htmltext = "30754-12.html"; + break; + } + case 4: + { + htmltext = "30754-13.html"; + break; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance talker) + { + final QuestState qs = getQuestState(talker, true); + String htmltext = getNoQuestMsg(talker); + switch (npc.getId()) + { + case GILMORE: + { + if (qs.isCreated()) + { + htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; + } + else if (qs.isStarted()) + { + if (qs.isCond(1)) + { + htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; + } + else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) + { + htmltext = "30754-14.html"; + } + else + { + qs.setCond(1); + htmltext = "30754-15.html"; + } + } + else + { + htmltext = getAlreadyCompletedMsg(talker); + } + break; + } + case KAIEN: + { + if (qs.getMemoState() == 1) + { + if (hasItem(talker, OLD_HILT)) + { + takeItems(talker, OLD_HILT.getId(), -1); + final int rand = getRandom(100); + if (rand <= 52) + { + rewardItems(talker, ORIHARUKON_ORE); + } + else if (rand <= 76) + { + rewardItems(talker, VARNISH_OF_PURITY); + } + else if (rand <= 98) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RAID_SWORD); + } + qs.setCond(1); + htmltext = "30623-01.html"; + } + else + { + htmltext = "30623-02.html"; + } + } + break; + } + case RODEMAI: + { + if (qs.getMemoState() == 2) + { + if (hasItem(talker, OLD_KEY)) + { + takeItems(talker, OLD_KEY.getId(), -1); + final int rand = getRandom(100); + if (rand <= 39) + { + rewardItems(talker, COKES); + } + else if (rand <= 89) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RING_OF_AGES); + } + qs.setCond(1); + htmltext = "30756-01.html"; + } + else + { + htmltext = "30756-02.html"; + } + } + break; + } + case GARVARENTZ: + { + if (qs.getMemoState() == 3) + { + if (hasItem(talker, TOTEM_NECKLACE)) + { + takeItems(talker, TOTEM_NECKLACE.getId(), -1); + final int rand = getRandom(100); + if (rand <= 47) + { + rewardItems(talker, LEATHER); + } + else if (rand <= 97) + { + rewardItems(talker, COARSE_BONE_POWDER); + } + else + { + rewardItems(talker, HEAVY_DOOM_HAMMER); + } + qs.setCond(1); + htmltext = "30704-01.html"; + } + else + { + htmltext = "30704-02.html"; + } + } + break; + } + case ORVEN: + { + if (qs.getMemoState() == 4) + { + if (hasItem(talker, CRUCIFIX)) + { + takeItems(talker, CRUCIFIX.getId(), -1); + final int rand = getRandom(100); + if (rand <= 49) + { + rewardItems(talker, STONE_OF_PURITY); + } + else if (rand <= 69) + { + rewardItems(talker, SCROLL_EAC); + } + else + { + rewardItems(talker, DRAKE_LEATHER_BOOTS); + } + qs.setCond(1); + htmltext = "30857-01.html"; + } + else + { + htmltext = "30857-02.html"; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); + if (qs != null) + { + giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java index 8c36644aa5..7d7d106ae8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java @@ -44,7 +44,6 @@ public final class Q00360_PlunderTheirSupplies extends Quest private static final int RECIPE_OF_SUPPLY = 5870; private static final int SUPPLY_ITEMS = 5872; private static final int SUSPICIOUS_DOCUMENT_PIECE = 5871; - static { MONSTER_DROP_CHANCES.put(20666, 50); // Taik Orc Seeker diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00372_LegacyOfInsolence/Q00372_LegacyOfInsolence.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00372_LegacyOfInsolence/Q00372_LegacyOfInsolence.java index fc9af3381b..1b6e5ca900 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00372_LegacyOfInsolence/Q00372_LegacyOfInsolence.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00372_LegacyOfInsolence/Q00372_LegacyOfInsolence.java @@ -103,7 +103,6 @@ public final class Q00372_LegacyOfInsolence extends Quest // Monsters private static final int HALLATES_INSPECTOR = 20825; private static final Map MONSTER_REWARDS = new HashMap<>(); - static { MONSTER_REWARDS.put(20817, new QuestItemHolder(ANCIENT_RED_PAPYRUS, 302, 1)); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00373_SupplierOfReagents/Q00373_SupplierOfReagents.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00373_SupplierOfReagents/Q00373_SupplierOfReagents.java index e980c8d668..c950889f99 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00373_SupplierOfReagents/Q00373_SupplierOfReagents.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00373_SupplierOfReagents/Q00373_SupplierOfReagents.java @@ -81,7 +81,6 @@ public final class Q00373_SupplierOfReagents extends Quest private static final HashMap HTML_TO_MEMO_STATE = new HashMap<>(20); private static final HashMap MEMO_STATE_TO_ITEM = new HashMap<>(20); private static final HashMap MEMO_STATE_TO_REWARD = new HashMap<>(15); - static { // List of ingredients to mix diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00380_BringOutTheFlavorOfIngredients/Q00380_BringOutTheFlavorOfIngredients.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00380_BringOutTheFlavorOfIngredients/Q00380_BringOutTheFlavorOfIngredients.java index fe379f171b..9872f86acc 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00380_BringOutTheFlavorOfIngredients/Q00380_BringOutTheFlavorOfIngredients.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00380_BringOutTheFlavorOfIngredients/Q00380_BringOutTheFlavorOfIngredients.java @@ -1,202 +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 . - */ -package quests.Q00380_BringOutTheFlavorOfIngredients; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; -import com.l2jmobius.gameserver.model.quest.Quest; -import com.l2jmobius.gameserver.model.quest.QuestState; -import com.l2jmobius.gameserver.model.quest.State; - -/** - * Bring Out the Flavor of Ingredients! (380) - * @author Pandragon - */ -public final class Q00380_BringOutTheFlavorOfIngredients extends Quest -{ - // NPC - private static final int ROLLAND = 30069; - // Items - private static final int ANTIDOTE = 1831; - private static final int RITRON_FRUIT = 5895; - private static final int MOON_FLOWER = 5896; - private static final int LEECH_FLUIDS = 5897; - // Monsters +/* + * 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 . + */ +package quests.Q00380_BringOutTheFlavorOfIngredients; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.holders.ItemChanceHolder; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; +import com.l2jmobius.gameserver.model.quest.State; + +/** + * Bring Out the Flavor of Ingredients! (380) + * @author Pandragon + */ +public final class Q00380_BringOutTheFlavorOfIngredients extends Quest +{ + // NPC + private static final int ROLLAND = 30069; + // Items + private static final int ANTIDOTE = 1831; + private static final int RITRON_FRUIT = 5895; + private static final int MOON_FLOWER = 5896; + private static final int LEECH_FLUIDS = 5897; + // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - { - MONSTER_CHANCES.put(20205, new ItemChanceHolder(RITRON_FRUIT, 0.1, 4)); // Dire Wolf - MONSTER_CHANCES.put(20206, new ItemChanceHolder(MOON_FLOWER, 0.5, 20)); // Kadif Werewolf - MONSTER_CHANCES.put(20225, new ItemChanceHolder(LEECH_FLUIDS, 0.5, 10)); // Giant Mist Leech - } - // Rewards - private static final int RITRON_RECIPE = 5959; - private static final int RITRON_DESSERT = 5960; - // Misc - private static final int MIN_LVL = 24; - - public Q00380_BringOutTheFlavorOfIngredients() - { - super(380); - addStartNpc(ROLLAND); - addTalkId(ROLLAND); - addKillId(MONSTER_CHANCES.keySet()); - registerQuestItems(RITRON_FRUIT, MOON_FLOWER, LEECH_FLUIDS); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs != null) - { - switch (event) - { - case "30069-03.htm": - case "30069-04.htm": - case "30069-06.html": - { - htmltext = event; - break; - } - case "30069-05.htm": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "30069-13.html": - { - if (qs.isCond(9)) - { - rewardItems(player, RITRON_RECIPE, 1); - qs.exitQuest(true, true); - htmltext = event; - } - break; - } - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance talker) - { - final QuestState qs = getQuestState(talker, true); - String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { - htmltext = (talker.getLevel() >= MIN_LVL) ? "30069-02.htm" : "30069-01.htm"; - break; - } - case State.STARTED: - { - switch (qs.getCond()) - { - case 1: - case 2: - case 3: - case 4: - { - if ((getQuestItemsCount(talker, ANTIDOTE) >= 2) && (getQuestItemsCount(talker, RITRON_FRUIT) >= 4) && (getQuestItemsCount(talker, MOON_FLOWER) >= 20) && (getQuestItemsCount(talker, LEECH_FLUIDS) >= 10)) - { - takeItems(talker, ANTIDOTE, 2); - takeItems(talker, -1, RITRON_FRUIT, MOON_FLOWER, LEECH_FLUIDS); - qs.setCond(5, true); - htmltext = "30069-08.html"; - } - else - { - htmltext = "30069-07.html"; - } - break; - } - case 5: - { - qs.setCond(6, true); - htmltext = "30069-09.html"; - break; - } - case 6: - { - qs.setCond(7, true); - htmltext = "30069-10.html"; - break; - } - case 7: - { - qs.setCond(8, true); - htmltext = "30069-11.html"; - break; - } - case 8: - { - rewardItems(talker, RITRON_DESSERT, 1); - if (getRandom(100) < 56) - { - htmltext = "30069-15.html"; - qs.exitQuest(true, true); - } - else - { - qs.setCond(9, true); - htmltext = "30069-12.html"; - } - break; - } - case 9: - { - htmltext = "30069-12.html"; - break; - } - } - break; - } - case State.COMPLETED: - { - htmltext = getAlreadyCompletedMsg(talker); - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if ((qs != null) && (qs.getCond() < 4)) - { - final ItemChanceHolder item = MONSTER_CHANCES.get(npc.getId()); - if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, item.getCount(), item.getChance(), true)) - { - qs.setCond(qs.getCond() + 1, true); - } - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MONSTER_CHANCES.put(20205, new ItemChanceHolder(RITRON_FRUIT, 0.1, 4)); // Dire Wolf + MONSTER_CHANCES.put(20206, new ItemChanceHolder(MOON_FLOWER, 0.5, 20)); // Kadif Werewolf + MONSTER_CHANCES.put(20225, new ItemChanceHolder(LEECH_FLUIDS, 0.5, 10)); // Giant Mist Leech + } + // Rewards + private static final int RITRON_RECIPE = 5959; + private static final int RITRON_DESSERT = 5960; + // Misc + private static final int MIN_LVL = 24; + + public Q00380_BringOutTheFlavorOfIngredients() + { + super(380); + addStartNpc(ROLLAND); + addTalkId(ROLLAND); + addKillId(MONSTER_CHANCES.keySet()); + registerQuestItems(RITRON_FRUIT, MOON_FLOWER, LEECH_FLUIDS); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs != null) + { + switch (event) + { + case "30069-03.htm": + case "30069-04.htm": + case "30069-06.html": + { + htmltext = event; + break; + } + case "30069-05.htm": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "30069-13.html": + { + if (qs.isCond(9)) + { + rewardItems(player, RITRON_RECIPE, 1); + qs.exitQuest(true, true); + htmltext = event; + } + break; + } + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance talker) + { + final QuestState qs = getQuestState(talker, true); + String htmltext = getNoQuestMsg(talker); + switch (qs.getState()) + { + case State.CREATED: + { + htmltext = (talker.getLevel() >= MIN_LVL) ? "30069-02.htm" : "30069-01.htm"; + break; + } + case State.STARTED: + { + switch (qs.getCond()) + { + case 1: + case 2: + case 3: + case 4: + { + if ((getQuestItemsCount(talker, ANTIDOTE) >= 2) && (getQuestItemsCount(talker, RITRON_FRUIT) >= 4) && (getQuestItemsCount(talker, MOON_FLOWER) >= 20) && (getQuestItemsCount(talker, LEECH_FLUIDS) >= 10)) + { + takeItems(talker, ANTIDOTE, 2); + takeItems(talker, -1, RITRON_FRUIT, MOON_FLOWER, LEECH_FLUIDS); + qs.setCond(5, true); + htmltext = "30069-08.html"; + } + else + { + htmltext = "30069-07.html"; + } + break; + } + case 5: + { + qs.setCond(6, true); + htmltext = "30069-09.html"; + break; + } + case 6: + { + qs.setCond(7, true); + htmltext = "30069-10.html"; + break; + } + case 7: + { + qs.setCond(8, true); + htmltext = "30069-11.html"; + break; + } + case 8: + { + rewardItems(talker, RITRON_DESSERT, 1); + if (getRandom(100) < 56) + { + htmltext = "30069-15.html"; + qs.exitQuest(true, true); + } + else + { + qs.setCond(9, true); + htmltext = "30069-12.html"; + } + break; + } + case 9: + { + htmltext = "30069-12.html"; + break; + } + } + break; + } + case State.COMPLETED: + { + htmltext = getAlreadyCompletedMsg(talker); + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); + if ((qs != null) && (qs.getCond() < 4)) + { + final ItemChanceHolder item = MONSTER_CHANCES.get(npc.getId()); + if (giveItemRandomly(qs.getPlayer(), npc, item.getId(), 1, item.getCount(), item.getChance(), true)) + { + qs.setCond(qs.getCond() + 1, true); + } + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00385_YokeOfThePast/Q00385_YokeOfThePast.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00385_YokeOfThePast/Q00385_YokeOfThePast.java index ad7cfcfb75..ddf4865380 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00385_YokeOfThePast/Q00385_YokeOfThePast.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00385_YokeOfThePast/Q00385_YokeOfThePast.java @@ -1,184 +1,185 @@ -/* - * 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 . - */ -package quests.Q00385_YokeOfThePast; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -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; - -/** - * Yoke of the Past (385) - * @author Pandragon - */ -public final class Q00385_YokeOfThePast extends Quest -{ - // NPCs - // @formatter:off - private static final int[] ZIGGURATS = - { - 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 - }; - // @formatter:on - // Item - private static final int SCROLL_OF_ANCIENT_MAGIC = 5902; - // Reward - private static final int BLANK_SCROLL = 5965; - // Monsters +/* + * 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 . + */ +package quests.Q00385_YokeOfThePast; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +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; + +/** + * Yoke of the Past (385) + * @author Pandragon + */ +public final class Q00385_YokeOfThePast extends Quest +{ + // NPCs + // @formatter:off + private static final int[] ZIGGURATS = + { + 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 + }; + // @formatter:on + // Item + private static final int SCROLL_OF_ANCIENT_MAGIC = 5902; + // Reward + private static final int BLANK_SCROLL = 5965; + // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - { - MONSTER_CHANCES.put(21144, 0.306); // Catacomb Shadow - MONSTER_CHANCES.put(21156, 0.994); // Purgatory Shadow - MONSTER_CHANCES.put(21208, 0.146); // Hallowed Watchman - MONSTER_CHANCES.put(21209, 0.166); // Hallowed Seer - MONSTER_CHANCES.put(21210, 0.202); // Vault Guardian - MONSTER_CHANCES.put(21211, 0.212); // Vault Seer - MONSTER_CHANCES.put(21213, 0.274); // Hallowed Monk - MONSTER_CHANCES.put(21214, 0.342); // Vault Sentinel - MONSTER_CHANCES.put(21215, 0.360); // Vault Monk - MONSTER_CHANCES.put(21217, 0.460); // Hallowed Priest - MONSTER_CHANCES.put(21218, 0.558); // Vault Overlord - MONSTER_CHANCES.put(21219, 0.578); // Vault Priest - MONSTER_CHANCES.put(21221, 0.710); // Sepulcher Inquisitor - MONSTER_CHANCES.put(21222, 0.842); // Sepulcher Archon - MONSTER_CHANCES.put(21223, 0.862); // Sepulcher Inquisitor - MONSTER_CHANCES.put(21224, 0.940); // Sepulcher Guardian - MONSTER_CHANCES.put(21225, 0.970); // Sepulcher Sage - MONSTER_CHANCES.put(21226, 0.202); // Sepulcher Guardian - MONSTER_CHANCES.put(21227, 0.290); // Sepulcher Sage - MONSTER_CHANCES.put(21228, 0.316); // Sepulcher Guard - MONSTER_CHANCES.put(21229, 0.426); // Sepulcher Preacher - MONSTER_CHANCES.put(21230, 0.646); // Sepulcher Guard - MONSTER_CHANCES.put(21231, 0.654); // Sepulcher Preacher - MONSTER_CHANCES.put(21236, 0.238); // Barrow Sentinel - MONSTER_CHANCES.put(21237, 0.274); // Barrow Monk - MONSTER_CHANCES.put(21238, 0.342); // Grave Sentinel - MONSTER_CHANCES.put(21239, 0.360); // Grave Monk - MONSTER_CHANCES.put(21240, 0.410); // Barrow Overlord - MONSTER_CHANCES.put(21241, 0.460); // Barrow Priest - MONSTER_CHANCES.put(21242, 0.558); // Grave Overlord - MONSTER_CHANCES.put(21243, 0.578); // Grave Priest - MONSTER_CHANCES.put(21244, 0.642); // Crypt Archon - MONSTER_CHANCES.put(21245, 0.700); // Crypt Inquisitor - MONSTER_CHANCES.put(21246, 0.842); // Tomb Archon - MONSTER_CHANCES.put(21247, 0.862); // Tomb Inquisitor - MONSTER_CHANCES.put(21248, 0.940); // Crypt Guardian - MONSTER_CHANCES.put(21249, 0.970); // Crypt Sage - MONSTER_CHANCES.put(21250, 0.798); // Tomb Guardian - MONSTER_CHANCES.put(21251, 0.710); // Tomb Sage - MONSTER_CHANCES.put(21252, 0.684); // Crypt Guard - MONSTER_CHANCES.put(21253, 0.574); // Crypt Preacher - MONSTER_CHANCES.put(21254, 0.354); // Tomb Guard - MONSTER_CHANCES.put(21255, 0.250); // Tomb Preacher - } - // Misc - private static final int MIN_LVL = 20; - - public Q00385_YokeOfThePast() - { - super(385); - addStartNpc(ZIGGURATS); - addTalkId(ZIGGURATS); - addKillId(MONSTER_CHANCES.keySet()); - registerQuestItems(SCROLL_OF_ANCIENT_MAGIC); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs != null) - { - switch (event) - { - case "ziggurat-03.htm": - case "ziggurat-04.htm": - case "ziggurat-06.htm": - case "ziggurat-07.htm": - { - htmltext = event; - break; - } - case "ziggurat-05.htm": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "ziggurat-10.html": - { - qs.exitQuest(true, true); - htmltext = event; - break; - } - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance talker) - { - final QuestState qs = getQuestState(talker, true); - String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { - htmltext = (talker.getLevel() >= MIN_LVL) ? "ziggurat-01.htm" : "ziggurat-02.htm"; - break; - } - case State.STARTED: - { - if (hasQuestItems(talker, SCROLL_OF_ANCIENT_MAGIC)) - { - rewardItems(talker, BLANK_SCROLL, getQuestItemsCount(talker, SCROLL_OF_ANCIENT_MAGIC)); - takeItems(talker, SCROLL_OF_ANCIENT_MAGIC, -1); - htmltext = "ziggurat-09.html"; - } - else - { - htmltext = "ziggurat-08.html"; - } - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { - giveItemRandomly(qs.getPlayer(), npc, SCROLL_OF_ANCIENT_MAGIC, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MONSTER_CHANCES.put(21144, 0.306); // Catacomb Shadow + MONSTER_CHANCES.put(21156, 0.994); // Purgatory Shadow + MONSTER_CHANCES.put(21208, 0.146); // Hallowed Watchman + MONSTER_CHANCES.put(21209, 0.166); // Hallowed Seer + MONSTER_CHANCES.put(21210, 0.202); // Vault Guardian + MONSTER_CHANCES.put(21211, 0.212); // Vault Seer + MONSTER_CHANCES.put(21213, 0.274); // Hallowed Monk + MONSTER_CHANCES.put(21214, 0.342); // Vault Sentinel + MONSTER_CHANCES.put(21215, 0.360); // Vault Monk + MONSTER_CHANCES.put(21217, 0.460); // Hallowed Priest + MONSTER_CHANCES.put(21218, 0.558); // Vault Overlord + MONSTER_CHANCES.put(21219, 0.578); // Vault Priest + MONSTER_CHANCES.put(21221, 0.710); // Sepulcher Inquisitor + MONSTER_CHANCES.put(21222, 0.842); // Sepulcher Archon + MONSTER_CHANCES.put(21223, 0.862); // Sepulcher Inquisitor + MONSTER_CHANCES.put(21224, 0.940); // Sepulcher Guardian + MONSTER_CHANCES.put(21225, 0.970); // Sepulcher Sage + MONSTER_CHANCES.put(21226, 0.202); // Sepulcher Guardian + MONSTER_CHANCES.put(21227, 0.290); // Sepulcher Sage + MONSTER_CHANCES.put(21228, 0.316); // Sepulcher Guard + MONSTER_CHANCES.put(21229, 0.426); // Sepulcher Preacher + MONSTER_CHANCES.put(21230, 0.646); // Sepulcher Guard + MONSTER_CHANCES.put(21231, 0.654); // Sepulcher Preacher + MONSTER_CHANCES.put(21236, 0.238); // Barrow Sentinel + MONSTER_CHANCES.put(21237, 0.274); // Barrow Monk + MONSTER_CHANCES.put(21238, 0.342); // Grave Sentinel + MONSTER_CHANCES.put(21239, 0.360); // Grave Monk + MONSTER_CHANCES.put(21240, 0.410); // Barrow Overlord + MONSTER_CHANCES.put(21241, 0.460); // Barrow Priest + MONSTER_CHANCES.put(21242, 0.558); // Grave Overlord + MONSTER_CHANCES.put(21243, 0.578); // Grave Priest + MONSTER_CHANCES.put(21244, 0.642); // Crypt Archon + MONSTER_CHANCES.put(21245, 0.700); // Crypt Inquisitor + MONSTER_CHANCES.put(21246, 0.842); // Tomb Archon + MONSTER_CHANCES.put(21247, 0.862); // Tomb Inquisitor + MONSTER_CHANCES.put(21248, 0.940); // Crypt Guardian + MONSTER_CHANCES.put(21249, 0.970); // Crypt Sage + MONSTER_CHANCES.put(21250, 0.798); // Tomb Guardian + MONSTER_CHANCES.put(21251, 0.710); // Tomb Sage + MONSTER_CHANCES.put(21252, 0.684); // Crypt Guard + MONSTER_CHANCES.put(21253, 0.574); // Crypt Preacher + MONSTER_CHANCES.put(21254, 0.354); // Tomb Guard + MONSTER_CHANCES.put(21255, 0.250); // Tomb Preacher + } + // Misc + private static final int MIN_LVL = 20; + + public Q00385_YokeOfThePast() + { + super(385); + addStartNpc(ZIGGURATS); + addTalkId(ZIGGURATS); + addKillId(MONSTER_CHANCES.keySet()); + registerQuestItems(SCROLL_OF_ANCIENT_MAGIC); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs != null) + { + switch (event) + { + case "ziggurat-03.htm": + case "ziggurat-04.htm": + case "ziggurat-06.htm": + case "ziggurat-07.htm": + { + htmltext = event; + break; + } + case "ziggurat-05.htm": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "ziggurat-10.html": + { + qs.exitQuest(true, true); + htmltext = event; + break; + } + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance talker) + { + final QuestState qs = getQuestState(talker, true); + String htmltext = getNoQuestMsg(talker); + switch (qs.getState()) + { + case State.CREATED: + { + htmltext = (talker.getLevel() >= MIN_LVL) ? "ziggurat-01.htm" : "ziggurat-02.htm"; + break; + } + case State.STARTED: + { + if (hasQuestItems(talker, SCROLL_OF_ANCIENT_MAGIC)) + { + rewardItems(talker, BLANK_SCROLL, getQuestItemsCount(talker, SCROLL_OF_ANCIENT_MAGIC)); + takeItems(talker, SCROLL_OF_ANCIENT_MAGIC, -1); + htmltext = "ziggurat-09.html"; + } + else + { + htmltext = "ziggurat-08.html"; + } + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); + if (qs != null) + { + giveItemRandomly(qs.getPlayer(), npc, SCROLL_OF_ANCIENT_MAGIC, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00419_GetAPet/Q00419_GetAPet.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00419_GetAPet/Q00419_GetAPet.java index 4760b9cbc6..f28feabc45 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00419_GetAPet/Q00419_GetAPet.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00419_GetAPet/Q00419_GetAPet.java @@ -75,7 +75,6 @@ public final class Q00419_GetAPet extends Quest private static final int MIN_LEVEL = 15; // Links private static final Map LINKS = new HashMap<>(); - static { LINKS.put(1110001, "Can be used for item transportation.
    "); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java index 7aed0ba8ee..6162e53bfb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00420_LittleWing/Q00420_LittleWing.java @@ -1,884 +1,885 @@ -/* - * 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 . - */ -package quests.Q00420_LittleWing; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.enums.QuestSound; -import com.l2jmobius.gameserver.model.actor.Npc; -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.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; - -/** - * Little Wing (420) - * @author Pandragon - */ -public final class Q00420_LittleWing extends Quest -{ - // NPCs - private static final int MARIA = 30608; - private static final int CRONOS = 30610; - private static final int BYRON = 30711; - private static final int MIMYU = 30747; - private static final int EXARION = 30748; - private static final int ZWOV = 30749; - private static final int KALIBRAN = 30750; - private static final int SUZET = 30751; - private static final int SHAMHAI = 30752; - private static final int COOPER = 30829; - // Items - private static final int COAL = 1870; - private static final int CHARCOAL = 1871; - private static final int SILVER_NUGGET = 1873; - private static final int STONE_OF_PURITY = 1875; - private static final int GEMSTONE_D = 2130; - private static final int GEMSTONE_C = 2131; - private static final int FAIRY_DUST = 3499; - private static final int FAIRY_STONE = 3816; - private static final int DELUXE_FAIRY_STONE = 3817; - private static final int FAIRY_STONE_LIST = 3818; - private static final int DELUXE_STONE_LIST = 3819; - private static final int TOAD_SKIN = 3820; - private static final int MONKSHOOD_JUICE = 3821; - private static final int EXARION_SCALE = 3822; - private static final int EXARION_EGG = 3823; - private static final int ZWOV_SCALE = 3824; - private static final int ZWOV_EGG = 3825; - private static final int KALIBRAN_SCALE = 3826; - private static final int KALIBRAN_EGG = 3827; - private static final int SUZET_SCALE = 3828; - private static final int SUZET_EGG = 3829; - private static final int SHAMHAI_SCALE = 3830; - private static final int SHAMHAI_EGG = 3831; - // Monsters - private static final int DEAD_SEEKER = 20202; - private static final int TOAD_LORD = 20231; - private static final int MARSH_SPIDER = 20233; - private static final int BREKA_OVERLORD = 20270; - private static final int ROAD_SCAVENGER = 20551; - private static final int LETO_WARRIOR = 20580; - private static final int[] DELUXE_STONE_BREAKERS = - { - 20589, // Fline - 20590, // Liele - 20591, // Valley Treant - 20592, // Satyr - 20593, // Unicorn - 20594, // Forest Runner - 20595, // Fline Elder - 20596, // Liele Elder - 20597, // Valley Treant Elder - 20598, // Satyr Elder - 20599, // Unicorn Elder - 27185, // Fairy Tree of Wind (Quest Monster) - 27186, // Fairy Tree of Star (Quest Monster) - 27187, // Fairy Tree of Twilight (Quest Monster) - 27188, // Fairy Tree of Abyss (Quest Monster) - 27189, // Soul of Tree Guardian (Quest Monster) - }; - // Rewards - private static final int DRAGONFLUTE_OF_WIND = 3500; - private static final int DRAGONFLUTE_OF_STAR = 3501; - private static final int DRAGONFLUTE_OF_TWILIGHT = 3502; - private static final int HATCHLING_ARMOR = 3912; - private static final int HATCHLING_FOOD = 4038; - private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); - // Drake Drops +/* + * 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 . + */ +package quests.Q00420_LittleWing; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.enums.QuestSound; +import com.l2jmobius.gameserver.model.actor.Npc; +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.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; + +/** + * Little Wing (420) + * @author Pandragon + */ +public final class Q00420_LittleWing extends Quest +{ + // NPCs + private static final int MARIA = 30608; + private static final int CRONOS = 30610; + private static final int BYRON = 30711; + private static final int MIMYU = 30747; + private static final int EXARION = 30748; + private static final int ZWOV = 30749; + private static final int KALIBRAN = 30750; + private static final int SUZET = 30751; + private static final int SHAMHAI = 30752; + private static final int COOPER = 30829; + // Items + private static final int COAL = 1870; + private static final int CHARCOAL = 1871; + private static final int SILVER_NUGGET = 1873; + private static final int STONE_OF_PURITY = 1875; + private static final int GEMSTONE_D = 2130; + private static final int GEMSTONE_C = 2131; + private static final int FAIRY_DUST = 3499; + private static final int FAIRY_STONE = 3816; + private static final int DELUXE_FAIRY_STONE = 3817; + private static final int FAIRY_STONE_LIST = 3818; + private static final int DELUXE_STONE_LIST = 3819; + private static final int TOAD_SKIN = 3820; + private static final int MONKSHOOD_JUICE = 3821; + private static final int EXARION_SCALE = 3822; + private static final int EXARION_EGG = 3823; + private static final int ZWOV_SCALE = 3824; + private static final int ZWOV_EGG = 3825; + private static final int KALIBRAN_SCALE = 3826; + private static final int KALIBRAN_EGG = 3827; + private static final int SUZET_SCALE = 3828; + private static final int SUZET_EGG = 3829; + private static final int SHAMHAI_SCALE = 3830; + private static final int SHAMHAI_EGG = 3831; + // Monsters + private static final int DEAD_SEEKER = 20202; + private static final int TOAD_LORD = 20231; + private static final int MARSH_SPIDER = 20233; + private static final int BREKA_OVERLORD = 20270; + private static final int ROAD_SCAVENGER = 20551; + private static final int LETO_WARRIOR = 20580; + private static final int[] DELUXE_STONE_BREAKERS = + { + 20589, // Fline + 20590, // Liele + 20591, // Valley Treant + 20592, // Satyr + 20593, // Unicorn + 20594, // Forest Runner + 20595, // Fline Elder + 20596, // Liele Elder + 20597, // Valley Treant Elder + 20598, // Satyr Elder + 20599, // Unicorn Elder + 27185, // Fairy Tree of Wind (Quest Monster) + 27186, // Fairy Tree of Star (Quest Monster) + 27187, // Fairy Tree of Twilight (Quest Monster) + 27188, // Fairy Tree of Abyss (Quest Monster) + 27189, // Soul of Tree Guardian (Quest Monster) + }; + // Rewards + private static final int DRAGONFLUTE_OF_WIND = 3500; + private static final int DRAGONFLUTE_OF_STAR = 3501; + private static final int DRAGONFLUTE_OF_TWILIGHT = 3502; + private static final int HATCHLING_ARMOR = 3912; + private static final int HATCHLING_FOOD = 4038; + private static final List EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG); + // Drake Drops private static final Map EGG_DROPS = new HashMap<>(); - { - EGG_DROPS.put(DEAD_SEEKER, SHAMHAI_EGG); - EGG_DROPS.put(MARSH_SPIDER, ZWOV_EGG); - EGG_DROPS.put(BREKA_OVERLORD, SUZET_EGG); - EGG_DROPS.put(ROAD_SCAVENGER, KALIBRAN_EGG); - EGG_DROPS.put(LETO_WARRIOR, EXARION_EGG); - } - // Misc - private static final int MIN_LVL = 35; - - public Q00420_LittleWing() - { - super(420); - addStartNpc(COOPER); - addTalkId(MARIA, CRONOS, BYRON, MIMYU, EXARION, ZWOV, KALIBRAN, SUZET, SHAMHAI, COOPER); - addAttackId(DELUXE_STONE_BREAKERS); - addKillId(TOAD_LORD, DEAD_SEEKER, MARSH_SPIDER, BREKA_OVERLORD, ROAD_SCAVENGER, LETO_WARRIOR); - registerQuestItems(FAIRY_DUST, FAIRY_STONE, DELUXE_FAIRY_STONE, FAIRY_STONE_LIST, DELUXE_STONE_LIST, TOAD_SKIN, MONKSHOOD_JUICE, EXARION_SCALE, EXARION_EGG, ZWOV_SCALE, ZWOV_EGG, KALIBRAN_SCALE, KALIBRAN_EGG, SUZET_SCALE, SUZET_EGG, SHAMHAI_SCALE, SHAMHAI_EGG); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs == null) - { - return htmltext; - } - - switch (event) - { - case "30610-02.html": - case "30610-03.html": - case "30610-04.html": - case "30711-02.html": - case "30747-05.html": - case "30747-06.html": - case "30751-02.html": - { - htmltext = event; - break; - } - case "30829-02.htm": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "30610-05.html": - { - if (qs.isCond(1)) - { - qs.setCond(2, true); - qs.set("old_stone", 0); - qs.set("fairy_stone", 1); - giveItems(player, FAIRY_STONE_LIST, 1); - htmltext = event; - } - break; - } - case "30610-06.html": - { - if (qs.isCond(1)) - { - qs.setCond(2, true); - qs.set("old_stone", 0); - qs.set("fairy_stone", 2); - giveItems(player, DELUXE_STONE_LIST, 1); - htmltext = event; - } - break; - } - case "30610-12.html": - { - if (qs.isCond(5)) - { - qs.setCond(2, true); - qs.set("old_stone", qs.getInt("fairy_stone")); - qs.set("fairy_stone", 1); - giveItems(player, FAIRY_STONE_LIST, 1); - htmltext = event; - } - break; - } - case "30610-13.html": - { - if (qs.isCond(5)) - { - qs.setCond(2, true); - qs.set("old_stone", qs.getInt("fairy_stone")); - qs.set("fairy_stone", 2); - giveItems(player, DELUXE_STONE_LIST, 1); - htmltext = event; - } - break; - } - case "30608-03.html": - { - if (qs.isCond(2)) - { - if ((qs.getInt("fairy_stone") == 1) && (getQuestItemsCount(player, COAL) >= 10) && (getQuestItemsCount(player, CHARCOAL) >= 10) && (getQuestItemsCount(player, GEMSTONE_D) >= 1) && (getQuestItemsCount(player, SILVER_NUGGET) >= 3) && (getQuestItemsCount(player, TOAD_SKIN) >= 10)) - { - takeItems(player, FAIRY_STONE_LIST, -1); - takeItems(player, COAL, 10); - takeItems(player, CHARCOAL, 10); - takeItems(player, GEMSTONE_D, 1); - takeItems(player, SILVER_NUGGET, 3); - takeItems(player, TOAD_SKIN, -1); - giveItems(player, FAIRY_STONE, 1); - } - qs.setCond(3, true); - htmltext = event; - } - break; - } - case "30608-05.html": - { - if (qs.isCond(2)) - { - if ((qs.getInt("fairy_stone") == 2) && (getQuestItemsCount(player, COAL) >= 10) && (getQuestItemsCount(player, CHARCOAL) >= 10) && (getQuestItemsCount(player, GEMSTONE_C) >= 1) && (getQuestItemsCount(player, STONE_OF_PURITY) >= 1) && (getQuestItemsCount(player, SILVER_NUGGET) >= 5) && (getQuestItemsCount(player, TOAD_SKIN) >= 20)) - { - takeItems(player, DELUXE_STONE_LIST, -1); - takeItems(player, COAL, 10); - takeItems(player, CHARCOAL, 10); - takeItems(player, GEMSTONE_C, 1); - takeItems(player, STONE_OF_PURITY, 1); - takeItems(player, SILVER_NUGGET, 5); - takeItems(player, TOAD_SKIN, -1); - giveItems(player, DELUXE_FAIRY_STONE, 1); - } - qs.setCond(3, true); - htmltext = event; - } - break; - } - case "30711-03.html": - { - if (qs.isCond(3)) - { - qs.setCond(4, true); - if (qs.getInt("fairy_stone") == 2) - { - htmltext = "30711-04.html"; - } - else - { - htmltext = event; - } - } - break; - } - case "30747-02.html": - case "30747-04.html": - { - if (qs.isCond(4) && ((getQuestItemsCount(player, FAIRY_STONE) + getQuestItemsCount(player, DELUXE_FAIRY_STONE)) > 0)) - { - takeItems(player, -1, FAIRY_STONE, DELUXE_FAIRY_STONE); - if (qs.getInt("fairy_stone") == 2) - { - giveItems(player, FAIRY_DUST, 1); - } - qs.setCond(5, true); - htmltext = event; - } - break; - } - case "30747-07.html": - case "30747-08.html": - { - if (qs.isCond(5) && (getQuestItemsCount(player, MONKSHOOD_JUICE) == 0)) - { - giveItems(player, MONKSHOOD_JUICE, 1); - htmltext = event; - } - break; - } - case "30747-12.html": - { - if (qs.isCond(7)) - { - if ((qs.getInt("fairy_stone") == 1) || (getQuestItemsCount(player, FAIRY_DUST) == 0)) - { - giveReward(player); - qs.exitQuest(true, true); - htmltext = "30747-16.html"; - } - else - { - qs.setCond(8, false); - htmltext = event; - } - } - else if (qs.isCond(8)) - { - htmltext = event; - } - break; - } - case "30747-13.html": - { - if (qs.isCond(8)) - { - giveReward(player); - qs.exitQuest(true, true); - htmltext = event; - } - break; - } - case "30747-15.html": - { - if (qs.isCond(8) && (getQuestItemsCount(player, FAIRY_DUST) > 1)) - { - if (getRandom(100) < 5) - { - giveItems(player, HATCHLING_ARMOR, 1); - htmltext = "30747-14.html"; - } - else - { - giveItems(player, HATCHLING_FOOD, 20); - htmltext = event; - } - giveReward(player); - takeItems(player, FAIRY_DUST, -1); - qs.exitQuest(true, true); - } - break; - } - case "30748-02.html": - { - if (qs.isCond(5)) - { - takeItems(player, MONKSHOOD_JUICE, -1); - giveItems(player, EXARION_SCALE, 1); - qs.setCond(6, true); - qs.set("drake_hunt", LETO_WARRIOR); - htmltext = event; - } - break; - } - case "30749-02.html": - { - if (qs.isCond(5)) - { - takeItems(player, MONKSHOOD_JUICE, -1); - giveItems(player, ZWOV_SCALE, 1); - qs.setCond(6, true); - qs.set("drake_hunt", MARSH_SPIDER); - htmltext = event; - } - break; - } - case "30750-02.html": - { - if (qs.isCond(5)) - { - takeItems(player, MONKSHOOD_JUICE, -1); - giveItems(player, KALIBRAN_SCALE, 1); - qs.setCond(6, true); - qs.set("drake_hunt", ROAD_SCAVENGER); - htmltext = event; - } - break; - } - case "30750-05.html": - { - if (qs.isCond(6) && (getQuestItemsCount(player, KALIBRAN_EGG) >= 20)) - { - takeItems(player, -1, KALIBRAN_SCALE, KALIBRAN_EGG); - giveItems(player, KALIBRAN_EGG, 1); - qs.setCond(7, true); - htmltext = event; - } - break; - } - case "30751-03.html": - { - if (qs.isCond(5)) - { - takeItems(player, MONKSHOOD_JUICE, -1); - giveItems(player, SUZET_SCALE, 1); - qs.setCond(6, true); - qs.set("drake_hunt", BREKA_OVERLORD); - htmltext = event; - } - break; - } - case "30752-02.html": - { - if (qs.isCond(5)) - { - takeItems(player, MONKSHOOD_JUICE, -1); - giveItems(player, SHAMHAI_SCALE, 1); - qs.setCond(6, true); - qs.set("drake_hunt", DEAD_SEEKER); - htmltext = event; - } - break; - } - } - return htmltext; - } - - @Override - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) - { - final QuestState qs = getQuestState(attacker, false); - if ((qs != null) && (getQuestItemsCount(attacker, DELUXE_FAIRY_STONE) > 0) && (getRandom(100) < 30)) - { - takeItems(attacker, DELUXE_FAIRY_STONE, -1); - playSound(attacker, QuestSound.ITEMSOUND_QUEST_MIDDLE); - npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.THE_STONE_THE_ELVEN_STONE_BROKE)); - } - return super.onAttack(npc, attacker, damage, isSummon); - } - - @Override - public String onTalk(Npc npc, PlayerInstance talker) - { - final QuestState qs = getQuestState(talker, true); - String htmltext = getNoQuestMsg(talker); - switch (qs.getState()) - { - case State.CREATED: - { - if (npc.getId() == COOPER) - { - htmltext = (talker.getLevel() >= MIN_LVL) ? "30829-01.htm" : "30829-03.html"; - } - break; - } - case State.STARTED: - { - switch (npc.getId()) - { - case COOPER: - { - htmltext = "30829-04.html"; - break; - } - case CRONOS: - { - switch (qs.getCond()) - { - case 1: - { - htmltext = "30610-01.html"; - break; - } - case 2: - { - htmltext = "30610-07.html"; - break; - } - case 3: - { - if (qs.getInt("old_stone") > 0) - { - htmltext = "30610-14.html"; - } - else - { - htmltext = "30610-08.html"; - } - break; - } - case 4: - { - htmltext = "30610-09.html"; - break; - } - case 5: - { - if ((getQuestItemsCount(talker, FAIRY_STONE) == 0) && (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) == 0)) - { - htmltext = "30610-10.html"; - } - else - { - htmltext = "30610-11.html"; - } - break; - } - } - break; - } - case MARIA: - { - switch (qs.getCond()) - { - case 2: - { - if ((qs.getInt("fairy_stone") == 1) && (getQuestItemsCount(talker, COAL) >= 10) && (getQuestItemsCount(talker, CHARCOAL) >= 10) && (getQuestItemsCount(talker, GEMSTONE_D) >= 1) && (getQuestItemsCount(talker, SILVER_NUGGET) >= 3) && (getQuestItemsCount(talker, TOAD_SKIN) >= 10)) - { - htmltext = "30608-02.html"; - } - else if ((qs.getInt("fairy_stone") == 2) && (getQuestItemsCount(talker, COAL) >= 10) && (getQuestItemsCount(talker, CHARCOAL) >= 10) && (getQuestItemsCount(talker, GEMSTONE_C) >= 1) && (getQuestItemsCount(talker, STONE_OF_PURITY) >= 1) && (getQuestItemsCount(talker, SILVER_NUGGET) >= 5) && (getQuestItemsCount(talker, TOAD_SKIN) >= 20)) - { - htmltext = "30608-04.html"; - } - else - { - htmltext = "30608-01.html"; - } - break; - } - case 3: - { - htmltext = "30608-06.html"; - break; - } - } - break; - } - case BYRON: - { - switch (qs.getCond()) - { - case 2: - { - htmltext = "30711-10.html"; - break; - } - case 3: - { - if (qs.getInt("old_stone") == 0) - { - htmltext = "30711-01.html"; - } - else if (qs.getInt("old_stone") == 1) - { - qs.setCond(5, true); - htmltext = "30711-05.html"; - } - else - { - qs.setCond(4, true); - htmltext = "30711-06.html"; - } - break; - } - case 4: - { - if ((getQuestItemsCount(talker, FAIRY_STONE) == 0) && (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) == 0)) - { - htmltext = "30711-09.html"; - } - else if (getQuestItemsCount(talker, FAIRY_STONE) == 0) - { - htmltext = "30711-08.html"; - } - else - { - htmltext = "30711-07.html"; - } - break; - } - } - break; - } - case MIMYU: - { - switch (qs.getCond()) - { - case 4: - { - if (getQuestItemsCount(talker, FAIRY_STONE) > 0) - { - htmltext = "30747-01.html"; - } - else if (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) > 0) - { - htmltext = "30747-03.html"; - } - break; - } - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { - htmltext = "30747-09.html"; - } - else if (qs.getInt("fairy_stone") == 1) - { - htmltext = "30747-05.html"; - } - else - { - htmltext = "30747-06.html"; - } - break; - } - case 6: - { - if ((getQuestItemsCount(talker, EXARION_EGG) >= 20) || (getQuestItemsCount(talker, ZWOV_EGG) >= 20) || (getQuestItemsCount(talker, KALIBRAN_EGG) >= 20) || (getQuestItemsCount(talker, SUZET_EGG) >= 20) || (getQuestItemsCount(talker, SHAMHAI_EGG) >= 20)) - { - htmltext = "30747-10.html"; - } - else - { - htmltext = "30747-09.html"; - } - break; - } - case 7: - { - htmltext = "30747-11.html"; - break; - } - case 8: - { - htmltext = "30747-12.html"; - break; - } - } - break; - } - case EXARION: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { - htmltext = "30748-01.html"; - } - break; - } - case 6: - { - if (getQuestItemsCount(talker, EXARION_EGG) >= 20) - { - takeItems(talker, -1, EXARION_SCALE, EXARION_EGG); - giveItems(talker, EXARION_EGG, 1); - qs.setCond(7, true); - htmltext = "30748-04.html"; - } - else - { - htmltext = "30748-03.html"; - } - break; - } - case 7: - { - htmltext = "30748-05.html"; - break; - } - } - break; - } - case ZWOV: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { - htmltext = "30749-01.html"; - } - break; - } - case 6: - { - if (getQuestItemsCount(talker, ZWOV_EGG) >= 20) - { - takeItems(talker, -1, ZWOV_SCALE, ZWOV_EGG); - giveItems(talker, ZWOV_EGG, 1); - qs.setCond(7, true); - htmltext = "30749-04.html"; - } - else - { - htmltext = "30749-03.html"; - } - break; - } - case 7: - { - htmltext = "30749-05.html"; - break; - } - } - break; - } - case KALIBRAN: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { - htmltext = "30750-01.html"; - } - break; - } - case 6: - { - if (getQuestItemsCount(talker, KALIBRAN_EGG) >= 20) - { - htmltext = "30750-04.html"; - } - else - { - htmltext = "30750-03.html"; - } - break; - } - case 7: - { - htmltext = "30750-06.html"; - break; - } - } - break; - } - case SUZET: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { - htmltext = "30751-01.html"; - } - break; - } - case 6: - { - if (getQuestItemsCount(talker, SUZET_EGG) >= 20) - { - takeItems(talker, -1, SUZET_SCALE, SUZET_EGG); - giveItems(talker, SUZET_EGG, 1); - qs.setCond(7, true); - htmltext = "30751-05.html"; - } - else - { - htmltext = "30751-04.html"; - } - break; - } - case 7: - { - htmltext = "30751-06.html"; - break; - } - } - break; - } - case SHAMHAI: - { - switch (qs.getCond()) - { - case 5: - { - if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) - { - htmltext = "30752-01.html"; - } - break; - } - case 6: - { - if (getQuestItemsCount(talker, SHAMHAI_EGG) >= 20) - { - takeItems(talker, -1, SHAMHAI_SCALE, SHAMHAI_EGG); - giveItems(talker, SHAMHAI_EGG, 1); - qs.setCond(7, true); - htmltext = "30752-04.html"; - } - else - { - htmltext = "30752-03.html"; - } - break; - } - case 7: - { - htmltext = "30752-05.html"; - break; - } - } - break; - } - } - break; - } - case State.COMPLETED: - { - htmltext = getAlreadyCompletedMsg(talker); - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); - if (qs != null) - { - if (qs.isCond(2) && (npc.getId() == TOAD_LORD)) - { - if (qs.getInt("fairy_stone") == 1) - { - giveItemRandomly(qs.getPlayer(), npc, TOAD_SKIN, 1, 10, 0.3, true); - } - else - { - giveItemRandomly(qs.getPlayer(), npc, TOAD_SKIN, 1, 20, 0.3, true); - } - } - else if (qs.isCond(6) && (npc.getId() == qs.getInt("drake_hunt"))) - { - giveItemRandomly(qs.getPlayer(), npc, EGG_DROPS.get(npc.getId()), 1, 20, 0.5, true); - } - } - return super.onKill(npc, killer, isSummon); - } - - /** - * Gives the reward to the player. - * @param player the player - */ - private static void giveReward(PlayerInstance player) - { - final int random = getRandom(100); - for (int i : EGGS) - { - if (hasQuestItems(player, i)) - { - final int mul = EGGS.indexOf(i) * 5; - if (hasQuestItems(player, FAIRY_DUST)) - { - if (random < (45 + mul)) - { - giveItems(player, DRAGONFLUTE_OF_WIND, 1); - } - else if (random < (75 + mul)) - { - giveItems(player, DRAGONFLUTE_OF_STAR, 1); - } - else - { - giveItems(player, DRAGONFLUTE_OF_TWILIGHT, 1); - } - } - if (random < (50 + mul)) - { - giveItems(player, DRAGONFLUTE_OF_WIND, 1); - } - else if (random < (85 + mul)) - { - giveItems(player, DRAGONFLUTE_OF_STAR, 1); - } - else - { - giveItems(player, DRAGONFLUTE_OF_TWILIGHT, 1); - } - takeItems(player, i, -1); - break; - } - } - } -} + static + { + EGG_DROPS.put(DEAD_SEEKER, SHAMHAI_EGG); + EGG_DROPS.put(MARSH_SPIDER, ZWOV_EGG); + EGG_DROPS.put(BREKA_OVERLORD, SUZET_EGG); + EGG_DROPS.put(ROAD_SCAVENGER, KALIBRAN_EGG); + EGG_DROPS.put(LETO_WARRIOR, EXARION_EGG); + } + // Misc + private static final int MIN_LVL = 35; + + public Q00420_LittleWing() + { + super(420); + addStartNpc(COOPER); + addTalkId(MARIA, CRONOS, BYRON, MIMYU, EXARION, ZWOV, KALIBRAN, SUZET, SHAMHAI, COOPER); + addAttackId(DELUXE_STONE_BREAKERS); + addKillId(TOAD_LORD, DEAD_SEEKER, MARSH_SPIDER, BREKA_OVERLORD, ROAD_SCAVENGER, LETO_WARRIOR); + registerQuestItems(FAIRY_DUST, FAIRY_STONE, DELUXE_FAIRY_STONE, FAIRY_STONE_LIST, DELUXE_STONE_LIST, TOAD_SKIN, MONKSHOOD_JUICE, EXARION_SCALE, EXARION_EGG, ZWOV_SCALE, ZWOV_EGG, KALIBRAN_SCALE, KALIBRAN_EGG, SUZET_SCALE, SUZET_EGG, SHAMHAI_SCALE, SHAMHAI_EGG); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs == null) + { + return htmltext; + } + + switch (event) + { + case "30610-02.html": + case "30610-03.html": + case "30610-04.html": + case "30711-02.html": + case "30747-05.html": + case "30747-06.html": + case "30751-02.html": + { + htmltext = event; + break; + } + case "30829-02.htm": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "30610-05.html": + { + if (qs.isCond(1)) + { + qs.setCond(2, true); + qs.set("old_stone", 0); + qs.set("fairy_stone", 1); + giveItems(player, FAIRY_STONE_LIST, 1); + htmltext = event; + } + break; + } + case "30610-06.html": + { + if (qs.isCond(1)) + { + qs.setCond(2, true); + qs.set("old_stone", 0); + qs.set("fairy_stone", 2); + giveItems(player, DELUXE_STONE_LIST, 1); + htmltext = event; + } + break; + } + case "30610-12.html": + { + if (qs.isCond(5)) + { + qs.setCond(2, true); + qs.set("old_stone", qs.getInt("fairy_stone")); + qs.set("fairy_stone", 1); + giveItems(player, FAIRY_STONE_LIST, 1); + htmltext = event; + } + break; + } + case "30610-13.html": + { + if (qs.isCond(5)) + { + qs.setCond(2, true); + qs.set("old_stone", qs.getInt("fairy_stone")); + qs.set("fairy_stone", 2); + giveItems(player, DELUXE_STONE_LIST, 1); + htmltext = event; + } + break; + } + case "30608-03.html": + { + if (qs.isCond(2)) + { + if ((qs.getInt("fairy_stone") == 1) && (getQuestItemsCount(player, COAL) >= 10) && (getQuestItemsCount(player, CHARCOAL) >= 10) && (getQuestItemsCount(player, GEMSTONE_D) >= 1) && (getQuestItemsCount(player, SILVER_NUGGET) >= 3) && (getQuestItemsCount(player, TOAD_SKIN) >= 10)) + { + takeItems(player, FAIRY_STONE_LIST, -1); + takeItems(player, COAL, 10); + takeItems(player, CHARCOAL, 10); + takeItems(player, GEMSTONE_D, 1); + takeItems(player, SILVER_NUGGET, 3); + takeItems(player, TOAD_SKIN, -1); + giveItems(player, FAIRY_STONE, 1); + } + qs.setCond(3, true); + htmltext = event; + } + break; + } + case "30608-05.html": + { + if (qs.isCond(2)) + { + if ((qs.getInt("fairy_stone") == 2) && (getQuestItemsCount(player, COAL) >= 10) && (getQuestItemsCount(player, CHARCOAL) >= 10) && (getQuestItemsCount(player, GEMSTONE_C) >= 1) && (getQuestItemsCount(player, STONE_OF_PURITY) >= 1) && (getQuestItemsCount(player, SILVER_NUGGET) >= 5) && (getQuestItemsCount(player, TOAD_SKIN) >= 20)) + { + takeItems(player, DELUXE_STONE_LIST, -1); + takeItems(player, COAL, 10); + takeItems(player, CHARCOAL, 10); + takeItems(player, GEMSTONE_C, 1); + takeItems(player, STONE_OF_PURITY, 1); + takeItems(player, SILVER_NUGGET, 5); + takeItems(player, TOAD_SKIN, -1); + giveItems(player, DELUXE_FAIRY_STONE, 1); + } + qs.setCond(3, true); + htmltext = event; + } + break; + } + case "30711-03.html": + { + if (qs.isCond(3)) + { + qs.setCond(4, true); + if (qs.getInt("fairy_stone") == 2) + { + htmltext = "30711-04.html"; + } + else + { + htmltext = event; + } + } + break; + } + case "30747-02.html": + case "30747-04.html": + { + if (qs.isCond(4) && ((getQuestItemsCount(player, FAIRY_STONE) + getQuestItemsCount(player, DELUXE_FAIRY_STONE)) > 0)) + { + takeItems(player, -1, FAIRY_STONE, DELUXE_FAIRY_STONE); + if (qs.getInt("fairy_stone") == 2) + { + giveItems(player, FAIRY_DUST, 1); + } + qs.setCond(5, true); + htmltext = event; + } + break; + } + case "30747-07.html": + case "30747-08.html": + { + if (qs.isCond(5) && (getQuestItemsCount(player, MONKSHOOD_JUICE) == 0)) + { + giveItems(player, MONKSHOOD_JUICE, 1); + htmltext = event; + } + break; + } + case "30747-12.html": + { + if (qs.isCond(7)) + { + if ((qs.getInt("fairy_stone") == 1) || (getQuestItemsCount(player, FAIRY_DUST) == 0)) + { + giveReward(player); + qs.exitQuest(true, true); + htmltext = "30747-16.html"; + } + else + { + qs.setCond(8, false); + htmltext = event; + } + } + else if (qs.isCond(8)) + { + htmltext = event; + } + break; + } + case "30747-13.html": + { + if (qs.isCond(8)) + { + giveReward(player); + qs.exitQuest(true, true); + htmltext = event; + } + break; + } + case "30747-15.html": + { + if (qs.isCond(8) && (getQuestItemsCount(player, FAIRY_DUST) > 1)) + { + if (getRandom(100) < 5) + { + giveItems(player, HATCHLING_ARMOR, 1); + htmltext = "30747-14.html"; + } + else + { + giveItems(player, HATCHLING_FOOD, 20); + htmltext = event; + } + giveReward(player); + takeItems(player, FAIRY_DUST, -1); + qs.exitQuest(true, true); + } + break; + } + case "30748-02.html": + { + if (qs.isCond(5)) + { + takeItems(player, MONKSHOOD_JUICE, -1); + giveItems(player, EXARION_SCALE, 1); + qs.setCond(6, true); + qs.set("drake_hunt", LETO_WARRIOR); + htmltext = event; + } + break; + } + case "30749-02.html": + { + if (qs.isCond(5)) + { + takeItems(player, MONKSHOOD_JUICE, -1); + giveItems(player, ZWOV_SCALE, 1); + qs.setCond(6, true); + qs.set("drake_hunt", MARSH_SPIDER); + htmltext = event; + } + break; + } + case "30750-02.html": + { + if (qs.isCond(5)) + { + takeItems(player, MONKSHOOD_JUICE, -1); + giveItems(player, KALIBRAN_SCALE, 1); + qs.setCond(6, true); + qs.set("drake_hunt", ROAD_SCAVENGER); + htmltext = event; + } + break; + } + case "30750-05.html": + { + if (qs.isCond(6) && (getQuestItemsCount(player, KALIBRAN_EGG) >= 20)) + { + takeItems(player, -1, KALIBRAN_SCALE, KALIBRAN_EGG); + giveItems(player, KALIBRAN_EGG, 1); + qs.setCond(7, true); + htmltext = event; + } + break; + } + case "30751-03.html": + { + if (qs.isCond(5)) + { + takeItems(player, MONKSHOOD_JUICE, -1); + giveItems(player, SUZET_SCALE, 1); + qs.setCond(6, true); + qs.set("drake_hunt", BREKA_OVERLORD); + htmltext = event; + } + break; + } + case "30752-02.html": + { + if (qs.isCond(5)) + { + takeItems(player, MONKSHOOD_JUICE, -1); + giveItems(player, SHAMHAI_SCALE, 1); + qs.setCond(6, true); + qs.set("drake_hunt", DEAD_SEEKER); + htmltext = event; + } + break; + } + } + return htmltext; + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) + { + final QuestState qs = getQuestState(attacker, false); + if ((qs != null) && (getQuestItemsCount(attacker, DELUXE_FAIRY_STONE) > 0) && (getRandom(100) < 30)) + { + takeItems(attacker, DELUXE_FAIRY_STONE, -1); + playSound(attacker, QuestSound.ITEMSOUND_QUEST_MIDDLE); + npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.THE_STONE_THE_ELVEN_STONE_BROKE)); + } + return super.onAttack(npc, attacker, damage, isSummon); + } + + @Override + public String onTalk(Npc npc, PlayerInstance talker) + { + final QuestState qs = getQuestState(talker, true); + String htmltext = getNoQuestMsg(talker); + switch (qs.getState()) + { + case State.CREATED: + { + if (npc.getId() == COOPER) + { + htmltext = (talker.getLevel() >= MIN_LVL) ? "30829-01.htm" : "30829-03.html"; + } + break; + } + case State.STARTED: + { + switch (npc.getId()) + { + case COOPER: + { + htmltext = "30829-04.html"; + break; + } + case CRONOS: + { + switch (qs.getCond()) + { + case 1: + { + htmltext = "30610-01.html"; + break; + } + case 2: + { + htmltext = "30610-07.html"; + break; + } + case 3: + { + if (qs.getInt("old_stone") > 0) + { + htmltext = "30610-14.html"; + } + else + { + htmltext = "30610-08.html"; + } + break; + } + case 4: + { + htmltext = "30610-09.html"; + break; + } + case 5: + { + if ((getQuestItemsCount(talker, FAIRY_STONE) == 0) && (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) == 0)) + { + htmltext = "30610-10.html"; + } + else + { + htmltext = "30610-11.html"; + } + break; + } + } + break; + } + case MARIA: + { + switch (qs.getCond()) + { + case 2: + { + if ((qs.getInt("fairy_stone") == 1) && (getQuestItemsCount(talker, COAL) >= 10) && (getQuestItemsCount(talker, CHARCOAL) >= 10) && (getQuestItemsCount(talker, GEMSTONE_D) >= 1) && (getQuestItemsCount(talker, SILVER_NUGGET) >= 3) && (getQuestItemsCount(talker, TOAD_SKIN) >= 10)) + { + htmltext = "30608-02.html"; + } + else if ((qs.getInt("fairy_stone") == 2) && (getQuestItemsCount(talker, COAL) >= 10) && (getQuestItemsCount(talker, CHARCOAL) >= 10) && (getQuestItemsCount(talker, GEMSTONE_C) >= 1) && (getQuestItemsCount(talker, STONE_OF_PURITY) >= 1) && (getQuestItemsCount(talker, SILVER_NUGGET) >= 5) && (getQuestItemsCount(talker, TOAD_SKIN) >= 20)) + { + htmltext = "30608-04.html"; + } + else + { + htmltext = "30608-01.html"; + } + break; + } + case 3: + { + htmltext = "30608-06.html"; + break; + } + } + break; + } + case BYRON: + { + switch (qs.getCond()) + { + case 2: + { + htmltext = "30711-10.html"; + break; + } + case 3: + { + if (qs.getInt("old_stone") == 0) + { + htmltext = "30711-01.html"; + } + else if (qs.getInt("old_stone") == 1) + { + qs.setCond(5, true); + htmltext = "30711-05.html"; + } + else + { + qs.setCond(4, true); + htmltext = "30711-06.html"; + } + break; + } + case 4: + { + if ((getQuestItemsCount(talker, FAIRY_STONE) == 0) && (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) == 0)) + { + htmltext = "30711-09.html"; + } + else if (getQuestItemsCount(talker, FAIRY_STONE) == 0) + { + htmltext = "30711-08.html"; + } + else + { + htmltext = "30711-07.html"; + } + break; + } + } + break; + } + case MIMYU: + { + switch (qs.getCond()) + { + case 4: + { + if (getQuestItemsCount(talker, FAIRY_STONE) > 0) + { + htmltext = "30747-01.html"; + } + else if (getQuestItemsCount(talker, DELUXE_FAIRY_STONE) > 0) + { + htmltext = "30747-03.html"; + } + break; + } + case 5: + { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) + { + htmltext = "30747-09.html"; + } + else if (qs.getInt("fairy_stone") == 1) + { + htmltext = "30747-05.html"; + } + else + { + htmltext = "30747-06.html"; + } + break; + } + case 6: + { + if ((getQuestItemsCount(talker, EXARION_EGG) >= 20) || (getQuestItemsCount(talker, ZWOV_EGG) >= 20) || (getQuestItemsCount(talker, KALIBRAN_EGG) >= 20) || (getQuestItemsCount(talker, SUZET_EGG) >= 20) || (getQuestItemsCount(talker, SHAMHAI_EGG) >= 20)) + { + htmltext = "30747-10.html"; + } + else + { + htmltext = "30747-09.html"; + } + break; + } + case 7: + { + htmltext = "30747-11.html"; + break; + } + case 8: + { + htmltext = "30747-12.html"; + break; + } + } + break; + } + case EXARION: + { + switch (qs.getCond()) + { + case 5: + { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) + { + htmltext = "30748-01.html"; + } + break; + } + case 6: + { + if (getQuestItemsCount(talker, EXARION_EGG) >= 20) + { + takeItems(talker, -1, EXARION_SCALE, EXARION_EGG); + giveItems(talker, EXARION_EGG, 1); + qs.setCond(7, true); + htmltext = "30748-04.html"; + } + else + { + htmltext = "30748-03.html"; + } + break; + } + case 7: + { + htmltext = "30748-05.html"; + break; + } + } + break; + } + case ZWOV: + { + switch (qs.getCond()) + { + case 5: + { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) + { + htmltext = "30749-01.html"; + } + break; + } + case 6: + { + if (getQuestItemsCount(talker, ZWOV_EGG) >= 20) + { + takeItems(talker, -1, ZWOV_SCALE, ZWOV_EGG); + giveItems(talker, ZWOV_EGG, 1); + qs.setCond(7, true); + htmltext = "30749-04.html"; + } + else + { + htmltext = "30749-03.html"; + } + break; + } + case 7: + { + htmltext = "30749-05.html"; + break; + } + } + break; + } + case KALIBRAN: + { + switch (qs.getCond()) + { + case 5: + { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) + { + htmltext = "30750-01.html"; + } + break; + } + case 6: + { + if (getQuestItemsCount(talker, KALIBRAN_EGG) >= 20) + { + htmltext = "30750-04.html"; + } + else + { + htmltext = "30750-03.html"; + } + break; + } + case 7: + { + htmltext = "30750-06.html"; + break; + } + } + break; + } + case SUZET: + { + switch (qs.getCond()) + { + case 5: + { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) + { + htmltext = "30751-01.html"; + } + break; + } + case 6: + { + if (getQuestItemsCount(talker, SUZET_EGG) >= 20) + { + takeItems(talker, -1, SUZET_SCALE, SUZET_EGG); + giveItems(talker, SUZET_EGG, 1); + qs.setCond(7, true); + htmltext = "30751-05.html"; + } + else + { + htmltext = "30751-04.html"; + } + break; + } + case 7: + { + htmltext = "30751-06.html"; + break; + } + } + break; + } + case SHAMHAI: + { + switch (qs.getCond()) + { + case 5: + { + if (getQuestItemsCount(talker, MONKSHOOD_JUICE) > 0) + { + htmltext = "30752-01.html"; + } + break; + } + case 6: + { + if (getQuestItemsCount(talker, SHAMHAI_EGG) >= 20) + { + takeItems(talker, -1, SHAMHAI_SCALE, SHAMHAI_EGG); + giveItems(talker, SHAMHAI_EGG, 1); + qs.setCond(7, true); + htmltext = "30752-04.html"; + } + else + { + htmltext = "30752-03.html"; + } + break; + } + case 7: + { + htmltext = "30752-05.html"; + break; + } + } + break; + } + } + break; + } + case State.COMPLETED: + { + htmltext = getAlreadyCompletedMsg(talker); + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc); + if (qs != null) + { + if (qs.isCond(2) && (npc.getId() == TOAD_LORD)) + { + if (qs.getInt("fairy_stone") == 1) + { + giveItemRandomly(qs.getPlayer(), npc, TOAD_SKIN, 1, 10, 0.3, true); + } + else + { + giveItemRandomly(qs.getPlayer(), npc, TOAD_SKIN, 1, 20, 0.3, true); + } + } + else if (qs.isCond(6) && (npc.getId() == qs.getInt("drake_hunt"))) + { + giveItemRandomly(qs.getPlayer(), npc, EGG_DROPS.get(npc.getId()), 1, 20, 0.5, true); + } + } + return super.onKill(npc, killer, isSummon); + } + + /** + * Gives the reward to the player. + * @param player the player + */ + private static void giveReward(PlayerInstance player) + { + final int random = getRandom(100); + for (int i : EGGS) + { + if (hasQuestItems(player, i)) + { + final int mul = EGGS.indexOf(i) * 5; + if (hasQuestItems(player, FAIRY_DUST)) + { + if (random < (45 + mul)) + { + giveItems(player, DRAGONFLUTE_OF_WIND, 1); + } + else if (random < (75 + mul)) + { + giveItems(player, DRAGONFLUTE_OF_STAR, 1); + } + else + { + giveItems(player, DRAGONFLUTE_OF_TWILIGHT, 1); + } + } + if (random < (50 + mul)) + { + giveItems(player, DRAGONFLUTE_OF_WIND, 1); + } + else if (random < (85 + mul)) + { + giveItems(player, DRAGONFLUTE_OF_STAR, 1); + } + else + { + giveItems(player, DRAGONFLUTE_OF_TWILIGHT, 1); + } + takeItems(player, i, -1); + break; + } + } + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00461_RumbleInTheBase/Q00461_RumbleInTheBase.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00461_RumbleInTheBase/Q00461_RumbleInTheBase.java index 02bbd90da6..abf8f39eb7 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00461_RumbleInTheBase/Q00461_RumbleInTheBase.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00461_RumbleInTheBase/Q00461_RumbleInTheBase.java @@ -42,7 +42,6 @@ public class Q00461_RumbleInTheBase extends Quest private static final int SHOES_STRING_OF_SEL_MAHUM = 16382; // Mobs private static final Map MONSTERS = new HashMap<>(); - static { MONSTERS.put(22780, 581); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00463_IMustBeaGenius/Q00463_IMustBeaGenius.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00463_IMustBeaGenius/Q00463_IMustBeaGenius.java index cc5c641941..6d502a59c1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00463_IMustBeaGenius/Q00463_IMustBeaGenius.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00463_IMustBeaGenius/Q00463_IMustBeaGenius.java @@ -67,7 +67,6 @@ public class Q00463_IMustBeaGenius extends Quest // Mobs private static final Map MOBS = new HashMap<>(); - static { MOBS.put(22801, new DropInfo(5, 0)); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00601_WatchingEyes/Q00601_WatchingEyes.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00601_WatchingEyes/Q00601_WatchingEyes.java index eea65e7140..52b27cd304 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00601_WatchingEyes/Q00601_WatchingEyes.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00601_WatchingEyes/Q00601_WatchingEyes.java @@ -39,7 +39,6 @@ public class Q00601_WatchingEyes extends Quest private static final int PROOF_OF_AVENGER = 7188; // Monsters private static final Map MOBS = new HashMap<>(); - static { MOBS.put(21308, 790); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java index 424e9aaad2..0d64637394 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00628_HuntGoldenRam/Q00628_HuntGoldenRam.java @@ -44,7 +44,6 @@ public final class Q00628_HuntGoldenRam extends Quest private static final int MIN_LVL = 66; // Mobs private static final Map MOBS_DROP_CHANCES = new HashMap<>(); - static { MOBS_DROP_CHANCES.put(21508, new ItemChanceHolder(SPLINTER_STAKATO_CHITIN, 0.500, 1)); // splinter_stakato diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00629_CleanUpTheSwampOfScreams/Q00629_CleanUpTheSwampOfScreams.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00629_CleanUpTheSwampOfScreams/Q00629_CleanUpTheSwampOfScreams.java index 395750c9f9..d3c718050e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00629_CleanUpTheSwampOfScreams/Q00629_CleanUpTheSwampOfScreams.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00629_CleanUpTheSwampOfScreams/Q00629_CleanUpTheSwampOfScreams.java @@ -40,7 +40,6 @@ public final class Q00629_CleanUpTheSwampOfScreams extends Quest private static final int MIN_LVL = 66; // Mobs private static final Map MOBS_DROP_CHANCES = new HashMap<>(); - static { MOBS_DROP_CHANCES.put(21508, 0.599); // splinter_stakato diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00644_GraveRobberAnnihilation/Q00644_GraveRobberAnnihilation.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00644_GraveRobberAnnihilation/Q00644_GraveRobberAnnihilation.java index 228c859e22..4af4a85000 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00644_GraveRobberAnnihilation/Q00644_GraveRobberAnnihilation.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00644_GraveRobberAnnihilation/Q00644_GraveRobberAnnihilation.java @@ -43,7 +43,6 @@ public final class Q00644_GraveRobberAnnihilation extends Quest private static final Map MONSTER_DROP_CHANCES = new HashMap<>(); // Rewards private static final Map REWARDS = new HashMap<>(); - static { MONSTER_DROP_CHANCES.put(22003, 0.714); // Grave Robber Scout diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00649_ALooterAndARailroadMan/Q00649_ALooterAndARailroadMan.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00649_ALooterAndARailroadMan/Q00649_ALooterAndARailroadMan.java index f5cf9bcf1c..356e5c6dce 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00649_ALooterAndARailroadMan/Q00649_ALooterAndARailroadMan.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00649_ALooterAndARailroadMan/Q00649_ALooterAndARailroadMan.java @@ -42,7 +42,6 @@ public final class Q00649_ALooterAndARailroadMan extends Quest private static final int MIN_LVL = 30; // Monsters private static final Map MONSTERS = new HashMap<>(); - static { MONSTERS.put(22017, 529); // Bandit Sweeper diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00716_PathToBecomingALordRune/Q00716_PathToBecomingALordRune.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00716_PathToBecomingALordRune/Q00716_PathToBecomingALordRune.java index 6578a57414..16ad69b73e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00716_PathToBecomingALordRune/Q00716_PathToBecomingALordRune.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00716_PathToBecomingALordRune/Q00716_PathToBecomingALordRune.java @@ -43,7 +43,6 @@ public class Q00716_PathToBecomingALordRune extends Quest private static final int RuneCastle = 8; private static List Pagans = new ArrayList<>(); - static { for (int i = 22138; i <= 22176; i++) diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00727_HopeWithinTheDarkness/Q00727_HopeWithinTheDarkness.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00727_HopeWithinTheDarkness/Q00727_HopeWithinTheDarkness.java index 67881a463b..5fffc9706a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00727_HopeWithinTheDarkness/Q00727_HopeWithinTheDarkness.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/quests/Q00727_HopeWithinTheDarkness/Q00727_HopeWithinTheDarkness.java @@ -1,820 +1,821 @@ -/* - * 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 . - */ -package quests.Q00727_HopeWithinTheDarkness; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.CommonUtil; -import com.l2jmobius.gameserver.ai.CtrlIntention; -import com.l2jmobius.gameserver.enums.ChatType; -import com.l2jmobius.gameserver.instancemanager.FortManager; -import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager; -import com.l2jmobius.gameserver.instancemanager.InstanceManager; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.Party; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Creature; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.actor.instance.QuestGuardInstance; -import com.l2jmobius.gameserver.model.entity.Castle; -import com.l2jmobius.gameserver.model.entity.Fort; -import com.l2jmobius.gameserver.model.holders.SkillHolder; -import com.l2jmobius.gameserver.model.instancezone.Instance; -import com.l2jmobius.gameserver.model.instancezone.InstanceWorld; -import com.l2jmobius.gameserver.model.quest.Quest; -import com.l2jmobius.gameserver.model.quest.QuestState; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.NpcSay; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.util.Util; - -/** - * Hope within the Darkness (727) - * @author GKR, Pandragon - */ -public class Q00727_HopeWithinTheDarkness extends Quest -{ - protected class CAUWorld extends InstanceWorld - { - public boolean underAttack = false; - public boolean allMonstersDead = true; - } - - public static class CastleDungeon - { - private final int INSTANCEID; - private final int _wardenId; - - public CastleDungeon(int iId, int wardenId) - { - INSTANCEID = iId; - _wardenId = wardenId; - } - - public int getInstanceId() - { - return INSTANCEID; - } - - public long getReEnterTime() - { - long _reEnterTime = 0; - if (GlobalVariablesManager.getInstance().hasVariable("CastlePailaka " + _wardenId)) - { - _reEnterTime = GlobalVariablesManager.getInstance().getLong("CastlePailaka " + _wardenId); - } - else - { - GlobalVariablesManager.getInstance().set("CastlePailaka " + _wardenId, 0); - } - return _reEnterTime; - } - - public void setReEnterTime(long time) - { - GlobalVariablesManager.getInstance().set("CastlePailaka " + _wardenId, time); - } - } - - // NPCs - private static final int NPC_KNIGHT = 36562; - private static final int NPC_RANGER = 36563; - private static final int NPC_MAGE = 36564; - private static final int NPC_WARRIOR = 36565; - - private static final int[] BOSSES = - { - 25653, - 25654, - 25655 - }; - private static final int[] MONSTERS = - { - 25656, - 25657, - 25658 - }; - - // Reward - private static final int KNIGHT_EPALUETTE = 9912; - - // Skills +/* + * 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 . + */ +package quests.Q00727_HopeWithinTheDarkness; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.concurrent.ThreadPool; +import com.l2jmobius.commons.util.CommonUtil; +import com.l2jmobius.gameserver.ai.CtrlIntention; +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.instancemanager.FortManager; +import com.l2jmobius.gameserver.instancemanager.GlobalVariablesManager; +import com.l2jmobius.gameserver.instancemanager.InstanceManager; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.Party; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Creature; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.actor.instance.QuestGuardInstance; +import com.l2jmobius.gameserver.model.entity.Castle; +import com.l2jmobius.gameserver.model.entity.Fort; +import com.l2jmobius.gameserver.model.holders.SkillHolder; +import com.l2jmobius.gameserver.model.instancezone.Instance; +import com.l2jmobius.gameserver.model.instancezone.InstanceWorld; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.NpcSay; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.util.Util; + +/** + * Hope within the Darkness (727) + * @author GKR, Pandragon + */ +public class Q00727_HopeWithinTheDarkness extends Quest +{ + protected class CAUWorld extends InstanceWorld + { + public boolean underAttack = false; + public boolean allMonstersDead = true; + } + + public static class CastleDungeon + { + private final int INSTANCEID; + private final int _wardenId; + + public CastleDungeon(int iId, int wardenId) + { + INSTANCEID = iId; + _wardenId = wardenId; + } + + public int getInstanceId() + { + return INSTANCEID; + } + + public long getReEnterTime() + { + long _reEnterTime = 0; + if (GlobalVariablesManager.getInstance().hasVariable("CastlePailaka " + _wardenId)) + { + _reEnterTime = GlobalVariablesManager.getInstance().getLong("CastlePailaka " + _wardenId); + } + else + { + GlobalVariablesManager.getInstance().set("CastlePailaka " + _wardenId, 0); + } + return _reEnterTime; + } + + public void setReEnterTime(long time) + { + GlobalVariablesManager.getInstance().set("CastlePailaka " + _wardenId, time); + } + } + + // NPCs + private static final int NPC_KNIGHT = 36562; + private static final int NPC_RANGER = 36563; + private static final int NPC_MAGE = 36564; + private static final int NPC_WARRIOR = 36565; + + private static final int[] BOSSES = + { + 25653, + 25654, + 25655 + }; + private static final int[] MONSTERS = + { + 25656, + 25657, + 25658 + }; + + // Reward + private static final int KNIGHT_EPALUETTE = 9912; + + // Skills private static Map NPC_BUFFS = new HashMap<>(); - { - NPC_BUFFS.put(NPC_KNIGHT, new SkillHolder(5970, 1)); - NPC_BUFFS.put(NPC_RANGER, new SkillHolder(5971, 1)); - NPC_BUFFS.put(NPC_MAGE, new SkillHolder(5972, 1)); - NPC_BUFFS.put(NPC_WARRIOR, new SkillHolder(5973, 1)); - } - private static final SkillHolder RAID_CURSE = new SkillHolder(5456, 1); - - // Strings - protected static final NpcStringId STRINGID_WIN = NpcStringId.YOU_VE_DONE_IT_WE_BELIEVED_IN_YOU_WARRIOR_WE_WANT_TO_SHOW_OUR_SINCERITY_THOUGH_IT_IS_SMALL_PLEASE_GIVE_ME_SOME_OF_YOUR_TIME; - private static final NpcStringId STRINGID_WELCOME = NpcStringId.WARRIORS_HAVE_YOU_COME_TO_HELP_THOSE_WHO_ARE_IMPRISONED_HERE; - private static final NpcStringId STRINGID_BOSS_DEATH = NpcStringId.HOW_DARE_YOU; - private static final NpcStringId[] STRINGID_INJURED = - { - NpcStringId.YOUR_MIND_IS_GOING_BLANK, - NpcStringId.UGH_IT_HURTS_DOWN_TO_THE_BONES - }; - private static final NpcStringId[] STRINGID_DIE = - { - NpcStringId.I_CAN_T_STAND_IT_ANYMORE_AAH, - NpcStringId.KYAAAK, - NpcStringId.GASP_HOW_CAN_THIS_BE - }; - private static final NpcStringId[] STRINGID_BOSS_SPAWN = - { - NpcStringId.I_LL_RIP_THE_FLESH_FROM_YOUR_BONES, - NpcStringId.YOU_LL_FLOUNDER_IN_DELUSION_FOR_THE_REST_OF_YOUR_LIFE, - NpcStringId.THERE_IS_NO_ESCAPE_FROM_THIS_PLACE - }; - - // Misc - private static final boolean DEBUG = false; - private static final int MIN_LVL = 80; - private static final boolean CHECK_FOR_CONTRACT = true; - private static final long REENTER_INTERVAL = 14400000; - private static final long INITIAL_SPAWN_DELAY = 120000; // Spawn NPCs and 1st Wave bosses (2 min) - private static final long WAVE_SPAWN_DELAY = 480000; // Spawn next wave's bosses (8 min) - private static final long PRIVATE_SPAWN_DELAY = 180000; // Spawn monsters (3 min after boss had been spawned) - private static final Location PLAYER_SPAWN_POINT = new Location(48163, -12195, -9140); - private final Map CASTLE_DUNGEONS = new HashMap<>(); - { - CASTLE_DUNGEONS.put(36403, new CastleDungeon(80, 36403)); - CASTLE_DUNGEONS.put(36404, new CastleDungeon(81, 36404)); - CASTLE_DUNGEONS.put(36405, new CastleDungeon(82, 36405)); - CASTLE_DUNGEONS.put(36406, new CastleDungeon(83, 36406)); - CASTLE_DUNGEONS.put(36407, new CastleDungeon(84, 36407)); - CASTLE_DUNGEONS.put(36408, new CastleDungeon(85, 36408)); - CASTLE_DUNGEONS.put(36409, new CastleDungeon(86, 36409)); - CASTLE_DUNGEONS.put(36410, new CastleDungeon(87, 36410)); - CASTLE_DUNGEONS.put(36411, new CastleDungeon(88, 36411)); - } - - public Q00727_HopeWithinTheDarkness() - { - super(727); - - for (int i : CASTLE_DUNGEONS.keySet()) - { - addStartNpc(i); - addTalkId(i); - } - - for (int i = NPC_KNIGHT; i <= NPC_WARRIOR; i++) - { - addSpawnId(i); - addKillId(i); - addAttackId(i); - addTalkId(i); - addFirstTalkId(i); - } - - for (int i : BOSSES) - { - addSpawnId(i); - addKillId(i); - addAttackId(i); - } - - for (int i : MONSTERS) - { - addKillId(i); - addAttackId(i); - } - - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final String htmltext = event; - if (event.equalsIgnoreCase("enter")) - { - return enterInstance(player, "CastlePailaka.xml", PLAYER_SPAWN_POINT, CASTLE_DUNGEONS.get(npc.getId()), checkEnterConditions(player, npc)); - } - else if (event.equalsIgnoreCase("suicide")) - { - final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc); - tmpworld.setStatus(5); - final Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId()); - if (inst != null) - { - for (Npc _npc : inst.getNpcs()) - { - if ((_npc != null) && ((_npc.getId() >= NPC_KNIGHT) && (_npc.getId() <= NPC_WARRIOR))) - { - cancelQuestTimer("check_for_foes", _npc, null); - cancelQuestTimer("buff", _npc, null); - - if (!_npc.isDead()) - { - _npc.doDie(null); - } - } - } - - // Destroy instance after 5 minutes - inst.setDuration(5 * 60000); - inst.setEmptyDestroyTime(0); - } - - return null; - } - else if (event.equalsIgnoreCase("buff")) - { - for (PlayerInstance pl : World.getInstance().getVisibleObjects(npc, PlayerInstance.class)) - { - if ((pl != null) && Util.checkIfInRange(75, npc, pl, false) && (NPC_BUFFS.get(npc.getId()) != null)) - { - npc.setTarget(pl); - npc.doCast(NPC_BUFFS.get(npc.getId()).getSkill()); - } - } - startQuestTimer("buff", 120000, npc, null); - return null; - } - else if (event.equalsIgnoreCase("check_for_foes")) - { - if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - for (Creature foe : World.getInstance().getVisibleObjectsInRange(npc, Creature.class, npc.getAggroRange())) - { - if (foe.isAttackable() && !(foe instanceof QuestGuardInstance)) - { - ((QuestGuardInstance) npc).addDamageHate(foe, 0, 999); - ((QuestGuardInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, foe, null); - } - } - } - - startQuestTimer("check_for_foes", 5000, npc, null); - return null; - } - - QuestState qs = player.getQuestState(getName()); - if (qs == null) - { - qs = newQuestState(player); - } - - final int cond = qs.getCond(); - if (event.equalsIgnoreCase("CastleWarden-05.htm")) - { - if (cond == 0) - { - qs.startQuest(); - } - } - else if (event.equalsIgnoreCase("CastleWarden-15.htm")) - { - qs.exitQuest(true, true); - } - return htmltext; - } - - @Override - public String onFirstTalk(Npc npc, PlayerInstance player) - { - final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player); - if (tmpworld instanceof CAUWorld) - { - final CAUWorld world = (CAUWorld) tmpworld; - - if (world.underAttack) - { - return "Victim-02.html"; - } - else if (world.getStatus() == 4) - { - return "Victim-03.html"; - } - else - { - return "Victim-01.html"; - } - } - - return null; - } - - @Override - public String onTalk(Npc npc, PlayerInstance player) - { - String htmltext = Quest.getNoQuestMsg(player); - final QuestState qs = getQuestState(player, true); - - if ((npc.getId() >= NPC_KNIGHT) && (npc.getId() <= NPC_WARRIOR)) - { - final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player); - if ((tmpworld != null) && (tmpworld instanceof CAUWorld)) - { - final CAUWorld world = (CAUWorld) tmpworld; - - world.removeAllowed(player); - final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - - final Location loc = inst.getExitLoc(); - teleportPlayer(player, loc, 0); - return null; - } - } - - if ((player.getClan() == null) || (npc.getCastle() == null) || (player.getClan().getCastleId() != npc.getCastle().getResidenceId())) - { - return "CastleWarden-03.html"; - } - else if (qs != null) - { - final int npcId = npc.getId(); - int cond = 0; - if (qs.isCreated()) - { - qs.setCond(0); - } - else - { - cond = qs.getCond(); - } - if (CASTLE_DUNGEONS.containsKey(npcId) && (cond == 0)) - { - if (player.getLevel() >= 80) - { - htmltext = "CastleWarden-01.htm"; - } - else - { - htmltext = "CastleWarden-04.html"; - qs.exitQuest(true); - } - } - else if (CASTLE_DUNGEONS.containsKey(npcId) && (cond > 0) && (qs.isStarted())) - { - if (cond == 1) - { - htmltext = "CastleWarden-15.htm"; - } - else if (cond == 3) - { - rewardItems(player, KNIGHT_EPALUETTE, 159); - qs.exitQuest(true, true); - htmltext = "CastleWarden-16.html"; - } - } - } - return htmltext; - } - - @Override - public String onAttack(Npc npc, PlayerInstance player, int damage, boolean isSummon) - { - if ((npc.getId() >= NPC_KNIGHT) && (npc.getId() <= NPC_WARRIOR)) - { - if (npc.getCurrentHp() <= (npc.getMaxHp() * 0.1)) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_INJURED[1])); - } - else if (npc.getCurrentHp() <= (npc.getMaxHp() * 0.4)) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_INJURED[0])); - } - - return null; - } - - if (player != null) - { - final Playable attacker = (isSummon ? player.getSummon() : player); - if ((attacker.getLevel() - npc.getLevel()) >= 9) - { - if ((attacker.getBuffCount() > 0) || (attacker.getDanceCount() > 0)) - { - npc.setTarget(attacker); - npc.doSimultaneousCast(RAID_CURSE.getSkill()); - } - else if (player.getParty() != null) - { - for (PlayerInstance pmember : player.getParty().getMembers()) - { - if ((pmember.getBuffCount() > 0) || (pmember.getDanceCount() > 0)) - { - npc.setTarget(pmember); - npc.doSimultaneousCast(RAID_CURSE.getSkill()); - } - } - } - } - } - return super.onAttack(npc, player, damage, isSummon); - } - - @Override - public String onKill(Npc npc, PlayerInstance player, boolean isSummon) - { - if ((npc.getId() >= NPC_KNIGHT) && (npc.getId() <= NPC_WARRIOR)) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_DIE[npc.getId() - 36562])); - - // All other friendly NPCs do suicide - start timer - startQuestTimer("suicide", 1500, npc, null); - cancelQuestTimer("check_for_foes", npc, null); - cancelQuestTimer("buff", npc, null); - return null; - } - - final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc); - if (tmpworld instanceof CAUWorld) - { - final CAUWorld world = (CAUWorld) tmpworld; - if (CommonUtil.contains(BOSSES, npc.getId())) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_BOSS_DEATH)); - } - - if ((tmpworld.getStatus() == 3) && (CommonUtil.contains(BOSSES, npc.getId()) || CommonUtil.contains(MONSTERS, npc.getId()))) - { - world.allMonstersDead = true; - final Instance inst = InstanceManager.getInstance().getInstance(tmpworld.getInstanceId()); - - if (inst != null) - { - for (Npc _npc : inst.getNpcs()) - { - if ((_npc != null) && !_npc.isDead() && (CommonUtil.contains(BOSSES, _npc.getId()) || CommonUtil.contains(MONSTERS, _npc.getId()))) - { - world.allMonstersDead = false; - break; - } - - } - - if (world.allMonstersDead) - { - tmpworld.setStatus(4); - - // Destroy instance after 5 minutes - inst.setDuration(5 * 60000); - inst.setEmptyDestroyTime(0); - ThreadPool.schedule(new completeDungeon(world, player), 1500); - } - } - } - } - - return null; - } - - @Override - public final String onSpawn(Npc npc) - { - // Buff players every two minutes, check for foes in aggro range - if ((npc.getId() >= NPC_KNIGHT) && (npc.getId() <= NPC_WARRIOR)) - { - startQuestTimer("buff", 120000, npc, null); - startQuestTimer("check_for_foes", 120000, npc, null); - - if (npc.getId() == NPC_KNIGHT) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_WELCOME)); - } - } - else if (Arrays.binarySearch(BOSSES, npc.getId()) >= 0) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_BOSS_SPAWN[Arrays.binarySearch(BOSSES, npc.getId())])); - } - - return null; - } - - private String checkEnterConditions(PlayerInstance player, Npc npc) - { - if (DEBUG) - { - return null; - } - - final Castle castle = npc.getCastle(); - final CastleDungeon dungeon = CASTLE_DUNGEONS.get(npc.getId()); - boolean haveContract = false; - - if ((player == null) || (castle == null) || (dungeon == null)) - { - return "CastleWarden-03.html"; - } - - // Check if castle have contract with fortress - if (CHECK_FOR_CONTRACT) - { - for (Fort fort : FortManager.getInstance().getForts()) - { - if (fort.getContractedCastleId() == castle.getResidenceId()) - { - haveContract = true; - break; - } - } - - if (!haveContract) - { - return "CastleWarden-13a.html"; - } - } - - QuestState qs = player.getQuestState(getName()); - - // Check if player has quest - if ((qs == null) || qs.isCreated()) - { - // Check if player is from clan, that owns castle - if ((player.getClan() == null) || (player.getClan().getCastleId() != castle.getResidenceId())) - { - return "CastleWarden-08.html"; - } - - if (player.getLevel() >= MIN_LVL) - { - return "CastleWarden-06.htm"; - } - - return "CastleWarden-07.html"; - } - - final Party party = player.getParty(); - - if (party == null) - { - return "CastleWarden-09.html"; - } - - if (party.getLeader() != player) - { - return getHtm(player, "CastleWarden-10.html").replace("%leader%", party.getLeader().getName()); - } - - for (PlayerInstance partyMember : party.getMembers()) - { - qs = partyMember.getQuestState(getName()); - - // Check if each party member has quest - if ((qs == null) || qs.isCreated()) - { - return getHtm(player, "CastleWarden-12.html").replace("%player%", partyMember.getName()); - } - - if ((player.getClan() == null) || (player.getClan().getCastleId() != castle.getResidenceId())) - { - return getHtm(player, "CastleWarden-11.html").replace("%player%", partyMember.getName()); - } - - // Check if each party member not very far from leader - if (!Util.checkIfInRange(1000, player, partyMember, true)) - { - return getHtm(player, "CastleWarden-17.html").replace("%player%", partyMember.getName()); - } - } - - if (dungeon.getReEnterTime() > System.currentTimeMillis()) - { - return "CastleWarden-18.html"; - } - - return null; - } - - protected String enterInstance(PlayerInstance player, String template, Location coords, CastleDungeon dungeon, String ret) - { - // Check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // Existing instance - if (world != null) - { - if (!(world instanceof CAUWorld)) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANCE_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON)); - return ""; - } - teleportPlayer(player, coords, world.getInstanceId()); - return ""; - } - // New instance - if (ret != null) - { - return ret; - } - - final Party party = player.getParty(); - world = new CAUWorld(); - final Instance instance = InstanceManager.getInstance().createDynamicInstance(dungeon.getInstanceId()); - world.setInstance(instance); - instance.setExitLoc(new Location(player)); - final int instanceId = world.getInstanceId(); - dungeon.setReEnterTime(System.currentTimeMillis() + REENTER_INTERVAL); - InstanceManager.getInstance().addWorld(world); - ThreadPool.schedule(new spawnNpcs((CAUWorld) world), INITIAL_SPAWN_DELAY); - if (DEBUG) - { - LOGGER.info("Castle HopeWithinTheDarkness started " + template + " Instance: " + instanceId + " created by player: " + player.getName()); - } - - // Teleport players - if (player.getParty() == null) - { - return "CastleWarden-09.html"; - } - for (PlayerInstance partyMember : party.getMembers()) - { - teleportPlayer(partyMember, coords, instanceId); - world.addAllowed(partyMember); - if (partyMember.getQuestState(getName()) == null) - { - newQuestState(partyMember); - } - - partyMember.getQuestState(getName()).setCond(2); - } - return getHtm(player, "CastleWarden-13.html").replace("%clan%", player.getClan().getName()); - } - - // Spawns npcs and bosses - private class spawnNpcs implements Runnable - { - private final CAUWorld _world; - - public spawnNpcs(CAUWorld world) - { - _world = world; - } - - @Override - public void run() - { - try - { - final Instance _instance = InstanceManager.getInstance().getInstance(_world.getInstanceId()); - - if (_world.getStatus() == 0) - { - _instance.spawnGroup("victims"); - _instance.spawnGroup("bosses_1"); - - ThreadPool.schedule(new spawnNpcs(_world), WAVE_SPAWN_DELAY); - ThreadPool.schedule(new spawnPrivates(_world), PRIVATE_SPAWN_DELAY); - } - else if (_world.getStatus() == 1) - { - _instance.spawnGroup("bosses_2"); - - ThreadPool.schedule(new spawnNpcs(_world), WAVE_SPAWN_DELAY); - ThreadPool.schedule(new spawnPrivates(_world), PRIVATE_SPAWN_DELAY); - } - else if (_world.getStatus() == 2) - { - _instance.spawnGroup("bosses_3"); - - ThreadPool.schedule(new spawnPrivates(_world), PRIVATE_SPAWN_DELAY); - } - } - catch (Exception e) - { - LOGGER.warning("Castle HopeWithinTheDarkness NPC Spawn error: " + e); - } - } - } - - // Spawns monsters (minions) - private class spawnPrivates implements Runnable - { - private final CAUWorld _world; - - public spawnPrivates(CAUWorld world) - { - _world = world; - } - - @Override - public void run() - { - try - { - final Instance _instance = InstanceManager.getInstance().getInstance(_world.getInstanceId()); - - if (_world.getStatus() == 0) - { - _instance.spawnGroup("monsters_first_wave"); - - _world.underAttack = true; - } - else if (_world.getStatus() == 1) - { - _instance.spawnGroup("monsters_second_wave"); - } - else if (_world.getStatus() == 2) - { - _instance.spawnGroup("monsters_third_wave"); - } - - _world.setStatus(_world.getStatus() + 1); - } - catch (Exception e) - { - LOGGER.warning("Castle HopeWithinTheDarkness Monster Spawn error: " + e); - } - } - } - - // Manages complete dungeon event - private class completeDungeon implements Runnable - { - private final CAUWorld _world; - private final PlayerInstance _player; - - public completeDungeon(CAUWorld world, PlayerInstance player) - { - _world = world; - _player = player; - } - - @Override - public void run() - { - try - { - if (_world.getStatus() == 4) - { - _world.underAttack = false; - - final Instance inst = InstanceManager.getInstance().getInstance(_world.getInstanceId()); - - for (Npc _npc : inst.getNpcs()) - { - - if ((_npc != null) && ((_npc.getId() >= NPC_KNIGHT) && (_npc.getId() <= NPC_WARRIOR))) - { - cancelQuestTimer("check_for_foes", _npc, null); - cancelQuestTimer("buff", _npc, null); - - if (_npc.getId() == NPC_KNIGHT) - { - _npc.broadcastPacket(new NpcSay(_npc.getObjectId(), ChatType.SHOUT, _npc.getId(), STRINGID_WIN)); - } - } - } - - if (_player != null) - { - final Party party = _player.getParty(); - - if (party == null) - { - rewardPlayer(_player); - } - else - { - for (PlayerInstance partyMember : party.getMembers()) - { - if ((partyMember != null) && (partyMember.getInstanceId() == _player.getInstanceId())) - { - rewardPlayer(partyMember); - } - } - } - } - } - } - catch (Exception e) - { - LOGGER.warning("Complete dungeon manage error: " + e); - } - } - } - - protected void rewardPlayer(PlayerInstance player) - { - final QuestState qs = player.getQuestState(getName()); - if ((qs != null) && (qs.isCond(2))) - { - qs.setCond(3); - } - } -} + static + { + NPC_BUFFS.put(NPC_KNIGHT, new SkillHolder(5970, 1)); + NPC_BUFFS.put(NPC_RANGER, new SkillHolder(5971, 1)); + NPC_BUFFS.put(NPC_MAGE, new SkillHolder(5972, 1)); + NPC_BUFFS.put(NPC_WARRIOR, new SkillHolder(5973, 1)); + } + private static final SkillHolder RAID_CURSE = new SkillHolder(5456, 1); + + // Strings + protected static final NpcStringId STRINGID_WIN = NpcStringId.YOU_VE_DONE_IT_WE_BELIEVED_IN_YOU_WARRIOR_WE_WANT_TO_SHOW_OUR_SINCERITY_THOUGH_IT_IS_SMALL_PLEASE_GIVE_ME_SOME_OF_YOUR_TIME; + private static final NpcStringId STRINGID_WELCOME = NpcStringId.WARRIORS_HAVE_YOU_COME_TO_HELP_THOSE_WHO_ARE_IMPRISONED_HERE; + private static final NpcStringId STRINGID_BOSS_DEATH = NpcStringId.HOW_DARE_YOU; + private static final NpcStringId[] STRINGID_INJURED = + { + NpcStringId.YOUR_MIND_IS_GOING_BLANK, + NpcStringId.UGH_IT_HURTS_DOWN_TO_THE_BONES + }; + private static final NpcStringId[] STRINGID_DIE = + { + NpcStringId.I_CAN_T_STAND_IT_ANYMORE_AAH, + NpcStringId.KYAAAK, + NpcStringId.GASP_HOW_CAN_THIS_BE + }; + private static final NpcStringId[] STRINGID_BOSS_SPAWN = + { + NpcStringId.I_LL_RIP_THE_FLESH_FROM_YOUR_BONES, + NpcStringId.YOU_LL_FLOUNDER_IN_DELUSION_FOR_THE_REST_OF_YOUR_LIFE, + NpcStringId.THERE_IS_NO_ESCAPE_FROM_THIS_PLACE + }; + + // Misc + private static final boolean DEBUG = false; + private static final int MIN_LVL = 80; + private static final boolean CHECK_FOR_CONTRACT = true; + private static final long REENTER_INTERVAL = 14400000; + private static final long INITIAL_SPAWN_DELAY = 120000; // Spawn NPCs and 1st Wave bosses (2 min) + private static final long WAVE_SPAWN_DELAY = 480000; // Spawn next wave's bosses (8 min) + private static final long PRIVATE_SPAWN_DELAY = 180000; // Spawn monsters (3 min after boss had been spawned) + private static final Location PLAYER_SPAWN_POINT = new Location(48163, -12195, -9140); + private final Map CASTLE_DUNGEONS = new HashMap<>(); + { + CASTLE_DUNGEONS.put(36403, new CastleDungeon(80, 36403)); + CASTLE_DUNGEONS.put(36404, new CastleDungeon(81, 36404)); + CASTLE_DUNGEONS.put(36405, new CastleDungeon(82, 36405)); + CASTLE_DUNGEONS.put(36406, new CastleDungeon(83, 36406)); + CASTLE_DUNGEONS.put(36407, new CastleDungeon(84, 36407)); + CASTLE_DUNGEONS.put(36408, new CastleDungeon(85, 36408)); + CASTLE_DUNGEONS.put(36409, new CastleDungeon(86, 36409)); + CASTLE_DUNGEONS.put(36410, new CastleDungeon(87, 36410)); + CASTLE_DUNGEONS.put(36411, new CastleDungeon(88, 36411)); + } + + public Q00727_HopeWithinTheDarkness() + { + super(727); + + for (int i : CASTLE_DUNGEONS.keySet()) + { + addStartNpc(i); + addTalkId(i); + } + + for (int i = NPC_KNIGHT; i <= NPC_WARRIOR; i++) + { + addSpawnId(i); + addKillId(i); + addAttackId(i); + addTalkId(i); + addFirstTalkId(i); + } + + for (int i : BOSSES) + { + addSpawnId(i); + addKillId(i); + addAttackId(i); + } + + for (int i : MONSTERS) + { + addKillId(i); + addAttackId(i); + } + + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final String htmltext = event; + if (event.equalsIgnoreCase("enter")) + { + return enterInstance(player, "CastlePailaka.xml", PLAYER_SPAWN_POINT, CASTLE_DUNGEONS.get(npc.getId()), checkEnterConditions(player, npc)); + } + else if (event.equalsIgnoreCase("suicide")) + { + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc); + tmpworld.setStatus(5); + final Instance inst = InstanceManager.getInstance().getInstance(npc.getInstanceId()); + if (inst != null) + { + for (Npc _npc : inst.getNpcs()) + { + if ((_npc != null) && ((_npc.getId() >= NPC_KNIGHT) && (_npc.getId() <= NPC_WARRIOR))) + { + cancelQuestTimer("check_for_foes", _npc, null); + cancelQuestTimer("buff", _npc, null); + + if (!_npc.isDead()) + { + _npc.doDie(null); + } + } + } + + // Destroy instance after 5 minutes + inst.setDuration(5 * 60000); + inst.setEmptyDestroyTime(0); + } + + return null; + } + else if (event.equalsIgnoreCase("buff")) + { + for (PlayerInstance pl : World.getInstance().getVisibleObjects(npc, PlayerInstance.class)) + { + if ((pl != null) && Util.checkIfInRange(75, npc, pl, false) && (NPC_BUFFS.get(npc.getId()) != null)) + { + npc.setTarget(pl); + npc.doCast(NPC_BUFFS.get(npc.getId()).getSkill()); + } + } + startQuestTimer("buff", 120000, npc, null); + return null; + } + else if (event.equalsIgnoreCase("check_for_foes")) + { + if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) + { + for (Creature foe : World.getInstance().getVisibleObjectsInRange(npc, Creature.class, npc.getAggroRange())) + { + if (foe.isAttackable() && !(foe instanceof QuestGuardInstance)) + { + ((QuestGuardInstance) npc).addDamageHate(foe, 0, 999); + ((QuestGuardInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, foe, null); + } + } + } + + startQuestTimer("check_for_foes", 5000, npc, null); + return null; + } + + QuestState qs = player.getQuestState(getName()); + if (qs == null) + { + qs = newQuestState(player); + } + + final int cond = qs.getCond(); + if (event.equalsIgnoreCase("CastleWarden-05.htm")) + { + if (cond == 0) + { + qs.startQuest(); + } + } + else if (event.equalsIgnoreCase("CastleWarden-15.htm")) + { + qs.exitQuest(true, true); + } + return htmltext; + } + + @Override + public String onFirstTalk(Npc npc, PlayerInstance player) + { + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player); + if (tmpworld instanceof CAUWorld) + { + final CAUWorld world = (CAUWorld) tmpworld; + + if (world.underAttack) + { + return "Victim-02.html"; + } + else if (world.getStatus() == 4) + { + return "Victim-03.html"; + } + else + { + return "Victim-01.html"; + } + } + + return null; + } + + @Override + public String onTalk(Npc npc, PlayerInstance player) + { + String htmltext = Quest.getNoQuestMsg(player); + final QuestState qs = getQuestState(player, true); + + if ((npc.getId() >= NPC_KNIGHT) && (npc.getId() <= NPC_WARRIOR)) + { + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player); + if ((tmpworld != null) && (tmpworld instanceof CAUWorld)) + { + final CAUWorld world = (CAUWorld) tmpworld; + + world.removeAllowed(player); + final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); + + final Location loc = inst.getExitLoc(); + teleportPlayer(player, loc, 0); + return null; + } + } + + if ((player.getClan() == null) || (npc.getCastle() == null) || (player.getClan().getCastleId() != npc.getCastle().getResidenceId())) + { + return "CastleWarden-03.html"; + } + else if (qs != null) + { + final int npcId = npc.getId(); + int cond = 0; + if (qs.isCreated()) + { + qs.setCond(0); + } + else + { + cond = qs.getCond(); + } + if (CASTLE_DUNGEONS.containsKey(npcId) && (cond == 0)) + { + if (player.getLevel() >= 80) + { + htmltext = "CastleWarden-01.htm"; + } + else + { + htmltext = "CastleWarden-04.html"; + qs.exitQuest(true); + } + } + else if (CASTLE_DUNGEONS.containsKey(npcId) && (cond > 0) && (qs.isStarted())) + { + if (cond == 1) + { + htmltext = "CastleWarden-15.htm"; + } + else if (cond == 3) + { + rewardItems(player, KNIGHT_EPALUETTE, 159); + qs.exitQuest(true, true); + htmltext = "CastleWarden-16.html"; + } + } + } + return htmltext; + } + + @Override + public String onAttack(Npc npc, PlayerInstance player, int damage, boolean isSummon) + { + if ((npc.getId() >= NPC_KNIGHT) && (npc.getId() <= NPC_WARRIOR)) + { + if (npc.getCurrentHp() <= (npc.getMaxHp() * 0.1)) + { + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_INJURED[1])); + } + else if (npc.getCurrentHp() <= (npc.getMaxHp() * 0.4)) + { + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_INJURED[0])); + } + + return null; + } + + if (player != null) + { + final Playable attacker = (isSummon ? player.getSummon() : player); + if ((attacker.getLevel() - npc.getLevel()) >= 9) + { + if ((attacker.getBuffCount() > 0) || (attacker.getDanceCount() > 0)) + { + npc.setTarget(attacker); + npc.doSimultaneousCast(RAID_CURSE.getSkill()); + } + else if (player.getParty() != null) + { + for (PlayerInstance pmember : player.getParty().getMembers()) + { + if ((pmember.getBuffCount() > 0) || (pmember.getDanceCount() > 0)) + { + npc.setTarget(pmember); + npc.doSimultaneousCast(RAID_CURSE.getSkill()); + } + } + } + } + } + return super.onAttack(npc, player, damage, isSummon); + } + + @Override + public String onKill(Npc npc, PlayerInstance player, boolean isSummon) + { + if ((npc.getId() >= NPC_KNIGHT) && (npc.getId() <= NPC_WARRIOR)) + { + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_DIE[npc.getId() - 36562])); + + // All other friendly NPCs do suicide - start timer + startQuestTimer("suicide", 1500, npc, null); + cancelQuestTimer("check_for_foes", npc, null); + cancelQuestTimer("buff", npc, null); + return null; + } + + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc); + if (tmpworld instanceof CAUWorld) + { + final CAUWorld world = (CAUWorld) tmpworld; + if (CommonUtil.contains(BOSSES, npc.getId())) + { + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_BOSS_DEATH)); + } + + if ((tmpworld.getStatus() == 3) && (CommonUtil.contains(BOSSES, npc.getId()) || CommonUtil.contains(MONSTERS, npc.getId()))) + { + world.allMonstersDead = true; + final Instance inst = InstanceManager.getInstance().getInstance(tmpworld.getInstanceId()); + + if (inst != null) + { + for (Npc _npc : inst.getNpcs()) + { + if ((_npc != null) && !_npc.isDead() && (CommonUtil.contains(BOSSES, _npc.getId()) || CommonUtil.contains(MONSTERS, _npc.getId()))) + { + world.allMonstersDead = false; + break; + } + + } + + if (world.allMonstersDead) + { + tmpworld.setStatus(4); + + // Destroy instance after 5 minutes + inst.setDuration(5 * 60000); + inst.setEmptyDestroyTime(0); + ThreadPool.schedule(new completeDungeon(world, player), 1500); + } + } + } + } + + return null; + } + + @Override + public final String onSpawn(Npc npc) + { + // Buff players every two minutes, check for foes in aggro range + if ((npc.getId() >= NPC_KNIGHT) && (npc.getId() <= NPC_WARRIOR)) + { + startQuestTimer("buff", 120000, npc, null); + startQuestTimer("check_for_foes", 120000, npc, null); + + if (npc.getId() == NPC_KNIGHT) + { + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_WELCOME)); + } + } + else if (Arrays.binarySearch(BOSSES, npc.getId()) >= 0) + { + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), STRINGID_BOSS_SPAWN[Arrays.binarySearch(BOSSES, npc.getId())])); + } + + return null; + } + + private String checkEnterConditions(PlayerInstance player, Npc npc) + { + if (DEBUG) + { + return null; + } + + final Castle castle = npc.getCastle(); + final CastleDungeon dungeon = CASTLE_DUNGEONS.get(npc.getId()); + boolean haveContract = false; + + if ((player == null) || (castle == null) || (dungeon == null)) + { + return "CastleWarden-03.html"; + } + + // Check if castle have contract with fortress + if (CHECK_FOR_CONTRACT) + { + for (Fort fort : FortManager.getInstance().getForts()) + { + if (fort.getContractedCastleId() == castle.getResidenceId()) + { + haveContract = true; + break; + } + } + + if (!haveContract) + { + return "CastleWarden-13a.html"; + } + } + + QuestState qs = player.getQuestState(getName()); + + // Check if player has quest + if ((qs == null) || qs.isCreated()) + { + // Check if player is from clan, that owns castle + if ((player.getClan() == null) || (player.getClan().getCastleId() != castle.getResidenceId())) + { + return "CastleWarden-08.html"; + } + + if (player.getLevel() >= MIN_LVL) + { + return "CastleWarden-06.htm"; + } + + return "CastleWarden-07.html"; + } + + final Party party = player.getParty(); + + if (party == null) + { + return "CastleWarden-09.html"; + } + + if (party.getLeader() != player) + { + return getHtm(player, "CastleWarden-10.html").replace("%leader%", party.getLeader().getName()); + } + + for (PlayerInstance partyMember : party.getMembers()) + { + qs = partyMember.getQuestState(getName()); + + // Check if each party member has quest + if ((qs == null) || qs.isCreated()) + { + return getHtm(player, "CastleWarden-12.html").replace("%player%", partyMember.getName()); + } + + if ((player.getClan() == null) || (player.getClan().getCastleId() != castle.getResidenceId())) + { + return getHtm(player, "CastleWarden-11.html").replace("%player%", partyMember.getName()); + } + + // Check if each party member not very far from leader + if (!Util.checkIfInRange(1000, player, partyMember, true)) + { + return getHtm(player, "CastleWarden-17.html").replace("%player%", partyMember.getName()); + } + } + + if (dungeon.getReEnterTime() > System.currentTimeMillis()) + { + return "CastleWarden-18.html"; + } + + return null; + } + + protected String enterInstance(PlayerInstance player, String template, Location coords, CastleDungeon dungeon, String ret) + { + // Check for existing instances for this player + InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); + // Existing instance + if (world != null) + { + if (!(world instanceof CAUWorld)) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANCE_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON)); + return ""; + } + teleportPlayer(player, coords, world.getInstanceId()); + return ""; + } + // New instance + if (ret != null) + { + return ret; + } + + final Party party = player.getParty(); + world = new CAUWorld(); + final Instance instance = InstanceManager.getInstance().createDynamicInstance(dungeon.getInstanceId()); + world.setInstance(instance); + instance.setExitLoc(new Location(player)); + final int instanceId = world.getInstanceId(); + dungeon.setReEnterTime(System.currentTimeMillis() + REENTER_INTERVAL); + InstanceManager.getInstance().addWorld(world); + ThreadPool.schedule(new spawnNpcs((CAUWorld) world), INITIAL_SPAWN_DELAY); + if (DEBUG) + { + LOGGER.info("Castle HopeWithinTheDarkness started " + template + " Instance: " + instanceId + " created by player: " + player.getName()); + } + + // Teleport players + if (player.getParty() == null) + { + return "CastleWarden-09.html"; + } + for (PlayerInstance partyMember : party.getMembers()) + { + teleportPlayer(partyMember, coords, instanceId); + world.addAllowed(partyMember); + if (partyMember.getQuestState(getName()) == null) + { + newQuestState(partyMember); + } + + partyMember.getQuestState(getName()).setCond(2); + } + return getHtm(player, "CastleWarden-13.html").replace("%clan%", player.getClan().getName()); + } + + // Spawns npcs and bosses + private class spawnNpcs implements Runnable + { + private final CAUWorld _world; + + public spawnNpcs(CAUWorld world) + { + _world = world; + } + + @Override + public void run() + { + try + { + final Instance _instance = InstanceManager.getInstance().getInstance(_world.getInstanceId()); + + if (_world.getStatus() == 0) + { + _instance.spawnGroup("victims"); + _instance.spawnGroup("bosses_1"); + + ThreadPool.schedule(new spawnNpcs(_world), WAVE_SPAWN_DELAY); + ThreadPool.schedule(new spawnPrivates(_world), PRIVATE_SPAWN_DELAY); + } + else if (_world.getStatus() == 1) + { + _instance.spawnGroup("bosses_2"); + + ThreadPool.schedule(new spawnNpcs(_world), WAVE_SPAWN_DELAY); + ThreadPool.schedule(new spawnPrivates(_world), PRIVATE_SPAWN_DELAY); + } + else if (_world.getStatus() == 2) + { + _instance.spawnGroup("bosses_3"); + + ThreadPool.schedule(new spawnPrivates(_world), PRIVATE_SPAWN_DELAY); + } + } + catch (Exception e) + { + LOGGER.warning("Castle HopeWithinTheDarkness NPC Spawn error: " + e); + } + } + } + + // Spawns monsters (minions) + private class spawnPrivates implements Runnable + { + private final CAUWorld _world; + + public spawnPrivates(CAUWorld world) + { + _world = world; + } + + @Override + public void run() + { + try + { + final Instance _instance = InstanceManager.getInstance().getInstance(_world.getInstanceId()); + + if (_world.getStatus() == 0) + { + _instance.spawnGroup("monsters_first_wave"); + + _world.underAttack = true; + } + else if (_world.getStatus() == 1) + { + _instance.spawnGroup("monsters_second_wave"); + } + else if (_world.getStatus() == 2) + { + _instance.spawnGroup("monsters_third_wave"); + } + + _world.setStatus(_world.getStatus() + 1); + } + catch (Exception e) + { + LOGGER.warning("Castle HopeWithinTheDarkness Monster Spawn error: " + e); + } + } + } + + // Manages complete dungeon event + private class completeDungeon implements Runnable + { + private final CAUWorld _world; + private final PlayerInstance _player; + + public completeDungeon(CAUWorld world, PlayerInstance player) + { + _world = world; + _player = player; + } + + @Override + public void run() + { + try + { + if (_world.getStatus() == 4) + { + _world.underAttack = false; + + final Instance inst = InstanceManager.getInstance().getInstance(_world.getInstanceId()); + + for (Npc _npc : inst.getNpcs()) + { + + if ((_npc != null) && ((_npc.getId() >= NPC_KNIGHT) && (_npc.getId() <= NPC_WARRIOR))) + { + cancelQuestTimer("check_for_foes", _npc, null); + cancelQuestTimer("buff", _npc, null); + + if (_npc.getId() == NPC_KNIGHT) + { + _npc.broadcastPacket(new NpcSay(_npc.getObjectId(), ChatType.SHOUT, _npc.getId(), STRINGID_WIN)); + } + } + } + + if (_player != null) + { + final Party party = _player.getParty(); + + if (party == null) + { + rewardPlayer(_player); + } + else + { + for (PlayerInstance partyMember : party.getMembers()) + { + if ((partyMember != null) && (partyMember.getInstanceId() == _player.getInstanceId())) + { + rewardPlayer(partyMember); + } + } + } + } + } + } + catch (Exception e) + { + LOGGER.warning("Complete dungeon manage error: " + e); + } + } + } + + protected void rewardPlayer(PlayerInstance player) + { + final QuestState qs = player.getQuestState(getName()); + if ((qs != null) && (qs.isCond(2))) + { + qs.setCond(3); + } + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/crypt/LoginCrypt.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/crypt/LoginCrypt.java index 08b1757771..ee983c8388 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/crypt/LoginCrypt.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/util/crypt/LoginCrypt.java @@ -49,7 +49,6 @@ public class LoginCrypt implements ICrypt }; private static final BlowfishEngine STATIC_BLOWFISH_ENGINE = new BlowfishEngine(); - static { STATIC_BLOWFISH_ENGINE.init(STATIC_BLOWFISH_KEY); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java index bee3baf3e2..1a82e3607e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java @@ -69,6 +69,18 @@ public final class TerritoryWarManager implements Siegable private static final String DELETE = "DELETE FROM territory_registrations WHERE castleId = ? and registeredId = ?"; private static final String INSERT = "INSERT INTO territory_registrations (castleId, registeredId) values (?, ?)"; public static final Map TERRITORY_ITEM_IDS = new HashMap<>(); + static + { + TERRITORY_ITEM_IDS.put(81, 13757); + TERRITORY_ITEM_IDS.put(82, 13758); + TERRITORY_ITEM_IDS.put(83, 13759); + TERRITORY_ITEM_IDS.put(84, 13760); + TERRITORY_ITEM_IDS.put(85, 13761); + TERRITORY_ITEM_IDS.put(86, 13762); + TERRITORY_ITEM_IDS.put(87, 13763); + TERRITORY_ITEM_IDS.put(88, 13764); + TERRITORY_ITEM_IDS.put(89, 13765); + } public static String qn = "TerritoryWarSuperClass"; public static String GLOBAL_VARIABLE = "nextTWStartDate"; @@ -100,19 +112,6 @@ public final class TerritoryWarManager implements Siegable protected ScheduledFuture _scheduledEndTWTask = null; protected ScheduledFuture _scheduledRewardOnlineTask = null; - static - { - TERRITORY_ITEM_IDS.put(81, 13757); - TERRITORY_ITEM_IDS.put(82, 13758); - TERRITORY_ITEM_IDS.put(83, 13759); - TERRITORY_ITEM_IDS.put(84, 13760); - TERRITORY_ITEM_IDS.put(85, 13761); - TERRITORY_ITEM_IDS.put(86, 13762); - TERRITORY_ITEM_IDS.put(87, 13763); - TERRITORY_ITEM_IDS.put(88, 13764); - TERRITORY_ITEM_IDS.put(89, 13765); - } - protected TerritoryWarManager() { load(); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/base/PlayerClass.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/base/PlayerClass.java index 604f2afefa..60f793ba19 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/base/PlayerClass.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/base/PlayerClass.java @@ -203,7 +203,6 @@ public enum PlayerClass private static final Set subclasseSet5 = EnumSet.of(Sorceror, Spellsinger, Spellhowler); private static final EnumMap> subclassSetMap = new EnumMap<>(PlayerClass.class); - static { final Set subclasses = getSet(null, THIRD); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExBasicActionList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExBasicActionList.java index 80c642fc92..0440a69f53 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExBasicActionList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExBasicActionList.java @@ -64,7 +64,6 @@ public final class ExBasicActionList implements IClientOutgoingPacket }; //@formatter:on public static final int[] DEFAULT_ACTION_LIST; - static { final int count1 = 74; // 0 <-> (count1 - 1) diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 64b38902b0..4484e3142e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java index 24060ff7c5..bc147562e2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java @@ -33,7 +33,8 @@ import ai.AbstractNpcAI; */ public class NpcLocationInfo extends AbstractNpcAI { - private static final List NPC = new ArrayList<>(); + private static final List NPC = new ArrayList<>(); + static { NPC.add(30598); NPC.add(30599); @@ -41,7 +42,8 @@ public class NpcLocationInfo extends AbstractNpcAI NPC.add(30601); NPC.add(30602); } - private static final List NPCRADAR = new ArrayList<>(); + private static final List NPCRADAR = new ArrayList<>(); + static { // Talking Island NPCRADAR.add(30006); // Gatekeeper Roxxy diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java index cb1a8eb04c..aed9ee56e9 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java @@ -1,452 +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 . - */ -package quests.Q00255_Tutorial; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.Config; -import com.l2jmobius.gameserver.enums.HtmlActionScope; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.events.EventType; -import com.l2jmobius.gameserver.model.events.ListenerRegisterType; -import com.l2jmobius.gameserver.model.events.annotations.Id; -import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; -import com.l2jmobius.gameserver.model.events.annotations.RegisterType; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark; -import com.l2jmobius.gameserver.model.holders.ItemHolder; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.quest.Quest; -import com.l2jmobius.gameserver.model.quest.QuestState; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; -import com.l2jmobius.gameserver.network.serverpackets.PlaySound; -import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml; -import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml; -import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark; - -/** - * Tutorial Quest - * @author Mobius - */ -public class Q00255_Tutorial extends Quest -{ - // NPCs - private static final List NEWBIE_HELPERS = new ArrayList<>(); - { - NEWBIE_HELPERS.add(30009); // human fighter - NEWBIE_HELPERS.add(30019); // human mystic - NEWBIE_HELPERS.add(30400); // elf - NEWBIE_HELPERS.add(30131); // dark elf - NEWBIE_HELPERS.add(30575); // orc - NEWBIE_HELPERS.add(30530); // dwarf - } - private static final List SUPERVISORS = new ArrayList<>(); - { - SUPERVISORS.add(30008); // human fighter - SUPERVISORS.add(30017); // human mystic - SUPERVISORS.add(30370); // elf - SUPERVISORS.add(30129); // dark elf - SUPERVISORS.add(30573); // orc - SUPERVISORS.add(30528); // dwarf - } - // Monsters - private static final int[] GREMLINS = - { - 18342, // this is used for now - 20001 - }; - // Items - private static final int BLUE_GEM = 6353; - private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200); - private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100); - // Others - private static final Map STARTING_VOICE_HTML = new HashMap<>(); - { - STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html")); - STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html")); - STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html")); - STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html")); - STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html")); - STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html")); - STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html")); - STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html")); - STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html")); - } - private static final Map HELPER_LOCATION = new HashMap<>(); - { - HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109)); - HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568)); - HELPER_LOCATION.put(18, new Location(46112, 41200, -3504)); - HELPER_LOCATION.put(25, new Location(46112, 41200, -3504)); - HELPER_LOCATION.put(31, new Location(28384, 11056, -4233)); - HELPER_LOCATION.put(38, new Location(28384, 11056, -4233)); - HELPER_LOCATION.put(44, new Location(-56736, -113680, -672)); - HELPER_LOCATION.put(49, new Location(-56736, -113680, -672)); - HELPER_LOCATION.put(53, new Location(108567, -173994, -406)); - } - private static final Map COMPLETE_LOCATION = new HashMap<>(); - { - COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723)); - COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723)); - COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060)); - COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060)); - COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582)); - COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582)); - COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192)); - COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192)); - COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905)); - } - private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial "; - private static final int QUESTION_MARK_ID_1 = 1; - private static final int QUESTION_MARK_ID_2 = 5; - private static final int QUESTION_MARK_ID_3 = 28; - - public Q00255_Tutorial() - { - super(255); - addTalkId(NEWBIE_HELPERS); - addTalkId(SUPERVISORS); - addFirstTalkId(NEWBIE_HELPERS); - addFirstTalkId(SUPERVISORS); - addKillId(GREMLINS); - registerQuestItems(BLUE_GEM); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs == null) - { - return null; - } - - String htmltext = null; - switch (event) - { - case "start_newbie_tutorial": - { - if (qs.getMemoState() < 4) - { - qs.startQuest(); - qs.setMemoState(1); - playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound()); - showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml()); - } - break; - } - case "tutorial_02.html": - case "tutorial_03.html": - { - if (qs.isMemoState(1)) - { - showTutorialHtml(player, event); - } - break; - } - case "question_mark_1": - { - if (qs.isMemoState(1)) - { - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0)); - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - } - break; - } - case "reward_2": - { - if (qs.isMemoState(4)) - { - qs.setMemoState(5); - if (player.isMageClass() && (player.getRace() != Race.ORC)) - { - giveItems(player, SPIRITSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_027"); - } - else - { - giveItems(player, SOULSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_026"); - } - htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html"; - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0)); - } - break; - } - case "close_tutorial": - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - break; - } - } - return htmltext; - } - - @Override - public String onFirstTalk(Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs != null) - { - // start newbie helpers - if (NEWBIE_HELPERS.contains(npc.getId())) - { - if (hasQuestItems(player, BLUE_GEM)) - { - qs.setMemoState(3); - } - switch (qs.getMemoState()) - { - case 0: - case 1: - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - qs.setMemoState(2); - if (!player.isMageClass()) - { - return "tutorial_05_fighter.html"; - } - else if (player.getRace() == Race.ORC) - { - return "tutorial_05_mystic_orc.html"; - } - return "tutorial_05_mystic.html"; - } - case 2: - { - if (!player.isMageClass()) - { - return "tutorial_05_fighter_back.html"; - } - else if (player.getRace() == Race.ORC) - { - return "tutorial_05_mystic_orc_back.html"; - } - return "tutorial_05_mystic_back.html"; - } - case 3: - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - qs.setMemoState(4); - takeItems(player, BLUE_GEM, -1); - if (player.isMageClass() && (player.getRace() != Race.ORC)) - { - giveItems(player, SPIRITSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_027"); - return npc.getId() + "-3.html"; - } - giveItems(player, SOULSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_026"); - return npc.getId() + "-2.html"; - } - case 4: - { - return npc.getId() + "-4.html"; - } - case 5: - case 6: - { - return npc.getId() + "-5.html"; - } - } - } - // else supervisors - switch (qs.getMemoState()) - { - case 0: - case 1: - case 2: - case 3: - { - return npc.getId() + "-1.html"; - } - case 4: - { - return npc.getId() + "-2.html"; - } - case 5: - case 6: - { - return npc.getId() + "-4.html"; - } - } - } - return npc.getId() + "-1.html"; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30)) - { - // check for too many gems on ground - int counter = 0; - for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500)) - { - if (item.getId() == BLUE_GEM) - { - counter++; - } - } - if (counter < 10) // do not drop if more than 10 - { - npc.dropItem(killer, BLUE_GEM, 1); - } - } - return super.onKill(npc, killer, isSummon); - } - - @RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP) - @RegisterType(ListenerRegisterType.ITEM) - @Id(BLUE_GEM) - public void OnPlayerItemPickup(OnPlayerItemPickup event) - { - final PlayerInstance player = event.getPlayer(); - final QuestState qs = getQuestState(player, false); - if ((qs != null) && (qs.getMemoState() < 3)) - { - qs.setMemoState(3); - playSound(player, "ItemSound.quest_tutorial"); - playTutorialVoice(player, "tutorial_voice_013"); - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0)); - } - } - - @RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event) - { - final QuestState qs = getQuestState(event.getPlayer(), false); - if (qs != null) - { - switch (event.getMarkId()) - { - case QUESTION_MARK_ID_1: - { - if (qs.isMemoState(1)) - { - showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000); - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); - showTutorialHtml(event.getPlayer(), "tutorial_04.html"); - } - break; - } - case QUESTION_MARK_ID_2: - { - if (qs.isMemoState(3)) - { - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); - showTutorialHtml(event.getPlayer(), "tutorial_06.html"); - } - break; - } - case QUESTION_MARK_ID_3: - { - if (qs.isMemoState(5)) - { - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ()); - playSound(event.getPlayer(), "ItemSound.quest_tutorial"); - } - break; - } - } - } - } - - @RegisterEvent(EventType.ON_PLAYER_BYPASS) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void OnPlayerBypass(OnPlayerBypass event) - { - final PlayerInstance player = event.getPlayer(); - if (event.getCommand().startsWith(TUTORIAL_BUYPASS)) - { - notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player); - } - } - - @RegisterEvent(EventType.ON_PLAYER_LOGIN) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void OnPlayerLogin(OnPlayerLogin event) - { - if (Config.DISABLE_TUTORIAL) - { - return; - } - - final PlayerInstance player = event.getPlayer(); - if (player.getLevel() > 6) - { - return; - } - - QuestState qs = getQuestState(player, true); - if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId())) - { - startQuestTimer("start_newbie_tutorial", 5000, null, player); - } - } - - private void showTutorialHtml(PlayerInstance player, String html) - { - player.sendPacket(new TutorialShowHtml(getHtm(player, html))); - } - - public void playTutorialVoice(PlayerInstance player, String voice) - { - player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ())); - } - - private class QuestSoundHtmlHolder - { - private final String _sound; - private final String _html; - - QuestSoundHtmlHolder(String sound, String html) - { - _sound = sound; - _html = html; - } - - String getSound() - { - return _sound; - } - - String getHtml() - { - return _html; - } - } -} +/* + * 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 . + */ +package quests.Q00255_Tutorial; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.Config; +import com.l2jmobius.gameserver.enums.HtmlActionScope; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.events.EventType; +import com.l2jmobius.gameserver.model.events.ListenerRegisterType; +import com.l2jmobius.gameserver.model.events.annotations.Id; +import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; +import com.l2jmobius.gameserver.model.events.annotations.RegisterType; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark; +import com.l2jmobius.gameserver.model.holders.ItemHolder; +import com.l2jmobius.gameserver.model.holders.QuestSoundHtmlHolder; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; +import com.l2jmobius.gameserver.network.serverpackets.PlaySound; +import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml; +import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml; +import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark; + +/** + * Tutorial Quest + * @author Mobius + */ +public class Q00255_Tutorial extends Quest +{ + // NPCs + private static final List NEWBIE_HELPERS = new ArrayList<>(); + static + { + NEWBIE_HELPERS.add(30009); // human fighter + NEWBIE_HELPERS.add(30019); // human mystic + NEWBIE_HELPERS.add(30400); // elf + NEWBIE_HELPERS.add(30131); // dark elf + NEWBIE_HELPERS.add(30575); // orc + NEWBIE_HELPERS.add(30530); // dwarf + } + private static final List SUPERVISORS = new ArrayList<>(); + static + { + SUPERVISORS.add(30008); // human fighter + SUPERVISORS.add(30017); // human mystic + SUPERVISORS.add(30370); // elf + SUPERVISORS.add(30129); // dark elf + SUPERVISORS.add(30573); // orc + SUPERVISORS.add(30528); // dwarf + } + // Monsters + private static final int[] GREMLINS = + { + 18342, // this is used for now + 20001 + }; + // Items + private static final int BLUE_GEM = 6353; + private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200); + private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100); + // Others + private static final Map STARTING_VOICE_HTML = new HashMap<>(); + static + { + STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html")); + STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html")); + STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html")); + STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html")); + STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html")); + STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html")); + STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html")); + STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html")); + STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html")); + } + private static final Map HELPER_LOCATION = new HashMap<>(); + static + { + HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109)); + HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568)); + HELPER_LOCATION.put(18, new Location(46112, 41200, -3504)); + HELPER_LOCATION.put(25, new Location(46112, 41200, -3504)); + HELPER_LOCATION.put(31, new Location(28384, 11056, -4233)); + HELPER_LOCATION.put(38, new Location(28384, 11056, -4233)); + HELPER_LOCATION.put(44, new Location(-56736, -113680, -672)); + HELPER_LOCATION.put(49, new Location(-56736, -113680, -672)); + HELPER_LOCATION.put(53, new Location(108567, -173994, -406)); + } + private static final Map COMPLETE_LOCATION = new HashMap<>(); + static + { + COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723)); + COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723)); + COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060)); + COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060)); + COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582)); + COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582)); + COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192)); + COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192)); + COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905)); + } + private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial "; + private static final int QUESTION_MARK_ID_1 = 1; + private static final int QUESTION_MARK_ID_2 = 5; + private static final int QUESTION_MARK_ID_3 = 28; + + public Q00255_Tutorial() + { + super(255); + addTalkId(NEWBIE_HELPERS); + addTalkId(SUPERVISORS); + addFirstTalkId(NEWBIE_HELPERS); + addFirstTalkId(SUPERVISORS); + addKillId(GREMLINS); + registerQuestItems(BLUE_GEM); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return null; + } + + String htmltext = null; + switch (event) + { + case "start_newbie_tutorial": + { + if (qs.getMemoState() < 4) + { + qs.startQuest(); + qs.setMemoState(1); + playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound()); + showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml()); + } + break; + } + case "tutorial_02.html": + case "tutorial_03.html": + { + if (qs.isMemoState(1)) + { + showTutorialHtml(player, event); + } + break; + } + case "question_mark_1": + { + if (qs.isMemoState(1)) + { + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0)); + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + } + break; + } + case "reward_2": + { + if (qs.isMemoState(4)) + { + qs.setMemoState(5); + if (player.isMageClass() && (player.getRace() != Race.ORC)) + { + giveItems(player, SPIRITSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_027"); + } + else + { + giveItems(player, SOULSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_026"); + } + htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html"; + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0)); + } + break; + } + case "close_tutorial": + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + break; + } + } + return htmltext; + } + + @Override + public String onFirstTalk(Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs != null) + { + // start newbie helpers + if (NEWBIE_HELPERS.contains(npc.getId())) + { + if (hasQuestItems(player, BLUE_GEM)) + { + qs.setMemoState(3); + } + switch (qs.getMemoState()) + { + case 0: + case 1: + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + qs.setMemoState(2); + if (!player.isMageClass()) + { + return "tutorial_05_fighter.html"; + } + else if (player.getRace() == Race.ORC) + { + return "tutorial_05_mystic_orc.html"; + } + return "tutorial_05_mystic.html"; + } + case 2: + { + if (!player.isMageClass()) + { + return "tutorial_05_fighter_back.html"; + } + else if (player.getRace() == Race.ORC) + { + return "tutorial_05_mystic_orc_back.html"; + } + return "tutorial_05_mystic_back.html"; + } + case 3: + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + qs.setMemoState(4); + takeItems(player, BLUE_GEM, -1); + if (player.isMageClass() && (player.getRace() != Race.ORC)) + { + giveItems(player, SPIRITSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_027"); + return npc.getId() + "-3.html"; + } + giveItems(player, SOULSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_026"); + return npc.getId() + "-2.html"; + } + case 4: + { + return npc.getId() + "-4.html"; + } + case 5: + case 6: + { + return npc.getId() + "-5.html"; + } + } + } + // else supervisors + switch (qs.getMemoState()) + { + case 0: + case 1: + case 2: + case 3: + { + return npc.getId() + "-1.html"; + } + case 4: + { + return npc.getId() + "-2.html"; + } + case 5: + case 6: + { + return npc.getId() + "-4.html"; + } + } + } + return npc.getId() + "-1.html"; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getQuestState(killer, false); + if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30)) + { + // check for too many gems on ground + int counter = 0; + for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500)) + { + if (item.getId() == BLUE_GEM) + { + counter++; + } + } + if (counter < 10) // do not drop if more than 10 + { + npc.dropItem(killer, BLUE_GEM, 1); + } + } + return super.onKill(npc, killer, isSummon); + } + + @RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP) + @RegisterType(ListenerRegisterType.ITEM) + @Id(BLUE_GEM) + public void OnPlayerItemPickup(OnPlayerItemPickup event) + { + final PlayerInstance player = event.getPlayer(); + final QuestState qs = getQuestState(player, false); + if ((qs != null) && (qs.getMemoState() < 3)) + { + qs.setMemoState(3); + playSound(player, "ItemSound.quest_tutorial"); + playTutorialVoice(player, "tutorial_voice_013"); + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0)); + } + } + + @RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event) + { + final QuestState qs = getQuestState(event.getPlayer(), false); + if (qs != null) + { + switch (event.getMarkId()) + { + case QUESTION_MARK_ID_1: + { + if (qs.isMemoState(1)) + { + showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000); + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); + showTutorialHtml(event.getPlayer(), "tutorial_04.html"); + } + break; + } + case QUESTION_MARK_ID_2: + { + if (qs.isMemoState(3)) + { + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); + showTutorialHtml(event.getPlayer(), "tutorial_06.html"); + } + break; + } + case QUESTION_MARK_ID_3: + { + if (qs.isMemoState(5)) + { + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ()); + playSound(event.getPlayer(), "ItemSound.quest_tutorial"); + } + break; + } + } + } + } + + @RegisterEvent(EventType.ON_PLAYER_BYPASS) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void OnPlayerBypass(OnPlayerBypass event) + { + final PlayerInstance player = event.getPlayer(); + if (event.getCommand().startsWith(TUTORIAL_BUYPASS)) + { + notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player); + } + } + + @RegisterEvent(EventType.ON_PLAYER_LOGIN) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void OnPlayerLogin(OnPlayerLogin event) + { + if (Config.DISABLE_TUTORIAL) + { + return; + } + + final PlayerInstance player = event.getPlayer(); + if (player.getLevel() > 6) + { + return; + } + + QuestState qs = getQuestState(player, true); + if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId())) + { + startQuestTimer("start_newbie_tutorial", 5000, null, player); + } + } + + private void showTutorialHtml(PlayerInstance player, String html) + { + player.sendPacket(new TutorialShowHtml(getHtm(player, html))); + } + + public void playTutorialVoice(PlayerInstance player, String voice) + { + player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ())); + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java index ba4b7c68a1..c353643195 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java @@ -64,7 +64,6 @@ public final class Q00257_TheGuardIsBusy extends Quest private static final int ORC_AMULET = 752; private static final int ORC_NECKLACE = 1085; private static final int WEREWOLF_FANG = 1086; - static { MONSTERS.put(20006, Arrays.asList(new MobDrop(10, 2, ORC_AMULET, 2), new MobDrop(10, 10, ORC_AMULET, 1))); // Orc Archer diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java index dba6bc1a20..8ba5fa8a7e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java @@ -54,7 +54,6 @@ public final class Q00276_TotemOfTheHestui extends Quest // Misc private static final List SPAWN_CHANCES = new ArrayList<>(); private static final int MIN_LVL = 15; - static { SPAWN_CHANCES.add(new ItemHolder(79, 100)); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java index cb7f9107c3..2de9d8c594 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java @@ -78,7 +78,6 @@ public final class Q00327_RecoverTheFarmland extends Quest new ItemHolder(ANCIENT_BRONZE_MIRROR, 3227), new ItemHolder(ANCIENT_JADE_NECKLACE, 3919) }; - static { FRAGMENTS_REWARD_DATA.put("30034-03.html", new ItemHolder(CLAY_URN_FRAGMENT, 307)); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 205193f1cf..a7c0af9e20 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -1,378 +1,379 @@ -/* - * 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 . - */ -package quests.Q00344_1000YearsTheEndOfLamentation; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -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; - -/** - * 1000 years, the End of Lamentation (344) - * @author Pandragon - */ -public final class Q00344_1000YearsTheEndOfLamentation extends Quest -{ - // NPCs - private static final int KAIEN = 30623; - private static final int GARVARENTZ = 30704; - private static final int GILMORE = 30754; - private static final int RODEMAI = 30756; - private static final int ORVEN = 30857; - // Items - private static final int ARTICLES = 4269; - private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); - private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); - private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); - private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); - // Monsters +/* + * 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 . + */ +package quests.Q00344_1000YearsTheEndOfLamentation; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +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; + +/** + * 1000 years, the End of Lamentation (344) + * @author Pandragon + */ +public final class Q00344_1000YearsTheEndOfLamentation extends Quest +{ + // NPCs + private static final int KAIEN = 30623; + private static final int GARVARENTZ = 30704; + private static final int GILMORE = 30754; + private static final int RODEMAI = 30756; + private static final int ORVEN = 30857; + // Items + private static final int ARTICLES = 4269; + private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); + private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); + private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); + private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); + // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - { - MONSTER_CHANCES.put(20236, 0.58); // Cave Servant - MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant - MONSTER_CHANCES.put(20272, 0.58); // Cave Servant - MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant - } - // Rewards - private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); - private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); - private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); - private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); - private static final ItemHolder COKES = new ItemHolder(1879, 55); - private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); - private static final ItemHolder LEATHER = new ItemHolder(1882, 70); - private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); - private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); - private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); - private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); - private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); - // Misc - private static final int MIN_LVL = 48; - - public Q00344_1000YearsTheEndOfLamentation() - { - super(344); - addStartNpc(GILMORE); - addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); - addKillId(MONSTER_CHANCES.keySet()); - registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs == null) - { - return htmltext; - } - - switch (event) - { - case "30754-03.htm": - case "30754-16.html": - { - htmltext = event; - break; - } - case "30754-04.htm": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "30754-08.html": - { - if (qs.isCond(1)) - { - final long count = getQuestItemsCount(player, ARTICLES); - if (count < 1) - { - htmltext = "30754-07.html"; - } - else - { - takeItems(player, ARTICLES, -1); - if (getRandom(1000) >= count) - { - giveAdena(player, count * 60, true); - htmltext = event; - } - else - { - qs.setCond(2, true); - switch (getRandom(4)) - { - case 0: - { - qs.setMemoState(1); - giveItems(player, OLD_HILT); - break; - } - case 1: - { - qs.setMemoState(2); - giveItems(player, OLD_KEY); - break; - } - case 2: - { - qs.setMemoState(3); - giveItems(player, TOTEM_NECKLACE); - break; - } - case 3: - { - qs.setMemoState(4); - giveItems(player, CRUCIFIX); - break; - } - } - htmltext = "30754-09.html"; - } - } - } - break; - } - case "30754-17.html": - { - if (qs.isCond(1)) - { - htmltext = event; - qs.exitQuest(true, true); - } - break; - } - case "relic_info": - { - switch (qs.getMemoState()) - { - case 1: - { - htmltext = "30754-10.html"; - break; - } - case 2: - { - htmltext = "30754-11.html"; - break; - } - case 3: - { - htmltext = "30754-12.html"; - break; - } - case 4: - { - htmltext = "30754-13.html"; - break; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance talker) - { - final QuestState qs = getQuestState(talker, true); - String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GILMORE: - { - if (qs.isCreated()) - { - htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { - htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; - } - else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) - { - htmltext = "30754-14.html"; - } - else - { - qs.setCond(1); - htmltext = "30754-15.html"; - } - } - else - { - htmltext = getAlreadyCompletedMsg(talker); - } - break; - } - case KAIEN: - { - if (qs.getMemoState() == 1) - { - if (hasItem(talker, OLD_HILT)) - { - takeItems(talker, OLD_HILT.getId(), -1); - final int rand = getRandom(100); - if (rand <= 52) - { - rewardItems(talker, ORIHARUKON_ORE); - } - else if (rand <= 76) - { - rewardItems(talker, VARNISH_OF_PURITY); - } - else if (rand <= 98) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RAID_SWORD); - } - qs.setCond(1); - htmltext = "30623-01.html"; - } - else - { - htmltext = "30623-02.html"; - } - } - break; - } - case RODEMAI: - { - if (qs.getMemoState() == 2) - { - if (hasItem(talker, OLD_KEY)) - { - takeItems(talker, OLD_KEY.getId(), -1); - final int rand = getRandom(100); - if (rand <= 39) - { - rewardItems(talker, COKES); - } - else if (rand <= 89) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RING_OF_AGES); - } - qs.setCond(1); - htmltext = "30756-01.html"; - } - else - { - htmltext = "30756-02.html"; - } - } - break; - } - case GARVARENTZ: - { - if (qs.getMemoState() == 3) - { - if (hasItem(talker, TOTEM_NECKLACE)) - { - takeItems(talker, TOTEM_NECKLACE.getId(), -1); - final int rand = getRandom(100); - if (rand <= 47) - { - rewardItems(talker, LEATHER); - } - else if (rand <= 97) - { - rewardItems(talker, COARSE_BONE_POWDER); - } - else - { - rewardItems(talker, HEAVY_DOOM_HAMMER); - } - qs.setCond(1); - htmltext = "30704-01.html"; - } - else - { - htmltext = "30704-02.html"; - } - } - break; - } - case ORVEN: - { - if (qs.getMemoState() == 4) - { - if (hasItem(talker, CRUCIFIX)) - { - takeItems(talker, CRUCIFIX.getId(), -1); - final int rand = getRandom(100); - if (rand <= 49) - { - rewardItems(talker, STONE_OF_PURITY); - } - else if (rand <= 69) - { - rewardItems(talker, SCROLL_EAC); - } - else - { - rewardItems(talker, DRAKE_LEATHER_BOOTS); - } - qs.setCond(1); - htmltext = "30857-01.html"; - } - else - { - htmltext = "30857-02.html"; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { - giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MONSTER_CHANCES.put(20236, 0.58); // Cave Servant + MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant + MONSTER_CHANCES.put(20272, 0.58); // Cave Servant + MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant + } + // Rewards + private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); + private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); + private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); + private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); + private static final ItemHolder COKES = new ItemHolder(1879, 55); + private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); + private static final ItemHolder LEATHER = new ItemHolder(1882, 70); + private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); + private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); + private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); + private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); + private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); + // Misc + private static final int MIN_LVL = 48; + + public Q00344_1000YearsTheEndOfLamentation() + { + super(344); + addStartNpc(GILMORE); + addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); + addKillId(MONSTER_CHANCES.keySet()); + registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs == null) + { + return htmltext; + } + + switch (event) + { + case "30754-03.htm": + case "30754-16.html": + { + htmltext = event; + break; + } + case "30754-04.htm": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "30754-08.html": + { + if (qs.isCond(1)) + { + final long count = getQuestItemsCount(player, ARTICLES); + if (count < 1) + { + htmltext = "30754-07.html"; + } + else + { + takeItems(player, ARTICLES, -1); + if (getRandom(1000) >= count) + { + giveAdena(player, count * 60, true); + htmltext = event; + } + else + { + qs.setCond(2, true); + switch (getRandom(4)) + { + case 0: + { + qs.setMemoState(1); + giveItems(player, OLD_HILT); + break; + } + case 1: + { + qs.setMemoState(2); + giveItems(player, OLD_KEY); + break; + } + case 2: + { + qs.setMemoState(3); + giveItems(player, TOTEM_NECKLACE); + break; + } + case 3: + { + qs.setMemoState(4); + giveItems(player, CRUCIFIX); + break; + } + } + htmltext = "30754-09.html"; + } + } + } + break; + } + case "30754-17.html": + { + if (qs.isCond(1)) + { + htmltext = event; + qs.exitQuest(true, true); + } + break; + } + case "relic_info": + { + switch (qs.getMemoState()) + { + case 1: + { + htmltext = "30754-10.html"; + break; + } + case 2: + { + htmltext = "30754-11.html"; + break; + } + case 3: + { + htmltext = "30754-12.html"; + break; + } + case 4: + { + htmltext = "30754-13.html"; + break; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance talker) + { + final QuestState qs = getQuestState(talker, true); + String htmltext = getNoQuestMsg(talker); + switch (npc.getId()) + { + case GILMORE: + { + if (qs.isCreated()) + { + htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; + } + else if (qs.isStarted()) + { + if (qs.isCond(1)) + { + htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; + } + else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) + { + htmltext = "30754-14.html"; + } + else + { + qs.setCond(1); + htmltext = "30754-15.html"; + } + } + else + { + htmltext = getAlreadyCompletedMsg(talker); + } + break; + } + case KAIEN: + { + if (qs.getMemoState() == 1) + { + if (hasItem(talker, OLD_HILT)) + { + takeItems(talker, OLD_HILT.getId(), -1); + final int rand = getRandom(100); + if (rand <= 52) + { + rewardItems(talker, ORIHARUKON_ORE); + } + else if (rand <= 76) + { + rewardItems(talker, VARNISH_OF_PURITY); + } + else if (rand <= 98) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RAID_SWORD); + } + qs.setCond(1); + htmltext = "30623-01.html"; + } + else + { + htmltext = "30623-02.html"; + } + } + break; + } + case RODEMAI: + { + if (qs.getMemoState() == 2) + { + if (hasItem(talker, OLD_KEY)) + { + takeItems(talker, OLD_KEY.getId(), -1); + final int rand = getRandom(100); + if (rand <= 39) + { + rewardItems(talker, COKES); + } + else if (rand <= 89) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RING_OF_AGES); + } + qs.setCond(1); + htmltext = "30756-01.html"; + } + else + { + htmltext = "30756-02.html"; + } + } + break; + } + case GARVARENTZ: + { + if (qs.getMemoState() == 3) + { + if (hasItem(talker, TOTEM_NECKLACE)) + { + takeItems(talker, TOTEM_NECKLACE.getId(), -1); + final int rand = getRandom(100); + if (rand <= 47) + { + rewardItems(talker, LEATHER); + } + else if (rand <= 97) + { + rewardItems(talker, COARSE_BONE_POWDER); + } + else + { + rewardItems(talker, HEAVY_DOOM_HAMMER); + } + qs.setCond(1); + htmltext = "30704-01.html"; + } + else + { + htmltext = "30704-02.html"; + } + } + break; + } + case ORVEN: + { + if (qs.getMemoState() == 4) + { + if (hasItem(talker, CRUCIFIX)) + { + takeItems(talker, CRUCIFIX.getId(), -1); + final int rand = getRandom(100); + if (rand <= 49) + { + rewardItems(talker, STONE_OF_PURITY); + } + else if (rand <= 69) + { + rewardItems(talker, SCROLL_EAC); + } + else + { + rewardItems(talker, DRAKE_LEATHER_BOOTS); + } + qs.setCond(1); + htmltext = "30857-01.html"; + } + else + { + htmltext = "30857-02.html"; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); + if (qs != null) + { + giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java index 23f31ff434..30e5cd8384 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java @@ -42,7 +42,6 @@ public final class Q00360_PlunderTheirSupplies extends Quest private static final Map MONSTER_DROP_CHANCES = new HashMap<>(); // Item private static final int SUPPLY_ITEMS = 5872; - static { MONSTER_DROP_CHANCES.put(20666, 50); // Taik Orc Seeker diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java index 9ce09adabf..f518800b8c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java @@ -68,7 +68,6 @@ public final class Q00416_PathOfTheOrcShaman extends Quest private static final int MIN_LEVEL = 19; // Mobs private static final Map MOBS = new HashMap<>(); - static { MOBS.put(20415, new ItemChanceHolder(FIRST_FIERY_EGG, 1.0, 1)); // scarlet_salamander diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java new file mode 100644 index 0000000000..f7a0a82059 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java @@ -0,0 +1,42 @@ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.holders; + +/** + * @author Mobius + */ +public class QuestSoundHtmlHolder +{ + private final String _sound; + private final String _html; + + public QuestSoundHtmlHolder(String sound, String html) + { + _sound = sound; + _html = html; + } + + public String getSound() + { + return _sound; + } + + public String getHtml() + { + return _html; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 64b38902b0..4484e3142e 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java index 24060ff7c5..bc147562e2 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java @@ -33,7 +33,8 @@ import ai.AbstractNpcAI; */ public class NpcLocationInfo extends AbstractNpcAI { - private static final List NPC = new ArrayList<>(); + private static final List NPC = new ArrayList<>(); + static { NPC.add(30598); NPC.add(30599); @@ -41,7 +42,8 @@ public class NpcLocationInfo extends AbstractNpcAI NPC.add(30601); NPC.add(30602); } - private static final List NPCRADAR = new ArrayList<>(); + private static final List NPCRADAR = new ArrayList<>(); + static { // Talking Island NPCRADAR.add(30006); // Gatekeeper Roxxy diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java index cb1a8eb04c..aed9ee56e9 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java @@ -1,452 +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 . - */ -package quests.Q00255_Tutorial; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.Config; -import com.l2jmobius.gameserver.enums.HtmlActionScope; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.events.EventType; -import com.l2jmobius.gameserver.model.events.ListenerRegisterType; -import com.l2jmobius.gameserver.model.events.annotations.Id; -import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; -import com.l2jmobius.gameserver.model.events.annotations.RegisterType; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark; -import com.l2jmobius.gameserver.model.holders.ItemHolder; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.quest.Quest; -import com.l2jmobius.gameserver.model.quest.QuestState; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; -import com.l2jmobius.gameserver.network.serverpackets.PlaySound; -import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml; -import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml; -import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark; - -/** - * Tutorial Quest - * @author Mobius - */ -public class Q00255_Tutorial extends Quest -{ - // NPCs - private static final List NEWBIE_HELPERS = new ArrayList<>(); - { - NEWBIE_HELPERS.add(30009); // human fighter - NEWBIE_HELPERS.add(30019); // human mystic - NEWBIE_HELPERS.add(30400); // elf - NEWBIE_HELPERS.add(30131); // dark elf - NEWBIE_HELPERS.add(30575); // orc - NEWBIE_HELPERS.add(30530); // dwarf - } - private static final List SUPERVISORS = new ArrayList<>(); - { - SUPERVISORS.add(30008); // human fighter - SUPERVISORS.add(30017); // human mystic - SUPERVISORS.add(30370); // elf - SUPERVISORS.add(30129); // dark elf - SUPERVISORS.add(30573); // orc - SUPERVISORS.add(30528); // dwarf - } - // Monsters - private static final int[] GREMLINS = - { - 18342, // this is used for now - 20001 - }; - // Items - private static final int BLUE_GEM = 6353; - private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200); - private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100); - // Others - private static final Map STARTING_VOICE_HTML = new HashMap<>(); - { - STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html")); - STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html")); - STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html")); - STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html")); - STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html")); - STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html")); - STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html")); - STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html")); - STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html")); - } - private static final Map HELPER_LOCATION = new HashMap<>(); - { - HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109)); - HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568)); - HELPER_LOCATION.put(18, new Location(46112, 41200, -3504)); - HELPER_LOCATION.put(25, new Location(46112, 41200, -3504)); - HELPER_LOCATION.put(31, new Location(28384, 11056, -4233)); - HELPER_LOCATION.put(38, new Location(28384, 11056, -4233)); - HELPER_LOCATION.put(44, new Location(-56736, -113680, -672)); - HELPER_LOCATION.put(49, new Location(-56736, -113680, -672)); - HELPER_LOCATION.put(53, new Location(108567, -173994, -406)); - } - private static final Map COMPLETE_LOCATION = new HashMap<>(); - { - COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723)); - COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723)); - COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060)); - COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060)); - COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582)); - COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582)); - COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192)); - COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192)); - COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905)); - } - private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial "; - private static final int QUESTION_MARK_ID_1 = 1; - private static final int QUESTION_MARK_ID_2 = 5; - private static final int QUESTION_MARK_ID_3 = 28; - - public Q00255_Tutorial() - { - super(255); - addTalkId(NEWBIE_HELPERS); - addTalkId(SUPERVISORS); - addFirstTalkId(NEWBIE_HELPERS); - addFirstTalkId(SUPERVISORS); - addKillId(GREMLINS); - registerQuestItems(BLUE_GEM); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs == null) - { - return null; - } - - String htmltext = null; - switch (event) - { - case "start_newbie_tutorial": - { - if (qs.getMemoState() < 4) - { - qs.startQuest(); - qs.setMemoState(1); - playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound()); - showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml()); - } - break; - } - case "tutorial_02.html": - case "tutorial_03.html": - { - if (qs.isMemoState(1)) - { - showTutorialHtml(player, event); - } - break; - } - case "question_mark_1": - { - if (qs.isMemoState(1)) - { - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0)); - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - } - break; - } - case "reward_2": - { - if (qs.isMemoState(4)) - { - qs.setMemoState(5); - if (player.isMageClass() && (player.getRace() != Race.ORC)) - { - giveItems(player, SPIRITSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_027"); - } - else - { - giveItems(player, SOULSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_026"); - } - htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html"; - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0)); - } - break; - } - case "close_tutorial": - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - break; - } - } - return htmltext; - } - - @Override - public String onFirstTalk(Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs != null) - { - // start newbie helpers - if (NEWBIE_HELPERS.contains(npc.getId())) - { - if (hasQuestItems(player, BLUE_GEM)) - { - qs.setMemoState(3); - } - switch (qs.getMemoState()) - { - case 0: - case 1: - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - qs.setMemoState(2); - if (!player.isMageClass()) - { - return "tutorial_05_fighter.html"; - } - else if (player.getRace() == Race.ORC) - { - return "tutorial_05_mystic_orc.html"; - } - return "tutorial_05_mystic.html"; - } - case 2: - { - if (!player.isMageClass()) - { - return "tutorial_05_fighter_back.html"; - } - else if (player.getRace() == Race.ORC) - { - return "tutorial_05_mystic_orc_back.html"; - } - return "tutorial_05_mystic_back.html"; - } - case 3: - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - qs.setMemoState(4); - takeItems(player, BLUE_GEM, -1); - if (player.isMageClass() && (player.getRace() != Race.ORC)) - { - giveItems(player, SPIRITSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_027"); - return npc.getId() + "-3.html"; - } - giveItems(player, SOULSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_026"); - return npc.getId() + "-2.html"; - } - case 4: - { - return npc.getId() + "-4.html"; - } - case 5: - case 6: - { - return npc.getId() + "-5.html"; - } - } - } - // else supervisors - switch (qs.getMemoState()) - { - case 0: - case 1: - case 2: - case 3: - { - return npc.getId() + "-1.html"; - } - case 4: - { - return npc.getId() + "-2.html"; - } - case 5: - case 6: - { - return npc.getId() + "-4.html"; - } - } - } - return npc.getId() + "-1.html"; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30)) - { - // check for too many gems on ground - int counter = 0; - for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500)) - { - if (item.getId() == BLUE_GEM) - { - counter++; - } - } - if (counter < 10) // do not drop if more than 10 - { - npc.dropItem(killer, BLUE_GEM, 1); - } - } - return super.onKill(npc, killer, isSummon); - } - - @RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP) - @RegisterType(ListenerRegisterType.ITEM) - @Id(BLUE_GEM) - public void OnPlayerItemPickup(OnPlayerItemPickup event) - { - final PlayerInstance player = event.getPlayer(); - final QuestState qs = getQuestState(player, false); - if ((qs != null) && (qs.getMemoState() < 3)) - { - qs.setMemoState(3); - playSound(player, "ItemSound.quest_tutorial"); - playTutorialVoice(player, "tutorial_voice_013"); - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0)); - } - } - - @RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event) - { - final QuestState qs = getQuestState(event.getPlayer(), false); - if (qs != null) - { - switch (event.getMarkId()) - { - case QUESTION_MARK_ID_1: - { - if (qs.isMemoState(1)) - { - showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000); - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); - showTutorialHtml(event.getPlayer(), "tutorial_04.html"); - } - break; - } - case QUESTION_MARK_ID_2: - { - if (qs.isMemoState(3)) - { - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); - showTutorialHtml(event.getPlayer(), "tutorial_06.html"); - } - break; - } - case QUESTION_MARK_ID_3: - { - if (qs.isMemoState(5)) - { - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ()); - playSound(event.getPlayer(), "ItemSound.quest_tutorial"); - } - break; - } - } - } - } - - @RegisterEvent(EventType.ON_PLAYER_BYPASS) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void OnPlayerBypass(OnPlayerBypass event) - { - final PlayerInstance player = event.getPlayer(); - if (event.getCommand().startsWith(TUTORIAL_BUYPASS)) - { - notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player); - } - } - - @RegisterEvent(EventType.ON_PLAYER_LOGIN) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void OnPlayerLogin(OnPlayerLogin event) - { - if (Config.DISABLE_TUTORIAL) - { - return; - } - - final PlayerInstance player = event.getPlayer(); - if (player.getLevel() > 6) - { - return; - } - - QuestState qs = getQuestState(player, true); - if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId())) - { - startQuestTimer("start_newbie_tutorial", 5000, null, player); - } - } - - private void showTutorialHtml(PlayerInstance player, String html) - { - player.sendPacket(new TutorialShowHtml(getHtm(player, html))); - } - - public void playTutorialVoice(PlayerInstance player, String voice) - { - player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ())); - } - - private class QuestSoundHtmlHolder - { - private final String _sound; - private final String _html; - - QuestSoundHtmlHolder(String sound, String html) - { - _sound = sound; - _html = html; - } - - String getSound() - { - return _sound; - } - - String getHtml() - { - return _html; - } - } -} +/* + * 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 . + */ +package quests.Q00255_Tutorial; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.Config; +import com.l2jmobius.gameserver.enums.HtmlActionScope; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.events.EventType; +import com.l2jmobius.gameserver.model.events.ListenerRegisterType; +import com.l2jmobius.gameserver.model.events.annotations.Id; +import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; +import com.l2jmobius.gameserver.model.events.annotations.RegisterType; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark; +import com.l2jmobius.gameserver.model.holders.ItemHolder; +import com.l2jmobius.gameserver.model.holders.QuestSoundHtmlHolder; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; +import com.l2jmobius.gameserver.network.serverpackets.PlaySound; +import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml; +import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml; +import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark; + +/** + * Tutorial Quest + * @author Mobius + */ +public class Q00255_Tutorial extends Quest +{ + // NPCs + private static final List NEWBIE_HELPERS = new ArrayList<>(); + static + { + NEWBIE_HELPERS.add(30009); // human fighter + NEWBIE_HELPERS.add(30019); // human mystic + NEWBIE_HELPERS.add(30400); // elf + NEWBIE_HELPERS.add(30131); // dark elf + NEWBIE_HELPERS.add(30575); // orc + NEWBIE_HELPERS.add(30530); // dwarf + } + private static final List SUPERVISORS = new ArrayList<>(); + static + { + SUPERVISORS.add(30008); // human fighter + SUPERVISORS.add(30017); // human mystic + SUPERVISORS.add(30370); // elf + SUPERVISORS.add(30129); // dark elf + SUPERVISORS.add(30573); // orc + SUPERVISORS.add(30528); // dwarf + } + // Monsters + private static final int[] GREMLINS = + { + 18342, // this is used for now + 20001 + }; + // Items + private static final int BLUE_GEM = 6353; + private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200); + private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100); + // Others + private static final Map STARTING_VOICE_HTML = new HashMap<>(); + static + { + STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html")); + STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html")); + STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html")); + STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html")); + STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html")); + STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html")); + STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html")); + STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html")); + STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html")); + } + private static final Map HELPER_LOCATION = new HashMap<>(); + static + { + HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109)); + HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568)); + HELPER_LOCATION.put(18, new Location(46112, 41200, -3504)); + HELPER_LOCATION.put(25, new Location(46112, 41200, -3504)); + HELPER_LOCATION.put(31, new Location(28384, 11056, -4233)); + HELPER_LOCATION.put(38, new Location(28384, 11056, -4233)); + HELPER_LOCATION.put(44, new Location(-56736, -113680, -672)); + HELPER_LOCATION.put(49, new Location(-56736, -113680, -672)); + HELPER_LOCATION.put(53, new Location(108567, -173994, -406)); + } + private static final Map COMPLETE_LOCATION = new HashMap<>(); + static + { + COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723)); + COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723)); + COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060)); + COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060)); + COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582)); + COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582)); + COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192)); + COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192)); + COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905)); + } + private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial "; + private static final int QUESTION_MARK_ID_1 = 1; + private static final int QUESTION_MARK_ID_2 = 5; + private static final int QUESTION_MARK_ID_3 = 28; + + public Q00255_Tutorial() + { + super(255); + addTalkId(NEWBIE_HELPERS); + addTalkId(SUPERVISORS); + addFirstTalkId(NEWBIE_HELPERS); + addFirstTalkId(SUPERVISORS); + addKillId(GREMLINS); + registerQuestItems(BLUE_GEM); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return null; + } + + String htmltext = null; + switch (event) + { + case "start_newbie_tutorial": + { + if (qs.getMemoState() < 4) + { + qs.startQuest(); + qs.setMemoState(1); + playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound()); + showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml()); + } + break; + } + case "tutorial_02.html": + case "tutorial_03.html": + { + if (qs.isMemoState(1)) + { + showTutorialHtml(player, event); + } + break; + } + case "question_mark_1": + { + if (qs.isMemoState(1)) + { + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0)); + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + } + break; + } + case "reward_2": + { + if (qs.isMemoState(4)) + { + qs.setMemoState(5); + if (player.isMageClass() && (player.getRace() != Race.ORC)) + { + giveItems(player, SPIRITSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_027"); + } + else + { + giveItems(player, SOULSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_026"); + } + htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html"; + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0)); + } + break; + } + case "close_tutorial": + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + break; + } + } + return htmltext; + } + + @Override + public String onFirstTalk(Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs != null) + { + // start newbie helpers + if (NEWBIE_HELPERS.contains(npc.getId())) + { + if (hasQuestItems(player, BLUE_GEM)) + { + qs.setMemoState(3); + } + switch (qs.getMemoState()) + { + case 0: + case 1: + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + qs.setMemoState(2); + if (!player.isMageClass()) + { + return "tutorial_05_fighter.html"; + } + else if (player.getRace() == Race.ORC) + { + return "tutorial_05_mystic_orc.html"; + } + return "tutorial_05_mystic.html"; + } + case 2: + { + if (!player.isMageClass()) + { + return "tutorial_05_fighter_back.html"; + } + else if (player.getRace() == Race.ORC) + { + return "tutorial_05_mystic_orc_back.html"; + } + return "tutorial_05_mystic_back.html"; + } + case 3: + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + qs.setMemoState(4); + takeItems(player, BLUE_GEM, -1); + if (player.isMageClass() && (player.getRace() != Race.ORC)) + { + giveItems(player, SPIRITSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_027"); + return npc.getId() + "-3.html"; + } + giveItems(player, SOULSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_026"); + return npc.getId() + "-2.html"; + } + case 4: + { + return npc.getId() + "-4.html"; + } + case 5: + case 6: + { + return npc.getId() + "-5.html"; + } + } + } + // else supervisors + switch (qs.getMemoState()) + { + case 0: + case 1: + case 2: + case 3: + { + return npc.getId() + "-1.html"; + } + case 4: + { + return npc.getId() + "-2.html"; + } + case 5: + case 6: + { + return npc.getId() + "-4.html"; + } + } + } + return npc.getId() + "-1.html"; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getQuestState(killer, false); + if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30)) + { + // check for too many gems on ground + int counter = 0; + for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500)) + { + if (item.getId() == BLUE_GEM) + { + counter++; + } + } + if (counter < 10) // do not drop if more than 10 + { + npc.dropItem(killer, BLUE_GEM, 1); + } + } + return super.onKill(npc, killer, isSummon); + } + + @RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP) + @RegisterType(ListenerRegisterType.ITEM) + @Id(BLUE_GEM) + public void OnPlayerItemPickup(OnPlayerItemPickup event) + { + final PlayerInstance player = event.getPlayer(); + final QuestState qs = getQuestState(player, false); + if ((qs != null) && (qs.getMemoState() < 3)) + { + qs.setMemoState(3); + playSound(player, "ItemSound.quest_tutorial"); + playTutorialVoice(player, "tutorial_voice_013"); + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0)); + } + } + + @RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event) + { + final QuestState qs = getQuestState(event.getPlayer(), false); + if (qs != null) + { + switch (event.getMarkId()) + { + case QUESTION_MARK_ID_1: + { + if (qs.isMemoState(1)) + { + showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000); + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); + showTutorialHtml(event.getPlayer(), "tutorial_04.html"); + } + break; + } + case QUESTION_MARK_ID_2: + { + if (qs.isMemoState(3)) + { + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); + showTutorialHtml(event.getPlayer(), "tutorial_06.html"); + } + break; + } + case QUESTION_MARK_ID_3: + { + if (qs.isMemoState(5)) + { + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ()); + playSound(event.getPlayer(), "ItemSound.quest_tutorial"); + } + break; + } + } + } + } + + @RegisterEvent(EventType.ON_PLAYER_BYPASS) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void OnPlayerBypass(OnPlayerBypass event) + { + final PlayerInstance player = event.getPlayer(); + if (event.getCommand().startsWith(TUTORIAL_BUYPASS)) + { + notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player); + } + } + + @RegisterEvent(EventType.ON_PLAYER_LOGIN) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void OnPlayerLogin(OnPlayerLogin event) + { + if (Config.DISABLE_TUTORIAL) + { + return; + } + + final PlayerInstance player = event.getPlayer(); + if (player.getLevel() > 6) + { + return; + } + + QuestState qs = getQuestState(player, true); + if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId())) + { + startQuestTimer("start_newbie_tutorial", 5000, null, player); + } + } + + private void showTutorialHtml(PlayerInstance player, String html) + { + player.sendPacket(new TutorialShowHtml(getHtm(player, html))); + } + + public void playTutorialVoice(PlayerInstance player, String voice) + { + player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ())); + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java index ba4b7c68a1..c353643195 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java @@ -64,7 +64,6 @@ public final class Q00257_TheGuardIsBusy extends Quest private static final int ORC_AMULET = 752; private static final int ORC_NECKLACE = 1085; private static final int WEREWOLF_FANG = 1086; - static { MONSTERS.put(20006, Arrays.asList(new MobDrop(10, 2, ORC_AMULET, 2), new MobDrop(10, 10, ORC_AMULET, 1))); // Orc Archer diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java index dba6bc1a20..8ba5fa8a7e 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java @@ -54,7 +54,6 @@ public final class Q00276_TotemOfTheHestui extends Quest // Misc private static final List SPAWN_CHANCES = new ArrayList<>(); private static final int MIN_LVL = 15; - static { SPAWN_CHANCES.add(new ItemHolder(79, 100)); diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java index cb7f9107c3..2de9d8c594 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java @@ -78,7 +78,6 @@ public final class Q00327_RecoverTheFarmland extends Quest new ItemHolder(ANCIENT_BRONZE_MIRROR, 3227), new ItemHolder(ANCIENT_JADE_NECKLACE, 3919) }; - static { FRAGMENTS_REWARD_DATA.put("30034-03.html", new ItemHolder(CLAY_URN_FRAGMENT, 307)); diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 205193f1cf..a7c0af9e20 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -1,378 +1,379 @@ -/* - * 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 . - */ -package quests.Q00344_1000YearsTheEndOfLamentation; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -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; - -/** - * 1000 years, the End of Lamentation (344) - * @author Pandragon - */ -public final class Q00344_1000YearsTheEndOfLamentation extends Quest -{ - // NPCs - private static final int KAIEN = 30623; - private static final int GARVARENTZ = 30704; - private static final int GILMORE = 30754; - private static final int RODEMAI = 30756; - private static final int ORVEN = 30857; - // Items - private static final int ARTICLES = 4269; - private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); - private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); - private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); - private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); - // Monsters +/* + * 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 . + */ +package quests.Q00344_1000YearsTheEndOfLamentation; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +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; + +/** + * 1000 years, the End of Lamentation (344) + * @author Pandragon + */ +public final class Q00344_1000YearsTheEndOfLamentation extends Quest +{ + // NPCs + private static final int KAIEN = 30623; + private static final int GARVARENTZ = 30704; + private static final int GILMORE = 30754; + private static final int RODEMAI = 30756; + private static final int ORVEN = 30857; + // Items + private static final int ARTICLES = 4269; + private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); + private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); + private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); + private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); + // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - { - MONSTER_CHANCES.put(20236, 0.58); // Cave Servant - MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant - MONSTER_CHANCES.put(20272, 0.58); // Cave Servant - MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant - } - // Rewards - private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); - private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); - private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); - private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); - private static final ItemHolder COKES = new ItemHolder(1879, 55); - private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); - private static final ItemHolder LEATHER = new ItemHolder(1882, 70); - private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); - private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); - private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); - private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); - private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); - // Misc - private static final int MIN_LVL = 48; - - public Q00344_1000YearsTheEndOfLamentation() - { - super(344); - addStartNpc(GILMORE); - addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); - addKillId(MONSTER_CHANCES.keySet()); - registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs == null) - { - return htmltext; - } - - switch (event) - { - case "30754-03.htm": - case "30754-16.html": - { - htmltext = event; - break; - } - case "30754-04.htm": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "30754-08.html": - { - if (qs.isCond(1)) - { - final long count = getQuestItemsCount(player, ARTICLES); - if (count < 1) - { - htmltext = "30754-07.html"; - } - else - { - takeItems(player, ARTICLES, -1); - if (getRandom(1000) >= count) - { - giveAdena(player, count * 60, true); - htmltext = event; - } - else - { - qs.setCond(2, true); - switch (getRandom(4)) - { - case 0: - { - qs.setMemoState(1); - giveItems(player, OLD_HILT); - break; - } - case 1: - { - qs.setMemoState(2); - giveItems(player, OLD_KEY); - break; - } - case 2: - { - qs.setMemoState(3); - giveItems(player, TOTEM_NECKLACE); - break; - } - case 3: - { - qs.setMemoState(4); - giveItems(player, CRUCIFIX); - break; - } - } - htmltext = "30754-09.html"; - } - } - } - break; - } - case "30754-17.html": - { - if (qs.isCond(1)) - { - htmltext = event; - qs.exitQuest(true, true); - } - break; - } - case "relic_info": - { - switch (qs.getMemoState()) - { - case 1: - { - htmltext = "30754-10.html"; - break; - } - case 2: - { - htmltext = "30754-11.html"; - break; - } - case 3: - { - htmltext = "30754-12.html"; - break; - } - case 4: - { - htmltext = "30754-13.html"; - break; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance talker) - { - final QuestState qs = getQuestState(talker, true); - String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GILMORE: - { - if (qs.isCreated()) - { - htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { - htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; - } - else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) - { - htmltext = "30754-14.html"; - } - else - { - qs.setCond(1); - htmltext = "30754-15.html"; - } - } - else - { - htmltext = getAlreadyCompletedMsg(talker); - } - break; - } - case KAIEN: - { - if (qs.getMemoState() == 1) - { - if (hasItem(talker, OLD_HILT)) - { - takeItems(talker, OLD_HILT.getId(), -1); - final int rand = getRandom(100); - if (rand <= 52) - { - rewardItems(talker, ORIHARUKON_ORE); - } - else if (rand <= 76) - { - rewardItems(talker, VARNISH_OF_PURITY); - } - else if (rand <= 98) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RAID_SWORD); - } - qs.setCond(1); - htmltext = "30623-01.html"; - } - else - { - htmltext = "30623-02.html"; - } - } - break; - } - case RODEMAI: - { - if (qs.getMemoState() == 2) - { - if (hasItem(talker, OLD_KEY)) - { - takeItems(talker, OLD_KEY.getId(), -1); - final int rand = getRandom(100); - if (rand <= 39) - { - rewardItems(talker, COKES); - } - else if (rand <= 89) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RING_OF_AGES); - } - qs.setCond(1); - htmltext = "30756-01.html"; - } - else - { - htmltext = "30756-02.html"; - } - } - break; - } - case GARVARENTZ: - { - if (qs.getMemoState() == 3) - { - if (hasItem(talker, TOTEM_NECKLACE)) - { - takeItems(talker, TOTEM_NECKLACE.getId(), -1); - final int rand = getRandom(100); - if (rand <= 47) - { - rewardItems(talker, LEATHER); - } - else if (rand <= 97) - { - rewardItems(talker, COARSE_BONE_POWDER); - } - else - { - rewardItems(talker, HEAVY_DOOM_HAMMER); - } - qs.setCond(1); - htmltext = "30704-01.html"; - } - else - { - htmltext = "30704-02.html"; - } - } - break; - } - case ORVEN: - { - if (qs.getMemoState() == 4) - { - if (hasItem(talker, CRUCIFIX)) - { - takeItems(talker, CRUCIFIX.getId(), -1); - final int rand = getRandom(100); - if (rand <= 49) - { - rewardItems(talker, STONE_OF_PURITY); - } - else if (rand <= 69) - { - rewardItems(talker, SCROLL_EAC); - } - else - { - rewardItems(talker, DRAKE_LEATHER_BOOTS); - } - qs.setCond(1); - htmltext = "30857-01.html"; - } - else - { - htmltext = "30857-02.html"; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { - giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MONSTER_CHANCES.put(20236, 0.58); // Cave Servant + MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant + MONSTER_CHANCES.put(20272, 0.58); // Cave Servant + MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant + } + // Rewards + private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); + private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); + private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); + private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); + private static final ItemHolder COKES = new ItemHolder(1879, 55); + private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); + private static final ItemHolder LEATHER = new ItemHolder(1882, 70); + private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); + private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); + private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); + private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); + private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); + // Misc + private static final int MIN_LVL = 48; + + public Q00344_1000YearsTheEndOfLamentation() + { + super(344); + addStartNpc(GILMORE); + addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); + addKillId(MONSTER_CHANCES.keySet()); + registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs == null) + { + return htmltext; + } + + switch (event) + { + case "30754-03.htm": + case "30754-16.html": + { + htmltext = event; + break; + } + case "30754-04.htm": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "30754-08.html": + { + if (qs.isCond(1)) + { + final long count = getQuestItemsCount(player, ARTICLES); + if (count < 1) + { + htmltext = "30754-07.html"; + } + else + { + takeItems(player, ARTICLES, -1); + if (getRandom(1000) >= count) + { + giveAdena(player, count * 60, true); + htmltext = event; + } + else + { + qs.setCond(2, true); + switch (getRandom(4)) + { + case 0: + { + qs.setMemoState(1); + giveItems(player, OLD_HILT); + break; + } + case 1: + { + qs.setMemoState(2); + giveItems(player, OLD_KEY); + break; + } + case 2: + { + qs.setMemoState(3); + giveItems(player, TOTEM_NECKLACE); + break; + } + case 3: + { + qs.setMemoState(4); + giveItems(player, CRUCIFIX); + break; + } + } + htmltext = "30754-09.html"; + } + } + } + break; + } + case "30754-17.html": + { + if (qs.isCond(1)) + { + htmltext = event; + qs.exitQuest(true, true); + } + break; + } + case "relic_info": + { + switch (qs.getMemoState()) + { + case 1: + { + htmltext = "30754-10.html"; + break; + } + case 2: + { + htmltext = "30754-11.html"; + break; + } + case 3: + { + htmltext = "30754-12.html"; + break; + } + case 4: + { + htmltext = "30754-13.html"; + break; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance talker) + { + final QuestState qs = getQuestState(talker, true); + String htmltext = getNoQuestMsg(talker); + switch (npc.getId()) + { + case GILMORE: + { + if (qs.isCreated()) + { + htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; + } + else if (qs.isStarted()) + { + if (qs.isCond(1)) + { + htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; + } + else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) + { + htmltext = "30754-14.html"; + } + else + { + qs.setCond(1); + htmltext = "30754-15.html"; + } + } + else + { + htmltext = getAlreadyCompletedMsg(talker); + } + break; + } + case KAIEN: + { + if (qs.getMemoState() == 1) + { + if (hasItem(talker, OLD_HILT)) + { + takeItems(talker, OLD_HILT.getId(), -1); + final int rand = getRandom(100); + if (rand <= 52) + { + rewardItems(talker, ORIHARUKON_ORE); + } + else if (rand <= 76) + { + rewardItems(talker, VARNISH_OF_PURITY); + } + else if (rand <= 98) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RAID_SWORD); + } + qs.setCond(1); + htmltext = "30623-01.html"; + } + else + { + htmltext = "30623-02.html"; + } + } + break; + } + case RODEMAI: + { + if (qs.getMemoState() == 2) + { + if (hasItem(talker, OLD_KEY)) + { + takeItems(talker, OLD_KEY.getId(), -1); + final int rand = getRandom(100); + if (rand <= 39) + { + rewardItems(talker, COKES); + } + else if (rand <= 89) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RING_OF_AGES); + } + qs.setCond(1); + htmltext = "30756-01.html"; + } + else + { + htmltext = "30756-02.html"; + } + } + break; + } + case GARVARENTZ: + { + if (qs.getMemoState() == 3) + { + if (hasItem(talker, TOTEM_NECKLACE)) + { + takeItems(talker, TOTEM_NECKLACE.getId(), -1); + final int rand = getRandom(100); + if (rand <= 47) + { + rewardItems(talker, LEATHER); + } + else if (rand <= 97) + { + rewardItems(talker, COARSE_BONE_POWDER); + } + else + { + rewardItems(talker, HEAVY_DOOM_HAMMER); + } + qs.setCond(1); + htmltext = "30704-01.html"; + } + else + { + htmltext = "30704-02.html"; + } + } + break; + } + case ORVEN: + { + if (qs.getMemoState() == 4) + { + if (hasItem(talker, CRUCIFIX)) + { + takeItems(talker, CRUCIFIX.getId(), -1); + final int rand = getRandom(100); + if (rand <= 49) + { + rewardItems(talker, STONE_OF_PURITY); + } + else if (rand <= 69) + { + rewardItems(talker, SCROLL_EAC); + } + else + { + rewardItems(talker, DRAKE_LEATHER_BOOTS); + } + qs.setCond(1); + htmltext = "30857-01.html"; + } + else + { + htmltext = "30857-02.html"; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); + if (qs != null) + { + giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java index 23f31ff434..30e5cd8384 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java @@ -42,7 +42,6 @@ public final class Q00360_PlunderTheirSupplies extends Quest private static final Map MONSTER_DROP_CHANCES = new HashMap<>(); // Item private static final int SUPPLY_ITEMS = 5872; - static { MONSTER_DROP_CHANCES.put(20666, 50); // Taik Orc Seeker diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java index 9ce09adabf..f518800b8c 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java @@ -68,7 +68,6 @@ public final class Q00416_PathOfTheOrcShaman extends Quest private static final int MIN_LEVEL = 19; // Mobs private static final Map MOBS = new HashMap<>(); - static { MOBS.put(20415, new ItemChanceHolder(FIRST_FIERY_EGG, 1.0, 1)); // scarlet_salamander diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java new file mode 100644 index 0000000000..f7a0a82059 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java @@ -0,0 +1,42 @@ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.holders; + +/** + * @author Mobius + */ +public class QuestSoundHtmlHolder +{ + private final String _sound; + private final String _html; + + public QuestSoundHtmlHolder(String sound, String html) + { + _sound = sound; + _html = html; + } + + public String getSound() + { + return _sound; + } + + public String getHtml() + { + return _html; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 64b38902b0..4484e3142e 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java index 24060ff7c5..bc147562e2 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java @@ -33,7 +33,8 @@ import ai.AbstractNpcAI; */ public class NpcLocationInfo extends AbstractNpcAI { - private static final List NPC = new ArrayList<>(); + private static final List NPC = new ArrayList<>(); + static { NPC.add(30598); NPC.add(30599); @@ -41,7 +42,8 @@ public class NpcLocationInfo extends AbstractNpcAI NPC.add(30601); NPC.add(30602); } - private static final List NPCRADAR = new ArrayList<>(); + private static final List NPCRADAR = new ArrayList<>(); + static { // Talking Island NPCRADAR.add(30006); // Gatekeeper Roxxy diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java index cb1a8eb04c..aed9ee56e9 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java @@ -1,452 +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 . - */ -package quests.Q00255_Tutorial; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.Config; -import com.l2jmobius.gameserver.enums.HtmlActionScope; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.events.EventType; -import com.l2jmobius.gameserver.model.events.ListenerRegisterType; -import com.l2jmobius.gameserver.model.events.annotations.Id; -import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; -import com.l2jmobius.gameserver.model.events.annotations.RegisterType; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark; -import com.l2jmobius.gameserver.model.holders.ItemHolder; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.quest.Quest; -import com.l2jmobius.gameserver.model.quest.QuestState; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; -import com.l2jmobius.gameserver.network.serverpackets.PlaySound; -import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml; -import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml; -import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark; - -/** - * Tutorial Quest - * @author Mobius - */ -public class Q00255_Tutorial extends Quest -{ - // NPCs - private static final List NEWBIE_HELPERS = new ArrayList<>(); - { - NEWBIE_HELPERS.add(30009); // human fighter - NEWBIE_HELPERS.add(30019); // human mystic - NEWBIE_HELPERS.add(30400); // elf - NEWBIE_HELPERS.add(30131); // dark elf - NEWBIE_HELPERS.add(30575); // orc - NEWBIE_HELPERS.add(30530); // dwarf - } - private static final List SUPERVISORS = new ArrayList<>(); - { - SUPERVISORS.add(30008); // human fighter - SUPERVISORS.add(30017); // human mystic - SUPERVISORS.add(30370); // elf - SUPERVISORS.add(30129); // dark elf - SUPERVISORS.add(30573); // orc - SUPERVISORS.add(30528); // dwarf - } - // Monsters - private static final int[] GREMLINS = - { - 18342, // this is used for now - 20001 - }; - // Items - private static final int BLUE_GEM = 6353; - private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200); - private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100); - // Others - private static final Map STARTING_VOICE_HTML = new HashMap<>(); - { - STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html")); - STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html")); - STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html")); - STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html")); - STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html")); - STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html")); - STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html")); - STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html")); - STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html")); - } - private static final Map HELPER_LOCATION = new HashMap<>(); - { - HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109)); - HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568)); - HELPER_LOCATION.put(18, new Location(46112, 41200, -3504)); - HELPER_LOCATION.put(25, new Location(46112, 41200, -3504)); - HELPER_LOCATION.put(31, new Location(28384, 11056, -4233)); - HELPER_LOCATION.put(38, new Location(28384, 11056, -4233)); - HELPER_LOCATION.put(44, new Location(-56736, -113680, -672)); - HELPER_LOCATION.put(49, new Location(-56736, -113680, -672)); - HELPER_LOCATION.put(53, new Location(108567, -173994, -406)); - } - private static final Map COMPLETE_LOCATION = new HashMap<>(); - { - COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723)); - COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723)); - COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060)); - COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060)); - COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582)); - COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582)); - COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192)); - COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192)); - COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905)); - } - private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial "; - private static final int QUESTION_MARK_ID_1 = 1; - private static final int QUESTION_MARK_ID_2 = 5; - private static final int QUESTION_MARK_ID_3 = 28; - - public Q00255_Tutorial() - { - super(255); - addTalkId(NEWBIE_HELPERS); - addTalkId(SUPERVISORS); - addFirstTalkId(NEWBIE_HELPERS); - addFirstTalkId(SUPERVISORS); - addKillId(GREMLINS); - registerQuestItems(BLUE_GEM); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs == null) - { - return null; - } - - String htmltext = null; - switch (event) - { - case "start_newbie_tutorial": - { - if (qs.getMemoState() < 4) - { - qs.startQuest(); - qs.setMemoState(1); - playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound()); - showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml()); - } - break; - } - case "tutorial_02.html": - case "tutorial_03.html": - { - if (qs.isMemoState(1)) - { - showTutorialHtml(player, event); - } - break; - } - case "question_mark_1": - { - if (qs.isMemoState(1)) - { - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0)); - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - } - break; - } - case "reward_2": - { - if (qs.isMemoState(4)) - { - qs.setMemoState(5); - if (player.isMageClass() && (player.getRace() != Race.ORC)) - { - giveItems(player, SPIRITSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_027"); - } - else - { - giveItems(player, SOULSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_026"); - } - htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html"; - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0)); - } - break; - } - case "close_tutorial": - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - break; - } - } - return htmltext; - } - - @Override - public String onFirstTalk(Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs != null) - { - // start newbie helpers - if (NEWBIE_HELPERS.contains(npc.getId())) - { - if (hasQuestItems(player, BLUE_GEM)) - { - qs.setMemoState(3); - } - switch (qs.getMemoState()) - { - case 0: - case 1: - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - qs.setMemoState(2); - if (!player.isMageClass()) - { - return "tutorial_05_fighter.html"; - } - else if (player.getRace() == Race.ORC) - { - return "tutorial_05_mystic_orc.html"; - } - return "tutorial_05_mystic.html"; - } - case 2: - { - if (!player.isMageClass()) - { - return "tutorial_05_fighter_back.html"; - } - else if (player.getRace() == Race.ORC) - { - return "tutorial_05_mystic_orc_back.html"; - } - return "tutorial_05_mystic_back.html"; - } - case 3: - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - qs.setMemoState(4); - takeItems(player, BLUE_GEM, -1); - if (player.isMageClass() && (player.getRace() != Race.ORC)) - { - giveItems(player, SPIRITSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_027"); - return npc.getId() + "-3.html"; - } - giveItems(player, SOULSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_026"); - return npc.getId() + "-2.html"; - } - case 4: - { - return npc.getId() + "-4.html"; - } - case 5: - case 6: - { - return npc.getId() + "-5.html"; - } - } - } - // else supervisors - switch (qs.getMemoState()) - { - case 0: - case 1: - case 2: - case 3: - { - return npc.getId() + "-1.html"; - } - case 4: - { - return npc.getId() + "-2.html"; - } - case 5: - case 6: - { - return npc.getId() + "-4.html"; - } - } - } - return npc.getId() + "-1.html"; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30)) - { - // check for too many gems on ground - int counter = 0; - for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500)) - { - if (item.getId() == BLUE_GEM) - { - counter++; - } - } - if (counter < 10) // do not drop if more than 10 - { - npc.dropItem(killer, BLUE_GEM, 1); - } - } - return super.onKill(npc, killer, isSummon); - } - - @RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP) - @RegisterType(ListenerRegisterType.ITEM) - @Id(BLUE_GEM) - public void OnPlayerItemPickup(OnPlayerItemPickup event) - { - final PlayerInstance player = event.getPlayer(); - final QuestState qs = getQuestState(player, false); - if ((qs != null) && (qs.getMemoState() < 3)) - { - qs.setMemoState(3); - playSound(player, "ItemSound.quest_tutorial"); - playTutorialVoice(player, "tutorial_voice_013"); - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0)); - } - } - - @RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event) - { - final QuestState qs = getQuestState(event.getPlayer(), false); - if (qs != null) - { - switch (event.getMarkId()) - { - case QUESTION_MARK_ID_1: - { - if (qs.isMemoState(1)) - { - showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000); - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); - showTutorialHtml(event.getPlayer(), "tutorial_04.html"); - } - break; - } - case QUESTION_MARK_ID_2: - { - if (qs.isMemoState(3)) - { - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); - showTutorialHtml(event.getPlayer(), "tutorial_06.html"); - } - break; - } - case QUESTION_MARK_ID_3: - { - if (qs.isMemoState(5)) - { - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ()); - playSound(event.getPlayer(), "ItemSound.quest_tutorial"); - } - break; - } - } - } - } - - @RegisterEvent(EventType.ON_PLAYER_BYPASS) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void OnPlayerBypass(OnPlayerBypass event) - { - final PlayerInstance player = event.getPlayer(); - if (event.getCommand().startsWith(TUTORIAL_BUYPASS)) - { - notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player); - } - } - - @RegisterEvent(EventType.ON_PLAYER_LOGIN) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void OnPlayerLogin(OnPlayerLogin event) - { - if (Config.DISABLE_TUTORIAL) - { - return; - } - - final PlayerInstance player = event.getPlayer(); - if (player.getLevel() > 6) - { - return; - } - - QuestState qs = getQuestState(player, true); - if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId())) - { - startQuestTimer("start_newbie_tutorial", 5000, null, player); - } - } - - private void showTutorialHtml(PlayerInstance player, String html) - { - player.sendPacket(new TutorialShowHtml(getHtm(player, html))); - } - - public void playTutorialVoice(PlayerInstance player, String voice) - { - player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ())); - } - - private class QuestSoundHtmlHolder - { - private final String _sound; - private final String _html; - - QuestSoundHtmlHolder(String sound, String html) - { - _sound = sound; - _html = html; - } - - String getSound() - { - return _sound; - } - - String getHtml() - { - return _html; - } - } -} +/* + * 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 . + */ +package quests.Q00255_Tutorial; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.Config; +import com.l2jmobius.gameserver.enums.HtmlActionScope; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.events.EventType; +import com.l2jmobius.gameserver.model.events.ListenerRegisterType; +import com.l2jmobius.gameserver.model.events.annotations.Id; +import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; +import com.l2jmobius.gameserver.model.events.annotations.RegisterType; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark; +import com.l2jmobius.gameserver.model.holders.ItemHolder; +import com.l2jmobius.gameserver.model.holders.QuestSoundHtmlHolder; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; +import com.l2jmobius.gameserver.network.serverpackets.PlaySound; +import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml; +import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml; +import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark; + +/** + * Tutorial Quest + * @author Mobius + */ +public class Q00255_Tutorial extends Quest +{ + // NPCs + private static final List NEWBIE_HELPERS = new ArrayList<>(); + static + { + NEWBIE_HELPERS.add(30009); // human fighter + NEWBIE_HELPERS.add(30019); // human mystic + NEWBIE_HELPERS.add(30400); // elf + NEWBIE_HELPERS.add(30131); // dark elf + NEWBIE_HELPERS.add(30575); // orc + NEWBIE_HELPERS.add(30530); // dwarf + } + private static final List SUPERVISORS = new ArrayList<>(); + static + { + SUPERVISORS.add(30008); // human fighter + SUPERVISORS.add(30017); // human mystic + SUPERVISORS.add(30370); // elf + SUPERVISORS.add(30129); // dark elf + SUPERVISORS.add(30573); // orc + SUPERVISORS.add(30528); // dwarf + } + // Monsters + private static final int[] GREMLINS = + { + 18342, // this is used for now + 20001 + }; + // Items + private static final int BLUE_GEM = 6353; + private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200); + private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100); + // Others + private static final Map STARTING_VOICE_HTML = new HashMap<>(); + static + { + STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html")); + STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html")); + STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html")); + STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html")); + STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html")); + STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html")); + STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html")); + STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html")); + STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html")); + } + private static final Map HELPER_LOCATION = new HashMap<>(); + static + { + HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109)); + HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568)); + HELPER_LOCATION.put(18, new Location(46112, 41200, -3504)); + HELPER_LOCATION.put(25, new Location(46112, 41200, -3504)); + HELPER_LOCATION.put(31, new Location(28384, 11056, -4233)); + HELPER_LOCATION.put(38, new Location(28384, 11056, -4233)); + HELPER_LOCATION.put(44, new Location(-56736, -113680, -672)); + HELPER_LOCATION.put(49, new Location(-56736, -113680, -672)); + HELPER_LOCATION.put(53, new Location(108567, -173994, -406)); + } + private static final Map COMPLETE_LOCATION = new HashMap<>(); + static + { + COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723)); + COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723)); + COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060)); + COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060)); + COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582)); + COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582)); + COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192)); + COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192)); + COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905)); + } + private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial "; + private static final int QUESTION_MARK_ID_1 = 1; + private static final int QUESTION_MARK_ID_2 = 5; + private static final int QUESTION_MARK_ID_3 = 28; + + public Q00255_Tutorial() + { + super(255); + addTalkId(NEWBIE_HELPERS); + addTalkId(SUPERVISORS); + addFirstTalkId(NEWBIE_HELPERS); + addFirstTalkId(SUPERVISORS); + addKillId(GREMLINS); + registerQuestItems(BLUE_GEM); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return null; + } + + String htmltext = null; + switch (event) + { + case "start_newbie_tutorial": + { + if (qs.getMemoState() < 4) + { + qs.startQuest(); + qs.setMemoState(1); + playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound()); + showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml()); + } + break; + } + case "tutorial_02.html": + case "tutorial_03.html": + { + if (qs.isMemoState(1)) + { + showTutorialHtml(player, event); + } + break; + } + case "question_mark_1": + { + if (qs.isMemoState(1)) + { + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0)); + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + } + break; + } + case "reward_2": + { + if (qs.isMemoState(4)) + { + qs.setMemoState(5); + if (player.isMageClass() && (player.getRace() != Race.ORC)) + { + giveItems(player, SPIRITSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_027"); + } + else + { + giveItems(player, SOULSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_026"); + } + htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html"; + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0)); + } + break; + } + case "close_tutorial": + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + break; + } + } + return htmltext; + } + + @Override + public String onFirstTalk(Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs != null) + { + // start newbie helpers + if (NEWBIE_HELPERS.contains(npc.getId())) + { + if (hasQuestItems(player, BLUE_GEM)) + { + qs.setMemoState(3); + } + switch (qs.getMemoState()) + { + case 0: + case 1: + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + qs.setMemoState(2); + if (!player.isMageClass()) + { + return "tutorial_05_fighter.html"; + } + else if (player.getRace() == Race.ORC) + { + return "tutorial_05_mystic_orc.html"; + } + return "tutorial_05_mystic.html"; + } + case 2: + { + if (!player.isMageClass()) + { + return "tutorial_05_fighter_back.html"; + } + else if (player.getRace() == Race.ORC) + { + return "tutorial_05_mystic_orc_back.html"; + } + return "tutorial_05_mystic_back.html"; + } + case 3: + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + qs.setMemoState(4); + takeItems(player, BLUE_GEM, -1); + if (player.isMageClass() && (player.getRace() != Race.ORC)) + { + giveItems(player, SPIRITSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_027"); + return npc.getId() + "-3.html"; + } + giveItems(player, SOULSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_026"); + return npc.getId() + "-2.html"; + } + case 4: + { + return npc.getId() + "-4.html"; + } + case 5: + case 6: + { + return npc.getId() + "-5.html"; + } + } + } + // else supervisors + switch (qs.getMemoState()) + { + case 0: + case 1: + case 2: + case 3: + { + return npc.getId() + "-1.html"; + } + case 4: + { + return npc.getId() + "-2.html"; + } + case 5: + case 6: + { + return npc.getId() + "-4.html"; + } + } + } + return npc.getId() + "-1.html"; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getQuestState(killer, false); + if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30)) + { + // check for too many gems on ground + int counter = 0; + for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500)) + { + if (item.getId() == BLUE_GEM) + { + counter++; + } + } + if (counter < 10) // do not drop if more than 10 + { + npc.dropItem(killer, BLUE_GEM, 1); + } + } + return super.onKill(npc, killer, isSummon); + } + + @RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP) + @RegisterType(ListenerRegisterType.ITEM) + @Id(BLUE_GEM) + public void OnPlayerItemPickup(OnPlayerItemPickup event) + { + final PlayerInstance player = event.getPlayer(); + final QuestState qs = getQuestState(player, false); + if ((qs != null) && (qs.getMemoState() < 3)) + { + qs.setMemoState(3); + playSound(player, "ItemSound.quest_tutorial"); + playTutorialVoice(player, "tutorial_voice_013"); + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0)); + } + } + + @RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event) + { + final QuestState qs = getQuestState(event.getPlayer(), false); + if (qs != null) + { + switch (event.getMarkId()) + { + case QUESTION_MARK_ID_1: + { + if (qs.isMemoState(1)) + { + showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000); + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); + showTutorialHtml(event.getPlayer(), "tutorial_04.html"); + } + break; + } + case QUESTION_MARK_ID_2: + { + if (qs.isMemoState(3)) + { + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); + showTutorialHtml(event.getPlayer(), "tutorial_06.html"); + } + break; + } + case QUESTION_MARK_ID_3: + { + if (qs.isMemoState(5)) + { + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ()); + playSound(event.getPlayer(), "ItemSound.quest_tutorial"); + } + break; + } + } + } + } + + @RegisterEvent(EventType.ON_PLAYER_BYPASS) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void OnPlayerBypass(OnPlayerBypass event) + { + final PlayerInstance player = event.getPlayer(); + if (event.getCommand().startsWith(TUTORIAL_BUYPASS)) + { + notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player); + } + } + + @RegisterEvent(EventType.ON_PLAYER_LOGIN) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void OnPlayerLogin(OnPlayerLogin event) + { + if (Config.DISABLE_TUTORIAL) + { + return; + } + + final PlayerInstance player = event.getPlayer(); + if (player.getLevel() > 6) + { + return; + } + + QuestState qs = getQuestState(player, true); + if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId())) + { + startQuestTimer("start_newbie_tutorial", 5000, null, player); + } + } + + private void showTutorialHtml(PlayerInstance player, String html) + { + player.sendPacket(new TutorialShowHtml(getHtm(player, html))); + } + + public void playTutorialVoice(PlayerInstance player, String voice) + { + player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ())); + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java index ba4b7c68a1..c353643195 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java @@ -64,7 +64,6 @@ public final class Q00257_TheGuardIsBusy extends Quest private static final int ORC_AMULET = 752; private static final int ORC_NECKLACE = 1085; private static final int WEREWOLF_FANG = 1086; - static { MONSTERS.put(20006, Arrays.asList(new MobDrop(10, 2, ORC_AMULET, 2), new MobDrop(10, 10, ORC_AMULET, 1))); // Orc Archer diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java index dba6bc1a20..8ba5fa8a7e 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java @@ -54,7 +54,6 @@ public final class Q00276_TotemOfTheHestui extends Quest // Misc private static final List SPAWN_CHANCES = new ArrayList<>(); private static final int MIN_LVL = 15; - static { SPAWN_CHANCES.add(new ItemHolder(79, 100)); diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java index cb7f9107c3..2de9d8c594 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java @@ -78,7 +78,6 @@ public final class Q00327_RecoverTheFarmland extends Quest new ItemHolder(ANCIENT_BRONZE_MIRROR, 3227), new ItemHolder(ANCIENT_JADE_NECKLACE, 3919) }; - static { FRAGMENTS_REWARD_DATA.put("30034-03.html", new ItemHolder(CLAY_URN_FRAGMENT, 307)); diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 205193f1cf..a7c0af9e20 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -1,378 +1,379 @@ -/* - * 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 . - */ -package quests.Q00344_1000YearsTheEndOfLamentation; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -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; - -/** - * 1000 years, the End of Lamentation (344) - * @author Pandragon - */ -public final class Q00344_1000YearsTheEndOfLamentation extends Quest -{ - // NPCs - private static final int KAIEN = 30623; - private static final int GARVARENTZ = 30704; - private static final int GILMORE = 30754; - private static final int RODEMAI = 30756; - private static final int ORVEN = 30857; - // Items - private static final int ARTICLES = 4269; - private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); - private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); - private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); - private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); - // Monsters +/* + * 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 . + */ +package quests.Q00344_1000YearsTheEndOfLamentation; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +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; + +/** + * 1000 years, the End of Lamentation (344) + * @author Pandragon + */ +public final class Q00344_1000YearsTheEndOfLamentation extends Quest +{ + // NPCs + private static final int KAIEN = 30623; + private static final int GARVARENTZ = 30704; + private static final int GILMORE = 30754; + private static final int RODEMAI = 30756; + private static final int ORVEN = 30857; + // Items + private static final int ARTICLES = 4269; + private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); + private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); + private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); + private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); + // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - { - MONSTER_CHANCES.put(20236, 0.58); // Cave Servant - MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant - MONSTER_CHANCES.put(20272, 0.58); // Cave Servant - MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant - } - // Rewards - private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); - private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); - private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); - private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); - private static final ItemHolder COKES = new ItemHolder(1879, 55); - private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); - private static final ItemHolder LEATHER = new ItemHolder(1882, 70); - private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); - private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); - private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); - private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); - private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); - // Misc - private static final int MIN_LVL = 48; - - public Q00344_1000YearsTheEndOfLamentation() - { - super(344); - addStartNpc(GILMORE); - addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); - addKillId(MONSTER_CHANCES.keySet()); - registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs == null) - { - return htmltext; - } - - switch (event) - { - case "30754-03.htm": - case "30754-16.html": - { - htmltext = event; - break; - } - case "30754-04.htm": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "30754-08.html": - { - if (qs.isCond(1)) - { - final long count = getQuestItemsCount(player, ARTICLES); - if (count < 1) - { - htmltext = "30754-07.html"; - } - else - { - takeItems(player, ARTICLES, -1); - if (getRandom(1000) >= count) - { - giveAdena(player, count * 60, true); - htmltext = event; - } - else - { - qs.setCond(2, true); - switch (getRandom(4)) - { - case 0: - { - qs.setMemoState(1); - giveItems(player, OLD_HILT); - break; - } - case 1: - { - qs.setMemoState(2); - giveItems(player, OLD_KEY); - break; - } - case 2: - { - qs.setMemoState(3); - giveItems(player, TOTEM_NECKLACE); - break; - } - case 3: - { - qs.setMemoState(4); - giveItems(player, CRUCIFIX); - break; - } - } - htmltext = "30754-09.html"; - } - } - } - break; - } - case "30754-17.html": - { - if (qs.isCond(1)) - { - htmltext = event; - qs.exitQuest(true, true); - } - break; - } - case "relic_info": - { - switch (qs.getMemoState()) - { - case 1: - { - htmltext = "30754-10.html"; - break; - } - case 2: - { - htmltext = "30754-11.html"; - break; - } - case 3: - { - htmltext = "30754-12.html"; - break; - } - case 4: - { - htmltext = "30754-13.html"; - break; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance talker) - { - final QuestState qs = getQuestState(talker, true); - String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GILMORE: - { - if (qs.isCreated()) - { - htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { - htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; - } - else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) - { - htmltext = "30754-14.html"; - } - else - { - qs.setCond(1); - htmltext = "30754-15.html"; - } - } - else - { - htmltext = getAlreadyCompletedMsg(talker); - } - break; - } - case KAIEN: - { - if (qs.getMemoState() == 1) - { - if (hasItem(talker, OLD_HILT)) - { - takeItems(talker, OLD_HILT.getId(), -1); - final int rand = getRandom(100); - if (rand <= 52) - { - rewardItems(talker, ORIHARUKON_ORE); - } - else if (rand <= 76) - { - rewardItems(talker, VARNISH_OF_PURITY); - } - else if (rand <= 98) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RAID_SWORD); - } - qs.setCond(1); - htmltext = "30623-01.html"; - } - else - { - htmltext = "30623-02.html"; - } - } - break; - } - case RODEMAI: - { - if (qs.getMemoState() == 2) - { - if (hasItem(talker, OLD_KEY)) - { - takeItems(talker, OLD_KEY.getId(), -1); - final int rand = getRandom(100); - if (rand <= 39) - { - rewardItems(talker, COKES); - } - else if (rand <= 89) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RING_OF_AGES); - } - qs.setCond(1); - htmltext = "30756-01.html"; - } - else - { - htmltext = "30756-02.html"; - } - } - break; - } - case GARVARENTZ: - { - if (qs.getMemoState() == 3) - { - if (hasItem(talker, TOTEM_NECKLACE)) - { - takeItems(talker, TOTEM_NECKLACE.getId(), -1); - final int rand = getRandom(100); - if (rand <= 47) - { - rewardItems(talker, LEATHER); - } - else if (rand <= 97) - { - rewardItems(talker, COARSE_BONE_POWDER); - } - else - { - rewardItems(talker, HEAVY_DOOM_HAMMER); - } - qs.setCond(1); - htmltext = "30704-01.html"; - } - else - { - htmltext = "30704-02.html"; - } - } - break; - } - case ORVEN: - { - if (qs.getMemoState() == 4) - { - if (hasItem(talker, CRUCIFIX)) - { - takeItems(talker, CRUCIFIX.getId(), -1); - final int rand = getRandom(100); - if (rand <= 49) - { - rewardItems(talker, STONE_OF_PURITY); - } - else if (rand <= 69) - { - rewardItems(talker, SCROLL_EAC); - } - else - { - rewardItems(talker, DRAKE_LEATHER_BOOTS); - } - qs.setCond(1); - htmltext = "30857-01.html"; - } - else - { - htmltext = "30857-02.html"; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { - giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MONSTER_CHANCES.put(20236, 0.58); // Cave Servant + MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant + MONSTER_CHANCES.put(20272, 0.58); // Cave Servant + MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant + } + // Rewards + private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); + private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); + private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); + private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); + private static final ItemHolder COKES = new ItemHolder(1879, 55); + private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); + private static final ItemHolder LEATHER = new ItemHolder(1882, 70); + private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); + private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); + private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); + private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); + private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); + // Misc + private static final int MIN_LVL = 48; + + public Q00344_1000YearsTheEndOfLamentation() + { + super(344); + addStartNpc(GILMORE); + addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); + addKillId(MONSTER_CHANCES.keySet()); + registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs == null) + { + return htmltext; + } + + switch (event) + { + case "30754-03.htm": + case "30754-16.html": + { + htmltext = event; + break; + } + case "30754-04.htm": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "30754-08.html": + { + if (qs.isCond(1)) + { + final long count = getQuestItemsCount(player, ARTICLES); + if (count < 1) + { + htmltext = "30754-07.html"; + } + else + { + takeItems(player, ARTICLES, -1); + if (getRandom(1000) >= count) + { + giveAdena(player, count * 60, true); + htmltext = event; + } + else + { + qs.setCond(2, true); + switch (getRandom(4)) + { + case 0: + { + qs.setMemoState(1); + giveItems(player, OLD_HILT); + break; + } + case 1: + { + qs.setMemoState(2); + giveItems(player, OLD_KEY); + break; + } + case 2: + { + qs.setMemoState(3); + giveItems(player, TOTEM_NECKLACE); + break; + } + case 3: + { + qs.setMemoState(4); + giveItems(player, CRUCIFIX); + break; + } + } + htmltext = "30754-09.html"; + } + } + } + break; + } + case "30754-17.html": + { + if (qs.isCond(1)) + { + htmltext = event; + qs.exitQuest(true, true); + } + break; + } + case "relic_info": + { + switch (qs.getMemoState()) + { + case 1: + { + htmltext = "30754-10.html"; + break; + } + case 2: + { + htmltext = "30754-11.html"; + break; + } + case 3: + { + htmltext = "30754-12.html"; + break; + } + case 4: + { + htmltext = "30754-13.html"; + break; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance talker) + { + final QuestState qs = getQuestState(talker, true); + String htmltext = getNoQuestMsg(talker); + switch (npc.getId()) + { + case GILMORE: + { + if (qs.isCreated()) + { + htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; + } + else if (qs.isStarted()) + { + if (qs.isCond(1)) + { + htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; + } + else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) + { + htmltext = "30754-14.html"; + } + else + { + qs.setCond(1); + htmltext = "30754-15.html"; + } + } + else + { + htmltext = getAlreadyCompletedMsg(talker); + } + break; + } + case KAIEN: + { + if (qs.getMemoState() == 1) + { + if (hasItem(talker, OLD_HILT)) + { + takeItems(talker, OLD_HILT.getId(), -1); + final int rand = getRandom(100); + if (rand <= 52) + { + rewardItems(talker, ORIHARUKON_ORE); + } + else if (rand <= 76) + { + rewardItems(talker, VARNISH_OF_PURITY); + } + else if (rand <= 98) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RAID_SWORD); + } + qs.setCond(1); + htmltext = "30623-01.html"; + } + else + { + htmltext = "30623-02.html"; + } + } + break; + } + case RODEMAI: + { + if (qs.getMemoState() == 2) + { + if (hasItem(talker, OLD_KEY)) + { + takeItems(talker, OLD_KEY.getId(), -1); + final int rand = getRandom(100); + if (rand <= 39) + { + rewardItems(talker, COKES); + } + else if (rand <= 89) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RING_OF_AGES); + } + qs.setCond(1); + htmltext = "30756-01.html"; + } + else + { + htmltext = "30756-02.html"; + } + } + break; + } + case GARVARENTZ: + { + if (qs.getMemoState() == 3) + { + if (hasItem(talker, TOTEM_NECKLACE)) + { + takeItems(talker, TOTEM_NECKLACE.getId(), -1); + final int rand = getRandom(100); + if (rand <= 47) + { + rewardItems(talker, LEATHER); + } + else if (rand <= 97) + { + rewardItems(talker, COARSE_BONE_POWDER); + } + else + { + rewardItems(talker, HEAVY_DOOM_HAMMER); + } + qs.setCond(1); + htmltext = "30704-01.html"; + } + else + { + htmltext = "30704-02.html"; + } + } + break; + } + case ORVEN: + { + if (qs.getMemoState() == 4) + { + if (hasItem(talker, CRUCIFIX)) + { + takeItems(talker, CRUCIFIX.getId(), -1); + final int rand = getRandom(100); + if (rand <= 49) + { + rewardItems(talker, STONE_OF_PURITY); + } + else if (rand <= 69) + { + rewardItems(talker, SCROLL_EAC); + } + else + { + rewardItems(talker, DRAKE_LEATHER_BOOTS); + } + qs.setCond(1); + htmltext = "30857-01.html"; + } + else + { + htmltext = "30857-02.html"; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); + if (qs != null) + { + giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java index 23f31ff434..30e5cd8384 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java @@ -42,7 +42,6 @@ public final class Q00360_PlunderTheirSupplies extends Quest private static final Map MONSTER_DROP_CHANCES = new HashMap<>(); // Item private static final int SUPPLY_ITEMS = 5872; - static { MONSTER_DROP_CHANCES.put(20666, 50); // Taik Orc Seeker diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java index 9ce09adabf..f518800b8c 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java @@ -68,7 +68,6 @@ public final class Q00416_PathOfTheOrcShaman extends Quest private static final int MIN_LEVEL = 19; // Mobs private static final Map MOBS = new HashMap<>(); - static { MOBS.put(20415, new ItemChanceHolder(FIRST_FIERY_EGG, 1.0, 1)); // scarlet_salamander diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java new file mode 100644 index 0000000000..f7a0a82059 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java @@ -0,0 +1,42 @@ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.holders; + +/** + * @author Mobius + */ +public class QuestSoundHtmlHolder +{ + private final String _sound; + private final String _html; + + public QuestSoundHtmlHolder(String sound, String html) + { + _sound = sound; + _html = html; + } + + public String getSound() + { + return _sound; + } + + public String getHtml() + { + return _html; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java index 637314495a..15d03c6c01 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/bosses/Antharas/Antharas.java @@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI private static final int BOMBER = 29070; // Dragon Bomber private static final int HEART = 13001; // Heart of Warding private static final int CUBE = 31859; // Teleportation Cubic - private static final Map INVISIBLE_NPC = new HashMap<>(); + private static final Map INVISIBLE_NPC = new HashMap<>(); + static { INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735)); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/bosses/Core/Core.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/bosses/Core/Core.java index faed6f3a1d..740b90dc2e 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/bosses/Core/Core.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/bosses/Core/Core.java @@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI private static final int DOOM_WRAITH = 29008; private static final int SUSCEPTOR = 29011; // Spawns - private static final Map MINNION_SPAWNS = new HashMap<>(); + private static final Map 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)); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java index 64b38902b0..4484e3142e 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/others/ClassMaster/ClassMaster.java @@ -66,7 +66,8 @@ import ai.AbstractNpcAI; public final class ClassMaster extends AbstractNpcAI implements IXmlReader { // NPCs - private static final List CLASS_MASTERS = new ArrayList<>(); + private static final List CLASS_MASTERS = new ArrayList<>(); + static { CLASS_MASTERS.add(31756); // Mr. Cat CLASS_MASTERS.add(31757); // Queen of Hearts diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java index 24060ff7c5..bc147562e2 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/custom/NpcLocationInfo/NpcLocationInfo.java @@ -33,7 +33,8 @@ import ai.AbstractNpcAI; */ public class NpcLocationInfo extends AbstractNpcAI { - private static final List NPC = new ArrayList<>(); + private static final List NPC = new ArrayList<>(); + static { NPC.add(30598); NPC.add(30599); @@ -41,7 +42,8 @@ public class NpcLocationInfo extends AbstractNpcAI NPC.add(30601); NPC.add(30602); } - private static final List NPCRADAR = new ArrayList<>(); + private static final List NPCRADAR = new ArrayList<>(); + static { // Talking Island NPCRADAR.add(30006); // Gatekeeper Roxxy diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java index d8c01c550b..7ab1ce1371 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/ChangeAttributeCrystal.java @@ -1,87 +1,88 @@ -/* - * 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 . - */ -package handlers.itemhandlers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.gameserver.enums.ItemGrade; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.handler.IItemHandler; -import com.l2jmobius.gameserver.model.ItemInfo; -import com.l2jmobius.gameserver.model.actor.Playable; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; -import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; - -/** - * @author Mobius - */ -public class ChangeAttributeCrystal implements IItemHandler -{ +/* + * 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 . + */ +package handlers.itemhandlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.gameserver.enums.ItemGrade; +import com.l2jmobius.gameserver.enums.PrivateStoreType; +import com.l2jmobius.gameserver.handler.IItemHandler; +import com.l2jmobius.gameserver.model.ItemInfo; +import com.l2jmobius.gameserver.model.actor.Playable; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.SystemMessageId; +import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList; + +/** + * @author Mobius + */ +public class ChangeAttributeCrystal implements IItemHandler +{ private static final Map ITEM_GRADES = new HashMap<>(); - { - ITEM_GRADES.put(33502, ItemGrade.S); - ITEM_GRADES.put(35749, ItemGrade.R); - ITEM_GRADES.put(45817, ItemGrade.R); - } - - @Override - public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) - { - if (!playable.isPlayer()) - { - playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); - return false; - } - - final PlayerInstance player = playable.getActingPlayer(); - if (player.getPrivateStoreType() != PrivateStoreType.NONE) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); - return false; - } - - if (ITEM_GRADES.get(item.getId()) == null) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); - return false; - } - - final List itemList = new ArrayList<>(); - for (ItemInstance i : player.getInventory().getItems()) - { - if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) - { - itemList.add(new ItemInfo(i)); - } - } - - if (itemList.isEmpty()) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); - return false; - } - - player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); - return true; - } + static + { + ITEM_GRADES.put(33502, ItemGrade.S); + ITEM_GRADES.put(35749, ItemGrade.R); + ITEM_GRADES.put(45817, ItemGrade.R); + } + + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.getPrivateStoreType() != PrivateStoreType.NONE) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP)); + return false; + } + + if (ITEM_GRADES.get(item.getId()) == null) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED)); + return false; + } + + final List itemList = new ArrayList<>(); + for (ItemInstance i : player.getInventory().getItems()) + { + if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId()))) + { + itemList.add(new ItemInfo(i)); + } + } + + if (itemList.isEmpty()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST)); + return false; + } + + player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()]))); + return true; + } } \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java index cb1a8eb04c..aed9ee56e9 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00255_Tutorial/Q00255_Tutorial.java @@ -1,452 +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 . - */ -package quests.Q00255_Tutorial; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.l2jmobius.Config; -import com.l2jmobius.gameserver.enums.HtmlActionScope; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.Location; -import com.l2jmobius.gameserver.model.World; -import com.l2jmobius.gameserver.model.actor.Npc; -import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import com.l2jmobius.gameserver.model.events.EventType; -import com.l2jmobius.gameserver.model.events.ListenerRegisterType; -import com.l2jmobius.gameserver.model.events.annotations.Id; -import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; -import com.l2jmobius.gameserver.model.events.annotations.RegisterType; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; -import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark; -import com.l2jmobius.gameserver.model.holders.ItemHolder; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.model.quest.Quest; -import com.l2jmobius.gameserver.model.quest.QuestState; -import com.l2jmobius.gameserver.network.NpcStringId; -import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; -import com.l2jmobius.gameserver.network.serverpackets.PlaySound; -import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml; -import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml; -import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark; - -/** - * Tutorial Quest - * @author Mobius - */ -public class Q00255_Tutorial extends Quest -{ - // NPCs - private static final List NEWBIE_HELPERS = new ArrayList<>(); - { - NEWBIE_HELPERS.add(30009); // human fighter - NEWBIE_HELPERS.add(30019); // human mystic - NEWBIE_HELPERS.add(30400); // elf - NEWBIE_HELPERS.add(30131); // dark elf - NEWBIE_HELPERS.add(30575); // orc - NEWBIE_HELPERS.add(30530); // dwarf - } - private static final List SUPERVISORS = new ArrayList<>(); - { - SUPERVISORS.add(30008); // human fighter - SUPERVISORS.add(30017); // human mystic - SUPERVISORS.add(30370); // elf - SUPERVISORS.add(30129); // dark elf - SUPERVISORS.add(30573); // orc - SUPERVISORS.add(30528); // dwarf - } - // Monsters - private static final int[] GREMLINS = - { - 18342, // this is used for now - 20001 - }; - // Items - private static final int BLUE_GEM = 6353; - private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200); - private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100); - // Others - private static final Map STARTING_VOICE_HTML = new HashMap<>(); - { - STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html")); - STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html")); - STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html")); - STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html")); - STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html")); - STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html")); - STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html")); - STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html")); - STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html")); - } - private static final Map HELPER_LOCATION = new HashMap<>(); - { - HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109)); - HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568)); - HELPER_LOCATION.put(18, new Location(46112, 41200, -3504)); - HELPER_LOCATION.put(25, new Location(46112, 41200, -3504)); - HELPER_LOCATION.put(31, new Location(28384, 11056, -4233)); - HELPER_LOCATION.put(38, new Location(28384, 11056, -4233)); - HELPER_LOCATION.put(44, new Location(-56736, -113680, -672)); - HELPER_LOCATION.put(49, new Location(-56736, -113680, -672)); - HELPER_LOCATION.put(53, new Location(108567, -173994, -406)); - } - private static final Map COMPLETE_LOCATION = new HashMap<>(); - { - COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723)); - COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723)); - COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060)); - COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060)); - COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582)); - COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582)); - COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192)); - COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192)); - COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905)); - } - private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial "; - private static final int QUESTION_MARK_ID_1 = 1; - private static final int QUESTION_MARK_ID_2 = 5; - private static final int QUESTION_MARK_ID_3 = 28; - - public Q00255_Tutorial() - { - super(255); - addTalkId(NEWBIE_HELPERS); - addTalkId(SUPERVISORS); - addFirstTalkId(NEWBIE_HELPERS); - addFirstTalkId(SUPERVISORS); - addKillId(GREMLINS); - registerQuestItems(BLUE_GEM); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs == null) - { - return null; - } - - String htmltext = null; - switch (event) - { - case "start_newbie_tutorial": - { - if (qs.getMemoState() < 4) - { - qs.startQuest(); - qs.setMemoState(1); - playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound()); - showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml()); - } - break; - } - case "tutorial_02.html": - case "tutorial_03.html": - { - if (qs.isMemoState(1)) - { - showTutorialHtml(player, event); - } - break; - } - case "question_mark_1": - { - if (qs.isMemoState(1)) - { - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0)); - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - } - break; - } - case "reward_2": - { - if (qs.isMemoState(4)) - { - qs.setMemoState(5); - if (player.isMageClass() && (player.getRace() != Race.ORC)) - { - giveItems(player, SPIRITSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_027"); - } - else - { - giveItems(player, SOULSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_026"); - } - htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html"; - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0)); - } - break; - } - case "close_tutorial": - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - break; - } - } - return htmltext; - } - - @Override - public String onFirstTalk(Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - if (qs != null) - { - // start newbie helpers - if (NEWBIE_HELPERS.contains(npc.getId())) - { - if (hasQuestItems(player, BLUE_GEM)) - { - qs.setMemoState(3); - } - switch (qs.getMemoState()) - { - case 0: - case 1: - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - qs.setMemoState(2); - if (!player.isMageClass()) - { - return "tutorial_05_fighter.html"; - } - else if (player.getRace() == Race.ORC) - { - return "tutorial_05_mystic_orc.html"; - } - return "tutorial_05_mystic.html"; - } - case 2: - { - if (!player.isMageClass()) - { - return "tutorial_05_fighter_back.html"; - } - else if (player.getRace() == Race.ORC) - { - return "tutorial_05_mystic_orc_back.html"; - } - return "tutorial_05_mystic_back.html"; - } - case 3: - { - player.sendPacket(TutorialCloseHtml.STATIC_PACKET); - player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); - qs.setMemoState(4); - takeItems(player, BLUE_GEM, -1); - if (player.isMageClass() && (player.getRace() != Race.ORC)) - { - giveItems(player, SPIRITSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_027"); - return npc.getId() + "-3.html"; - } - giveItems(player, SOULSHOT_REWARD); - playTutorialVoice(player, "tutorial_voice_026"); - return npc.getId() + "-2.html"; - } - case 4: - { - return npc.getId() + "-4.html"; - } - case 5: - case 6: - { - return npc.getId() + "-5.html"; - } - } - } - // else supervisors - switch (qs.getMemoState()) - { - case 0: - case 1: - case 2: - case 3: - { - return npc.getId() + "-1.html"; - } - case 4: - { - return npc.getId() + "-2.html"; - } - case 5: - case 6: - { - return npc.getId() + "-4.html"; - } - } - } - return npc.getId() + "-1.html"; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getQuestState(killer, false); - if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30)) - { - // check for too many gems on ground - int counter = 0; - for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500)) - { - if (item.getId() == BLUE_GEM) - { - counter++; - } - } - if (counter < 10) // do not drop if more than 10 - { - npc.dropItem(killer, BLUE_GEM, 1); - } - } - return super.onKill(npc, killer, isSummon); - } - - @RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP) - @RegisterType(ListenerRegisterType.ITEM) - @Id(BLUE_GEM) - public void OnPlayerItemPickup(OnPlayerItemPickup event) - { - final PlayerInstance player = event.getPlayer(); - final QuestState qs = getQuestState(player, false); - if ((qs != null) && (qs.getMemoState() < 3)) - { - qs.setMemoState(3); - playSound(player, "ItemSound.quest_tutorial"); - playTutorialVoice(player, "tutorial_voice_013"); - player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0)); - } - } - - @RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event) - { - final QuestState qs = getQuestState(event.getPlayer(), false); - if (qs != null) - { - switch (event.getMarkId()) - { - case QUESTION_MARK_ID_1: - { - if (qs.isMemoState(1)) - { - showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000); - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); - showTutorialHtml(event.getPlayer(), "tutorial_04.html"); - } - break; - } - case QUESTION_MARK_ID_2: - { - if (qs.isMemoState(3)) - { - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); - showTutorialHtml(event.getPlayer(), "tutorial_06.html"); - } - break; - } - case QUESTION_MARK_ID_3: - { - if (qs.isMemoState(5)) - { - final int classId = event.getPlayer().getClassId().getId(); - addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ()); - playSound(event.getPlayer(), "ItemSound.quest_tutorial"); - } - break; - } - } - } - } - - @RegisterEvent(EventType.ON_PLAYER_BYPASS) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void OnPlayerBypass(OnPlayerBypass event) - { - final PlayerInstance player = event.getPlayer(); - if (event.getCommand().startsWith(TUTORIAL_BUYPASS)) - { - notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player); - } - } - - @RegisterEvent(EventType.ON_PLAYER_LOGIN) - @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) - public void OnPlayerLogin(OnPlayerLogin event) - { - if (Config.DISABLE_TUTORIAL) - { - return; - } - - final PlayerInstance player = event.getPlayer(); - if (player.getLevel() > 6) - { - return; - } - - QuestState qs = getQuestState(player, true); - if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId())) - { - startQuestTimer("start_newbie_tutorial", 5000, null, player); - } - } - - private void showTutorialHtml(PlayerInstance player, String html) - { - player.sendPacket(new TutorialShowHtml(getHtm(player, html))); - } - - public void playTutorialVoice(PlayerInstance player, String voice) - { - player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ())); - } - - private class QuestSoundHtmlHolder - { - private final String _sound; - private final String _html; - - QuestSoundHtmlHolder(String sound, String html) - { - _sound = sound; - _html = html; - } - - String getSound() - { - return _sound; - } - - String getHtml() - { - return _html; - } - } -} +/* + * 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 . + */ +package quests.Q00255_Tutorial; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.l2jmobius.Config; +import com.l2jmobius.gameserver.enums.HtmlActionScope; +import com.l2jmobius.gameserver.enums.Race; +import com.l2jmobius.gameserver.model.Location; +import com.l2jmobius.gameserver.model.World; +import com.l2jmobius.gameserver.model.actor.Npc; +import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import com.l2jmobius.gameserver.model.events.EventType; +import com.l2jmobius.gameserver.model.events.ListenerRegisterType; +import com.l2jmobius.gameserver.model.events.annotations.Id; +import com.l2jmobius.gameserver.model.events.annotations.RegisterEvent; +import com.l2jmobius.gameserver.model.events.annotations.RegisterType; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerBypass; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerItemPickup; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin; +import com.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerPressTutorialMark; +import com.l2jmobius.gameserver.model.holders.ItemHolder; +import com.l2jmobius.gameserver.model.holders.QuestSoundHtmlHolder; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.model.quest.Quest; +import com.l2jmobius.gameserver.model.quest.QuestState; +import com.l2jmobius.gameserver.network.NpcStringId; +import com.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; +import com.l2jmobius.gameserver.network.serverpackets.PlaySound; +import com.l2jmobius.gameserver.network.serverpackets.TutorialCloseHtml; +import com.l2jmobius.gameserver.network.serverpackets.TutorialShowHtml; +import com.l2jmobius.gameserver.network.serverpackets.TutorialShowQuestionMark; + +/** + * Tutorial Quest + * @author Mobius + */ +public class Q00255_Tutorial extends Quest +{ + // NPCs + private static final List NEWBIE_HELPERS = new ArrayList<>(); + static + { + NEWBIE_HELPERS.add(30009); // human fighter + NEWBIE_HELPERS.add(30019); // human mystic + NEWBIE_HELPERS.add(30400); // elf + NEWBIE_HELPERS.add(30131); // dark elf + NEWBIE_HELPERS.add(30575); // orc + NEWBIE_HELPERS.add(30530); // dwarf + } + private static final List SUPERVISORS = new ArrayList<>(); + static + { + SUPERVISORS.add(30008); // human fighter + SUPERVISORS.add(30017); // human mystic + SUPERVISORS.add(30370); // elf + SUPERVISORS.add(30129); // dark elf + SUPERVISORS.add(30573); // orc + SUPERVISORS.add(30528); // dwarf + } + // Monsters + private static final int[] GREMLINS = + { + 18342, // this is used for now + 20001 + }; + // Items + private static final int BLUE_GEM = 6353; + private static final ItemHolder SOULSHOT_REWARD = new ItemHolder(5789, 200); + private static final ItemHolder SPIRITSHOT_REWARD = new ItemHolder(5790, 100); + // Others + private static final Map STARTING_VOICE_HTML = new HashMap<>(); + static + { + STARTING_VOICE_HTML.put(0, new QuestSoundHtmlHolder("tutorial_voice_001a", "tutorial_human_fighter001.html")); + STARTING_VOICE_HTML.put(10, new QuestSoundHtmlHolder("tutorial_voice_001b", "tutorial_human_mage001.html")); + STARTING_VOICE_HTML.put(18, new QuestSoundHtmlHolder("tutorial_voice_001c", "tutorial_elven_fighter001.html")); + STARTING_VOICE_HTML.put(25, new QuestSoundHtmlHolder("tutorial_voice_001d", "tutorial_elven_mage001.html")); + STARTING_VOICE_HTML.put(31, new QuestSoundHtmlHolder("tutorial_voice_001e", "tutorial_delf_fighter001.html")); + STARTING_VOICE_HTML.put(38, new QuestSoundHtmlHolder("tutorial_voice_001f", "tutorial_delf_mage001.html")); + STARTING_VOICE_HTML.put(44, new QuestSoundHtmlHolder("tutorial_voice_001g", "tutorial_orc_fighter001.html")); + STARTING_VOICE_HTML.put(49, new QuestSoundHtmlHolder("tutorial_voice_001h", "tutorial_orc_mage001.html")); + STARTING_VOICE_HTML.put(53, new QuestSoundHtmlHolder("tutorial_voice_001i", "tutorial_dwarven_fighter001.html")); + } + private static final Map HELPER_LOCATION = new HashMap<>(); + static + { + HELPER_LOCATION.put(0, new Location(-71424, 258336, -3109)); + HELPER_LOCATION.put(10, new Location(-91036, 248044, -3568)); + HELPER_LOCATION.put(18, new Location(46112, 41200, -3504)); + HELPER_LOCATION.put(25, new Location(46112, 41200, -3504)); + HELPER_LOCATION.put(31, new Location(28384, 11056, -4233)); + HELPER_LOCATION.put(38, new Location(28384, 11056, -4233)); + HELPER_LOCATION.put(44, new Location(-56736, -113680, -672)); + HELPER_LOCATION.put(49, new Location(-56736, -113680, -672)); + HELPER_LOCATION.put(53, new Location(108567, -173994, -406)); + } + private static final Map COMPLETE_LOCATION = new HashMap<>(); + static + { + COMPLETE_LOCATION.put(0, new Location(-84081, 243227, -3723)); + COMPLETE_LOCATION.put(10, new Location(-84081, 243227, -3723)); + COMPLETE_LOCATION.put(18, new Location(45475, 48359, -3060)); + COMPLETE_LOCATION.put(25, new Location(45475, 48359, -3060)); + COMPLETE_LOCATION.put(31, new Location(12111, 16686, -4582)); + COMPLETE_LOCATION.put(38, new Location(12111, 16686, -4582)); + COMPLETE_LOCATION.put(44, new Location(-45032, -113598, -192)); + COMPLETE_LOCATION.put(49, new Location(-45032, -113598, -192)); + COMPLETE_LOCATION.put(53, new Location(115632, -177996, -905)); + } + private static final String TUTORIAL_BUYPASS = "Quest Q00255_Tutorial "; + private static final int QUESTION_MARK_ID_1 = 1; + private static final int QUESTION_MARK_ID_2 = 5; + private static final int QUESTION_MARK_ID_3 = 28; + + public Q00255_Tutorial() + { + super(255); + addTalkId(NEWBIE_HELPERS); + addTalkId(SUPERVISORS); + addFirstTalkId(NEWBIE_HELPERS); + addFirstTalkId(SUPERVISORS); + addKillId(GREMLINS); + registerQuestItems(BLUE_GEM); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs == null) + { + return null; + } + + String htmltext = null; + switch (event) + { + case "start_newbie_tutorial": + { + if (qs.getMemoState() < 4) + { + qs.startQuest(); + qs.setMemoState(1); + playTutorialVoice(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getSound()); + showTutorialHtml(player, STARTING_VOICE_HTML.get(player.getClassId().getId()).getHtml()); + } + break; + } + case "tutorial_02.html": + case "tutorial_03.html": + { + if (qs.isMemoState(1)) + { + showTutorialHtml(player, event); + } + break; + } + case "question_mark_1": + { + if (qs.isMemoState(1)) + { + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_1, 0)); + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + } + break; + } + case "reward_2": + { + if (qs.isMemoState(4)) + { + qs.setMemoState(5); + if (player.isMageClass() && (player.getRace() != Race.ORC)) + { + giveItems(player, SPIRITSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_027"); + } + else + { + giveItems(player, SOULSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_026"); + } + htmltext = (npc != null ? npc.getId() : player.getTarget().getId()) + "-3.html"; + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_3, 0)); + } + break; + } + case "close_tutorial": + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + break; + } + } + return htmltext; + } + + @Override + public String onFirstTalk(Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + if (qs != null) + { + // start newbie helpers + if (NEWBIE_HELPERS.contains(npc.getId())) + { + if (hasQuestItems(player, BLUE_GEM)) + { + qs.setMemoState(3); + } + switch (qs.getMemoState()) + { + case 0: + case 1: + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + qs.setMemoState(2); + if (!player.isMageClass()) + { + return "tutorial_05_fighter.html"; + } + else if (player.getRace() == Race.ORC) + { + return "tutorial_05_mystic_orc.html"; + } + return "tutorial_05_mystic.html"; + } + case 2: + { + if (!player.isMageClass()) + { + return "tutorial_05_fighter_back.html"; + } + else if (player.getRace() == Race.ORC) + { + return "tutorial_05_mystic_orc_back.html"; + } + return "tutorial_05_mystic_back.html"; + } + case 3: + { + player.sendPacket(TutorialCloseHtml.STATIC_PACKET); + player.clearHtmlActions(HtmlActionScope.TUTORIAL_HTML); + qs.setMemoState(4); + takeItems(player, BLUE_GEM, -1); + if (player.isMageClass() && (player.getRace() != Race.ORC)) + { + giveItems(player, SPIRITSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_027"); + return npc.getId() + "-3.html"; + } + giveItems(player, SOULSHOT_REWARD); + playTutorialVoice(player, "tutorial_voice_026"); + return npc.getId() + "-2.html"; + } + case 4: + { + return npc.getId() + "-4.html"; + } + case 5: + case 6: + { + return npc.getId() + "-5.html"; + } + } + } + // else supervisors + switch (qs.getMemoState()) + { + case 0: + case 1: + case 2: + case 3: + { + return npc.getId() + "-1.html"; + } + case 4: + { + return npc.getId() + "-2.html"; + } + case 5: + case 6: + { + return npc.getId() + "-4.html"; + } + } + } + return npc.getId() + "-1.html"; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getQuestState(killer, false); + if ((qs != null) && qs.isMemoState(2) && !hasQuestItems(killer, BLUE_GEM) && (getRandom(100) < 30)) + { + // check for too many gems on ground + int counter = 0; + for (ItemInstance item : World.getInstance().getVisibleObjectsInRange(killer, ItemInstance.class, 1500)) + { + if (item.getId() == BLUE_GEM) + { + counter++; + } + } + if (counter < 10) // do not drop if more than 10 + { + npc.dropItem(killer, BLUE_GEM, 1); + } + } + return super.onKill(npc, killer, isSummon); + } + + @RegisterEvent(EventType.ON_PLAYER_ITEM_PICKUP) + @RegisterType(ListenerRegisterType.ITEM) + @Id(BLUE_GEM) + public void OnPlayerItemPickup(OnPlayerItemPickup event) + { + final PlayerInstance player = event.getPlayer(); + final QuestState qs = getQuestState(player, false); + if ((qs != null) && (qs.getMemoState() < 3)) + { + qs.setMemoState(3); + playSound(player, "ItemSound.quest_tutorial"); + playTutorialVoice(player, "tutorial_voice_013"); + player.sendPacket(new TutorialShowQuestionMark(QUESTION_MARK_ID_2, 0)); + } + } + + @RegisterEvent(EventType.ON_PLAYER_PRESS_TUTORIAL_MARK) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void onPlayerPressTutorialMark(OnPlayerPressTutorialMark event) + { + final QuestState qs = getQuestState(event.getPlayer(), false); + if (qs != null) + { + switch (event.getMarkId()) + { + case QUESTION_MARK_ID_1: + { + if (qs.isMemoState(1)) + { + showOnScreenMsg(event.getPlayer(), NpcStringId.SPEAK_WITH_THE_NEWBIE_HELPER, ExShowScreenMessage.TOP_CENTER, 5000); + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); + showTutorialHtml(event.getPlayer(), "tutorial_04.html"); + } + break; + } + case QUESTION_MARK_ID_2: + { + if (qs.isMemoState(3)) + { + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), HELPER_LOCATION.get(classId).getX(), HELPER_LOCATION.get(classId).getY(), HELPER_LOCATION.get(classId).getZ()); + showTutorialHtml(event.getPlayer(), "tutorial_06.html"); + } + break; + } + case QUESTION_MARK_ID_3: + { + if (qs.isMemoState(5)) + { + final int classId = event.getPlayer().getClassId().getId(); + addRadar(event.getPlayer(), COMPLETE_LOCATION.get(classId).getX(), COMPLETE_LOCATION.get(classId).getY(), COMPLETE_LOCATION.get(classId).getZ()); + playSound(event.getPlayer(), "ItemSound.quest_tutorial"); + } + break; + } + } + } + } + + @RegisterEvent(EventType.ON_PLAYER_BYPASS) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void OnPlayerBypass(OnPlayerBypass event) + { + final PlayerInstance player = event.getPlayer(); + if (event.getCommand().startsWith(TUTORIAL_BUYPASS)) + { + notifyEvent(event.getCommand().replace(TUTORIAL_BUYPASS, ""), null, player); + } + } + + @RegisterEvent(EventType.ON_PLAYER_LOGIN) + @RegisterType(ListenerRegisterType.GLOBAL_PLAYERS) + public void OnPlayerLogin(OnPlayerLogin event) + { + if (Config.DISABLE_TUTORIAL) + { + return; + } + + final PlayerInstance player = event.getPlayer(); + if (player.getLevel() > 6) + { + return; + } + + QuestState qs = getQuestState(player, true); + if ((qs != null) && (qs.getMemoState() < 4) && STARTING_VOICE_HTML.containsKey(player.getClassId().getId())) + { + startQuestTimer("start_newbie_tutorial", 5000, null, player); + } + } + + private void showTutorialHtml(PlayerInstance player, String html) + { + player.sendPacket(new TutorialShowHtml(getHtm(player, html))); + } + + public void playTutorialVoice(PlayerInstance player, String voice) + { + player.sendPacket(new PlaySound(2, voice, 0, 0, player.getX(), player.getY(), player.getZ())); + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java index ba4b7c68a1..c353643195 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00257_TheGuardIsBusy/Q00257_TheGuardIsBusy.java @@ -64,7 +64,6 @@ public final class Q00257_TheGuardIsBusy extends Quest private static final int ORC_AMULET = 752; private static final int ORC_NECKLACE = 1085; private static final int WEREWOLF_FANG = 1086; - static { MONSTERS.put(20006, Arrays.asList(new MobDrop(10, 2, ORC_AMULET, 2), new MobDrop(10, 10, ORC_AMULET, 1))); // Orc Archer diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java index dba6bc1a20..8ba5fa8a7e 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00276_TotemOfTheHestui/Q00276_TotemOfTheHestui.java @@ -54,7 +54,6 @@ public final class Q00276_TotemOfTheHestui extends Quest // Misc private static final List SPAWN_CHANCES = new ArrayList<>(); private static final int MIN_LVL = 15; - static { SPAWN_CHANCES.add(new ItemHolder(79, 100)); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java index cb7f9107c3..2de9d8c594 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00327_RecoverTheFarmland/Q00327_RecoverTheFarmland.java @@ -78,7 +78,6 @@ public final class Q00327_RecoverTheFarmland extends Quest new ItemHolder(ANCIENT_BRONZE_MIRROR, 3227), new ItemHolder(ANCIENT_JADE_NECKLACE, 3919) }; - static { FRAGMENTS_REWARD_DATA.put("30034-03.html", new ItemHolder(CLAY_URN_FRAGMENT, 307)); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java index 205193f1cf..a7c0af9e20 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00344_1000YearsTheEndOfLamentation/Q00344_1000YearsTheEndOfLamentation.java @@ -1,378 +1,379 @@ -/* - * 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 . - */ -package quests.Q00344_1000YearsTheEndOfLamentation; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.gameserver.model.actor.Npc; -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; - -/** - * 1000 years, the End of Lamentation (344) - * @author Pandragon - */ -public final class Q00344_1000YearsTheEndOfLamentation extends Quest -{ - // NPCs - private static final int KAIEN = 30623; - private static final int GARVARENTZ = 30704; - private static final int GILMORE = 30754; - private static final int RODEMAI = 30756; - private static final int ORVEN = 30857; - // Items - private static final int ARTICLES = 4269; - private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); - private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); - private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); - private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); - // Monsters +/* + * 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 . + */ +package quests.Q00344_1000YearsTheEndOfLamentation; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.gameserver.model.actor.Npc; +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; + +/** + * 1000 years, the End of Lamentation (344) + * @author Pandragon + */ +public final class Q00344_1000YearsTheEndOfLamentation extends Quest +{ + // NPCs + private static final int KAIEN = 30623; + private static final int GARVARENTZ = 30704; + private static final int GILMORE = 30754; + private static final int RODEMAI = 30756; + private static final int ORVEN = 30857; + // Items + private static final int ARTICLES = 4269; + private static final ItemHolder OLD_KEY = new ItemHolder(4270, 1); + private static final ItemHolder OLD_HILT = new ItemHolder(4271, 1); + private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1); + private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1); + // Monsters private static final Map MONSTER_CHANCES = new HashMap<>(); - { - MONSTER_CHANCES.put(20236, 0.58); // Cave Servant - MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant - MONSTER_CHANCES.put(20272, 0.58); // Cave Servant - MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer - MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior - MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain - MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant - } - // Rewards - private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); - private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); - private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); - private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); - private static final ItemHolder COKES = new ItemHolder(1879, 55); - private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); - private static final ItemHolder LEATHER = new ItemHolder(1882, 70); - private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); - private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); - private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); - private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); - private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); - // Misc - private static final int MIN_LVL = 48; - - public Q00344_1000YearsTheEndOfLamentation() - { - super(344); - addStartNpc(GILMORE); - addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); - addKillId(MONSTER_CHANCES.keySet()); - registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); - } - - @Override - public String onAdvEvent(String event, Npc npc, PlayerInstance player) - { - final QuestState qs = getQuestState(player, false); - String htmltext = null; - if (qs == null) - { - return htmltext; - } - - switch (event) - { - case "30754-03.htm": - case "30754-16.html": - { - htmltext = event; - break; - } - case "30754-04.htm": - { - if (qs.isCreated()) - { - qs.startQuest(); - htmltext = event; - } - break; - } - case "30754-08.html": - { - if (qs.isCond(1)) - { - final long count = getQuestItemsCount(player, ARTICLES); - if (count < 1) - { - htmltext = "30754-07.html"; - } - else - { - takeItems(player, ARTICLES, -1); - if (getRandom(1000) >= count) - { - giveAdena(player, count * 60, true); - htmltext = event; - } - else - { - qs.setCond(2, true); - switch (getRandom(4)) - { - case 0: - { - qs.setMemoState(1); - giveItems(player, OLD_HILT); - break; - } - case 1: - { - qs.setMemoState(2); - giveItems(player, OLD_KEY); - break; - } - case 2: - { - qs.setMemoState(3); - giveItems(player, TOTEM_NECKLACE); - break; - } - case 3: - { - qs.setMemoState(4); - giveItems(player, CRUCIFIX); - break; - } - } - htmltext = "30754-09.html"; - } - } - } - break; - } - case "30754-17.html": - { - if (qs.isCond(1)) - { - htmltext = event; - qs.exitQuest(true, true); - } - break; - } - case "relic_info": - { - switch (qs.getMemoState()) - { - case 1: - { - htmltext = "30754-10.html"; - break; - } - case 2: - { - htmltext = "30754-11.html"; - break; - } - case 3: - { - htmltext = "30754-12.html"; - break; - } - case 4: - { - htmltext = "30754-13.html"; - break; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onTalk(Npc npc, PlayerInstance talker) - { - final QuestState qs = getQuestState(talker, true); - String htmltext = getNoQuestMsg(talker); - switch (npc.getId()) - { - case GILMORE: - { - if (qs.isCreated()) - { - htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; - } - else if (qs.isStarted()) - { - if (qs.isCond(1)) - { - htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; - } - else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) - { - htmltext = "30754-14.html"; - } - else - { - qs.setCond(1); - htmltext = "30754-15.html"; - } - } - else - { - htmltext = getAlreadyCompletedMsg(talker); - } - break; - } - case KAIEN: - { - if (qs.getMemoState() == 1) - { - if (hasItem(talker, OLD_HILT)) - { - takeItems(talker, OLD_HILT.getId(), -1); - final int rand = getRandom(100); - if (rand <= 52) - { - rewardItems(talker, ORIHARUKON_ORE); - } - else if (rand <= 76) - { - rewardItems(talker, VARNISH_OF_PURITY); - } - else if (rand <= 98) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RAID_SWORD); - } - qs.setCond(1); - htmltext = "30623-01.html"; - } - else - { - htmltext = "30623-02.html"; - } - } - break; - } - case RODEMAI: - { - if (qs.getMemoState() == 2) - { - if (hasItem(talker, OLD_KEY)) - { - takeItems(talker, OLD_KEY.getId(), -1); - final int rand = getRandom(100); - if (rand <= 39) - { - rewardItems(talker, COKES); - } - else if (rand <= 89) - { - rewardItems(talker, SCROLL_EWC); - } - else - { - rewardItems(talker, RING_OF_AGES); - } - qs.setCond(1); - htmltext = "30756-01.html"; - } - else - { - htmltext = "30756-02.html"; - } - } - break; - } - case GARVARENTZ: - { - if (qs.getMemoState() == 3) - { - if (hasItem(talker, TOTEM_NECKLACE)) - { - takeItems(talker, TOTEM_NECKLACE.getId(), -1); - final int rand = getRandom(100); - if (rand <= 47) - { - rewardItems(talker, LEATHER); - } - else if (rand <= 97) - { - rewardItems(talker, COARSE_BONE_POWDER); - } - else - { - rewardItems(talker, HEAVY_DOOM_HAMMER); - } - qs.setCond(1); - htmltext = "30704-01.html"; - } - else - { - htmltext = "30704-02.html"; - } - } - break; - } - case ORVEN: - { - if (qs.getMemoState() == 4) - { - if (hasItem(talker, CRUCIFIX)) - { - takeItems(talker, CRUCIFIX.getId(), -1); - final int rand = getRandom(100); - if (rand <= 49) - { - rewardItems(talker, STONE_OF_PURITY); - } - else if (rand <= 69) - { - rewardItems(talker, SCROLL_EAC); - } - else - { - rewardItems(talker, DRAKE_LEATHER_BOOTS); - } - qs.setCond(1); - htmltext = "30857-01.html"; - } - else - { - htmltext = "30857-02.html"; - } - } - break; - } - } - return htmltext; - } - - @Override - public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) - { - final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); - if (qs != null) - { - giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); - } - return super.onKill(npc, killer, isSummon); - } -} + static + { + MONSTER_CHANCES.put(20236, 0.58); // Cave Servant + MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20237, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20239, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20240, 0.85); // Royal Cave Servant + MONSTER_CHANCES.put(20272, 0.58); // Cave Servant + MONSTER_CHANCES.put(20273, 0.78); // Cave Servant Archer + MONSTER_CHANCES.put(20274, 0.75); // Cave Servant Warrior + MONSTER_CHANCES.put(20275, 0.79); // Cave Servant Captain + MONSTER_CHANCES.put(20276, 0.85); // Royal Cave Servant + } + // Rewards + private static final ItemHolder ORIHARUKON_ORE = new ItemHolder(1874, 25); + private static final ItemHolder VARNISH_OF_PURITY = new ItemHolder(1887, 10); + private static final ItemHolder SCROLL_EWC = new ItemHolder(951, 1); + private static final ItemHolder RAID_SWORD = new ItemHolder(133, 1); + private static final ItemHolder COKES = new ItemHolder(1879, 55); + private static final ItemHolder RING_OF_AGES = new ItemHolder(885, 1); + private static final ItemHolder LEATHER = new ItemHolder(1882, 70); + private static final ItemHolder COARSE_BONE_POWDER = new ItemHolder(1881, 50); + private static final ItemHolder HEAVY_DOOM_HAMMER = new ItemHolder(191, 1); + private static final ItemHolder STONE_OF_PURITY = new ItemHolder(1875, 19); + private static final ItemHolder SCROLL_EAC = new ItemHolder(952, 5); + private static final ItemHolder DRAKE_LEATHER_BOOTS = new ItemHolder(2437, 1); + // Misc + private static final int MIN_LVL = 48; + + public Q00344_1000YearsTheEndOfLamentation() + { + super(344); + addStartNpc(GILMORE); + addTalkId(KAIEN, GARVARENTZ, GILMORE, RODEMAI, ORVEN); + addKillId(MONSTER_CHANCES.keySet()); + registerQuestItems(ARTICLES, OLD_KEY.getId(), OLD_HILT.getId(), TOTEM_NECKLACE.getId(), CRUCIFIX.getId()); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + final QuestState qs = getQuestState(player, false); + String htmltext = null; + if (qs == null) + { + return htmltext; + } + + switch (event) + { + case "30754-03.htm": + case "30754-16.html": + { + htmltext = event; + break; + } + case "30754-04.htm": + { + if (qs.isCreated()) + { + qs.startQuest(); + htmltext = event; + } + break; + } + case "30754-08.html": + { + if (qs.isCond(1)) + { + final long count = getQuestItemsCount(player, ARTICLES); + if (count < 1) + { + htmltext = "30754-07.html"; + } + else + { + takeItems(player, ARTICLES, -1); + if (getRandom(1000) >= count) + { + giveAdena(player, count * 60, true); + htmltext = event; + } + else + { + qs.setCond(2, true); + switch (getRandom(4)) + { + case 0: + { + qs.setMemoState(1); + giveItems(player, OLD_HILT); + break; + } + case 1: + { + qs.setMemoState(2); + giveItems(player, OLD_KEY); + break; + } + case 2: + { + qs.setMemoState(3); + giveItems(player, TOTEM_NECKLACE); + break; + } + case 3: + { + qs.setMemoState(4); + giveItems(player, CRUCIFIX); + break; + } + } + htmltext = "30754-09.html"; + } + } + } + break; + } + case "30754-17.html": + { + if (qs.isCond(1)) + { + htmltext = event; + qs.exitQuest(true, true); + } + break; + } + case "relic_info": + { + switch (qs.getMemoState()) + { + case 1: + { + htmltext = "30754-10.html"; + break; + } + case 2: + { + htmltext = "30754-11.html"; + break; + } + case 3: + { + htmltext = "30754-12.html"; + break; + } + case 4: + { + htmltext = "30754-13.html"; + break; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onTalk(Npc npc, PlayerInstance talker) + { + final QuestState qs = getQuestState(talker, true); + String htmltext = getNoQuestMsg(talker); + switch (npc.getId()) + { + case GILMORE: + { + if (qs.isCreated()) + { + htmltext = (talker.getLevel() >= MIN_LVL) ? "30754-02.htm" : "30754-01.htm"; + } + else if (qs.isStarted()) + { + if (qs.isCond(1)) + { + htmltext = (hasQuestItems(talker, ARTICLES)) ? "30754-06.html" : "30754-05.html"; + } + else if (hasItem(talker, OLD_KEY) || hasItem(talker, OLD_HILT) || hasItem(talker, TOTEM_NECKLACE) || hasItem(talker, CRUCIFIX)) + { + htmltext = "30754-14.html"; + } + else + { + qs.setCond(1); + htmltext = "30754-15.html"; + } + } + else + { + htmltext = getAlreadyCompletedMsg(talker); + } + break; + } + case KAIEN: + { + if (qs.getMemoState() == 1) + { + if (hasItem(talker, OLD_HILT)) + { + takeItems(talker, OLD_HILT.getId(), -1); + final int rand = getRandom(100); + if (rand <= 52) + { + rewardItems(talker, ORIHARUKON_ORE); + } + else if (rand <= 76) + { + rewardItems(talker, VARNISH_OF_PURITY); + } + else if (rand <= 98) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RAID_SWORD); + } + qs.setCond(1); + htmltext = "30623-01.html"; + } + else + { + htmltext = "30623-02.html"; + } + } + break; + } + case RODEMAI: + { + if (qs.getMemoState() == 2) + { + if (hasItem(talker, OLD_KEY)) + { + takeItems(talker, OLD_KEY.getId(), -1); + final int rand = getRandom(100); + if (rand <= 39) + { + rewardItems(talker, COKES); + } + else if (rand <= 89) + { + rewardItems(talker, SCROLL_EWC); + } + else + { + rewardItems(talker, RING_OF_AGES); + } + qs.setCond(1); + htmltext = "30756-01.html"; + } + else + { + htmltext = "30756-02.html"; + } + } + break; + } + case GARVARENTZ: + { + if (qs.getMemoState() == 3) + { + if (hasItem(talker, TOTEM_NECKLACE)) + { + takeItems(talker, TOTEM_NECKLACE.getId(), -1); + final int rand = getRandom(100); + if (rand <= 47) + { + rewardItems(talker, LEATHER); + } + else if (rand <= 97) + { + rewardItems(talker, COARSE_BONE_POWDER); + } + else + { + rewardItems(talker, HEAVY_DOOM_HAMMER); + } + qs.setCond(1); + htmltext = "30704-01.html"; + } + else + { + htmltext = "30704-02.html"; + } + } + break; + } + case ORVEN: + { + if (qs.getMemoState() == 4) + { + if (hasItem(talker, CRUCIFIX)) + { + takeItems(talker, CRUCIFIX.getId(), -1); + final int rand = getRandom(100); + if (rand <= 49) + { + rewardItems(talker, STONE_OF_PURITY); + } + else if (rand <= 69) + { + rewardItems(talker, SCROLL_EAC); + } + else + { + rewardItems(talker, DRAKE_LEATHER_BOOTS); + } + qs.setCond(1); + htmltext = "30857-01.html"; + } + else + { + htmltext = "30857-02.html"; + } + } + break; + } + } + return htmltext; + } + + @Override + public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) + { + final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc); + if (qs != null) + { + giveItemRandomly(qs.getPlayer(), npc, ARTICLES, 1, 0, MONSTER_CHANCES.get(npc.getId()), true); + } + return super.onKill(npc, killer, isSummon); + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java index 23f31ff434..30e5cd8384 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00360_PlunderTheirSupplies/Q00360_PlunderTheirSupplies.java @@ -42,7 +42,6 @@ public final class Q00360_PlunderTheirSupplies extends Quest private static final Map MONSTER_DROP_CHANCES = new HashMap<>(); // Item private static final int SUPPLY_ITEMS = 5872; - static { MONSTER_DROP_CHANCES.put(20666, 50); // Taik Orc Seeker diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java index 9ce09adabf..f518800b8c 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/quests/Q00416_PathOfTheOrcShaman/Q00416_PathOfTheOrcShaman.java @@ -68,7 +68,6 @@ public final class Q00416_PathOfTheOrcShaman extends Quest private static final int MIN_LEVEL = 19; // Mobs private static final Map MOBS = new HashMap<>(); - static { MOBS.put(20415, new ItemChanceHolder(FIRST_FIERY_EGG, 1.0, 1)); // scarlet_salamander diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java new file mode 100644 index 0000000000..f7a0a82059 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/holders/QuestSoundHtmlHolder.java @@ -0,0 +1,42 @@ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.holders; + +/** + * @author Mobius + */ +public class QuestSoundHtmlHolder +{ + private final String _sound; + private final String _html; + + public QuestSoundHtmlHolder(String sound, String html) + { + _sound = sound; + _html = html; + } + + public String getSound() + { + return _sound; + } + + public String getHtml() + { + return _html; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java index b6cbca35fd..449738e397 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/skills/MountEnabledSkillList.java @@ -1,37 +1,38 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.model.skills; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Mobius - */ -public class MountEnabledSkillList -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.model.skills; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Mobius + */ +public class MountEnabledSkillList +{ private final static List ENABLED_SKILLS = new ArrayList<>(2); - { - ENABLED_SKILLS.add(4289); // Wyvern Breath - ENABLED_SKILLS.add(325); // Strider Siege Assault - } - - public static boolean contains(int skillId) - { - return ENABLED_SKILLS.contains(skillId); - } -} + static + { + ENABLED_SKILLS.add(4289); // Wyvern Breath + ENABLED_SKILLS.add(325); // Strider Siege Assault + } + + public static boolean contains(int skillId) + { + return ENABLED_SKILLS.contains(skillId); + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java index ef93f5128c..d3c810242d 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/network/serverpackets/attributechange/ExChangeAttributeInfo.java @@ -1,69 +1,70 @@ -/* - * 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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.attributechange; - -import java.util.HashMap; -import java.util.Map; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.AttributeType; -import com.l2jmobius.gameserver.model.items.instance.ItemInstance; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Mobius - */ -public class ExChangeAttributeInfo implements IClientOutgoingPacket -{ +/* + * 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 . + */ +package com.l2jmobius.gameserver.network.serverpackets.attributechange; + +import java.util.HashMap; +import java.util.Map; + +import com.l2jmobius.commons.network.PacketWriter; +import com.l2jmobius.gameserver.enums.AttributeType; +import com.l2jmobius.gameserver.model.items.instance.ItemInstance; +import com.l2jmobius.gameserver.network.OutgoingPackets; +import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * @author Mobius + */ +public class ExChangeAttributeInfo implements IClientOutgoingPacket +{ private static final Map ATTRIBUTE_MASKS = new HashMap<>(); - { - ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); - ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); - ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); - ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); - ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); - ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); - } - - private final int _crystalItemId; - private int _attributes; - private int _itemObjId; - - public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) - { - _crystalItemId = crystalItemId; - _attributes = 0; - for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) - { - if (e != item.getAttackAttributeType()) - { - _attributes |= ATTRIBUTE_MASKS.get(e); - } - } - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); - packet.writeD(_crystalItemId); - packet.writeD(_attributes); - packet.writeD(_itemObjId); - return true; - } + static + { + ATTRIBUTE_MASKS.put(AttributeType.FIRE, (byte) 1); + ATTRIBUTE_MASKS.put(AttributeType.WATER, (byte) 2); + ATTRIBUTE_MASKS.put(AttributeType.WIND, (byte) 4); + ATTRIBUTE_MASKS.put(AttributeType.EARTH, (byte) 8); + ATTRIBUTE_MASKS.put(AttributeType.HOLY, (byte) 16); + ATTRIBUTE_MASKS.put(AttributeType.DARK, (byte) 32); + } + + private final int _crystalItemId; + private int _attributes; + private int _itemObjId; + + public ExChangeAttributeInfo(int crystalItemId, ItemInstance item) + { + _crystalItemId = crystalItemId; + _attributes = 0; + for (AttributeType e : AttributeType.ATTRIBUTE_TYPES) + { + if (e != item.getAttackAttributeType()) + { + _attributes |= ATTRIBUTE_MASKS.get(e); + } + } + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_CHANGE_ATTRIBUTE_INFO.writeId(packet); + packet.writeD(_crystalItemId); + packet.writeD(_attributes); + packet.writeD(_itemObjId); + return true; + } } \ No newline at end of file