[Performance] Reworked how all log calls are made in the source, see changelog.txt for more details

This commit is contained in:
Akkadius
2017-04-01 03:51:46 -05:00
parent 93a6efa95f
commit 7aa1d243b0
131 changed files with 3126 additions and 3066 deletions
+71 -71
View File
@@ -58,7 +58,7 @@ bool Mob::AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const
if (weapon && weapon->IsClassCommon()) {
const EQEmu::ItemData* item = weapon->GetItem();
Log.Out(Logs::Detail, Logs::Attack, "Weapon skill : %i", item->ItemType);
Log(Logs::Detail, Logs::Attack, "Weapon skill : %i", item->ItemType);
switch (item->ItemType) {
case EQEmu::item::ItemType1HSlash: // 1H Slashing
@@ -271,7 +271,7 @@ bool Mob::CheckHitChance(Mob* other, DamageHitInfo &hit)
{
Mob *attacker = other;
Mob *defender = this;
Log.Out(Logs::Detail, Logs::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName());
Log(Logs::Detail, Logs::Attack, "CheckHitChance(%s) attacked by %s", defender->GetName(), attacker->GetName());
if (defender->IsClient() && defender->CastToClient()->IsSitting())
return true;
@@ -289,7 +289,7 @@ bool Mob::CheckHitChance(Mob* other, DamageHitInfo &hit)
// Then your chance to simply avoid the attack is checked (defender's avoidance roll beat the attacker's accuracy roll.)
int tohit_roll = zone->random.Roll0(accuracy);
int avoid_roll = zone->random.Roll0(avoidance);
Log.Out(Logs::Detail, Logs::Attack, "CheckHitChance accuracy(%d => %d) avoidance(%d => %d)", accuracy, tohit_roll, avoidance, avoid_roll);
Log(Logs::Detail, Logs::Attack, "CheckHitChance accuracy(%d => %d) avoidance(%d => %d)", accuracy, tohit_roll, avoidance, avoid_roll);
// tie breaker? Don't want to be biased any one way
if (tohit_roll == avoid_roll)
@@ -363,7 +363,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
if (hit.hand != EQEmu::inventory::slotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) {
if (IsEnraged()) {
hit.damage_done = DMG_RIPOSTED;
Log.Out(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack.");
Log(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack.");
return true;
}
if (IsClient())
@@ -803,9 +803,9 @@ int Mob::ACSum()
auto over_cap = ac - softcap;
ac = softcap + (over_cap * returns);
}
Log.Out(Logs::Detail, Logs::Combat, "ACSum ac %d softcap %d returns %f", ac, softcap, returns);
Log(Logs::Detail, Logs::Combat, "ACSum ac %d softcap %d returns %f", ac, softcap, returns);
} else {
Log.Out(Logs::Detail, Logs::Combat, "ACSum ac %d", ac);
Log(Logs::Detail, Logs::Combat, "ACSum ac %d", ac);
}
return ac;
}
@@ -869,7 +869,7 @@ void Mob::MeleeMitigation(Mob *attacker, DamageHitInfo &hit, ExtraAttackOptions
// +0.5 for rounding, min to 1 dmg
hit.damage_done = std::max(static_cast<int>(roll * static_cast<double>(hit.base_damage) + 0.5), 1);
Log.Out(Logs::Detail, Logs::Attack, "mitigation %d vs offense %d. base %d rolled %f damage %d", mitigation, hit.offense, hit.base_damage, roll, hit.damage_done);
Log(Logs::Detail, Logs::Attack, "mitigation %d vs offense %d. base %d rolled %f damage %d", mitigation, hit.offense, hit.base_damage, roll, hit.damage_done);
}
//Returns the weapon damage against the input mob
@@ -1197,7 +1197,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
{
if (!other)
return;
Log.Out(Logs::Detail, Logs::Combat, "%s::DoAttack vs %s base %d min %d offense %d tohit %d skill %d", GetName(),
Log(Logs::Detail, Logs::Combat, "%s::DoAttack vs %s base %d min %d offense %d tohit %d skill %d", GetName(),
other->GetName(), hit.base_damage, hit.min_damage, hit.offense, hit.tohit, hit.skill);
// check to see if we hit..
if (other->AvoidDamage(this, hit)) {
@@ -1213,7 +1213,7 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
//if (IsDead())
return;
}
Log.Out(Logs::Detail, Logs::Combat, "Avoided/strikethrough damage with code %d", hit.damage_done);
Log(Logs::Detail, Logs::Combat, "Avoided/strikethrough damage with code %d", hit.damage_done);
}
if (hit.damage_done >= 0) {
@@ -1223,9 +1223,9 @@ void Mob::DoAttack(Mob *other, DamageHitInfo &hit, ExtraAttackOptions *opts)
ApplyDamageTable(hit);
CommonOutgoingHitSuccess(other, hit, opts);
}
Log.Out(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", hit.damage_done);
Log(Logs::Detail, Logs::Combat, "Final damage after all reductions: %d", hit.damage_done);
} else {
Log.Out(Logs::Detail, Logs::Combat, "Attack missed. Damage set to 0.");
Log(Logs::Detail, Logs::Combat, "Attack missed. Damage set to 0.");
hit.damage_done = 0;
}
}
@@ -1238,14 +1238,14 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
{
if (!other) {
SetTarget(nullptr);
Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Client::Attack() for evaluation!");
Log(Logs::General, Logs::Error, "A null Mob object was passed to Client::Attack() for evaluation!");
return false;
}
if(!GetTarget())
SetTarget(other);
Log.Out(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":"");
Log(Logs::Detail, Logs::Combat, "Attacking %s with hand %d %s", other?other->GetName():"(nullptr)", Hand, bRiposte?"(this is a riposte)":"");
//SetAttackTimer();
if (
@@ -1255,12 +1255,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
|| (GetHP() < 0)
|| (!IsAttackAllowed(other))
) {
Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, invalid circumstances.");
Log(Logs::Detail, Logs::Combat, "Attack canceled, invalid circumstances.");
return false; // Only bards can attack while casting
}
if(DivineAura() && !GetGM()) {//cant attack while invulnerable unless your a gm
Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect.");
Log(Logs::Detail, Logs::Combat, "Attack canceled, Divine Aura is in effect.");
Message_StringID(MT_DefaultText, DIVINE_AURA_NO_ATK); //You can't attack while invulnerable!
return false;
}
@@ -1280,19 +1280,19 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
if(weapon != nullptr) {
if (!weapon->IsWeapon()) {
Log.Out(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID());
Log(Logs::Detail, Logs::Combat, "Attack canceled, Item %s (%d) is not a weapon.", weapon->GetItem()->Name, weapon->GetID());
return(false);
}
Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID());
Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d)", weapon->GetItem()->Name, weapon->GetID());
} else {
Log.Out(Logs::Detail, Logs::Combat, "Attacking without a weapon.");
Log(Logs::Detail, Logs::Combat, "Attacking without a weapon.");
}
DamageHitInfo my_hit;
// calculate attack_skill and skillinuse depending on hand and weapon
// also send Packet to near clients
AttackAnimation(my_hit.skill, Hand, weapon);
Log.Out(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, my_hit.skill);
Log(Logs::Detail, Logs::Combat, "Attacking with %s in slot %d using skill %d", weapon?weapon->GetItem()->Name:"Fist", Hand, my_hit.skill);
// Now figure out damage
my_hit.damage_done = 1;
@@ -1360,7 +1360,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
// damage = mod_client_damage(damage, skillinuse, Hand, weapon, other);
Log.Out(Logs::Detail, Logs::Combat, "Damage calculated: base %d min damage %d skill %d", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
Log(Logs::Detail, Logs::Combat, "Damage calculated: base %d min damage %d skill %d", my_hit.base_damage, my_hit.min_damage, my_hit.skill);
int hit_chance_bonus = 0;
my_hit.offense = offense(my_hit.skill); // we need this a few times
@@ -1495,7 +1495,7 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQEmu::skills::Sk
}
int exploss = 0;
Log.Out(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
Log(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob ? killerMob->GetName() : "Unknown", damage, spell, attack_skill);
/*
#1: Send death packet to everyone
@@ -1756,7 +1756,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
{
if (!other) {
SetTarget(nullptr);
Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to NPC::Attack() for evaluation!");
Log(Logs::General, Logs::Error, "A null Mob object was passed to NPC::Attack() for evaluation!");
return false;
}
@@ -1774,7 +1774,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
if (other->IsClient())
other->CastToClient()->RemoveXTarget(this, false);
RemoveFromHateList(other);
Log.Out(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetName());
Log(Logs::Detail, Logs::Combat, "I am not allowed to attack %s", other->GetName());
}
return false;
}
@@ -1804,10 +1804,10 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
//We dont factor much from the weapon into the attack.
//Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons
if(weapon) {
Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID);
Log(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID);
if (Hand == EQEmu::inventory::slotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield){
Log.Out(Logs::Detail, Logs::Combat, "Attack with shield canceled.");
Log(Logs::Detail, Logs::Combat, "Attack with shield canceled.");
return false;
}
@@ -1906,7 +1906,7 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
other->AddToHateList(this, hate);
Log.Out(Logs::Detail, Logs::Combat, "Final damage against %s: %d", other->GetName(), my_hit.damage_done);
Log(Logs::Detail, Logs::Combat, "Final damage against %s: %d", other->GetName(), my_hit.damage_done);
if(other->IsClient() && IsPet() && GetOwner()->IsClient()) {
//pets do half damage to clients in pvp
@@ -1961,7 +1961,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill
//handle EVENT_ATTACK. Resets after we have not been attacked for 12 seconds
if(attacked_timer.Check())
{
Log.Out(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", other ? other->GetName() : "nullptr");
Log(Logs::Detail, Logs::Combat, "Triggering EVENT_ATTACK due to attack by %s", other ? other->GetName() : "nullptr");
parse->EventNPC(EVENT_ATTACK, this, other, "", 0);
}
attacked_timer.Start(CombatEventTimer_expire);
@@ -1999,7 +1999,7 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, EQEmu::skills::Skill
bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::SkillType attack_skill)
{
Log.Out(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d",
Log(Logs::Detail, Logs::Combat, "Fatal blow dealt by %s with %d damage, spell %d, skill %d",
((killer_mob) ? (killer_mob->GetName()) : ("[nullptr]")), damage, spell, attack_skill);
Mob *oos = nullptr;
@@ -2045,7 +2045,7 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::Skil
if (IsEngaged()) {
zone->DelAggroMob();
Log.Out(Logs::Detail, Logs::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount());
Log(Logs::Detail, Logs::Attack, "%s Mobs currently Aggro %i", __FUNCTION__, zone->MobsAggroCount());
}
SetHP(0);
@@ -2629,7 +2629,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
if(DS == 0 && rev_ds == 0)
return;
Log.Out(Logs::Detail, Logs::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName());
Log(Logs::Detail, Logs::Combat, "Applying Damage Shield of value %d to %s", DS, attacker->GetName());
//invert DS... spells yield negative values for a true damage shield
if(DS < 0) {
@@ -2674,7 +2674,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID;
if(rev_ds < 0) {
Log.Out(Logs::Detail, Logs::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName());
Log(Logs::Detail, Logs::Combat, "Applying Reverse Damage Shield of value %d to %s", rev_ds, attacker->GetName());
attacker->Damage(this, -rev_ds, rev_ds_spell_id, EQEmu::skills::SkillAbjuration/*hackish*/, false); //"this" (us) will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this
//do we need to send a damage packet here also?
}
@@ -2878,7 +2878,7 @@ int32 Mob::ReduceDamage(int32 damage)
int damage_to_reduce = damage * spellbonuses.MeleeThresholdGuard[0] / 100;
if(damage_to_reduce >= buffs[slot].melee_rune)
{
Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d"
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d"
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune);
damage -= buffs[slot].melee_rune;
if(!TryFadeEffect(slot))
@@ -2886,7 +2886,7 @@ int32 Mob::ReduceDamage(int32 damage)
}
else
{
Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d"
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MeleeThresholdGuard %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].melee_rune);
buffs[slot].melee_rune = (buffs[slot].melee_rune - damage_to_reduce);
damage -= damage_to_reduce;
@@ -2905,7 +2905,7 @@ int32 Mob::ReduceDamage(int32 damage)
if(spellbonuses.MitigateMeleeRune[3] && (damage_to_reduce >= buffs[slot].melee_rune))
{
Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].melee_rune);
damage -= buffs[slot].melee_rune;
if(!TryFadeEffect(slot))
@@ -2913,7 +2913,7 @@ int32 Mob::ReduceDamage(int32 damage)
}
else
{
Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].melee_rune);
if (spellbonuses.MitigateMeleeRune[3])
@@ -3031,7 +3031,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
if(spellbonuses.MitigateSpellRune[3] && (damage_to_reduce >= buffs[slot].magic_rune))
{
Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d"
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateSpellDamage %d damage negated, %d"
" damage remaining, fading buff.", damage_to_reduce, buffs[slot].magic_rune);
damage -= buffs[slot].magic_rune;
if(!TryFadeEffect(slot))
@@ -3039,7 +3039,7 @@ int32 Mob::AffectMagicalDamage(int32 damage, uint16 spell_id, const bool iBuffTi
}
else
{
Log.Out(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
Log(Logs::Detail, Logs::Spells, "Mob::ReduceDamage SE_MitigateMeleeDamage %d damage negated, %d"
" damage remaining.", damage_to_reduce, buffs[slot].magic_rune);
if (spellbonuses.MitigateSpellRune[3])
@@ -3194,11 +3194,11 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
if (IsValidSpell(spell_id))
ignore_invul = spell_id == 982 || spells[spell_id].cast_not_standing; // cazic touch
Log.Out(Logs::Detail, Logs::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d",
Log(Logs::Detail, Logs::Combat, "Applying damage %d done by %s with skill %d and spell %d, avoidable? %s, is %sa buff tic in slot %d",
damage, attacker?attacker->GetName():"NOBODY", skill_used, spell_id, avoidable?"yes":"no", iBuffTic?"":"not ", buffslot);
if (!ignore_invul && (GetInvul() || DivineAura())) {
Log.Out(Logs::Detail, Logs::Combat, "Avoiding %d damage due to invulnerability.", damage);
Log(Logs::Detail, Logs::Combat, "Avoiding %d damage due to invulnerability.", damage);
damage = DMG_INVULNERABLE;
}
@@ -3242,7 +3242,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
int healed = damage;
healed = attacker->GetActSpellHealing(spell_id, healed);
Log.Out(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName());
Log(Logs::Detail, Logs::Combat, "Applying lifetap heal of %d to %s", healed, attacker->GetName());
attacker->HealDamage(healed);
//we used to do a message to the client, but its gone now.
@@ -3255,7 +3255,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
if (pet && !pet->IsFamiliar() && !pet->GetSpecialAbility(IMMUNE_AGGRO) && !pet->IsEngaged() && attacker && attacker != this && !attacker->IsCorpse())
{
if (!pet->IsHeld()) {
Log.Out(Logs::Detail, Logs::Aggro, "Sending pet %s into battle due to attack.", pet->GetName());
Log(Logs::Detail, Logs::Aggro, "Sending pet %s into battle due to attack.", pet->GetName());
pet->AddToHateList(attacker, 1,0, true, false, false, spell_id);
pet->SetTarget(attacker);
Message_StringID(10, PET_ATTACKING, pet->GetCleanName(), attacker->GetCleanName());
@@ -3265,7 +3265,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
//see if any runes want to reduce this damage
if(spell_id == SPELL_UNKNOWN) {
damage = ReduceDamage(damage);
Log.Out(Logs::Detail, Logs::Combat, "Melee Damage reduced to %d", damage);
Log(Logs::Detail, Logs::Combat, "Melee Damage reduced to %d", damage);
damage = ReduceAllDamage(damage);
TryTriggerThreshHold(damage, SE_TriggerMeleeThreshold, attacker);
@@ -3326,7 +3326,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
//fade mez if we are mezzed
if (IsMezzed() && attacker) {
Log.Out(Logs::Detail, Logs::Combat, "Breaking mez due to attack.");
Log(Logs::Detail, Logs::Combat, "Breaking mez due to attack.");
entity_list.MessageClose_StringID(
this, /* Sender */
true, /* Skip Sender */
@@ -3409,7 +3409,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
//increment chances of interrupting
if(IsCasting()) { //shouldnt interrupt on regular spell damage
attacked_count++;
Log.Out(Logs::Detail, Logs::Combat, "Melee attack while casting. Attack count %d", attacked_count);
Log(Logs::Detail, Logs::Combat, "Melee attack while casting. Attack count %d", attacked_count);
}
}
@@ -3667,7 +3667,7 @@ float Mob::GetProcChances(float ProcBonus, uint16 hand)
ProcChance += ProcChance * ProcBonus / 100.0f;
}
Log.Out(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
Log(Logs::Detail, Logs::Combat, "Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
return ProcChance;
}
@@ -3686,7 +3686,7 @@ float Mob::GetDefensiveProcChances(float &ProcBonus, float &ProcChance, uint16 h
ProcBonus += static_cast<float>(myagi) * RuleR(Combat, DefProcPerMinAgiContrib) / 100.0f;
ProcChance = ProcChance + (ProcChance * ProcBonus);
Log.Out(Logs::Detail, Logs::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
Log(Logs::Detail, Logs::Combat, "Defensive Proc chance %.2f (%.2f from bonuses)", ProcChance, ProcBonus);
return ProcChance;
}
@@ -3695,7 +3695,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
if (!on) {
SetTarget(nullptr);
Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!");
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryDefensiveProc for evaluation!");
return;
}
@@ -3735,17 +3735,17 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
void Mob::TryWeaponProc(const EQEmu::ItemInstance* weapon_g, Mob *on, uint16 hand) {
if(!on) {
SetTarget(nullptr);
Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TryWeaponProc for evaluation!");
return;
}
if (!IsAttackAllowed(on)) {
Log.Out(Logs::Detail, Logs::Combat, "Preventing procing off of unattackable things.");
Log(Logs::Detail, Logs::Combat, "Preventing procing off of unattackable things.");
return;
}
if (DivineAura()) {
Log.Out(Logs::Detail, Logs::Combat, "Procs canceled, Divine Aura is in effect.");
Log(Logs::Detail, Logs::Combat, "Procs canceled, Divine Aura is in effect.");
return;
}
@@ -3792,7 +3792,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *
static_cast<float>(weapon->ProcRate)) / 100.0f;
if (zone->random.Roll(WPC)) { // 255 dex = 0.084 chance of proc. No idea what this number should be really.
if (weapon->Proc.Level > ourlevel) {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Tried to proc (%s), but our level (%d) is lower than required (%d)",
weapon->Name, ourlevel, weapon->Proc.Level);
if (IsPet()) {
@@ -3803,7 +3803,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *
Message_StringID(13, PROC_TOOLOW);
}
} else {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Attacking weapon (%s) successfully procing spell %d (%.2f percent chance)",
weapon->Name, weapon->Proc.Effect, WPC * 100);
ExecWeaponProc(inst, weapon->Proc.Effect, on);
@@ -3883,12 +3883,12 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
// Perma procs (AAs)
if (PermaProcs[i].spellID != SPELL_UNKNOWN) {
if (zone->random.Roll(PermaProcs[i].chance)) { // TODO: Do these get spell bonus?
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Permanent proc %d procing spell %d (%d percent chance)",
i, PermaProcs[i].spellID, PermaProcs[i].chance);
ExecWeaponProc(nullptr, PermaProcs[i].spellID, on);
} else {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Permanent proc %d failed to proc %d (%d percent chance)",
i, PermaProcs[i].spellID, PermaProcs[i].chance);
}
@@ -3898,7 +3898,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
if (SpellProcs[i].spellID != SPELL_UNKNOWN) {
float chance = ProcChance * (static_cast<float>(SpellProcs[i].chance) / 100.0f);
if (zone->random.Roll(chance)) {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Spell proc %d procing spell %d (%.2f percent chance)",
i, SpellProcs[i].spellID, chance);
auto outapp = new EQApplicationPacket(OP_BeginCast,sizeof(BeginCast_Struct));
@@ -3913,7 +3913,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0,
SpellProcs[i].base_spellID);
} else {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Spell proc %d failed to proc %d (%.2f percent chance)",
i, SpellProcs[i].spellID, chance);
}
@@ -3923,14 +3923,14 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
if (RangedProcs[i].spellID != SPELL_UNKNOWN) {
float chance = ProcChance * (static_cast<float>(RangedProcs[i].chance) / 100.0f);
if (zone->random.Roll(chance)) {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Ranged proc %d procing spell %d (%.2f percent chance)",
i, RangedProcs[i].spellID, chance);
ExecWeaponProc(nullptr, RangedProcs[i].spellID, on);
CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0,
RangedProcs[i].base_spellID);
} else {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Ranged proc %d failed to proc %d (%.2f percent chance)",
i, RangedProcs[i].spellID, chance);
}
@@ -4114,7 +4114,7 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
int og_damage = hit.damage_done;
int crit_mod = 170 + GetCritDmgMob(hit.skill);
hit.damage_done = hit.damage_done * crit_mod / 100;
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Crit success roll %d dex chance %d og dmg %d crit_mod %d new dmg %d", roll, dex_bonus,
og_damage, crit_mod, hit.damage_done);
@@ -4157,7 +4157,7 @@ void Mob::TryCriticalHit(Mob *defender, DamageHitInfo &hit, ExtraAttackOptions *
if (IsBerserk() || berserk) {
hit.damage_done += og_damage * 119 / 100;
Log.Out(Logs::Detail, Logs::Combat, "Crip damage %d", hit.damage_done);
Log(Logs::Detail, Logs::Combat, "Crip damage %d", hit.damage_done);
entity_list.FilteredMessageClose_StringID(
this, /* Sender */
@@ -4237,7 +4237,7 @@ bool Mob::TryFinishingBlow(Mob *defender, int &damage)
void Mob::DoRiposte(Mob *defender)
{
Log.Out(Logs::Detail, Logs::Combat, "Preforming a riposte");
Log(Logs::Detail, Logs::Combat, "Preforming a riposte");
if (!defender)
return;
@@ -4251,7 +4251,7 @@ void Mob::DoRiposte(Mob *defender)
defender->itembonuses.DoubleRiposte;
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Preforming a double riposted from SE_DoubleRiposte (%d percent chance)", DoubleRipChance);
defender->Attack(this, EQEmu::inventory::slotPrimary, true);
if (HasDied())
@@ -4263,7 +4263,7 @@ void Mob::DoRiposte(Mob *defender)
// Live AA - Double Riposte
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
Log.Out(Logs::Detail, Logs::Combat,
Log(Logs::Detail, Logs::Combat,
"Preforming a double riposted from SE_GiveDoubleRiposte base1 == 0 (%d percent chance)",
DoubleRipChance);
defender->Attack(this, EQEmu::inventory::slotPrimary, true);
@@ -4277,7 +4277,7 @@ void Mob::DoRiposte(Mob *defender)
DoubleRipChance = defender->aabonuses.GiveDoubleRiposte[1];
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
Log.Out(Logs::Detail, Logs::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)",
Log(Logs::Detail, Logs::Combat, "Preforming a return SPECIAL ATTACK (%d percent chance)",
DoubleRipChance);
if (defender->GetClass() == MONK)
@@ -4482,7 +4482,7 @@ void Mob::ApplyDamageTable(DamageHitInfo &hit)
if (IsWarriorClass() && GetLevel() > 54)
hit.damage_done++;
Log.Out(Logs::Detail, Logs::Attack, "Damage table applied %d (max %d)", percent, damage_table.max_extra);
Log(Logs::Detail, Logs::Attack, "Damage table applied %d (max %d)", percent, damage_table.max_extra);
}
void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, uint16 hand, bool IsDefensive)
@@ -4490,7 +4490,7 @@ void Mob::TrySkillProc(Mob *on, uint16 skill, uint16 ReuseTime, bool Success, ui
if (!on) {
SetTarget(nullptr);
Log.Out(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!");
Log(Logs::General, Logs::Error, "A null Mob object was passed to Mob::TrySkillProc for evaluation!");
return;
}
@@ -4721,13 +4721,13 @@ bool Mob::TryRootFadeByDamage(int buffslot, Mob* attacker) {
if (!TryFadeEffect(spellbonuses.Root[1])) {
BuffFadeBySlot(spellbonuses.Root[1]);
Log.Out(Logs::Detail, Logs::Combat, "Spell broke root! BreakChance percent chance");
Log(Logs::Detail, Logs::Combat, "Spell broke root! BreakChance percent chance");
return true;
}
}
}
Log.Out(Logs::Detail, Logs::Combat, "Spell did not break root. BreakChance percent chance");
Log(Logs::Detail, Logs::Combat, "Spell did not break root. BreakChance percent chance");
return false;
}
@@ -4890,19 +4890,19 @@ void Mob::CommonBreakInvisibleFromCombat()
{
//break invis when you attack
if(invisible) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack.");
Log(Logs::Detail, Logs::Combat, "Removing invisibility due to melee attack.");
BuffFadeByEffect(SE_Invisibility);
BuffFadeByEffect(SE_Invisibility2);
invisible = false;
}
if(invisible_undead) {
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. undead due to melee attack.");
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
invisible_undead = false;
}
if(invisible_animals){
Log.Out(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
Log(Logs::Detail, Logs::Combat, "Removing invisibility vs. animals due to melee attack.");
BuffFadeByEffect(SE_InvisVsAnimals);
invisible_animals = false;
}