Logs::AI to LogAI

This commit is contained in:
Akkadius 2019-09-02 03:44:03 -05:00
parent b4339691f9
commit 44e3f28cb0
6 changed files with 38 additions and 53 deletions

View File

@ -2872,7 +2872,7 @@ void Bot::AI_Process() {
else { // To far away to fight (GetTarget() validity can be iffy below this point - including outer scopes) else { // To far away to fight (GetTarget() validity can be iffy below this point - including outer scopes)
if (AI_movement_timer->Check() && (!spellend_timer.Enabled() || GetClass() == BARD)) { // Pursue processing if (AI_movement_timer->Check() && (!spellend_timer.Enabled() || GetClass() == BARD)) { // Pursue processing
if (GetTarget() && !IsRooted()) { if (GetTarget() && !IsRooted()) {
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); LogAI("Pursuing [{}] while engaged", GetTarget()->GetCleanName());
Goal = GetTarget()->GetPosition(); Goal = GetTarget()->GetPosition();
@ -3177,7 +3177,7 @@ void Bot::PetAIProcess() {
else if (botPet->GetTarget() && botPet->GetAIMovementTimer()->Check()) { else if (botPet->GetTarget() && botPet->GetAIMovementTimer()->Check()) {
botPet->SetRunAnimSpeed(0); botPet->SetRunAnimSpeed(0);
if(!botPet->IsRooted()) { if(!botPet->IsRooted()) {
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", botPet->GetTarget()->GetCleanName()); LogAI("Pursuing [{}] while engaged", botPet->GetTarget()->GetCleanName());
botPet->RunTo(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ()); botPet->RunTo(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ());
return; return;
} else { } else {

View File

@ -1134,7 +1134,7 @@ bool Bot::AI_PursueCastCheck() {
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log(Logs::Detail, Logs::AI, "Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); LogAI("Bot Engaged (pursuing) autocast check triggered. Trying to cast offensive spells");
if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) { if(!AICastSpell(GetTarget(), 100, SpellType_Snare)) {
if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) { if(!AICastSpell(GetTarget(), 100, SpellType_Lifetap)) {
@ -1162,7 +1162,7 @@ bool Bot::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) { if (AIautocastspell_timer->Check(false)) {
#if BotAI_DEBUG_Spells >= 25 #if BotAI_DEBUG_Spells >= 25
Log(Logs::Detail, Logs::AI, "Bot Non-Engaged autocast check triggered: %s", this->GetCleanName()); LogAI("Bot Non-Engaged autocast check triggered: [{}]", this->GetCleanName());
#endif #endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
@ -1310,7 +1310,7 @@ bool Bot::AI_EngagedCastCheck() {
EQEmu::constants::StanceType botStance = GetBotStance(); EQEmu::constants::StanceType botStance = GetBotStance();
bool mayGetAggro = HasOrMayGetAggro(); bool mayGetAggro = HasOrMayGetAggro();
Log(Logs::Detail, Logs::AI, "Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells."); LogAI("Engaged autocast check triggered (BOTS). Trying to cast healing spells then maybe offensive spells");
if(botClass == CLERIC) { if(botClass == CLERIC) {
if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) { if(!AICastSpell(GetTarget(), GetChanceToCastBySpellType(SpellType_Escape), SpellType_Escape)) {
@ -1560,11 +1560,11 @@ bool Bot::AIHealRotation(Mob* tar, bool useFastHeals) {
} }
#if BotAI_DEBUG_Spells >= 10 #if BotAI_DEBUG_Spells >= 10
Log(Logs::Detail, Logs::AI, "Bot::AIHealRotation: heal spellid = %u, fastheals = %c, casterlevel = %u", LogAI("Bot::AIHealRotation: heal spellid = [{}], fastheals = [{}], casterlevel = [{}]",
botSpell.SpellId, ((useFastHeals) ? ('T') : ('F')), GetLevel()); botSpell.SpellId, ((useFastHeals) ? ('T') : ('F')), GetLevel());
#endif #endif
#if BotAI_DEBUG_Spells >= 25 #if BotAI_DEBUG_Spells >= 25
Log(Logs::Detail, Logs::AI, "Bot::AIHealRotation: target = %s, current_time = %u, donthealmebefore = %u", tar->GetCleanName(), Timer::GetCurrentTime(), tar->DontHealMeBefore()); LogAI("Bot::AIHealRotation: target = [{}], current_time = [{}], donthealmebefore = [{}]", tar->GetCleanName(), Timer::GetCurrentTime(), tar->DontHealMeBefore());
#endif #endif
// If there is still no spell id, then there isn't going to be one so we are done // If there is still no spell id, then there isn't going to be one so we are done

View File

@ -1688,7 +1688,7 @@ void Merc::AI_Process() {
if (AI_movement_timer->Check()) if (AI_movement_timer->Check())
{ {
if(!IsRooted()) { if(!IsRooted()) {
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", GetTarget()->GetCleanName()); LogAI("Pursuing [{}] while engaged", GetTarget()->GetCleanName());
RunTo(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ()); RunTo(GetTarget()->GetX(), GetTarget()->GetY(), GetTarget()->GetZ());
return; return;
} }
@ -1807,7 +1807,7 @@ bool Merc::AI_EngagedCastCheck() {
{ {
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log(Logs::Detail, Logs::AI, "Merc Engaged autocast check triggered"); LogAI("Merc Engaged autocast check triggered");
int8 mercClass = GetClass(); int8 mercClass = GetClass();
@ -1862,7 +1862,7 @@ bool Merc::AI_IdleCastCheck() {
if (AIautocastspell_timer->Check(false)) { if (AIautocastspell_timer->Check(false)) {
#if MercAI_DEBUG_Spells >= 25 #if MercAI_DEBUG_Spells >= 25
Log(Logs::Detail, Logs::AI, "Merc Non-Engaged autocast check triggered: %s", this->GetCleanName()); LogAI("Merc Non-Engaged autocast check triggered: [{}]", this->GetCleanName());
#endif #endif
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.

View File

@ -127,7 +127,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
) { ) {
#if MobAI_DEBUG_Spells >= 21 #if MobAI_DEBUG_Spells >= 21
Log(Logs::Detail, Logs::AI, "Mob::AICastSpell: Casting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u", LogAI("Mob::AICastSpell: Casting: spellid=[{}], tar=[{}], dist2[[{}]]<=[{}], mana_cost[[{}]]<=[{}], cancast[[{}]]<=[{}], type=[{}]",
AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type); AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type);
#endif #endif
@ -360,7 +360,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
} }
#if MobAI_DEBUG_Spells >= 21 #if MobAI_DEBUG_Spells >= 21
else { else {
Log(Logs::Detail, Logs::AI, "Mob::AICastSpell: NotCasting: spellid=%u, tar=%s, dist2[%f]<=%f, mana_cost[%i]<=%i, cancast[%u]<=%u, type=%u", LogAI("Mob::AICastSpell: NotCasting: spellid=[{}], tar=[{}], dist2[[{}]]<=[{}], mana_cost[[{}]]<=[{}], cancast[[{}]]<=[{}], type=[{}]",
AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type); AIspells[i].spellid, tar->GetName(), dist2, (spells[AIspells[i].spellid].range * spells[AIspells[i].spellid].range), mana_cost, GetMana(), AIspells[i].time_cancast, Timer::GetCurrentTime(), AIspells[i].type);
} }
#endif #endif
@ -371,7 +371,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint32 iSpellTypes, bool bInnates
bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore) { bool NPC::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgainBefore) {
#if MobAI_DEBUG_Spells >= 1 #if MobAI_DEBUG_Spells >= 1
Log(Logs::Detail, Logs::AI, "Mob::AIDoSpellCast: spellid = %u, tar = %s, mana = %i, Name: '%s'", AIspells[i].spellid, tar->GetName(), mana_cost, spells[AIspells[i].spellid].name); LogAI("Mob::AIDoSpellCast: spellid = [{}], tar = [{}], mana = [{}], Name: [{}]", AIspells[i].spellid, tar->GetName(), mana_cost, spells[AIspells[i].spellid].name);
#endif #endif
casting_spell_AIindex = i; casting_spell_AIindex = i;
@ -1356,7 +1356,7 @@ void Mob::AI_Process() {
} }
else if (AI_movement_timer->Check() && target) { else if (AI_movement_timer->Check() && target) {
if (!IsRooted()) { if (!IsRooted()) {
Log(Logs::Detail, Logs::AI, "Pursuing %s while engaged.", target->GetName()); LogAI("Pursuing [{}] while engaged", target->GetName());
RunTo(target->GetX(), target->GetY(), target->GetZ()); RunTo(target->GetX(), target->GetY(), target->GetZ());
} }
@ -1721,9 +1721,7 @@ void NPC::AI_DoMovement() {
else if (!(AI_walking_timer->Enabled())) { // currently moving else if (!(AI_walking_timer->Enabled())) { // currently moving
bool doMove = true; bool doMove = true;
if(IsPositionEqual(glm::vec2(m_CurrentWayPoint.x, m_CurrentWayPoint.y), glm::vec2(GetX(), GetY()))) { if(IsPositionEqual(glm::vec2(m_CurrentWayPoint.x, m_CurrentWayPoint.y), glm::vec2(GetX(), GetY()))) {
Log(Logs::Detail, LogAI("We have reached waypoint [{}] ({},{},{}) on grid [{}]",
Logs::AI,
"We have reached waypoint %d (%.3f,%.3f,%.3f) on grid %d",
cur_wp, cur_wp,
GetX(), GetX(),
GetY(), GetY(),
@ -1790,12 +1788,7 @@ void NPC::AI_DoMovement() {
if (at_gp) { if (at_gp) {
if (moved) { if (moved) {
Log(Logs::Detail, LogAI("Reached guard point ({},{},{})", m_GuardPoint.x, m_GuardPoint.y, m_GuardPoint.z);
Logs::AI,
"Reached guard point (%.3f,%.3f,%.3f)",
m_GuardPoint.x,
m_GuardPoint.y,
m_GuardPoint.z);
ClearFeignMemory(); ClearFeignMemory();
moved = false; moved = false;
@ -1983,7 +1976,7 @@ bool NPC::AI_EngagedCastCheck() {
if (AIautocastspell_timer->Check(false)) { if (AIautocastspell_timer->Check(false)) {
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log(Logs::Detail, Logs::AI, "Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells."); LogAI("Engaged autocast check triggered. Trying to cast healing spells then maybe offensive spells");
// first try innate (spam) spells // first try innate (spam) spells
if(!AICastSpell(GetTarget(), 0, SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root, true)) { if(!AICastSpell(GetTarget(), 0, SpellType_Nuke | SpellType_Lifetap | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff | SpellType_Charm | SpellType_Root, true)) {
@ -2012,7 +2005,7 @@ bool NPC::AI_PursueCastCheck() {
if (AIautocastspell_timer->Check(false)) { if (AIautocastspell_timer->Check(false)) {
AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting. AIautocastspell_timer->Disable(); //prevent the timer from going off AGAIN while we are casting.
Log(Logs::Detail, Logs::AI, "Engaged (pursuing) autocast check triggered. Trying to cast offensive spells."); LogAI("Engaged (pursuing) autocast check triggered. Trying to cast offensive spells");
// checking innate (spam) spells first // checking innate (spam) spells first
if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff, true)) { if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff, true)) {
if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) { if(!AICastSpell(GetTarget(), AISpellVar.pursue_detrimental_chance, SpellType_Root | SpellType_Nuke | SpellType_Lifetap | SpellType_Snare | SpellType_DOT | SpellType_Dispel | SpellType_Mez | SpellType_Slow | SpellType_Debuff)) {
@ -2507,21 +2500,21 @@ bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
else { else {
debug_msg.append(" (not found)"); debug_msg.append(" (not found)");
} }
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str()); LogAI("[{}]", debug_msg.c_str());
#ifdef MobAI_DEBUG_Spells >= 25 #ifdef MobAI_DEBUG_Spells >= 25
if (parentlist) { if (parentlist) {
for (const auto &iter : parentlist->entries) { for (const auto &iter : parentlist->entries) {
Log(Logs::Detail, Logs::AI, "(%i) %s", iter.spellid, spells[iter.spellid].name); LogAI("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
} }
} }
Log(Logs::Detail, Logs::AI, "fin (parent list)"); LogAI("fin (parent list)");
if (spell_list) { if (spell_list) {
for (const auto &iter : spell_list->entries) { for (const auto &iter : spell_list->entries) {
Log(Logs::Detail, Logs::AI, "(%i) %s", iter.spellid, spells[iter.spellid].name); LogAI("([{}]) [{}]", iter.spellid, spells[iter.spellid].name);
} }
} }
Log(Logs::Detail, Logs::AI, "fin (spell list)"); LogAI("fin (spell list)");
#endif #endif
#endif #endif
@ -2682,7 +2675,7 @@ bool NPC::AI_AddNPCSpellsEffects(uint32 iDBSpellsEffectsID) {
else { else {
debug_msg.append(" (not found)"); debug_msg.append(" (not found)");
} }
Log(Logs::Detail, Logs::AI, "%s", debug_msg.c_str()); LogAI("[{}]", debug_msg.c_str());
#endif #endif
if (parentlist) { if (parentlist) {

View File

@ -395,7 +395,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
} }
SaveSpellLoc(); SaveSpellLoc();
LogSpells("Casting [{}] Started at (%.3f,%.3f,%.3f)", spell_id, m_SpellLocation.x, m_SpellLocation.y, m_SpellLocation.z); LogSpells("Casting [{}] Started at ({},{},{})", spell_id, m_SpellLocation.x, m_SpellLocation.y, m_SpellLocation.z);
// if this spell doesn't require a target, or if it's an optional target // if this spell doesn't require a target, or if it's an optional target
// and a target wasn't provided, then it's us; unless TGB is on and this // and a target wasn't provided, then it's us; unless TGB is on and this
@ -3358,7 +3358,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite)
{ {
int i, ret, firstfree = -2; int i, ret, firstfree = -2;
Log(Logs::Detail, Logs::AI, "Checking if buff %d cast at level %d can stack on me.%s", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":""); LogAI("Checking if buff [{}] cast at level [{}] can stack on me.[{}]", spellid, caster_level, iFailIfOverwrite?" failing if we would overwrite something":"");
int buff_count = GetMaxTotalSlots(); int buff_count = GetMaxTotalSlots();
for (i=0; i < buff_count; i++) for (i=0; i < buff_count; i++)
@ -3382,7 +3382,7 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite)
if(ret == 1) { if(ret == 1) {
// should overwrite current slot // should overwrite current slot
if(iFailIfOverwrite) { if(iFailIfOverwrite) {
Log(Logs::Detail, Logs::AI, "Buff %d would overwrite %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); LogAI("Buff [{}] would overwrite [{}] in slot [{}], reporting stack failure", spellid, curbuf.spellid, i);
return(-1); return(-1);
} }
if(firstfree == -2) if(firstfree == -2)
@ -3390,12 +3390,12 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite)
} }
if(ret == -1) { if(ret == -1) {
Log(Logs::Detail, Logs::AI, "Buff %d would conflict with %d in slot %d, reporting stack failure", spellid, curbuf.spellid, i); LogAI("Buff [{}] would conflict with [{}] in slot [{}], reporting stack failure", spellid, curbuf.spellid, i);
return -1; // stop the spell, can't stack it return -1; // stop the spell, can't stack it
} }
} }
Log(Logs::Detail, Logs::AI, "Reporting that buff %d could successfully be placed into slot %d", spellid, firstfree); LogAI("Reporting that buff [{}] could successfully be placed into slot [{}]", spellid, firstfree);
return firstfree; return firstfree;
} }

View File

@ -179,19 +179,14 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
if (IsNPC() && GetGrid() != 0) { // he is on a grid if (IsNPC() && GetGrid() != 0) { // he is on a grid
if (GetGrid() < 0) { // currently stopped by a quest command if (GetGrid() < 0) { // currently stopped by a quest command
SetGrid(0 - GetGrid()); // get him moving again SetGrid(0 - GetGrid()); // get him moving again
Log(Logs::Detail, LogAI("MoveTo during quest wandering. Canceling quest wandering and going back to grid [{}] when MoveTo is done", GetGrid());
Logs::AI,
"MoveTo during quest wandering. Canceling quest wandering and going back to grid %d when MoveTo is done.",
GetGrid());
} }
AI_walking_timer->Disable(); // disable timer in case he is paused at a wp AI_walking_timer->Disable(); // disable timer in case he is paused at a wp
if (cur_wp >= 0) { // we've not already done a MoveTo() if (cur_wp >= 0) { // we've not already done a MoveTo()
save_wp = cur_wp; // save the current waypoint save_wp = cur_wp; // save the current waypoint
cur_wp = EQEmu::WaypointStatus::QuestControlGrid; cur_wp = EQEmu::WaypointStatus::QuestControlGrid;
} }
Log(Logs::Detail, LogAI("MoveTo [{}], pausing regular grid wandering. Grid [{}], save_wp [{}]",
Logs::AI,
"MoveTo %s, pausing regular grid wandering. Grid %d, save_wp %d",
to_string(static_cast<glm::vec3>(position)).c_str(), to_string(static_cast<glm::vec3>(position)).c_str(),
-GetGrid(), -GetGrid(),
save_wp); save_wp);
@ -200,7 +195,7 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
roamer = true; roamer = true;
save_wp = 0; save_wp = 0;
cur_wp = EQEmu::WaypointStatus::QuestControlNoGrid; cur_wp = EQEmu::WaypointStatus::QuestControlNoGrid;
Log(Logs::Detail, Logs::AI, "MoveTo %s without a grid.", to_string(static_cast<glm::vec3>(position)).c_str()); LogAI("MoveTo [{}] without a grid", to_string(static_cast<glm::vec3>(position)).c_str());
} }
glm::vec3 dest(position); glm::vec3 dest(position);
@ -218,10 +213,7 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
if (m_GuardPoint.w == -1) if (m_GuardPoint.w == -1)
m_GuardPoint.w = this->CalculateHeadingToTarget(position.x, position.y); m_GuardPoint.w = this->CalculateHeadingToTarget(position.x, position.y);
Log(Logs::Detail, LogAI("Setting guard position to [{}]", to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
Logs::AI,
"Setting guard position to %s",
to_string(static_cast<glm::vec3>(m_GuardPoint)).c_str());
} }
cur_wp_pause = 0; cur_wp_pause = 0;
@ -234,7 +226,7 @@ void NPC::MoveTo(const glm::vec4 &position, bool saveguardspot)
void NPC::UpdateWaypoint(int wp_index) void NPC::UpdateWaypoint(int wp_index)
{ {
if (wp_index >= static_cast<int>(Waypoints.size())) { if (wp_index >= static_cast<int>(Waypoints.size())) {
Log(Logs::Detail, Logs::AI, "Update to waypoint %d failed. Not found.", wp_index); LogAI("Update to waypoint [{}] failed. Not found", wp_index);
return; return;
} }
std::vector<wplist>::iterator cur; std::vector<wplist>::iterator cur;
@ -243,7 +235,7 @@ void NPC::UpdateWaypoint(int wp_index)
m_CurrentWayPoint = glm::vec4(cur->x, cur->y, cur->z, cur->heading); m_CurrentWayPoint = glm::vec4(cur->x, cur->y, cur->z, cur->heading);
cur_wp_pause = cur->pause; cur_wp_pause = cur->pause;
Log(Logs::Detail, Logs::AI, "Next waypoint %d: (%.3f, %.3f, %.3f, %.3f)", wp_index, m_CurrentWayPoint.x, m_CurrentWayPoint.y, m_CurrentWayPoint.z, m_CurrentWayPoint.w); LogAI("Next waypoint [{}]: ({}, {}, {}, {})", wp_index, m_CurrentWayPoint.x, m_CurrentWayPoint.y, m_CurrentWayPoint.z, m_CurrentWayPoint.w);
} }
@ -431,7 +423,7 @@ void NPC::SaveGuardSpot(const glm::vec4 &pos)
if (m_GuardPoint.w == 0) if (m_GuardPoint.w == 0)
m_GuardPoint.w = 0.0001; //hack to make IsGuarding simpler m_GuardPoint.w = 0.0001; //hack to make IsGuarding simpler
LogF(Logs::Detail, Logs::AI, "Setting guard position to {0}", to_string(static_cast<glm::vec3>(m_GuardPoint))); LogAI("Setting guard position to {0}", to_string(static_cast<glm::vec3>(m_GuardPoint)));
} }
void NPC::NextGuardPosition() { void NPC::NextGuardPosition() {
@ -565,7 +557,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) {
m_Position.x = new_x; m_Position.x = new_x;
m_Position.y = new_y; m_Position.y = new_y;
m_Position.z = new_z; m_Position.z = new_z;
Log(Logs::Detail, Logs::AI, "Sent To (%.3f, %.3f, %.3f)", new_x, new_y, new_z); LogAI("Sent To ({}, {}, {})", new_x, new_y, new_z);
if (flymode == GravityBehavior::Flying) if (flymode == GravityBehavior::Flying)
return; return;
@ -581,7 +573,7 @@ void Mob::SendTo(float new_x, float new_y, float new_z) {
float newz = zone->zonemap->FindBestZ(dest, nullptr); float newz = zone->zonemap->FindBestZ(dest, nullptr);
Log(Logs::Detail, Logs::AI, "BestZ returned %4.3f at %4.3f, %4.3f, %4.3f", newz, m_Position.x, m_Position.y, m_Position.z); LogAI("BestZ returned {} at {}, {}, {}", newz, m_Position.x, m_Position.y, m_Position.z);
if ((newz > -2000) && std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check. if ((newz > -2000) && std::abs(newz - dest.z) < RuleR(Map, FixPathingZMaxDeltaSendTo)) // Sanity check.
m_Position.z = newz + 1; m_Position.z = newz + 1;