Logs::Combat to LogCombat

This commit is contained in:
Akkadius
2019-09-02 04:21:03 -05:00
parent 3e4587cd57
commit 89bfbe6bd2
5 changed files with 104 additions and 127 deletions
+26 -28
View File
@@ -631,7 +631,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
//make sure the attack and ranged timers are up
//if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow
if(!CanDoubleAttack && ((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) {
Log(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
LogCombat("Throwing attack canceled. Timer not up. Attack [{}], ranged [{}]", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
// The server and client timers are not exact matches currently, so this would spam too often if enabled
//Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
@@ -643,12 +643,12 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
const EQEmu::ItemInstance* Ammo = m_inv[EQEmu::invslot::slotAmmo];
if (!RangeWeapon || !RangeWeapon->IsClassCommon()) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange);
LogCombat("Ranged attack canceled. Missing or invalid ranged weapon ([{}]) in slot [{}]", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have no bow!", GetItemIDAt(EQEmu::invslot::slotRange));
return;
}
if (!Ammo || !Ammo->IsClassCommon()) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ammo item (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotAmmo), EQEmu::invslot::slotAmmo);
LogCombat("Ranged attack canceled. Missing or invalid ammo item ([{}]) in slot [{}]", GetItemIDAt(EQEmu::invslot::slotAmmo), EQEmu::invslot::slotAmmo);
Message(0, "Error: Ammo: GetItem(%i)==0, you have no ammo!", GetItemIDAt(EQEmu::invslot::slotAmmo));
return;
}
@@ -657,17 +657,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
const EQEmu::ItemData* AmmoItem = Ammo->GetItem();
if (RangeItem->ItemType != EQEmu::item::ItemTypeBow) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item is not a bow. type %d.", RangeItem->ItemType);
LogCombat("Ranged attack canceled. Ranged item is not a bow. type [{}]", RangeItem->ItemType);
Message(0, "Error: Rangeweapon: Item %d is not a bow.", RangeWeapon->GetID());
return;
}
if (AmmoItem->ItemType != EQEmu::item::ItemTypeArrow) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ammo item is not an arrow. type %d.", AmmoItem->ItemType);
LogCombat("Ranged attack canceled. Ammo item is not an arrow. type [{}]", AmmoItem->ItemType);
Message(0, "Error: Ammo: type %d != %d, you have the wrong type of ammo!", AmmoItem->ItemType, EQEmu::item::ItemTypeArrow);
return;
}
Log(Logs::Detail, Logs::Combat, "Shooting %s with bow %s (%d) and arrow %s (%d)", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID);
LogCombat("Shooting [{}] with bow [{}] ([{}]) and arrow [{}] ([{}])", other->GetName(), RangeItem->Name, RangeItem->ID, AmmoItem->Name, AmmoItem->ID);
//look for ammo in inventory if we only have 1 left...
if(Ammo->GetCharges() == 1) {
@@ -694,7 +694,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
Ammo = baginst;
ammo_slot = m_inv.CalcSlotId(r, i);
found = true;
Log(Logs::Detail, Logs::Combat, "Using ammo from quiver stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges());
LogCombat("Using ammo from quiver stack at slot [{}]. [{}] in stack", ammo_slot, Ammo->GetCharges());
break;
}
}
@@ -709,17 +709,17 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
if (aslot != INVALID_INDEX) {
ammo_slot = aslot;
Ammo = m_inv[aslot];
Log(Logs::Detail, Logs::Combat, "Using ammo from inventory stack at slot %d. %d in stack.", ammo_slot, Ammo->GetCharges());
LogCombat("Using ammo from inventory stack at slot [{}]. [{}] in stack", ammo_slot, Ammo->GetCharges());
}
}
}
float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget());
Log(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range);
LogCombat("Calculated bow range to be [{}]", range);
range *= range;
float dist = DistanceSquared(m_Position, other->GetPosition());
if(dist > range) {
Log(Logs::Detail, Logs::Combat, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range);
LogCombat("Ranged attack out of range client should catch this. ([{}] > [{}]).\n", dist, range);
MessageString(Chat::Red,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
return;
}
@@ -747,9 +747,9 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
if (RangeItem->ExpendableArrow || !ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){
DeleteItemInInventory(ammo_slot, 1, true);
Log(Logs::Detail, Logs::Combat, "Consumed one arrow from slot %d", ammo_slot);
LogCombat("Consumed one arrow from slot [{}]", ammo_slot);
} else {
Log(Logs::Detail, Logs::Combat, "Endless Quiver prevented ammo consumption.");
LogCombat("Endless Quiver prevented ammo consumption");
}
CheckIncreaseSkill(EQEmu::skills::SkillArchery, GetTarget(), -15);
@@ -808,7 +808,7 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon,
SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillArchery);
}
Log(Logs::Detail, Logs::Combat, "Ranged attack hit %s.", other->GetName());
LogCombat("Ranged attack hit [{}]", other->GetName());
uint32 hate = 0;
int TotalDmg = 0;
@@ -840,12 +840,10 @@ void Mob::DoArcheryAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon,
hate = ((WDmg + ADmg));
if (RuleB(Combat, ProjectileDmgOnImpact)) {
Log(Logs::Detail, Logs::Combat, "Bow and Arrow DMG %d, Max Damage %d.", WDmg,
MaxDmg);
LogCombat("Bow and Arrow DMG [{}], Max Damage [{}]", WDmg, MaxDmg);
}
else {
Log(Logs::Detail, Logs::Combat, "Bow DMG %d, Arrow DMG %d, Max Damage %d.", WDmg,
ADmg, MaxDmg);
LogCombat("Bow DMG [{}], Arrow DMG [{}], Max Damage [{}]", WDmg, ADmg, MaxDmg);
}
if (MaxDmg == 0)
@@ -1087,7 +1085,7 @@ void NPC::RangedAttack(Mob* other)
//make sure the attack and ranged timers are up
//if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow
if((attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check())){
Log(Logs::Detail, Logs::Combat, "Archery canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
LogCombat("Archery canceled. Timer not up. Attack [{}], ranged [{}]", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
}
@@ -1223,7 +1221,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
//make sure the attack and ranged timers are up
//if the ranged timer is disabled, then they have no ranged weapon and shouldent be attacking anyhow
if((!CanDoubleAttack && (attack_timer.Enabled() && !attack_timer.Check(false)) || (ranged_timer.Enabled() && !ranged_timer.Check()))) {
Log(Logs::Detail, Logs::Combat, "Throwing attack canceled. Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
LogCombat("Throwing attack canceled. Timer not up. Attack [{}], ranged [{}]", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
// The server and client timers are not exact matches currently, so this would spam too often if enabled
//Message(0, "Error: Timer not up. Attack %d, ranged %d", attack_timer.GetRemainingTime(), ranged_timer.GetRemainingTime());
return;
@@ -1233,19 +1231,19 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
const EQEmu::ItemInstance* RangeWeapon = m_inv[EQEmu::invslot::slotRange];
if (!RangeWeapon || !RangeWeapon->IsClassCommon()) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Missing or invalid ranged weapon (%d) in slot %d", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange);
LogCombat("Ranged attack canceled. Missing or invalid ranged weapon ([{}]) in slot [{}]", GetItemIDAt(EQEmu::invslot::slotRange), EQEmu::invslot::slotRange);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing to throw!", GetItemIDAt(EQEmu::invslot::slotRange));
return;
}
const EQEmu::ItemData* item = RangeWeapon->GetItem();
if (item->ItemType != EQEmu::item::ItemTypeLargeThrowing && item->ItemType != EQEmu::item::ItemTypeSmallThrowing) {
Log(Logs::Detail, Logs::Combat, "Ranged attack canceled. Ranged item %d is not a throwing weapon. type %d.", item->ItemType);
LogCombat("Ranged attack canceled. Ranged item [{}] is not a throwing weapon. type [{}]", item->ItemType);
Message(0, "Error: Rangeweapon: GetItem(%i)==0, you have nothing useful to throw!", GetItemIDAt(EQEmu::invslot::slotRange));
return;
}
Log(Logs::Detail, Logs::Combat, "Throwing %s (%d) at %s", item->Name, item->ID, other->GetName());
LogCombat("Throwing [{}] ([{}]) at [{}]", item->Name, item->ID, other->GetName());
if(RangeWeapon->GetCharges() == 1) {
//first check ammo
@@ -1254,7 +1252,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
//more in the ammo slot, use it
RangeWeapon = AmmoItem;
ammo_slot = EQEmu::invslot::slotAmmo;
Log(Logs::Detail, Logs::Combat, "Using ammo from ammo slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges());
LogCombat("Using ammo from ammo slot, stack at slot [{}]. [{}] in stack", ammo_slot, RangeWeapon->GetCharges());
} else {
//look through our inventory for more
int32 aslot = m_inv.HasItem(item->ID, 1, invWherePersonal);
@@ -1262,17 +1260,17 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
//the item wont change, but the instance does, not that it matters
ammo_slot = aslot;
RangeWeapon = m_inv[aslot];
Log(Logs::Detail, Logs::Combat, "Using ammo from inventory slot, stack at slot %d. %d in stack.", ammo_slot, RangeWeapon->GetCharges());
LogCombat("Using ammo from inventory slot, stack at slot [{}]. [{}] in stack", ammo_slot, RangeWeapon->GetCharges());
}
}
}
float range = item->Range + GetRangeDistTargetSizeMod(other);
Log(Logs::Detail, Logs::Combat, "Calculated bow range to be %.1f", range);
LogCombat("Calculated bow range to be [{}]", range);
range *= range;
float dist = DistanceSquared(m_Position, other->GetPosition());
if(dist > range) {
Log(Logs::Detail, Logs::Combat, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range);
LogCombat("Throwing attack out of range client should catch this. ([{}] > [{}]).\n", dist, range);
MessageString(Chat::Red,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase.
return;
}
@@ -1339,7 +1337,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon
SendItemAnimation(other, AmmoItem, EQEmu::skills::SkillThrowing);
}
Log(Logs::Detail, Logs::Combat, "Throwing attack hit %s.", other->GetName());
LogCombat("Throwing attack hit [{}]", other->GetName());
int WDmg = 0;
@@ -1377,7 +1375,7 @@ void Mob::DoThrowingAttackDmg(Mob *other, const EQEmu::ItemInstance *RangeWeapon
DoAttack(other, my_hit);
TotalDmg = my_hit.damage_done;
Log(Logs::Detail, Logs::Combat, "Item DMG %d. Hit for damage %d", WDmg, TotalDmg);
LogCombat("Item DMG [{}]. Hit for damage [{}]", WDmg, TotalDmg);
} else {
TotalDmg = DMG_INVULNERABLE;
}