From efe767389a5e6e2e1e84f05e45a739654f4ca2c4 Mon Sep 17 00:00:00 2001 From: Tofame <80583148+Tofame@users.noreply.github.com> Date: Tue, 10 Dec 2024 01:59:27 -0800 Subject: [PATCH] Fix: Unable to set spell group to 'NONE' (#32) Using the spellgroup("none"), didn't work as below in the code, after it was already loaded, the code: if (group == SPELLGROUP_NONE) {, would have overriden it and set none to either attack or healing group. This successfully fixes it. --- src/spells.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/spells.cpp b/src/spells.cpp index f8e9d273..39fe57d4 100644 --- a/src/spells.cpp +++ b/src/spells.cpp @@ -403,6 +403,15 @@ bool Spell::configureSpell(const pugi::xml_node& node) spellId = pugi::cast(attr.value()); } + + if ((attr = node.attribute("aggressive"))) { + aggressive = booleanString(attr.as_string()); + } + + if (group == SPELLGROUP_NONE) { + group = (aggressive ? SPELLGROUP_ATTACK : SPELLGROUP_HEALING); + } + if ((attr = node.attribute("group"))) { std::string tmpStr = asLowerCaseString(attr.as_string()); if (tmpStr == "none" || tmpStr == "0") { @@ -420,7 +429,7 @@ bool Spell::configureSpell(const pugi::xml_node& node) } } - if ((attr = node.attribute("groupcooldown"))) { + if (group != SPELLGROUP_NONE && (attr = node.attribute("groupcooldown"))) { groupCooldown = pugi::cast(attr.value()); } @@ -441,7 +450,7 @@ bool Spell::configureSpell(const pugi::xml_node& node) } } - if ((attr = node.attribute("secondarygroupcooldown"))) { + if (secondaryGroup != SPELLGROUP_NONE && (attr = node.attribute("secondarygroupcooldown"))) { secondaryGroupCooldown = pugi::cast(attr.value()); } @@ -520,14 +529,6 @@ bool Spell::configureSpell(const pugi::xml_node& node) pzLock = booleanString(attr.as_string()); } - if ((attr = node.attribute("aggressive"))) { - aggressive = booleanString(attr.as_string()); - } - - if (group == SPELLGROUP_NONE) { - group = (aggressive ? SPELLGROUP_ATTACK : SPELLGROUP_HEALING); - } - for (auto vocationNode : node.children()) { if (!(attr = vocationNode.attribute("name"))) { continue;