From bfb589b0a5c0266711402ea1b672ea845eb2f81d Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 11 Sep 2021 21:14:12 +0000 Subject: [PATCH] Transcendent zone skill replacements. --- .../TranscendentZone/TranscendentZone.java | 156 +++++++++++++++--- .../TranscendentZone/TranscendentZone.java | 156 +++++++++++++++--- 2 files changed, 268 insertions(+), 44 deletions(-) diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java index abc1325838..cef6be045f 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java @@ -16,22 +16,31 @@ */ package instances.TranscendentZone; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; import java.util.concurrent.ScheduledFuture; import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.Rnd; +import org.l2jmobius.gameserver.data.xml.SkillData; import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData; +import org.l2jmobius.gameserver.enums.ShortcutType; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.TeleportWhereType; import org.l2jmobius.gameserver.instancemanager.InstanceManager; +import org.l2jmobius.gameserver.model.Shortcut; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; +import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.serverpackets.ExSendUIEvent; +import org.l2jmobius.gameserver.network.serverpackets.ShortCutInit; +import org.l2jmobius.gameserver.network.serverpackets.ShortCutRegister; import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit; import instances.AbstractInstance; @@ -60,6 +69,52 @@ public class TranscendentZone extends AbstractInstance 1106, // Dragon Valley 1107, // Sel Mahum Base }; + private static final Map SKILL_REPLACEMENTS = new HashMap<>(); + static + { + SKILL_REPLACEMENTS.put(3, 45199); // Power Strike + SKILL_REPLACEMENTS.put(16, 45200); // Mortal Blow + SKILL_REPLACEMENTS.put(56, 45201); // Power Shot + SKILL_REPLACEMENTS.put(29, 45202); // Iron Punch + SKILL_REPLACEMENTS.put(5, 45203); // Double Sonic Slash + SKILL_REPLACEMENTS.put(261, 45204); // Triple Sonic Slash + SKILL_REPLACEMENTS.put(19, 45205); // Double Shot + SKILL_REPLACEMENTS.put(190, 45206); // Fatal Strike + SKILL_REPLACEMENTS.put(263, 45207); // Deadly Blow + SKILL_REPLACEMENTS.put(280, 45208); // Burning Fist + SKILL_REPLACEMENTS.put(284, 45209); // Hurricane Assault + SKILL_REPLACEMENTS.put(343, 45210); // Lethal Shot + SKILL_REPLACEMENTS.put(344, 45211); // Lethal Blow + SKILL_REPLACEMENTS.put(400, 45212); // Tribunal + SKILL_REPLACEMENTS.put(401, 45213); // Judgment + SKILL_REPLACEMENTS.put(984, 45215); // Shield Strike + SKILL_REPLACEMENTS.put(1632, 45216); // Deadly Strike + SKILL_REPLACEMENTS.put(45184, 45217); // Guard Crush + SKILL_REPLACEMENTS.put(1230, 45218); // Prominence + SKILL_REPLACEMENTS.put(1235, 45219); // Hydro Blast + SKILL_REPLACEMENTS.put(1239, 45220); // Hurricane + SKILL_REPLACEMENTS.put(1220, 45221); // Blaze + SKILL_REPLACEMENTS.put(1175, 45222); // Aqua Swirl + SKILL_REPLACEMENTS.put(1178, 45223); // Twister + SKILL_REPLACEMENTS.put(1028, 45224); // Might of Heaven + SKILL_REPLACEMENTS.put(1245, 45225); // Steal Essence + SKILL_REPLACEMENTS.put(45155, 45227); // Soul Impulse + SKILL_REPLACEMENTS.put(45161, 45228); // Soul Piercing + SKILL_REPLACEMENTS.put(45163, 45229); // Soul Spark + SKILL_REPLACEMENTS.put(45168, 45230); // Twin Shot + SKILL_REPLACEMENTS.put(1148, 45231); // Death Spike + SKILL_REPLACEMENTS.put(1234, 45232); // Vampiric Claw + SKILL_REPLACEMENTS.put(1031, 45261); // Divine Strike + SKILL_REPLACEMENTS.put(45241, 45262); // Divine Beam + SKILL_REPLACEMENTS.put(45247, 45263); // Vampiric Touch + SKILL_REPLACEMENTS.put(1090, 45265); // Life Drain + SKILL_REPLACEMENTS.put(777, 45266); // Demolition Impact + SKILL_REPLACEMENTS.put(45249, 45267); // Earth Tremor + SKILL_REPLACEMENTS.put(348, 45268); // Spoil Crush + SKILL_REPLACEMENTS.put(45303, 45360); // Wipeout + SKILL_REPLACEMENTS.put(36, 45386); // Spinning Slasher + SKILL_REPLACEMENTS.put(47011, 47015); // Freezing Wound + } public TranscendentZone() { @@ -112,28 +167,6 @@ public class TranscendentZone extends AbstractInstance return null; } - @Override - public void onInstanceLeave(PlayerInstance player, Instance instance) - { - if (instance.getParameters().getBoolean("TranscendentZoneTaskFinished", false)) - { - instance.setParameter("TranscendentZoneTaskFinished", false); - } - player.sendPacket(new ExSendUIEvent(player, true, false, 600, 0, NpcStringId.TIME_LEFT)); - player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET); - - ThreadPool.schedule(() -> - { - if (player.getInstanceWorld() != instance) - { - finishInstance(player); - } - }, 300000); - - player.getEffectList().stopSkillEffects(SkillFinishType.REMOVED, BUFF); - instance.setParameter("PlayerIsOut", true); - } - @Override public String onFirstTalk(Npc npc, PlayerInstance player) { @@ -162,11 +195,90 @@ public class TranscendentZone extends AbstractInstance protected void onEnter(PlayerInstance player, Instance instance, boolean firstEnter) { super.onEnter(player, instance, firstEnter); + instance.setParameter("PlayerIsOut", false); if (!firstEnter) { startEvent(player); } + + // Replace normal skills. + for (Entry entry : SKILL_REPLACEMENTS.entrySet()) + { + final int normalSkillId = entry.getKey().intValue(); + final Skill knownSkill = player.getKnownSkill(normalSkillId); + if (knownSkill == null) + { + continue; + } + + final int transcendentSkillId = entry.getValue().intValue(); + player.addSkill(SkillData.getInstance().getSkill(transcendentSkillId, knownSkill.getLevel(), knownSkill.getSubLevel()), false); + for (Shortcut shortcut : player.getAllShortCuts()) + { + if ((shortcut.getType() == ShortcutType.SKILL) && (shortcut.getId() == normalSkillId)) + { + final Shortcut newShortcut = new Shortcut(shortcut.getSlot(), shortcut.getPage(), ShortcutType.SKILL, transcendentSkillId, shortcut.getLevel(), shortcut.getSubLevel(), shortcut.getCharacterType()); + player.deleteShortCut(shortcut.getSlot(), shortcut.getPage()); + player.registerShortCut(newShortcut); + player.sendPacket(new ShortCutRegister(newShortcut)); + } + } + + player.removeSkill(knownSkill, false); + } + player.sendSkillList(); + ThreadPool.schedule(() -> player.sendPacket(new ShortCutInit(player)), 1100); + } + + @Override + public void onInstanceLeave(PlayerInstance player, Instance instance) + { + if (instance.getParameters().getBoolean("TranscendentZoneTaskFinished", false)) + { + instance.setParameter("TranscendentZoneTaskFinished", false); + } + player.sendPacket(new ExSendUIEvent(player, true, false, 600, 0, NpcStringId.TIME_LEFT)); + player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET); + + ThreadPool.schedule(() -> + { + if (player.getInstanceWorld() != instance) + { + finishInstance(player); + } + }, 300000); + + player.getEffectList().stopSkillEffects(SkillFinishType.REMOVED, BUFF); + instance.setParameter("PlayerIsOut", true); + + // Restore normal skills. + for (Entry entry : SKILL_REPLACEMENTS.entrySet()) + { + final int transcendentSkillId = entry.getValue().intValue(); + final Skill knownSkill = player.getKnownSkill(transcendentSkillId); + if (knownSkill == null) + { + continue; + } + + final int normalSkillId = entry.getKey().intValue(); + player.addSkill(SkillData.getInstance().getSkill(normalSkillId, knownSkill.getLevel(), knownSkill.getSubLevel()), false); + for (Shortcut shortcut : player.getAllShortCuts()) + { + if ((shortcut.getType() == ShortcutType.SKILL) && (shortcut.getId() == transcendentSkillId)) + { + final Shortcut newShortcut = new Shortcut(shortcut.getSlot(), shortcut.getPage(), ShortcutType.SKILL, normalSkillId, shortcut.getLevel(), shortcut.getSubLevel(), shortcut.getCharacterType()); + player.deleteShortCut(shortcut.getSlot(), shortcut.getPage()); + player.registerShortCut(newShortcut); + player.sendPacket(new ShortCutRegister(newShortcut)); + } + } + + player.removeSkill(knownSkill, false); + } + player.sendSkillList(); + ThreadPool.schedule(() -> player.sendPacket(new ShortCutInit(player)), 1100); } private void startEvent(PlayerInstance player) diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java index abc1325838..cef6be045f 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java @@ -16,22 +16,31 @@ */ package instances.TranscendentZone; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; import java.util.concurrent.ScheduledFuture; import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.Rnd; +import org.l2jmobius.gameserver.data.xml.SkillData; import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData; +import org.l2jmobius.gameserver.enums.ShortcutType; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.TeleportWhereType; import org.l2jmobius.gameserver.instancemanager.InstanceManager; +import org.l2jmobius.gameserver.model.Shortcut; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; +import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.serverpackets.ExSendUIEvent; +import org.l2jmobius.gameserver.network.serverpackets.ShortCutInit; +import org.l2jmobius.gameserver.network.serverpackets.ShortCutRegister; import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZoneExit; import instances.AbstractInstance; @@ -60,6 +69,52 @@ public class TranscendentZone extends AbstractInstance 1106, // Dragon Valley 1107, // Sel Mahum Base }; + private static final Map SKILL_REPLACEMENTS = new HashMap<>(); + static + { + SKILL_REPLACEMENTS.put(3, 45199); // Power Strike + SKILL_REPLACEMENTS.put(16, 45200); // Mortal Blow + SKILL_REPLACEMENTS.put(56, 45201); // Power Shot + SKILL_REPLACEMENTS.put(29, 45202); // Iron Punch + SKILL_REPLACEMENTS.put(5, 45203); // Double Sonic Slash + SKILL_REPLACEMENTS.put(261, 45204); // Triple Sonic Slash + SKILL_REPLACEMENTS.put(19, 45205); // Double Shot + SKILL_REPLACEMENTS.put(190, 45206); // Fatal Strike + SKILL_REPLACEMENTS.put(263, 45207); // Deadly Blow + SKILL_REPLACEMENTS.put(280, 45208); // Burning Fist + SKILL_REPLACEMENTS.put(284, 45209); // Hurricane Assault + SKILL_REPLACEMENTS.put(343, 45210); // Lethal Shot + SKILL_REPLACEMENTS.put(344, 45211); // Lethal Blow + SKILL_REPLACEMENTS.put(400, 45212); // Tribunal + SKILL_REPLACEMENTS.put(401, 45213); // Judgment + SKILL_REPLACEMENTS.put(984, 45215); // Shield Strike + SKILL_REPLACEMENTS.put(1632, 45216); // Deadly Strike + SKILL_REPLACEMENTS.put(45184, 45217); // Guard Crush + SKILL_REPLACEMENTS.put(1230, 45218); // Prominence + SKILL_REPLACEMENTS.put(1235, 45219); // Hydro Blast + SKILL_REPLACEMENTS.put(1239, 45220); // Hurricane + SKILL_REPLACEMENTS.put(1220, 45221); // Blaze + SKILL_REPLACEMENTS.put(1175, 45222); // Aqua Swirl + SKILL_REPLACEMENTS.put(1178, 45223); // Twister + SKILL_REPLACEMENTS.put(1028, 45224); // Might of Heaven + SKILL_REPLACEMENTS.put(1245, 45225); // Steal Essence + SKILL_REPLACEMENTS.put(45155, 45227); // Soul Impulse + SKILL_REPLACEMENTS.put(45161, 45228); // Soul Piercing + SKILL_REPLACEMENTS.put(45163, 45229); // Soul Spark + SKILL_REPLACEMENTS.put(45168, 45230); // Twin Shot + SKILL_REPLACEMENTS.put(1148, 45231); // Death Spike + SKILL_REPLACEMENTS.put(1234, 45232); // Vampiric Claw + SKILL_REPLACEMENTS.put(1031, 45261); // Divine Strike + SKILL_REPLACEMENTS.put(45241, 45262); // Divine Beam + SKILL_REPLACEMENTS.put(45247, 45263); // Vampiric Touch + SKILL_REPLACEMENTS.put(1090, 45265); // Life Drain + SKILL_REPLACEMENTS.put(777, 45266); // Demolition Impact + SKILL_REPLACEMENTS.put(45249, 45267); // Earth Tremor + SKILL_REPLACEMENTS.put(348, 45268); // Spoil Crush + SKILL_REPLACEMENTS.put(45303, 45360); // Wipeout + SKILL_REPLACEMENTS.put(36, 45386); // Spinning Slasher + SKILL_REPLACEMENTS.put(47011, 47015); // Freezing Wound + } public TranscendentZone() { @@ -112,28 +167,6 @@ public class TranscendentZone extends AbstractInstance return null; } - @Override - public void onInstanceLeave(PlayerInstance player, Instance instance) - { - if (instance.getParameters().getBoolean("TranscendentZoneTaskFinished", false)) - { - instance.setParameter("TranscendentZoneTaskFinished", false); - } - player.sendPacket(new ExSendUIEvent(player, true, false, 600, 0, NpcStringId.TIME_LEFT)); - player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET); - - ThreadPool.schedule(() -> - { - if (player.getInstanceWorld() != instance) - { - finishInstance(player); - } - }, 300000); - - player.getEffectList().stopSkillEffects(SkillFinishType.REMOVED, BUFF); - instance.setParameter("PlayerIsOut", true); - } - @Override public String onFirstTalk(Npc npc, PlayerInstance player) { @@ -162,11 +195,90 @@ public class TranscendentZone extends AbstractInstance protected void onEnter(PlayerInstance player, Instance instance, boolean firstEnter) { super.onEnter(player, instance, firstEnter); + instance.setParameter("PlayerIsOut", false); if (!firstEnter) { startEvent(player); } + + // Replace normal skills. + for (Entry entry : SKILL_REPLACEMENTS.entrySet()) + { + final int normalSkillId = entry.getKey().intValue(); + final Skill knownSkill = player.getKnownSkill(normalSkillId); + if (knownSkill == null) + { + continue; + } + + final int transcendentSkillId = entry.getValue().intValue(); + player.addSkill(SkillData.getInstance().getSkill(transcendentSkillId, knownSkill.getLevel(), knownSkill.getSubLevel()), false); + for (Shortcut shortcut : player.getAllShortCuts()) + { + if ((shortcut.getType() == ShortcutType.SKILL) && (shortcut.getId() == normalSkillId)) + { + final Shortcut newShortcut = new Shortcut(shortcut.getSlot(), shortcut.getPage(), ShortcutType.SKILL, transcendentSkillId, shortcut.getLevel(), shortcut.getSubLevel(), shortcut.getCharacterType()); + player.deleteShortCut(shortcut.getSlot(), shortcut.getPage()); + player.registerShortCut(newShortcut); + player.sendPacket(new ShortCutRegister(newShortcut)); + } + } + + player.removeSkill(knownSkill, false); + } + player.sendSkillList(); + ThreadPool.schedule(() -> player.sendPacket(new ShortCutInit(player)), 1100); + } + + @Override + public void onInstanceLeave(PlayerInstance player, Instance instance) + { + if (instance.getParameters().getBoolean("TranscendentZoneTaskFinished", false)) + { + instance.setParameter("TranscendentZoneTaskFinished", false); + } + player.sendPacket(new ExSendUIEvent(player, true, false, 600, 0, NpcStringId.TIME_LEFT)); + player.sendPacket(TimedHuntingZoneExit.STATIC_PACKET); + + ThreadPool.schedule(() -> + { + if (player.getInstanceWorld() != instance) + { + finishInstance(player); + } + }, 300000); + + player.getEffectList().stopSkillEffects(SkillFinishType.REMOVED, BUFF); + instance.setParameter("PlayerIsOut", true); + + // Restore normal skills. + for (Entry entry : SKILL_REPLACEMENTS.entrySet()) + { + final int transcendentSkillId = entry.getValue().intValue(); + final Skill knownSkill = player.getKnownSkill(transcendentSkillId); + if (knownSkill == null) + { + continue; + } + + final int normalSkillId = entry.getKey().intValue(); + player.addSkill(SkillData.getInstance().getSkill(normalSkillId, knownSkill.getLevel(), knownSkill.getSubLevel()), false); + for (Shortcut shortcut : player.getAllShortCuts()) + { + if ((shortcut.getType() == ShortcutType.SKILL) && (shortcut.getId() == transcendentSkillId)) + { + final Shortcut newShortcut = new Shortcut(shortcut.getSlot(), shortcut.getPage(), ShortcutType.SKILL, normalSkillId, shortcut.getLevel(), shortcut.getSubLevel(), shortcut.getCharacterType()); + player.deleteShortCut(shortcut.getSlot(), shortcut.getPage()); + player.registerShortCut(newShortcut); + player.sendPacket(new ShortCutRegister(newShortcut)); + } + } + + player.removeSkill(knownSkill, false); + } + player.sendSkillList(); + ThreadPool.schedule(() -> player.sendPacket(new ShortCutInit(player)), 1100); } private void startEvent(PlayerInstance player)