diff --git a/src/enums.h b/src/enums.h index a86127f..07a292c 100644 --- a/src/enums.h +++ b/src/enums.h @@ -150,6 +150,8 @@ enum SpellGroup_t : uint8_t { SPELLGROUP_HEALING = 2, SPELLGROUP_SUPPORT = 3, SPELLGROUP_SPECIAL = 4, + + SPELLGROUP_UNKNOWN = 255, // last, unspecified }; enum SpellType_t : uint8_t { diff --git a/src/luascript.cpp b/src/luascript.cpp index 1f1e945..7148cf8 100644 --- a/src/luascript.cpp +++ b/src/luascript.cpp @@ -16671,7 +16671,7 @@ int LuaScriptInterface::luaSpellGroup(lua_State* L) pushBoolean(L, true); } else if (isString(L, 2)) { group = stringToSpellGroup(getString(L, 2)); - if (group != SPELLGROUP_NONE) { + if (group != SPELLGROUP_UNKNOWN) { spell->setGroup(group); } else { std::cout << "[Warning - Spell::group] Unknown group: " << getString(L, 2) << std::endl; @@ -16693,7 +16693,7 @@ int LuaScriptInterface::luaSpellGroup(lua_State* L) pushBoolean(L, true); } else if (isString(L, 2) && isString(L, 3)) { primaryGroup = stringToSpellGroup(getString(L, 2)); - if (primaryGroup != SPELLGROUP_NONE) { + if (primaryGroup != SPELLGROUP_UNKNOWN) { spell->setGroup(primaryGroup); } else { std::cout << "[Warning - Spell::group] Unknown primaryGroup: " << getString(L, 2) << std::endl; @@ -16701,7 +16701,7 @@ int LuaScriptInterface::luaSpellGroup(lua_State* L) return 1; } secondaryGroup = stringToSpellGroup(getString(L, 3)); - if (secondaryGroup != SPELLGROUP_NONE) { + if (secondaryGroup != SPELLGROUP_UNKNOWN) { spell->setSecondaryGroup(secondaryGroup); } else { std::cout << "[Warning - Spell::group] Unknown secondaryGroup: " << getString(L, 3) << std::endl; diff --git a/src/spells.cpp b/src/spells.cpp index 39fe57d..8878d96 100644 --- a/src/spells.cpp +++ b/src/spells.cpp @@ -416,6 +416,7 @@ bool Spell::configureSpell(const pugi::xml_node& node) std::string tmpStr = asLowerCaseString(attr.as_string()); if (tmpStr == "none" || tmpStr == "0") { group = SPELLGROUP_NONE; + groupCooldown = 0; } else if (tmpStr == "attack" || tmpStr == "1") { group = SPELLGROUP_ATTACK; } else if (tmpStr == "healing" || tmpStr == "2") { diff --git a/src/spells.h b/src/spells.h index dc38d5f..a210bb7 100644 --- a/src/spells.h +++ b/src/spells.h @@ -188,6 +188,9 @@ class Spell : public BaseSpell } void setGroup(SpellGroup_t g) { group = g; + if(group == SPELLGROUP_NONE) { + groupCooldown = 0; + } } SpellGroup_t getSecondaryGroup() const { return secondaryGroup; diff --git a/src/tools.cpp b/src/tools.cpp index 90b1413..2e71e2c 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -1243,8 +1243,10 @@ int64_t OTSYS_TIME() SpellGroup_t stringToSpellGroup(const std::string& value) { - std::string tmpStr = asLowerCaseString(value); - if (tmpStr == "attack" || tmpStr == "1") { + std::string tmpStr = boost::algorithm::to_lower_copy(value); + if (tmpStr == "none" || tmpStr == "0") { + return SPELLGROUP_NONE; + } else if (tmpStr == "attack" || tmpStr == "1") { return SPELLGROUP_ATTACK; } else if (tmpStr == "healing" || tmpStr == "2") { return SPELLGROUP_HEALING; @@ -1254,7 +1256,7 @@ SpellGroup_t stringToSpellGroup(const std::string& value) return SPELLGROUP_SPECIAL; } - return SPELLGROUP_NONE; + return SPELLGROUP_UNKNOWN; } std::vector depotBoxes = {