[Bots] Add Support for TryTriggerOnCastFocusEffect (#2864)

This commit is contained in:
Aeadoin 2023-02-13 01:19:50 -05:00 committed by GitHub
parent e57979c3a8
commit 0f49fbcfcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,7 @@
#include "../common/data_verification.h" #include "../common/data_verification.h"
#include "../common/misc_functions.h" #include "../common/misc_functions.h"
#include "bot.h"
#include "quest_parser_collection.h" #include "quest_parser_collection.h"
#include "lua_parser.h" #include "lua_parser.h"
#include "string_ids.h" #include "string_ids.h"
@ -6165,12 +6166,12 @@ void Mob::TryTriggerOnCastFocusEffect(focusType type, uint16 spell_id)
int32 proc_spellid = 0; int32 proc_spellid = 0;
// item focus // item focus
if (IsClient() && itembonuses.FocusEffects[type]) { if (IsOfClientBot() && itembonuses.FocusEffects[type]) {
const EQ::ItemData *temp_item = nullptr; const EQ::ItemData *temp_item = nullptr;
for (int x = EQ::invslot::EQUIPMENT_BEGIN; x <= EQ::invslot::EQUIPMENT_END; x++) { for (int x = EQ::invslot::EQUIPMENT_BEGIN; x <= EQ::invslot::EQUIPMENT_END; x++) {
temp_item = nullptr; temp_item = nullptr;
EQ::ItemInstance *ins = CastToClient()->GetInv().GetItem(x); EQ::ItemInstance const *ins = (IsClient()) ? CastToClient()->GetInv().GetItem(x) : CastToBot()->GetBotItem(x);
if (!ins) { if (!ins) {
continue; continue;
} }
@ -6230,7 +6231,7 @@ void Mob::TryTriggerOnCastFocusEffect(focusType type, uint16 spell_id)
} }
// Only use one of this focus per AA effect. // Only use one of this focus per AA effect.
if (IsClient() && aabonuses.FocusEffects[type]) { if (IsOfClientBot() && aabonuses.FocusEffects[type]) {
for (const auto &aa : aa_ranks) { for (const auto &aa : aa_ranks) {
auto ability_rank = zone->GetAlternateAdvancementAbilityAndRank(aa.first, aa.second.first); auto ability_rank = zone->GetAlternateAdvancementAbilityAndRank(aa.first, aa.second.first);
auto ability = ability_rank.first; auto ability = ability_rank.first;
@ -6244,7 +6245,7 @@ void Mob::TryTriggerOnCastFocusEffect(focusType type, uint16 spell_id)
continue; continue;
} }
proc_spellid = CastToClient()->CalcAAFocus(type, *rank, spell_id); proc_spellid = CalcAAFocus(type, *rank, spell_id);
if (proc_spellid) { if (proc_spellid) {
TryTriggerOnCastProc(0, spell_id, proc_spellid); TryTriggerOnCastProc(0, spell_id, proc_spellid);
} }