Skip to content

Commit

Permalink
Fix: Unable to set spell group to 'NONE' (#32)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Tofame authored Dec 10, 2024
1 parent 4deca50 commit efe7673
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,15 @@ bool Spell::configureSpell(const pugi::xml_node& node)
spellId = pugi::cast<uint16_t>(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") {
Expand All @@ -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<uint32_t>(attr.value());
}

Expand All @@ -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<uint32_t>(attr.value());
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit efe7673

Please sign in to comment.