From 43e53f7658b47cdf31bdca6debbfcef3627a9c14 Mon Sep 17 00:00:00 2001 From: Bishop Date: Sun, 26 Jul 2026 11:56:56 -0500 Subject: [PATCH] Removed magic numbers --- .../node/entity/combat/equipment/WeaponInterface.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Server/src/main/core/game/node/entity/combat/equipment/WeaponInterface.java b/Server/src/main/core/game/node/entity/combat/equipment/WeaponInterface.java index 7c00c5145..934b1f88f 100644 --- a/Server/src/main/core/game/node/entity/combat/equipment/WeaponInterface.java +++ b/Server/src/main/core/game/node/entity/combat/equipment/WeaponInterface.java @@ -365,6 +365,8 @@ public final class WeaponInterface extends Component { * @param adjustAttackStyle If the attack style should be adjusted. */ public void selectAutoSpell(int buttonId, boolean adjustAttackStyle, boolean forgetAutocast) { + int stdAutocastBookChild = 83; + int defAutocastBookChild = 183; boolean modern = player.getSpellBookManager().getSpellBook() == Components.MAGIC_192; int[] data = modern ? MODERN_SPELL_IDS : ANCIENT_SPELL_IDS; if (modern && player.getEquipment().getNew(3).getName().equalsIgnoreCase("Slayer's staff")) { @@ -391,8 +393,8 @@ public final class WeaponInterface extends Component { } if (buttonId < 0) { player.getProperties().setAutocastSpell(null); - setComponentVisibility(player, Components.WEAPON_STAFF_SEL_90, 83, false); - setComponentVisibility(player, Components.WEAPON_STAFF_SEL_90, 183, false); + setComponentVisibility(player, Components.WEAPON_STAFF_SEL_90, defAutocastBookChild, false); + setComponentVisibility(player, Components.WEAPON_STAFF_SEL_90, stdAutocastBookChild, false); if (adjustAttackStyle && current != null) { setAttackStyle(3); player.getProperties().getCombatPulse().updateStyle(); @@ -400,8 +402,8 @@ public final class WeaponInterface extends Component { return; } boolean defensive = player.getSettings().getAttackStyleIndex() == 3; - player.getPacketDispatch().sendInterfaceConfig(Components.WEAPON_STAFF_SEL_90, 183, defensive); - player.getPacketDispatch().sendInterfaceConfig(Components.WEAPON_STAFF_SEL_90, 83, !defensive); + player.getPacketDispatch().sendInterfaceConfig(Components.WEAPON_STAFF_SEL_90, defAutocastBookChild, defensive); + player.getPacketDispatch().sendInterfaceConfig(Components.WEAPON_STAFF_SEL_90, stdAutocastBookChild, !defensive); current = (CombatSpell) (modern ? SpellBookManager.SpellBook.MODERN.getSpell(data[buttonId]) : SpellBookManager.SpellBook.ANCIENT.getSpell(data[buttonId])); player.getProperties().setAutocastSpell(current); setAttribute(player, attributeAutocastButtonId, buttonId);