From 0159615dba8fd6a579346cfb8a1ab71f0626757d Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Thu, 20 Aug 2020 22:47:26 -0700 Subject: [PATCH] Added workaround for invalid spell cast modes SQ defaults to SC when encountered until implemented SpellsQuickPanel changes CharData actions for the time being --- core/src/com/riiablo/engine/server/Actioneer.java | 4 ++++ core/src/com/riiablo/screen/panel/SpellsQuickPanel.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/com/riiablo/engine/server/Actioneer.java b/core/src/com/riiablo/engine/server/Actioneer.java index e37df608..1a2fdebe 100644 --- a/core/src/com/riiablo/engine/server/Actioneer.java +++ b/core/src/com/riiablo/engine/server/Actioneer.java @@ -26,6 +26,10 @@ public class Actioneer extends PassiveSystem { byte mode = (byte) mClass.get(entityId).type.getMode(skill.anim); log.trace("mode: {}", mode); + if (mode == -1) { // TODO: replace -1 with some const INVALID_SKILL + mode = (byte) mClass.get(entityId).type.getMode("SC"); + log.trace("changed mode to {} because it was invalid", mode); + } mSequence.create(entityId).sequence(mode, mMovementModes.get(entityId).NU); } diff --git a/core/src/com/riiablo/screen/panel/SpellsQuickPanel.java b/core/src/com/riiablo/screen/panel/SpellsQuickPanel.java index 692dbec8..56aa1b11 100644 --- a/core/src/com/riiablo/screen/panel/SpellsQuickPanel.java +++ b/core/src/com/riiablo/screen/panel/SpellsQuickPanel.java @@ -106,8 +106,12 @@ public class SpellsQuickPanel extends Table implements Disposable, CharData.Skil public void onPressed(MappedKey key, int keycode) { HotkeyButton button = keyMappings.get(key); if (button == null) return; - // TODO: Replace Riiablo.charData.action with this button's action observer.copy(button); + // FIXME: it isn't appropriate to have this call here -- should separate into a controller + Riiablo.charData.setAction( + Riiablo.charData.getItems().getAlternate(), + leftSkills ? Input.Buttons.LEFT : Input.Buttons.RIGHT, + button.getSkill()); } }; for (MappedKey Skill : Keys.Skill) Skill.addStateListener(mappedKeyListener);