mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
chore(Core/Logging): replace most server loggers (#5726)
* chore(Core/Logging): replace most server loggers Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -509,25 +509,25 @@ void SpellCastTargets::Update(Unit* caster)
|
||||
void SpellCastTargets::OutDebug() const
|
||||
{
|
||||
if (!m_targetMask)
|
||||
LOG_INFO("server", "No targets");
|
||||
LOG_INFO("spells", "No targets");
|
||||
|
||||
LOG_INFO("server", "target mask: %u", m_targetMask);
|
||||
LOG_INFO("spells", "target mask: %u", m_targetMask);
|
||||
if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK))
|
||||
LOG_INFO("server", "Object target: %s", m_objectTargetGUID.ToString().c_str());
|
||||
LOG_INFO("spells", "Object target: %s", m_objectTargetGUID.ToString().c_str());
|
||||
if (m_targetMask & TARGET_FLAG_ITEM)
|
||||
LOG_INFO("server", "Item target: %s", m_itemTargetGUID.ToString().c_str());
|
||||
LOG_INFO("spells", "Item target: %s", m_itemTargetGUID.ToString().c_str());
|
||||
if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
|
||||
LOG_INFO("server", "Trade item target: %s", m_itemTargetGUID.ToString().c_str());
|
||||
LOG_INFO("spells", "Trade item target: %s", m_itemTargetGUID.ToString().c_str());
|
||||
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
|
||||
LOG_INFO("server", "Source location: transport guid: %s trans offset: %s position: %s",
|
||||
LOG_INFO("spells", "Source location: transport guid: %s trans offset: %s position: %s",
|
||||
m_src._transportGUID.ToString().c_str(), m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
|
||||
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
|
||||
LOG_INFO("server", "Destination location: transport guid: %s trans offset: %s position: %s",
|
||||
LOG_INFO("spells", "Destination location: transport guid: %s trans offset: %s position: %s",
|
||||
m_dst._transportGUID.ToString().c_str(), m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
|
||||
if (m_targetMask & TARGET_FLAG_STRING)
|
||||
LOG_INFO("server", "String: %s", m_strTarget.c_str());
|
||||
LOG_INFO("server", "speed: %f", m_speed);
|
||||
LOG_INFO("server", "elevation: %f", m_elevation);
|
||||
LOG_INFO("spells", "String: %s", m_strTarget.c_str());
|
||||
LOG_INFO("spells", "speed: %f", m_speed);
|
||||
LOG_INFO("spells", "elevation: %f", m_elevation);
|
||||
}
|
||||
|
||||
SpellValue::SpellValue(SpellInfo const* proto)
|
||||
@@ -675,7 +675,7 @@ Spell::~Spell()
|
||||
{
|
||||
// Clean the reference to avoid later crash.
|
||||
// If this error is repeating, we may have to add an ASSERT to better track down how we get into this case.
|
||||
LOG_ERROR("server", "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id);
|
||||
LOG_ERROR("spells", "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id);
|
||||
*m_selfContainer = nullptr;
|
||||
}
|
||||
|
||||
@@ -979,9 +979,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
|
||||
}
|
||||
break;
|
||||
case TARGET_SELECT_CATEGORY_NYI:
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "SPELL: target type %u, found in spellID %u, effect %u is not implemented yet!", m_spellInfo->Id, effIndex, targetType.GetTarget());
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target category");
|
||||
@@ -1012,9 +1010,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1034,9 +1030,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa
|
||||
}
|
||||
else //if (!m_targets.HasDst())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case TARGET_DEST_CHANNEL_CASTER:
|
||||
@@ -1083,9 +1077,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
|
||||
// handle emergency case - try to use other provided targets if no conditions provided
|
||||
if (targetType.GetCheckType() == TARGET_CHECK_ENTRY && (!condList || condList->empty()))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell::SelectImplicitNearbyTargets: no conditions entry for target with TARGET_CHECK_ENTRY of spell ID %u, effect %u - selecting default targets", m_spellInfo->Id, effIndex);
|
||||
#endif
|
||||
switch (targetType.GetObjectType())
|
||||
{
|
||||
case TARGET_OBJECT_TYPE_GOBJ:
|
||||
@@ -1112,9 +1104,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
|
||||
WorldObject* target = SearchNearbyTarget(range, targetType.GetObjectType(), targetType.GetCheckType(), condList);
|
||||
if (!target)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell::SelectImplicitNearbyTargets: cannot find nearby target for spell ID %u, effect %u", m_spellInfo->Id, effIndex);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1317,9 +1307,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id);
|
||||
#endif
|
||||
if (WorldObject* target = m_targets.GetObjectTarget())
|
||||
dest = SpellDestination(*target);
|
||||
}
|
||||
@@ -1637,7 +1625,8 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d);
|
||||
if (a > -0.0001f)
|
||||
a = 0;
|
||||
DEBUG_TRAJ(LOG_ERROR("server", "Spell::SelectTrajTargets: a %f b %f", a, b);)
|
||||
|
||||
LOG_ERROR("spells", "Spell::SelectTrajTargets: a %f b %f", a, b);
|
||||
|
||||
// Xinef: hack for distance, many trajectory spells have RangeEntry 1 (self)
|
||||
float bestDist = m_spellInfo->GetMaxRange(false) * 2;
|
||||
@@ -1656,11 +1645,14 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
const float objDist2d = fabs(m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr)));
|
||||
const float dz = fabs((*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ);
|
||||
|
||||
DEBUG_TRAJ(LOG_ERROR("server", "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);)
|
||||
LOG_ERROR("spells", "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.",
|
||||
(*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);
|
||||
|
||||
float dist = objDist2d - size;
|
||||
float height = dist * (a * dist + b);
|
||||
DEBUG_TRAJ(LOG_ERROR("server", "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)
|
||||
|
||||
LOG_ERROR("spells", "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);
|
||||
|
||||
if (dist < bestDist && height < dz + size && height > dz - size)
|
||||
{
|
||||
bestDist = dist > 0 ? dist : 0;
|
||||
@@ -1668,7 +1660,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
}
|
||||
|
||||
#define CHECK_DIST {\
|
||||
DEBUG_TRAJ(LOG_ERROR("server", "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\
|
||||
LOG_ERROR("spells", "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);\
|
||||
if (dist > bestDist)\
|
||||
continue;\
|
||||
if (dist < objDist2d + size && dist > objDist2d - size)\
|
||||
@@ -1744,7 +1736,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
float distSq = (*itr)->GetExactDistSq(x, y, z);
|
||||
float sizeSq = (*itr)->GetObjectSize();
|
||||
sizeSq *= sizeSq;
|
||||
DEBUG_TRAJ(LOG_ERROR("server", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
|
||||
LOG_ERROR("spells", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);
|
||||
if (distSq > sizeSq)
|
||||
{
|
||||
float factor = 1 - sqrt(sizeSq / distSq);
|
||||
@@ -1753,7 +1745,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge
|
||||
z += factor * ((*itr)->GetPositionZ() - z);
|
||||
|
||||
distSq = (*itr)->GetExactDistSq(x, y, z);
|
||||
DEBUG_TRAJ(LOG_ERROR("server", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);)
|
||||
LOG_ERROR("spells", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2987,9 +2979,7 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask)
|
||||
if (CanExecuteTriggersOnHit(effMask, i->triggeredByAura) && roll_chance_i(i->chance))
|
||||
{
|
||||
m_caster->CastSpell(unit, i->triggeredSpell, true);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id);
|
||||
#endif
|
||||
|
||||
// SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
|
||||
// set duration of current aura to the triggered spell
|
||||
@@ -3338,9 +3328,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
|
||||
// set timer base at cast time
|
||||
ReSetTimer();
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell::prepare: spell id %u source %u caster %d customCastFlags %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, _triggeredCastFlags, m_targets.GetTargetMask());
|
||||
#endif
|
||||
|
||||
//Containers for channeled spells have to be set
|
||||
//TODO:Apply this to all casted spells if needed
|
||||
@@ -3942,9 +3930,7 @@ void Spell::update(uint32 difftime)
|
||||
|
||||
if (m_targets.GetUnitTargetGUID() && !m_targets.GetUnitTarget())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell %u is cancelled due to removal of target.", m_spellInfo->Id);
|
||||
#endif
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
@@ -4002,9 +3988,7 @@ void Spell::update(uint32 difftime)
|
||||
// Xinef: so the aura can be removed in different updates for all units
|
||||
else if ((m_timer < 0 || m_timer > 300) && !UpdateChanneledTargetList())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Channeled spell %d is removed due to lack of targets", m_spellInfo->Id);
|
||||
#endif
|
||||
SendChannelUpdate(0);
|
||||
finish();
|
||||
}
|
||||
@@ -4068,9 +4052,7 @@ void Spell::finish(bool ok)
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
|
||||
if (spellInfo && spellInfo->SpellIconID == 2056)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Statue %s is unsummoned in spell %d finish", m_caster->GetGUID().ToString().c_str(), m_spellInfo->Id);
|
||||
#endif
|
||||
m_caster->setDeathState(JUST_DIED);
|
||||
return;
|
||||
}
|
||||
@@ -4761,7 +4743,7 @@ void Spell::TakeCastItem()
|
||||
{
|
||||
// This code is to avoid a crash
|
||||
// I'm not sure, if this is really an error, but I guess every item needs a prototype
|
||||
LOG_ERROR("server", "Cast item has no item prototype %s", m_CastItem->GetGUID().ToString().c_str());
|
||||
LOG_ERROR("spells", "Cast item has no item prototype %s", m_CastItem->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4857,7 +4839,7 @@ void Spell::TakePower()
|
||||
|
||||
if (PowerType >= MAX_POWERS)
|
||||
{
|
||||
LOG_ERROR("server", "Spell::TakePower: Unknown power type '%d'", PowerType);
|
||||
LOG_ERROR("spells", "Spell::TakePower: Unknown power type '%d'", PowerType);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5116,9 +5098,7 @@ void Spell::HandleThreatSpells()
|
||||
else if (!m_spellInfo->_IsPositiveSpell() && !IsFriendly && target->CanHaveThreatList())
|
||||
target->AddThreat(m_caster, threatToAdd, m_spellInfo->GetSchoolMask(), m_spellInfo);
|
||||
}
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell %u, added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, m_spellInfo->_IsPositiveSpell() ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i, SpellEffectHandleMode mode)
|
||||
@@ -5131,9 +5111,7 @@ void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOT
|
||||
|
||||
uint8 eff = m_spellInfo->Effects[i].Effect;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell: %u Effect : %u", m_spellInfo->Id, eff);
|
||||
#endif
|
||||
|
||||
// we do not need DamageMultiplier here.
|
||||
damage = CalculateSpellDamage(i, nullptr);
|
||||
@@ -6508,7 +6486,7 @@ SpellCastResult Spell::CheckPower()
|
||||
// Check valid power type
|
||||
if (m_spellInfo->PowerType >= MAX_POWERS)
|
||||
{
|
||||
LOG_ERROR("server", "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType);
|
||||
LOG_ERROR("spells", "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType);
|
||||
return SPELL_FAILED_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -7145,9 +7123,7 @@ void Spell::Delayed() // only called in DealDamage()
|
||||
else
|
||||
m_timer += delaytime;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
|
||||
#endif
|
||||
LOG_DEBUG("spells", "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
|
||||
|
||||
WorldPacket data(SMSG_SPELL_DELAYED, 8 + 4);
|
||||
data << m_caster->GetPackGUID();
|
||||
@@ -7185,9 +7161,7 @@ void Spell::DelayedChannel()
|
||||
else
|
||||
m_timer -= delaytime;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer);
|
||||
#endif
|
||||
|
||||
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
if ((*ihit).missCondition == SPELL_MISS_NONE)
|
||||
@@ -7443,7 +7417,7 @@ SpellEvent::~SpellEvent()
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("server", "~SpellEvent: %s %s tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
|
||||
LOG_ERROR("spells", "~SpellEvent: %s %s tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
|
||||
(m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUID().ToString().c_str(), m_Spell->m_spellInfo->Id);
|
||||
ABORT();
|
||||
}
|
||||
@@ -7841,9 +7815,7 @@ void Spell::LoadScripts()
|
||||
m_loadedScripts.erase(bitr);
|
||||
continue;
|
||||
}
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Spell::LoadScripts: Script `%s` for spell `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id);
|
||||
#endif
|
||||
(*itr)->Register();
|
||||
++itr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user