From af4c630eded1692c757d21ec935530a99d5dd347 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 2 Sep 2019 03:26:44 -0500 Subject: [PATCH] Logs::Spells to LogSpells --- common/shareddb.cpp | 4 +- common/spdat.cpp | 2 +- zone/attack.cpp | 18 +-- zone/bot.cpp | 20 +-- zone/client_mods.cpp | 9 +- zone/client_packet.cpp | 8 +- zone/client_process.cpp | 10 +- zone/groups.cpp | 4 +- zone/mob.cpp | 6 +- zone/mob_ai.cpp | 2 +- zone/raids.cpp | 4 +- zone/spell_effects.cpp | 14 +- zone/spells.cpp | 334 ++++++++++++++++++++-------------------- zone/worldserver.cpp | 12 +- 14 files changed, 220 insertions(+), 227 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 31028677f..3b6a70a5e 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -1653,7 +1653,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { } if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) { - Log(Logs::Detail, Logs::Spells, "Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT(%u)", SPELL_LOAD_FIELD_COUNT); + LogSpells("Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT([{}])", SPELL_LOAD_FIELD_COUNT); return; } @@ -1663,7 +1663,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { for (auto row = results.begin(); row != results.end(); ++row) { tempid = atoi(row[0]); if(tempid >= max_spells) { - Log(Logs::Detail, Logs::Spells, "Non fatal error: spell.id >= max_spells, ignoring."); + LogSpells("Non fatal error: spell.id >= max_spells, ignoring"); continue; } diff --git a/common/spdat.cpp b/common/spdat.cpp index 8006e377d..5aa7f9efd 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -850,7 +850,7 @@ DmgShieldType GetDamageShieldType(uint16 spell_id, int32 DSType) // If we have a DamageShieldType for this spell from the damageshieldtypes table, return that, // else, make a guess, based on the resist type. Default return value is DS_THORNS if (IsValidSpell(spell_id)) { - Log(Logs::Detail, Logs::Spells, "DamageShieldType for spell %i (%s) is %X\n", spell_id, + LogSpells("DamageShieldType for spell [{}] ([{}]) is %X\n", spell_id, spells[spell_id].name, spells[spell_id].DamageShieldType); if (spells[spell_id].DamageShieldType) diff --git a/zone/attack.cpp b/zone/attack.cpp index b26f4cf16..b3147ac41 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3054,16 +3054,14 @@ int32 Mob::ReduceDamage(int32 damage) int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100; if (damage_to_reduce >= buffs[slot].melee_rune) { - Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" - " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); + LogSpells("Mob::ReduceDamage SE_MeleeThresholdGuard [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if (!TryFadeEffect(slot)) BuffFadeBySlot(slot); } else { - Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d" - " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); + LogSpells("Mob::ReduceDamage SE_MeleeThresholdGuard [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].melee_rune); buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); damage -= damage_to_reduce; } @@ -3081,16 +3079,14 @@ int32 Mob::ReduceDamage(int32 damage) if (spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune)) { - Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" - " damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune); + LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].melee_rune); damage -= buffs[slot].melee_rune; if (!TryFadeEffect(slot)) BuffFadeBySlot(slot); } else { - Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" - " damage remaining.", damage_to_reduce, buffs[slot].melee_rune); + LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].melee_rune); if (spellbonuses.MitigateMeleeRune[3]) buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce); @@ -3207,16 +3203,14 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi if (spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune)) { - Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d" - " damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune); + LogSpells("Mob::ReduceDamage SE_MitigateSpellDamage [{}] damage negated, [{}] damage remaining, fading buff", damage_to_reduce, buffs[slot].magic_rune); damage -= buffs[slot].magic_rune; if (!TryFadeEffect(slot)) BuffFadeBySlot(slot); } else { - Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d" - " damage remaining.", damage_to_reduce, buffs[slot].magic_rune); + LogSpells("Mob::ReduceDamage SE_MitigateMeleeDamage [{}] damage negated, [{}] damage remaining", damage_to_reduce, buffs[slot].magic_rune); if (spellbonuses.MitigateSpellRune[3]) buffs[slot].magic_rune = (buffs[slot].magic_rune - damage_to_reduce); diff --git a/zone/bot.cpp b/zone/bot.cpp index e7d85e7c3..8e63d1d9e 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -5268,7 +5268,7 @@ int32 Bot::CalcBotFocusEffect(BotfocusType bottype, uint16 focus_id, uint16 spel break; } default: - Log(Logs::General, Logs::Spells, "CalcFocusEffect: unknown effectid %d", focus_spell.effectid[i]); + LogSpells("CalcFocusEffect: unknown effectid [{}]", focus_spell.effectid[i]); break; } } @@ -6435,14 +6435,14 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlo uint32* oSpellWillFinish, uint32 item_slot, int16 *resist_adjust, uint32 aa_id) { bool Result = false; if(zone && !zone->IsSpellBlocked(spell_id, glm::vec3(GetPosition()))) { - Log(Logs::Detail, Logs::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); + LogSpells("CastSpell called for spell [{}] ([{}]) on entity [{}], slot [{}], time [{}], mana [{}], from item slot [{}]", spells[spell_id].name, spell_id, target_id, slot, cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) ZeroCastingVars(); if(GetClass() != BARD) { if(!IsValidSpell(spell_id) || casting_spell_id || delaytimer || spellend_timer.Enabled() || IsStunned() || IsFeared() || IsMezzed() || (IsSilenced() && !IsDiscipline(spell_id)) || (IsAmnesiad() && IsDiscipline(spell_id))) { - Log(Logs::Detail, Logs::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() ); + LogSpells("Spell casting canceled: not able to cast now. Valid? [{}], casting [{}], waiting? [{}], spellend? [{}], stunned? [{}], feared? [{}], mezed? [{}], silenced? [{}]", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced() ); if(IsSilenced() && !IsDiscipline(spell_id)) MessageString(Chat::Red, SILENCED_STRING); @@ -6466,7 +6466,7 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlo } if(DivineAura()) { - Log(Logs::Detail, Logs::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + LogSpells("Spell casting canceled: cannot cast while Divine Aura is in effect"); InterruptSpell(173, 0x121, false); return false; } @@ -6476,13 +6476,13 @@ bool Bot::CastSpell(uint16 spell_id, uint16 target_id, EQEmu::spells::CastingSlo InterruptSpell(fizzle_msg, 0x121, spell_id); uint32 use_mana = ((spells[spell_id].mana) / 4); - Log(Logs::Detail, Logs::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + LogSpells("Spell casting canceled: fizzled. [{}] mana has been consumed", use_mana); SetMana(GetMana() - use_mana); return false; } if (HasActiveSong()) { - Log(Logs::Detail, Logs::Spells, "Casting a new spell/song while singing a song. Killing old song %d.", bardsong); + LogSpells("Casting a new spell/song while singing a song. Killing old song [{}]", bardsong); bardsong = 0; bardsong_target_id = 0; bardsong_slot = EQEmu::spells::CastingSlot::Gem1; @@ -6596,19 +6596,19 @@ bool Bot::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(caster->IsBot()) { if(spells[spell_id].targettype == ST_Undead) { if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Undead) && (GetBodyType() != BT_Vampire)) { - Log(Logs::Detail, Logs::Spells, "Bot's target is not an undead."); + LogSpells("Bot's target is not an undead"); return true; } } if(spells[spell_id].targettype == ST_Summoned) { if((GetBodyType() != BT_SummonedUndead) && (GetBodyType() != BT_Summoned) && (GetBodyType() != BT_Summoned2) && (GetBodyType() != BT_Summoned3)) { - Log(Logs::Detail, Logs::Spells, "Bot's target is not a summoned creature."); + LogSpells("Bot's target is not a summoned creature"); return true; } } } - Log(Logs::Detail, Logs::Spells, "No bot immunities to spell %d found.", spell_id); + LogSpells("No bot immunities to spell [{}] found", spell_id); } } @@ -6759,7 +6759,7 @@ bool Bot::DoFinishedSpellSingleTarget(uint16 spell_id, Mob* spellTarget, EQEmu:: if((spelltypeequal || spelltypetargetequal) || spelltypeclassequal || slotequal) { if(((spells[thespell].effectid[0] == 0) && (spells[thespell].base[0] < 0)) && (spellTarget->GetHP() < ((spells[thespell].base[0] * (-1)) + 100))) { - Log(Logs::General, Logs::Spells, "Bot::DoFinishedSpellSingleTarget - GroupBuffing failure"); + LogSpells("Bot::DoFinishedSpellSingleTarget - GroupBuffing failure"); return false; } diff --git a/zone/client_mods.cpp b/zone/client_mods.cpp index 45238afdc..1b8735d7d 100644 --- a/zone/client_mods.cpp +++ b/zone/client_mods.cpp @@ -576,7 +576,7 @@ int32 Client::CalcMaxMana() break; } default: { - Log(Logs::Detail, Logs::Spells, "Invalid Class '%c' in CalcMaxMana", GetCasterClass()); + LogSpells("Invalid Class [{}] in CalcMaxMana", GetCasterClass()); max_mana = 0; break; } @@ -594,7 +594,7 @@ int32 Client::CalcMaxMana() current_mana = curMana_cap; } } - Log(Logs::Detail, Logs::Spells, "Client::CalcMaxMana() called for %s - returning %d", GetName(), max_mana); + LogSpells("Client::CalcMaxMana() called for [{}] - returning [{}]", GetName(), max_mana); return max_mana; } @@ -1597,8 +1597,9 @@ uint32 Mob::GetInstrumentMod(uint16 spell_id) const effectmod = 10; if (!nocap && effectmod > effectmodcap) // if the cap is calculated to be 0 using new rules, no cap. effectmod = effectmodcap; - Log(Logs::Detail, Logs::Spells, "%s::GetInstrumentMod() spell=%d mod=%d modcap=%d\n", GetName(), spell_id, - effectmod, effectmodcap); + + LogSpells("[{}]::GetInstrumentMod() spell=[{}] mod=[{}] modcap=[{}]\n", GetName(), spell_id, effectmod, effectmodcap); + return effectmod; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 33aacc62a..967182154 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3868,7 +3868,7 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app) SpellBuffPacket_Struct* sbf = (SpellBuffPacket_Struct*)app->pBuffer; uint32 spid = sbf->buff.spellid; - Log(Logs::Detail, Logs::Spells, "Client requested that buff with spell id %d be canceled.", spid); + LogSpells("Client requested that buff with spell id [{}] be canceled", spid); //something about IsDetrimentalSpell() crashes this portion of code.. //tbh we shouldn't use it anyway since this is a simple red vs blue buff check and @@ -4027,7 +4027,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) m_TargetRing = glm::vec3(castspell->x_pos, castspell->y_pos, castspell->z_pos); - Log(Logs::General, Logs::Spells, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); + LogSpells("OP CastSpell: slot=[{}], spell=[{}], target=[{}], inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); CastingSlot slot = static_cast(castspell->slot); /* Memorized Spell */ @@ -4123,7 +4123,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app) /* Discipline -- older clients use the same slot as items, but we translate to it's own */ else if (slot == CastingSlot::Discipline) { if (!UseDiscipline(castspell->spell_id, castspell->target_id)) { - Log(Logs::General, Logs::Spells, "Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id); + LogSpells("Unknown ability being used by [{}], spell being cast is: [{}]\n", GetName(), castspell->spell_id); InterruptSpell(castspell->spell_id); return; } @@ -12091,7 +12091,7 @@ void Client::Handle_OP_RezzAnswer(const EQApplicationPacket *app) const Resurrect_Struct* ra = (const Resurrect_Struct*)app->pBuffer; - Log(Logs::Detail, Logs::Spells, "Received OP_RezzAnswer from client. Pendingrezzexp is %i, action is %s", + LogSpells("Received OP_RezzAnswer from client. Pendingrezzexp is [{}], action is [{}]", PendingRezzXP, ra->action ? "ACCEPT" : "DECLINE"); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 55fd8d0b9..95f6fbaa8 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -988,7 +988,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I { if(PendingRezzXP < 0) { // pendingrezexp is set to -1 if we are not expecting an OP_RezzAnswer - Log(Logs::Detail, Logs::Spells, "Unexpected OP_RezzAnswer. Ignoring it."); + LogSpells("Unexpected OP_RezzAnswer. Ignoring it"); Message(Chat::Red, "You have already been resurrected.\n"); return; } @@ -998,7 +998,7 @@ void Client::OPRezzAnswer(uint32 Action, uint32 SpellID, uint16 ZoneID, uint16 I // Mark the corpse as rezzed in the database, just in case the corpse has buried, or the zone the // corpse is in has shutdown since the rez spell was cast. database.MarkCorpseAsRezzed(PendingRezzDBID); - Log(Logs::Detail, Logs::Spells, "Player %s got a %i Rezz, spellid %i in zone%i, instance id %i", + LogSpells("Player [{}] got a [{}] Rezz, spellid [{}] in zone[{}], instance id [{}]", this->name, (uint16)spells[SpellID].base[0], SpellID, ZoneID, InstanceID); @@ -2004,7 +2004,7 @@ void Client::HandleRespawnFromHover(uint32 Option) { if (PendingRezzXP < 0 || PendingRezzSpellID == 0) { - Log(Logs::Detail, Logs::Spells, "Unexpected Rezz from hover request."); + LogSpells("Unexpected Rezz from hover request"); return; } SetHP(GetMaxHP() / 5); @@ -2038,10 +2038,10 @@ void Client::HandleRespawnFromHover(uint32 Option) if (corpse && corpse->IsCorpse()) { - Log(Logs::Detail, Logs::Spells, "Hover Rez in zone %s for corpse %s", + LogSpells("Hover Rez in zone [{}] for corpse [{}]", zone->GetShortName(), PendingRezzCorpseName.c_str()); - Log(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed."); + LogSpells("Found corpse. Marking corpse as rezzed"); corpse->IsRezzed(true); corpse->CompleteResurrection(); diff --git a/zone/groups.cpp b/zone/groups.cpp index 86226230f..e29deca43 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -835,7 +835,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { caster->SpellOnTarget(spell_id, members[z]->GetPet()); #endif } else - Log(Logs::Detail, Logs::Spells, "Group spell: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + LogSpells("Group spell: [{}] is out of range [{}] at distance [{}] from [{}]", members[z]->GetName(), range, distance, caster->GetName()); } } @@ -874,7 +874,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { members[z]->GetPet()->BardPulse(spell_id, caster); #endif } else - Log(Logs::Detail, Logs::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z]->GetName(), range, distance, caster->GetName()); + LogSpells("Group bard pulse: [{}] is out of range [{}] at distance [{}] from [{}]", members[z]->GetName(), range, distance, caster->GetName()); } } } diff --git a/zone/mob.cpp b/zone/mob.cpp index 2e3a607ea..dd2d78064 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1840,9 +1840,7 @@ void Mob::SendIllusionPacket( /* Refresh armor and tints after send illusion packet */ this->SendArmorAppearance(); - Log(Logs::Detail, - Logs::Spells, - "Illusion: Race = %i, Gender = %i, Texture = %i, HelmTexture = %i, HairColor = %i, BeardColor = %i, EyeColor1 = %i, EyeColor2 = %i, HairStyle = %i, Face = %i, DrakkinHeritage = %i, DrakkinTattoo = %i, DrakkinDetails = %i, Size = %f", + LogSpells("Illusion: Race = [{}], Gender = [{}], Texture = [{}], HelmTexture = [{}], HairColor = [{}], BeardColor = [{}], EyeColor1 = [{}], EyeColor2 = [{}], HairStyle = [{}], Face = [{}], DrakkinHeritage = [{}], DrakkinTattoo = [{}], DrakkinDetails = [{}], Size = [{}]", race, gender, new_texture, @@ -3063,7 +3061,7 @@ void Mob::ExecWeaponProc(const EQEmu::ItemInstance *inst, uint16 spell_id, Mob * if(!IsValidSpell(spell_id)) { // Check for a valid spell otherwise it will crash through the function if(IsClient()){ Message(0, "Invalid spell proc %u", spell_id); - Log(Logs::Detail, Logs::Spells, "Player %s, Weapon Procced invalid spell %u", this->GetName(), spell_id); + LogSpells("Player [{}], Weapon Procced invalid spell [{}]", this->GetName(), spell_id); } return; } diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index ff936493e..dd0bb5cc6 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -2034,7 +2034,7 @@ bool NPC::AI_IdleCastCheck() { //last duration it was set to... try to put up a more reasonable timer... AIautocastspell_timer->Start(RandomTimer(AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max), false); - Log(Logs::Moderate, Logs::Spells, "Triggering AI_IdleCastCheck :: Mob %s - Min : %u Max : %u", this->GetCleanName(), AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max); + LogSpells("Triggering AI_IdleCastCheck :: Mob [{}] - Min : [{}] Max : [{}]", this->GetCleanName(), AISpellVar.idle_no_sp_recast_min, AISpellVar.idle_no_sp_recast_max); } //else, spell casting finishing will reset the timer. } //else, spell casting finishing will reset the timer. diff --git a/zone/raids.cpp b/zone/raids.cpp index d985f9e7b..7a153864d 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -547,7 +547,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) #endif } else{ - Log(Logs::Detail, Logs::Spells, "Raid spell: %s is out of range %f at distance %f from %s", members[x].member->GetName(), range, distance, caster->GetName()); + LogSpells("Raid spell: [{}] is out of range [{}] at distance [{}] from [{}]", members[x].member->GetName(), range, distance, caster->GetName()); } } } @@ -848,7 +848,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ members[z].member->GetPet()->BardPulse(spellid, caster); #endif } else - Log(Logs::Detail, Logs::Spells, "Group bard pulse: %s is out of range %f at distance %f from %s", members[z].member->GetName(), range, distance, caster->GetName()); + LogSpells("Group bard pulse: [{}] is out of range [{}] at distance [{}] from [{}]", members[z].member->GetName(), range, distance, caster->GetName()); } } } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 693333df4..9b15f6de5 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -1678,7 +1678,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove if (IsCorpse() && CastToCorpse()->IsPlayerCorpse()) { if(caster) - Log(Logs::Detail, Logs::Spells, " corpse being rezzed using spell %i by %s", + LogSpells(" corpse being rezzed using spell [{}] by [{}]", spell_id, caster->GetName()); CastToCorpse()->CastRezz(spell_id, caster); @@ -3060,7 +3060,7 @@ int Mob::CalcSpellEffectValue(uint16 spell_id, int effect_id, int caster_level, int oval = effect_value; int mod = ApplySpellEffectiveness(spell_id, instrument_mod, true, caster_id); effect_value = effect_value * mod / 10; - Log(Logs::Detail, Logs::Spells, "Effect value %d altered with bard modifier of %d to yeild %d", + LogSpells("Effect value [{}] altered with bard modifier of [{}] to yeild [{}]", oval, mod, effect_value); } @@ -3123,7 +3123,7 @@ snare has both of them negative, yet their range should work the same: updownsign = 1; } - Log(Logs::Detail, Logs::Spells, "CSEV: spell %d, formula %d, base %d, max %d, lvl %d. Up/Down %d", + LogSpells("CSEV: spell [{}], formula [{}], base [{}], max [{}], lvl [{}]. Up/Down [{}]", spell_id, formula, base, max, caster_level, updownsign); switch(formula) @@ -3370,7 +3370,7 @@ snare has both of them negative, yet their range should work the same: if (base < 0 && result > 0) result *= -1; - Log(Logs::Detail, Logs::Spells, "Result: %d (orig %d), cap %d %s", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); + LogSpells("Result: [{}] (orig [{}]), cap [{}] [{}]", result, oresult, max, (base < 0 && result > 0)?"Inverted due to negative base":""); return result; } @@ -3397,12 +3397,12 @@ void Mob::BuffProcess() --buffs[buffs_i].ticsremaining; if (buffs[buffs_i].ticsremaining < 0) { - Log(Logs::Detail, Logs::Spells, "Buff %d in slot %d has expired. Fading.", buffs[buffs_i].spellid, buffs_i); + LogSpells("Buff [{}] in slot [{}] has expired. Fading", buffs[buffs_i].spellid, buffs_i); BuffFadeBySlot(buffs_i); } else { - Log(Logs::Detail, Logs::Spells, "Buff %d in slot %d has %d tics remaining.", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); + LogSpells("Buff [{}] in slot [{}] has [{}] tics remaining", buffs[buffs_i].spellid, buffs_i, buffs[buffs_i].ticsremaining); } } else if (IsClient() && !(CastToClient()->ClientVersionBit() & EQEmu::versions::maskSoFAndLater)) @@ -3733,7 +3733,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses) if (IsClient() && !CastToClient()->IsDead()) CastToClient()->MakeBuffFadePacket(buffs[slot].spellid, slot); - Log(Logs::Detail, Logs::Spells, "Fading buff %d from slot %d", buffs[slot].spellid, slot); + LogSpells("Fading buff [{}] from slot [{}]", buffs[slot].spellid, slot); if(spells[buffs[slot].spellid].viral_targets > 0) { bool last_virus = true; diff --git a/zone/spells.cpp b/zone/spells.cpp index 6ca3bf422..2ebbf9e6b 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -158,7 +158,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, uint32 timer, uint32 timer_duration, int16 *resist_adjust, uint32 aa_id) { - Log(Logs::Detail, Logs::Spells, "CastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item slot %d", + LogSpells("CastSpell called for spell [{}] ([{}]) on entity [{}], slot [{}], time [{}], mana [{}], from item slot [{}]", (IsValidSpell(spell_id))?spells[spell_id].name:"UNKNOWN SPELL", spell_id, target_id, static_cast(slot), cast_time, mana_cost, (item_slot==0xFFFFFFFF)?999:item_slot); if(casting_spell_id == spell_id) @@ -177,7 +177,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, (IsAmnesiad() && IsDiscipline(spell_id)) ) { - Log(Logs::Detail, Logs::Spells, "Spell casting canceled: not able to cast now. Valid? %d, casting %d, waiting? %d, spellend? %d, stunned? %d, feared? %d, mezed? %d, silenced? %d, amnesiad? %d", + LogSpells("Spell casting canceled: not able to cast now. Valid? [{}], casting [{}], waiting? [{}], spellend? [{}], stunned? [{}], feared? [{}], mezed? [{}], silenced? [{}], amnesiad? [{}]", IsValidSpell(spell_id), casting_spell_id, delaytimer, spellend_timer.Enabled(), IsStunned(), IsFeared(), IsMezzed(), IsSilenced(), IsAmnesiad() ); if(IsSilenced() && !IsDiscipline(spell_id)) MessageString(Chat::Red, SILENCED_STRING); @@ -215,7 +215,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, //cannot cast under divine aura if(DivineAura()) { - Log(Logs::Detail, Logs::Spells, "Spell casting canceled: cannot cast while Divine Aura is in effect."); + LogSpells("Spell casting canceled: cannot cast while Divine Aura is in effect"); InterruptSpell(173, 0x121, false); return(false); } @@ -237,7 +237,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, } if (HasActiveSong() && IsBardSong(spell_id)) { - Log(Logs::Detail, Logs::Spells, "Casting a new song while singing a song. Killing old song %d.", bardsong); + LogSpells("Casting a new song while singing a song. Killing old song [{}]", bardsong); //Note: this does NOT tell the client _StopSong(); } @@ -344,7 +344,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, const SPDat_Spell_Struct &spell = spells[spell_id]; - Log(Logs::Detail, Logs::Spells, "DoCastSpell called for spell %s (%d) on entity %d, slot %d, time %d, mana %d, from item %d", + LogSpells("DoCastSpell called for spell [{}] ([{}]) on entity [{}], slot [{}], time [{}], mana [{}], from item [{}]", spell.name, spell_id, target_id, static_cast(slot), cast_time, mana_cost, item_slot==0xFFFFFFFF?999:item_slot); casting_spell_id = spell_id; @@ -364,7 +364,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, int fizzle_msg = IsBardSong(spell_id) ? MISS_NOTE : SPELL_FIZZLE; uint32 use_mana = ((spells[spell_id].mana) / 4); - Log(Logs::Detail, Logs::Spells, "Spell casting canceled: fizzled. %d mana has been consumed", use_mana); + LogSpells("Spell casting canceled: fizzled. [{}] mana has been consumed", use_mana); // fizzle 1/4 the mana away Mob::SetMana(GetMana() - use_mana); // We send StopCasting which will update mana @@ -395,7 +395,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, } SaveSpellLoc(); - Log(Logs::Detail, Logs::Spells, "Casting %d Started at (%.3f,%.3f,%.3f)", spell_id, m_SpellLocation.x, m_SpellLocation.y, m_SpellLocation.z); + LogSpells("Casting [{}] Started at (%.3f,%.3f,%.3f)", 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 // and a target wasn't provided, then it's us; unless TGB is on and this @@ -408,7 +408,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, spell.targettype == ST_Beam || spell.targettype == ST_TargetOptional) && target_id == 0) { - Log(Logs::Detail, Logs::Spells, "Spell %d auto-targeted the caster. Group? %d, target type %d", spell_id, IsGroupSpell(spell_id), spell.targettype); + LogSpells("Spell [{}] auto-targeted the caster. Group? [{}], target type [{}]", spell_id, IsGroupSpell(spell_id), spell.targettype); target_id = GetID(); } @@ -425,7 +425,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, // we checked for spells not requiring targets above if(target_id == 0) { - Log(Logs::Detail, Logs::Spells, "Spell Error: no target. spell=%d", spell_id); + LogSpells("Spell Error: no target. spell=[{}]", spell_id); if(IsClient()) { //clients produce messages... npcs should not for this case MessageString(Chat::Red, SPELL_NEED_TAR); @@ -458,7 +458,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, { mana_cost = 0; } else { - Log(Logs::Detail, Logs::Spells, "Spell Error not enough mana spell=%d mymana=%d cost=%d\n", spell_id, my_curmana, mana_cost); + LogSpells("Spell Error not enough mana spell=[{}] mymana=[{}] cost=[{}]\n", spell_id, my_curmana, mana_cost); if(IsClient()) { //clients produce messages... npcs should not for this case MessageString(Chat::Red, INSUFFICIENT_MANA); @@ -479,7 +479,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, casting_spell_resist_adjust = resist_adjust; - Log(Logs::Detail, Logs::Spells, "Spell %d: Casting time %d (orig %d), mana cost %d", + LogSpells("Spell [{}]: Casting time [{}] (orig [{}]), mana cost [{}]", spell_id, cast_time, orgcasttime, mana_cost); // now tell the people in the area -- we ALWAYS want to send this, even instant cast spells. @@ -573,7 +573,7 @@ bool Mob::DoCastingChecks() if (RuleB(Spells, BuffLevelRestrictions)) { // casting_spell_targetid is guaranteed to be what we went, check for ST_Self for now should work though if (spell_target && spells[spell_id].targettype != ST_Self && !spell_target->CheckSpellLevelRestriction(spell_id)) { - Log(Logs::Detail, Logs::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + LogSpells("Spell [{}] failed: recipient did not meet the level restrictions", spell_id); if (!IsBardSong(spell_id)) MessageString(Chat::SpellFailure, SPELL_TOO_POWERFUL); return false; @@ -758,7 +758,7 @@ bool Client::CheckFizzle(uint16 spell_id) act_skill = GetSkill(spells[spell_id].skill); act_skill += GetLevel(); // maximum of whatever the client can cheat act_skill += itembonuses.adjusted_casting_skill + spellbonuses.adjusted_casting_skill + aabonuses.adjusted_casting_skill; - Log(Logs::Detail, Logs::Spells, "Adjusted casting skill: %d+%d+%d+%d+%d=%d", GetSkill(spells[spell_id].skill), GetLevel(), itembonuses.adjusted_casting_skill, spellbonuses.adjusted_casting_skill, aabonuses.adjusted_casting_skill, act_skill); + LogSpells("Adjusted casting skill: [{}]+[{}]+[{}]+[{}]+[{}]=[{}]", GetSkill(spells[spell_id].skill), GetLevel(), itembonuses.adjusted_casting_skill, spellbonuses.adjusted_casting_skill, aabonuses.adjusted_casting_skill, act_skill); //spell specialization float specialize = GetSpecializeSkillValue(spell_id); @@ -810,7 +810,7 @@ bool Client::CheckFizzle(uint16 spell_id) float fizzle_roll = zone->random.Real(0, 100); - Log(Logs::Detail, Logs::Spells, "Check Fizzle %s spell %d fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); + LogSpells("Check Fizzle [{}] spell [{}] fizzlechance: %0.2f%% diff: %0.2f roll: %0.2f", GetName(), spell_id, fizzlechance, diff, fizzle_roll); if(fizzle_roll > fizzlechance) return(true); @@ -869,7 +869,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) ZeroCastingVars(); // resets all the state keeping stuff - Log(Logs::Detail, Logs::Spells, "Spell %d has been interrupted.", spellid); + LogSpells("Spell [{}] has been interrupted", spellid); if(!spellid) return; @@ -972,7 +972,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if(!CastToClient()->GetPTimers().Expired(&database, pTimerSpellStart + spell_id, false)) { //should we issue a message or send them a spell gem packet? MessageString(Chat::Red, SPELL_RECAST); - Log(Logs::Detail, Logs::Spells, "Casting of %d canceled: spell reuse timer not expired", spell_id); + LogSpells("Casting of [{}] canceled: spell reuse timer not expired", spell_id); StopCasting(); return; } @@ -986,7 +986,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + itm->GetItem()->RecastType), false)) { MessageString(Chat::Red, SPELL_RECAST); - Log(Logs::Detail, Logs::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + LogSpells("Casting of [{}] canceled: item spell reuse timer not expired", spell_id); StopCasting(); return; } @@ -995,7 +995,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if(!IsValidSpell(spell_id)) { - Log(Logs::Detail, Logs::Spells, "Casting of %d canceled: invalid spell id", spell_id); + LogSpells("Casting of [{}] canceled: invalid spell id", spell_id); InterruptSpell(); return; } @@ -1006,7 +1006,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo { if(delaytimer) { - Log(Logs::Detail, Logs::Spells, "Casting of %d canceled: recast too quickly", spell_id); + LogSpells("Casting of [{}] canceled: recast too quickly", spell_id); Message(Chat::Red, "You are unable to focus."); InterruptSpell(); return; @@ -1016,7 +1016,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo // make sure they aren't somehow casting 2 timed spells at once if (casting_spell_id != spell_id) { - Log(Logs::Detail, Logs::Spells, "Casting of %d canceled: already casting", spell_id); + LogSpells("Casting of [{}] canceled: already casting", spell_id); MessageString(Chat::Red,ALREADY_CASTING); InterruptSpell(); return; @@ -1031,7 +1031,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo { if (IsBardSong(spell_id)) { if(spells[spell_id].buffduration == 0xFFFF) { - Log(Logs::Detail, Logs::Spells, "Bard song %d not applying bard logic because duration. dur=%d, recast=%d", spells[spell_id].buffduration); + LogSpells("Bard song [{}] not applying bard logic because duration. dur=[{}], recast=[{}]", spells[spell_id].buffduration); } else { // So long recast bard songs need special bard logic, although the effects don't repulse like other songs // This is basically a hack to get that effect @@ -1047,7 +1047,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo bardsong_target_id = spell_target->GetID(); bardsong_timer.Start(6000); } - Log(Logs::Detail, Logs::Spells, "Bard song %d started: slot %d, target id %d", bardsong, bardsong_slot, bardsong_target_id); + LogSpells("Bard song [{}] started: slot [{}], target id [{}]", bardsong, (int) bardsong_slot, bardsong_target_id); bard_song_mode = true; } } @@ -1126,10 +1126,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo } } - Log(Logs::Detail, Logs::Spells, "Checking Interruption: spell x: %f spell y: %f cur x: %f cur y: %f channelchance %f channeling skill %d\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(EQEmu::skills::SkillChanneling)); + LogSpells("Checking Interruption: spell x: [{}] spell y: [{}] cur x: [{}] cur y: [{}] channelchance [{}] channeling skill [{}]\n", GetSpellX(), GetSpellY(), GetX(), GetY(), channelchance, GetSkill(EQEmu::skills::SkillChanneling)); if(!spells[spell_id].uninterruptable && zone->random.Real(0, 100) > channelchance) { - Log(Logs::Detail, Logs::Spells, "Casting of %d canceled: interrupted.", spell_id); + LogSpells("Casting of [{}] canceled: interrupted", spell_id); InterruptSpell(); return; } @@ -1151,10 +1151,10 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if(IsClient()) { int reg_focus = CastToClient()->GetFocusEffect(focusReagentCost,spell_id);//Client only if(zone->random.Roll(reg_focus)) { - Log(Logs::Detail, Logs::Spells, "Spell %d: Reagent focus item prevented reagent consumption (%d chance)", spell_id, reg_focus); + LogSpells("Spell [{}]: Reagent focus item prevented reagent consumption ([{}] chance)", spell_id, reg_focus); } else { if(reg_focus > 0) - Log(Logs::Detail, Logs::Spells, "Spell %d: Reagent focus item failed to prevent reagent consumption (%d chance)", spell_id, reg_focus); + LogSpells("Spell [{}]: Reagent focus item failed to prevent reagent consumption ([{}] chance)", spell_id, reg_focus); Client *c = this->CastToClient(); int component, component_count, inv_slot_id; bool missingreags = false; @@ -1207,11 +1207,11 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo break; default: // some non-instrument component. Let it go, but record it in the log - Log(Logs::Detail, Logs::Spells, "Something odd happened: Song %d required component %d", spell_id, component); + LogSpells("Something odd happened: Song [{}] required component [{}]", spell_id, component); } if(!HasInstrument) { // if the instrument is missing, log it and interrupt the song - Log(Logs::Detail, Logs::Spells, "Song %d: Canceled. Missing required instrument %d", spell_id, component); + LogSpells("Song [{}]: Canceled. Missing required instrument [{}]", spell_id, component); if(c->GetGM()) c->Message(Chat::White, "Your GM status allows you to finish casting even though you're missing a required instrument."); else { @@ -1237,12 +1237,12 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo const EQEmu::ItemData *item = database.GetItem(component); if(item) { c->MessageString(Chat::Red, MISSING_SPELL_COMP_ITEM, item->Name); - Log(Logs::Detail, Logs::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, item->Name, component); + LogSpells("Spell [{}]: Canceled. Missing required reagent [{}] ([{}])", spell_id, item->Name, component); } else { char TempItemName[64]; strcpy((char*)&TempItemName, "UNKNOWN"); - Log(Logs::Detail, Logs::Spells, "Spell %d: Canceled. Missing required reagent %s (%d)", spell_id, TempItemName, component); + LogSpells("Spell [{}]: Canceled. Missing required reagent [{}] ([{}])", spell_id, TempItemName, component); } } } // end bard/not bard ifs @@ -1268,7 +1268,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if (component == -1 || noexpend == component) continue; component_count = spells[spell_id].component_counts[t_count]; - Log(Logs::Detail, Logs::Spells, "Spell %d: Consuming %d of spell component item id %d", spell_id, component_count, component); + LogSpells("Spell [{}]: Consuming [{}] of spell component item id [{}]", spell_id, component_count, component); // Components found, Deleting // now we go looking for and deleting the items one by one for(int s = 0; s < component_count; s++) @@ -1333,7 +1333,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo { if(!CastToClient()->GetPTimers().Expired(&database, (pTimerItemStart + recasttype), false)) { MessageString(Chat::Red, SPELL_RECAST); - Log(Logs::Detail, Logs::Spells, "Casting of %d canceled: item spell reuse timer not expired", spell_id); + LogSpells("Casting of [{}] canceled: item spell reuse timer not expired", spell_id); StopCasting(); return; } @@ -1354,15 +1354,15 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo if(fromaug) { charges = -1; } //Don't destroy the parent item if(charges > -1) { // charged item, expend a charge - Log(Logs::Detail, Logs::Spells, "Spell %d: Consuming a charge from item %s (%d) which had %d/%d charges.", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); + LogSpells("Spell [{}]: Consuming a charge from item [{}] ([{}]) which had [{}]/[{}] charges", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetCharges(), inst->GetItem()->MaxCharges); DeleteChargeFromSlot = inventory_slot; } else { - Log(Logs::Detail, Logs::Spells, "Spell %d: Cast from unlimited charge item %s (%d) (%d charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); + LogSpells("Spell [{}]: Cast from unlimited charge item [{}] ([{}]) ([{}] charges)", spell_id, inst->GetItem()->Name, inst->GetItem()->ID, inst->GetItem()->MaxCharges); } } else { - Log(Logs::Detail, Logs::Spells, "Item used to cast spell %d was missing from inventory slot %d after casting!", spell_id, inventory_slot); + LogSpells("Item used to cast spell [{}] was missing from inventory slot [{}] after casting!", spell_id, inventory_slot); Message(Chat::Red, "Casting Error: Active casting item not found in inventory slot %i", inventory_slot); InterruptSpell(); return; @@ -1372,7 +1372,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo // we're done casting, now try to apply the spell if( !SpellFinished(spell_id, spell_target, slot, mana_used, inventory_slot, resist_adjust) ) { - Log(Logs::Detail, Logs::Spells, "Casting of %d canceled: SpellFinished returned false.", spell_id); + LogSpells("Casting of [{}] canceled: SpellFinished returned false", spell_id); // most of the cases we return false have a message already or are logic errors that shouldn't happen // if there are issues I guess we can do something else, but this should work StopCasting(); @@ -1415,7 +1415,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo c->SetLinkedSpellReuseTimer(spells[spell_id].EndurTimerIndex, spells[spell_id].recast_time / 1000); c->MemorizeSpell(static_cast(slot), spell_id, memSpellSpellbar); } - Log(Logs::Detail, Logs::Spells, "Bard song %d should be started", spell_id); + LogSpells("Bard song [{}] should be started", spell_id); } else { @@ -1453,7 +1453,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo delaytimer = true; spellend_timer.Start(10, true); - Log(Logs::Detail, Logs::Spells, "Spell casting of %d is finished.", spell_id); + LogSpells("Spell casting of [{}] is finished", spell_id); } @@ -1588,7 +1588,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce ) { //invalid target - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (undead)", spell_id, mob_body); + LogSpells("Spell [{}] canceled: invalid target of body type [{}] (undead)", spell_id, mob_body); if(!spell_target) MessageString(Chat::Red,SPELL_NEED_TAR); else @@ -1603,7 +1603,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (mob_body != BT_Summoned && mob_body != BT_Summoned2 && mob_body != BT_Summoned3)) { //invalid target - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (summoned)", spell_id, mob_body); + LogSpells("Spell [{}] canceled: invalid target of body type [{}] (summoned)", spell_id, mob_body); MessageString(Chat::Red,SPELL_NEED_TAR); return false; } @@ -1616,7 +1616,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || (spell_target != GetPet()) || (mob_body != BT_Summoned && mob_body != BT_Summoned2 && mob_body != BT_Summoned3 && mob_body != BT_Animal)) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (summoned pet)", + LogSpells("Spell [{}] canceled: invalid target of body type [{}] (summoned pet)", spell_id, mob_body); MessageString(Chat::Red, SPELL_NEED_TAR); @@ -1641,7 +1641,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target || mob_body != target_bt) { //invalid target - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target of body type %d (want body Type %d)", spell_id, mob_body, target_bt); + LogSpells("Spell [{}] canceled: invalid target of body type [{}] (want body Type [{}])", spell_id, mob_body, target_bt); if(!spell_target) MessageString(Chat::Red,SPELL_NEED_TAR); else @@ -1659,7 +1659,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (ldon object)", spell_id); + LogSpells("Spell [{}] canceled: invalid target (ldon object)", spell_id); MessageString(Chat::Red,SPELL_NEED_TAR); return false; } @@ -1667,14 +1667,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target->IsNPC()) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + LogSpells("Spell [{}] canceled: invalid target (normal)", spell_id); MessageString(Chat::Red,SPELL_NEED_TAR); return false; } if(spell_target->GetClass() != LDON_TREASURE) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + LogSpells("Spell [{}] canceled: invalid target (normal)", spell_id); MessageString(Chat::Red,SPELL_NEED_TAR); return false; } @@ -1683,7 +1683,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(!spell_target) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (normal)", spell_id); + LogSpells("Spell [{}] canceled: invalid target (normal)", spell_id); MessageString(Chat::Red,SPELL_NEED_TAR); return false; // can't cast these unless we have a target } @@ -1695,7 +1695,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target || !spell_target->IsPlayerCorpse()) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (corpse)", spell_id); + LogSpells("Spell [{}] canceled: invalid target (corpse)", spell_id); uint32 message = ONLY_ON_CORPSES; if(!spell_target) message = SPELL_NEED_TAR; else if(!spell_target->IsCorpse()) message = ONLY_ON_CORPSES; @@ -1711,7 +1711,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce spell_target = GetPet(); if(!spell_target) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (no pet)", spell_id); + LogSpells("Spell [{}] canceled: invalid target (no pet)", spell_id); MessageString(Chat::Red,NO_PET); return false; // can't cast these unless we have a target } @@ -1782,7 +1782,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (AOE)", spell_id); + LogSpells("Spell [{}] canceled: invalid target (AOE)", spell_id); MessageString(Chat::Red,SPELL_NEED_TAR); return false; } @@ -1819,7 +1819,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce { if(!spell_target) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: invalid target (Group Required: Single Target)", spell_id); + LogSpells("Spell [{}] canceled: invalid target (Group Required: Single Target)", spell_id); MessageString(Chat::Red,SPELL_NEED_TAR); return false; } @@ -1936,14 +1936,14 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce if(group_id_caster == 0 || group_id_target == 0) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + LogSpells("Spell [{}] canceled: Attempted to cast a Single Target Group spell on a ungrouped member", spell_id); MessageString(Chat::Red, TARGET_GROUP_MEMBER); return false; } if(group_id_caster != group_id_target) { - Log(Logs::Detail, Logs::Spells, "Spell %d canceled: Attempted to cast a Single Target Group spell on a ungrouped member.", spell_id); + LogSpells("Spell [{}] canceled: Attempted to cast a Single Target Group spell on a ungrouped member", spell_id); MessageString(Chat::Red, TARGET_GROUP_MEMBER); return false; } @@ -2014,7 +2014,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce default: { - Log(Logs::Detail, Logs::Spells, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); + LogSpells("I dont know Target Type: [{}] Spell: ([{}]) [{}]", spells[spell_id].targettype, spell_id, spells[spell_id].name); Message(0, "I dont know Target Type: %d Spell: (%d) %s", spells[spell_id].targettype, spell_id, spells[spell_id].name); CastAction = CastActUnknown; break; @@ -2071,7 +2071,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui if (IsClient() && CastToClient()->GetGM()){ if (zone->IsSpellBlocked(spell_id, glm::vec3(GetPosition()))){ - Log(Logs::Detail, Logs::Spells, "GM Cast Blocked Spell: %s (ID %i)", GetSpellName(spell_id), spell_id); + LogSpells("GM Cast Blocked Spell: [{}] (ID [{}])", GetSpellName(spell_id), spell_id); } } @@ -2099,7 +2099,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction, slot, isproc)) return(false); - Log(Logs::Detail, Logs::Spells, "Spell %d: target type %d, target %s, AE center %s", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); + LogSpells("Spell [{}]: target type [{}], target [{}], AE center [{}]", spell_id, CastAction, spell_target?spell_target->GetName():"NONE", ae_center?ae_center->GetName():"NONE"); // if a spell has the AEDuration flag, it becomes an AE on target // spell that's recast every 2500 msec for AEDuration msec. There are @@ -2110,7 +2110,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui Mob *beacon_loc = spell_target ? spell_target : this; auto beacon = new Beacon(beacon_loc, spells[spell_id].AEDuration); entity_list.AddBeacon(beacon); - Log(Logs::Detail, Logs::Spells, "Spell %d: AE duration beacon created, entity id %d", spell_id, beacon->GetName()); + LogSpells("Spell [{}]: AE duration beacon created, entity id [{}]", spell_id, beacon->GetName()); spell_target = nullptr; ae_center = beacon; CastAction = AECaster; @@ -2119,7 +2119,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui // check line of sight to target if it's a detrimental spell if(!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].targettype != ST_TargetOptional) { - Log(Logs::Detail, Logs::Spells, "Spell %d: cannot see target %s", spell_id, spell_target->GetName()); + LogSpells("Spell [{}]: cannot see target [{}]", spell_id, spell_target->GetName()); MessageString(Chat::Red,CANT_SEE_TARGET); return false; } @@ -2150,13 +2150,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { //target is out of range. - Log(Logs::Detail, Logs::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + LogSpells("Spell [{}]: Spell target is out of range (squared: [{}] > [{}])", spell_id, dist2, range2); MessageString(Chat::Red, TARGET_OUT_OF_RANGE); return(false); } else if (dist2 < min_range2){ //target is too close range. - Log(Logs::Detail, Logs::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); + LogSpells("Spell [{}]: Spell target is too close (squared: [{}] < [{}])", spell_id, dist2, min_range2); MessageString(Chat::Red, TARGET_TOO_CLOSE); return(false); } @@ -2171,13 +2171,13 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { //target is out of range. - Log(Logs::Detail, Logs::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + LogSpells("Spell [{}]: Spell target is out of range (squared: [{}] > [{}])", spell_id, dist2, range2); MessageString(Chat::Red, TARGET_OUT_OF_RANGE); return(false); } else if (dist2 < min_range2){ //target is too close range. - Log(Logs::Detail, Logs::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); + LogSpells("Spell [{}]: Spell target is too close (squared: [{}] < [{}])", spell_id, dist2, min_range2); MessageString(Chat::Red, TARGET_TOO_CLOSE); return(false); } @@ -2207,7 +2207,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui #endif //BOTS if(spell_target == nullptr) { - Log(Logs::Detail, Logs::Spells, "Spell %d: Targeted spell, but we have no target", spell_id); + LogSpells("Spell [{}]: Targeted spell, but we have no target", spell_id); return(false); } if (isproc) { @@ -2403,7 +2403,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui // clamp if we some how got focused above our current mana if (GetMana() < mana_used) mana_used = GetMana(); - Log(Logs::Detail, Logs::Spells, "Spell %d: consuming %d mana", spell_id, mana_used); + LogSpells("Spell [{}]: consuming [{}] mana", spell_id, mana_used); if (!DoHPToManaCovert(mana_used)) { SetMana(GetMana() - mana_used); TryTriggerOnValueAmount(false, true); @@ -2436,7 +2436,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui { //aa new todo: aa expendable charges here CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration); - Log(Logs::Detail, Logs::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration); + LogSpells("Spell [{}]: Setting custom reuse timer [{}] to [{}]", spell_id, casting_spell_timer, casting_spell_timer_duration); } else if(spells[spell_id].recast_time > 1000 && !spells[spell_id].IsDisciplineBuff) { int recast = spells[spell_id].recast_time/1000; @@ -2452,7 +2452,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui if(reduction) recast -= reduction; - Log(Logs::Detail, Logs::Spells, "Spell %d: Setting long reuse timer to %d s (orig %d)", spell_id, recast, spells[spell_id].recast_time); + LogSpells("Spell [{}]: Setting long reuse timer to [{}] s (orig [{}])", spell_id, recast, spells[spell_id].recast_time); CastToClient()->GetPTimers().Start(pTimerSpellStart + spell_id, recast); } } @@ -2494,7 +2494,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slot) { if(slot == CastingSlot::Item) { //bard songs should never come from items... - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id); + LogSpells("Bard Song Pulse [{}]: Supposidly cast from an item. Killing song", spell_id); return(false); } @@ -2502,12 +2502,12 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slo Mob *ae_center = nullptr; CastAction_type CastAction; if(!DetermineSpellTargets(spell_id, spell_target, ae_center, CastAction, slot)) { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: was unable to determine target. Stopping.", spell_id); + LogSpells("Bard Song Pulse [{}]: was unable to determine target. Stopping", spell_id); return(false); } if(ae_center != nullptr && ae_center->IsBeacon()) { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Unsupported Beacon NPC AE spell", spell_id); + LogSpells("Bard Song Pulse [{}]: Unsupported Beacon NPC AE spell", spell_id); return(false); } @@ -2516,18 +2516,18 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slo if(mana_used > 0) { if(mana_used > GetMana()) { //ran out of mana... this calls StopSong() for us - Log(Logs::Detail, Logs::Spells, "Ran out of mana while singing song %d", spell_id); + LogSpells("Ran out of mana while singing song [{}]", spell_id); return(false); } - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: consuming %d mana (have %d)", spell_id, mana_used, GetMana()); + LogSpells("Bard Song Pulse [{}]: consuming [{}] mana (have [{}])", spell_id, mana_used, GetMana()); SetMana(GetMana() - mana_used); } // check line of sight to target if it's a detrimental spell if(spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target)) { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: cannot see target %s", spell_target->GetName()); + LogSpells("Bard Song Pulse [{}]: cannot see target [{}]", spell_target->GetName()); MessageString(Chat::Red, CANT_SEE_TARGET); return(false); } @@ -2542,7 +2542,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slo float range2 = range * range; if(dist2 > range2) { //target is out of range. - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + LogSpells("Bard Song Pulse [{}]: Spell target is out of range (squared: [{}] > [{}])", spell_id, dist2, range2); MessageString(Chat::Red, TARGET_OUT_OF_RANGE); return(false); } @@ -2558,10 +2558,10 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slo case SingleTarget: { if(spell_target == nullptr) { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Targeted spell, but we have no target", spell_id); + LogSpells("Bard Song Pulse [{}]: Targeted spell, but we have no target", spell_id); return(false); } - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse: Targeted. spell %d, target %s", spell_id, spell_target->GetName()); + LogSpells("Bard Song Pulse: Targeted. spell [{}], target [{}]", spell_id, spell_target->GetName()); spell_target->BardPulse(spell_id, this); break; } @@ -2579,7 +2579,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slo { // we can't cast an AE spell without something to center it on if(ae_center == nullptr) { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: AE Targeted spell, but we have no target", spell_id); + LogSpells("Bard Song Pulse [{}]: AE Targeted spell, but we have no target", spell_id); return(false); } @@ -2587,9 +2587,9 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slo if(spell_target) { // this must be an AETarget spell // affect the target too spell_target->BardPulse(spell_id, this); - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, AE target %s", spell_id, spell_target->GetName()); + LogSpells("Bard Song Pulse: spell [{}], AE target [{}]", spell_id, spell_target->GetName()); } else { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, AE with no target", spell_id); + LogSpells("Bard Song Pulse: spell [{}], AE with no target", spell_id); } bool affect_caster = !IsNPC(); //NPC AE spells do not affect the NPC caster entity_list.AEBardPulse(this, ae_center, spell_id, affect_caster); @@ -2599,13 +2599,13 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slo case GroupSpell: { if(spell_target->IsGrouped()) { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, Group targeting group of %s", spell_id, spell_target->GetName()); + LogSpells("Bard Song Pulse: spell [{}], Group targeting group of [{}]", spell_id, spell_target->GetName()); Group *target_group = entity_list.GetGroupByMob(spell_target); if(target_group) target_group->GroupBardPulse(this, spell_id); } else if(spell_target->IsRaidGrouped() && spell_target->IsClient()) { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, Raid group targeting raid group of %s", spell_id, spell_target->GetName()); + LogSpells("Bard Song Pulse: spell [{}], Raid group targeting raid group of [{}]", spell_id, spell_target->GetName()); Raid *r = entity_list.GetRaidByClient(spell_target->CastToClient()); if(r){ uint32 gid = r->GetGroup(spell_target->GetName()); @@ -2622,7 +2622,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, CastingSlot slo } } else { - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse: spell %d, Group target without group. Affecting caster.", spell_id); + LogSpells("Bard Song Pulse: spell [{}], Group target without group. Affecting caster", spell_id); BardPulse(spell_id, this); #ifdef GROUP_BUFF_PETS if (GetPet() && HasPetAffinity() && !GetPet()->IsCharmed()) @@ -2648,13 +2648,13 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { if(buffs[buffs_i].spellid != spell_id) continue; if(buffs[buffs_i].casterid != caster->GetID()) { - Log(Logs::Detail, Logs::Spells, "Bard Pulse for %d: found buff from caster %d and we are pulsing for %d... are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); + LogSpells("Bard Pulse for [{}]: found buff from caster [{}] and we are pulsing for [{}] are there two bards playing the same song???", spell_id, buffs[buffs_i].casterid, caster->GetID()); return; } //extend the spell if it will expire before the next pulse if(buffs[buffs_i].ticsremaining <= 3) { buffs[buffs_i].ticsremaining += 3; - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: extending duration in slot %d to %d tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); + LogSpells("Bard Song Pulse [{}]: extending duration in slot [{}] to [{}] tics", spell_id, buffs_i, buffs[buffs_i].ticsremaining); } //should we send this buff update to the client... seems like it would @@ -2704,7 +2704,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { //we are done... return; } - Log(Logs::Detail, Logs::Spells, "Bard Song Pulse %d: Buff not found, reapplying spell.", spell_id); + LogSpells("Bard Song Pulse [{}]: Buff not found, reapplying spell", spell_id); //this spell is not affecting this mob, apply it. caster->SpellOnTarget(spell_id, this); } @@ -2750,7 +2750,7 @@ int Mob::CalcBuffDuration(Mob *caster, Mob *target, uint16 spell_id, int32 caste res = mod_buff_duration(res, caster, target, spell_id); - Log(Logs::Detail, Logs::Spells, "Spell %d: Casting level %d, formula %d, base_duration %d: result %d", + LogSpells("Spell [{}]: Casting level [{}], formula [{}], base_duration [{}]: result [{}]", spell_id, castlevel, formula, duration, res); return res; @@ -2841,24 +2841,24 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, int blocked_effect, blocked_below_value, blocked_slot; int overwrite_effect, overwrite_below_value, overwrite_slot; - Log(Logs::Detail, Logs::Spells, "Check Stacking on old %s (%d) @ lvl %d (by %s) vs. new %s (%d) @ lvl %d (by %s)", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); + LogSpells("Check Stacking on old [{}] ([{}]) @ lvl [{}] (by [{}]) vs. new [{}] ([{}]) @ lvl [{}] (by [{}])", sp1.name, spellid1, caster_level1, (caster1==nullptr)?"Nobody":caster1->GetName(), sp2.name, spellid2, caster_level2, (caster2==nullptr)?"Nobody":caster2->GetName()); if (spellid1 == spellid2 ) { if (!IsStackableDot(spellid1) && !IsEffectInSpell(spellid1, SE_ManaBurn)) { // mana burn spells we need to use the stacking command blocks live actually checks those first, we should probably rework to that too if (caster_level1 > caster_level2) { // cur buff higher level than new if (IsEffectInSpell(spellid1, SE_ImprovedTaunt)) { - Log(Logs::Detail, Logs::Spells, "SE_ImprovedTaunt level exception, overwriting."); + LogSpells("SE_ImprovedTaunt level exception, overwriting"); return 1; } else { - Log(Logs::Detail, Logs::Spells, "Spells the same but existing is higher level, stopping."); + LogSpells("Spells the same but existing is higher level, stopping"); return -1; } } else { - Log(Logs::Detail, Logs::Spells, "Spells the same but newer is higher or equal level, overwriting."); + LogSpells("Spells the same but newer is higher or equal level, overwriting"); return 1; } } else if (spellid1 == 2751) { - Log(Logs::Detail, Logs::Spells, "Blocking spell because manaburn does not stack with itself."); + LogSpells("Blocking spell because manaburn does not stack with itself"); return -1; } } @@ -2873,7 +2873,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { if(!IsDetrimentalSpell(spellid1) && !IsDetrimentalSpell(spellid2)) { - Log(Logs::Detail, Logs::Spells, "%s and %s are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); + LogSpells("[{}] and [{}] are beneficial, and one is a bard song, no action needs to be taken", sp1.name, sp2.name); return (0); } } @@ -2888,7 +2888,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, } } } else if (IsEffectInSpell(spellid1, SE_ManaBurn)) { - Log(Logs::Detail, Logs::Spells, "We have a Mana Burn spell that is the same, they won't stack"); + LogSpells("We have a Mana Burn spell that is the same, they won't stack"); return -1; } @@ -2946,16 +2946,16 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp1_value = CalcSpellEffectValue(spellid1, overwrite_slot, caster_level1); - Log(Logs::Detail, Logs::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d. Old spell has value %d on that slot/effect. %s.", + LogSpells("[{}] ([{}]) overwrites existing spell if effect [{}] on slot [{}] is below [{}]. Old spell has value [{}] on that slot/effect. [{}]", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value, sp1_value, (sp1_value < overwrite_below_value)?"Overwriting":"Not overwriting"); if(sp1_value < overwrite_below_value) { - Log(Logs::Detail, Logs::Spells, "Overwrite spell because sp1_value < overwrite_below_value"); + LogSpells("Overwrite spell because sp1_value < overwrite_below_value"); return 1; // overwrite spell if its value is less } } else { - Log(Logs::Detail, Logs::Spells, "%s (%d) overwrites existing spell if effect %d on slot %d is below %d, but we do not have that effect on that slot. Ignored.", + LogSpells("[{}] ([{}]) overwrites existing spell if effect [{}] on slot [{}] is below [{}], but we do not have that effect on that slot. Ignored", sp2.name, spellid2, overwrite_effect, overwrite_slot, overwrite_below_value); } @@ -2969,22 +2969,22 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, { sp2_value = CalcSpellEffectValue(spellid2, blocked_slot, caster_level2); - Log(Logs::Detail, Logs::Spells, "%s (%d) blocks effect %d on slot %d below %d. New spell has value %d on that slot/effect. %s.", + LogSpells("[{}] ([{}]) blocks effect [{}] on slot [{}] below [{}]. New spell has value [{}] on that slot/effect. [{}]", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value, sp2_value, (sp2_value < blocked_below_value)?"Blocked":"Not blocked"); if (sp2_value < blocked_below_value) { - Log(Logs::Detail, Logs::Spells, "Blocking spell because sp2_Value < blocked_below_value"); + LogSpells("Blocking spell because sp2_Value < blocked_below_value"); return -1; //blocked } } else { - Log(Logs::Detail, Logs::Spells, "%s (%d) blocks effect %d on slot %d below %d, but we do not have that effect on that slot. Ignored.", + LogSpells("[{}] ([{}]) blocks effect [{}] on slot [{}] below [{}], but we do not have that effect on that slot. Ignored", sp1.name, spellid1, blocked_effect, blocked_slot, blocked_below_value); } } } } else { - Log(Logs::Detail, Logs::Spells, "%s (%d) and %s (%d) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", + LogSpells("[{}] ([{}]) and [{}] ([{}]) appear to be in the same line, skipping Stacking Overwrite/Blocking checks", sp1.name, spellid1, sp2.name, spellid2); } @@ -3037,13 +3037,13 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, */ if(IsNPC() && caster1 && caster2 && caster1 != caster2) { if(effect1 == SE_CurrentHP && sp1_detrimental && sp2_detrimental) { - Log(Logs::Detail, Logs::Spells, "Both casters exist and are not the same, the effect is a detrimental dot, moving on"); + LogSpells("Both casters exist and are not the same, the effect is a detrimental dot, moving on"); continue; } } if(effect1 == SE_CompleteHeal){ //SE_CompleteHeal never stacks or overwrites ever, always block. - Log(Logs::Detail, Logs::Spells, "Blocking spell because complete heal never stacks or overwries"); + LogSpells("Blocking spell because complete heal never stacks or overwries"); return (-1); } @@ -3052,7 +3052,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, and the effect is a dot we can go ahead and stack it */ if(effect1 == SE_CurrentHP && spellid1 != spellid2 && sp1_detrimental && sp2_detrimental) { - Log(Logs::Detail, Logs::Spells, "The spells are not the same and it is a detrimental dot, passing"); + LogSpells("The spells are not the same and it is a detrimental dot, passing"); continue; } @@ -3077,7 +3077,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, sp2_value = 0 - sp2_value; if(sp2_value < sp1_value) { - Log(Logs::Detail, Logs::Spells, "Spell %s (value %d) is not as good as %s (value %d). Rejecting %s.", + LogSpells("Spell [{}] (value [{}]) is not as good as [{}] (value [{}]). Rejecting [{}]", sp2.name, sp2_value, sp1.name, sp1_value, sp2.name); return -1; // can't stack } @@ -3086,7 +3086,7 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //we dont return here... a better value on this one effect dosent mean they are //all better... - Log(Logs::Detail, Logs::Spells, "Spell %s (value %d) is not as good as %s (value %d). We will overwrite %s if there are no other conflicts.", + LogSpells("Spell [{}] (value [{}]) is not as good as [{}] (value [{}]). We will overwrite [{}] if there are no other conflicts", sp1.name, sp1_value, sp2.name, sp2_value, sp1.name); will_overwrite = true; } @@ -3095,15 +3095,15 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2, //so now we see if this new spell is any better, or if its not related at all if(will_overwrite) { if (values_equal && effect_match && !IsGroupSpell(spellid2) && IsGroupSpell(spellid1)) { - Log(Logs::Detail, Logs::Spells, "%s (%d) appears to be the single target version of %s (%d), rejecting", + LogSpells("[{}] ([{}]) appears to be the single target version of [{}] ([{}]), rejecting", sp2.name, spellid2, sp1.name, spellid1); return -1; } - Log(Logs::Detail, Logs::Spells, "Stacking code decided that %s should overwrite %s.", sp2.name, sp1.name); + LogSpells("Stacking code decided that [{}] should overwrite [{}]", sp2.name, sp1.name); return(1); } - Log(Logs::Detail, Logs::Spells, "Stacking code decided that %s is not affected by %s.", sp2.name, sp1.name); + LogSpells("Stacking code decided that [{}] is not affected by [{}]", sp2.name, sp1.name); return 0; } @@ -3196,11 +3196,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } if (duration == 0) { - Log(Logs::Detail, Logs::Spells, "Buff %d failed to add because its duration came back as 0.", spell_id); + LogSpells("Buff [{}] failed to add because its duration came back as 0", spell_id); return -2; // no duration? this isn't a buff } - Log(Logs::Detail, Logs::Spells, "Trying to add buff %d cast by %s (cast level %d) with duration %d", + LogSpells("Trying to add buff [{}] cast by [{}] (cast level [{}]) with duration [{}]", spell_id, caster?caster->GetName():"UNKNOWN", caster_level, duration); // first we loop through everything checking that the spell @@ -3220,7 +3220,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid ret = CheckStackConflict(curbuf.spellid, curbuf.casterlevel, spell_id, caster_level, entity_list.GetMobID(curbuf.casterid), caster, buffslot); if (ret == -1) { // stop the spell - Log(Logs::Detail, Logs::Spells, "Adding buff %d failed: stacking prevented by spell %d in slot %d with caster level %d", + LogSpells("Adding buff [{}] failed: stacking prevented by spell [{}] in slot [{}] with caster level [{}]", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); if (caster && caster->IsClient() && RuleB(Client, UseLiveBlockedMessage)) { caster->Message(Chat::Red, "Your %s did not take hold on %s. (Blocked by %s.)", spells[spell_id].name, this->GetName(), spells[curbuf.spellid].name); @@ -3228,7 +3228,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid return -1; } if (ret == 1) { // set a flag to indicate that there will be overwriting - Log(Logs::Detail, Logs::Spells, "Adding buff %d will overwrite spell %d in slot %d with caster level %d", + LogSpells("Adding buff [{}] will overwrite spell [{}] in slot [{}] with caster level [{}]", spell_id, curbuf.spellid, buffslot, curbuf.casterlevel); // If this is the first buff it would override, use its slot if (!will_overwrite && !IsDisciplineBuff(spell_id)) @@ -3252,7 +3252,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid for (buffslot = 0; buffslot < buff_count; buffslot++) { const Buffs_Struct &curbuf = buffs[buffslot]; if (IsBeneficialSpell(curbuf.spellid)) { - Log(Logs::Detail, Logs::Spells, "No slot for detrimental buff %d, so we are overwriting a beneficial buff %d in slot %d", + LogSpells("No slot for detrimental buff [{}], so we are overwriting a beneficial buff [{}] in slot [{}]", spell_id, curbuf.spellid, buffslot); BuffFadeBySlot(buffslot, false); emptyslot = buffslot; @@ -3260,11 +3260,11 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid } } if(emptyslot == -1) { - Log(Logs::Detail, Logs::Spells, "Unable to find a buff slot for detrimental buff %d", spell_id); + LogSpells("Unable to find a buff slot for detrimental buff [{}]", spell_id); return -1; } } else { - Log(Logs::Detail, Logs::Spells, "Unable to find a buff slot for beneficial buff %d", spell_id); + LogSpells("Unable to find a buff slot for beneficial buff [{}]", spell_id); return -1; } } @@ -3316,7 +3316,7 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid buffs[emptyslot].UpdateClient = true; } - Log(Logs::Detail, Logs::Spells, "Buff %d added to slot %d with caster level %d", spell_id, emptyslot, caster_level); + LogSpells("Buff [{}] added to slot [{}] with caster level [{}]", spell_id, emptyslot, caster_level); if (IsPet() && GetOwner() && GetOwner()->IsClient()) SendPetBuffsToClient(); @@ -3423,7 +3423,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r // well we can't cast a spell on target without a target if(!spelltar) { - Log(Logs::Detail, Logs::Spells, "Unable to apply spell %d without a target", spell_id); + LogSpells("Unable to apply spell [{}] without a target", spell_id); Message(Chat::Red, "SOT: You must have a target for this spell."); return false; } @@ -3457,7 +3457,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r uint16 caster_level = level_override > 0 ? level_override : GetCasterLevel(spell_id); - Log(Logs::Detail, Logs::Spells, "Casting spell %d on %s with effective caster level %d", spell_id, spelltar->GetName(), caster_level); + LogSpells("Casting spell [{}] on [{}] with effective caster level [{}]", spell_id, spelltar->GetName(), caster_level); // Actual cast action - this causes the caster animation and the particles // around the target @@ -3548,7 +3548,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r if (RuleB(Spells, EnableBlockedBuffs)) { // We return true here since the caster's client should act like normal if (spelltar->IsBlockedBuff(spell_id)) { - Log(Logs::Detail, Logs::Spells, "Spell %i not applied to %s as it is a Blocked Buff.", + LogSpells("Spell [{}] not applied to [{}] as it is a Blocked Buff", spell_id, spelltar->GetName()); safe_delete(action_packet); return true; @@ -3556,7 +3556,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r if (spelltar->IsPet() && spelltar->GetOwner() && spelltar->GetOwner()->IsBlockedPetBuff(spell_id)) { - Log(Logs::Detail, Logs::Spells, "Spell %i not applied to %s (%s's pet) as it is a Pet Blocked Buff.", + LogSpells("Spell [{}] not applied to [{}] ([{}]'s pet) as it is a Pet Blocked Buff", spell_id, spelltar->GetName(), spelltar->GetOwner()->GetName()); safe_delete(action_packet); return true; @@ -3565,7 +3565,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r // invuln mobs can't be affected by any spells, good or bad if(spelltar->GetInvul() || spelltar->DivineAura()) { - Log(Logs::Detail, Logs::Spells, "Casting spell %d on %s aborted: they are invulnerable.", spell_id, spelltar->GetName()); + LogSpells("Casting spell [{}] on [{}] aborted: they are invulnerable", spell_id, spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3576,17 +3576,17 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r if (RuleB(Pets, UnTargetableSwarmPet)) { if (spelltar->IsNPC()) { if (!spelltar->CastToNPC()->GetSwarmOwner()) { - Log(Logs::Detail, Logs::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + LogSpells("Casting spell [{}] on [{}] aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - Log(Logs::Detail, Logs::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + LogSpells("Casting spell [{}] on [{}] aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } } else { - Log(Logs::Detail, Logs::Spells, "Casting spell %d on %s aborted: they are untargetable", spell_id, spelltar->GetName()); + LogSpells("Casting spell [{}] on [{}] aborted: they are untargetable", spell_id, spelltar->GetName()); safe_delete(action_packet); return(false); } @@ -3695,9 +3695,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r { if(spells[spell_id].targettype == ST_AEBard) { //if it was a beneficial AE bard song don't spam the window that it would not hold - Log(Logs::Detail, Logs::Spells, "Beneficial ae bard song %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + LogSpells("Beneficial ae bard song [{}] can't take hold [{}] -> [{}], IBA? [{}]", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); } else { - Log(Logs::Detail, Logs::Spells, "Beneficial spell %d can't take hold %s -> %s, IBA? %d", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); + LogSpells("Beneficial spell [{}] can't take hold [{}] -> [{}], IBA? [{}]", spell_id, GetName(), spelltar->GetName(), IsBeneficialAllowed(spelltar)); MessageString(Chat::SpellFailure, SPELL_NO_HOLD); } safe_delete(action_packet); @@ -3707,7 +3707,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r } else if ( !IsAttackAllowed(spelltar, true) && !IsResurrectionEffects(spell_id)) // Detrimental spells - PVP check { - Log(Logs::Detail, Logs::Spells, "Detrimental spell %d can't take hold %s -> %s", spell_id, GetName(), spelltar->GetName()); + LogSpells("Detrimental spell [{}] can't take hold [{}] -> [{}]", spell_id, GetName(), spelltar->GetName()); spelltar->MessageString(Chat::SpellFailure, YOU_ARE_PROTECTED, GetCleanName()); safe_delete(action_packet); return false; @@ -3721,7 +3721,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r if(spelltar->IsImmuneToSpell(spell_id, this)) { //the above call does the message to the client if needed - Log(Logs::Detail, Logs::Spells, "Spell %d can't take hold due to immunity %s -> %s", spell_id, GetName(), spelltar->GetName()); + LogSpells("Spell [{}] can't take hold due to immunity [{}] -> [{}]", spell_id, GetName(), spelltar->GetName()); safe_delete(action_packet); return false; } @@ -3834,7 +3834,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r { if(spell_effectiveness == 0 || !IsPartialCapableSpell(spell_id) ) { - Log(Logs::Detail, Logs::Spells, "Spell %d was completely resisted by %s", spell_id, spelltar->GetName()); + LogSpells("Spell [{}] was completely resisted by [{}]", spell_id, spelltar->GetName()); if (spells[spell_id].resisttype == RESIST_PHYSICAL){ MessageString(Chat::SpellFailure, PHYSICAL_RESIST_FAIL,spells[spell_id].name); @@ -3886,7 +3886,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r if (spelltar->IsAIControlled() && IsDetrimentalSpell(spell_id) && !IsHarmonySpell(spell_id)) { int32 aggro_amount = CheckAggroAmount(spell_id, spelltar, isproc); - Log(Logs::Detail, Logs::Spells, "Spell %d cast on %s generated %d hate", spell_id, + LogSpells("Spell [{}] cast on [{}] generated [{}] hate", spell_id, spelltar->GetName(), aggro_amount); if (aggro_amount > 0) { spelltar->AddToHateList(this, aggro_amount); @@ -3905,7 +3905,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r // make sure spelltar is high enough level for the buff if(RuleB(Spells, BuffLevelRestrictions) && !spelltar->CheckSpellLevelRestriction(spell_id)) { - Log(Logs::Detail, Logs::Spells, "Spell %d failed: recipient did not meet the level restrictions", spell_id); + LogSpells("Spell [{}] failed: recipient did not meet the level restrictions", spell_id); if(!IsBardSong(spell_id)) MessageString(Chat::SpellFailure, SPELL_TOO_POWERFUL); safe_delete(action_packet); @@ -3917,7 +3917,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r { // if SpellEffect returned false there's a problem applying the // spell. It's most likely a buff that can't stack. - Log(Logs::Detail, Logs::Spells, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); + LogSpells("Spell [{}] could not apply its effects [{}] -> [{}]\n", spell_id, GetName(), spelltar->GetName()); if(casting_spell_aa_id) MessageString(Chat::SpellFailure, SPELL_NO_HOLD); safe_delete(action_packet); @@ -3988,14 +3988,14 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r safe_delete(action_packet); safe_delete(message_packet); - Log(Logs::Detail, Logs::Spells, "Cast of %d by %s on %s complete successfully.", spell_id, GetName(), spelltar->GetName()); + LogSpells("Cast of [{}] by [{}] on [{}] complete successfully", spell_id, GetName(), spelltar->GetName()); return true; } void Corpse::CastRezz(uint16 spellid, Mob* Caster) { - Log(Logs::Detail, Logs::Spells, "Corpse::CastRezz spellid %i, Rezzed() is %i, rezzexp is %i", spellid,IsRezzed(),rez_experience); + LogSpells("Corpse::CastRezz spellid [{}], Rezzed() is [{}], rezzexp is [{}]", spellid,IsRezzed(),rez_experience); if(IsRezzed()){ if(Caster && Caster->IsClient()) @@ -4222,7 +4222,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) //this spell like 10 times, this could easily be consolidated //into one loop through with a switch statement. - Log(Logs::Detail, Logs::Spells, "Checking to see if we are immune to spell %d cast by %s", spell_id, caster->GetName()); + LogSpells("Checking to see if we are immune to spell [{}] cast by [{}]", spell_id, caster->GetName()); if(!IsValidSpell(spell_id)) return true; @@ -4233,7 +4233,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(IsMezSpell(spell_id)) { if(GetSpecialAbility(UNMEZABLE)) { - Log(Logs::Detail, Logs::Spells, "We are immune to Mez spells."); + LogSpells("We are immune to Mez spells"); caster->MessageString(Chat::SpellFailure, CANNOT_MEZ); int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { @@ -4251,7 +4251,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if((GetLevel() > spells[spell_id].max[effect_index]) && (!caster->IsNPC() || (caster->IsNPC() && !RuleB(Spells, NPCIgnoreBaseImmunity)))) { - Log(Logs::Detail, Logs::Spells, "Our level (%d) is higher than the limit of this Mez spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + LogSpells("Our level ([{}]) is higher than the limit of this Mez spell ([{}])", GetLevel(), spells[spell_id].max[effect_index]); caster->MessageString(Chat::SpellFailure, CANNOT_MEZ_WITH_SPELL); AddToHateList(caster, 1,0,true,false,false,spell_id); return true; @@ -4261,7 +4261,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) // slow and haste spells if(GetSpecialAbility(UNSLOWABLE) && IsEffectInSpell(spell_id, SE_AttackSpeed)) { - Log(Logs::Detail, Logs::Spells, "We are immune to Slow spells."); + LogSpells("We are immune to Slow spells"); caster->MessageString(Chat::Red, IMMUNE_ATKSPEED); int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { @@ -4277,7 +4277,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { effect_index = GetSpellEffectIndex(spell_id, SE_Fear); if(GetSpecialAbility(UNFEARABLE)) { - Log(Logs::Detail, Logs::Spells, "We are immune to Fear spells."); + LogSpells("We are immune to Fear spells"); caster->MessageString(Chat::Red, IMMUNE_FEAR); // need to verify message type, not in MQ2Cast for easy look up int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { @@ -4288,13 +4288,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) return true; } else if(IsClient() && caster->IsClient() && (caster->CastToClient()->GetGM() == false)) { - Log(Logs::Detail, Logs::Spells, "Clients cannot fear eachother!"); + LogSpells("Clients cannot fear eachother!"); caster->MessageString(Chat::Red, IMMUNE_FEAR); // need to verify message type, not in MQ2Cast for easy look up return true; } else if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - Log(Logs::Detail, Logs::Spells, "Level is %d, cannot be feared by this spell.", GetLevel()); + LogSpells("Level is [{}], cannot be feared by this spell", GetLevel()); caster->MessageString(Chat::Shout, FEAR_TOO_HIGH); int32 aggro = caster->CheckAggroAmount(spell_id, this); if (aggro > 0) { @@ -4307,7 +4307,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) else if (CheckAATimer(aaTimerWarcry)) { Message(Chat::Red, "Your are immune to fear."); - Log(Logs::Detail, Logs::Spells, "Clients has WarCry effect, immune to fear!"); + LogSpells("Clients has WarCry effect, immune to fear!"); caster->MessageString(Chat::Red, IMMUNE_FEAR); // need to verify message type, not in MQ2Cast for easy look up return true; } @@ -4317,7 +4317,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(GetSpecialAbility(UNCHARMABLE)) { - Log(Logs::Detail, Logs::Spells, "We are immune to Charm spells."); + LogSpells("We are immune to Charm spells"); caster->MessageString(Chat::Red, CANNOT_CHARM); // need to verify message type, not in MQ2Cast for easy look up int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { @@ -4330,7 +4330,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) if(this == caster) { - Log(Logs::Detail, Logs::Spells, "You are immune to your own charms."); + LogSpells("You are immune to your own charms"); caster->Message(Chat::Red, "You cannot charm yourself."); // need to look up message? return true; } @@ -4343,7 +4343,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) assert(effect_index >= 0); if(GetLevel() > spells[spell_id].max[effect_index] && spells[spell_id].max[effect_index] != 0) { - Log(Logs::Detail, Logs::Spells, "Our level (%d) is higher than the limit of this Charm spell (%d)", GetLevel(), spells[spell_id].max[effect_index]); + LogSpells("Our level ([{}]) is higher than the limit of this Charm spell ([{}])", GetLevel(), spells[spell_id].max[effect_index]); caster->MessageString(Chat::Red, CANNOT_CHARM_YET); // need to verify message type, not in MQ2Cast for easy look up AddToHateList(caster, 1,0,true,false,false,spell_id); return true; @@ -4358,7 +4358,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) ) { if(GetSpecialAbility(UNSNAREABLE)) { - Log(Logs::Detail, Logs::Spells, "We are immune to Snare spells."); + LogSpells("We are immune to Snare spells"); caster->MessageString(Chat::Red, IMMUNE_MOVEMENT); int32 aggro = caster->CheckAggroAmount(spell_id, this); if(aggro > 0) { @@ -4374,7 +4374,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - Log(Logs::Detail, Logs::Spells, "You cannot lifetap yourself."); + LogSpells("You cannot lifetap yourself"); caster->MessageString(Chat::SpellFailure, CANT_DRAIN_SELF); return true; } @@ -4384,13 +4384,13 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster) { if(this == caster) { - Log(Logs::Detail, Logs::Spells, "You cannot sacrifice yourself."); + LogSpells("You cannot sacrifice yourself"); caster->MessageString(Chat::SpellFailure, CANNOT_SAC_SELF); return true; } } - Log(Logs::Detail, Logs::Spells, "No immunities to spell %d found.", spell_id); + LogSpells("No immunities to spell [{}] found", spell_id); return false; } @@ -4457,7 +4457,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use if(GetSpecialAbility(IMMUNE_MAGIC)) { - Log(Logs::Detail, Logs::Spells, "We are immune to magic, so we fully resist the spell %d", spell_id); + LogSpells("We are immune to magic, so we fully resist the spell [{}]", spell_id); return(0); } @@ -4478,7 +4478,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int fear_resist_bonuses = CalcFearResistChance(); if(zone->random.Roll(fear_resist_bonuses)) { - Log(Logs::Detail, Logs::Spells, "Resisted spell in fear resistance, had %d chance to resist", fear_resist_bonuses); + LogSpells("Resisted spell in fear resistance, had [{}] chance to resist", fear_resist_bonuses); return 0; } } @@ -4496,7 +4496,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use int resist_bonuses = CalcResistChanceBonus(); if(resist_bonuses && zone->random.Roll(resist_bonuses)) { - Log(Logs::Detail, Logs::Spells, "Resisted spell in sanctification, had %d chance to resist", resist_bonuses); + LogSpells("Resisted spell in sanctification, had [{}] chance to resist", resist_bonuses); return 0; } } @@ -4504,7 +4504,7 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use //Get the resist chance for the target if(resist_type == RESIST_NONE || spells[spell_id].no_resist) { - Log(Logs::Detail, Logs::Spells, "Spell was unresistable"); + LogSpells("Spell was unresistable"); return 100; } @@ -5022,7 +5022,7 @@ void Client::MemSpell(uint16 spell_id, int slot, bool update_client) } m_pp.mem_spells[slot] = spell_id; - Log(Logs::Detail, Logs::Spells, "Spell %d memorized into slot %d", spell_id, slot); + LogSpells("Spell [{}] memorized into slot [{}]", spell_id, slot); database.SaveCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -5037,7 +5037,7 @@ void Client::UnmemSpell(int slot, bool update_client) if(slot > EQEmu::spells::SPELL_GEM_COUNT || slot < 0) return; - Log(Logs::Detail, Logs::Spells, "Spell %d forgotten from slot %d", m_pp.mem_spells[slot], slot); + LogSpells("Spell [{}] forgotten from slot [{}]", m_pp.mem_spells[slot], slot); m_pp.mem_spells[slot] = 0xFFFFFFFF; database.DeleteCharacterMemorizedSpell(this->CharacterID(), m_pp.mem_spells[slot], slot); @@ -5097,7 +5097,7 @@ void Client::ScribeSpell(uint16 spell_id, int slot, bool update_client) m_pp.spell_book[slot] = spell_id; database.SaveCharacterSpell(this->CharacterID(), spell_id, slot); - Log(Logs::Detail, Logs::Spells, "Spell %d scribed into spell book slot %d", spell_id, slot); + LogSpells("Spell [{}] scribed into spell book slot [{}]", spell_id, slot); if(update_client) { @@ -5110,7 +5110,7 @@ void Client::UnscribeSpell(int slot, bool update_client) if(slot >= EQEmu::spells::SPELLBOOK_SIZE || slot < 0) return; - Log(Logs::Detail, Logs::Spells, "Spell %d erased from spell book slot %d", m_pp.spell_book[slot], slot); + LogSpells("Spell [{}] erased from spell book slot [{}]", m_pp.spell_book[slot], slot); m_pp.spell_book[slot] = 0xFFFFFFFF; database.DeleteCharacterSpell(this->CharacterID(), m_pp.spell_book[slot], slot); @@ -5139,7 +5139,7 @@ void Client::UntrainDisc(int slot, bool update_client) if(slot >= MAX_PP_DISCIPLINES || slot < 0) return; - Log(Logs::Detail, Logs::Spells, "Discipline %d untrained from slot %d", m_pp.disciplines.values[slot], slot); + LogSpells("Discipline [{}] untrained from slot [{}]", m_pp.disciplines.values[slot], slot); m_pp.disciplines.values[slot] = 0; database.DeleteCharacterDisc(this->CharacterID(), slot); @@ -5387,12 +5387,12 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b PermaProcs[i].chance = iChance; PermaProcs[i].base_spellID = base_spell_id; PermaProcs[i].level_override = level_override; - Log(Logs::Detail, Logs::Spells, "Added permanent proc spell %d with chance %d to slot %d", spell_id, iChance, i); + LogSpells("Added permanent proc spell [{}] with chance [{}] to slot [{}]", spell_id, iChance, i); return true; } } - Log(Logs::Detail, Logs::Spells, "Too many perma procs for %s", GetName()); + LogSpells("Too many perma procs for [{}]", GetName()); } else { for (i = 0; i < MAX_PROCS; i++) { if (SpellProcs[i].spellID == SPELL_UNKNOWN) { @@ -5400,11 +5400,11 @@ bool Mob::AddProcToWeapon(uint16 spell_id, bool bPerma, uint16 iChance, uint16 b SpellProcs[i].chance = iChance; SpellProcs[i].base_spellID = base_spell_id;; SpellProcs[i].level_override = level_override; - Log(Logs::Detail, Logs::Spells, "Added spell-granted proc spell %d with chance %d to slot %d", spell_id, iChance, i); + LogSpells("Added spell-granted proc spell [{}] with chance [{}] to slot [{}]", spell_id, iChance, i); return true; } } - Log(Logs::Detail, Logs::Spells, "Too many procs for %s", GetName()); + LogSpells("Too many procs for [{}]", GetName()); } return false; } @@ -5416,7 +5416,7 @@ bool Mob::RemoveProcFromWeapon(uint16 spell_id, bool bAll) { SpellProcs[i].chance = 0; SpellProcs[i].base_spellID = SPELL_UNKNOWN; SpellProcs[i].level_override = -1; - Log(Logs::Detail, Logs::Spells, "Removed proc %d from slot %d", spell_id, i); + LogSpells("Removed proc [{}] from slot [{}]", spell_id, i); } } return true; @@ -5433,7 +5433,7 @@ bool Mob::AddDefensiveProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id DefensiveProcs[i].spellID = spell_id; DefensiveProcs[i].chance = iChance; DefensiveProcs[i].base_spellID = base_spell_id; - Log(Logs::Detail, Logs::Spells, "Added spell-granted defensive proc spell %d with chance %d to slot %d", spell_id, iChance, i); + LogSpells("Added spell-granted defensive proc spell [{}] with chance [{}] to slot [{}]", spell_id, iChance, i); return true; } } @@ -5448,7 +5448,7 @@ bool Mob::RemoveDefensiveProc(uint16 spell_id, bool bAll) DefensiveProcs[i].spellID = SPELL_UNKNOWN; DefensiveProcs[i].chance = 0; DefensiveProcs[i].base_spellID = SPELL_UNKNOWN; - Log(Logs::Detail, Logs::Spells, "Removed defensive proc %d from slot %d", spell_id, i); + LogSpells("Removed defensive proc [{}] from slot [{}]", spell_id, i); } } return true; @@ -5465,7 +5465,7 @@ bool Mob::AddRangedProc(uint16 spell_id, uint16 iChance, uint16 base_spell_id) RangedProcs[i].spellID = spell_id; RangedProcs[i].chance = iChance; RangedProcs[i].base_spellID = base_spell_id; - Log(Logs::Detail, Logs::Spells, "Added spell-granted ranged proc spell %d with chance %d to slot %d", spell_id, iChance, i); + LogSpells("Added spell-granted ranged proc spell [{}] with chance [{}] to slot [{}]", spell_id, iChance, i); return true; } } @@ -5480,7 +5480,7 @@ bool Mob::RemoveRangedProc(uint16 spell_id, bool bAll) RangedProcs[i].spellID = SPELL_UNKNOWN; RangedProcs[i].chance = 0; RangedProcs[i].base_spellID = SPELL_UNKNOWN;; - Log(Logs::Detail, Logs::Spells, "Removed ranged proc %d from slot %d", spell_id, i); + LogSpells("Removed ranged proc [{}] from slot [{}]", spell_id, i); } } return true; @@ -5511,7 +5511,7 @@ bool Mob::UseBardSpellLogic(uint16 spell_id, int slot) int Mob::GetCasterLevel(uint16 spell_id) { int level = GetLevel(); level += itembonuses.effective_casting_level + spellbonuses.effective_casting_level + aabonuses.effective_casting_level; - Log(Logs::Detail, Logs::Spells, "Determined effective casting level %d+%d+%d=%d", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); + LogSpells("Determined effective casting level [{}]+[{}]+[{}]=[{}]", GetLevel(), spellbonuses.effective_casting_level, itembonuses.effective_casting_level, level); return std::max(1, level); } @@ -5947,7 +5947,7 @@ void Client::SetLinkedSpellReuseTimer(uint32 timer_id, uint32 duration) { if (timer_id > 19) return; - Log(Logs::Detail, Logs::Spells, "Setting Linked Spell Reuse %d for %d", timer_id, duration); + LogSpells("Setting Linked Spell Reuse [{}] for [{}]", timer_id, duration); GetPTimers().Start(pTimerLinkedSpellReuseStart + timer_id, duration); auto outapp = new EQApplicationPacket(OP_LinkedReuse, sizeof(LinkedSpellReuseTimer_Struct)); auto lr = (LinkedSpellReuseTimer_Struct *)outapp->pBuffer; diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index c6ae6a621..65793d0f5 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -747,7 +747,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) //pendingrezexp is the amount of XP on the corpse. Setting it to a value >= 0 //also serves to inform Client::OPRezzAnswer to expect a packet. client->SetPendingRezzData(srs->exp, srs->dbid, srs->rez.spellid, srs->rez.corpse_name); - Log(Logs::Detail, Logs::Spells, "OP_RezzRequest in zone %s for %s, spellid:%i", + LogSpells("OP_RezzRequest in zone [{}] for [{}], spellid:[{}]", zone->GetShortName(), client->GetName(), srs->rez.spellid); auto outapp = new EQApplicationPacket(OP_RezzRequest, sizeof(Resurrect_Struct)); @@ -762,10 +762,10 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) // to the zone that the corpse is in. Corpse* corpse = entity_list.GetCorpseByName(srs->rez.corpse_name); if (corpse && corpse->IsCorpse()) { - Log(Logs::Detail, Logs::Spells, "OP_RezzComplete received in zone %s for corpse %s", + LogSpells("OP_RezzComplete received in zone [{}] for corpse [{}]", zone->GetShortName(), srs->rez.corpse_name); - Log(Logs::Detail, Logs::Spells, "Found corpse. Marking corpse as rezzed if needed."); + LogSpells("Found corpse. Marking corpse as rezzed if needed"); // I don't know why Rezzed is not set to true in CompleteRezz(). if (!IsEffectInSpell(srs->rez.spellid, SE_SummonToCorpse)) { corpse->IsRezzed(true); @@ -2103,7 +2103,7 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode) { - Log(Logs::Detail, Logs::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp); + LogSpells("WorldServer::RezzPlayer rezzexp is [{}] (0 is normal for RezzComplete", rezzexp); auto pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct)); RezzPlayer_Struct* sem = (RezzPlayer_Struct*)pack->pBuffer; sem->rezzopcode = opcode; @@ -2112,9 +2112,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 sem->dbid = dbid; bool ret = SendPacket(pack); if (ret) - Log(Logs::Detail, Logs::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid); + LogSpells("Sending player rezz packet to world spellid:[{}]", sem->rez.spellid); else - Log(Logs::Detail, Logs::Spells, "NOT Sending player rezz packet to world"); + LogSpells("NOT Sending player rezz packet to world"); safe_delete(pack); return ret;