From 501da02badbac3c4be29f52213a3562123413ad1 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 12 Oct 2021 18:00:30 +0000 Subject: [PATCH] Fixed shortcut deletion removing active shortcuts from settings. --- .../clientpackets/RequestShortCutDel.java | 24 ++++++++++++------- .../clientpackets/RequestShortCutDel.java | 24 ++++++++++++------- .../clientpackets/RequestShortCutDel.java | 24 ++++++++++++------- .../clientpackets/RequestShortCutDel.java | 24 ++++++++++++------- .../clientpackets/RequestShortCutDel.java | 24 ++++++++++++------- .../clientpackets/RequestShortCutDel.java | 24 ++++++++++++------- 6 files changed, 90 insertions(+), 54 deletions(-) diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java index ee339fe470..81776c9cb5 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java @@ -55,10 +55,11 @@ public class RequestShortCutDel implements IClientIncomingPacket } // Delete the shortcut. + final Shortcut oldShortcut = player.getShortCut(_slot, _page); player.deleteShortCut(_slot, _page); + boolean removed = true; // Keep other similar shortcuts activated. - final Shortcut oldShortcut = player.getShortCut(_slot, _page); if ((oldShortcut != null) && oldShortcut.isAutoUse()) { player.removeAutoShortcut(_slot, _page); @@ -67,21 +68,26 @@ public class RequestShortCutDel implements IClientIncomingPacket if (oldShortcut.getId() == shortcut.getId()) { player.addAutoShortcut(shortcut.getSlot(), shortcut.getPage()); + removed = false; } } } // Remove auto used ids. - final int id = oldShortcut == null ? -1 : oldShortcut.getId(); - if (_slot > 263) + if (removed) { - AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); - } - else - { - AutoUseTaskManager.getInstance().removeAutoBuff(player, id); - AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + final int id = oldShortcut == null ? -1 : oldShortcut.getId(); + if (_slot > 263) + { + AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); + } + else + { + AutoUseTaskManager.getInstance().removeAutoBuff(player, id); + AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + } } + player.restoreAutoShortcutVisual(); } } diff --git a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java index ee339fe470..81776c9cb5 100644 --- a/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java +++ b/L2J_Mobius_8.2_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java @@ -55,10 +55,11 @@ public class RequestShortCutDel implements IClientIncomingPacket } // Delete the shortcut. + final Shortcut oldShortcut = player.getShortCut(_slot, _page); player.deleteShortCut(_slot, _page); + boolean removed = true; // Keep other similar shortcuts activated. - final Shortcut oldShortcut = player.getShortCut(_slot, _page); if ((oldShortcut != null) && oldShortcut.isAutoUse()) { player.removeAutoShortcut(_slot, _page); @@ -67,21 +68,26 @@ public class RequestShortCutDel implements IClientIncomingPacket if (oldShortcut.getId() == shortcut.getId()) { player.addAutoShortcut(shortcut.getSlot(), shortcut.getPage()); + removed = false; } } } // Remove auto used ids. - final int id = oldShortcut == null ? -1 : oldShortcut.getId(); - if (_slot > 263) + if (removed) { - AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); - } - else - { - AutoUseTaskManager.getInstance().removeAutoBuff(player, id); - AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + final int id = oldShortcut == null ? -1 : oldShortcut.getId(); + if (_slot > 263) + { + AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); + } + else + { + AutoUseTaskManager.getInstance().removeAutoBuff(player, id); + AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + } } + player.restoreAutoShortcutVisual(); } } diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java index ee339fe470..81776c9cb5 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java @@ -55,10 +55,11 @@ public class RequestShortCutDel implements IClientIncomingPacket } // Delete the shortcut. + final Shortcut oldShortcut = player.getShortCut(_slot, _page); player.deleteShortCut(_slot, _page); + boolean removed = true; // Keep other similar shortcuts activated. - final Shortcut oldShortcut = player.getShortCut(_slot, _page); if ((oldShortcut != null) && oldShortcut.isAutoUse()) { player.removeAutoShortcut(_slot, _page); @@ -67,21 +68,26 @@ public class RequestShortCutDel implements IClientIncomingPacket if (oldShortcut.getId() == shortcut.getId()) { player.addAutoShortcut(shortcut.getSlot(), shortcut.getPage()); + removed = false; } } } // Remove auto used ids. - final int id = oldShortcut == null ? -1 : oldShortcut.getId(); - if (_slot > 263) + if (removed) { - AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); - } - else - { - AutoUseTaskManager.getInstance().removeAutoBuff(player, id); - AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + final int id = oldShortcut == null ? -1 : oldShortcut.getId(); + if (_slot > 263) + { + AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); + } + else + { + AutoUseTaskManager.getInstance().removeAutoBuff(player, id); + AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + } } + player.restoreAutoShortcutVisual(); } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java index ee339fe470..81776c9cb5 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java @@ -55,10 +55,11 @@ public class RequestShortCutDel implements IClientIncomingPacket } // Delete the shortcut. + final Shortcut oldShortcut = player.getShortCut(_slot, _page); player.deleteShortCut(_slot, _page); + boolean removed = true; // Keep other similar shortcuts activated. - final Shortcut oldShortcut = player.getShortCut(_slot, _page); if ((oldShortcut != null) && oldShortcut.isAutoUse()) { player.removeAutoShortcut(_slot, _page); @@ -67,21 +68,26 @@ public class RequestShortCutDel implements IClientIncomingPacket if (oldShortcut.getId() == shortcut.getId()) { player.addAutoShortcut(shortcut.getSlot(), shortcut.getPage()); + removed = false; } } } // Remove auto used ids. - final int id = oldShortcut == null ? -1 : oldShortcut.getId(); - if (_slot > 263) + if (removed) { - AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); - } - else - { - AutoUseTaskManager.getInstance().removeAutoBuff(player, id); - AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + final int id = oldShortcut == null ? -1 : oldShortcut.getId(); + if (_slot > 263) + { + AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); + } + else + { + AutoUseTaskManager.getInstance().removeAutoBuff(player, id); + AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + } } + player.restoreAutoShortcutVisual(); } } diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java index ee339fe470..81776c9cb5 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java @@ -55,10 +55,11 @@ public class RequestShortCutDel implements IClientIncomingPacket } // Delete the shortcut. + final Shortcut oldShortcut = player.getShortCut(_slot, _page); player.deleteShortCut(_slot, _page); + boolean removed = true; // Keep other similar shortcuts activated. - final Shortcut oldShortcut = player.getShortCut(_slot, _page); if ((oldShortcut != null) && oldShortcut.isAutoUse()) { player.removeAutoShortcut(_slot, _page); @@ -67,21 +68,26 @@ public class RequestShortCutDel implements IClientIncomingPacket if (oldShortcut.getId() == shortcut.getId()) { player.addAutoShortcut(shortcut.getSlot(), shortcut.getPage()); + removed = false; } } } // Remove auto used ids. - final int id = oldShortcut == null ? -1 : oldShortcut.getId(); - if (_slot > 263) + if (removed) { - AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); - } - else - { - AutoUseTaskManager.getInstance().removeAutoBuff(player, id); - AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + final int id = oldShortcut == null ? -1 : oldShortcut.getId(); + if (_slot > 263) + { + AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); + } + else + { + AutoUseTaskManager.getInstance().removeAutoBuff(player, id); + AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + } } + player.restoreAutoShortcutVisual(); } } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java index ee339fe470..81776c9cb5 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/RequestShortCutDel.java @@ -55,10 +55,11 @@ public class RequestShortCutDel implements IClientIncomingPacket } // Delete the shortcut. + final Shortcut oldShortcut = player.getShortCut(_slot, _page); player.deleteShortCut(_slot, _page); + boolean removed = true; // Keep other similar shortcuts activated. - final Shortcut oldShortcut = player.getShortCut(_slot, _page); if ((oldShortcut != null) && oldShortcut.isAutoUse()) { player.removeAutoShortcut(_slot, _page); @@ -67,21 +68,26 @@ public class RequestShortCutDel implements IClientIncomingPacket if (oldShortcut.getId() == shortcut.getId()) { player.addAutoShortcut(shortcut.getSlot(), shortcut.getPage()); + removed = false; } } } // Remove auto used ids. - final int id = oldShortcut == null ? -1 : oldShortcut.getId(); - if (_slot > 263) + if (removed) { - AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); - } - else - { - AutoUseTaskManager.getInstance().removeAutoBuff(player, id); - AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + final int id = oldShortcut == null ? -1 : oldShortcut.getId(); + if (_slot > 263) + { + AutoUseTaskManager.getInstance().removeAutoSupplyItem(player, id); + } + else + { + AutoUseTaskManager.getInstance().removeAutoBuff(player, id); + AutoUseTaskManager.getInstance().removeAutoSkill(player, id); + } } + player.restoreAutoShortcutVisual(); } }