misc cleanup

This commit is contained in:
nytmyr
2024-11-26 09:09:08 -06:00
parent e6aeb01ddf
commit d97f691255
3 changed files with 130 additions and 130 deletions
+110 -110
View File
@@ -9406,14 +9406,14 @@ bool Bot::PrecastChecks(Mob* tar, uint16 spellType) {
return true; return true;
} }
bool Bot::CastChecks(uint16 spellid, Mob* tar, uint16 spellType, bool doPrechecks, bool AECheck) { bool Bot::CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechecks, bool AECheck) {
if (!tar) { if (!tar) {
LogBotPreChecksDetail("{} says, 'Cancelling cast due to CastChecks !tar.'", GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast due to CastChecks !tar.'", GetCleanName()); //deleteme
return false; return false;
} }
if (doPrechecks) { if (doPrechecks) {
if (spells[spellid].target_type == ST_Self && tar != this) { if (spells[spell_id].target_type == ST_Self && tar != this) {
tar = this; tar = this;
} }
@@ -9425,105 +9425,105 @@ bool Bot::CastChecks(uint16 spellid, Mob* tar, uint16 spellType, bool doPrecheck
LogBotPreChecksDetail("{} says, 'Running [{}] CastChecks on [{}].'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Running [{}] CastChecks on [{}].'", GetCleanName(), GetSpellTypeNameByID(spellType), tar->GetCleanName()); //deleteme
if (!IsValidSpell(spellid)) { if (!IsValidSpell(spell_id)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast due to !IsValidSpell.'", GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast due to !IsValidSpell.'", GetCleanName()); //deleteme
return false; return false;
} }
if (spells[spellid].target_type == ST_Self && tar != this) { if (spells[spell_id].target_type == ST_Self && tar != this) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to ST_Self.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to ST_Self.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (!CheckSpellRecastTimer(spellid)) { if (!CheckSpellRecastTimer(spell_id)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} due to !CheckSpellRecastTimer.'", GetCleanName(), GetSpellName(spellid)); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} due to !CheckSpellRecastTimer.'", GetCleanName(), GetSpellName(spell_id)); //deleteme
return false; return false;
} }
if (!BotHasEnoughMana(spellid)) { if (!BotHasEnoughMana(spell_id)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} due to !BotHasEnoughMana.'", GetCleanName(), GetSpellName(spellid)); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} due to !BotHasEnoughMana.'", GetCleanName(), GetSpellName(spell_id)); //deleteme
return false; return false;
} }
if (zone->IsSpellBlocked(spellid, glm::vec3(GetPosition()))) { if (zone->IsSpellBlocked(spell_id, glm::vec3(GetPosition()))) {
LogBotPreChecks("{} says, 'Cancelling cast of {} due to IsSpellBlocked.'", GetCleanName(), GetSpellName(spellid)); //deleteme LogBotPreChecks("{} says, 'Cancelling cast of {} due to IsSpellBlocked.'", GetCleanName(), GetSpellName(spell_id)); //deleteme
return false; return false;
} }
if (!zone->CanLevitate() && IsEffectInSpell(spellid, SE_Levitate)) { if (!zone->CanLevitate() && IsEffectInSpell(spell_id, SE_Levitate)) {
LogBotPreChecks("{} says, 'Cancelling cast of {} due to !CanLevitate.'", GetCleanName(), GetSpellName(spellid)); //deleteme LogBotPreChecks("{} says, 'Cancelling cast of {} due to !CanLevitate.'", GetCleanName(), GetSpellName(spell_id)); //deleteme
return false; return false;
} }
if (spells[spellid].time_of_day == SpellTimeRestrictions::Day && !zone->zone_time.IsDayTime()) { if (spells[spell_id].time_of_day == SpellTimeRestrictions::Day && !zone->zone_time.IsDayTime()) {
LogBotPreChecks("{} says, 'Cancelling cast of {} due to !IsDayTime.'", GetCleanName(), GetSpellName(spellid)); //deleteme LogBotPreChecks("{} says, 'Cancelling cast of {} due to !IsDayTime.'", GetCleanName(), GetSpellName(spell_id)); //deleteme
return false; return false;
} }
if (spells[spellid].time_of_day == SpellTimeRestrictions::Night && !zone->zone_time.IsNightTime()) { if (spells[spell_id].time_of_day == SpellTimeRestrictions::Night && !zone->zone_time.IsNightTime()) {
LogBotPreChecks("{} says, 'Cancelling cast of {} due to !IsNightTime.'", GetCleanName(), GetSpellName(spellid)); //deleteme LogBotPreChecks("{} says, 'Cancelling cast of {} due to !IsNightTime.'", GetCleanName(), GetSpellName(spell_id)); //deleteme
return false; return false;
} }
if (spells[spellid].zone_type == 1 && !zone->CanCastOutdoor()) { if (spells[spell_id].zone_type == 1 && !zone->CanCastOutdoor()) {
LogBotPreChecks("{} says, 'Cancelling cast of {} due to !CanCastOutdoor.'", GetCleanName(), GetSpellName(spellid)); //deleteme LogBotPreChecks("{} says, 'Cancelling cast of {} due to !CanCastOutdoor.'", GetCleanName(), GetSpellName(spell_id)); //deleteme
return false; return false;
} }
if (!AECheck && !IsValidSpellRange(spellid, tar)) { if (!AECheck && !IsValidSpellRange(spell_id, tar)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsValidSpellRange.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsValidSpellRange.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (!IsValidTargetType(spellid, GetSpellTargetType(spellid), tar->GetBodyType())) { if (!IsValidTargetType(spell_id, GetSpellTargetType(spell_id), tar->GetBodyType())) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsValidTargetType.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsValidTargetType.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (tar->GetSpecialAbility(SpecialAbility::CastingFromRangeImmunity) && !CombatRange(tar)) { if (tar->GetSpecialAbility(SpecialAbility::CastingFromRangeImmunity) && !CombatRange(tar)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IMMUNE_CASTING_FROM_RANGE.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IMMUNE_CASTING_FROM_RANGE.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (tar->IsImmuneToBotSpell(spellid, this)) { if (tar->IsImmuneToBotSpell(spell_id, this)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsImmuneToBotSpell.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsImmuneToBotSpell.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (!DoResistCheckBySpellType(tar, spellid, spellType)) { if (!DoResistCheckBySpellType(tar, spell_id, spellType)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to DoResistCheckBySpellType.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to DoResistCheckBySpellType.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (!IsCommandedSpell() && !IsTaunting() && GetSpellTypeAggroCheck(spellType) && HasOrMayGetAggro(IsSitting(), spellid) && !tar->IsFleeing()) { if (!IsCommandedSpell() && !IsTaunting() && GetSpellTypeAggroCheck(spellType) && HasOrMayGetAggro(IsSitting(), spell_id) && !tar->IsFleeing()) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to HasOrMayGetAggro.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to HasOrMayGetAggro.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if ( if (
(RequiresStackCheck(spellType) || (!RequiresStackCheck(spellType) && CalcBuffDuration(this, tar, spellid) != 0)) (RequiresStackCheck(spellType) || (!RequiresStackCheck(spellType) && CalcBuffDuration(this, tar, spell_id) != 0))
&& &&
tar->CanBuffStack(spellid, GetLevel(), true) < 0 tar->CanBuffStack(spell_id, GetLevel(), true) < 0
) { ) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to !CanBuffStack.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to !CanBuffStack.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (IsBeneficialSpell(spellid) && tar->BuffCount() >= tar->GetCurrentBuffSlots() && CalcBuffDuration(this, tar, spellid) != 0) { if (IsBeneficialSpell(spell_id) && tar->BuffCount() >= tar->GetCurrentBuffSlots() && CalcBuffDuration(this, tar, spell_id) != 0) {
return false; return false;
} }
LogBotPreChecksDetail("{} says, 'Doing CanCastSpellType checks of {} on {}.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Doing CanCastSpellType checks of {} on {}.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
if (!CanCastSpellType(spellType, spellid, tar)) { if (!CanCastSpellType(spellType, spell_id, tar)) {
return false; return false;
} }
return true; return true;
} }
bool Bot::CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar) { bool Bot::CanCastSpellType(uint16 spellType, uint16 spell_id, Mob* tar) {
if (!spellid || !tar) { if (!spell_id || !tar) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to failsafe checks.'", GetCleanName(), (spellid ? GetSpellName(spellid) : (spellType ? GetSpellTypeNameByID(spellType) : "Unknown")), (tar ? tar->GetCleanName() : "Unknown")); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to failsafe checks.'", GetCleanName(), (spell_id ? GetSpellName(spell_id) : (spellType ? GetSpellTypeNameByID(spellType) : "Unknown")), (tar ? tar->GetCleanName() : "Unknown")); //deleteme
return false; return false;
} }
@@ -9540,44 +9540,44 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar) {
case BotSpellTypes::PetResistBuffs: case BotSpellTypes::PetResistBuffs:
if ( if (
!( !(
spells[spellid].target_type == ST_Target || spells[spell_id].target_type == ST_Target ||
spells[spellid].target_type == ST_Pet || spells[spell_id].target_type == ST_Pet ||
(tar == this && spells[spellid].target_type != ST_TargetsTarget) || (tar == this && spells[spell_id].target_type != ST_TargetsTarget) ||
spells[spellid].target_type == ST_Group || spells[spell_id].target_type == ST_Group ||
spells[spellid].target_type == ST_GroupTeleport spells[spell_id].target_type == ST_GroupTeleport
) )
) { ) {
LogBotPreChecks("{} says, 'Cancelling cast of {} on {} due to target_type checks.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecks("{} says, 'Cancelling cast of {} on {} due to target_type checks.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (tar->IsBlockedBuff(spellid)) { if (tar->IsBlockedBuff(spell_id)) {
LogBotPreChecks("{} says, 'Cancelling cast of {} on {} due to IsBlockedBuff.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecks("{} says, 'Cancelling cast of {} on {} due to IsBlockedBuff.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (IsEffectInSpell(spellid, SE_Teleport) || IsEffectInSpell(spellid, SE_Succor)) { if ((spellType != BotSpellTypes::Teleport && spellType != BotSpellTypes::Succor) && (IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Succor))) {
LogBotPreChecks("{} says, 'Cancelling cast of {} on {} due to Teleport.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecks("{} says, 'Cancelling cast of {} on {} due to Teleport.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (tar->IsPet() && !RuleB(Bots, CanCastIllusionsOnPets) && IsEffectInSpell(spellid, SE_Illusion)) { if (tar->IsPet() && !RuleB(Bots, CanCastIllusionsOnPets) && IsEffectInSpell(spell_id, SE_Illusion)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to PetSE_Illusion.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to PetSE_Illusion.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (spells[spellid].target_type == ST_Pet && (!tar->IsPet() || (tar->GetOwner() != this && !RuleB(Bots, CanCastPetOnlyOnOthersPets)))) { if (spells[spell_id].target_type == ST_Pet && (!tar->IsPet() || (tar->GetOwner() != this && !RuleB(Bots, CanCastPetOnlyOnOthersPets)))) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to PetOnly.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to PetOnly.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if ((IsGroupSpell(spellid) && tar->IsPet()) && (!tar->GetOwner() || (RuleB(Bots, RequirePetAffinity) && !tar->GetOwner()->HasPetAffinity()))) { if ((IsGroupSpell(spell_id) && tar->IsPet()) && (!tar->GetOwner() || (RuleB(Bots, RequirePetAffinity) && !tar->GetOwner()->HasPetAffinity()))) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to PetGroupSpellTarget.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to PetGroupSpellTarget.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
if (!IsCommandedSpell() && IsTargetAlreadyReceivingSpell(tar, spellid)) { if (!IsCommandedSpell() && IsTargetAlreadyReceivingSpell(tar, spell_id)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsTargetAlreadyReceivingSpell.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsTargetAlreadyReceivingSpell.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
@@ -9587,21 +9587,21 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar) {
if ( if (
tar->IsBot() && tar->GetLevel() > tar->CastToBot()->GetStopMeleeLevel() && tar->IsBot() && tar->GetLevel() > tar->CastToBot()->GetStopMeleeLevel() &&
( (
IsEffectInSpell(spellid, SE_AttackSpeed) || IsEffectInSpell(spellid, SE_ReverseDS)) || IsEffectInSpell(spell_id, SE_AttackSpeed) || IsEffectInSpell(spell_id, SE_ReverseDS)) ||
(SpellEffectsCount(spellid) == 1 && (IsEffectInSpell(spellid, SE_ATK) || IsEffectInSpell(spellid, SE_STR)) (SpellEffectsCount(spell_id) == 1 && (IsEffectInSpell(spell_id, SE_ATK) || IsEffectInSpell(spell_id, SE_STR))
) )
) { ) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Archetype::Caster.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Archetype::Caster.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
break; break;
case Archetype::Melee: case Archetype::Melee:
if ( if (
IsEffectInSpell(spellid, SE_IncreaseSpellHaste) || IsEffectInSpell(spellid, SE_ManaPool) || IsEffectInSpell(spell_id, SE_IncreaseSpellHaste) || IsEffectInSpell(spell_id, SE_ManaPool) ||
IsEffectInSpell(spellid, SE_CastingLevel) || IsEffectInSpell(spellid, SE_ManaRegen_v2) || IsEffectInSpell(spell_id, SE_CastingLevel) || IsEffectInSpell(spell_id, SE_ManaRegen_v2) ||
IsEffectInSpell(spellid, SE_CurrentMana) IsEffectInSpell(spell_id, SE_CurrentMana)
) { ) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Archetype::Melee.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Archetype::Melee.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
break; break;
@@ -9613,14 +9613,14 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar) {
// Differences for each type // Differences for each type
if (spellType != BotSpellTypes::InCombatBuff) { if (spellType != BotSpellTypes::InCombatBuff) {
if (IsEffectInSpell(spellid, SE_AbsorbMagicAtt) || IsEffectInSpell(spellid, SE_Rune)) { if (IsEffectInSpell(spell_id, SE_AbsorbMagicAtt) || IsEffectInSpell(spell_id, SE_Rune)) {
for (int i = 0; i < tar->GetMaxTotalSlots(); i++) { for (int i = 0; i < tar->GetMaxTotalSlots(); i++) {
uint32 buff_count = tar->GetMaxTotalSlots(); uint32 buff_count = tar->GetMaxTotalSlots();
for (unsigned int j = 0; j < buff_count; j++) { for (unsigned int j = 0; j < buff_count; j++) {
if (IsValidSpell(tar->GetBuffs()[j].spellid)) { if (IsValidSpell(tar->GetBuffs()[j].spellid)) {
if (IsLichSpell(tar->GetBuffs()[j].spellid)) { if (IsLichSpell(tar->GetBuffs()[j].spellid)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsLichSpell.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsLichSpell.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
} }
@@ -9633,8 +9633,8 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar) {
case BotSpellTypes::PreCombatBuffSong: case BotSpellTypes::PreCombatBuffSong:
case BotSpellTypes::InCombatBuffSong: case BotSpellTypes::InCombatBuffSong:
case BotSpellTypes::OutOfCombatBuffSong: case BotSpellTypes::OutOfCombatBuffSong:
if (!IsCommandedSpell() && IsTargetAlreadyReceivingSpell(tar, spellid)) { if (!IsCommandedSpell() && IsTargetAlreadyReceivingSpell(tar, spell_id)) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsTargetAlreadyReceivingSpell.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to IsTargetAlreadyReceivingSpell.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
@@ -9644,21 +9644,21 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar) {
if ( if (
tar->IsBot() && tar->GetLevel() > tar->CastToBot()->GetStopMeleeLevel() && tar->IsBot() && tar->GetLevel() > tar->CastToBot()->GetStopMeleeLevel() &&
( (
IsEffectInSpell(spellid, SE_AttackSpeed) || IsEffectInSpell(spellid, SE_ReverseDS)) || IsEffectInSpell(spell_id, SE_AttackSpeed) || IsEffectInSpell(spell_id, SE_ReverseDS)) ||
(SpellEffectsCount(spellid) == 1 && (IsEffectInSpell(spellid, SE_ATK) || IsEffectInSpell(spellid, SE_STR)) (SpellEffectsCount(spell_id) == 1 && (IsEffectInSpell(spell_id, SE_ATK) || IsEffectInSpell(spell_id, SE_STR))
) )
) { ) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Archetype::Caster.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Archetype::Caster.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
break; break;
case Archetype::Melee: case Archetype::Melee:
if ( if (
IsEffectInSpell(spellid, SE_IncreaseSpellHaste) || IsEffectInSpell(spellid, SE_ManaPool) || IsEffectInSpell(spell_id, SE_IncreaseSpellHaste) || IsEffectInSpell(spell_id, SE_ManaPool) ||
IsEffectInSpell(spellid, SE_CastingLevel) || IsEffectInSpell(spellid, SE_ManaRegen_v2) || IsEffectInSpell(spell_id, SE_CastingLevel) || IsEffectInSpell(spell_id, SE_ManaRegen_v2) ||
IsEffectInSpell(spellid, SE_CurrentMana) IsEffectInSpell(spell_id, SE_CurrentMana)
) { ) {
LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Archetype::Melee.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, 'Cancelling cast of {} on {} due to Archetype::Melee.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return false; return false;
} }
break; break;
@@ -9673,7 +9673,7 @@ bool Bot::CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar) {
break; break;
} }
LogBotPreChecksDetail("{} says, {} on {} passed CanCastSpellType.'", GetCleanName(), GetSpellName(spellid), tar->GetCleanName()); //deleteme LogBotPreChecksDetail("{} says, {} on {} passed CanCastSpellType.'", GetCleanName(), GetSpellName(spell_id), tar->GetCleanName()); //deleteme
return true; return true;
} }
@@ -9692,9 +9692,9 @@ bool Bot::BotHasEnoughMana(uint16 spell_id) {
return true; return true;
} }
bool Bot::IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spellid) { bool Bot::IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spell_id) {
if (!tar || !spellid) { if (!tar || !spell_id) {
return true; return true;
} }
@@ -9717,18 +9717,18 @@ bool Bot::IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spellid) {
m->IsCasting() && m->IsCasting() &&
m->CastToBot()->casting_spell_targetid && m->CastToBot()->casting_spell_targetid &&
entity_list.GetMobID(m->CastToBot()->casting_spell_targetid) == entity_list.GetMobID(tar->GetID()) && entity_list.GetMobID(m->CastToBot()->casting_spell_targetid) == entity_list.GetMobID(tar->GetID()) &&
m->CastingSpellID() == spellid m->CastingSpellID() == spell_id
) { ) {
return true; return true;
} }
else { else {
if (IsGroupSpell(spellid)) { if (IsGroupSpell(spell_id)) {
if ( if (
m->IsBot() && m->IsBot() &&
m->IsCasting() && m->IsCasting() &&
m->CastToBot()->casting_spell_targetid && m->CastToBot()->casting_spell_targetid &&
m->CastingSpellID() == spellid m->CastingSpellID() == spell_id
) { ) {
std::vector<Mob*> x = GatherGroupSpellTargets(); std::vector<Mob*> x = GatherGroupSpellTargets();
@@ -9746,13 +9746,13 @@ bool Bot::IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spellid) {
return false; return false;
} }
bool Bot::DoResistCheck(Mob* tar, uint16 spellid, int32 resist_limit) { bool Bot::DoResistCheck(Mob* tar, uint16 spell_id, int32 resist_limit) {
if (!tar || spellid == 0) { if (!tar || spell_id == 0) {
return false; return false;
} }
int32 resist_difficulty = -spells[spellid].resist_difficulty; int32 resist_difficulty = -spells[spell_id].resist_difficulty;
int32 level_mod = (tar->GetLevel() - GetLevel()) * (tar->GetLevel() - GetLevel()) / 2; int32 level_mod = (tar->GetLevel() - GetLevel()) * (tar->GetLevel() - GetLevel()) / 2;
if (tar->GetLevel() - GetLevel() < 0) { if (tar->GetLevel() - GetLevel() < 0) {
@@ -9761,7 +9761,7 @@ bool Bot::DoResistCheck(Mob* tar, uint16 spellid, int32 resist_limit) {
int32 targetResist = 0; int32 targetResist = 0;
switch (GetSpellResistType(spellid)) { switch (GetSpellResistType(spell_id)) {
case RESIST_NONE: case RESIST_NONE:
return true; return true;
case RESIST_MAGIC: case RESIST_MAGIC:
@@ -9785,7 +9785,7 @@ bool Bot::DoResistCheck(Mob* tar, uint16 spellid, int32 resist_limit) {
default: default:
return true; return true;
} }
//LogBotPreChecksDetail("DoResistCheck on {} for {} - TarResist [{}] LMod [{}] ResistDiff [{}] - Adjust [{}] > ResistLim [{}]", tar->GetCleanName(), GetSpellName(spellid), targetResist, level_mod, resist_difficulty, (targetResist + level_mod - resist_difficulty), resist_limit); //deleteme) //LogBotPreChecksDetail("DoResistCheck on {} for {} - TarResist [{}] LMod [{}] ResistDiff [{}] - Adjust [{}] > ResistLim [{}]", tar->GetCleanName(), GetSpellName(spell_id), targetResist, level_mod, resist_difficulty, (targetResist + level_mod - resist_difficulty), resist_limit); //deleteme)
if ((targetResist + level_mod - resist_difficulty) > resist_limit) { if ((targetResist + level_mod - resist_difficulty) > resist_limit) {
return false; return false;
} }
@@ -9793,8 +9793,8 @@ bool Bot::DoResistCheck(Mob* tar, uint16 spellid, int32 resist_limit) {
return true; return true;
} }
bool Bot::DoResistCheckBySpellType(Mob* tar, uint16 spellid, uint16 spellType) { bool Bot::DoResistCheckBySpellType(Mob* tar, uint16 spell_id, uint16 spellType) {
if (!tar || !IsValidSpell(spellid)) { if (!tar || !IsValidSpell(spell_id)) {
return false; return false;
} }
@@ -9802,11 +9802,11 @@ bool Bot::DoResistCheckBySpellType(Mob* tar, uint16 spellid, uint16 spellType) {
return true; return true;
} }
return DoResistCheck(tar, spellid, GetSpellTypeResistLimit(spellType)); return DoResistCheck(tar, spell_id, GetSpellTypeResistLimit(spellType));
} }
bool Bot::IsValidTargetType(uint16 spellid, int targetType, uint8 bodyType) { bool Bot::IsValidTargetType(uint16 spell_id, int targetType, uint8 bodyType) {
if (!spellid) { if (!spell_id) {
return false; return false;
} }
@@ -9890,7 +9890,7 @@ bool Bot::IsMobEngagedByAnyone(Mob* tar) {
return false; return false;
} }
bool Bot::IsValidMezTarget(Mob* owner, Mob* npc, uint16 spellid) { bool Bot::IsValidMezTarget(Mob* owner, Mob* npc, uint16 spell_id) {
if (npc->GetSpecialAbility(SpecialAbility::MesmerizeImmunity)) { if (npc->GetSpecialAbility(SpecialAbility::MesmerizeImmunity)) {
return false; return false;
} }
@@ -9907,7 +9907,7 @@ bool Bot::IsValidMezTarget(Mob* owner, Mob* npc, uint16 spellid) {
return false; return false;
} }
if (!IsValidTargetType(spellid, GetSpellTargetType(spellid), npc->GetBodyType())) { if (!IsValidTargetType(spell_id, GetSpellTargetType(spell_id), npc->GetBodyType())) {
return false; return false;
} }
@@ -10952,58 +10952,58 @@ uint16 Bot::GetSpellListSpellType(uint16 spellType) {
return spellType; return spellType;
} }
bool Bot::IsValidSpellTypeBySpellID(uint16 spellType, uint16 spellid) { bool Bot::IsValidSpellTypeBySpellID(uint16 spellType, uint16 spell_id) {
if (IsAEBotSpellType(spellType) && !IsAnyAESpell(spellid)) { if (IsAEBotSpellType(spellType) && !IsAnyAESpell(spell_id)) {
return false; return false;
} }
if (IsGroupBotSpellType(spellType) && !IsGroupSpell(spellid)) { if (IsGroupBotSpellType(spellType) && !IsGroupSpell(spell_id)) {
return false; return false;
} }
switch (spellType) { switch (spellType) {
case BotSpellTypes::Buff: case BotSpellTypes::Buff:
case BotSpellTypes::PetBuffs: case BotSpellTypes::PetBuffs:
if (IsResistanceOnlySpell(spellid) || IsDamageShieldOnlySpell(spellid) || IsDamageShieldAndResistanceSpellOnly(spellid)) { if (IsResistanceOnlySpell(spell_id) || IsDamageShieldOnlySpell(spell_id) || IsDamageShieldAndResistanceSpellOnly(spell_id)) {
return false; return false;
} }
return true; return true;
case BotSpellTypes::ResistBuffs: case BotSpellTypes::ResistBuffs:
case BotSpellTypes::PetResistBuffs: case BotSpellTypes::PetResistBuffs:
if (IsResistanceOnlySpell(spellid)) { if (IsResistanceOnlySpell(spell_id)) {
return true; return true;
} }
return false; return false;
case BotSpellTypes::DamageShields: case BotSpellTypes::DamageShields:
case BotSpellTypes::PetDamageShields: case BotSpellTypes::PetDamageShields:
if (IsDamageShieldOnlySpell(spellid) || IsDamageShieldAndResistanceSpellOnly(spellid)) { if (IsDamageShieldOnlySpell(spell_id) || IsDamageShieldAndResistanceSpellOnly(spell_id)) {
return true; return true;
} }
return false; return false;
case BotSpellTypes::PBAENuke: case BotSpellTypes::PBAENuke:
if (IsPBAENukeSpell(spellid) && !IsStunSpell(spellid)) { if (IsPBAENukeSpell(spell_id) && !IsStunSpell(spell_id)) {
return true; return true;
} }
return false; return false;
case BotSpellTypes::AERains: case BotSpellTypes::AERains:
if (IsAERainNukeSpell(spellid) && !IsStunSpell(spellid)) { if (IsAERainNukeSpell(spell_id) && !IsStunSpell(spell_id)) {
return true; return true;
} }
return false; return false;
case BotSpellTypes::AEStun: case BotSpellTypes::AEStun:
case BotSpellTypes::Stun: case BotSpellTypes::Stun:
if (IsStunSpell(spellid)) { if (IsStunSpell(spell_id)) {
return true; return true;
} }
return false; return false;
case BotSpellTypes::AENukes: case BotSpellTypes::AENukes:
case BotSpellTypes::Nuke: case BotSpellTypes::Nuke:
if (!IsStunSpell(spellid)) { if (!IsStunSpell(spell_id)) {
return true; return true;
} }
@@ -11199,9 +11199,9 @@ bool Bot::HasRequiredLoSForPositioning(Mob* tar) {
return true; return true;
} }
bool Bot::HasValidAETarget(Bot* botCaster, uint16 spellid, uint16 spellType, Mob* tar) { bool Bot::HasValidAETarget(Bot* botCaster, uint16 spell_id, uint16 spellType, Mob* tar) {
int spellRange = botCaster->GetActSpellRange(spellid, spells[spellid].range); int spellRange = botCaster->GetActSpellRange(spell_id, spells[spell_id].range);
int spellAERange = botCaster->GetActSpellRange(spellid, spells[spellid].aoe_range); int spellAERange = botCaster->GetActSpellRange(spell_id, spells[spell_id].aoe_range);
int targetCount = 0; int targetCount = 0;
for (auto& close_mob : botCaster->m_close_mobs) { for (auto& close_mob : botCaster->m_close_mobs) {
@@ -11244,14 +11244,14 @@ bool Bot::HasValidAETarget(Bot* botCaster, uint16 spellid, uint16 spellType, Mob
continue; continue;
} }
if (SpellBreaksMez(spellid) && m->IsMezzed()) { if (SpellBreaksMez(spell_id) && m->IsMezzed()) {
continue; continue;
} }
if (IsPBAESpell(spellid)) { if (IsPBAESpell(spell_id)) {
if ( if (
spellAERange >= Distance(botCaster->GetPosition(), m->GetPosition()) && spellAERange >= Distance(botCaster->GetPosition(), m->GetPosition()) &&
botCaster->CastChecks(spellid, m, spellType, true, true) botCaster->CastChecks(spell_id, m, spellType, true, true)
) { ) {
++targetCount; ++targetCount;
} }
@@ -11263,7 +11263,7 @@ bool Bot::HasValidAETarget(Bot* botCaster, uint16 spellid, uint16 spellType, Mob
if ( if (
spellAERange >= Distance(tar->GetPosition(), m->GetPosition()) && spellAERange >= Distance(tar->GetPosition(), m->GetPosition()) &&
botCaster->CastChecks(spellid, m, spellType, true, true) botCaster->CastChecks(spell_id, m, spellType, true, true)
) { ) {
++targetCount; ++targetCount;
} }
+11 -11
View File
@@ -445,13 +445,13 @@ public:
std::vector<Mob*> GatherSpellTargets(bool entireRaid = false, bool noClients = false, bool noBots = false, bool noPets = false); std::vector<Mob*> GatherSpellTargets(bool entireRaid = false, bool noClients = false, bool noBots = false, bool noPets = false);
bool PrecastChecks(Mob* tar, uint16 spellType); bool PrecastChecks(Mob* tar, uint16 spellType);
bool CastChecks(uint16 spellid, Mob* tar, uint16 spellType, bool doPrechecks = false, bool AECheck = false); bool CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechecks = false, bool AECheck = false);
bool CanCastSpellType(uint16 spellType, uint16 spellid, Mob* tar); bool CanCastSpellType(uint16 spellType, uint16 spell_id, Mob* tar);
bool BotHasEnoughMana(uint16 spell_id); bool BotHasEnoughMana(uint16 spell_id);
bool IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spellid); bool IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spell_id);
bool DoResistCheck(Mob* target, uint16 spellid, int32 resist_limit); bool DoResistCheck(Mob* target, uint16 spell_id, int32 resist_limit);
bool DoResistCheckBySpellType(Mob* tar, uint16 spellid, uint16 spellType); bool DoResistCheckBySpellType(Mob* tar, uint16 spell_id, uint16 spellType);
bool IsValidTargetType(uint16 spellid, int targetType, uint8 bodyType); bool IsValidTargetType(uint16 spell_id, int targetType, uint8 bodyType);
bool IsMobEngagedByAnyone(Mob* tar); bool IsMobEngagedByAnyone(Mob* tar);
void SetBotSetting(uint8 settingType, uint16 botSetting, int settingValue); void SetBotSetting(uint8 settingType, uint16 botSetting, int settingValue);
void CopySettings(Bot* to, uint8 settingType, uint16 spellType = UINT16_MAX); void CopySettings(Bot* to, uint8 settingType, uint16 spellType = UINT16_MAX);
@@ -522,11 +522,11 @@ public:
std::list<BotSpellTypeOrder> GetSpellTypesPrioritized(uint8 priorityType); std::list<BotSpellTypeOrder> GetSpellTypesPrioritized(uint8 priorityType);
uint16 GetSpellListSpellType(uint16 spellType); uint16 GetSpellListSpellType(uint16 spellType);
bool IsValidSpellTypeBySpellID(uint16 spellType, uint16 spellid); bool IsValidSpellTypeBySpellID(uint16 spellType, uint16 spell_id);
inline uint16 GetCastedSpellType() const { return _castedSpellType; } inline uint16 GetCastedSpellType() const { return _castedSpellType; }
void SetCastedSpellType(uint16 spellType); void SetCastedSpellType(uint16 spellType);
bool HasValidAETarget(Bot* botCaster, uint16 spellid, uint16 spellType, Mob* tar); bool HasValidAETarget(Bot* botCaster, uint16 spell_id, uint16 spellType, Mob* tar);
void CheckBotSpells(); void CheckBotSpells();
@@ -592,8 +592,8 @@ public:
static BotSpell GetBestBotSpellForGroupCompleteHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForGroupCompleteHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal);
static BotSpell GetBestBotSpellForGroupHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForGroupHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal);
static Mob* GetFirstIncomingMobToMez(Bot* botCaster, int16 spellid, uint16 spellType, bool AE = false); static Mob* GetFirstIncomingMobToMez(Bot* botCaster, int16 spell_id, uint16 spellType, bool AE = false);
bool IsValidMezTarget(Mob* owner, Mob* npc, uint16 spellid); bool IsValidMezTarget(Mob* owner, Mob* npc, uint16 spell_id);
static BotSpell GetBestBotSpellForMez(Bot* botCaster, uint16 spellType = BotSpellTypes::Mez); static BotSpell GetBestBotSpellForMez(Bot* botCaster, uint16 spellType = BotSpellTypes::Mez);
static BotSpell GetBestBotMagicianPetSpell(Bot* botCaster, uint16 spellType = BotSpellTypes::Pet); static BotSpell GetBestBotMagicianPetSpell(Bot* botCaster, uint16 spellType = BotSpellTypes::Pet);
static std::string GetBotMagicianPetType(Bot* botCaster); static std::string GetBotMagicianPetType(Bot* botCaster);
@@ -735,7 +735,7 @@ public:
inline const InspectMessage_Struct& GetInspectMessage() const { return _botInspectMessage; } inline const InspectMessage_Struct& GetInspectMessage() const { return _botInspectMessage; }
// "Quest API" Methods // "Quest API" Methods
bool HasBotSpellEntry(uint16 spellid); bool HasBotSpellEntry(uint16 spell_id);
void ApplySpell(int spell_id, int duration = 0, int level = -1, ApplySpellType apply_type = ApplySpellType::Solo, bool allow_pets = false, bool is_raid_group_only = true); void ApplySpell(int spell_id, int duration = 0, int level = -1, ApplySpellType apply_type = ApplySpellType::Solo, bool allow_pets = false, bool is_raid_group_only = true);
void BreakInvis(); void BreakInvis();
void Escape(); void Escape();
+9 -9
View File
@@ -1429,11 +1429,11 @@ BotSpell Bot::GetBestBotSpellForMez(Bot* botCaster, uint16 spellType) {
return result; return result;
} }
Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spellid, uint16 spellType, bool AE) { Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spell_id, uint16 spellType, bool AE) {
Mob* result = nullptr; Mob* result = nullptr;
if (botCaster && botCaster->GetOwner()) { if (botCaster && botCaster->GetOwner()) {
int spellRange = (!AE ? botCaster->GetActSpellRange(spellid, spells[spellid].range) : botCaster->GetActSpellRange(spellid, spells[spellid].aoe_range)); int spellRange = (!AE ? botCaster->GetActSpellRange(spell_id, spells[spell_id].range) : botCaster->GetActSpellRange(spell_id, spells[spell_id].aoe_range));
int buff_count = 0; int buff_count = 0;
NPC* npc = nullptr; NPC* npc = nullptr;
@@ -1445,7 +1445,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spellid, uint16 spellTy
continue; continue;
} }
if (!botCaster->IsValidMezTarget(botCaster->GetOwner(), npc, spellid)) { if (!botCaster->IsValidMezTarget(botCaster->GetOwner(), npc, spell_id)) {
continue; continue;
} }
@@ -1459,11 +1459,11 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spellid, uint16 spellTy
continue; continue;
} }
if (!botCaster->IsValidMezTarget(botCaster->GetOwner(), m, spellid)) { if (!botCaster->IsValidMezTarget(botCaster->GetOwner(), m, spell_id)) {
continue; continue;
} }
if (IsPBAESpell(spellid)) { if (IsPBAESpell(spell_id)) {
if (spellRange < Distance(botCaster->GetPosition(), m->GetPosition())) { if (spellRange < Distance(botCaster->GetPosition(), m->GetPosition())) {
continue; continue;
} }
@@ -1474,7 +1474,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spellid, uint16 spellTy
} }
} }
if (botCaster->CastChecks(spellid, m, spellType, true, true)) { if (botCaster->CastChecks(spell_id, m, spellType, true, true)) {
++targetCount; ++targetCount;
} }
@@ -1499,7 +1499,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, int16 spellid, uint16 spellTy
continue; continue;
} }
if (!botCaster->CastChecks(spellid, npc, spellType, true)) { if (!botCaster->CastChecks(spell_id, npc, spellType, true)) {
continue; continue;
} }
@@ -2631,7 +2631,7 @@ void Bot::AI_Bot_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot) {
} }
} }
bool Bot::HasBotSpellEntry(uint16 spellid) { bool Bot::HasBotSpellEntry(uint16 spell_id) {
auto* spell_list = content_db.GetBotSpells(GetBotSpellID()); auto* spell_list = content_db.GetBotSpells(GetBotSpellID());
if (!spell_list) { if (!spell_list) {
@@ -2640,7 +2640,7 @@ bool Bot::HasBotSpellEntry(uint16 spellid) {
// Check if Spell ID is found in Bot Spell Entries // Check if Spell ID is found in Bot Spell Entries
for (auto& e : spell_list->entries) { for (auto& e : spell_list->entries) {
if (spellid == e.spellid) { if (spell_id == e.spellid) {
return true; return true;
} }
} }