mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-21 10:25:13 -06:00
Removed magic numbers
This commit is contained in:
parent
c31b643c0b
commit
43e53f7658
1 changed files with 6 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue