Skip to content

Commit

Permalink
Additional debug for boss detection
Browse files Browse the repository at this point in the history
  • Loading branch information
kjack9 committed Oct 8, 2023
1 parent e636e36 commit 070cdcd
Showing 1 changed file with 45 additions and 21 deletions.
66 changes: 45 additions & 21 deletions src/AutoBalance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ uint32 getBaseExpansionValueForLevel(const uint32 baseValues[3], uint8 targetLev
return getBaseExpansionValueForLevel(floatBaseValues, targetLevel);
}

bool isBossOrBossSummon(Creature* creature)
bool isBossOrBossSummon(Creature* creature, bool log = false)
{
// no creature? not a boss
if (!creature)
Expand All @@ -826,9 +826,19 @@ bool isBossOrBossSummon(Creature* creature)
// if this creature is a boss, return true
if (creature->IsDungeonBoss() || creature->isWorldBoss())
{
if (log)
{
LOG_DEBUG("module.AutoBalance", "AutoBalance::isBossOrBossSummon: {} ({}{}) is a BOSS.",
creature->GetName(),
creature->GetEntry(),
creature->GetInstanceId() ? "-" + std::to_string(creature->GetInstanceId()) : ""
);
}

return true;
}


// if this creature is a summon of a boss, return true
if (
creature->IsSummon() &&
Expand All @@ -843,32 +853,43 @@ bool isBossOrBossSummon(Creature* creature)
{
if (summoner->IsDungeonBoss() || summoner->isWorldBoss())
{
// LOG_DEBUG("module.AutoBalance", "AutoBalance::isBossOrBossSummon: {} ({}{}) is a summon of BOSS {}({}{})",
// creature->GetName(),
// creature->GetEntry(),
// creature->GetInstanceId() ? "-" + std::to_string(creature->GetInstanceId()) : "",
// summoner->GetName(),
// summoner->GetEntry(),
// summoner->GetInstanceId() ? "-" + std::to_string(summoner->GetInstanceId()) : ""
// );
if (log)
{
LOG_DEBUG("module.AutoBalance", "AutoBalance::isBossOrBossSummon: {} ({}) is a summon of BOSS {}({}).",
creature->GetName(),
creature->GetEntry(),
summoner->GetName(),
summoner->GetEntry()
);
}

return true;
}
else
{
// LOG_DEBUG("module.AutoBalance", "AutoBalance::isBossOrBossSummon: {} ({}{}) is a summon of NON-BOSS {}({}{})",
// creature->GetName(),
// creature->GetEntry(),
// creature->GetInstanceId() ? "-" + std::to_string(creature->GetInstanceId()) : "",
// summoner->GetName(),
// summoner->GetEntry(),
// summoner->GetInstanceId() ? "-" + std::to_string(summoner->GetInstanceId()) : ""
// );
if (log)
{
LOG_DEBUG("module.AutoBalance", "AutoBalance::isBossOrBossSummon: {} ({}) is a summon of NON-BOSS {}({}).",
creature->GetName(),
creature->GetEntry(),
summoner->GetName(),
summoner->GetEntry()
);
}
return false;
}
}
}

// not a boss
if (log)
{
LOG_DEBUG("module.AutoBalance", "AutoBalance::isBossOrBossSummon: {} ({}) is NOT a BOSS.",
creature->GetName(),
creature->GetEntry()
);
}

return false;
}

Expand Down Expand Up @@ -4210,7 +4231,7 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript
if (creatureMap && creatureMap->IsDungeon())
{
LOG_DEBUG("module.AutoBalance", "AutoBalance:: {}", SPACER);
LOG_DEBUG("module.AutoBalance", "AutoBalance_AllCreatureScript::OnBeforeCreatureSelectLevel: Creature {} ({}) | Entry ID: {} | Spawn ID: {}",
LOG_DEBUG("module.AutoBalance", "AutoBalance_AllCreatureScript::OnBeforeCreatureSelectLevel: Creature {} ({}) | Entry ID: ({}) | Spawn ID: ({})",
creature->GetName(),
level,
creature->GetEntry(),
Expand Down Expand Up @@ -4325,7 +4346,7 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript
{
LOG_DEBUG("module.AutoBalance", "AutoBalance:: {}", SPACER);

LOG_DEBUG("module.AutoBalance", "AutoBalance_AllCreatureScript::OnCreatureRemoveWorld: Creature {} ({}) | Entry ID: {} | Spawn ID: {}",
LOG_DEBUG("module.AutoBalance", "AutoBalance_AllCreatureScript::OnCreatureRemoveWorld: Creature {} ({}) | Entry ID: ({}) | Spawn ID: ({})",
creature->GetName(),
creature->GetLevel(),
creature->GetEntry(),
Expand Down Expand Up @@ -4376,7 +4397,7 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript
{
LOG_DEBUG("module.AutoBalance", "AutoBalance:: {}", SPACER);

LOG_DEBUG("module.AutoBalance", "AutoBalance_AllCreatureScript::OnAllCreatureUpdate: Creature {} ({}) | Entry ID: {} | Spawn ID: {}",
LOG_DEBUG("module.AutoBalance", "AutoBalance_AllCreatureScript::OnAllCreatureUpdate: Creature {} ({}) | Entry ID: ({}) | Spawn ID: ({})",
creature->GetName(),
creature->GetLevel(),
creature->GetEntry(),
Expand Down Expand Up @@ -4445,7 +4466,7 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript
{
LOG_DEBUG("module.AutoBalance", "AutoBalance:: {}", SPACER);

LOG_DEBUG("module.AutoBalance", "AutoBalance_AllCreatureScript::ResetCreatureIfNeeded: Creature {} ({}) | Entry ID: {} | Spawn ID: {}",
LOG_DEBUG("module.AutoBalance", "AutoBalance_AllCreatureScript::ResetCreatureIfNeeded: Creature {} ({}) | Entry ID: ({}) | Spawn ID: ({})",
creature->GetName(),
creature->GetLevel(),
creature->GetEntry(),
Expand Down Expand Up @@ -4775,6 +4796,9 @@ class AutoBalance_AllCreatureScript : public AllCreatureScript
if (!sABScriptMgr->OnAfterDefaultMultiplier(creature, defaultMultiplier))
return;

// Debug for boss detection
isBossOrBossSummon(creature, true);

// Stat Modifiers
AutoBalanceStatModifiers statModifiers = getStatModifiers(map, creature);
float statMod_global = statModifiers.global;
Expand Down

0 comments on commit 070cdcd

Please sign in to comment.