From fc4cd3eddb118f5fd40cfe9216bf723317fcbc17 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sun, 2 Jan 2022 01:07:11 +0000 Subject: [PATCH] Unequip shield on Death Knight class change. --- .../handlers/effecthandlers/ClassChange.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/L2J_Mobius_10.0_MasterClass/dist/game/data/scripts/handlers/effecthandlers/ClassChange.java b/L2J_Mobius_10.0_MasterClass/dist/game/data/scripts/handlers/effecthandlers/ClassChange.java index 30bc29f6f5..c1e1f7835c 100644 --- a/L2J_Mobius_10.0_MasterClass/dist/game/data/scripts/handlers/effecthandlers/ClassChange.java +++ b/L2J_Mobius_10.0_MasterClass/dist/game/data/scripts/handlers/effecthandlers/ClassChange.java @@ -25,6 +25,8 @@ import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; import org.l2jmobius.gameserver.model.item.instance.Item; +import org.l2jmobius.gameserver.model.item.type.ArmorType; +import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.olympiad.OlympiadManager; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -42,9 +44,10 @@ import org.l2jmobius.gameserver.taskmanager.AutoUseTaskManager; */ public class ClassChange extends AbstractEffect { - private final int _index; private static final int IDENTITY_CRISIS_SKILL_ID = 1570; + private final int _index; + public ClassChange(StatSet params) { _index = params.getInt("index", 0); @@ -156,9 +159,17 @@ public class ClassChange extends AbstractEffect } } - // Fix Death Knight model animation. + // Death Knight adjustments. if (player.isDeathKnight()) { + // Unequip shield. + final Item lhand = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND); + if ((lhand != null) && lhand.isArmor() && (lhand.getItemType() == ArmorType.SHIELD)) + { + player.disarmShield(); + } + + // Fix Death Knight model animation. player.transform(101, false); ThreadPool.schedule(() -> player.stopTransformation(false), 50); }