code cleanup 2

This commit is contained in:
nytmyr
2025-01-10 11:45:00 -06:00
parent 40b676c320
commit 95c1bb6883
10 changed files with 1455 additions and 1451 deletions
+110 -110
View File
@@ -2791,8 +2791,8 @@ bool IsLichSpell(uint16 spell_id)
return false; return false;
} }
bool IsBotSpellTypeDetrimental(uint16 spellType) { bool IsBotSpellTypeDetrimental(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::Nuke: case BotSpellTypes::Nuke:
case BotSpellTypes::Root: case BotSpellTypes::Root:
case BotSpellTypes::Lifetap: case BotSpellTypes::Lifetap:
@@ -2831,8 +2831,8 @@ bool IsBotSpellTypeDetrimental(uint16 spellType) {
return false; return false;
} }
bool IsBotSpellTypeBeneficial(uint16 spellType) { bool IsBotSpellTypeBeneficial(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::RegularHeal: case BotSpellTypes::RegularHeal:
case BotSpellTypes::CompleteHeal: case BotSpellTypes::CompleteHeal:
case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::GroupCompleteHeals:
@@ -2881,8 +2881,8 @@ bool IsBotSpellTypeBeneficial(uint16 spellType) {
return false; return false;
} }
bool IsBotSpellTypeOtherBeneficial(uint16 spellType) { bool IsBotSpellTypeOtherBeneficial(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::RegularHeal: case BotSpellTypes::RegularHeal:
case BotSpellTypes::CompleteHeal: case BotSpellTypes::CompleteHeal:
case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::GroupCompleteHeals:
@@ -2925,8 +2925,8 @@ bool IsBotSpellTypeOtherBeneficial(uint16 spellType) {
return false; return false;
} }
bool IsBotSpellTypeInnate(uint16 spellType) { bool IsBotSpellTypeInnate(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::AENukes: case BotSpellTypes::AENukes:
case BotSpellTypes::AERains: case BotSpellTypes::AERains:
case BotSpellTypes::PBAENuke: case BotSpellTypes::PBAENuke:
@@ -2960,8 +2960,8 @@ bool IsBotSpellTypeInnate(uint16 spellType) {
return false; return false;
} }
bool IsAEBotSpellType(uint16 spellType) { bool IsAEBotSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::AEDebuff: case BotSpellTypes::AEDebuff:
case BotSpellTypes::AEFear: case BotSpellTypes::AEFear:
case BotSpellTypes::AEMez: case BotSpellTypes::AEMez:
@@ -2985,8 +2985,8 @@ bool IsAEBotSpellType(uint16 spellType) {
return false; return false;
} }
bool IsGroupBotSpellType(uint16 spellType) { bool IsGroupBotSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::GroupCures: case BotSpellTypes::GroupCures:
case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::GroupCompleteHeals:
case BotSpellTypes::GroupHeals: case BotSpellTypes::GroupHeals:
@@ -2999,8 +2999,8 @@ bool IsGroupBotSpellType(uint16 spellType) {
return false; return false;
} }
bool IsGroupTargetOnlyBotSpellType(uint16 spellType) { bool IsGroupTargetOnlyBotSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::GroupCures: case BotSpellTypes::GroupCures:
case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::GroupCompleteHeals:
case BotSpellTypes::GroupHeals: case BotSpellTypes::GroupHeals:
@@ -3012,8 +3012,8 @@ bool IsGroupTargetOnlyBotSpellType(uint16 spellType) {
return false; return false;
} }
bool IsPetBotSpellType(uint16 spellType) { bool IsPetBotSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::PetBuffs: case BotSpellTypes::PetBuffs:
case BotSpellTypes::PetRegularHeals: case BotSpellTypes::PetRegularHeals:
case BotSpellTypes::PetCompleteHeals: case BotSpellTypes::PetCompleteHeals:
@@ -3031,8 +3031,8 @@ bool IsPetBotSpellType(uint16 spellType) {
return false; return false;
} }
bool IsClientBotSpellType(uint16 spellType) { bool IsClientBotSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::RegularHeal: case BotSpellTypes::RegularHeal:
case BotSpellTypes::CompleteHeal: case BotSpellTypes::CompleteHeal:
case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::GroupCompleteHeals:
@@ -3063,8 +3063,8 @@ bool IsClientBotSpellType(uint16 spellType) {
return false; return false;
} }
bool IsHealBotSpellType(uint16 spellType) { bool IsHealBotSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::VeryFastHeals: case BotSpellTypes::VeryFastHeals:
case BotSpellTypes::FastHeals: case BotSpellTypes::FastHeals:
case BotSpellTypes::RegularHeal: case BotSpellTypes::RegularHeal:
@@ -3086,12 +3086,12 @@ bool IsHealBotSpellType(uint16 spellType) {
return false; return false;
} }
bool SpellTypeRequiresLoS(uint16 spellType) { bool SpellTypeRequiresLoS(uint16 spell_type) {
if (IsAEBotSpellType(spellType)) { // These gather their own targets later if (IsAEBotSpellType(spell_type)) { // These gather their own targets later
return false; return false;
} }
switch (spellType) { switch (spell_type) {
case BotSpellTypes::RegularHeal: case BotSpellTypes::RegularHeal:
case BotSpellTypes::GroupCompleteHeals: case BotSpellTypes::GroupCompleteHeals:
case BotSpellTypes::CompleteHeal: case BotSpellTypes::CompleteHeal:
@@ -3114,8 +3114,8 @@ bool SpellTypeRequiresLoS(uint16 spellType) {
return true; return true;
} }
bool SpellTypeRequiresTarget(uint16 spellType) { bool SpellTypeRequiresTarget(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::Pet: case BotSpellTypes::Pet:
case BotSpellTypes::Succor: case BotSpellTypes::Succor:
return false; return false;
@@ -3126,8 +3126,8 @@ bool SpellTypeRequiresTarget(uint16 spellType) {
return true; return true;
} }
bool SpellTypeRequiresAEChecks(uint16 spellType) { bool SpellTypeRequiresAEChecks(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::AEMez: case BotSpellTypes::AEMez:
return false; return false;
default: default:
@@ -3137,12 +3137,12 @@ bool SpellTypeRequiresAEChecks(uint16 spellType) {
return true; return true;
} }
bool IsValidSpellAndLoS(uint32 spell_id, bool hasLoS) { bool IsValidSpellAndLoS(uint32 spell_id, bool has_los) {
if (!IsValidSpell(spell_id)) { if (!IsValidSpell(spell_id)) {
return false; return false;
} }
if (!hasLoS && IsTargetRequiredForSpell(spell_id)) { if (!has_los && IsTargetRequiredForSpell(spell_id)) {
return false; return false;
} }
@@ -3162,8 +3162,8 @@ bool IsResurrectSpell(uint16 spell_id)
return IsEffectInSpell(spell_id, SE_Revive); return IsEffectInSpell(spell_id, SE_Revive);
} }
bool RequiresStackCheck(uint16 spellType) { bool RequiresStackCheck(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::VeryFastHeals: case BotSpellTypes::VeryFastHeals:
case BotSpellTypes::PetVeryFastHeals: case BotSpellTypes::PetVeryFastHeals:
case BotSpellTypes::FastHeals: case BotSpellTypes::FastHeals:
@@ -3244,8 +3244,8 @@ bool IsHateSpell(uint16 spell_id) {
return false; return false;
} }
bool IsCommandedSpellType(uint16 spellType) { bool IsCommandedSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::Charm: case BotSpellTypes::Charm:
case BotSpellTypes::AEFear: case BotSpellTypes::AEFear:
case BotSpellTypes::Fear: case BotSpellTypes::Fear:
@@ -3278,8 +3278,8 @@ bool IsCommandedSpellType(uint16 spellType) {
return false; return false;
} }
bool IsPullingSpellType(uint16 spellType) { bool IsPullingSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::Nuke: case BotSpellTypes::Nuke:
case BotSpellTypes::Lifetap: case BotSpellTypes::Lifetap:
case BotSpellTypes::Snare: case BotSpellTypes::Snare:
@@ -3297,101 +3297,101 @@ bool IsPullingSpellType(uint16 spellType) {
return false; return false;
} }
uint16 GetCorrectSpellType(uint16 spellType, uint16 spell_id) { uint16 GetCorrectSpellType(uint16 spell_type, uint16 spell_id) {
uint16 correctType = UINT16_MAX; uint16 correct_type = UINT16_MAX;
SPDat_Spell_Struct spell = spells[spell_id]; SPDat_Spell_Struct spell = spells[spell_id];
std::string teleportZone = spell.teleport_zone; std::string teleport_zone = spell.teleport_zone;
if (IsCharmSpell(spell_id)) { if (IsCharmSpell(spell_id)) {
correctType = BotSpellTypes::Charm; correct_type = BotSpellTypes::Charm;
} }
else if (IsFearSpell(spell_id)) { else if (IsFearSpell(spell_id)) {
correctType = BotSpellTypes::Fear; correct_type = BotSpellTypes::Fear;
} }
else if (IsEffectInSpell(spell_id, SE_Revive)) { else if (IsEffectInSpell(spell_id, SE_Revive)) {
correctType = BotSpellTypes::Resurrect; correct_type = BotSpellTypes::Resurrect;
} }
else if (IsHarmonySpell(spell_id)) { else if (IsHarmonySpell(spell_id)) {
correctType = BotSpellTypes::Lull; correct_type = BotSpellTypes::Lull;
} }
else if (teleportZone.compare("") && !IsEffectInSpell(spell_id, SE_GateToHomeCity) && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Translocate))) { else if (teleport_zone.compare("") && !IsEffectInSpell(spell_id, SE_GateToHomeCity) && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Teleport) || IsEffectInSpell(spell_id, SE_Translocate))) {
correctType = BotSpellTypes::Teleport; correct_type = BotSpellTypes::Teleport;
} }
else if (IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_Succor)) { else if (IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_Succor)) {
correctType = BotSpellTypes::Succor; correct_type = BotSpellTypes::Succor;
} }
else if (IsEffectInSpell(spell_id, SE_BindAffinity)) { else if (IsEffectInSpell(spell_id, SE_BindAffinity)) {
correctType = BotSpellTypes::BindAffinity; correct_type = BotSpellTypes::BindAffinity;
} }
else if (IsEffectInSpell(spell_id, SE_Identify)) { else if (IsEffectInSpell(spell_id, SE_Identify)) {
correctType = BotSpellTypes::Identify; correct_type = BotSpellTypes::Identify;
} }
else if (spellType == BotSpellTypes::Levitate && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Levitate))) { else if (spell_type == BotSpellTypes::Levitate && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Levitate))) {
correctType = BotSpellTypes::Levitate; correct_type = BotSpellTypes::Levitate;
} }
else if (spellType == BotSpellTypes::Rune && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_AbsorbMagicAtt) || IsEffectInSpell(spell_id, SE_Rune))) { else if (spell_type == BotSpellTypes::Rune && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_AbsorbMagicAtt) || IsEffectInSpell(spell_id, SE_Rune))) {
correctType = BotSpellTypes::Rune; correct_type = BotSpellTypes::Rune;
} }
else if (spellType == BotSpellTypes::WaterBreathing && IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_WaterBreathing)) { else if (spell_type == BotSpellTypes::WaterBreathing && IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_WaterBreathing)) {
correctType = BotSpellTypes::WaterBreathing; correct_type = BotSpellTypes::WaterBreathing;
} }
else if (spellType == BotSpellTypes::Size && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_ModelSize) || IsEffectInSpell(spell_id, SE_ChangeHeight))) { else if (spell_type == BotSpellTypes::Size && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_ModelSize) || IsEffectInSpell(spell_id, SE_ChangeHeight))) {
correctType = BotSpellTypes::Size; correct_type = BotSpellTypes::Size;
} }
else if (spellType == BotSpellTypes::Invisibility && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_SeeInvis) || IsInvisibleSpell(spell_id))) { else if (spell_type == BotSpellTypes::Invisibility && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_SeeInvis) || IsInvisibleSpell(spell_id))) {
correctType = BotSpellTypes::Invisibility; correct_type = BotSpellTypes::Invisibility;
} }
else if (spellType == BotSpellTypes::MovementSpeed && IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) { else if (spell_type == BotSpellTypes::MovementSpeed && IsBeneficialSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) {
correctType = BotSpellTypes::MovementSpeed; correct_type = BotSpellTypes::MovementSpeed;
} }
else if (!teleportZone.compare("") && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Translocate) || IsEffectInSpell(spell_id, SE_GateToHomeCity))) { else if (!teleport_zone.compare("") && IsBeneficialSpell(spell_id) && (IsEffectInSpell(spell_id, SE_Translocate) || IsEffectInSpell(spell_id, SE_GateToHomeCity))) {
correctType = BotSpellTypes::SendHome; correct_type = BotSpellTypes::SendHome;
} }
else if (IsEffectInSpell(spell_id, SE_SummonCorpse)) { else if (IsEffectInSpell(spell_id, SE_SummonCorpse)) {
correctType = BotSpellTypes::SummonCorpse; correct_type = BotSpellTypes::SummonCorpse;
} }
if (correctType == UINT16_MAX) { if (correct_type == UINT16_MAX) {
if (IsSummonPetSpell(spell_id) || IsEffectInSpell(spell_id, SE_TemporaryPets)) { if (IsSummonPetSpell(spell_id) || IsEffectInSpell(spell_id, SE_TemporaryPets)) {
correctType = BotSpellTypes::Pet; correct_type = BotSpellTypes::Pet;
} }
else if (IsMesmerizeSpell(spell_id)) { else if (IsMesmerizeSpell(spell_id)) {
correctType = BotSpellTypes::Mez; correct_type = BotSpellTypes::Mez;
} }
else if (IsEscapeSpell(spell_id)) { else if (IsEscapeSpell(spell_id)) {
correctType = BotSpellTypes::Escape; correct_type = BotSpellTypes::Escape;
} }
else if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_Root)) { else if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_Root)) {
if (IsAnyAESpell(spell_id)) { if (IsAnyAESpell(spell_id)) {
correctType = BotSpellTypes::AERoot; correct_type = BotSpellTypes::AERoot;
} }
else { else {
correctType = BotSpellTypes::Root; correct_type = BotSpellTypes::Root;
} }
} }
else if (IsDetrimentalSpell(spell_id) && IsLifetapSpell(spell_id)) { else if (IsDetrimentalSpell(spell_id) && IsLifetapSpell(spell_id)) {
correctType = BotSpellTypes::Lifetap; correct_type = BotSpellTypes::Lifetap;
} }
else if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) { else if (IsDetrimentalSpell(spell_id) && IsEffectInSpell(spell_id, SE_MovementSpeed)) {
correctType = BotSpellTypes::Snare; correct_type = BotSpellTypes::Snare;
} }
else if (IsDetrimentalSpell(spell_id) && (IsStackableDOT(spell_id) || IsDamageOverTimeSpell(spell_id))) { else if (IsDetrimentalSpell(spell_id) && (IsStackableDOT(spell_id) || IsDamageOverTimeSpell(spell_id))) {
correctType = BotSpellTypes::DOT; correct_type = BotSpellTypes::DOT;
} }
else if (IsDispelSpell(spell_id)) { else if (IsDispelSpell(spell_id)) {
correctType = BotSpellTypes::Dispel; correct_type = BotSpellTypes::Dispel;
} }
else if (IsDetrimentalSpell(spell_id) && IsSlowSpell(spell_id)) { else if (IsDetrimentalSpell(spell_id) && IsSlowSpell(spell_id)) {
correctType = BotSpellTypes::Slow; correct_type = BotSpellTypes::Slow;
} }
else if (IsDebuffSpell(spell_id) && !IsHateReduxSpell(spell_id) && !IsHateSpell(spell_id)) { else if (IsDebuffSpell(spell_id) && !IsHateReduxSpell(spell_id) && !IsHateSpell(spell_id)) {
correctType = BotSpellTypes::Debuff; correct_type = BotSpellTypes::Debuff;
} }
else if (IsHateReduxSpell(spell_id)) { else if (IsHateReduxSpell(spell_id)) {
correctType = BotSpellTypes::HateRedux; correct_type = BotSpellTypes::HateRedux;
} }
else if (IsDetrimentalSpell(spell_id) && IsHateSpell(spell_id)) { else if (IsDetrimentalSpell(spell_id) && IsHateSpell(spell_id)) {
correctType = BotSpellTypes::HateLine; correct_type = BotSpellTypes::HateLine;
} }
else if ( else if (
IsBuffSpell(spell_id) && IsBuffSpell(spell_id) &&
@@ -3399,112 +3399,112 @@ uint16 GetCorrectSpellType(uint16 spellType, uint16 spell_id) {
IsBardSong(spell_id) IsBardSong(spell_id)
) { ) {
if ( if (
spellType == BotSpellTypes::InCombatBuffSong || spell_type == BotSpellTypes::InCombatBuffSong ||
spellType == BotSpellTypes::OutOfCombatBuffSong || spell_type == BotSpellTypes::OutOfCombatBuffSong ||
spellType == BotSpellTypes::PreCombatBuffSong spell_type == BotSpellTypes::PreCombatBuffSong
) { ) {
correctType = spellType; correct_type = spell_type;
} }
else { else {
correctType = BotSpellTypes::OutOfCombatBuffSong; correct_type = BotSpellTypes::OutOfCombatBuffSong;
} }
} }
else if ( else if (
!IsBardSong(spell_id) && !IsBardSong(spell_id) &&
( (
(IsSelfConversionSpell(spell_id) && spell.buff_duration < 1) || (IsSelfConversionSpell(spell_id) && spell.buff_duration < 1) ||
(spellType == BotSpellTypes::InCombatBuff && IsAnyBuffSpell(spell_id)) (spell_type == BotSpellTypes::InCombatBuff && IsAnyBuffSpell(spell_id))
) )
) { ) {
correctType = BotSpellTypes::InCombatBuff; correct_type = BotSpellTypes::InCombatBuff;
} }
else if ( else if (
spellType == BotSpellTypes::PreCombatBuff && spell_type == BotSpellTypes::PreCombatBuff &&
IsAnyBuffSpell(spell_id) && IsAnyBuffSpell(spell_id) &&
!IsBardSong(spell_id) !IsBardSong(spell_id)
) { ) {
correctType = BotSpellTypes::PreCombatBuff; correct_type = BotSpellTypes::PreCombatBuff;
} }
else if ( else if (
(IsCureSpell(spell_id) && spellType == BotSpellTypes::Cure) || (IsCureSpell(spell_id) && spell_type == BotSpellTypes::Cure) ||
(IsCureSpell(spell_id) && !IsAnyHealSpell(spell_id)) (IsCureSpell(spell_id) && !IsAnyHealSpell(spell_id))
) { ) {
correctType = BotSpellTypes::Cure; correct_type = BotSpellTypes::Cure;
} }
else if (IsAnyNukeOrStunSpell(spell_id)) { else if (IsAnyNukeOrStunSpell(spell_id)) {
if (IsAnyAESpell(spell_id)) { if (IsAnyAESpell(spell_id)) {
if (IsAERainSpell(spell_id)) { if (IsAERainSpell(spell_id)) {
correctType = BotSpellTypes::AERains; correct_type = BotSpellTypes::AERains;
} }
else if (IsPBAENukeSpell(spell_id)) { else if (IsPBAENukeSpell(spell_id)) {
correctType = BotSpellTypes::PBAENuke; correct_type = BotSpellTypes::PBAENuke;
} }
else if (IsStunSpell(spell_id)) { else if (IsStunSpell(spell_id)) {
correctType = BotSpellTypes::AEStun; correct_type = BotSpellTypes::AEStun;
} }
else { else {
correctType = BotSpellTypes::AENukes; correct_type = BotSpellTypes::AENukes;
} }
} }
else if (IsStunSpell(spell_id)) { else if (IsStunSpell(spell_id)) {
correctType = BotSpellTypes::Stun; correct_type = BotSpellTypes::Stun;
} }
else { else {
correctType = BotSpellTypes::Nuke; correct_type = BotSpellTypes::Nuke;
} }
} }
else if (IsAnyHealSpell(spell_id)) { else if (IsAnyHealSpell(spell_id)) {
if (IsGroupSpell(spell_id)) { if (IsGroupSpell(spell_id)) {
if (IsGroupCompleteHealSpell(spell_id)) { if (IsGroupCompleteHealSpell(spell_id)) {
correctType = BotSpellTypes::GroupCompleteHeals; correct_type = BotSpellTypes::GroupCompleteHeals;
} }
else if (IsGroupHealOverTimeSpell(spell_id)) { else if (IsGroupHealOverTimeSpell(spell_id)) {
correctType = BotSpellTypes::GroupHoTHeals; correct_type = BotSpellTypes::GroupHoTHeals;
} }
else if (IsRegularGroupHealSpell(spell_id)) { else if (IsRegularGroupHealSpell(spell_id)) {
correctType = BotSpellTypes::GroupHeals; correct_type = BotSpellTypes::GroupHeals;
} }
} }
else { else {
if (IsVeryFastHealSpell(spell_id)) { if (IsVeryFastHealSpell(spell_id)) {
correctType = BotSpellTypes::VeryFastHeals; correct_type = BotSpellTypes::VeryFastHeals;
} }
else if (IsFastHealSpell(spell_id)) { else if (IsFastHealSpell(spell_id)) {
correctType = BotSpellTypes::FastHeals; correct_type = BotSpellTypes::FastHeals;
} }
else if (IsCompleteHealSpell(spell_id)) { else if (IsCompleteHealSpell(spell_id)) {
correctType = BotSpellTypes::CompleteHeal; correct_type = BotSpellTypes::CompleteHeal;
} }
else if (IsHealOverTimeSpell(spell_id)) { else if (IsHealOverTimeSpell(spell_id)) {
correctType = BotSpellTypes::HoTHeals; correct_type = BotSpellTypes::HoTHeals;
} }
else if (IsRegularSingleTargetHealSpell(spell_id)) { else if (IsRegularSingleTargetHealSpell(spell_id)) {
correctType = BotSpellTypes::RegularHeal; correct_type = BotSpellTypes::RegularHeal;
} }
else if (IsRegularPetHealSpell(spell_id)) { else if (IsRegularPetHealSpell(spell_id)) {
correctType = BotSpellTypes::RegularHeal; correct_type = BotSpellTypes::RegularHeal;
} }
} }
} }
else if (IsAnyBuffSpell(spell_id)) { else if (IsAnyBuffSpell(spell_id)) {
if (IsResistanceOnlySpell(spell_id)) { if (IsResistanceOnlySpell(spell_id)) {
correctType = BotSpellTypes::ResistBuffs; correct_type = BotSpellTypes::ResistBuffs;
} }
else if (IsDamageShieldOnlySpell(spell_id)) { else if (IsDamageShieldOnlySpell(spell_id)) {
correctType = BotSpellTypes::DamageShields; correct_type = BotSpellTypes::DamageShields;
} }
else { else {
correctType = BotSpellTypes::Buff; correct_type = BotSpellTypes::Buff;
} }
} }
} }
return correctType; return correct_type;
} }
uint16 GetPetSpellType(uint16 spellType) { uint16 GetPetSpellType(uint16 spell_type) {
switch (spellType) { switch (spell_type) {
case BotSpellTypes::Buff: case BotSpellTypes::Buff:
return BotSpellTypes::PetBuffs; return BotSpellTypes::PetBuffs;
case BotSpellTypes::RegularHeal: case BotSpellTypes::RegularHeal:
@@ -3524,8 +3524,8 @@ uint16 GetPetSpellType(uint16 spellType) {
case BotSpellTypes::ResistBuffs: case BotSpellTypes::ResistBuffs:
return BotSpellTypes::PetResistBuffs; return BotSpellTypes::PetResistBuffs;
default: default:
return spellType; return spell_type;
} }
return spellType; return spell_type;
} }
+19 -19
View File
@@ -896,23 +896,23 @@ const uint32 SPELL_TYPES_DETRIMENTAL = (SpellType_Nuke | SpellType_Root | SpellT
const uint32 SPELL_TYPES_BENEFICIAL = (SpellType_Heal | SpellType_Buff | SpellType_Escape | SpellType_Pet | SpellType_InCombatBuff | SpellType_Cure | SpellType_HateRedux | SpellType_InCombatBuffSong | SpellType_OutOfCombatBuffSong | SpellType_PreCombatBuff | SpellType_PreCombatBuffSong); const uint32 SPELL_TYPES_BENEFICIAL = (SpellType_Heal | SpellType_Buff | SpellType_Escape | SpellType_Pet | SpellType_InCombatBuff | SpellType_Cure | SpellType_HateRedux | SpellType_InCombatBuffSong | SpellType_OutOfCombatBuffSong | SpellType_PreCombatBuff | SpellType_PreCombatBuffSong);
const uint32 SPELL_TYPES_INNATE = (SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root); const uint32 SPELL_TYPES_INNATE = (SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root);
bool IsBotSpellTypeDetrimental (uint16 spellType); bool IsBotSpellTypeDetrimental (uint16 spell_type);
bool IsBotSpellTypeBeneficial (uint16 spellType); bool IsBotSpellTypeBeneficial (uint16 spell_type);
bool IsBotSpellTypeOtherBeneficial(uint16 spellType); bool IsBotSpellTypeOtherBeneficial(uint16 spell_type);
bool IsBotSpellTypeInnate (uint16 spellType); bool IsBotSpellTypeInnate (uint16 spell_type);
bool IsAEBotSpellType(uint16 spellType); bool IsAEBotSpellType(uint16 spell_type);
bool IsGroupBotSpellType(uint16 spellType); bool IsGroupBotSpellType(uint16 spell_type);
bool IsGroupTargetOnlyBotSpellType(uint16 spellType); bool IsGroupTargetOnlyBotSpellType(uint16 spell_type);
bool IsPetBotSpellType(uint16 spellType); bool IsPetBotSpellType(uint16 spell_type);
bool IsClientBotSpellType(uint16 spellType); bool IsClientBotSpellType(uint16 spell_type);
bool IsHealBotSpellType(uint16 spellType); bool IsHealBotSpellType(uint16 spell_type);
bool SpellTypeRequiresLoS(uint16 spellType); bool SpellTypeRequiresLoS(uint16 spell_type);
bool SpellTypeRequiresTarget(uint16 spellType); bool SpellTypeRequiresTarget(uint16 spell_type);
bool SpellTypeRequiresAEChecks(uint16 spellType); bool SpellTypeRequiresAEChecks(uint16 spell_type);
bool IsCommandedSpellType(uint16 spellType); bool IsCommandedSpellType(uint16 spell_type);
bool IsPullingSpellType(uint16 spellType); bool IsPullingSpellType(uint16 spell_type);
uint16 GetCorrectSpellType(uint16 spellType, uint16 spell_id); uint16 GetCorrectSpellType(uint16 spell_type, uint16 spell_id);
uint16 GetPetSpellType(uint16 spellType); uint16 GetPetSpellType(uint16 spell_type);
// These should not be used to determine spell category.. // These should not be used to determine spell category..
// They are a graphical affects (effects?) index only // They are a graphical affects (effects?) index only
@@ -1810,7 +1810,7 @@ bool IsEffectInSpell(uint16 spell_id, int effect_id);
uint16 GetSpellTriggerSpellID(uint16 spell_id, int effect_id); uint16 GetSpellTriggerSpellID(uint16 spell_id, int effect_id);
bool IsBlankSpellEffect(uint16 spell_id, int effect_index); bool IsBlankSpellEffect(uint16 spell_id, int effect_index);
bool IsValidSpell(uint32 spell_id); bool IsValidSpell(uint32 spell_id);
bool IsValidSpellAndLoS(uint32 spell_id, bool hasLoS = true); bool IsValidSpellAndLoS(uint32 spell_id, bool has_los = true);
bool IsSummonSpell(uint16 spell_id); bool IsSummonSpell(uint16 spell_id);
bool IsDamageSpell(uint16 spell_id); bool IsDamageSpell(uint16 spell_id);
bool IsAnyDamageSpell(uint16 spell_id); bool IsAnyDamageSpell(uint16 spell_id);
@@ -1906,7 +1906,7 @@ int8 SpellEffectsCount(uint16 spell_id);
bool IsLichSpell(uint16 spell_id); bool IsLichSpell(uint16 spell_id);
bool IsInstantHealSpell(uint32 spell_id); bool IsInstantHealSpell(uint32 spell_id);
bool IsResurrectSpell(uint16 spell_id); bool IsResurrectSpell(uint16 spell_id);
bool RequiresStackCheck(uint16 spellType); bool RequiresStackCheck(uint16 spell_type);
bool IsResistanceOnlySpell(uint16 spell_id); bool IsResistanceOnlySpell(uint16 spell_id);
bool IsDamageShieldOnlySpell(uint16 spell_id); bool IsDamageShieldOnlySpell(uint16 spell_id);
bool IsHateSpell(uint16 spell_id); bool IsHateSpell(uint16 spell_id);
+449 -444
View File
File diff suppressed because it is too large Load Diff
+107 -107
View File
@@ -288,7 +288,7 @@ public:
uint16 BotGetSpells(int spellslot) { return AIBot_spells[spellslot].spellid; } uint16 BotGetSpells(int spellslot) { return AIBot_spells[spellslot].spellid; }
uint32 BotGetSpellType(int spellslot) { return AIBot_spells[spellslot].type; } uint32 BotGetSpellType(int spellslot) { return AIBot_spells[spellslot].type; }
uint16 BotGetSpellPriority(int spellslot) { return AIBot_spells[spellslot].priority; } uint16 BotGetSpellPriority(int spellslot) { return AIBot_spells[spellslot].priority; }
std::vector<BotSpells_Struct_wIndex> BotGetSpellsByType(uint16 spellType); std::vector<BotSpells_Struct_wIndex> BotGetSpellsByType(uint16 spell_type);
float GetProcChances(float ProcBonus, uint16 hand) override; float GetProcChances(float ProcBonus, uint16 hand) override;
int GetHandToHandDamage(void) override; int GetHandToHandDamage(void) override;
bool TryFinishingBlow(Mob *defender, int64 &damage) override; bool TryFinishingBlow(Mob *defender, int64 &damage) override;
@@ -322,7 +322,7 @@ public:
void SetTarget(Mob* mob) override; void SetTarget(Mob* mob) override;
void Zone(); void Zone();
bool IsAtRange(Mob* target); bool IsAtRange(Mob* target);
void ChangeBotRangedWeapons(bool isRanged); void ChangeBotRangedWeapons(bool is_ranged);
void Sit(); void Sit();
void Stand(); void Stand();
bool IsSitting() const override; bool IsSitting() const override;
@@ -347,8 +347,8 @@ public:
bool GetIsUsingItemClick() { return is_using_item_click; } bool GetIsUsingItemClick() { return is_using_item_click; }
void SetIsUsingItemClick(bool flag = true) { is_using_item_click = flag; } void SetIsUsingItemClick(bool flag = true) { is_using_item_click = flag; }
bool UseDiscipline(uint32 spell_id, uint32 target); bool UseDiscipline(uint32 spell_id, uint32 target);
uint8 GetNumberNeedingHealedInGroup(uint8 hpr, bool includePets, Raid* raid); uint8 GetNumberNeedingHealedInGroup(uint8 hpr, bool include_pets, Raid* raid);
uint8 GetNumberNeedingHealedInRaidGroup(uint8& need_healed, uint8 hpr, bool includePets, Raid* raid); uint8 GetNumberNeedingHealedInRaidGroup(uint8& need_healed, uint8 hpr, bool include_pets, Raid* raid);
bool GetNeedsCured(Mob *tar); bool GetNeedsCured(Mob *tar);
bool GetNeedsHateRedux(Mob *tar); bool GetNeedsHateRedux(Mob *tar);
bool HasOrMayGetAggro(bool SitAggro, uint32 spell_id = 0); bool HasOrMayGetAggro(bool SitAggro, uint32 spell_id = 0);
@@ -450,11 +450,11 @@ public:
void AI_Bot_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot); void AI_Bot_Event_SpellCastFinished(bool iCastSucceeded, uint16 slot);
// AI Methods // AI Methods
bool AICastSpell(Mob* tar, uint8 iChance, uint16 spellType, uint16 subTargetType = UINT16_MAX, uint16 subType = UINT16_MAX); bool AICastSpell(Mob* tar, uint8 chance, uint16 spell_type, uint16 sub_target_type = UINT16_MAX, uint16 sub_type = UINT16_MAX);
bool AttemptAICastSpell(uint16 spellType, Mob* tar = nullptr); bool AttemptAICastSpell(uint16 spell_type, Mob* tar = nullptr);
bool AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank); bool AttemptAACastSpell(Mob* tar, uint16 spell_id, AA::Rank* rank);
bool AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool isDisc = false); bool AttemptForcedCastSpell(Mob* tar, uint16 spell_id, bool is_disc = false);
bool AttemptCloseBeneficialSpells(uint16 spellType); bool AttemptCloseBeneficialSpells(uint16 spell_type);
bool AI_EngagedCastCheck() override; bool AI_EngagedCastCheck() override;
bool AI_PursueCastCheck() override; bool AI_PursueCastCheck() override;
bool AI_IdleCastCheck() override; bool AI_IdleCastCheck() override;
@@ -509,37 +509,37 @@ public:
{ return Mob::Attack(other, Hand, FromRiposte, IsStrikethrough, IsFromSpell, opts); } { return Mob::Attack(other, Hand, FromRiposte, IsStrikethrough, IsFromSpell, opts); }
void DoAttackRounds(Mob* target, int hand); void DoAttackRounds(Mob* target, int hand);
bool PrecastChecks(Mob* tar, uint16 spellType); bool PrecastChecks(Mob* tar, uint16 spell_type);
bool CastChecks(uint16 spell_id, Mob* tar, uint16 spellType, bool doPrechecks = false, bool AECheck = false); bool CastChecks(uint16 spell_id, Mob* tar, uint16 spell_type, bool prechecks = false, bool ae_check = false);
bool CanCastSpellType(uint16 spellType, uint16 spell_id, Mob* tar); bool CanCastSpellType(uint16 spell_type, uint16 spell_id, Mob* tar);
bool BotHasEnoughMana(uint16 spell_id); bool BotHasEnoughMana(uint16 spell_id);
std::vector<Mob*> GetSpellTargetList() { return _spellTargetList; } std::vector<Mob*> GetSpellTargetList() { return _spellTargetList; }
void SetSpellTargetList(std::vector<Mob*> spellTargetList) { _spellTargetList = spellTargetList; } void SetSpellTargetList(std::vector<Mob*> spell_target_list) { _spellTargetList = spell_target_list; }
std::vector<Mob*> GetGroupSpellTargetList() { return _groupSpellTargetList; } std::vector<Mob*> GetGroupSpellTargetList() { return _groupSpellTargetList; }
void SetGroupSpellTargetList(std::vector<Mob*> spellTargetList) { _groupSpellTargetList = spellTargetList; } void SetGroupSpellTargetList(std::vector<Mob*> spell_target_list) { _groupSpellTargetList = spell_target_list; }
Raid* GetStoredRaid() { return _storedRaid; } Raid* GetStoredRaid() { return _storedRaid; }
void SetStoredRaid(Raid* storedRaid) { _storedRaid = storedRaid; } void SetStoredRaid(Raid* stored_raid) { _storedRaid = stored_raid; }
bool GetVerifiedRaid() { return _verifiedRaid; } bool GetVerifiedRaid() { return _verifiedRaid; }
void SetVerifiedRaid(bool status) { _verifiedRaid = status; } void SetVerifiedRaid(bool status) { _verifiedRaid = status; }
uint16 GetTempSpellType() { return _tempSpellType; } uint16 GetTempSpellType() { return _tempSpellType; }
void SetTempSpellType(uint16 spellType) { _tempSpellType = spellType; } void SetTempSpellType(uint16 spell_type) { _tempSpellType = spell_type; }
void AssignBotSpellsToTypes(std::vector<BotSpells_Struct>& AIBot_spells, std::unordered_map<uint16, std::vector<BotSpells_Struct_wIndex>>& AIBot_spells_by_type); void AssignBotSpellsToTypes(std::vector<BotSpells_Struct>& AIBot_spells, std::unordered_map<uint16, std::vector<BotSpells_Struct_wIndex>>& AIBot_spells_by_type);
bool IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spell_id); bool IsTargetAlreadyReceivingSpell(Mob* tar, uint16 spell_id);
bool DoResistCheck(Mob* target, uint16 spell_id, int32 resist_limit); bool DoResistCheck(Mob* target, uint16 spell_id, int32 resist_limit);
bool DoResistCheckBySpellType(Mob* tar, uint16 spell_id, uint16 spellType); bool DoResistCheckBySpellType(Mob* tar, uint16 spell_id, uint16 spell_type);
bool IsValidTargetType(uint16 spell_id, int targetType, uint8 bodyType); bool IsValidTargetType(uint16 spell_id, int target_type, uint8 body_type);
bool IsMobEngagedByAnyone(Mob* tar); bool IsMobEngagedByAnyone(Mob* tar);
void SetBotSetting(uint8 settingType, uint16 botSetting, int settingValue); void SetBotSetting(uint8 setting_type, uint16 bot_setting, int setting_value);
void CopySettings(Bot* to, uint8 settingType, uint16 spellType = UINT16_MAX); void CopySettings(Bot* to, uint8 setting_type, uint16 spell_type = UINT16_MAX);
void CopyBotSpellSettings(Bot* to); void CopyBotSpellSettings(Bot* to);
void ResetBotSpellSettings(); void ResetBotSpellSettings();
void CopyBotBlockedBuffs(Bot* to); void CopyBotBlockedBuffs(Bot* to);
void CopyBotBlockedPetBuffs(Bot* to); void CopyBotBlockedPetBuffs(Bot* to);
int GetBotBaseSetting(uint16 botSetting); int GetBotBaseSetting(uint16 bot_setting);
int GetDefaultBotBaseSetting(uint16 botSetting, uint8 stance = Stance::Balanced); int GetDefaultBotBaseSetting(uint16 bot_setting, uint8 stance = Stance::Balanced);
void SetBotBaseSetting(uint16 botSetting, int settingValue); void SetBotBaseSetting(uint16 bot_setting, int setting_value);
void LoadDefaultBotSettings(); void LoadDefaultBotSettings();
void SetBotSpellRecastTimer(uint16 spellType, Mob* spelltar, bool preCast = false); void SetBotSpellRecastTimer(uint16 spell_type, Mob* spelltar, bool pre_cast = false);
uint16 GetSpellByAA(int id, AA::Rank* &rank); uint16 GetSpellByAA(int id, AA::Rank* &rank);
void CleanBotBlockedBuffs(); void CleanBotBlockedBuffs();
void ClearBotBlockedBuffs() { bot_blocked_buffs.clear(); } void ClearBotBlockedBuffs() { bot_blocked_buffs.clear(); }
@@ -548,40 +548,40 @@ public:
void SetBotBlockedBuff(uint16 spell_id, bool block); void SetBotBlockedBuff(uint16 spell_id, bool block);
void SetBotBlockedPetBuff(uint16 spell_id, bool block); void SetBotBlockedPetBuff(uint16 spell_id, bool block);
int GetDefaultSetting(uint16 settingCategory, uint16 settingType, uint8 stance = Stance::Balanced); int GetDefaultSetting(uint16 setting_category, uint16 setting_type, uint8 stance = Stance::Balanced);
uint16 GetDefaultSpellTypePriority(uint16 spellType, uint8 priorityType, uint8 botClass, uint8 stance = Stance::Balanced); uint16 GetDefaultSpellTypePriority(uint16 spell_type, uint8 priority_type, uint8 bot_class, uint8 stance = Stance::Balanced);
uint16 GetDefaultSpellTypeIdlePriority(uint16 spellType, uint8 botClass, uint8 stance = Stance::Balanced); uint16 GetDefaultSpellTypeIdlePriority(uint16 spell_type, uint8 bot_class, uint8 stance = Stance::Balanced);
uint16 GetDefaultSpellTypeEngagedPriority(uint16 spellType, uint8 botClass, uint8 stance = Stance::Balanced); uint16 GetDefaultSpellTypeEngagedPriority(uint16 spell_type, uint8 bot_class, uint8 stance = Stance::Balanced);
uint16 GetDefaultSpellTypePursuePriority(uint16 spellType, uint8 botClass, uint8 stance = Stance::Balanced); uint16 GetDefaultSpellTypePursuePriority(uint16 spell_type, uint8 bot_class, uint8 stance = Stance::Balanced);
uint16 GetDefaultSpellTypeResistLimit(uint16 spellType, uint8 stance = Stance::Balanced); uint16 GetDefaultSpellTypeResistLimit(uint16 spell_type, uint8 stance = Stance::Balanced);
bool GetDefaultSpellTypeAggroCheck(uint16 spellType, uint8 stance = Stance::Balanced); bool GetDefaultSpellTypeAggroCheck(uint16 spell_type, uint8 stance = Stance::Balanced);
uint8 GetDefaultSpellTypeMinManaLimit(uint16 spellType, uint8 stance = Stance::Balanced); uint8 GetDefaultSpellTypeMinManaLimit(uint16 spell_type, uint8 stance = Stance::Balanced);
uint8 GetDefaultSpellTypeMaxManaLimit(uint16 spellType, uint8 stance = Stance::Balanced); uint8 GetDefaultSpellTypeMaxManaLimit(uint16 spell_type, uint8 stance = Stance::Balanced);
uint8 GetDefaultSpellTypeMinHPLimit(uint16 spellType, uint8 stance = Stance::Balanced); uint8 GetDefaultSpellTypeMinHPLimit(uint16 spell_type, uint8 stance = Stance::Balanced);
uint8 GetDefaultSpellTypeMaxHPLimit(uint16 spellType, uint8 stance = Stance::Balanced); uint8 GetDefaultSpellTypeMaxHPLimit(uint16 spell_type, uint8 stance = Stance::Balanced);
uint16 GetDefaultSpellTypeAEOrGroupTargetCount(uint16 spellType, uint8 stance = Stance::Balanced); uint16 GetDefaultSpellTypeAEOrGroupTargetCount(uint16 spell_type, uint8 stance = Stance::Balanced);
int GetSetting(uint16 settingCategory, uint16 settingType); int GetSetting(uint16 setting_category, uint16 setting_type);
uint16 GetSpellTypePriority(uint16 spellType, uint8 priorityType); uint16 GetSpellTypePriority(uint16 spell_type, uint8 priority_type);
void SetSpellTypePriority(uint16 spellType, uint8 priorityType, uint16 priority); void SetSpellTypePriority(uint16 spell_type, uint8 priority_type, uint16 priority);
inline uint16 GetSpellTypeResistLimit(uint16 spellType) const { return _spellSettings[spellType].resistLimit; } inline uint16 GetSpellTypeResistLimit(uint16 spell_type) const { return _spellSettings[spell_type].resistLimit; }
void SetSpellTypeResistLimit(uint16 spellType, uint16 resistLimit); void SetSpellTypeResistLimit(uint16 spell_type, uint16 resist_limit);
inline bool GetSpellTypeAggroCheck(uint16 spellType) const { return _spellSettings[spellType].aggroCheck; } inline bool GetSpellTypeAggroCheck(uint16 spell_type) const { return _spellSettings[spell_type].aggroCheck; }
void SetSpellTypeAggroCheck(uint16 spellType, bool AggroCheck); void SetSpellTypeAggroCheck(uint16 spell_type, bool aggro_check);
inline uint8 GetSpellTypeMinManaLimit(uint16 spellType) const { return _spellSettings[spellType].minManaPct; } inline uint8 GetSpellTypeMinManaLimit(uint16 spell_type) const { return _spellSettings[spell_type].minManaPct; }
inline uint8 GetSpellTypeMaxManaLimit(uint16 spellType) const { return _spellSettings[spellType].maxManaPct; } inline uint8 GetSpellTypeMaxManaLimit(uint16 spell_type) const { return _spellSettings[spell_type].maxManaPct; }
void SetSpellTypeMinManaLimit(uint16 spellType, uint8 manaLimit); void SetSpellTypeMinManaLimit(uint16 spell_type, uint8 mana_limit);
void SetSpellTypeMaxManaLimit(uint16 spellType, uint8 manaLimit); void SetSpellTypeMaxManaLimit(uint16 spell_type, uint8 mana_limit);
inline uint8 GetSpellTypeMinHPLimit(uint16 spellType) const { return _spellSettings[spellType].minHPPct; } inline uint8 GetSpellTypeMinHPLimit(uint16 spell_type) const { return _spellSettings[spell_type].minHPPct; }
inline uint8 GetSpellTypeMaxHPLimit(uint16 spellType) const { return _spellSettings[spellType].maxHPPct; } inline uint8 GetSpellTypeMaxHPLimit(uint16 spell_type) const { return _spellSettings[spell_type].maxHPPct; }
void SetSpellTypeMinHPLimit(uint16 spellType, uint8 hpLimit); void SetSpellTypeMinHPLimit(uint16 spell_type, uint8 hp_limit);
void SetSpellTypeMaxHPLimit(uint16 spellType, uint8 hpLimit); void SetSpellTypeMaxHPLimit(uint16 spell_type, uint8 hp_limit);
inline uint16 GetSpellTypeAEOrGroupTargetCount(uint16 spellType) const { return _spellSettings[spellType].AEOrGroupTargetCount; } inline uint16 GetSpellTypeAEOrGroupTargetCount(uint16 spell_type) const { return _spellSettings[spell_type].AEOrGroupTargetCount; }
void SetSpellTypeAEOrGroupTargetCount(uint16 spellType, uint16 targetCount); void SetSpellTypeAEOrGroupTargetCount(uint16 spell_type, uint16 target_count);
bool BotPassiveCheck(); bool BotPassiveCheck();
bool GetShowHelm() const { return _showHelm; } bool GetShowHelm() const { return _showHelm; }
void SetShowHelm(bool showHelm) { _showHelm = showHelm; } void SetShowHelm(bool show_helm) { _showHelm = show_helm; }
bool GetBehindMob() const { return _behindMobStatus; } bool GetBehindMob() const { return _behindMobStatus; }
void SetBehindMob(bool value) { _behindMobStatus = value; } void SetBehindMob(bool value) { _behindMobStatus = value; }
bool GetMaxMeleeRange() const { return _maxMeleeRangeStatus; } bool GetMaxMeleeRange() const { return _maxMeleeRangeStatus; }
@@ -589,24 +589,24 @@ public:
uint8 GetStopMeleeLevel() const { return _stopMeleeLevel; } uint8 GetStopMeleeLevel() const { return _stopMeleeLevel; }
void SetStopMeleeLevel(uint8 level) { _stopMeleeLevel = level; } void SetStopMeleeLevel(uint8 level) { _stopMeleeLevel = level; }
uint32 GetBotDistanceRanged() const { return _distanceRanged; } uint32 GetBotDistanceRanged() const { return _distanceRanged; }
void SetBotDistanceRanged(uint32 distanceRanged) { _distanceRanged = distanceRanged; } void SetBotDistanceRanged(uint32 distance) { _distanceRanged = distance; }
bool GetMedInCombat() const { return _medInCombat; } bool GetMedInCombat() const { return _medInCombat; }
void SetMedInCombat(bool value) { _medInCombat = value; } void SetMedInCombat(bool value) { _medInCombat = value; }
uint8 GetSitHPPct() const { return _SitHPPct; } uint8 GetSitHPPct() const { return _SitHPPct; }
void SetSitHPPct(uint8 value) { _SitHPPct = value; } void SetSitHPPct(uint8 value) { _SitHPPct = value; }
uint8 GetSitManaPct() const { return _SitManaPct; } uint8 GetSitManaPct() const { return _SitManaPct; }
void SetSitManaPct(uint8 value) { _SitManaPct = value; } void SetSitManaPct(uint8 value) { _SitManaPct = value; }
void SetHasLoS(bool hasLoS) { _hasLoS = hasLoS; } void SetHasLoS(bool has_los) { _hasLoS = has_los; }
bool HasLoS() const { return _hasLoS; } bool HasLoS() const { return _hasLoS; }
std::list<BotSpellTypeOrder> GetSpellTypesPrioritized(uint8 priorityType); std::list<BotSpellTypeOrder> GetSpellTypesPrioritized(uint8 priority_type);
uint16 GetParentSpellType(uint16 spellType); uint16 GetParentSpellType(uint16 spell_type);
bool IsValidSpellTypeBySpellID(uint16 spellType, uint16 spell_id); bool IsValidSpellTypeBySpellID(uint16 spell_type, uint16 spell_id);
inline uint16 GetCastedSpellType() const { return _castedSpellType; } inline uint16 GetCastedSpellType() const { return _castedSpellType; }
void SetCastedSpellType(uint16 spellType); void SetCastedSpellType(uint16 spell_type);
bool IsValidSpellTypeSubType(uint16 spellType, uint16 subType, uint16 spell_id); bool IsValidSpellTypeSubType(uint16 spell_type, uint16 sub_type, uint16 spell_id);
bool HasValidAETarget(Bot* botCaster, uint16 spell_id, uint16 spellType, Mob* tar); bool HasValidAETarget(Bot* caster, uint16 spell_id, uint16 spell_type, Mob* tar);
void CheckBotSpells(); void CheckBotSpells();
@@ -655,37 +655,37 @@ public:
ProcessBotGroupAdd(Group* group, Raid* raid, Client* client = nullptr, bool new_raid = false, bool initial = false); ProcessBotGroupAdd(Group* group, Raid* raid, Client* client = nullptr, bool new_raid = false, bool initial = false);
static std::list<BotSpell> GetBotSpellsForSpellEffect(Bot* botCaster, uint16 spellType, int spellEffect); static std::list<BotSpell> GetBotSpellsForSpellEffect(Bot* caster, uint16 spell_type, int spell_effect);
static std::list<BotSpell> GetBotSpellsForSpellEffectAndTargetType(Bot* botCaster, uint16 spellType, int spellEffect, SpellTargetType targetType); static std::list<BotSpell> GetBotSpellsForSpellEffectAndTargetType(Bot* caster, uint16 spell_type, int spell_effect, SpellTargetType target_type);
static std::list<BotSpell> GetBotSpellsBySpellType(Bot* botCaster, uint16 spellType); static std::list<BotSpell> GetBotSpellsBySpellType(Bot* caster, uint16 spell_type);
static std::vector<BotSpell_wPriority> GetPrioritizedBotSpellsBySpellType(Bot* botCaster, uint16 spellType, Mob* tar, bool AE = false, uint16 subTargetType = UINT16_MAX, uint16 subType = UINT16_MAX); static std::vector<BotSpell_wPriority> GetPrioritizedBotSpellsBySpellType(Bot* caster, uint16 spell_type, Mob* tar, bool AE = false, uint16 sub_target_type = UINT16_MAX, uint16 sub_type = UINT16_MAX);
static BotSpell GetFirstBotSpellBySpellType(Bot* botCaster, uint16 spellType); static BotSpell GetFirstBotSpellBySpellType(Bot* caster, uint16 spell_type);
BotSpell GetSpellByHealType(uint16 spellType, Mob* tar); BotSpell GetSpellByHealType(uint16 spell_type, Mob* tar);
static BotSpell GetBestBotSpellForVeryFastHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForVeryFastHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static BotSpell GetBestBotSpellForFastHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForFastHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static BotSpell GetBestBotSpellForHealOverTime(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForHealOverTime(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static BotSpell GetBestBotSpellForPercentageHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForPercentageHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static BotSpell GetBestBotSpellForRegularSingleTargetHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForRegularSingleTargetHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static BotSpell GetFirstBotSpellForSingleTargetHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetFirstBotSpellForSingleTargetHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static BotSpell GetBestBotSpellForGroupHealOverTime(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForGroupHealOverTime(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static BotSpell GetBestBotSpellForGroupCompleteHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForGroupCompleteHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static BotSpell GetBestBotSpellForGroupHeal(Bot* botCaster, Mob* tar, uint16 spellType = BotSpellTypes::RegularHeal); static BotSpell GetBestBotSpellForGroupHeal(Bot* caster, Mob* tar, uint16 spell_type = BotSpellTypes::RegularHeal);
static Mob* GetFirstIncomingMobToMez(Bot* botCaster, int16 spell_id, uint16 spellType, bool AE); static Mob* GetFirstIncomingMobToMez(Bot* caster, int16 spell_id, uint16 spell_type, bool AE);
bool IsValidMezTarget(Mob* owner, Mob* npc, uint16 spell_id); bool IsValidMezTarget(Mob* owner, Mob* npc, uint16 spell_id);
static BotSpell GetBestBotSpellForMez(Bot* botCaster, uint16 spellType = BotSpellTypes::Mez); static BotSpell GetBestBotSpellForMez(Bot* caster, uint16 spell_type = BotSpellTypes::Mez);
static BotSpell GetBestBotMagicianPetSpell(Bot* botCaster, uint16 spellType = BotSpellTypes::Pet); static BotSpell GetBestBotMagicianPetSpell(Bot* caster, uint16 spell_type = BotSpellTypes::Pet);
static std::string GetBotMagicianPetType(Bot* botCaster); static std::string GetBotMagicianPetType(Bot* caster);
static BotSpell GetBestBotSpellForNukeByTargetType(Bot* botCaster, SpellTargetType targetType, uint16 spellType, bool AE = false, Mob* tar = nullptr); static BotSpell GetBestBotSpellForNukeByTargetType(Bot* caster, SpellTargetType target_type, uint16 spell_type, bool AE = false, Mob* tar = nullptr);
static BotSpell GetBestBotSpellForStunByTargetType(Bot* botCaster, SpellTargetType targetType, uint16 spellType, bool AE = false, Mob* tar = nullptr); static BotSpell GetBestBotSpellForStunByTargetType(Bot* caster, SpellTargetType target_type, uint16 spell_type, bool AE = false, Mob* tar = nullptr);
static BotSpell GetBestBotWizardNukeSpellByTargetResists(Bot* botCaster, Mob* target, uint16 spellType); static BotSpell GetBestBotWizardNukeSpellByTargetResists(Bot* caster, Mob* target, uint16 spell_type);
static BotSpell GetDebuffBotSpell(Bot* botCaster, Mob* target, uint16 spellType); static BotSpell GetDebuffBotSpell(Bot* caster, Mob* target, uint16 spell_type);
static BotSpell GetBestBotSpellForCure(Bot* botCaster, Mob* target, uint16 spellType); static BotSpell GetBestBotSpellForCure(Bot* caster, Mob* target, uint16 spell_type);
static BotSpell GetBestBotSpellForResistDebuff(Bot* botCaster, Mob* target, uint16 spellType); static BotSpell GetBestBotSpellForResistDebuff(Bot* caster, Mob* target, uint16 spell_type);
static BotSpell GetBestBotSpellForNukeByBodyType(Bot* botCaster, uint8 bodyType, uint16 spellType, bool AE = false, Mob* tar = nullptr); static BotSpell GetBestBotSpellForNukeByBodyType(Bot* caster, uint8 body_type, uint16 spell_type, bool AE = false, Mob* tar = nullptr);
static BotSpell GetBestBotSpellForRez(Bot* botCaster, Mob* target, uint16 spellType); static BotSpell GetBestBotSpellForRez(Bot* caster, Mob* target, uint16 spell_type);
static BotSpell GetBestBotSpellForCharm(Bot* botCaster, Mob* target, uint16 spellType); static BotSpell GetBestBotSpellForCharm(Bot* caster, Mob* target, uint16 spell_type);
static NPCType *CreateDefaultNPCTypeStructForBot( static NPCType *CreateDefaultNPCTypeStructForBot(
const std::string& botName, const std::string& botName,
@@ -720,7 +720,7 @@ public:
bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; } bool GetRangerAutoWeaponSelect() { return _rangerAutoWeaponSelect; }
uint8 GetBotStance() { return _botStance; } uint8 GetBotStance() { return _botStance; }
uint8 GetChanceToCastBySpellType(uint16 spellType); uint8 GetChanceToCastBySpellType(uint16 spell_type);
bool IsGroupHealer() const { return m_CastingRoles.GroupHealer; } bool IsGroupHealer() const { return m_CastingRoles.GroupHealer; }
bool IsGroupSlower() const { return m_CastingRoles.GroupSlower; } bool IsGroupSlower() const { return m_CastingRoles.GroupSlower; }
bool IsGroupNuker() const { return m_CastingRoles.GroupNuker; } bool IsGroupNuker() const { return m_CastingRoles.GroupNuker; }
@@ -832,7 +832,7 @@ public:
void SetBotSpellID(uint32 newSpellID); void SetBotSpellID(uint32 newSpellID);
void SetSpawnStatus(bool spawnStatus) { _spawnStatus = spawnStatus; } void SetSpawnStatus(bool spawnStatus) { _spawnStatus = spawnStatus; }
void SetPetChooserID(uint8 id) { _petChooserID = id; } void SetPetChooserID(uint8 id) { _petChooserID = id; }
void SetBotRangedSetting(bool botRangedSetting) { _botRangedSetting = botRangedSetting; } void SetBotRangedSetting(bool value) { _botRangedSetting = value; }
void SetBotCharmer(bool c) { _botCharmer = c; } void SetBotCharmer(bool c) { _botCharmer = c; }
void SetBotOwner(Mob* botOwner) { this->_botOwner = botOwner; } void SetBotOwner(Mob* botOwner) { this->_botOwner = botOwner; }
void SetRangerAutoWeaponSelect(bool enable) { GetClass() == Class::Ranger ? _rangerAutoWeaponSelect = enable : _rangerAutoWeaponSelect = false; } void SetRangerAutoWeaponSelect(bool enable) { GetClass() == Class::Ranger ? _rangerAutoWeaponSelect = enable : _rangerAutoWeaponSelect = false; }
@@ -950,7 +950,7 @@ public:
std::vector<BotTimer_Struct> GetBotTimers() { return bot_timers; } std::vector<BotTimer_Struct> GetBotTimers() { return bot_timers; }
void SetBotTimers(std::vector<BotTimer_Struct> timers) { bot_timers = timers; } void SetBotTimers(std::vector<BotTimer_Struct> timers) { bot_timers = timers; }
std::vector<BotBlockedBuffs_Struct> GetBotBlockedBuffs() { return bot_blocked_buffs; } std::vector<BotBlockedBuffs_Struct> GetBotBlockedBuffs() { return bot_blocked_buffs; }
void SetBotBlockedBuffs(std::vector<BotBlockedBuffs_Struct> blockedBuff) { bot_blocked_buffs = blockedBuff; } void SetBotBlockedBuffs(std::vector<BotBlockedBuffs_Struct> blocked_buffs) { bot_blocked_buffs = blocked_buffs; }
uint32 GetLastZoneID() const { return _lastZoneId; } uint32 GetLastZoneID() const { return _lastZoneId; }
int32 GetBaseAC() const { return _baseAC; } int32 GetBaseAC() const { return _baseAC; }
int32 GetBaseATK() const { return _baseATK; } int32 GetBaseATK() const { return _baseATK; }
@@ -977,11 +977,11 @@ public:
static uint8 spell_casting_chances[SPELL_TYPE_COUNT][Class::PLAYER_CLASS_COUNT][Stance::AEBurn][cntHSND]; static uint8 spell_casting_chances[SPELL_TYPE_COUNT][Class::PLAYER_CLASS_COUNT][Stance::AEBurn][cntHSND];
bool BotCastMez(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); bool BotCastMez(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type);
bool BotCastHeal(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); bool BotCastHeal(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type);
bool BotCastNuke(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); bool BotCastNuke(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type);
bool BotCastPet(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); bool BotCastPet(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type);
bool BotCastCure(Mob* tar, uint8 botClass, BotSpell& botSpell, uint16 spellType); bool BotCastCure(Mob* tar, uint8 bot_class, BotSpell& bot_spell, uint16 spell_type);
bool CheckIfIncapacitated(); bool CheckIfIncapacitated();
bool IsAIProcessValid(const Client* bot_owner, const Group* bot_group, const Raid* raid); bool IsAIProcessValid(const Client* bot_owner, const Group* bot_group, const Raid* raid);
@@ -1010,12 +1010,12 @@ public:
const Mob* tar, const Mob* tar,
const EQ::ItemInstance* const& p_item, const EQ::ItemInstance* const& p_item,
const EQ::ItemInstance* const& s_item, const EQ::ItemInstance* const& s_item,
bool behindMob, bool behind_mob,
bool backstab_weapon, bool backstab_weapon,
float& melee_distance_min, float& melee_distance_min,
float& melee_distance, float& melee_distance,
float& melee_distance_max, float& melee_distance_max,
uint8 stopMeleeLevel uint8 stop_melee_level
); );
// Combat Checks // Combat Checks
@@ -1025,14 +1025,14 @@ public:
void CheckCombatRange( void CheckCombatRange(
Mob* tar, Mob* tar,
float tar_distance, float tar_distance,
bool& atCombatRange, bool& at_combat_range,
bool behindMob, bool behind_mob,
const EQ::ItemInstance*& p_item, const EQ::ItemInstance*& p_item,
const EQ::ItemInstance*& s_item, const EQ::ItemInstance*& s_item,
float& melee_distance_min, float& melee_distance_min,
float& melee_distance, float& melee_distance,
float& melee_distance_max, float& melee_distance_max,
uint8 stopMeleeLevel uint8 stop_melee_level
); );
bool GetCombatJitterFlag() { return m_combat_jitter_flag; } bool GetCombatJitterFlag() { return m_combat_jitter_flag; }
void SetCombatJitterFlag(bool flag = true) { m_combat_jitter_flag = flag; } void SetCombatJitterFlag(bool flag = true) { m_combat_jitter_flag = flag; }
@@ -1040,7 +1040,7 @@ public:
void SetCombatOutOfRangeJitterFlag(bool flag = true) { m_combat_out_of_range_jitter_flag = flag; } void SetCombatOutOfRangeJitterFlag(bool flag = true) { m_combat_out_of_range_jitter_flag = flag; }
void SetCombatJitter(); void SetCombatJitter();
void SetCombatOutOfRangeJitter(); void SetCombatOutOfRangeJitter();
void DoCombatPositioning(Mob* tar, glm::vec3 Goal, bool stopMeleeLevel, float tar_distance, float melee_distance_min, float melee_distance, float melee_distance_max, bool behindMob, bool frontMob); void DoCombatPositioning(Mob* tar, glm::vec3 Goal, bool stop_melee_level, float tar_distance, float melee_distance_min, float melee_distance, float melee_distance_max, bool behind_mob, bool front_mob);
void DoFaceCheckWithJitter(Mob* tar); void DoFaceCheckWithJitter(Mob* tar);
void DoFaceCheckNoJitter(Mob* tar); void DoFaceCheckNoJitter(Mob* tar);
void RunToGoalWithJitter(glm::vec3 Goal); void RunToGoalWithJitter(glm::vec3 Goal);
@@ -1056,15 +1056,15 @@ public:
bool TryIdleChecks(float fm_distance); bool TryIdleChecks(float fm_distance);
bool TryNonCombatMovementChecks(Client* bot_owner, const Mob* follow_mob, glm::vec3& Goal); bool TryNonCombatMovementChecks(Client* bot_owner, const Mob* follow_mob, glm::vec3& Goal);
bool TryBardMovementCasts(); bool TryBardMovementCasts();
bool BotRangedAttack(Mob* other, bool CanDoubleAttack = false); bool BotRangedAttack(Mob* other, bool can_double_attack = false);
bool CheckDoubleRangedAttack(); bool CheckDoubleRangedAttack();
// Public "Refactor" Methods // Public "Refactor" Methods
static bool CheckCampSpawnConditions(Client* c); static bool CheckCampSpawnConditions(Client* c);
protected: protected:
void BotMeditate(bool isSitting); void BotMeditate(bool is_sitting);
bool CheckBotDoubleAttack(bool Triple = false); bool CheckBotDoubleAttack(bool triple_attack = false);
bool CheckTripleAttack(); bool CheckTripleAttack();
void PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* client); void PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client* client);
bool AIDoSpellCast(int32 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = nullptr) override; bool AIDoSpellCast(int32 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore = nullptr) override;
@@ -1210,6 +1210,6 @@ private:
int32 CalcItemATKCap() final; int32 CalcItemATKCap() final;
}; };
bool IsSpellInBotList(DBbotspells_Struct* spell_list, uint16 iSpellID); bool IsSpellInBotList(DBbotspells_Struct* spell_list, uint16 spell_id);
#endif // BOT_H #endif // BOT_H
+26 -26
View File
@@ -2100,34 +2100,34 @@ void SendSpellTypeWindow(Client* c, const Seperator* sep) {
std::string arg0 = sep->arg[0]; std::string arg0 = sep->arg[0];
std::string arg1 = sep->arg[1]; std::string arg1 = sep->arg[1];
uint8 minCount = 0; uint8 min_count = 0;
uint8 maxCount = 0; uint8 max_count = 0;
bool clientOnly = false; bool client_only = false;
if (BotSpellTypes::END <= 19) { if (BotSpellTypes::END <= 19) {
minCount = BotSpellTypes::START; min_count = BotSpellTypes::START;
maxCount = BotSpellTypes::END; max_count = BotSpellTypes::END;
} }
else if (!arg1.compare("0-19")) { else if (!arg1.compare("0-19")) {
minCount = BotSpellTypes::START; min_count = BotSpellTypes::START;
maxCount = 19; max_count = 19;
} }
else if (!arg1.compare("20-39")) { else if (!arg1.compare("20-39")) {
minCount = std::min(static_cast<uint8_t>(20), static_cast<uint8_t>(BotSpellTypes::END)); min_count = std::min(static_cast<uint8_t>(20), static_cast<uint8_t>(BotSpellTypes::END));
maxCount = std::min(static_cast<uint8_t>(39), static_cast<uint8_t>(BotSpellTypes::END)); max_count = std::min(static_cast<uint8_t>(39), static_cast<uint8_t>(BotSpellTypes::END));
} }
else if (!arg1.compare("40+")) { else if (!arg1.compare("40+")) {
minCount = std::min(static_cast<uint8_t>(40), static_cast<uint8_t>(BotSpellTypes::END)); min_count = std::min(static_cast<uint8_t>(40), static_cast<uint8_t>(BotSpellTypes::END));
maxCount = BotSpellTypes::END; max_count = BotSpellTypes::END;
} }
else if (!arg1.compare("commanded")) { else if (!arg1.compare("commanded")) {
minCount = BotSpellTypes::COMMANDED_START; min_count = BotSpellTypes::COMMANDED_START;
maxCount = BotSpellTypes::COMMANDED_END; max_count = BotSpellTypes::COMMANDED_END;
} }
else if (!arg1.compare("client")) { else if (!arg1.compare("client")) {
minCount = BotSpellTypes::START; min_count = BotSpellTypes::START;
maxCount = BotSpellTypes::END; max_count = BotSpellTypes::END;
clientOnly = true; client_only = true;
} }
else { else {
c->Message(Chat::Yellow, "You must choose a valid range option"); c->Message(Chat::Yellow, "You must choose a valid range option");
@@ -2141,25 +2141,25 @@ void SendSpellTypeWindow(Client* c, const Seperator* sep) {
const std::string& forest_green = "forest_green"; const std::string& forest_green = "forest_green";
const std::string& goldenrod = "goldenrod"; const std::string& goldenrod = "goldenrod";
std::string fillerLine = "-----------"; std::string filler_line = "-----------";
std::string spellTypeField = "Spell Type"; std::string spell_type_field = "Spell Type";
std::string idField = "ID"; std::string id_field = "ID";
std::string shortnameField = "Short Name"; std::string shortname_field = "Short Name";
std::string popup_text = DialogueWindow::TableRow( std::string popup_text = DialogueWindow::TableRow(
DialogueWindow::TableCell(DialogueWindow::ColorMessage(goldenrod, spellTypeField)) DialogueWindow::TableCell(DialogueWindow::ColorMessage(goldenrod, spell_type_field))
+ +
DialogueWindow::TableCell((!arg0.compare("^spelltypeids") ? DialogueWindow::ColorMessage(goldenrod, idField) : DialogueWindow::ColorMessage(goldenrod, shortnameField))) DialogueWindow::TableCell((!arg0.compare("^spelltypeids") ? DialogueWindow::ColorMessage(goldenrod, id_field) : DialogueWindow::ColorMessage(goldenrod, shortname_field)))
); );
popup_text += DialogueWindow::TableRow( popup_text += DialogueWindow::TableRow(
DialogueWindow::TableCell(DialogueWindow::ColorMessage(gold, fillerLine)) DialogueWindow::TableCell(DialogueWindow::ColorMessage(gold, filler_line))
+ +
DialogueWindow::TableCell(DialogueWindow::ColorMessage(gold, fillerLine)) DialogueWindow::TableCell(DialogueWindow::ColorMessage(gold, filler_line))
); );
for (int i = minCount; i <= maxCount; ++i) { for (int i = min_count; i <= max_count; ++i) {
if (clientOnly && !IsClientBotSpellType(i)) { if (client_only && !IsClientBotSpellType(i)) {
continue; continue;
} }
+24 -24
View File
@@ -56,15 +56,15 @@ void bot_command_camp(Client *c, const Seperator *sep)
return; return;
} }
uint16 campCount; uint16 camp_count;
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
bot_iter->Camp(); bot_iter->Camp();
++campCount; ++camp_count;
} }
if (campCount) { if (camp_count) {
c->Message(Chat::White, "%i of your bots have been camped.", campCount); c->Message(Chat::White, "%i of your bots have been camped.", camp_count);
} }
} }
@@ -559,7 +559,7 @@ void bot_command_follow_distance(Client *c, const Seperator *sep)
uint32 bfd = RuleI(Bots, DefaultFollowDistance); uint32 bfd = RuleI(Bots, DefaultFollowDistance);
bool set_flag = false; bool set_flag = false;
bool currentCheck = false; bool current_check = false;
int ab_arg = 2; int ab_arg = 2;
std::string arg1 = sep->arg[1]; std::string arg1 = sep->arg[1];
@@ -589,7 +589,7 @@ void bot_command_follow_distance(Client *c, const Seperator *sep)
++ab_arg; ++ab_arg;
} }
else if (!arg1.compare("current")) { else if (!arg1.compare("current")) {
currentCheck = true; current_check = true;
} }
else if (arg1.compare("reset")) { else if (arg1.compare("reset")) {
c->Message( c->Message(
@@ -619,13 +619,13 @@ void bot_command_follow_distance(Client *c, const Seperator *sep)
sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end()); sbl.erase(std::remove(sbl.begin(), sbl.end(), nullptr), sbl.end());
int botCount = 0; int bot_count = 0;
for (auto bot_iter : sbl) { for (auto bot_iter : sbl) {
if (!bot_iter) { if (!bot_iter) {
continue; continue;
} }
if (currentCheck) { if (current_check) {
Mob* follow_mob = entity_list.GetMob(bot_iter->GetFollowID()); Mob* follow_mob = entity_list.GetMob(bot_iter->GetFollowID());
c->Message( c->Message(
@@ -640,15 +640,15 @@ void bot_command_follow_distance(Client *c, const Seperator *sep)
} }
else { else {
bot_iter->SetFollowDistance(bfd * bfd); bot_iter->SetFollowDistance(bfd * bfd);
++botCount; ++bot_count;
} }
} }
if (currentCheck) { if (current_check) {
return; return;
} }
if (botCount == 1) { if (bot_count == 1) {
Mob* follow_mob = entity_list.GetMob(sbl.front()->GetFollowID()); Mob* follow_mob = entity_list.GetMob(sbl.front()->GetFollowID());
c->Message( c->Message(
@@ -666,7 +666,7 @@ void bot_command_follow_distance(Client *c, const Seperator *sep)
Chat::Green, Chat::Green,
fmt::format( fmt::format(
"{} of your bots are now following at a distance of {}.", "{} of your bots are now following at a distance of {}.",
botCount, bot_count,
bfd bfd
).c_str() ).c_str()
); );
@@ -1170,16 +1170,16 @@ void bot_command_spawn(Client *c, const Seperator *sep)
} }
std::string silent_confirm = sep->arg[2]; std::string silent_confirm = sep->arg[2];
bool silentTell = false; bool silent_tell = false;
if (!silent_confirm.compare("silent")) { if (!silent_confirm.compare("silent")) {
silentTell = true; silent_tell = true;
} }
if (!silentTell && c->GetBotOption(Client::booSpawnMessageSay)) { if (!silent_tell && c->GetBotOption(Client::booSpawnMessageSay)) {
Bot::BotGroupSay(my_bot, bot_spawn_message[message_index].c_str()); Bot::BotGroupSay(my_bot, bot_spawn_message[message_index].c_str());
} }
else if (!silentTell && c->GetBotOption(Client::booSpawnMessageTell)) { else if (!silent_tell && c->GetBotOption(Client::booSpawnMessageTell)) {
my_bot->OwnerMessage(bot_spawn_message[message_index]); my_bot->OwnerMessage(bot_spawn_message[message_index]);
} }
} }
@@ -1330,7 +1330,7 @@ void bot_command_stance(Client *c, const Seperator *sep)
const int ab_mask = ActionableBots::ABM_Type1; const int ab_mask = ActionableBots::ABM_Type1;
bool currentCheck = false; bool current_check = false;
int ab_arg = 1; int ab_arg = 1;
uint32 value = 0; uint32 value = 0;
@@ -1360,7 +1360,7 @@ void bot_command_stance(Client *c, const Seperator *sep)
} }
else if (!arg1.compare("current")) { else if (!arg1.compare("current")) {
++ab_arg; ++ab_arg;
currentCheck = true; current_check = true;
} }
else { else {
c->Message( c->Message(
@@ -1395,7 +1395,7 @@ void bot_command_stance(Client *c, const Seperator *sep)
first_found = bot_iter; first_found = bot_iter;
} }
if (currentCheck) { if (current_check) {
c->Message( c->Message(
Chat::Green, Chat::Green,
fmt::format( fmt::format(
@@ -1436,7 +1436,7 @@ void bot_command_stance(Client *c, const Seperator *sep)
++success_count; ++success_count;
} }
if (currentCheck) { if (current_check) {
return; return;
} }
@@ -1482,7 +1482,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep)
uint8 sml = RuleI(Bots, CasterStopMeleeLevel); uint8 sml = RuleI(Bots, CasterStopMeleeLevel);
bool sync_sml = false; bool sync_sml = false;
bool reset_sml = false; bool reset_sml = false;
bool currentCheck = false; bool current_check = false;
if (sep->IsNumber(1)) { if (sep->IsNumber(1)) {
ab_arg = 2; ab_arg = 2;
@@ -1498,7 +1498,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep)
} }
else if (!arg1.compare("current")) { else if (!arg1.compare("current")) {
ab_arg = 2; ab_arg = 2;
currentCheck = true; current_check = true;
} }
else if (!strcasecmp(sep->arg[1], "reset")) { else if (!strcasecmp(sep->arg[1], "reset")) {
ab_arg = 2; ab_arg = 2;
@@ -1553,7 +1553,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep)
sml = my_bot->GetDefaultBotBaseSetting(BotBaseSettings::StopMeleeLevel); sml = my_bot->GetDefaultBotBaseSetting(BotBaseSettings::StopMeleeLevel);
} }
if (currentCheck) { if (current_check) {
c->Message( c->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
@@ -1570,7 +1570,7 @@ void bot_command_stop_melee_level(Client* c, const Seperator* sep)
} }
} }
if (!currentCheck) { if (!current_check) {
if (success_count == 1 && first_found) { if (success_count == 1 && first_found) {
c->Message( c->Message(
Chat::White, Chat::White,
+29 -29
View File
@@ -1161,8 +1161,8 @@ bool BotDatabase::SaveEquipmentColor(const uint32 bot_id, const int16 slot_id, c
if (all_flag) { if (all_flag) {
where_clause = fmt::format( where_clause = fmt::format(
"IN ({}, {}, {}, {}, {}, {}, {})", "IN ({}, {}, {}, {}, {}, {}, {})",
EQ::invslot::slotHead, EQ::invslot::SlotHead,
EQ::invslot::slotArms, EQ::invslot::SlotArms,
EQ::invslot::slotWrist1, EQ::invslot::slotWrist1,
EQ::invslot::slotHands, EQ::invslot::slotHands,
EQ::invslot::slotChest, EQ::invslot::slotChest,
@@ -2214,19 +2214,19 @@ bool BotDatabase::LoadBotSettings(Mob* m)
return false; return false;
} }
uint32 mobID = (m->IsClient() ? m->CastToClient()->CharacterID() : m->CastToBot()->GetBotID()); uint32 mob_id = (m->IsClient() ? m->CastToClient()->CharacterID() : m->CastToBot()->GetBotID());
uint8 stanceID = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0); uint8 stance_id = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0);
std::string query = ""; std::string query = "";
if (m->IsClient()) { if (m->IsClient()) {
query = fmt::format("`char_id` = {} AND `stance` = {}", mobID, stanceID); query = fmt::format("`char_id` = {} AND `stance` = {}", mob_id, stance_id);
} }
else { else {
query = fmt::format("`bot_id` = {} AND `stance` = {}", mobID, stanceID); query = fmt::format("`bot_id` = {} AND `stance` = {}", mob_id, stance_id);
} }
if (stanceID == Stance::Passive) { if (stance_id == Stance::Passive) {
LogBotSettings("{} is currently set to {} [#{}]. No saving or loading required.", m->GetCleanName(), Stance::GetName(Stance::Passive), Stance::Passive); LogBotSettings("{} is currently set to {} [#{}]. No saving or loading required.", m->GetCleanName(), Stance::GetName(Stance::Passive), Stance::Passive);
return true; return true;
} }
@@ -2273,11 +2273,11 @@ bool BotDatabase::SaveBotSettings(Mob* m)
return false; return false;
} }
uint32 botID = (m->IsBot() ? m->CastToBot()->GetBotID() : 0); uint32 bot_id = (m->IsBot() ? m->CastToBot()->GetBotID() : 0);
uint32 charID = (m->IsClient() ? m->CastToClient()->CharacterID() : 0); uint32 char_id = (m->IsClient() ? m->CastToClient()->CharacterID() : 0);
uint8 stanceID = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0); uint8 stance_id = (m->IsBot() ? m->CastToBot()->GetBotStance() : 0);
if (stanceID == Stance::Passive) { if (stance_id == Stance::Passive) {
LogBotSettings("{} is currently set to {} [#{}]. No saving or loading required.", m->GetCleanName(), Stance::GetName(Stance::Passive), Stance::Passive); LogBotSettings("{} is currently set to {} [#{}]. No saving or loading required.", m->GetCleanName(), Stance::GetName(Stance::Passive), Stance::Passive);
return true; return true;
} }
@@ -2285,10 +2285,10 @@ bool BotDatabase::SaveBotSettings(Mob* m)
std::string query = ""; std::string query = "";
if (m->IsClient()) { if (m->IsClient()) {
query = fmt::format("`char_id` = {} AND `stance` = {}", charID, stanceID); query = fmt::format("`char_id` = {} AND `stance` = {}", char_id, stance_id);
} }
else { else {
query = fmt::format("`bot_id` = {} AND `stance` = {}", botID, stanceID); query = fmt::format("`bot_id` = {} AND `stance` = {}", bot_id, stance_id);
} }
BotSettingsRepository::DeleteWhere(database, query); BotSettingsRepository::DeleteWhere(database, query);
@@ -2296,14 +2296,14 @@ bool BotDatabase::SaveBotSettings(Mob* m)
std::vector<BotSettingsRepository::BotSettings> v; std::vector<BotSettingsRepository::BotSettings> v;
if (m->IsBot()) { if (m->IsBot()) {
uint8 botStance = m->CastToBot()->GetBotStance(); uint8 bot_stance = m->CastToBot()->GetBotStance();
for (uint16 i = BotBaseSettings::START_ALL; i <= BotBaseSettings::END; ++i) { for (uint16 i = BotBaseSettings::START_ALL; i <= BotBaseSettings::END; ++i) {
if (m->CastToBot()->GetBotBaseSetting(i) != m->CastToBot()->GetDefaultBotBaseSetting(i, botStance)) { if (m->CastToBot()->GetBotBaseSetting(i) != m->CastToBot()->GetDefaultBotBaseSetting(i, bot_stance)) {
auto e = BotSettingsRepository::BotSettings{ auto e = BotSettingsRepository::BotSettings{
.char_id = charID, .char_id = char_id,
.bot_id = botID, .bot_id = bot_id,
.stance = stanceID, .stance = stance_id,
.setting_id = static_cast<uint16_t>(i), .setting_id = static_cast<uint16_t>(i),
.setting_type = static_cast<uint8_t>(BotSettingCategories::BaseSetting), .setting_type = static_cast<uint8_t>(BotSettingCategories::BaseSetting),
.value = static_cast<int32_t>(m->CastToBot()->GetBotBaseSetting(i)), .value = static_cast<int32_t>(m->CastToBot()->GetBotBaseSetting(i)),
@@ -2319,11 +2319,11 @@ bool BotDatabase::SaveBotSettings(Mob* m)
for (uint16 i = BotSettingCategories::START_NO_BASE; i <= BotSettingCategories::END; ++i) { for (uint16 i = BotSettingCategories::START_NO_BASE; i <= BotSettingCategories::END; ++i) {
for (uint16 x = BotSpellTypes::START; x <= BotSpellTypes::END; ++x) { for (uint16 x = BotSpellTypes::START; x <= BotSpellTypes::END; ++x) {
if (m->CastToBot()->GetSetting(i, x) != m->CastToBot()->GetDefaultSetting(i, x, botStance)) { if (m->CastToBot()->GetSetting(i, x) != m->CastToBot()->GetDefaultSetting(i, x, bot_stance)) {
auto e = BotSettingsRepository::BotSettings{ auto e = BotSettingsRepository::BotSettings{
.char_id = charID, .char_id = char_id,
.bot_id = botID, .bot_id = bot_id,
.stance = stanceID, .stance = stance_id,
.setting_id = static_cast<uint16_t>(x), .setting_id = static_cast<uint16_t>(x),
.setting_type = static_cast<uint8_t>(i), .setting_type = static_cast<uint8_t>(i),
.value = m->CastToBot()->GetSetting(i, x), .value = m->CastToBot()->GetSetting(i, x),
@@ -2333,7 +2333,7 @@ bool BotDatabase::SaveBotSettings(Mob* m)
v.emplace_back(e); v.emplace_back(e);
LogBotSettings("{} says, 'Saving {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->GetSpellTypeNameByID(x), x, e.value, m->CastToBot()->GetDefaultSetting(i, x, botStance)); LogBotSettings("{} says, 'Saving {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->GetSpellTypeNameByID(x), x, e.value, m->CastToBot()->GetDefaultSetting(i, x, bot_stance));
} }
} }
} }
@@ -2342,9 +2342,9 @@ bool BotDatabase::SaveBotSettings(Mob* m)
if (m->IsClient()) { if (m->IsClient()) {
if (m->CastToClient()->GetDefaultBotSettings(BotSettingCategories::BaseSetting, BotBaseSettings::IllusionBlock) != m->GetIllusionBlock()) { // Only illusion block supported if (m->CastToClient()->GetDefaultBotSettings(BotSettingCategories::BaseSetting, BotBaseSettings::IllusionBlock) != m->GetIllusionBlock()) { // Only illusion block supported
auto e = BotSettingsRepository::BotSettings{ auto e = BotSettingsRepository::BotSettings{
.char_id = charID, .char_id = char_id,
.bot_id = botID, .bot_id = bot_id,
.stance = stanceID, .stance = stance_id,
.setting_id = static_cast<uint16_t>(BotBaseSettings::IllusionBlock), .setting_id = static_cast<uint16_t>(BotBaseSettings::IllusionBlock),
.setting_type = static_cast<uint8_t>(BotSettingCategories::BaseSetting), .setting_type = static_cast<uint8_t>(BotSettingCategories::BaseSetting),
.value = m->GetIllusionBlock(), .value = m->GetIllusionBlock(),
@@ -2362,9 +2362,9 @@ bool BotDatabase::SaveBotSettings(Mob* m)
LogBotSettings("{} says, 'Checking {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->CastToBot()->GetSpellTypeNameByID(x), x, m->CastToClient()->GetBotSetting(i, x), m->CastToClient()->GetDefaultBotSettings(i, x)); LogBotSettings("{} says, 'Checking {} {} [{}] - set to [{}] default [{}].'", m->GetCleanName(), m->GetBotSpellCategoryName(i), m->CastToBot()->GetSpellTypeNameByID(x), x, m->CastToClient()->GetBotSetting(i, x), m->CastToClient()->GetDefaultBotSettings(i, x));
if (m->CastToClient()->GetBotSetting(i, x) != m->CastToClient()->GetDefaultBotSettings(i, x)) { if (m->CastToClient()->GetBotSetting(i, x) != m->CastToClient()->GetDefaultBotSettings(i, x)) {
auto e = BotSettingsRepository::BotSettings{ auto e = BotSettingsRepository::BotSettings{
.char_id = charID, .char_id = char_id,
.bot_id = botID, .bot_id = bot_id,
.stance = stanceID, .stance = stance_id,
.setting_id = static_cast<uint16_t>(x), .setting_id = static_cast<uint16_t>(x),
.setting_type = static_cast<uint8_t>(i), .setting_type = static_cast<uint8_t>(i),
.value = m->CastToClient()->GetBotSetting(i, x), .value = m->CastToClient()->GetBotSetting(i, x),
+599 -596
View File
File diff suppressed because it is too large Load Diff
+70 -74
View File
@@ -13089,50 +13089,50 @@ void Client::LoadDefaultBotSettings() {
} }
} }
int Client::GetDefaultBotSettings(uint8 settingType, uint16 botSetting) { int Client::GetDefaultBotSettings(uint8 setting_type, uint16 bot_setting) {
switch (settingType) { switch (setting_type) {
case BotSettingCategories::BaseSetting: case BotSettingCategories::BaseSetting:
return false; return false;
case BotSettingCategories::SpellHold: case BotSettingCategories::SpellHold:
return GetDefaultSpellHold(botSetting); return GetDefaultSpellHold(bot_setting);
case BotSettingCategories::SpellDelay: case BotSettingCategories::SpellDelay:
return GetDefaultSpellDelay(botSetting); return GetDefaultSpellDelay(bot_setting);
case BotSettingCategories::SpellMinThreshold: case BotSettingCategories::SpellMinThreshold:
return GetDefaultSpellMinThreshold(botSetting); return GetDefaultSpellMinThreshold(bot_setting);
case BotSettingCategories::SpellMaxThreshold: case BotSettingCategories::SpellMaxThreshold:
return GetDefaultSpellMaxThreshold(botSetting); return GetDefaultSpellMaxThreshold(bot_setting);
} }
} }
int Client::GetBotSetting(uint8 settingType, uint16 botSetting) { int Client::GetBotSetting(uint8 setting_type, uint16 bot_setting) {
switch (settingType) { switch (setting_type) {
case BotSettingCategories::SpellHold: case BotSettingCategories::SpellHold:
return GetSpellHold(botSetting); return GetSpellHold(bot_setting);
case BotSettingCategories::SpellDelay: case BotSettingCategories::SpellDelay:
return GetSpellDelay(botSetting); return GetSpellDelay(bot_setting);
case BotSettingCategories::SpellMinThreshold: case BotSettingCategories::SpellMinThreshold:
return GetSpellMinThreshold(botSetting); return GetSpellMinThreshold(bot_setting);
case BotSettingCategories::SpellMaxThreshold: case BotSettingCategories::SpellMaxThreshold:
return GetSpellMaxThreshold(botSetting); return GetSpellMaxThreshold(bot_setting);
} }
} }
void Client::SetBotSetting(uint8 settingType, uint16 botSetting, uint32 settingValue) { void Client::SetBotSetting(uint8 setting_type, uint16 bot_setting, uint32 setting_value) {
switch (settingType) { switch (setting_type) {
case BotSettingCategories::BaseSetting: case BotSettingCategories::BaseSetting:
SetBaseSetting(botSetting, settingValue); SetBaseSetting(bot_setting, setting_value);
break; break;
case BotSettingCategories::SpellHold: case BotSettingCategories::SpellHold:
SetSpellHold(botSetting, settingValue); SetSpellHold(bot_setting, setting_value);
break; break;
case BotSettingCategories::SpellDelay: case BotSettingCategories::SpellDelay:
SetSpellDelay(botSetting, settingValue); SetSpellDelay(bot_setting, setting_value);
break; break;
case BotSettingCategories::SpellMinThreshold: case BotSettingCategories::SpellMinThreshold:
SetSpellMinThreshold(botSetting, settingValue); SetSpellMinThreshold(bot_setting, setting_value);
break; break;
case BotSettingCategories::SpellMaxThreshold: case BotSettingCategories::SpellMaxThreshold:
SetSpellMaxThreshold(botSetting, settingValue); SetSpellMaxThreshold(bot_setting, setting_value);
break; break;
} }
} }
@@ -13148,9 +13148,9 @@ std::string Client::SendCommandHelpWindow(
std::vector<std::string> options_one, std::vector<std::string> options_two, std::vector<std::string> options_three std::vector<std::string> options_one, std::vector<std::string> options_two, std::vector<std::string> options_three
) { ) {
unsigned stringLength = 0; unsigned string_length = 0;
unsigned currentPlace = 0; unsigned current_place = 0;
uint16 maxLength = RuleI(Command, MaxHelpLineLength); //character length of a line before splitting in to multiple lines uint16 max_length = RuleI(Command, MaxHelpLineLength); //character length of a line before splitting in to multiple lines
const std::string& description_color = RuleS(Command, DescriptionColor); const std::string& description_color = RuleS(Command, DescriptionColor);
const std::string& description_header_color = RuleS(Command, DescriptionHeaderColor); const std::string& description_header_color = RuleS(Command, DescriptionHeaderColor);
const std::string& alt_description_color = RuleS(Command, AltDescriptionColor); const std::string& alt_description_color = RuleS(Command, AltDescriptionColor);
@@ -13177,78 +13177,74 @@ std::string Client::SendCommandHelpWindow(
std::string fillerLine = "--------------------------------------------------------------------"; std::string filler_line = "--------------------------------------------------------------------";
std::string fillerDia = DialogueWindow::TableRow(DialogueWindow::TableCell(fmt::format("{}", DialogueWindow::ColorMessage(filler_line_color, fillerLine)))); std::string filler_dia = DialogueWindow::TableRow(DialogueWindow::TableCell(fmt::format("{}", DialogueWindow::ColorMessage(filler_line_color, filler_line))));
std::string breakLine = DialogueWindow::Break(); std::string break_line = DialogueWindow::Break();
std::string indent = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; std::string indent = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
std::string bullet = "- "; std::string bullet = "- ";
std::string popup_text = ""; std::string popup_text = "";
/* /*
maxLength is how long you want lines to be before splitting them. This will look for the last space before the count and split there so words are not split mid sentence max_length is how long you want lines to be before splitting them. This will look for the last space before the count and split there so words are not split mid sentence
Any SplitCommandHelpText can be be have the first string from a vector differ in color from the next strings by setting secondColor to true and assigning a color. Any SplitCommandHelpText can have the first string from a vector differ in color from the next strings by setting an alternate color for that type in the rule.
ex: SplitCommandHelpText(examples_one, example_color, maxLength, true, alt_example_color)
- This will make the first string from examples_one vector be the color of example_color and all following strings the color of alt_example_color
ex: SplitCommandHelpText(examples_one, example_color, maxLength)
- This will apply the color example_color to everything in examples_one vector
*/ */
if (!description.empty()) { if (!description.empty()) {
popup_text += GetCommandHelpHeader(description_header_color, "[Description]"); popup_text += GetCommandHelpHeader(description_header_color, "[Description]");
popup_text += SplitCommandHelpText(description, description_color, maxLength, true, alt_description_color); popup_text += SplitCommandHelpText(description, description_color, max_length, !alt_description_color.empty(), alt_description_color);
} }
if (!notes.empty()) { if (!notes.empty()) {
popup_text += breakLine; popup_text += break_line;
popup_text += breakLine; popup_text += break_line;
popup_text += GetCommandHelpHeader(note_header_color, "[Notes]"); popup_text += GetCommandHelpHeader(note_header_color, "[Notes]");
popup_text += SplitCommandHelpText(notes, note_color, maxLength, true, alt_note_color); popup_text += SplitCommandHelpText(notes, note_color, max_length, !alt_note_color.empty(), alt_note_color);
} }
if (!example_format.empty()) { if (!example_format.empty()) {
popup_text += fillerDia; popup_text += filler_dia;
popup_text += GetCommandHelpHeader(example_header_color, "[Examples]"); popup_text += GetCommandHelpHeader(example_header_color, "[Examples]");
popup_text += SplitCommandHelpText(example_format, example_color, maxLength, true, alt_example_color); popup_text += SplitCommandHelpText(example_format, example_color, max_length, !alt_example_color.empty(), alt_example_color);
} }
if (!examples_one.empty()) { if (!examples_one.empty()) {
popup_text += breakLine; popup_text += break_line;
popup_text += breakLine; popup_text += break_line;
popup_text += SplitCommandHelpText(examples_one, sub_example_color, maxLength, true, sub_alt_example_color); popup_text += SplitCommandHelpText(examples_one, sub_example_color, max_length, !sub_alt_example_color.empty(), sub_alt_example_color);
} }
if (!examples_two.empty()) { if (!examples_two.empty()) {
popup_text += SplitCommandHelpText(examples_two, sub_example_color, maxLength, true, sub_alt_example_color); popup_text += SplitCommandHelpText(examples_two, sub_example_color, max_length, !sub_alt_example_color.empty(), sub_alt_example_color);
} }
if (!examples_three.empty()) { if (!examples_three.empty()) {
popup_text += SplitCommandHelpText(examples_three, sub_example_color, maxLength, true, sub_alt_example_color); popup_text += SplitCommandHelpText(examples_three, sub_example_color, max_length, !sub_alt_example_color.empty(), sub_alt_example_color);
} }
if (!options.empty()) { if (!options.empty()) {
popup_text += fillerDia; popup_text += filler_dia;
popup_text += GetCommandHelpHeader(option_header_color, "[Options]"); popup_text += GetCommandHelpHeader(option_header_color, "[Options]");
popup_text += SplitCommandHelpText(options, option_color, maxLength, true, alt_option_color); popup_text += SplitCommandHelpText(options, option_color, max_length, !alt_option_color.empty(), alt_option_color);
} }
if (!options_one.empty()) { if (!options_one.empty()) {
popup_text += breakLine; popup_text += break_line;
popup_text += breakLine; popup_text += break_line;
popup_text += SplitCommandHelpText(options_one, sub_option_color, maxLength, true, sub_alt_option_color); popup_text += SplitCommandHelpText(options_one, sub_option_color, max_length, !sub_alt_option_color.empty(), sub_alt_option_color);
} }
if (!options_two.empty()) { if (!options_two.empty()) {
popup_text += SplitCommandHelpText(options_two, sub_option_color, maxLength, true, sub_alt_option_color); popup_text += SplitCommandHelpText(options_two, sub_option_color, max_length, !sub_alt_option_color.empty(), sub_alt_option_color);
} }
if (!options_three.empty()) { if (!options_three.empty()) {
popup_text += SplitCommandHelpText(options_three, secondary_header_color, maxLength, true, sub_alt_option_color); popup_text += SplitCommandHelpText(options_three, secondary_header_color, max_length, !sub_alt_option_color.empty(), sub_alt_option_color);
} }
if (!actionables.empty()) { if (!actionables.empty()) {
popup_text += fillerDia; popup_text += filler_dia;
popup_text += GetCommandHelpHeader(actionable_header_color, "[Actionables]"); popup_text += GetCommandHelpHeader(actionable_header_color, "[Actionables]");
popup_text += SplitCommandHelpText(actionables, actionable_color, maxLength, true, alt_actionable_color); popup_text += SplitCommandHelpText(actionables, actionable_color, max_length, !alt_actionable_color.empty(), alt_actionable_color);
} }
popup_text = DialogueWindow::Table(popup_text); popup_text = DialogueWindow::Table(popup_text);
@@ -13257,7 +13253,7 @@ std::string Client::SendCommandHelpWindow(
} }
std::string Client::GetCommandHelpHeader(std::string color, std::string header) { std::string Client::GetCommandHelpHeader(std::string color, std::string header) {
std::string returnText = DialogueWindow::TableRow( std::string return_text = DialogueWindow::TableRow(
DialogueWindow::TableCell( DialogueWindow::TableCell(
fmt::format( fmt::format(
"{}", "{}",
@@ -13266,58 +13262,58 @@ std::string Client::GetCommandHelpHeader(std::string color, std::string header)
) )
); );
return returnText; return return_text;
} }
std::string Client::SplitCommandHelpText(std::vector<std::string> msg, std::string color, uint16 maxLength, bool secondColor, std::string secondaryColor) { std::string Client::SplitCommandHelpText(std::vector<std::string> msg, std::string color, uint16 max_length, bool second_color, std::string secondary_color) {
std::string returnText; std::string return_text;
for (int i = 0; i < msg.size(); i++) { for (int i = 0; i < msg.size(); i++) {
std::vector<std::string> msg_split; std::vector<std::string> msg_split;
int stringLength = msg[i].length() + 1; int string_length = msg[i].length() + 1;
int endCount = 0; int end_count = 0;
int newCount = 0; int new_count = 0;
int splitCount = 0; int split_count = 0;
for (int x = 0; x < stringLength; x = endCount) { for (int x = 0; x < string_length; x = end_count) {
endCount = std::min(int(stringLength), (int(x) + std::min(int(stringLength), int(maxLength)))); end_count = std::min(int(string_length), (int(x) + std::min(int(string_length), int(max_length))));
if ((stringLength - (x + 1)) > maxLength) { if ((string_length - (x + 1)) > max_length) {
for (int y = endCount; y >= x; --y) { for (int y = end_count; y >= x; --y) {
if (msg[i][y] == ' ') { if (msg[i][y] == ' ') {
splitCount = y - x; split_count = y - x;
msg_split.emplace_back(msg[i].substr(x, splitCount)); msg_split.emplace_back(msg[i].substr(x, split_count));
endCount = y + 1; end_count = y + 1;
break; break;
} }
if (y == x) { if (y == x) {
msg_split.emplace_back(msg[i].substr(x, maxLength)); msg_split.emplace_back(msg[i].substr(x, max_length));
break; break;
} }
} }
} }
else { else {
msg_split.emplace_back(msg[i].substr(x, (stringLength - 1) - x)); msg_split.emplace_back(msg[i].substr(x, (string_length - 1) - x));
break; break;
} }
} }
for (const auto& s : msg_split) { for (const auto& s : msg_split) {
returnText += DialogueWindow::TableRow( return_text += DialogueWindow::TableRow(
DialogueWindow::TableCell(DialogueWindow::ColorMessage(((secondColor && i == 0) ? color : secondaryColor), s)) DialogueWindow::TableCell(DialogueWindow::ColorMessage(((second_color && i == 0) ? color : secondary_color), s))
); );
} }
} }
return returnText; return return_text;
} }
void Client::SendSpellTypePrompts(bool commandedTypes, bool clientOnlyTypes) { void Client::SendSpellTypePrompts(bool commanded_types, bool client_only_types) {
if (clientOnlyTypes) { if (client_only_types) {
Message( Message(
Chat::Yellow, Chat::Yellow,
fmt::format( fmt::format(
@@ -13358,7 +13354,7 @@ void Client::SendSpellTypePrompts(bool commandedTypes, bool clientOnlyTypes) {
); );
} }
if (commandedTypes) { if (commanded_types) {
Message( Message(
Chat::Yellow, Chat::Yellow,
fmt::format( fmt::format(
+3 -3
View File
@@ -2239,9 +2239,9 @@ public:
void SpawnRaidBotsOnConnect(Raid* raid); void SpawnRaidBotsOnConnect(Raid* raid);
void LoadDefaultBotSettings(); void LoadDefaultBotSettings();
int GetDefaultBotSettings(uint8 settingType, uint16 botSetting); int GetDefaultBotSettings(uint8 setting_type, uint16 bot_setting);
int GetBotSetting(uint8 settingType, uint16 botSetting); int GetBotSetting(uint8 setting_type, uint16 bot_setting);
void SetBotSetting(uint8 settingType, uint16 botSetting, uint32 settingValue); void SetBotSetting(uint8 setting_type, uint16 bot_setting, uint32 setting_value);
private: private:
bool bot_owner_options[_booCount]; bool bot_owner_options[_booCount];