[Bots] Fix spell priority commands (#4660)

- Fix priority value check in spellpriority commands
- Fix list option
- Remove unnecessary temp vector on list grab

- Will move getter to cache in future PR
This commit is contained in:
nytmyr
2025-02-08 01:18:36 -06:00
committed by GitHub
parent 95559b2e17
commit 4658e7f60d
4 changed files with 115 additions and 101 deletions
+3 -10
View File
@@ -11174,25 +11174,18 @@ void Bot::SetSpellTypePriority(uint16 spell_type, uint8 priority_type, uint16 pr
std::list<BotSpellTypeOrder> Bot::GetSpellTypesPrioritized(uint8 priority_type) {
std::list<BotSpellTypeOrder> cast_order;
std::list<BotSpellTypeOrder> temp_cast_order;
for (uint16 i = BotSpellTypes::START; i <= BotSpellTypes::END; i++) {
BotSpellTypeOrder typeSettings = {
.spellType = i,
.priority = GetSpellTypePriority(i, priority_type)
};
cast_order.emplace_back(typeSettings);
}
for (auto& currentType : cast_order) {
if (currentType.priority != 0) {
temp_cast_order.emplace_back(currentType);
if (typeSettings.priority != 0) {
cast_order.emplace_back(typeSettings);
}
}
cast_order = temp_cast_order;
if (cast_order.size() > 1) {
cast_order.sort(
[](BotSpellTypeOrder const& l, BotSpellTypeOrder const& r) {