diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Amaskari.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Amaskari.java index 37c4a8435a208adf7489bc5fed3e2937150814d9..fa8f199a195f896479848cfd62cf6524c9f9012e 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Amaskari.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Amaskari.java @@ -29,7 +29,6 @@ import com.l2jserver.gameserver.model.skills.BuffInfo; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; import hellbound.HellboundEngine; @@ -39,9 +38,11 @@ import hellbound.HellboundEngine; */ public final class Amaskari extends AbstractNpcAI { + // NPCs private static final int AMASKARI = 22449; private static final int AMASKARI_PRISONER = 22450; - + // Skills + // private static SkillHolder INVINCIBILITY = new SkillHolder(5417, 1); private static final int BUFF_ID = 4632; private static SkillHolder[] BUFF = { @@ -49,8 +50,7 @@ public final class Amaskari extends AbstractNpcAI new SkillHolder(BUFF_ID, 2), new SkillHolder(BUFF_ID, 3) }; - // private static SkillHolder INVINCIBILITY = new SkillHolder(5417, 1); - + // Misc private static final NpcStringId[] AMASKARI_NPCSTRING_ID = { NpcStringId.ILL_MAKE_EVERYONE_FEEL_THE_SAME_SUFFERING_AS_ME, @@ -58,7 +58,6 @@ public final class Amaskari extends AbstractNpcAI NpcStringId.MORE_NEED_MORE_SEVERE_PAIN, NpcStringId.SOMETHING_IS_BURNING_INSIDE_MY_BODY }; - private static final NpcStringId[] MINIONS_NPCSTRING_ID = { NpcStringId.AHH_MY_LIFE_IS_BEING_DRAINED_OUT, @@ -80,7 +79,7 @@ public final class Amaskari extends AbstractNpcAI { if (event.equalsIgnoreCase("stop_toggle")) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), AMASKARI_NPCSTRING_ID[2])); + broadcastNpcSay(npc, Say2.NPC_ALL, AMASKARI_NPCSTRING_ID[2]); ((L2MonsterInstance) npc).clearAggroList(); ((L2MonsterInstance) npc).getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); npc.setIsInvul(false); @@ -90,11 +89,11 @@ public final class Amaskari extends AbstractNpcAI { if (getRandom(100) > 20) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), MINIONS_NPCSTRING_ID[2])); + broadcastNpcSay(npc, Say2.NPC_ALL, MINIONS_NPCSTRING_ID[2]); } else if (getRandom(100) > 40) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), MINIONS_NPCSTRING_ID[3])); + broadcastNpcSay(npc, Say2.NPC_ALL, MINIONS_NPCSTRING_ID[3]); } startQuestTimer("onspawn_msg", (getRandom(8) + 1) * 30000, npc, null); } @@ -106,12 +105,12 @@ public final class Amaskari extends AbstractNpcAI { if ((npc.getId() == AMASKARI) && (getRandom(1000) < 25)) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), AMASKARI_NPCSTRING_ID[0])); + broadcastNpcSay(npc, Say2.NPC_ALL, AMASKARI_NPCSTRING_ID[0]); for (L2MonsterInstance minion : ((L2MonsterInstance) npc).getMinionList().getSpawnedMinions()) { if ((minion != null) && !minion.isDead() && (getRandom(10) == 0)) { - minion.broadcastPacket(new NpcSay(minion.getObjectId(), Say2.NPC_ALL, minion.getId(), MINIONS_NPCSTRING_ID[0])); + broadcastNpcSay(minion, Say2.NPC_ALL, MINIONS_NPCSTRING_ID[0]); minion.setCurrentHp(minion.getCurrentHp() - (minion.getCurrentHp() / 5)); } } @@ -127,7 +126,7 @@ public final class Amaskari extends AbstractNpcAI final L2MonsterInstance master = ((L2MonsterInstance) npc).getLeader(); if ((master != null) && !master.isDead()) { - master.broadcastPacket(new NpcSay(master.getObjectId(), Say2.NPC_ALL, master.getId(), AMASKARI_NPCSTRING_ID[1])); + broadcastNpcSay(master, Say2.NPC_ALL, AMASKARI_NPCSTRING_ID[1]); final BuffInfo info = master.getEffectList().getBuffInfoBySkillId(BUFF_ID); if ((info != null) && (info.getSkill().getAbnormalLvl() == 3) && master.isInvul()) { @@ -147,7 +146,7 @@ public final class Amaskari extends AbstractNpcAI } else { - master.broadcastPacket(new NpcSay(master.getObjectId(), Say2.NPC_ALL, master.getId(), AMASKARI_NPCSTRING_ID[3])); + broadcastNpcSay(master, Say2.NPC_ALL, AMASKARI_NPCSTRING_ID[3]); // master.doCast(INVINCIBILITY.getSkill()) master.setIsInvul(true); startQuestTimer("stop_toggle", 10000, master, null); @@ -163,9 +162,8 @@ public final class Amaskari extends AbstractNpcAI { if (getRandom(1000) > 300) { - minion.broadcastPacket(new NpcSay(minion.getObjectId(), Say2.NPC_ALL, minion.getId(), MINIONS_NPCSTRING_ID[1])); + broadcastNpcSay(minion, Say2.NPC_ALL, MINIONS_NPCSTRING_ID[1]); } - HellboundEngine.getInstance().updateTrust(30, true); minion.deleteMe(); } @@ -183,4 +181,4 @@ public final class Amaskari extends AbstractNpcAI } return super.onSpawn(npc); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Chimeras.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Chimeras.java index dff164d72aa6bd5c51c7c2b19764952d30d3f069..e0712f2efc1c16e0e4372911216910a25611f624 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Chimeras.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Chimeras.java @@ -23,7 +23,6 @@ import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.Location; -import com.l2jserver.gameserver.model.actor.L2Attackable; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.skills.Skill; @@ -34,18 +33,17 @@ import hellbound.HellboundEngine; * Chimeras AI. * @author DS */ -public class Chimeras extends AbstractNpcAI +public final class Chimeras extends AbstractNpcAI { // NPCs private static final int[] NPCS = { - 22349, - 22350, - 22351, - 22352 + 22349, // Chimera of Earth + 22350, // Chimera of Darkness + 22351, // Chimera of Wind + 22352, // Chimera of Fire }; private static final int CELTUS = 22353; - // Locations private static final Location[] LOCATIONS = { @@ -54,9 +52,9 @@ public class Chimeras extends AbstractNpcAI new Location(7222, 240617, -2033), new Location(9969, 235570, -1993) }; - + // Skills + private static final int BOTTLE = 2359; // Magic Bottle // Items - private static final int BOTTLE = 2359; private static final int DIM_LIFE_FORCE = 9680; private static final int LIFE_FORCE = 9681; private static final int CONTAINED_LIFE_FORCE = 9682; @@ -107,11 +105,11 @@ public class Chimeras extends AbstractNpcAI { if (getRandom(100) < 80) { - ((L2Attackable) npc).dropItem(caster, DIM_LIFE_FORCE, 1); + npc.dropItem(caster, DIM_LIFE_FORCE, 1); } else if (getRandom(100) < 80) { - ((L2Attackable) npc).dropItem(caster, LIFE_FORCE, 1); + npc.dropItem(caster, LIFE_FORCE, 1); } } npc.onDecay(); @@ -138,4 +136,4 @@ public class Chimeras extends AbstractNpcAI _npc.teleToLocation(_loc, false); } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/DemonPrince.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/DemonPrince.java index 1631731973c34ef0f8de4265c7d9f89ee9d1a3db..8c1b13109e5445cb08e5dea72724ae04fcc456fd 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/DemonPrince.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/DemonPrince.java @@ -34,15 +34,16 @@ import com.l2jserver.gameserver.model.skills.Skill; */ public final class DemonPrince extends AbstractNpcAI { + // NPCs private static final int DEMON_PRINCE = 25540; private static final int FIEND = 25541; - + // Skills private static final SkillHolder UD = new SkillHolder(5044, 2); private static final SkillHolder[] AOE = { new SkillHolder(5376, 4), new SkillHolder(5376, 5), - new SkillHolder(5376, 6) + new SkillHolder(5376, 6), }; private static final Map<Integer, Boolean> ATTACK_STATE = new FastMap<>(); @@ -62,7 +63,7 @@ public final class DemonPrince extends AbstractNpcAI { npc.doCast(AOE[getRandom(AOE.length)].getSkill()); } - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -112,10 +113,10 @@ public final class DemonPrince extends AbstractNpcAI { if ((master != null) && !master.isDead()) { - int instanceId = master.getInstanceId(); - int x = master.getX(); - int y = master.getY(); - int z = master.getZ(); + final int instanceId = master.getInstanceId(); + final int x = master.getX(); + final int y = master.getY(); + final int z = master.getZ(); addSpawn(FIEND, x + 200, y, z, 0, false, 0, false, instanceId); addSpawn(FIEND, x - 200, y, z, 0, false, 0, false, instanceId); addSpawn(FIEND, x - 100, y - 140, z, 0, false, 0, false, instanceId); @@ -124,4 +125,4 @@ public final class DemonPrince extends AbstractNpcAI addSpawn(FIEND, x + 100, y + 140, z, 0, false, 0, false, instanceId); } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/HellboundCore.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/HellboundCore.java index 6a4d32693a9d2edd3037b8dd3702354c23019762..d79d7a12af6e3096a024735f91ca6c4c4d4d4d81 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/HellboundCore.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/HellboundCore.java @@ -33,9 +33,10 @@ import hellbound.HellboundEngine; */ public final class HellboundCore extends AbstractNpcAI { + // NPCs private static final int NAIA = 18484; private static final int HELLBOUND_CORE = 32331; - + // Skills private static SkillHolder BEAM = new SkillHolder(5493, 1); public HellboundCore() @@ -59,7 +60,7 @@ public final class HellboundCore extends AbstractNpcAI } startQuestTimer("cast", 10000, npc, null); } - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -68,4 +69,4 @@ public final class HellboundCore extends AbstractNpcAI startQuestTimer("cast", 10000, npc, null); return super.onSpawn(npc); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Keltas.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Keltas.java index 9c866e8d5ba7bb70ab015f9c86e5650db114288c..f8d2705c1a11eea763819ab6c19f52bb7f8a991b 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Keltas.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Keltas.java @@ -30,7 +30,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; /** * Manages Darion's Enforcer's and Darion's Executioner spawn/despawn @@ -38,14 +37,11 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay; */ public final class Keltas extends AbstractNpcAI { + // NPCs private static final int KELTAS = 22341; private static final int ENFORCER = 22342; private static final int EXECUTIONER = 22343; - - private L2MonsterInstance _spawnedKeltas = null; - - private final List<L2Spawn> _spawnedMonsters; - + // Locations private static final Location[] ENFORCER_SPAWN_POINTS = { new Location(-24540, 251404, -3320), @@ -75,7 +71,6 @@ public final class Keltas extends AbstractNpcAI new Location(-25376, 252368, -3257), new Location(-25376, 252208, -3257) }; - private static final Location[] EXECUTIONER_SPAWN_POINTS = { new Location(-24419, 251395, -3340), @@ -104,6 +99,9 @@ public final class Keltas extends AbstractNpcAI new Location(-28580, 251071, -3527), new Location(-28492, 250704, -3523) }; + // Misc + private L2MonsterInstance _spawnedKeltas = null; + private final List<L2Spawn> _spawnedMonsters; public Keltas() { @@ -161,13 +159,13 @@ public final class Keltas extends AbstractNpcAI { if ((_spawnedKeltas != null) && !_spawnedKeltas.isDead()) { - _spawnedKeltas.broadcastPacket(new NpcSay(_spawnedKeltas.getObjectId(), Say2.NPC_SHOUT, _spawnedKeltas.getId(), NpcStringId.THAT_IS_IT_FOR_TODAYLETS_RETREAT_EVERYONE_PULL_BACK)); + broadcastNpcSay(_spawnedKeltas, Say2.NPC_SHOUT, NpcStringId.THAT_IS_IT_FOR_TODAYLETS_RETREAT_EVERYONE_PULL_BACK); _spawnedKeltas.deleteMe(); _spawnedKeltas.getSpawn().decreaseCount(_spawnedKeltas); despawnMinions(); } } - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -175,7 +173,6 @@ public final class Keltas extends AbstractNpcAI { cancelQuestTimers("despawn"); despawnMinions(); - return super.onKill(npc, killer, isSummon); } @@ -185,10 +182,10 @@ public final class Keltas extends AbstractNpcAI if (!npc.isTeleporting()) { _spawnedKeltas = (L2MonsterInstance) npc; - npc.broadcastPacket(new NpcSay(_spawnedKeltas.getObjectId(), Say2.NPC_SHOUT, _spawnedKeltas.getId(), NpcStringId.GUYS_SHOW_THEM_OUR_POWER)); + broadcastNpcSay(_spawnedKeltas, Say2.NPC_SHOUT, NpcStringId.GUYS_SHOW_THEM_OUR_POWER); spawnMinions(); startQuestTimer("despawn", 1800000, null, null); } return super.onSpawn(npc); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Bernarde/Bernarde.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Bernarde/Bernarde.java index 3a49c63e00ff76c7e5e473e16bd7ef3328d38cdc..9c496c3745c90c97285bda1fecfea87471853701 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Bernarde/Bernarde.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Bernarde/Bernarde.java @@ -18,9 +18,10 @@ */ package hellbound.AI.NPC.Bernarde; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import hellbound.HellboundEngine; @@ -28,17 +29,20 @@ import hellbound.HellboundEngine; * Bernarde AI. * @author DS */ -public final class Bernarde extends Quest +public final class Bernarde extends AbstractNpcAI { + // NPCs private static final int BERNARDE = 32300; + // Misc private static final int NATIVE_TRANSFORM = 101; + // Items private static final int HOLY_WATER = 9673; private static final int DARION_BADGE = 9674; private static final int TREASURE = 9684; public Bernarde() { - super(-1, Bernarde.class.getSimpleName(), "hellbound/AI/NPC"); + super(Bernarde.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(BERNARDE); addStartNpc(BERNARDE); addTalkId(BERNARDE); @@ -47,38 +51,44 @@ public final class Bernarde extends Quest @Override public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if ("HolyWater".equalsIgnoreCase(event)) + switch (event) { - if (HellboundEngine.getInstance().getLevel() == 2) + case "HolyWater": { - if (player.getInventory().getInventoryItemCount(DARION_BADGE, -1, false) >= 5) + if (HellboundEngine.getInstance().getLevel() == 2) { - if (player.exchangeItemsById("Quest", npc, DARION_BADGE, 5, HOLY_WATER, 1, true)) + if (player.getInventory().getInventoryItemCount(DARION_BADGE, -1, false) >= 5) { - return "32300-02b.htm"; + if (player.exchangeItemsById("Quest", npc, DARION_BADGE, 5, HOLY_WATER, 1, true)) + { + return "32300-02b.htm"; + } } } + event = "32300-02c.htm"; + break; } - event = "32300-02c.htm"; - } - else if ("Treasure".equalsIgnoreCase(event)) - { - if (HellboundEngine.getInstance().getLevel() == 3) + case "Treasure": { - if (player.getInventory().getInventoryItemCount(TREASURE, -1, false) > 0) + if (HellboundEngine.getInstance().getLevel() == 3) { - if (player.destroyItemByItemId("Quest", TREASURE, player.getInventory().getInventoryItemCount(TREASURE, -1, false), npc, true)) + if (player.getInventory().getInventoryItemCount(TREASURE, -1, false) > 0) { - HellboundEngine.getInstance().updateTrust((int) (player.getInventory().getInventoryItemCount(TREASURE, -1, false) * 1000), true); - return "32300-02d.htm"; + if (player.destroyItemByItemId("Quest", TREASURE, player.getInventory().getInventoryItemCount(TREASURE, -1, false), npc, true)) + { + HellboundEngine.getInstance().updateTrust((int) (player.getInventory().getInventoryItemCount(TREASURE, -1, false) * 1000), true); + return "32300-02d.htm"; + } } } + event = "32300-02e.htm"; + break; + } + case "rumors": + { + event = "32300-" + HellboundEngine.getInstance().getLevel() + "r.htm"; + break; } - event = "32300-02e.htm"; - } - else if ("rumors".equalsIgnoreCase(event)) - { - event = "32300-" + HellboundEngine.getInstance().getLevel() + "r.htm"; } return event; } @@ -86,11 +96,6 @@ public final class Bernarde extends Quest @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - if (player.getQuestState(getName()) == null) - { - newQuestState(player); - } - switch (HellboundEngine.getInstance().getLevel()) { case 0: @@ -111,4 +116,4 @@ public final class Bernarde extends Quest { return player.isTransformed() && (player.getTransformation().getId() == NATIVE_TRANSFORM); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka.java index df2df3bd60fd14ad42a560c455f2fd23167be680..502018bb73979df117aadd5c6c2a6dc5ac4c179f 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Budenka/Budenka.java @@ -18,14 +18,15 @@ */ package hellbound.AI.NPC.Budenka; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; /** * Budenka AI. */ -public final class Budenka extends Quest +public final class Budenka extends AbstractNpcAI { private static final int BUDENKA = 32294; private static final int STANDART_CERT = 9851; @@ -33,24 +34,22 @@ public final class Budenka extends Quest public Budenka() { - super(-1, Budenka.class.getSimpleName(), "hellbound/AI/NPC"); + super(Budenka.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(BUDENKA); } @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - if (player.getInventory().getInventoryItemCount(PREMIUM_CERT, -1, false) > 0) + if (hasAtLeastOneQuestItem(player, PREMIUM_CERT)) { return "32294-premium.htm"; } - - if (player.getInventory().getInventoryItemCount(STANDART_CERT, -1, false) > 0) + else if (hasAtLeastOneQuestItem(player, STANDART_CERT)) { return "32294-standart.htm"; } - npc.showChatWindow(player); - return null; + return super.onFirstTalk(npc, player); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Buron/Buron.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Buron/Buron.java index 2d31e5c1e5bba3dbe65373b72a252d64d7002c63..e810bcda8626211ffee1d8a8c1cf945439c323e4 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Buron/Buron.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Buron/Buron.java @@ -18,9 +18,10 @@ */ package hellbound.AI.NPC.Buron; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import hellbound.HellboundEngine; @@ -28,7 +29,7 @@ import hellbound.HellboundEngine; * Buron AI. * @author DS */ -public final class Buron extends Quest +public final class Buron extends AbstractNpcAI { private static final int BURON = 32345; private static final int HELMET = 9669; @@ -38,7 +39,7 @@ public final class Buron extends Quest public Buron() { - super(-1, Buron.class.getSimpleName(), "hellbound/AI/NPC"); + super(Buron.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(BURON); addStartNpc(BURON); addTalkId(BURON); @@ -102,4 +103,4 @@ public final class Buron extends Quest return "32345-01a.htm"; } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Deltuva/Deltuva.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Deltuva/Deltuva.java index 96c12a84335d1be1a4c24e94e1006e76abe0d5e3..77918e8ccaebde62c4bb7206f56f16e2accddb27 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Deltuva/Deltuva.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Deltuva/Deltuva.java @@ -19,26 +19,27 @@ package hellbound.AI.NPC.Deltuva; import quests.Q00132_MatrasCuriosity.Q00132_MatrasCuriosity; +import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; /** * Deltuva AI. * @author GKR */ -public final class Deltuva extends Quest +public final class Deltuva extends AbstractNpcAI { + // NPCs private static final int DELTUVA = 32313; // Location private static final Location TELEPORT = new Location(17934, 283189, -9701); public Deltuva() { - super(-1, Deltuva.class.getSimpleName(), "hellbound/AI/NPC"); + super(Deltuva.class.getSimpleName(), "hellbound/AI/NPC"); addStartNpc(DELTUVA); addTalkId(DELTUVA); } @@ -46,19 +47,15 @@ public final class Deltuva extends Quest @Override public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - String htmltext = null; if (event.equalsIgnoreCase("teleport")) { final QuestState hostQuest = player.getQuestState(Q00132_MatrasCuriosity.class.getSimpleName()); if ((hostQuest == null) || !hostQuest.isCompleted()) { - htmltext = "32313-02.htm"; - } - else - { - player.teleToLocation(TELEPORT); + return "32313-02.htm"; } + player.teleToLocation(TELEPORT); } - return htmltext; + return super.onAdvEvent(event, npc, player); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Falk/Falk.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Falk/Falk.java index 4585d79a05e0f0061338ba91211ab8a995b6ba6d..aeb27ce36e0d0e6d5ffa852370553d825604537f 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Falk/Falk.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Falk/Falk.java @@ -18,25 +18,28 @@ */ package hellbound.AI.NPC.Falk; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; /** * Falk AI. * @author DS */ -public final class Falk extends Quest +public final class Falk extends AbstractNpcAI { + // NPCs private static final int FALK = 32297; - private static final int BASIC_CERT = 9850; - private static final int STANDART_CERT = 9851; - private static final int PREMIUM_CERT = 9852; + // Items private static final int DARION_BADGE = 9674; + private static final int BASIC_CERT = 9850; // Basic Caravan Certificate + private static final int STANDART_CERT = 9851; // Standard Caravan Certificate + private static final int PREMIUM_CERT = 9852; // Premium Caravan Certificate public Falk() { - super(-1, Falk.class.getSimpleName(), "hellbound/AI/NPC"); + super(Falk.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(FALK); addStartNpc(FALK); addTalkId(FALK); @@ -78,6 +81,6 @@ public final class Falk extends Quest return "32297-02b.htm"; } } - return event; + return super.onAdvEvent(event, npc, player); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Hude/Hude.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Hude/Hude.java index 13fd4a7de9d9ba70c14648e772b49f02f76028fd..8df3f3f7c8255cd8a76e8e925b8107556dd4c646 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Hude/Hude.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Hude/Hude.java @@ -18,10 +18,11 @@ */ package hellbound.AI.NPC.Hude; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.datatables.MultisellData; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import hellbound.HellboundEngine; @@ -29,9 +30,11 @@ import hellbound.HellboundEngine; * Hude AI. * @author DS */ -public final class Hude extends Quest +public final class Hude extends AbstractNpcAI { + // NPCs private static final int HUDE = 32298; + // Items private static final int BASIC_CERT = 9850; private static final int STANDART_CERT = 9851; private static final int PREMIUM_CERT = 9852; @@ -43,7 +46,7 @@ public final class Hude extends Quest public Hude() { - super(-1, Hude.class.getSimpleName(), "hellbound/AI/NPC"); + super(Hude.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(HUDE); addStartNpc(HUDE); addTalkId(HUDE); @@ -52,58 +55,63 @@ public final class Hude extends Quest @Override public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if ("scertif".equalsIgnoreCase(event)) + switch (event) { - if (HellboundEngine.getInstance().getLevel() > 3) + case "scertif": { - if (hasQuestItems(player, BASIC_CERT) && (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 30) && (getQuestItemsCount(player, STINGER) >= 60)) + if (HellboundEngine.getInstance().getLevel() > 3) { - takeItems(player, MARK_OF_BETRAYAL, 30); - takeItems(player, STINGER, 60); - takeItems(player, BASIC_CERT, 1); - giveItems(player, STANDART_CERT, 1); - return "32298-04a.htm"; + if (hasQuestItems(player, BASIC_CERT) && (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 30) && (getQuestItemsCount(player, STINGER) >= 60)) + { + takeItems(player, MARK_OF_BETRAYAL, 30); + takeItems(player, STINGER, 60); + takeItems(player, BASIC_CERT, 1); + giveItems(player, STANDART_CERT, 1); + return "32298-04a.htm"; + } } + return "32298-04b.htm"; } - return "32298-04b.htm"; - } - else if ("pcertif".equalsIgnoreCase(event)) - { - if (HellboundEngine.getInstance().getLevel() > 6) + case "pcertif": { - if (hasQuestItems(player, STANDART_CERT) && (getQuestItemsCount(player, LIFE_FORCE) >= 56) && (getQuestItemsCount(player, CONTAINED_LIFE_FORCE) >= 14)) + if (HellboundEngine.getInstance().getLevel() > 6) { - takeItems(player, LIFE_FORCE, 56); - takeItems(player, CONTAINED_LIFE_FORCE, 14); - takeItems(player, STANDART_CERT, 1); - giveItems(player, PREMIUM_CERT, 1); - giveItems(player, MAP, 1); - return "32298-06a.htm"; + if (hasQuestItems(player, STANDART_CERT) && (getQuestItemsCount(player, LIFE_FORCE) >= 56) && (getQuestItemsCount(player, CONTAINED_LIFE_FORCE) >= 14)) + { + takeItems(player, LIFE_FORCE, 56); + takeItems(player, CONTAINED_LIFE_FORCE, 14); + takeItems(player, STANDART_CERT, 1); + giveItems(player, PREMIUM_CERT, 1); + giveItems(player, MAP, 1); + return "32298-06a.htm"; + } } + return "32298-06b.htm"; } - return "32298-06b.htm"; - } - else if ("multisell1".equalsIgnoreCase(event)) - { - if (hasQuestItems(player, STANDART_CERT) || hasQuestItems(player, PREMIUM_CERT)) + case "multisell1": { - MultisellData.getInstance().separateAndSend(322980001, player, npc, false); + if (hasQuestItems(player, STANDART_CERT) || hasQuestItems(player, PREMIUM_CERT)) + { + MultisellData.getInstance().separateAndSend(322980001, player, npc, false); + } + break; } - } - else if ("multisell2".equalsIgnoreCase(event)) - { - if (hasQuestItems(player, PREMIUM_CERT)) + case "multisell2": { - MultisellData.getInstance().separateAndSend(322980002, player, npc, false); + if (hasQuestItems(player, PREMIUM_CERT)) + { + MultisellData.getInstance().separateAndSend(322980002, player, npc, false); + } + break; } } - return null; + return super.onAdvEvent(event, npc, player); } @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - String htmltext = ""; + String htmltext = null; if (!hasAtLeastOneQuestItem(player, BASIC_CERT, STANDART_CERT, PREMIUM_CERT)) { htmltext = "32298-01.htm"; @@ -122,4 +130,4 @@ public final class Hude extends Quest } return htmltext; } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Jude/Jude.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Jude/Jude.java index 35c1802b24b787203ba9833d2c74cc310fd09949..19b256ee5f7635399bfdd486025fad64d58a9fe5 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Jude/Jude.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Jude/Jude.java @@ -18,9 +18,10 @@ */ package hellbound.AI.NPC.Jude; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import hellbound.HellboundEngine; @@ -28,15 +29,16 @@ import hellbound.HellboundEngine; * Jude AI. * @author DS */ -public final class Jude extends Quest +public final class Jude extends AbstractNpcAI { + // NPCs private static final int JUDE = 32356; private static final int NATIVE_TREASURE = 9684; private static final int RING_OF_WIND_MASTERY = 9677; public Jude() { - super(-1, Jude.class.getSimpleName(), "hellbound/AI/NPC"); + super(Jude.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(JUDE); addStartNpc(JUDE); addTalkId(JUDE); @@ -58,17 +60,12 @@ public final class Jude extends Quest } return "32356-02a.htm"; } - return event; + return super.onAdvEvent(event, npc, player); } @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - if (player.getQuestState(getName()) == null) - { - newQuestState(player); - } - switch (HellboundEngine.getInstance().getLevel()) { case 0: @@ -84,4 +81,4 @@ public final class Jude extends Quest return "32356-01b.htm"; } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Kanaf/Kanaf.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Kanaf/Kanaf.java index 1f9f5256cfcff27d5a864787c0df678998eecad9..0d4fa78de90c1b0203263055b700061849b55d89 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Kanaf/Kanaf.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Kanaf/Kanaf.java @@ -18,21 +18,23 @@ */ package hellbound.AI.NPC.Kanaf; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; /** * Kanaf AI. * @author GKR */ -public final class Kanaf extends Quest +public final class Kanaf extends AbstractNpcAI { + // NPCs private static final int KANAF = 32346; public Kanaf() { - super(-1, Kanaf.class.getSimpleName(), "hellbound/AI/NPC"); + super(Kanaf.class.getSimpleName(), "hellbound/AI/NPC"); addStartNpc(KANAF); addTalkId(KANAF); } @@ -40,11 +42,10 @@ public final class Kanaf extends Quest @Override public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equalsIgnoreCase("info")) + if (event.equals("info")) { return "32346-0" + getRandom(1, 3) + ".htm"; } - return super.onAdvEvent(event, npc, player); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Kief/Kief.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Kief/Kief.java index a5d892b1e1e7767a3475a0c9edb646983b53678a..20b1223f88cdc6fb26be852779d327fc0452f272 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Kief/Kief.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Kief/Kief.java @@ -18,9 +18,10 @@ */ package hellbound.AI.NPC.Kief; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import hellbound.HellboundEngine; @@ -28,19 +29,21 @@ import hellbound.HellboundEngine; * Kief AI. * @author DS */ -public final class Kief extends Quest +public final class Kief extends AbstractNpcAI { + // NPCs private static final int KIEF = 32354; - private static final int BOTTLE = 9672; - private static final int DARION_BADGE = 9674; - private static final int DIM_LIFE_FORCE = 9680; - private static final int LIFE_FORCE = 9681; - private static final int CONTAINED_LIFE_FORCE = 9682; - private static final int STINGER = 10012; + // Items + private static final int BOTTLE = 9672; // Magic Bottle + private static final int DARION_BADGE = 9674; // Darion's Badge + private static final int DIM_LIFE_FORCE = 9680; // Dim Life Force + private static final int LIFE_FORCE = 9681; // Life Force + private static final int CONTAINED_LIFE_FORCE = 9682; // Contained Life Force + private static final int STINGER = 10012; // Scorpion Poison Stinger public Kief() { - super(-1, Kief.class.getSimpleName(), "hellbound/AI/NPC"); + super(Kief.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(KIEF); addStartNpc(KIEF); addTalkId(KIEF); @@ -49,84 +52,107 @@ public final class Kief extends Quest @Override public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if ("Badges".equalsIgnoreCase(event)) + String htmltext = null; + switch (event) { - switch (HellboundEngine.getInstance().getLevel()) + case "Badges": { - case 2: - case 3: - if (hasQuestItems(player, DARION_BADGE)) + switch (HellboundEngine.getInstance().getLevel()) + { + case 2: + case 3: + { + if (hasQuestItems(player, DARION_BADGE)) + { + HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, DARION_BADGE) * 10, true); + takeItems(player, DARION_BADGE, -1); + return "32354-10.htm"; + } + break; + } + default: { - HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, DARION_BADGE) * 10, true); - takeItems(player, DARION_BADGE, -1); - return "32354-10.htm"; + htmltext = "32354-10a.htm"; + break; } + } + break; } - return "32354-10a.htm"; - } - else if ("Bottle".equalsIgnoreCase(event)) - { - if (HellboundEngine.getInstance().getLevel() >= 7) + case "Bottle": { - if (getQuestItemsCount(player, STINGER) >= 20) + if (HellboundEngine.getInstance().getLevel() >= 7) { - takeItems(player, STINGER, 20); - giveItems(player, BOTTLE, 1); - return "32354-11h.htm"; + if (getQuestItemsCount(player, STINGER) >= 20) + { + takeItems(player, STINGER, 20); + giveItems(player, BOTTLE, 1); + htmltext = "32354-11h.htm"; + } + else + { + htmltext = "32354-11i.htm"; + } } - return "32354-11i.htm"; + break; } - } - else if ("dlf".equalsIgnoreCase(event)) - { - if (HellboundEngine.getInstance().getLevel() == 7) + case "dlf": { - if (hasQuestItems(player, DIM_LIFE_FORCE)) + if (HellboundEngine.getInstance().getLevel() == 7) { - HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, DIM_LIFE_FORCE) * 20, true); - takeItems(player, DIM_LIFE_FORCE, -1); - return "32354-11a.htm"; + if (hasQuestItems(player, DIM_LIFE_FORCE)) + { + HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, DIM_LIFE_FORCE) * 20, true); + takeItems(player, DIM_LIFE_FORCE, -1); + htmltext = "32354-11a.htm"; + } + else + { + htmltext = "32354-11b.htm"; + } } - return "32354-11b.htm"; + break; } - } - else if ("lf".equalsIgnoreCase(event)) - { - if (HellboundEngine.getInstance().getLevel() == 7) + case "lf": { - if (hasQuestItems(player, LIFE_FORCE)) + if (HellboundEngine.getInstance().getLevel() == 7) { - HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, LIFE_FORCE) * 80, true); - takeItems(player, LIFE_FORCE, -1); - return "32354-11c.htm"; + if (hasQuestItems(player, LIFE_FORCE)) + { + HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, LIFE_FORCE) * 80, true); + takeItems(player, LIFE_FORCE, -1); + htmltext = "32354-11c.htm"; + } + else + { + htmltext = "32354-11d.htm"; + } } - return "32354-11d.htm"; + break; } - } - else if ("clf".equalsIgnoreCase(event)) - { - if (HellboundEngine.getInstance().getLevel() == 7) + case "clf": { - if (hasQuestItems(player, CONTAINED_LIFE_FORCE)) + if (HellboundEngine.getInstance().getLevel() == 7) { - HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, CONTAINED_LIFE_FORCE) * 200, true); - takeItems(player, CONTAINED_LIFE_FORCE, -1); - return "32354-11e.htm"; + if (hasQuestItems(player, CONTAINED_LIFE_FORCE)) + { + HellboundEngine.getInstance().updateTrust((int) getQuestItemsCount(player, CONTAINED_LIFE_FORCE) * 200, true); + takeItems(player, CONTAINED_LIFE_FORCE, -1); + htmltext = "32354-11e.htm"; + } + else + { + htmltext = "32354-11f.htm"; + } } - return "32354-11f.htm"; + break; } } - return event; + return htmltext; } @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - if (player.getQuestState(getName()) == null) - { - newQuestState(player); - } - switch (HellboundEngine.getInstance().getLevel()) { case 1: @@ -146,4 +172,4 @@ public final class Kief extends Quest return "32354-01f.htm"; } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Natives/Natives.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Natives/Natives.java index f6edc4c3b00e27a7f56133e2f6972dbf3a8f5e3c..831bd11c106fe517a82310ceebe053cb278fd2e8 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Natives/Natives.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Natives/Natives.java @@ -18,40 +18,41 @@ */ package hellbound.AI.NPC.Natives; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.datatables.DoorTable; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; import hellbound.HellboundEngine; /** - * Natives AI.<br> - * This class manages Natives' behavior up to 9 level of Hellbound. 10 level are handled in Urban Area. + * Natives AI. * @author DS, GKR */ -public final class Natives extends Quest +public final class Natives extends AbstractNpcAI { + // NPCs private static final int NATIVE = 32362; private static final int INSURGENT = 32363; private static final int TRAITOR = 32364; private static final int INCASTLE = 32357; - private static final int MARK_OF_BETRAYAL = 9676; - private static final int BADGES = 9674; - + // Items + private static final int MARK_OF_BETRAYAL = 9676; // Mark of Betrayal + private static final int BADGES = 9674; // Darion's Badge + // Misc private static final int[] DOORS = { 19250003, - 19250004 + 19250004, }; public Natives() { - super(-1, Natives.class.getSimpleName(), "hellbound/AI/NPC"); + super(Natives.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(NATIVE); addFirstTalkId(INSURGENT); addFirstTalkId(INCASTLE); @@ -65,17 +66,22 @@ public final class Natives extends Quest @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - String htmltext = ""; + String htmltext = null; final int hellboundLevel = HellboundEngine.getInstance().getLevel(); switch (npc.getId()) { case NATIVE: + { htmltext = hellboundLevel > 5 ? "32362-01.htm" : "32362.htm"; break; + } case INSURGENT: + { htmltext = hellboundLevel > 5 ? "32363-01.htm" : "32363.htm"; break; + } case INCASTLE: + { if (hellboundLevel < 9) { htmltext = "32357-01a.htm"; @@ -89,6 +95,7 @@ public final class Natives extends Quest htmltext = "32357-01b.htm"; } break; + } } return htmltext; } @@ -104,7 +111,7 @@ public final class Natives extends Quest if (getQuestItemsCount(player, MARK_OF_BETRAYAL) >= 10) { takeItems(player, MARK_OF_BETRAYAL, 10); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.ALRIGHT_NOW_LEODAS_IS_YOURS)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.ALRIGHT_NOW_LEODAS_IS_YOURS); HellboundEngine.getInstance().updateTrust(-50, true); for (int doorId : DOORS) @@ -142,7 +149,7 @@ public final class Natives extends Quest } else if ((npc.getId() == NATIVE) && event.equalsIgnoreCase("hungry_death")) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.HUN_HUNGRY)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HUN_HUNGRY); npc.doDie(null); } else if (npc.getId() == INCASTLE) @@ -179,7 +186,6 @@ public final class Natives extends Quest { startQuestTimer("hungry_death", 600000, npc, null); } - return super.onSpawn(npc); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Quarry/Quarry.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Quarry/Quarry.java index 6f35f126b6573b274fb8bbfd36186c0c646d212b..efe9b36dffb85d34b4b547ef9d72c24308b07479 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Quarry/Quarry.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Quarry/Quarry.java @@ -18,8 +18,9 @@ */ package hellbound.AI.NPC.Quarry; +import ai.npc.AbstractNpcAI; + import com.l2jserver.Config; -import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.instancemanager.ZoneManager; import com.l2jserver.gameserver.model.actor.L2Attackable; @@ -28,11 +29,9 @@ import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2QuestGuardInstance; import com.l2jserver.gameserver.model.holders.ItemChanceHolder; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.zone.L2ZoneType; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; import hellbound.HellboundEngine; @@ -40,11 +39,10 @@ import hellbound.HellboundEngine; * Quarry AI. * @author DS, GKR */ -public final class Quarry extends Quest +public final class Quarry extends AbstractNpcAI { + // NPCs private static final int SLAVE = 32299; - private static final int TRUST = 50; - private static final int ZONE = 40107; // Items protected static final ItemChanceHolder[] DROP_LIST = { @@ -55,10 +53,14 @@ public final class Quarry extends Quest new ItemChanceHolder(1877, 1333), // Adamantine nugget new ItemChanceHolder(1874, 2222), // Oriharukon ore }; + // Zone + private static final int ZONE = 40107; + // Misc + private static final int TRUST = 50; public Quarry() { - super(-1, Quarry.class.getSimpleName(), "hellbound/AI/NPC"); + super(Quarry.class.getSimpleName(), "hellbound/AI/NPC"); addSpawnId(SLAVE); addFirstTalkId(SLAVE); addStartNpc(SLAVE); @@ -70,40 +72,66 @@ public final class Quarry extends Quest @Override public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equalsIgnoreCase("time_limit")) + String htmltext = null; + switch (event) { - for (L2ZoneType zone : ZoneManager.getInstance().getZones(npc)) + case "FollowMe": { - if (zone.getId() == 40108) + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.setTarget(player); + npc.setAutoAttackable(true); + npc.setRHandId(9136); + npc.setWalking(); + + if (getQuestTimer("TIME_LIMIT", npc, null) == null) { - npc.setTarget(null); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); - npc.setAutoAttackable(false); - npc.setRHandId(0); - npc.teleToLocation(npc.getSpawn().getLocation()); - return null; + startQuestTimer("TIME_LIMIT", 900000, npc, null); // 15 min limit for save } + htmltext = "32299-02.htm"; + break; } - - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.HUN_HUNGRY)); - npc.doDie(npc); - return null; - } - else if (event.equalsIgnoreCase("FollowMe")) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.setTarget(player); - npc.setAutoAttackable(true); - npc.setRHandId(9136); - npc.setWalking(); - - if (getQuestTimer("time_limit", npc, null) == null) + case "TIME_LIMIT": + { + for (L2ZoneType zone : ZoneManager.getInstance().getZones(npc)) + { + if (zone.getId() == 40108) + { + npc.setTarget(null); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE); + npc.setAutoAttackable(false); + npc.setRHandId(0); + npc.teleToLocation(npc.getSpawn().getLocation()); + return null; + } + } + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HUN_HUNGRY); + npc.doDie(npc); + break; + } + case "DECAY": { - startQuestTimer("time_limit", 900000, npc, null); // 15 min limit for save + if ((npc != null) && !npc.isDead()) + { + if (npc.getTarget().isPlayer()) + { + for (ItemChanceHolder item : DROP_LIST) + { + if (getRandom(10000) < item.getChance()) + { + npc.dropItem((L2PcInstance) npc.getTarget(), item.getId(), (int) (item.getCount() * Config.RATE_QUEST_DROP)); + break; + } + } + } + npc.setAutoAttackable(false); + npc.deleteMe(); + npc.getSpawn().decreaseCount(npc); + HellboundEngine.getInstance().updateTrust(TRUST, true); + } } - return "32299-02.htm"; } - return event; + + return htmltext; } @Override @@ -124,15 +152,9 @@ public final class Quarry extends Quest { return "32299.htm"; } - - if (player.getQuestState(getName()) == null) - { - newQuestState(player); - } return "32299-01.htm"; } - // Let's manage kill points in Engine @Override public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { @@ -143,7 +165,7 @@ public final class Quarry extends Quest @Override public final String onEnterZone(L2Character character, L2ZoneType zone) { - if (character instanceof L2Attackable) + if (character.isAttackable()) { final L2Attackable npc = (L2Attackable) character; if (npc.getId() == SLAVE) @@ -152,10 +174,10 @@ public final class Quarry extends Quest { if (HellboundEngine.getInstance().getLevel() == 5) { - ThreadPoolManager.getInstance().scheduleGeneral(new Decay(npc), 1000); + startQuestTimer("DECAY", 1000, npc, null); try { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.THANK_YOU_FOR_THE_RESCUE_ITS_A_SMALL_GIFT)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THANK_YOU_FOR_THE_RESCUE_ITS_A_SMALL_GIFT); } catch (Exception e) { @@ -165,40 +187,6 @@ public final class Quarry extends Quest } } } - return null; - } - - private final class Decay implements Runnable - { - private final L2Npc _npc; - - public Decay(L2Npc npc) - { - _npc = npc; - } - - @Override - public void run() - { - if ((_npc != null) && !_npc.isDead()) - { - if (_npc.getTarget() instanceof L2PcInstance) - { - for (ItemChanceHolder item : DROP_LIST) - { - if (getRandom(10000) < item.getChance()) - { - _npc.dropItem((L2PcInstance) _npc.getTarget(), item.getId(), (int) (item.getCount() * Config.RATE_QUEST_DROP)); - break; - } - } - } - - _npc.setAutoAttackable(false); - _npc.deleteMe(); - _npc.getSpawn().decreaseCount(_npc); - HellboundEngine.getInstance().updateTrust(TRUST, true); - } - } + return super.onEnterZone(character, zone); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Shadai/Shadai.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Shadai/Shadai.java index 2e9472fa833ac782ae46dcffddb1a5f8ffb50df3..94b8c940bc9f9d1a230b2a0c000a62cf34fb59d7 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Shadai/Shadai.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Shadai/Shadai.java @@ -18,74 +18,64 @@ */ package hellbound.AI.NPC.Shadai; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.GameTimeController; -import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; -import com.l2jserver.gameserver.model.quest.Quest; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; /** * Shadai AI. * @author GKR */ -public final class Shadai extends Quest +public final class Shadai extends AbstractNpcAI { + // NPCs private static final int SHADAI = 32347; - + // Locations private static final Location DAY_COORDS = new Location(16882, 238952, 9776); private static final Location NIGHT_COORDS = new Location(9064, 253037, -1928); public Shadai() { - super(-1, Shadai.class.getSimpleName(), "hellbound/AI/NPC"); + super(Shadai.class.getSimpleName(), "hellbound/AI/NPC"); addSpawnId(SHADAI); } @Override - public final String onSpawn(L2Npc npc) - { - if (!npc.isTeleporting()) - { - ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new ValidatePosition(npc), 60000, 60000); - } - - return super.onSpawn(npc); - } - - protected static void validatePosition(L2Npc npc) + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - Location coords = DAY_COORDS; - boolean mustRevalidate = false; - if ((npc.getX() != NIGHT_COORDS.getX()) && GameTimeController.getInstance().isNight()) + if (event.equals("VALIDATE_POS") && (npc != null)) { - coords = NIGHT_COORDS; - mustRevalidate = true; - } - else if ((npc.getX() != DAY_COORDS.getX()) && !GameTimeController.getInstance().isNight()) - { - mustRevalidate = true; - } - - if (mustRevalidate) - { - npc.getSpawn().setLocation(coords); - npc.teleToLocation(coords); + Location coords = DAY_COORDS; + boolean mustRevalidate = false; + if ((npc.getX() != NIGHT_COORDS.getX()) && GameTimeController.getInstance().isNight()) + { + coords = NIGHT_COORDS; + mustRevalidate = true; + } + else if ((npc.getX() != DAY_COORDS.getX()) && !GameTimeController.getInstance().isNight()) + { + mustRevalidate = true; + } + + if (mustRevalidate) + { + npc.getSpawn().setLocation(coords); + npc.teleToLocation(coords); + } } + return super.onAdvEvent(event, npc, player); } - private static class ValidatePosition implements Runnable + @Override + public final String onSpawn(L2Npc npc) { - private final L2Npc _npc; - - public ValidatePosition(L2Npc npc) - { - _npc = npc; - } - - @Override - public void run() + if (!npc.isTeleporting()) { - validatePosition(_npc); + startQuestTimer("VALIDATE_POS", 60000, npc, null, true); } + return super.onSpawn(npc); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Solomon/Solomon.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Solomon/Solomon.java index d5eec2b2446377ee36a2b8e0036cfe7b2de52764..d15633eff6b6c7e09bf5c1335fbc0764a949d9c0 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Solomon/Solomon.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Solomon/Solomon.java @@ -18,9 +18,10 @@ */ package hellbound.AI.NPC.Solomon; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import hellbound.HellboundEngine; @@ -28,13 +29,14 @@ import hellbound.HellboundEngine; * Solomon AI. * @author DS */ -public final class Solomon extends Quest +public final class Solomon extends AbstractNpcAI { + // NPCs private static final int SOLOMON = 32355; public Solomon() { - super(-1, Solomon.class.getSimpleName(), "hellbound/AI/NPC"); + super(Solomon.class.getSimpleName(), "hellbound/AI/NPC"); addFirstTalkId(SOLOMON); } @@ -49,6 +51,6 @@ public final class Solomon extends Quest { return "32355-01a.htm"; } - return null; + return super.onFirstTalk(npc, player); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate.java index 917dabe469beb34f18644e10febf208ee555fa17..cca2107f42d6b1a6d31132d9f6543d4a04f62e90 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NPC/Warpgate/Warpgate.java @@ -23,7 +23,6 @@ import quests.Q00133_ThatsBloodyHot.Q00133_ThatsBloodyHot; import ai.npc.AbstractNpcAI; import com.l2jserver.Config; -import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Character; @@ -40,10 +39,7 @@ import hellbound.HellboundEngine; */ public final class Warpgate extends AbstractNpcAI { - // Misc - private static final int MAP = 9994; - private static final int ZONE = 40101; - // Teleports + // NPCs private static final int[] WARPGATES = { 32314, @@ -56,6 +52,9 @@ public final class Warpgate extends AbstractNpcAI // Locations private static final Location HELLBOUND = new Location(-11272, 236464, -3248); protected static final Location REMOVE_LOC = new Location(-16555, 209375, -3670); + // Misc + private static final int MAP = 9994; + private static final int ZONE = 40101; public Warpgate() { @@ -66,6 +65,16 @@ public final class Warpgate extends AbstractNpcAI addEnterZoneId(ZONE); } + @Override + public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) + { + if (event.equals("TELEPORT")) + { + player.teleToLocation(REMOVE_LOC, true); + } + return super.onAdvEvent(event, npc, player); + } + @Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { @@ -86,13 +95,13 @@ public final class Warpgate extends AbstractNpcAI { return "warpgate-no.htm"; } - player.teleToLocation(HELLBOUND, true); + if (HellboundEngine.getInstance().isLocked()) { HellboundEngine.getInstance().setLevel(1); } - return null; + return super.onTalk(npc, player); } @Override @@ -102,7 +111,7 @@ public final class Warpgate extends AbstractNpcAI { if (!canEnter(character.getActingPlayer()) && !character.canOverrideCond(PcCondOverride.ZONE_CONDITIONS)) { - ThreadPoolManager.getInstance().scheduleGeneral(new Teleport(character), 1000); + startQuestTimer("TELEPORT", 1000, null, (L2PcInstance) character); } else if (!character.getActingPlayer().isMinimapAllowed()) { @@ -112,30 +121,7 @@ public final class Warpgate extends AbstractNpcAI } } } - return null; - } - - private static final class Teleport implements Runnable - { - private final L2Character _char; - - public Teleport(L2Character c) - { - _char = c; - } - - @Override - public void run() - { - try - { - _char.teleToLocation(REMOVE_LOC, true); - } - catch (Exception e) - { - e.printStackTrace(); - } - } + return super.onEnterZone(character, zone); } private static boolean canEnter(L2PcInstance player) @@ -162,4 +148,4 @@ public final class Warpgate extends AbstractNpcAI st = player.getQuestState(Q00133_ThatsBloodyHot.class.getSimpleName()); return ((st != null) && st.isCompleted()); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NaiaLock.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NaiaLock.java index 6913244cce1299ae1286420fec59067d655551f5..60753dab22fac78824d2692b42a40bd0e7f548bd 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NaiaLock.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/NaiaLock.java @@ -31,6 +31,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; */ public final class NaiaLock extends AbstractNpcAI { + // NPCs private static final int LOCK = 18491; public NaiaLock() @@ -45,4 +46,4 @@ public final class NaiaLock extends AbstractNpcAI ((L2MonsterInstance) npc).getMinionList().onMasterDie(true); return super.onKill(npc, killer, isSummon); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/OutpostCaptain.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/OutpostCaptain.java index 33faf5a4fca69605134d0583aea2c30763344a52..df6e2c8dacdeff2f319fc641f7ceb31543071cb6 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/OutpostCaptain.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/OutpostCaptain.java @@ -33,14 +33,13 @@ import hellbound.HellboundEngine; */ public final class OutpostCaptain extends AbstractNpcAI { + // NPCs private static final int CAPTAIN = 18466; - private static final int[] DEFENDERS = { - 22357, - 22358 + 22357, // Enceinte Defender + 22358, // Enceinte Defender }; - private static final int DOORKEEPER = 32351; public OutpostCaptain() @@ -54,12 +53,12 @@ public final class OutpostCaptain extends AbstractNpcAI @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equalsIgnoreCase("level_up")) + if (event.equalsIgnoreCase("LEVEL_UP")) { npc.deleteMe(); HellboundEngine.getInstance().setLevel(9); } - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -69,7 +68,6 @@ public final class OutpostCaptain extends AbstractNpcAI { addSpawn(DOORKEEPER, npc.getSpawn().getLocation(), false, 0, false); } - return super.onKill(npc, killer, isSummon); } @@ -80,7 +78,7 @@ public final class OutpostCaptain extends AbstractNpcAI if (npc.getId() == CAPTAIN) { - L2DoorInstance door = DoorTable.getInstance().getDoor(20250001); + final L2DoorInstance door = DoorTable.getInstance().getDoor(20250001); if (door != null) { door.closeMe(); @@ -88,9 +86,8 @@ public final class OutpostCaptain extends AbstractNpcAI } else if (npc.getId() == DOORKEEPER) { - startQuestTimer("level_up", 3000, npc, null); + startQuestTimer("LEVEL_UP", 3000, npc, null); } - return super.onSpawn(npc); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Ranku.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Ranku.java index 102cbc844c783b575992ec99a68c6dcf42fdd769..4d40e6a734818238b1435fd7659cb31b0a65bb7d 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Ranku.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Ranku.java @@ -29,7 +29,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; import com.l2jserver.gameserver.util.MinionList; /** @@ -38,10 +37,11 @@ import com.l2jserver.gameserver.util.MinionList; */ public final class Ranku extends AbstractNpcAI { + // NPCs private static final int RANKU = 25542; private static final int MINION = 32305; private static final int MINION_2 = 25543; - + // Misc private static final Set<Integer> MY_TRACKING_SET = new FastSet<Integer>().shared(); public Ranku() @@ -60,14 +60,14 @@ public final class Ranku extends AbstractNpcAI { if ((minion != null) && !minion.isDead() && MY_TRACKING_SET.contains(minion.getObjectId())) { - L2PcInstance[] players = minion.getKnownList().getKnownPlayers().values().toArray(new L2PcInstance[minion.getKnownList().getKnownPlayers().size()]); - L2PcInstance killer = players[getRandom(players.length)]; + final L2PcInstance[] players = minion.getKnownList().getKnownPlayers().values().toArray(new L2PcInstance[minion.getKnownList().getKnownPlayers().size()]); + final L2PcInstance killer = players[getRandom(players.length)]; minion.reduceCurrentHp(minion.getMaxHp() / 100, killer, null); } } startQuestTimer("checkup", 1000, npc, null); } - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -79,7 +79,7 @@ public final class Ranku extends AbstractNpcAI { if ((minion != null) && !minion.isDead() && !MY_TRACKING_SET.contains(minion.getObjectId())) { - minion.broadcastPacket(new NpcSay(minion.getObjectId(), Say2.NPC_ALL, minion.getId(), NpcStringId.DONT_KILL_ME_PLEASE_SOMETHINGS_STRANGLING_ME)); + broadcastNpcSay(minion, Say2.NPC_ALL, NpcStringId.DONT_KILL_ME_PLEASE_SOMETHINGS_STRANGLING_ME); startQuestTimer("checkup", 1000, npc, null); MY_TRACKING_SET.add(minion.getObjectId()); } @@ -117,4 +117,4 @@ public final class Ranku extends AbstractNpcAI } return super.onKill(npc, killer, isSummon); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Slaves.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Slaves.java index 1611c0fb91ed8ef66531df2dab9cdc92a6650834..0c28454d8b7741e2a9064f17f9374a8e147cb02d 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Slaves.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Slaves.java @@ -23,14 +23,12 @@ import java.util.List; import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ai.CtrlIntention; -import com.l2jserver.gameserver.enums.QuestEventType; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; import com.l2jserver.gameserver.taskmanager.DecayTaskManager; import hellbound.HellboundEngine; @@ -39,20 +37,24 @@ import hellbound.HellboundEngine; * Hellbound Slaves AI. * @author DS */ -public class Slaves extends AbstractNpcAI +public final class Slaves extends AbstractNpcAI { + // NPCs private static final int[] MASTERS = { - 22320, - 22321 + 22320, // Junior Watchman + 22321, // Junior Summoner }; + // Locations private static final Location MOVE_TO = new Location(-25451, 252291, -3252, 3500); + // Misc private static final int TRUST_REWARD = 10; public Slaves() { super(Slaves.class.getSimpleName(), "hellbound/AI"); - registerMobs(MASTERS, QuestEventType.ON_SPAWN, QuestEventType.ON_KILL); + addSpawnId(MASTERS); + addKillId(MASTERS); } @Override @@ -60,11 +62,9 @@ public class Slaves extends AbstractNpcAI { ((L2MonsterInstance) npc).enableMinions(HellboundEngine.getInstance().getLevel() < 5); ((L2MonsterInstance) npc).setOnKillDelay(1000); - return super.onSpawn(npc); } - // Let's count trust points for killing in Engine @Override public final String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { @@ -79,17 +79,15 @@ public class Slaves extends AbstractNpcAI { continue; } - slave.clearAggroList(); slave.abortAttack(); slave.abortCast(); - slave.broadcastPacket(new NpcSay(slave.getObjectId(), Say2.NPC_ALL, slave.getId(), NpcStringId.THANK_YOU_FOR_SAVING_ME_FROM_THE_CLUTCHES_OF_EVIL)); + broadcastNpcSay(slave, Say2.NPC_ALL, NpcStringId.THANK_YOU_FOR_SAVING_ME_FROM_THE_CLUTCHES_OF_EVIL); if ((HellboundEngine.getInstance().getLevel() >= 1) && (HellboundEngine.getInstance().getLevel() <= 2)) { HellboundEngine.getInstance().updateTrust(TRUST_REWARD, false); } - slave.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, MOVE_TO); DecayTaskManager.getInstance().add(slave); } @@ -97,4 +95,4 @@ public class Slaves extends AbstractNpcAI } return super.onKill(npc, killer, isSummon); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Typhoon.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Typhoon.java index eb6ccb78764b009aaf2d61fd2df22870303a1669..0ea0afb8e59b106c6f6e365325717ede2cb0b4df 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Typhoon.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Typhoon.java @@ -32,9 +32,10 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; */ public final class Typhoon extends AbstractNpcAI { + // NPCs private static final int TYPHOON = 25539; - - private static SkillHolder STORM = new SkillHolder(5434, 1); + // Skills + private static SkillHolder STORM = new SkillHolder(5434, 1); // Gust public Typhoon() { @@ -52,12 +53,12 @@ public final class Typhoon extends AbstractNpcAI @Override public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equalsIgnoreCase("cast") && (npc != null) && !npc.isDead()) + if (event.equalsIgnoreCase("CAST") && (npc != null) && !npc.isDead()) { npc.doSimultaneousCast(STORM.getSkill()); - startQuestTimer("cast", 5000, npc, null); + startQuestTimer("CAST", 5000, npc, null); } - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -72,9 +73,8 @@ public final class Typhoon extends AbstractNpcAI { if (!npc.isTeleporting()) { - startQuestTimer("cast", 5000, npc, null); + startQuestTimer("CAST", 5000, npc, null); } - return super.onSpawn(npc); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/AnomicFoundry/AnomicFoundry.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/AnomicFoundry/AnomicFoundry.java index 8846a587ef097c5d0cc3bcf3cad76bbec1e914ff..93e2be7eab911a6920c23c4a1ff466b9e1b1d309 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/AnomicFoundry/AnomicFoundry.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/AnomicFoundry/AnomicFoundry.java @@ -21,6 +21,7 @@ package hellbound.AI.Zones.AnomicFoundry; import java.util.Map; import javolution.util.FastMap; +import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.datatables.SpawnTable; @@ -30,11 +31,9 @@ import com.l2jserver.gameserver.model.actor.L2Attackable; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; import hellbound.HellboundEngine; @@ -42,57 +41,26 @@ import hellbound.HellboundEngine; * Anomic Foundry. * @author GKR */ -public final class AnomicFoundry extends Quest +public final class AnomicFoundry extends AbstractNpcAI { + // NPCs private static int LABORER = 22396; private static int FOREMAN = 22397; private static int LESSER_EVIL = 22398; private static int GREATER_EVIL = 22399; - + // Misc + private final Map<Integer, Integer> _atkIndex = new FastMap<>(); // npcId, x, y, z, heading, max count + //@formatter:off private static int[][] SPAWNS = { - { - LESSER_EVIL, - 27883, - 248613, - -3209, - -13248, - 5 - }, - { - LESSER_EVIL, - 26142, - 246442, - -3216, - 7064, - 5 - }, - { - LESSER_EVIL, - 27335, - 246217, - -3668, - -7992, - 5 - }, - { - LESSER_EVIL, - 28486, - 245913, - -3698, - 0, - 10 - }, - { - GREATER_EVIL, - 28684, - 244118, - -3700, - -22560, - 10 - } + {LESSER_EVIL, 27883, 248613, -3209, -13248, 5}, + {LESSER_EVIL, 26142, 246442, -3216, 7064, 5}, + {LESSER_EVIL, 27335, 246217, -3668, -7992, 5}, + {LESSER_EVIL, 28486, 245913, -3698, 0, 10}, + {GREATER_EVIL, 28684, 244118, -3700, -22560, 10}, }; + //@formatter:on private int respawnTime = 60000; private final int respawnMin = 20000; @@ -106,11 +74,10 @@ public final class AnomicFoundry extends Quest 0, 0 }; - private final Map<Integer, Integer> _atkIndex = new FastMap<>(); public AnomicFoundry() { - super(-1, AnomicFoundry.class.getSimpleName(), "hellbound/AI/Zones"); + super(AnomicFoundry.class.getSimpleName(), "hellbound/AI/Zones"); addAggroRangeEnterId(LABORER); addAttackId(LABORER); addKillId(LABORER); @@ -119,7 +86,6 @@ public final class AnomicFoundry extends Quest addSpawnId(LABORER); addSpawnId(LESSER_EVIL); addSpawnId(GREATER_EVIL); - startQuestTimer("make_spawn_1", respawnTime, null, null); } @@ -157,8 +123,7 @@ public final class AnomicFoundry extends Quest { respawnTime = 60000; } - - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -180,7 +145,7 @@ public final class AnomicFoundry extends Quest int atkIndex = _atkIndex.containsKey(npc.getObjectId()) ? _atkIndex.get(npc.getObjectId()) : 0; if (atkIndex == 0) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.ENEMY_INVASION_HURRY_UP)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.ENEMY_INVASION_HURRY_UP); cancelQuestTimer("return_laborer", npc, null); startQuestTimer("return_laborer", 60000, npc, null); @@ -206,7 +171,6 @@ public final class AnomicFoundry extends Quest npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location((npc.getX() + getRandom(-800, 800)), (npc.getY() + getRandom(-800, 800)), npc.getZ(), npc.getHeading())); } } - return super.onAttack(npc, attacker, damage, isSummon, skill); } @@ -222,7 +186,7 @@ public final class AnomicFoundry extends Quest { if (getRandom(10000) < 8000) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.PROCESS_SHOULDNT_BE_DELAYED_BECAUSE_OF_ME)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.PROCESS_SHOULDNT_BE_DELAYED_BECAUSE_OF_ME); if (respawnTime < respawnMax) { respawnTime += 10000; @@ -274,7 +238,6 @@ public final class AnomicFoundry extends Quest npc.scheduleDespawn(100); } } - return super.onSpawn(npc); } @@ -306,4 +269,4 @@ public final class AnomicFoundry extends Quest } } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/BaseTower/BaseTower.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/BaseTower/BaseTower.java index d849d07f88fd572d583254426dd72502c34a805b..b5765525048db7b02031b007f7e305e1657b0ac3 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/BaseTower/BaseTower.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/BaseTower/BaseTower.java @@ -21,31 +21,32 @@ package hellbound.AI.Zones.BaseTower; import java.util.Map; import javolution.util.FastMap; +import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.datatables.DoorTable; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.base.ClassId; import com.l2jserver.gameserver.model.holders.SkillHolder; -import com.l2jserver.gameserver.model.quest.Quest; /** * Base Tower. * @author GKR */ -public final class BaseTower extends Quest +public final class BaseTower extends AbstractNpcAI { + // NPCs private static final int GUZEN = 22362; private static final int KENDAL = 32301; private static final int BODY_DESTROYER = 22363; - - private static final Map<Integer, L2PcInstance> BODY_DESTROYER_TARGET_LIST = new FastMap<>(); - + // Skills private static final SkillHolder DEATH_WORD = new SkillHolder(5256, 1); + // Misc + private static final Map<Integer, L2PcInstance> BODY_DESTROYER_TARGET_LIST = new FastMap<>(); public BaseTower() { - super(-1, BaseTower.class.getSimpleName(), "hellbound/AI/Zones"); + super(BaseTower.class.getSimpleName(), "hellbound/AI/Zones"); addKillId(GUZEN); addKillId(BODY_DESTROYER); addFirstTalkId(KENDAL); @@ -55,7 +56,7 @@ public final class BaseTower extends Quest @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - ClassId classId = player.getClassId(); + final ClassId classId = player.getClassId(); if (classId.equalsOrChildOf(ClassId.hellKnight) || classId.equalsOrChildOf(ClassId.soultaker)) { return "32301-02.htm"; @@ -66,11 +67,11 @@ public final class BaseTower extends Quest @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - if (event.equalsIgnoreCase("close")) + if (event.equalsIgnoreCase("CLOSE")) { DoorTable.getInstance().getDoor(20260004).closeMe(); } - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -91,13 +92,16 @@ public final class BaseTower extends Quest switch (npc.getId()) { case GUZEN: + { // Should Kendal be despawned before Guzen's spawn? Or it will be crowd of Kendal's addSpawn(KENDAL, npc.getSpawn().getLocation(), false, npc.getSpawn().getRespawnDelay(), false); DoorTable.getInstance().getDoor(20260003).openMe(); DoorTable.getInstance().getDoor(20260004).openMe(); - startQuestTimer("close", 60000, npc, null, false); + startQuestTimer("CLOSE", 60000, npc, null, false); break; + } case BODY_DESTROYER: + { if (BODY_DESTROYER_TARGET_LIST.containsKey(npc.getObjectId())) { final L2PcInstance pl = BODY_DESTROYER_TARGET_LIST.get(npc.getObjectId()); @@ -105,11 +109,11 @@ public final class BaseTower extends Quest { pl.stopSkillEffects(true, DEATH_WORD.getSkillId()); } - BODY_DESTROYER_TARGET_LIST.remove(npc.getObjectId()); } + break; + } } - return super.onKill(npc, killer, isSummon); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TowerOfInfinitum/TowerOfInfinitum.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TowerOfInfinitum/TowerOfInfinitum.java index bb30430d4b94b3aaf031b75f233a80168069f5b6..f3c393aa4e0e156c6fe3bf712c26dfc7f276c006 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TowerOfInfinitum/TowerOfInfinitum.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TowerOfInfinitum/TowerOfInfinitum.java @@ -21,11 +21,12 @@ package hellbound.AI.Zones.TowerOfInfinitum; import java.util.HashMap; import java.util.Map; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.util.Util; import hellbound.HellboundEngine; @@ -34,16 +35,16 @@ import hellbound.HellboundEngine; * Tower Of Infinitum. * @author GKR */ -public final class TowerOfInfinitum extends Quest +public final class TowerOfInfinitum extends AbstractNpcAI { + // NPCs private static final int JERIAN = 32302; private static final int GK_FIRST = 32745; private static final int GK_LAST = 32752; - + // Skills private static final int PASS_SKILL = 2357; - + // Misc private static final Map<Integer, Location[]> TELE_COORDS = new HashMap<>(); - static { TELE_COORDS.put(32745, new Location[] @@ -90,7 +91,7 @@ public final class TowerOfInfinitum extends Quest public TowerOfInfinitum() { - super(-1, TowerOfInfinitum.class.getSimpleName(), "hellbound/AI/Zones"); + super(TowerOfInfinitum.class.getSimpleName(), "hellbound/AI/Zones"); addStartNpc(JERIAN); addTalkId(JERIAN); @@ -107,7 +108,7 @@ public final class TowerOfInfinitum extends Quest public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = event; - int npcId = npc.getId(); + final int npcId = npc.getId(); if (event.equalsIgnoreCase("enter") && (npcId == JERIAN)) { @@ -141,13 +142,14 @@ public final class TowerOfInfinitum extends Quest } else if ((event.equalsIgnoreCase("up") || event.equalsIgnoreCase("down")) && (npcId >= GK_FIRST) && (npcId <= GK_LAST)) { - int direction = event.equalsIgnoreCase("up") ? 0 : 1; - L2Party party = player.getParty(); + final int direction = event.equalsIgnoreCase("up") ? 0 : 1; + final L2Party party = player.getParty(); + if (party == null) { htmltext = "gk-noparty.htm"; } - else if (party.getLeaderObjectId() != player.getObjectId()) + else if (!party.isLeader(player)) { htmltext = "gk-noreq.htm"; } @@ -174,4 +176,4 @@ public final class TowerOfInfinitum extends Quest } return htmltext; } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java index 3ca787ee7d3251b760efbb47970b3a0520f3290f..34b83747008e887d6df1f333e4a7bf211ce7680f 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TowerOfNaia/TowerOfNaia.java @@ -26,6 +26,7 @@ import java.util.Map; import javolution.util.FastList; import javolution.util.FastMap; +import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.ai.CtrlIntention; @@ -38,13 +39,11 @@ import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.model.zone.L2ZoneType; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; import com.l2jserver.gameserver.util.MinionList; import com.l2jserver.gameserver.util.Util; @@ -52,7 +51,7 @@ import com.l2jserver.gameserver.util.Util; * Tower Of Naia. * @author GKR */ -public final class TowerOfNaia extends Quest +public final class TowerOfNaia extends AbstractNpcAI { // Challenge states private static final int STATE_SPORE_CHALLENGE_IN_PROGRESS = 1; @@ -116,62 +115,24 @@ public final class TowerOfNaia extends Quest "Wind", "Earth" }; + //@formatter:off private static final int[][] SPORES_MOVE_POINTS = { - { - -46080, - 246368, - -14183 - }, - { - -44816, - 246368, - -14183 - }, - { - -44224, - 247440, - -14184 - }, - { - -44896, - 248464, - -14183 - }, - { - -46064, - 248544, - -14183 - }, - { - -46720, - 247424, - -14183 - } + {-46080, 246368, -14183}, + {-44816, 246368, -14183}, + {-44224, 247440, -14184}, + {-44896, 248464, -14183}, + {-46064, 248544, -14183}, + {-46720, 247424, -14183}, }; private static final int[][] SPORES_MERGE_POSITION = { - { - -45488, - 246768, - -14183 - }, - { - -44767, - 247419, - -14183 - }, - { - -46207, - 247417, - -14183 - }, - { - -45462, - 248174, - -14183 - } + {-45488, 246768, -14183}, + {-44767, 247419, -14183}, + {-46207, 247417, -14183}, + {-45462, 248174, -14183}, }; + //@formatter:on private static final NpcStringId[] SPORES_NPCSTRING_ID = { NpcStringId.ITS_S1, @@ -199,7 +160,6 @@ public final class TowerOfNaia extends Quest private final Map<Integer, Boolean> _activeRooms = new FastMap<>(); private final Map<Integer, List<L2Npc>> _spawns = new FastMap<>(); private final FastList<L2Npc> _sporeSpawn = new FastList<L2Npc>().shared(); - static { // Format: entrance_door, exit_door @@ -276,524 +236,117 @@ public final class TowerOfNaia extends Quest ZONES.put(18503, 200029); ZONES.put(18504, 200030); ZONES.put(18505, 200031); - + //@formatter:off SPAWNS.put(18494, new int[][] { - { - 22393, - -46371, - 246400, - -9120, - 0 - }, - { - 22394, - -46435, - 245830, - -9120, - 0 - }, - { - 22394, - -46536, - 246275, - -9120, - 0 - }, - { - 22393, - -46239, - 245996, - -9120, - 0 - }, - { - 22394, - -46229, - 246347, - -9120, - 0 - }, - { - 22394, - -46019, - 246198, - -9120, - 0 - } + {22393, -46371, 246400, -9120, 0}, + {22394, -46435, 245830, -9120, 0}, + {22394, -46536, 246275, -9120, 0}, + {22393, -46239, 245996, -9120, 0}, + {22394, -46229, 246347, -9120, 0}, + {22394, -46019, 246198, -9120, 0}, }); SPAWNS.put(18495, new int[][] { - { - 22439, - -48146, - 249597, - -9124, - -16280 - }, - { - 22439, - -48144, - 248711, - -9124, - 16368 - }, - { - 22439, - -48704, - 249597, - -9104, - -16380 - }, - { - 22439, - -49219, - 249596, - -9104, - -16400 - }, - { - 22439, - -49715, - 249601, - -9104, - -16360 - }, - { - 22439, - -49714, - 248696, - -9104, - 15932 - }, - { - 22439, - -49225, - 248710, - -9104, - 16512 - }, - { - 22439, - -48705, - 248708, - -9104, - 16576 - } + {22439, -48146, 249597, -9124, -16280}, + {22439, -48144, 248711, -9124, 16368}, + {22439, -48704, 249597, -9104, -16380}, + {22439, -49219, 249596, -9104, -16400}, + {-49715, 249601, -9104, -16360}, + {22439, -49714, 248696, -9104, 15932}, + {22439, -49225, 248710, -9104, 16512}, + {22439, -48705, 248708, -9104, 16576}, }); SPAWNS.put(18496, new int[][] { - { - 22441, - -51176, - 246055, - -9984, - 0 - }, - { - 22441, - -51699, - 246190, - -9984, - 0 - }, - { - 22442, - -52060, - 245956, - -9984, - 0 - }, - { - 22442, - -51565, - 246433, - -9984, - 0 - } + {22441, -51176, 246055, -9984, 0}, + {22441, -51699, 246190, -9984, 0}, + {22442, -52060, 245956, -9984, 0}, + {22442, -51565, 246433, -9984, 0}, }); SPAWNS.put(18497, new int[][] { - { - 22440, - -49754, - 243866, - -9968, - -16328 - }, - { - 22440, - -49754, - 242940, - -9968, - 16336 - }, - { - 22440, - -48733, - 243858, - -9968, - -16208 - }, - { - 22440, - -48745, - 242936, - -9968, - 16320 - }, - { - 22440, - -49264, - 242946, - -9968, - 16312 - }, - { - 22440, - -49268, - 243869, - -9968, - -16448 - }, - { - 22440, - -48186, - 242934, - -9968, - 16576 - }, - { - 22440, - -48185, - 243855, - -9968, - -16448 - } + {22440, -49754, 243866, -9968, -16328}, + {22440, -49754, 242940, -9968, 16336}, + {22440, -48733, 243858, -9968, -16208}, + {22440, -48745, 242936, -9968, 16320}, + {22440, -49264, 242946, -9968, 16312}, + {22440, -49268, 243869, -9968, -16448}, + {22440, -48186, 242934, -9968, 16576}, + {22440, -48185, 243855, -9968, -16448}, }); SPAWNS.put(18498, new int[][] { - { - 22411, - -46355, - 246375, - -9984, - 0 - }, - { - 22411, - -46167, - 246160, - -9984, - 0 - }, - { - 22393, - -45952, - 245748, - -9984, - 0 - }, - { - 22394, - -46428, - 246254, - -9984, - 0 - }, - { - 22393, - -46490, - 245871, - -9984, - 0 - }, - { - 22394, - -45877, - 246309, - -9984, - 0 - } + {22411, -46355, 246375, -9984, 0}, + {22411, -46167, 246160, -9984, 0}, + {22393, -45952, 245748, -9984, 0}, + {22394, -46428, 246254, -9984, 0}, + {22393, -46490, 245871, -9984, 0}, + {22394, -45877, 246309, -9984, 0}, }); SPAWNS.put(18499, new int[][] { - { - 22395, - -48730, - 248067, - -9984, - 0 - }, - { - 22395, - -49112, - 248250, - -9984, - 0 - } + {22395, -48730, 248067, -9984, 0}, + {22395, -49112, 248250, -9984, 0}, }); SPAWNS.put(18500, new int[][] { - { - 22393, - -51954, - 246475, - -10848, - 0 - }, - { - 22394, - -51421, - 246512, - -10848, - 0 - }, - { - 22394, - -51404, - 245951, - -10848, - 0 - }, - { - 22393, - -51913, - 246206, - -10848, - 0 - }, - { - 22394, - -51663, - 245979, - -10848, - 0 - }, - { - 22394, - -51969, - 245809, - -10848, - 0 - }, - { - 22412, - -51259, - 246357, - -10848, - 0 - } + {22393, -51954, 246475, -10848, 0}, + {22394, -51421, 246512, -10848, 0}, + {22394, -51404, 245951, -10848, 0}, + {22393, -51913, 246206, -10848, 0}, + {22394, -51663, 245979, -10848, 0}, + {22394, -51969, 245809, -10848, 0}, + {22412, -51259, 246357, -10848, 0}, }); SPAWNS.put(18501, new int[][] { - { - 22395, - -48856, - 243949, - -10848, - 0 - }, - { - 22395, - -49144, - 244190, - -10848, - 0 - } + {22395, -48856, 243949, -10848, 0}, + {22395, -49144, 244190, -10848, 0}, }); SPAWNS.put(18502, new int[][] { - { - 22441, - -46471, - 246135, - -11704, - 0 - }, - { - 22441, - -46449, - 245997, - -11704, - 0 - }, - { - 22441, - -46235, - 246187, - -11704, - 0 - }, - { - 22441, - -46513, - 246326, - -11704, - 0 - }, - { - 22441, - -45889, - 246313, - -11704, - 0 - } + {22441, -46471, 246135, -11704, 0}, + {22441, -46449, 245997, -11704, 0}, + {22441, -46235, 246187, -11704, 0}, + {22441, -46513, 246326, -11704, 0}, + {22441, -45889, 246313, -11704, 0}, }); SPAWNS.put(18503, new int[][] { - { - 22395, - -49067, - 248050, - -11712, - 0 - }, - { - 22395, - -48957, - 248223, - -11712, - 0 - } + {22395, -49067, 248050, -11712, 0}, + {22395, -48957, 248223, -11712, 0}, }); SPAWNS.put(18504, new int[][] { - { - 22413, - -51748, - 246138, - -12568, - 0 - }, - { - 22413, - -51279, - 246200, - -12568, - 0 - }, - { - 22413, - -51787, - 246594, - -12568, - 0 - }, - { - 22413, - -51892, - 246544, - -12568, - 0 - }, - { - 22413, - -51500, - 245781, - -12568, - 0 - }, - { - 22413, - -51941, - 246045, - -12568, - 0 - } + {22413, -51748, 246138, -12568, 0}, + {22413, -51279, 246200, -12568, 0}, + {22413, -51787, 246594, -12568, 0}, + {22413, -51892, 246544, -12568, 0}, + {22413, -51500, 245781, -12568, 0}, + {22413, -51941, 246045, -12568, 0}, }); SPAWNS.put(18505, new int[][] { - { - 18490, - -48238, - 243347, - -13376, - 0 - }, - { - 18490, - -48462, - 244022, - -13376, - 0 - }, - { - 18490, - -48050, - 244045, - -13376, - 0 - }, - { - 18490, - -48229, - 243823, - -13376, - 0 - }, - { - 18490, - -47871, - 243208, - -13376, - 0 - }, - { - 18490, - -48255, - 243528, - -13376, - 0 - }, - { - 18490, - -48461, - 243780, - -13376, - 0 - }, - { - 18490, - -47983, - 243197, - -13376, - 0 - }, - { - 18490, - -47841, - 243819, - -13376, - 0 - }, - { - 18490, - -48646, - 243764, - -13376, - 0 - }, - { - 18490, - -47806, - 243850, - -13376, - 0 - }, - { - 18490, - -48456, - 243447, - -13376, - 0 - } + {18490, -48238, 243347, -13376, 0}, + {18490, -48462, 244022, -13376, 0}, + {18490, -48050, 244045, -13376, 0}, + {18490, -48229, 243823, -13376, 0}, + {18490, -47871, 243208, -13376, 0}, + {18490, -48255, 243528, -13376, 0}, + {18490, -48461, 243780, -13376, 0}, + {18490, -47983, 243197, -13376, 0}, + {18490, -47841, 243819, -13376, 0}, + {18490, -48646, 243764, -13376, 0}, + {18490, -47806, 243850, -13376, 0}, + {18490, -48456, 243447, -13376, 0}, }); + //@formatter:on } public TowerOfNaia() { - super(-1, TowerOfNaia.class.getSimpleName(), "hellbound/AI/Zones"); + super(TowerOfNaia.class.getSimpleName(), "hellbound/AI/Zones"); addFirstTalkId(CONTROLLER); addStartNpc(CONTROLLER); addStartNpc(DWARVEN_GHOST); @@ -838,7 +391,7 @@ public final class TowerOfNaia extends Quest @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - int npcId = npc.getId(); + final int npcId = npc.getId(); if (npcId == CONTROLLER) { @@ -861,8 +414,7 @@ public final class TowerOfNaia extends Quest return "manager.htm"; } } - - return null; + return super.onFirstTalk(npc, player); } @Override @@ -941,7 +493,7 @@ public final class TowerOfNaia extends Quest return null; } - int npcId = npc.getId(); + final int npcId = npc.getId(); if (event.equalsIgnoreCase("despawn_spore") && !npc.isDead() && (_challengeState == STATE_SPORE_CHALLENGE_IN_PROGRESS)) { @@ -1038,7 +590,6 @@ public final class TowerOfNaia extends Quest player.sendPacket(SystemMessageId.CAN_OPERATE_MACHINE_WHEN_IN_PARTY); } } - return htmltext; } @@ -1061,12 +612,10 @@ public final class TowerOfNaia extends Quest MinionList.spawnMinion(_lock, 18493); MinionList.spawnMinion(_lock, 18493); } - - _controller.broadcastPacket(new NpcSay(_controller.getObjectId(), Say2.NPC_ALL, _controller.getId(), NpcStringId.EMERGENCY_EMERGENCY_THE_OUTER_WALL_IS_WEAKENING_RAPIDLY)); + broadcastNpcSay(_controller, Say2.NPC_ALL, NpcStringId.EMERGENCY_EMERGENCY_THE_OUTER_WALL_IS_WEAKENING_RAPIDLY); _counter -= 10; } } - return super.onAttack(npc, attacker, damage, isSummon, skill); } @@ -1167,9 +716,7 @@ public final class TowerOfNaia extends Quest { if ((spore != null) && !spore.isDead() && (spore.getId() == npcId)) { - NpcSay ns = new NpcSay(spore.getObjectId(), Say2.NPC_ALL, spore.getId(), SPORES_NPCSTRING_ID[getRandom(4)]); - ns.addStringParameter(el); - spore.broadcastPacket(ns); + broadcastNpcSay(spore, Say2.NPC_ALL, SPORES_NPCSTRING_ID[getRandom(4)], el); } } } @@ -1184,7 +731,6 @@ public final class TowerOfNaia extends Quest spawnRandomSpore(); } } - else // index value was reached { @@ -1212,7 +758,7 @@ public final class TowerOfNaia extends Quest @Override public final String onSpawn(L2Npc npc) { - int npcId = npc.getId(); + final int npcId = npc.getId(); if ((npcId == MUTATED_ELPY) && !npc.isTeleporting()) { @@ -1328,14 +874,7 @@ public final class TowerOfNaia extends Quest } else { - ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() - { - @Override - public void run() - { - addSpawn(MUTATED_ELPY, -45474, 247450, -13994, 49152, false, 0, false); - } - }, respawnTime - System.currentTimeMillis()); + ThreadPoolManager.getInstance().scheduleGeneral(() -> addSpawn(MUTATED_ELPY, -45474, 247450, -13994, 49152, false, 0, false), respawnTime - System.currentTimeMillis()); } } @@ -1346,7 +885,7 @@ public final class TowerOfNaia extends Quest private L2Npc spawnOppositeSpore(int srcSporeId) { - int idx = Arrays.binarySearch(ELEMENTS, srcSporeId); + final int idx = Arrays.binarySearch(ELEMENTS, srcSporeId); return idx >= 0 ? addSpawn(OPPOSITE_ELEMENTS[idx], -45474, 247450, -13994, 49152, false, 0, false) : null; } @@ -1425,4 +964,4 @@ public final class TowerOfNaia extends Quest initRoom(_managerId); } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java index 2807aae15d9da051e07d811349fd2908370f54d8..2dce172e26bfd7f02a32379f3a28cdf2921fa312 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/AI/Zones/TullyWorkshop/TullyWorkshop.java @@ -27,6 +27,7 @@ import java.util.concurrent.ScheduledFuture; import javolution.util.FastList; import javolution.util.FastMap; +import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.ai.CtrlIntention; @@ -43,13 +44,11 @@ import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance; import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.base.ClassId; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.model.zone.L2ZoneType; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.clientpackets.Say2; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; import com.l2jserver.gameserver.util.MinionList; import com.l2jserver.gameserver.util.Util; @@ -57,7 +56,7 @@ import com.l2jserver.gameserver.util.Util; * Tully's Workshop. * @author GKR */ -public final class TullyWorkshop extends Quest +public final class TullyWorkshop extends AbstractNpcAI { // NPC's private static final int AGENT = 32372; @@ -459,7 +458,7 @@ public final class TullyWorkshop extends Quest public TullyWorkshop() { - super(-1, TullyWorkshop.class.getSimpleName(), "hellbound/AI/Zones"); + super(TullyWorkshop.class.getSimpleName(), "hellbound/AI/Zones"); addStartNpc(DORIAN); addTalkId(DORIAN); @@ -542,8 +541,8 @@ public final class TullyWorkshop extends Quest @Override public final String onFirstTalk(L2Npc npc, L2PcInstance player) { - ClassId classId = player.getClassId(); - int npcId = npc.getId(); + final ClassId classId = player.getClassId(); + final int npcId = npc.getId(); if (TULLY_DOORLIST.containsKey(npcId)) { @@ -573,7 +572,7 @@ public final class TullyWorkshop extends Quest { if (postMortemSpawn.indexOf(npc) == 11) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.HA_HA_YOU_WERE_SO_AFRAID_OF_DEATH_LET_ME_SEE_IF_YOU_FIND_ME_IN_TIME_MAYBE_YOU_CAN_FIND_A_WAY)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HA_HA_YOU_WERE_SO_AFRAID_OF_DEATH_LET_ME_SEE_IF_YOU_FIND_ME_IN_TIME_MAYBE_YOU_CAN_FIND_A_WAY); npc.deleteMe(); return null; } @@ -621,7 +620,7 @@ public final class TullyWorkshop extends Quest { for (int itemId : REWARDS) { - if (player.getInventory().getInventoryItemCount(itemId, -1, false) > 0) + if (hasAtLeastOneQuestItem(player, itemId)) { return "32344-01.htm"; } @@ -694,7 +693,7 @@ public final class TullyWorkshop extends Quest } } } - return null; + return super.onTalk(npc, player); } @Override @@ -747,7 +746,7 @@ public final class TullyWorkshop extends Quest if (event.equalsIgnoreCase("repair_device")) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getId(), NpcStringId.DE_ACTIVATE_THE_ALARM)); + broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.DE_ACTIVATE_THE_ALARM); brokenContraptions.remove(npc.getObjectId()); } else if (event.equalsIgnoreCase("despawn_servant") && !npc.isDead()) @@ -877,8 +876,8 @@ public final class TullyWorkshop extends Quest { if (event.equalsIgnoreCase("touch_device")) { - int i0 = talkedContraptions.contains(npc.getObjectId()) ? 0 : 1; - int i1 = player.getClassId().equalsOrChildOf(ClassId.maestro) ? 6 : 3; + final int i0 = talkedContraptions.contains(npc.getObjectId()) ? 0 : 1; + final int i1 = player.getClassId().equalsOrChildOf(ClassId.maestro) ? 6 : 3; if (getRandom(1000) < ((i1 - i0) * 100)) { @@ -1075,12 +1074,12 @@ public final class TullyWorkshop extends Quest else if ((npcId == CUBE_68) && event.startsWith("cube68_tp")) { htmltext = null; - int tpId = Integer.parseInt(event.substring(10)); - L2Party party = player.getParty(); + final int tpId = Integer.parseInt(event.substring(10)); + final L2Party party = player.getParty(); if (party != null) { - if (party.getLeaderObjectId() != player.getObjectId()) + if (!party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); } @@ -1150,8 +1149,8 @@ public final class TullyWorkshop extends Quest if (((npcId == TEMENIR) || (npcId == DRAXIUS)) && spawnedFollowers.contains(npc)) { - L2MonsterInstance victim = npcId == TEMENIR ? spawnedFollowers.get(1) : spawnedFollowers.get(2); - L2MonsterInstance actor = spawnedFollowers.get(0); + final L2MonsterInstance victim = npcId == TEMENIR ? spawnedFollowers.get(1) : spawnedFollowers.get(2); + final L2MonsterInstance actor = spawnedFollowers.get(0); if ((actor != null) && (victim != null) && !actor.isDead() && !victim.isDead() && (getRandom(1000) > 333)) { @@ -1196,13 +1195,13 @@ public final class TullyWorkshop extends Quest @Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { - int npcId = npc.getId(); + final int npcId = npc.getId(); if ((npcId == TULLY) && npc.isInsideRadius(-12557, 273901, -9000, 1000, false, false)) { for (int i[] : POST_MORTEM_SPAWNLIST) { - L2Npc spawnedNpc = addSpawn(i[0], i[1], i[2], i[3], i[4], false, i[5], false); + final L2Npc spawnedNpc = addSpawn(i[0], i[1], i[2], i[3], i[4], false, i[5], false); postMortemSpawn.add(spawnedNpc); } @@ -1210,41 +1209,90 @@ public final class TullyWorkshop extends Quest DoorTable.getInstance().getDoor(19260052).openMe(); countdownTime = 600000; - _countdown = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CountdownTask(), 60000, 10000); - NpcSay ns = new NpcSay(postMortemSpawn.get(0).getObjectId(), Say2.NPC_SHOUT, postMortemSpawn.get(0).getId(), NpcStringId.DETONATOR_INITIALIZATION_TIME_S1_MINUTES_FROM_NOW); - ns.addStringParameter(Integer.toString((countdownTime / 60000))); - postMortemSpawn.get(0).broadcastPacket(ns); + _countdown = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(() -> + { + countdownTime -= 10000; + L2Npc _npc = null; + if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0)) + { + _npc = postMortemSpawn.get(0); + } + if (countdownTime > 60000) + { + if ((countdownTime % 60000) == 0) + { + if ((_npc != null) && (_npc.getId() == INGENIOUS_CONTRAPTION)) + { + broadcastNpcSay(_npc, Say2.NPC_SHOUT, NpcStringId.S1_MINUTES_REMAINING, Integer.toString((countdownTime / 60000))); + } + } + } + else if (countdownTime <= 0) + { + if (_countdown != null) + { + _countdown.cancel(false); + _countdown = null; + } + + for (L2Npc spawnedNpc : postMortemSpawn) + { + if ((spawnedNpc != null) && ((spawnedNpc.getId() == INGENIOUS_CONTRAPTION) || (spawnedNpc.getId() == TIMETWISTER_GOLEM))) + { + spawnedNpc.deleteMe(); + } + } + + brokenContraptions.clear(); + rewardedContraptions.clear(); + talkedContraptions.clear(); + final L2ZoneType dmgZone = ZoneManager.getInstance().getZoneById(200011); + if (dmgZone != null) + { + dmgZone.setEnabled(true); + } + startQuestTimer("disable_zone", 300000, null, null); + } + else + { + if ((_npc != null) && (_npc.getId() == INGENIOUS_CONTRAPTION)) + { + broadcastNpcSay(_npc, Say2.NPC_SHOUT, NpcStringId.S1_SECONDS_REMAINING, Integer.toString((countdownTime / 1000))); + } + } + }, 60000, 10000); + broadcastNpcSay(postMortemSpawn.get(0), Say2.NPC_SHOUT, NpcStringId.DETONATOR_INITIALIZATION_TIME_S1_MINUTES_FROM_NOW, Integer.toString((countdownTime / 60000))); } else if ((npcId == TIMETWISTER_GOLEM) && (_countdown != null)) { if (getRandom(1000) >= 700) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.A_FATAL_ERROR_HAS_OCCURRED)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.A_FATAL_ERROR_HAS_OCCURRED); if (countdownTime > 180000) { countdownTime = Math.max(countdownTime - 180000, 60000); if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0) && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION)) { - postMortemSpawn.get(0).broadcastPacket(new NpcSay(postMortemSpawn.get(0).getObjectId(), Say2.NPC_SHOUT, postMortemSpawn.get(0).getId(), NpcStringId.ZZZZ_CITY_INTERFERENCE_ERROR_FORWARD_EFFECT_CREATED)); + broadcastNpcSay(postMortemSpawn.get(0), Say2.NPC_SHOUT, NpcStringId.ZZZZ_CITY_INTERFERENCE_ERROR_FORWARD_EFFECT_CREATED); } } } else { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.TIME_RIFT_DEVICE_ACTIVATION_SUCCESSFUL)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.TIME_RIFT_DEVICE_ACTIVATION_SUCCESSFUL); if ((countdownTime > 0) && (countdownTime <= 420000)) { countdownTime += 180000; if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0) && (postMortemSpawn.get(0) != null) && (postMortemSpawn.get(0).getId() == INGENIOUS_CONTRAPTION)) { - postMortemSpawn.get(0).broadcastPacket(new NpcSay(postMortemSpawn.get(0).getObjectId(), Say2.NPC_SHOUT, postMortemSpawn.get(0).getId(), NpcStringId.ZZZZ_CITY_INTERFERENCE_ERROR_RECURRENCE_EFFECT_CREATED)); + broadcastNpcSay(postMortemSpawn.get(0), Say2.NPC_SHOUT, NpcStringId.ZZZZ_CITY_INTERFERENCE_ERROR_RECURRENCE_EFFECT_CREATED); } } } } else if (Arrays.binarySearch(SIN_WARDENS, npcId) >= 0) { - int[] roomData = getRoomData(npc); + final int[] roomData = getRoomData(npc); if ((roomData[0] >= 0) && (roomData[1] >= 0)) { deathCount[roomData[0]][roomData[1]]++; @@ -1290,8 +1338,8 @@ public final class TullyWorkshop extends Quest { allowAgentSpawn = false; allowServantSpawn = false; - int cf = roomData[0] == 1 ? 3 : 0; - int[] coords = AGENT_COORDINATES[(roomData[1] + cf)]; + final int cf = roomData[0] == 1 ? 3 : 0; + final int[] coords = AGENT_COORDINATES[(roomData[1] + cf)]; L2Npc spawnedNpc = addSpawn(AGENT, coords[0], coords[1], coords[2], 0, false, 0, false); startQuestTimer("despawn_agent", 180000, spawnedNpc, null); } @@ -1319,13 +1367,11 @@ public final class TullyWorkshop extends Quest if (((npc.getId() - 22404) == 3) || ((npc.getId() - 22404) == 6)) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getId(), NpcStringId.I_FAILED_PLEASE_FORGIVE_ME_DARION)); + broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.I_FAILED_PLEASE_FORGIVE_ME_DARION); } else { - NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getId(), NpcStringId.S1_ILL_BE_BACK_DONT_GET_COMFORTABLE); - ns.addStringParameter(killer.getName()); - npc.broadcastPacket(ns); + broadcastNpcSay(npc, Say2.NPC_SHOUT, NpcStringId.S1_ILL_BE_BACK_DONT_GET_COMFORTABLE, killer.getName()); } } else if (((npcId == TEMENIR) || (npcId == DRAXIUS) || (npcId == KIRETCENAH)) && spawnedFollowers.contains(npc)) @@ -1400,15 +1446,12 @@ public final class TullyWorkshop extends Quest } else if ((npcId >= SERVANT_FIRST) && (npcId <= SERVANT_LAST) && (skillId == 5392)) { - final NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.S1_THANK_YOU_FOR_GIVING_ME_YOUR_LIFE); - ns.addStringParameter(player.getName()); - npc.broadcastPacket(ns); - + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.S1_THANK_YOU_FOR_GIVING_ME_YOUR_LIFE, player.getName()); final int dmg = (int) (player.getCurrentHp() / (npc.getId() - 22404)); player.reduceCurrentHp(dmg, null, null); npc.setCurrentHp((npc.getCurrentHp() + 10) - (npc.getId() - 22404)); } - return null; + return super.onSpellFinished(npc, player, skill); } private int[] getRoomData(L2Npc npc) @@ -1567,67 +1610,6 @@ public final class TullyWorkshop extends Quest }, STATE_CLOSE), 4000); } - protected class CountdownTask implements Runnable - { - @Override - public void run() - { - countdownTime -= 10000; - L2Npc npc = null; - if ((postMortemSpawn != null) && (postMortemSpawn.size() > 0)) - { - npc = postMortemSpawn.get(0); - } - if (countdownTime > 60000) - { - if ((countdownTime % 60000) == 0) - { - if ((npc != null) && (npc.getId() == INGENIOUS_CONTRAPTION)) - { - NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getId(), NpcStringId.S1_MINUTES_REMAINING); - ns.addStringParameter(Integer.toString((countdownTime / 60000))); - npc.broadcastPacket(ns); - } - } - } - else if (countdownTime <= 0) - { - if (_countdown != null) - { - _countdown.cancel(false); - _countdown = null; - } - - for (L2Npc spawnedNpc : postMortemSpawn) - { - if ((spawnedNpc != null) && ((spawnedNpc.getId() == INGENIOUS_CONTRAPTION) || (spawnedNpc.getId() == TIMETWISTER_GOLEM))) - { - spawnedNpc.deleteMe(); - } - } - - brokenContraptions.clear(); - rewardedContraptions.clear(); - talkedContraptions.clear(); - final L2ZoneType dmgZone = ZoneManager.getInstance().getZoneById(200011); - if (dmgZone != null) - { - dmgZone.setEnabled(true); - } - startQuestTimer("disable_zone", 300000, null, null); - } - else - { - if ((npc != null) && (npc.getId() == INGENIOUS_CONTRAPTION)) - { - final NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_SHOUT, npc.getId(), NpcStringId.S1_SECONDS_REMAINING); - ns.addStringParameter(Integer.toString((countdownTime / 1000))); - npc.broadcastPacket(ns); - } - } - } - } - private static class DoorTask implements Runnable { private final int[] _doorIds; @@ -1661,4 +1643,4 @@ public final class TullyWorkshop extends Quest } } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/HellboundEngine.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/HellboundEngine.java index 5fb7102df8ef781db51a2648c95b6c6491564e0d..78ec0356f39cda39dc0d4d326303d3c0accb8bb7 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/HellboundEngine.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/HellboundEngine.java @@ -370,4 +370,4 @@ public final class HellboundEngine extends AbstractNpcAI { protected static final HellboundEngine INSTANCE = new HellboundEngine(); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/HellboundPointData.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/HellboundPointData.java index 5993fbe9f908074a43df3ed338c21f933560d6ac..cbfb25894bb5bd788236729c4724634a3217b897 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/HellboundPointData.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/HellboundPointData.java @@ -175,4 +175,4 @@ public final class HellboundPointData extends DocumentParser { protected static final HellboundPointData INSTANCE = new HellboundPointData(); } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java index bd717a0b37803b21db4ee9aba4a7c0593c94bc61..aa8ebe4053a65d0a2f43dcc7c737b30fd96ccdaf 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java @@ -20,6 +20,8 @@ package hellbound.Instances.DemonPrinceFloor; import java.util.Calendar; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.L2World; @@ -28,7 +30,6 @@ import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.Util; @@ -37,7 +38,7 @@ import com.l2jserver.gameserver.util.Util; * Demon Prince Floor instance zone. * @author GKR */ -public final class DemonPrinceFloor extends Quest +public final class DemonPrinceFloor extends AbstractNpcAI { // NPCs private static final int GK_4 = 32748; @@ -54,7 +55,7 @@ public final class DemonPrinceFloor extends Quest public DemonPrinceFloor() { - super(-1, DemonPrinceFloor.class.getSimpleName(), "hellbound/Instances"); + super(DemonPrinceFloor.class.getSimpleName(), "hellbound/Instances"); addStartNpc(GK_4); addStartNpc(CUBE); addTalkId(GK_4); @@ -90,7 +91,7 @@ public final class DemonPrinceFloor extends Quest @Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { - int instanceId = npc.getInstanceId(); + final int instanceId = npc.getInstanceId(); if (instanceId > 0) { Instance inst = InstanceManager.getInstance().getInstance(instanceId); @@ -109,7 +110,6 @@ public final class DemonPrinceFloor extends Quest { setReenterTime(world); } - addSpawn(CUBE, -22144, 278744, -8239, 0, false, 0, false, instanceId); } return super.onKill(npc, killer, isSummon); @@ -121,7 +121,7 @@ public final class DemonPrinceFloor extends Quest { return "gk-noparty.htm"; } - else if (player.getParty().getLeaderObjectId() != player.getObjectId()) + else if (!player.getParty().isLeader(player)) { return "gk-noleader.htm"; } @@ -131,14 +131,14 @@ public final class DemonPrinceFloor extends Quest private boolean checkTeleport(L2PcInstance player) { - L2Party party = player.getParty(); + final L2Party party = player.getParty(); if (party == null) { return false; } - if (player.getObjectId() != party.getLeaderObjectId()) + if (!party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; @@ -187,7 +187,6 @@ public final class DemonPrinceFloor extends Quest return false; } } - return true; } @@ -269,4 +268,4 @@ public final class DemonPrinceFloor extends Quest } } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java index e154b4038f0626a4245f024bb366bb9e76b01562..6e1d5e4f70cbc35a6d66ae3504bd8927c7febc89 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java @@ -20,6 +20,8 @@ package hellbound.Instances.RankuFloor; import java.util.Calendar; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.L2World; @@ -28,7 +30,6 @@ import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.util.Util; @@ -37,7 +38,7 @@ import com.l2jserver.gameserver.util.Util; * Tower of Infinitum (10th Floor) instance zone. * @author GKR */ -public final class RankuFloor extends Quest +public final class RankuFloor extends AbstractNpcAI { // NPCs private static final int GK_9 = 32752; @@ -54,7 +55,7 @@ public final class RankuFloor extends Quest public RankuFloor() { - super(-1, RankuFloor.class.getSimpleName(), "hellbound/Instances"); + super(RankuFloor.class.getSimpleName(), "hellbound/Instances"); addStartNpc(GK_9); addStartNpc(CUBE); addTalkId(GK_9); @@ -139,7 +140,7 @@ public final class RankuFloor extends Quest return false; } - if (player.getObjectId() != party.getLeaderObjectId()) + if (!party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; @@ -188,7 +189,6 @@ public final class RankuFloor extends Quest return false; } } - return true; } @@ -271,4 +271,4 @@ public final class RankuFloor extends Quest } } } -} +} \ No newline at end of file diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java index 639b5698fe903f2a9ec2aaa4e4de0ea7307999e2..86db27b54a00e0a9925b7644bc04317de1f1f69b 100644 --- a/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java +++ b/L2J_DataPack_BETA/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java @@ -20,6 +20,8 @@ package hellbound.Instances.UrbanArea; import java.util.concurrent.ScheduledFuture; +import ai.npc.AbstractNpcAI; + import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2Party; @@ -31,7 +33,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2QuestGuardInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; @@ -46,7 +47,7 @@ import hellbound.HellboundEngine; * Urban Area instance zone. * @author GKR */ -public final class UrbanArea extends Quest +public final class UrbanArea extends AbstractNpcAI { protected class UrbanAreaWorld extends InstanceWorld { @@ -85,7 +86,7 @@ public final class UrbanArea extends Quest public UrbanArea() { - super(-1, UrbanArea.class.getSimpleName(), "hellbound/Instances"); + super(UrbanArea.class.getSimpleName(), "hellbound/Instances"); addFirstTalkId(DOWNTOWN_NATIVE); addStartNpc(KANAF); addStartNpc(DOWNTOWN_NATIVE); @@ -129,9 +130,9 @@ public final class UrbanArea extends Quest InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { - UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; + final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; - L2Party party = player.getParty(); + final L2Party party = player.getParty(); if (party == null) { @@ -174,7 +175,7 @@ public final class UrbanArea extends Quest @Override public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; @@ -342,14 +343,14 @@ public final class UrbanArea extends Quest private boolean checkTeleport(L2PcInstance player) { - L2Party party = player.getParty(); + final L2Party party = player.getParty(); if (party == null) { return false; } - if (player.getObjectId() != party.getLeaderObjectId()) + if (!party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; @@ -480,4 +481,4 @@ public final class UrbanArea extends Quest } } } -} +} \ No newline at end of file