From ed4fc74bd40059d004fee9cb0438b554c2a69eb6 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 2 Sep 2019 03:10:03 -0500 Subject: [PATCH] Logs::Tradeskills to LogTradeskills and more Logs::Error to LogError --- common/shareddb.cpp | 15 +++----- zone/aura.cpp | 6 ++-- zone/bot_command.cpp | 4 +-- zone/client_packet.cpp | 80 +++++++++++++++++------------------------- zone/entity.cpp | 6 ++-- zone/guild_mgr.cpp | 2 +- zone/heal_rotation.cpp | 2 +- zone/inventory.cpp | 6 ++-- zone/spells.cpp | 4 +-- zone/tasks.cpp | 56 +++++++++++------------------ zone/tradeskills.cpp | 16 ++++----- zone/trading.cpp | 3 +- zone/zone.cpp | 2 +- 13 files changed, 80 insertions(+), 122 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index a854318ac..31028677f 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -485,8 +485,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool const EQEmu::ItemData *item = GetItem(item_id); if (!item) { - Log(Logs::General, Logs::Error, - "Warning: %s %i has an invalid item_id %i in inventory slot %i", + LogError("Warning: [{}] [{}] has an invalid item_id [{}] in inventory slot [{}]", ((is_charid == true) ? "charid" : "acctid"), id, item_id, slot_id); continue; } @@ -534,8 +533,7 @@ bool SharedDatabase::GetSharedBank(uint32 id, EQEmu::InventoryProfile *inv, bool if (put_slot_id != INVALID_INDEX) continue; - Log(Logs::General, Logs::Error, - "Warning: Invalid slot_id for item in shared bank inventory: %s=%i, item_id=%i, slot_id=%i", + LogError("Warning: Invalid slot_id for item in shared bank inventory: [{}]=[{}], item_id=[{}], slot_id=[{}]", ((is_charid == true) ? "charid" : "acctid"), id, item_id, slot_id); if (is_charid) @@ -623,8 +621,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) const EQEmu::ItemData *item = GetItem(item_id); if (!item) { - Log(Logs::General, Logs::Error, - "Warning: charid %i has an invalid item_id %i in inventory slot %i", char_id, item_id, + LogError("Warning: charid [{}] has an invalid item_id [{}] in inventory slot [{}]", char_id, item_id, slot_id); continue; } @@ -708,8 +705,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) // Save ptr to item in inventory if (put_slot_id == INVALID_INDEX) { - Log(Logs::General, Logs::Error, - "Warning: Invalid slot_id for item in inventory: charid=%i, item_id=%i, slot_id=%i", + LogError("Warning: Invalid slot_id for item in inventory: charid=[{}], item_id=[{}], slot_id=[{}]", char_id, item_id, slot_id); } } @@ -717,8 +713,7 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQEmu::InventoryProfile *inv) if (cv_conflict) { char char_name[64] = ""; GetCharName(char_id, char_name); - Log(Logs::General, Logs::Error, - "ClientVersion/Expansion conflict during inventory load at zone entry for '%s' (charid: %u, inver: %s, gmi: %s)", + LogError("ClientVersion/Expansion conflict during inventory load at zone entry for [{}] (charid: [{}], inver: [{}], gmi: [{}])", char_name, char_id, EQEmu::versions::MobVersionName(inv->InventoryVersion()), diff --git a/zone/aura.cpp b/zone/aura.cpp index d49f480cd..0830816c1 100644 --- a/zone/aura.cpp +++ b/zone/aura.cpp @@ -717,7 +717,7 @@ void Mob::MakeAura(uint16 spell_id) if (!IsValidSpell(record.spell_id)) { Message(Chat::Red, "Casted spell (%d) is not valid for aura %s", record.spell_id, spells[spell_id].name); - Log(Logs::General, Logs::Error, "Casted spell (%d) is not valid for aura %d, check auras table.", + LogError("Casted spell ([{}]) is not valid for aura [{}], check auras table", record.spell_id, spell_id); return; } @@ -745,9 +745,7 @@ void Mob::MakeAura(uint16 spell_id) const auto base = database.LoadNPCTypesData(record.npc_type); if (base == nullptr) { Message(Chat::Red, "Unable to load NPC data for aura %s", spells[spell_id].teleport_zone); - Log(Logs::General, Logs::Error, - "Unable to load NPC data for aura %s (NPC ID %d), check auras and npc_types tables.", - spells[spell_id].teleport_zone, record.npc_type); + LogError("Unable to load NPC data for aura [{}] (NPC ID [{}]), check auras and npc_types tables", spells[spell_id].teleport_zone, record.npc_type); return; } diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 091109d1b..a147744c3 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -454,7 +454,7 @@ public: if (target_type == BCEnum::TT_Self && (entry_prototype->BCST() != BCEnum::SpT_Stance && entry_prototype->BCST() != BCEnum::SpT_SummonCorpse)) { #ifdef BCSTSPELLDUMP - Log(Logs::General, Logs::Error, "DELETING entry_prototype (primary clause) - name: %s, target_type: %s, BCST: %s", + LogError("DELETING entry_prototype (primary clause) - name: [{}], target_type: [{}], BCST: [{}]", spells[spell_id].name, BCEnum::TargetTypeEnumToString(target_type).c_str(), BCEnum::SpellTypeEnumToString(entry_prototype->BCST()).c_str()); #endif safe_delete(entry_prototype); @@ -462,7 +462,7 @@ public: } if (entry_prototype->BCST() == BCEnum::SpT_Stance && target_type != BCEnum::TT_Self) { #ifdef BCSTSPELLDUMP - Log(Logs::General, Logs::Error, "DELETING entry_prototype (secondary clause) - name: %s, BCST: %s, target_type: %s", + LogError("DELETING entry_prototype (secondary clause) - name: [{}], BCST: [{}], target_type: [{}]", spells[spell_id].name, BCEnum::SpellTypeEnumToString(entry_prototype->BCST()).c_str(), BCEnum::TargetTypeEnumToString(target_type).c_str()); #endif safe_delete(entry_prototype); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index cc4aea265..0e4e266c5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -446,11 +446,6 @@ int Client::HandlePacket(const EQApplicationPacket *app) args.push_back(const_cast(app)); parse->EventPlayer(EVENT_UNHANDLED_OPCODE, this, "", 1, &args); -#if EQDEBUG >= 10 - Log(Logs::General, Logs::Error, "HandlePacket() Opcode error: Unexpected packet during CLIENT_CONNECTING: opcode:" - " %s (#%d eq=0x%04x), size: %i", OpcodeNames[opcode], opcode, 0, app->size); - DumpPacket(app); -#endif break; } @@ -927,7 +922,7 @@ return; void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) { if (app->size != sizeof(ApproveZone_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size on OP_ApproveZone: Expected %i, Got %i", + LogError("Invalid size on OP_ApproveZone: Expected [{}], Got [{}]", sizeof(ApproveZone_Struct), app->size); return; } @@ -940,7 +935,7 @@ void Client::Handle_Connect_OP_ApproveZone(const EQApplicationPacket *app) void Client::Handle_Connect_OP_ClientError(const EQApplicationPacket *app) { if (app->size != sizeof(ClientError_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size on OP_ClientError: Expected %i, Got %i", + LogError("Invalid size on OP_ClientError: Expected [{}], Got [{}]", sizeof(ClientError_Struct), app->size); return; } @@ -1102,7 +1097,7 @@ void Client::Handle_Connect_OP_SpawnAppearance(const EQApplicationPacket *app) void Client::Handle_Connect_OP_TGB(const EQApplicationPacket *app) { if (app->size != sizeof(uint32)) { - Log(Logs::General, Logs::Error, "Invalid size on OP_TGB: Expected %i, Got %i", + LogError("Invalid size on OP_TGB: Expected [{}], Got [{}]", sizeof(uint32), app->size); return; } @@ -1183,7 +1178,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app) struct in_addr ghost_addr; ghost_addr.s_addr = eqs->GetRemoteIP(); - Log(Logs::General, Logs::Error, "Ghosting client: Account ID:%i Name:%s Character:%s IP:%s", + LogError("Ghosting client: Account ID:[{}] Name:[{}] Character:[{}] IP:[{}]", client->AccountID(), client->AccountName(), client->GetName(), inet_ntoa(ghost_addr)); client->Save(); client->Disconnect(); @@ -2791,9 +2786,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) void Client::Handle_OP_Animation(const EQApplicationPacket *app) { if (app->size != sizeof(Animation_Struct)) { - Log(Logs::General, Logs::Error, "Received invalid sized " - "OP_Animation: got %d, expected %d", app->size, - sizeof(Animation_Struct)); + LogError("Received invalid sized OP_Animation: got [{}], expected [{}]", app->size, sizeof(Animation_Struct)); DumpPacket(app); return; } @@ -2944,7 +2937,7 @@ void Client::Handle_OP_AugmentInfo(const EQApplicationPacket *app) void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app) { if (app->size != sizeof(AugmentItem_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for AugmentItem_Struct: Expected: %i, Got: %i", + LogError("Invalid size for AugmentItem_Struct: Expected: [{}], Got: [{}]", sizeof(AugmentItem_Struct), app->size); return; } @@ -3593,7 +3586,7 @@ void Client::Handle_OP_Barter(const EQApplicationPacket *app) void Client::Handle_OP_BazaarInspect(const EQApplicationPacket *app) { if (app->size != sizeof(BazaarInspect_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for BazaarInspect_Struct: Expected %i, Got %i", + LogError("Invalid size for BazaarInspect_Struct: Expected [{}], Got [{}]", sizeof(BazaarInspect_Struct), app->size); return; } @@ -4275,7 +4268,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app) void Client::Handle_OP_ClickObject(const EQApplicationPacket *app) { if (app->size != sizeof(ClickObject_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size on ClickObject_Struct: Expected %i, Got %i", + LogError("Invalid size on ClickObject_Struct: Expected [{}], Got [{}]", sizeof(ClickObject_Struct), app->size); return; } @@ -4322,7 +4315,7 @@ void Client::Handle_OP_ClickObjectAction(const EQApplicationPacket *app) else { if (app->size != sizeof(ClickObjectAction_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size on OP_ClickObjectAction: Expected %i, Got %i", + LogError("Invalid size on OP_ClickObjectAction: Expected [{}], Got [{}]", sizeof(ClickObjectAction_Struct), app->size); return; } @@ -4377,7 +4370,7 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) { if (app->size != sizeof(PlayerPositionUpdateClient_Struct) && app->size != (sizeof(PlayerPositionUpdateClient_Struct) + 1) ) { - Log(Logs::General, Logs::Error, "OP size error: OP_ClientUpdate expected:%i got:%i", + LogError("OP size error: OP_ClientUpdate expected:[{}] got:[{}]", sizeof(PlayerPositionUpdateClient_Struct), app->size); return; } @@ -5084,8 +5077,7 @@ void Client::Handle_OP_CrystalReclaim(const EQApplicationPacket *app) void Client::Handle_OP_Damage(const EQApplicationPacket *app) { if (app->size != sizeof(CombatDamage_Struct)) { - Log(Logs::General, Logs::Error, "Received invalid sized OP_Damage: got %d, expected %d", app->size, - sizeof(CombatDamage_Struct)); + LogError("Received invalid sized OP_Damage: got [{}], expected [{}]", app->size, sizeof(CombatDamage_Struct)); DumpPacket(app); return; } @@ -5530,9 +5522,7 @@ void Client::Handle_OP_Dye(const EQApplicationPacket *app) void Client::Handle_OP_Emote(const EQApplicationPacket *app) { if (app->size != sizeof(Emote_Struct)) { - Log(Logs::General, Logs::Error, "Received invalid sized " - "OP_Emote: got %d, expected %d", app->size, - sizeof(Emote_Struct)); + LogError("Received invalid sized OP_Emote: got [{}], expected [{}]", app->size, sizeof(Emote_Struct)); DumpPacket(app); return; } @@ -5621,8 +5611,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) } if (app->size != sizeof(EnvDamage2_Struct)) { - Log(Logs::General, Logs::Error, "Received invalid sized OP_EnvDamage: got %d, expected %d", app->size, - sizeof(EnvDamage2_Struct)); + LogError("Received invalid sized OP_EnvDamage: got [{}], expected [{}]", app->size, sizeof(EnvDamage2_Struct)); DumpPacket(app); return; } @@ -5675,7 +5664,7 @@ void Client::Handle_OP_EnvDamage(const EQApplicationPacket *app) void Client::Handle_OP_FaceChange(const EQApplicationPacket *app) { if (app->size != sizeof(FaceChange_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for OP_FaceChange: Expected: %i, Got: %i", + LogError("Invalid size for OP_FaceChange: Expected: [{}], Got: [{}]", sizeof(FaceChange_Struct), app->size); return; } @@ -6456,7 +6445,7 @@ void Client::Handle_OP_GroupAcknowledge(const EQApplicationPacket *app) void Client::Handle_OP_GroupCancelInvite(const EQApplicationPacket *app) { if (app->size != sizeof(GroupCancel_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for OP_GroupCancelInvite: Expected: %i, Got: %i", + LogError("Invalid size for OP_GroupCancelInvite: Expected: [{}], Got: [{}]", sizeof(GroupCancel_Struct), app->size); return; } @@ -6500,7 +6489,7 @@ void Client::Handle_OP_GroupDelete(const EQApplicationPacket *app) void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for GroupGeneric_Struct: Expected: %i, Got: %i", + LogError("Invalid size for GroupGeneric_Struct: Expected: [{}], Got: [{}]", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6681,7 +6670,7 @@ void Client::Handle_OP_GroupFollow(const EQApplicationPacket *app) void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupGeneric_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for OP_GroupFollow: Expected: %i, Got: %i", + LogError("Invalid size for OP_GroupFollow: Expected: [{}], Got: [{}]", sizeof(GroupGeneric_Struct), app->size); return; } @@ -6730,7 +6719,7 @@ void Client::Handle_OP_GroupInvite(const EQApplicationPacket *app) void Client::Handle_OP_GroupInvite2(const EQApplicationPacket *app) { if (app->size != sizeof(GroupInvite_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for OP_GroupInvite: Expected: %i, Got: %i", + LogError("Invalid size for OP_GroupInvite: Expected: [{}], Got: [{}]", sizeof(GroupInvite_Struct), app->size); return; } @@ -8092,8 +8081,7 @@ void Client::Handle_OP_Ignore(const EQApplicationPacket *app) void Client::Handle_OP_Illusion(const EQApplicationPacket *app) { if (app->size != sizeof(Illusion_Struct)) { - Log(Logs::General, Logs::Error, "Received invalid sized OP_Illusion: got %d, expected %d", app->size, - sizeof(Illusion_Struct)); + LogError("Received invalid sized OP_Illusion: got [{}], expected [{}]", app->size, sizeof(Illusion_Struct)); DumpPacket(app); return; } @@ -8218,7 +8206,7 @@ void Client::Handle_OP_InstillDoubt(const EQApplicationPacket *app) void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app) { if (app->size != sizeof(ItemViewRequest_Struct)) { - Log(Logs::General, Logs::Error, "Wrong size on OP_ItemLinkClick. Got: %i, Expected: %i", app->size, + LogError("Wrong size on OP_ItemLinkClick. Got: [{}], Expected: [{}]", app->size, sizeof(ItemViewRequest_Struct)); DumpPacket(app); return; @@ -8319,7 +8307,7 @@ void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app) void Client::Handle_OP_ItemName(const EQApplicationPacket *app) { if (app->size != sizeof(ItemNamePacket_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for ItemNamePacket_Struct: Expected: %i, Got: %i", + LogError("Invalid size for ItemNamePacket_Struct: Expected: [{}], Got: [{}]", sizeof(ItemNamePacket_Struct), app->size); return; } @@ -11732,7 +11720,7 @@ void Client::Handle_OP_ReadBook(const EQApplicationPacket *app) void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) { if (app->size != sizeof(RecipeAutoCombine_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for RecipeAutoCombine_Struct: Expected: %i, Got: %i", + LogError("Invalid size for RecipeAutoCombine_Struct: Expected: [{}], Got: [{}]", sizeof(RecipeAutoCombine_Struct), app->size); return; } @@ -11746,7 +11734,7 @@ void Client::Handle_OP_RecipeAutoCombine(const EQApplicationPacket *app) void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) { if (app->size < sizeof(uint32)) { - Log(Logs::General, Logs::Error, "Invalid size for RecipeDetails Request: Expected: %i, Got: %i", + LogError("Invalid size for RecipeDetails Request: Expected: [{}], Got: [{}]", sizeof(uint32), app->size); return; } @@ -11760,7 +11748,7 @@ void Client::Handle_OP_RecipeDetails(const EQApplicationPacket *app) void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) { if (app->size != sizeof(TradeskillFavorites_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for TradeskillFavorites_Struct: Expected: %i, Got: %i", + LogError("Invalid size for TradeskillFavorites_Struct: Expected: [{}], Got: [{}]", sizeof(TradeskillFavorites_Struct), app->size); return; } @@ -11833,7 +11821,7 @@ void Client::Handle_OP_RecipesFavorite(const EQApplicationPacket *app) void Client::Handle_OP_RecipesSearch(const EQApplicationPacket *app) { if (app->size != sizeof(RecipesSearch_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for RecipesSearch_Struct: Expected: %i, Got: %i", + LogError("Invalid size for RecipesSearch_Struct: Expected: [{}], Got: [{}]", sizeof(RecipesSearch_Struct), app->size); return; } @@ -12314,9 +12302,7 @@ void Client::Handle_OP_SetGuildMOTD(const EQApplicationPacket *app) void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) { if (app->size < sizeof(SetRunMode_Struct)) { - Log(Logs::General, Logs::Error, "Received invalid sized " - "OP_SetRunMode: got %d, expected %d", app->size, - sizeof(SetRunMode_Struct)); + LogError("Received invalid sized OP_SetRunMode: got [{}], expected [{}]", app->size, sizeof(SetRunMode_Struct)); DumpPacket(app); return; } @@ -12331,9 +12317,7 @@ void Client::Handle_OP_SetRunMode(const EQApplicationPacket *app) void Client::Handle_OP_SetServerFilter(const EQApplicationPacket *app) { if (app->size != sizeof(SetServerFilter_Struct)) { - Log(Logs::General, Logs::Error, "Received invalid sized " - "OP_SetServerFilter: got %d, expected %d", app->size, - sizeof(SetServerFilter_Struct)); + LogError("Received invalid sized OP_SetServerFilter: got [{}], expected [{}]", app->size, sizeof(SetServerFilter_Struct)); DumpPacket(app); return; } @@ -12533,7 +12517,7 @@ void Client::Handle_OP_ShopEnd(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Sell_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size on OP_ShopPlayerBuy: Expected %i, Got %i", + LogError("Invalid size on OP_ShopPlayerBuy: Expected [{}], Got [{}]", sizeof(Merchant_Sell_Struct), app->size); return; } @@ -12773,7 +12757,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) qsaudit->items[0].aug_5 = 0; if (freeslotid != INVALID_INDEX) { - Log(Logs::General, Logs::Error, "Handle_OP_ShopPlayerBuy: QS Audit could not locate merchant (%u) purchased item in player (%u) inventory slot (%i)", + LogError("Handle_OP_ShopPlayerBuy: QS Audit could not locate merchant ([{}]) purchased item in player ([{}]) inventory slot ([{}])", qsaudit->merchant_id, qsaudit->char_id, freeslotid); } } @@ -12801,7 +12785,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) { if (app->size != sizeof(Merchant_Purchase_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size on OP_ShopPlayerSell: Expected %i, Got %i", + LogError("Invalid size on OP_ShopPlayerSell: Expected [{}], Got [{}]", sizeof(Merchant_Purchase_Struct), app->size); return; } @@ -13717,7 +13701,7 @@ void Client::Handle_OP_TrackTarget(const EQApplicationPacket *app) if (app->size != sizeof(TrackTarget_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for OP_TrackTarget: Expected: %i, Got: %i", + LogError("Invalid size for OP_TrackTarget: Expected: [{}], Got: [{}]", sizeof(TrackTarget_Struct), app->size); return; } @@ -14289,7 +14273,7 @@ void Client::Handle_OP_TraderShop(const EQApplicationPacket *app) void Client::Handle_OP_TradeSkillCombine(const EQApplicationPacket *app) { if (app->size != sizeof(NewCombine_Struct)) { - Log(Logs::General, Logs::Error, "Invalid size for NewCombine_Struct: Expected: %i, Got: %i", + LogError("Invalid size for NewCombine_Struct: Expected: [{}], Got: [{}]", sizeof(NewCombine_Struct), app->size); return; } diff --git a/zone/entity.cpp b/zone/entity.cpp index b57c62e96..084e0fc93 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -592,8 +592,7 @@ void EntityList::AddGroup(Group *group) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log(Logs::General, Logs::Error, - "Unable to get new group ID from world server. group is going to be broken."); + LogError("Unable to get new group ID from world server. group is going to be broken"); return; } @@ -621,8 +620,7 @@ void EntityList::AddRaid(Raid *raid) uint32 gid = worldserver.NextGroupID(); if (gid == 0) { - Log(Logs::General, Logs::Error, - "Unable to get new group ID from world server. group is going to be broken."); + LogError("Unable to get new group ID from world server. group is going to be broken"); return; } diff --git a/zone/guild_mgr.cpp b/zone/guild_mgr.cpp index 374446654..200f67d90 100644 --- a/zone/guild_mgr.cpp +++ b/zone/guild_mgr.cpp @@ -338,7 +338,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) { { if(pack->size != sizeof(ServerGuildRankUpdate_Struct)) { - Log(Logs::General, Logs::Error, "Received ServerOP_RankUpdate of incorrect size %d, expected %d", + LogError("Received ServerOP_RankUpdate of incorrect size [{}], expected [{}]", pack->size, sizeof(ServerGuildRankUpdate_Struct)); return; diff --git a/zone/heal_rotation.cpp b/zone/heal_rotation.cpp index 55d0c1e1d..e4fffafef 100644 --- a/zone/heal_rotation.cpp +++ b/zone/heal_rotation.cpp @@ -906,7 +906,7 @@ void HealRotation::bias_targets() for (auto tlist_iter : m_target_pool) { if (!tlist_iter) { continue; } - Log(Logs::General, Logs::Error, "(%i) %s (hp: %3.1f%%, at: %u, dontheal: %c, crit(base): %c(%c), safe(base): %c(%c), hcnt(ext): %u(%u), hfreq(ext): %f(%f))", + LogError("([{}]) [{}] (hp: %3.1f%%, at: [{}], dontheal: [{}], crit(base): [{}]([{}]), safe(base): [{}]([{}]), hcnt(ext): [{}]([{}]), hfreq(ext): [{}]([{}]))", (++target_index), tlist_iter->GetCleanName(), tlist_iter->GetHPRatio(), ClassArmorType(tlist_iter->GetClass()), diff --git a/zone/inventory.cpp b/zone/inventory.cpp index 974712caa..3ee86df47 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -519,7 +519,7 @@ bool Client::SummonItem(uint32 item_id, int16 charges, uint32 aug1, uint32 aug2, if(inst == nullptr) { Message(Chat::Red, "An unknown server error has occurred and your item was not created."); // this goes to logfile since this is a major error - Log(Logs::General, Logs::Error, "Player %s on account %s encountered an unknown item creation error.\n(Item: %u, Aug1: %u, Aug2: %u, Aug3: %u, Aug4: %u, Aug5: %u, Aug6: %u)\n", + LogError("Player [{}] on account [{}] encountered an unknown item creation error.\n(Item: [{}], Aug1: [{}], Aug2: [{}], Aug3: [{}], Aug4: [{}], Aug5: [{}], Aug6: [{}])\n", GetName(), account_name, item->ID, aug1, aug2, aug3, aug4, aug5, aug6); return false; @@ -1722,7 +1722,7 @@ bool Client::SwapItem(MoveItem_Struct* move_in) { ndh_item_data.append(StringFormat(", nodrop=%s(%u)", (ndh_item->NoDrop == 0 ? "true" : "false"), ndh_item->NoDrop)); } } - Log(Logs::General, Logs::Error, "WorldKick() of Player %s(id:%u, acct:%u) due to 'NoDrop Hack' detection >> SlotID:%i, ItemData:'%s'", + LogError("WorldKick() of Player [{}](id:[{}], acct:[{}]) due to 'NoDrop Hack' detection >> SlotID:[{}], ItemData:[{}]", GetName(), CharacterID(), AccountID(), src_slot_id, ndh_item_data.c_str()); ndh_inst = nullptr; @@ -3460,7 +3460,7 @@ void Client::InterrogateInventory_(bool errorcheck, Client* requester, int16 hea else { e = ""; } if (log) { - Log(Logs::General, Logs::Error, "Head: %i, Depth: %i, Instance: %s, Parent: %s%s", + LogError("Head: [{}], Depth: [{}], Instance: [{}], Parent: [{}][{}]", head, depth, i.c_str(), p.c_str(), e.c_str()); } if (!silent) { diff --git a/zone/spells.cpp b/zone/spells.cpp index 0ac3250d7..6ca3bf422 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -252,7 +252,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, if ((itm->GetItem()->Click.Type == EQEmu::item::ItemEffectEquipClick) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::SoF) { // They are casting a spell from an item that requires equipping but shouldn't let them equip it - Log(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click an equip-only effect on item %s (id: %d) which they shouldn't be able to equip!", + LogError("HACKER: [{}] (account: [{}]) attempted to click an equip-only effect on item [{}] (id: [{}]) which they shouldn't be able to equip!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking equip-only item with an invalid class"); } @@ -264,7 +264,7 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, if ((itm->GetItem()->Click.Type == EQEmu::item::ItemEffectClick2) && !(itm->GetItem()->Classes & bitmask)) { if (CastToClient()->ClientVersion() < EQEmu::versions::ClientVersion::SoF) { // They are casting a spell from an item that they don't meet the race/class requirements to cast - Log(Logs::General, Logs::Error, "HACKER: %s (account: %s) attempted to click a race/class restricted effect on item %s (id: %d) which they shouldn't be able to click!", + LogError("HACKER: [{}] (account: [{}]) attempted to click a race/class restricted effect on item [{}] (id: [{}]) which they shouldn't be able to click!", CastToClient()->GetCleanName(), CastToClient()->AccountName(), itm->GetItem()->Name, itm->GetItem()->ID); database.SetHackerFlag(CastToClient()->AccountName(), CastToClient()->GetCleanName(), "Clicking race/class restricted item with an invalid class"); } diff --git a/zone/tasks.cpp b/zone/tasks.cpp index bad983481..778a556e3 100644 --- a/zone/tasks.cpp +++ b/zone/tasks.cpp @@ -142,8 +142,7 @@ bool TaskManager::LoadTasks(int singleTask) if ((taskID <= 0) || (taskID >= MAXTASKS)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log(Logs::General, Logs::Error, - "[TASKS]Task ID %i out of range while loading tasks from database", taskID); + LogError("[TASKS]Task ID [{}] out of range while loading tasks from database", taskID); continue; } @@ -203,16 +202,12 @@ bool TaskManager::LoadTasks(int singleTask) if ((taskID <= 0) || (taskID >= MAXTASKS) || (activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { // This shouldn't happen, as the SELECT is bounded by MAXTASKS - Log(Logs::General, Logs::Error, - "[TASKS]Task or Activity ID (%i, %i) out of range while loading " - "activities from database", - taskID, activityID); + LogError("[TASKS]Task or Activity ID ([{}], [{}]) out of range while loading activities from database", taskID, activityID); continue; } if (Tasks[taskID] == nullptr) { - Log(Logs::General, Logs::Error, - "[TASKS]Activity for non-existent task (%i, %i) while loading activities from database", + LogError("[TASKS]Activity for non-existent task ([{}], [{}]) while loading activities from database", taskID, activityID); continue; } @@ -230,8 +225,7 @@ bool TaskManager::LoadTasks(int singleTask) // ERR_NOTASK errors. // Change to (activityID != (Tasks[taskID]->ActivityCount + 1)) to index from 1 if (activityID != Tasks[taskID]->ActivityCount) { - Log(Logs::General, Logs::Error, - "[TASKS]Activities for Task %i are not sequential starting at 0. Not loading task.", taskID, + LogError("[TASKS]Activities for Task [{}] are not sequential starting at 0. Not loading task", taskID, activityID); Tasks[taskID] = nullptr; continue; @@ -470,7 +464,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) characterID); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Tasks: %s", + LogError("[TASKS]Error in TaskManager::LoadClientState load Tasks: [{}]", results.ErrorMessage().c_str()); return false; } @@ -481,21 +475,19 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) TaskType type = static_cast(atoi(row[2])); if ((taskID < 0) || (taskID >= MAXTASKS)) { - Log(Logs::General, Logs::Error, - "[TASKS]Task ID %i out of range while loading character tasks from database", taskID); + LogError("[TASKS]Task ID [{}] out of range while loading character tasks from database", taskID); continue; } auto task_info = state->GetClientTaskInfo(type, slot); if (task_info == nullptr) { - Log(Logs::General, Logs::Error, - "[TASKS] Slot %i out of range while loading character tasks from database", slot); + LogError("[TASKS] Slot [{}] out of range while loading character tasks from database", slot); continue; } if (task_info->TaskID != TASKSLOTEMPTY) { - Log(Logs::General, Logs::Error, "[TASKS] Slot %i for Task %is is already occupied.", slot, + LogError("[TASKS] Slot [{}] for Task [{}]s is already occupied", slot, taskID); continue; } @@ -529,7 +521,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) characterID); results = database.QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load Activities: %s", + LogError("[TASKS]Error in TaskManager::LoadClientState load Activities: [{}]", results.ErrorMessage().c_str()); return false; } @@ -537,15 +529,13 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) for (auto row = results.begin(); row != results.end(); ++row) { int taskID = atoi(row[0]); if ((taskID < 0) || (taskID >= MAXTASKS)) { - Log(Logs::General, Logs::Error, - "[TASKS]Task ID %i out of range while loading character activities from database", taskID); + LogError("[TASKS]Task ID [{}] out of range while loading character activities from database", taskID); continue; } int activityID = atoi(row[1]); if ((activityID < 0) || (activityID >= MAXACTIVITIESPERTASK)) { - Log(Logs::General, Logs::Error, - "[TASKS]Activity ID %i out of range while loading character activities from database", + LogError("[TASKS]Activity ID [{}] out of range while loading character activities from database", activityID); continue; } @@ -562,8 +552,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) task_info = &state->ActiveQuests[i]; if (task_info == nullptr) { - Log(Logs::General, Logs::Error, - "[TASKS]Activity %i found for task %i which client does not have.", activityID, taskID); + LogError("[TASKS]Activity [{}] found for task [{}] which client does not have", activityID, taskID); continue; } @@ -591,8 +580,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) characterID); results = database.QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, - "[TASKS]Error in TaskManager::LoadClientState load completed tasks: %s", + LogError("[TASKS]Error in TaskManager::LoadClientState load completed tasks: [{}]", results.ErrorMessage().c_str()); return false; } @@ -609,8 +597,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) int taskID = atoi(row[0]); if ((taskID <= 0) || (taskID >= MAXTASKS)) { - Log(Logs::General, Logs::Error, - "[TASKS]Task ID %i out of range while loading completed tasks from database", + LogError("[TASKS]Task ID [{}] out of range while loading completed tasks from database", taskID); continue; } @@ -621,8 +608,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) // completed. int activityID = atoi(row[1]); if ((activityID < -1) || (activityID >= MAXACTIVITIESPERTASK)) { - Log(Logs::General, Logs::Error, - "[TASKS]Activity ID %i out of range while loading completed tasks from database", + LogError("[TASKS]Activity ID [{}] out of range while loading completed tasks from database", activityID); continue; } @@ -663,7 +649,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) characterID, MAXTASKS); results = database.QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "[TASKS]Error in TaskManager::LoadClientState load enabled tasks: %s", + LogError("[TASKS]Error in TaskManager::LoadClientState load enabled tasks: [{}]", results.ErrorMessage().c_str()); } else { for (auto row = results.begin(); row != results.end(); ++row) { @@ -686,7 +672,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) "Removing from memory. Contact a GM to resolve this.", i, taskID); - Log(Logs::General, Logs::Error, "[TASKS]Character %i has task %i which does not exist.", + LogError("[TASKS]Character [{}] has task [{}] which does not exist", characterID, taskID); state->ActiveTasks[i].TaskID = TASKSLOTEMPTY; continue; @@ -699,9 +685,7 @@ bool TaskManager::LoadClientState(Client *c, ClientTaskState *state) "Removing from memory. Contact a GM to resolve this.", taskID, Tasks[taskID]->Title.c_str()); - Log(Logs::General, Logs::Error, - "[TASKS]Fatal error in character %i task state. Activity %i for " - "Task %i either missing from client state or from task.", + LogError("[TASKS]Fatal error in character [{}] task state. Activity [{}] for Task [{}] either missing from client state or from task", characterID, j, taskID); state->ActiveTasks[i].TaskID = TASKSLOTEMPTY; break; @@ -3174,7 +3158,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber, TaskType type) characterID, task_id); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s", + LogError("[TASKS] Error in CientTaskState::CancelTask [{}]", results.ErrorMessage().c_str()); return; } @@ -3184,7 +3168,7 @@ void ClientTaskState::RemoveTask(Client *c, int sequenceNumber, TaskType type) task_id, static_cast(type)); results = database.QueryDatabase(query); if (!results.Success()) - Log(Logs::General, Logs::Error, "[TASKS] Error in CientTaskState::CancelTask %s", + LogError("[TASKS] Error in CientTaskState::CancelTask [{}]", results.ErrorMessage().c_str()); Log(Logs::General, Logs::Tasks, "[UPDATE] CancelTask: %s", query.c_str()); diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index e13bf428f..d94a2bdd8 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -940,7 +940,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { //handle caps if(spec->nofail) { chance = 100; //cannot fail. - Log(Logs::Detail, Logs::Tradeskills, "...This combine cannot fail."); + LogTradeskills("This combine cannot fail"); } else if(over_trivial >= 0) { // At reaching trivial the chance goes to 95% going up an additional // percent for every 40 skillpoints above the trivial. @@ -960,8 +960,8 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { chance = 95; } - Log(Logs::Detail, Logs::Tradeskills, "...Current skill: %d , Trivial: %d , Success chance: %f percent", user_skill , spec->trivial , chance); - Log(Logs::Detail, Logs::Tradeskills, "...Bonusstat: %d , INT: %d , WIS: %d , DEX: %d , STR: %d", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); + LogTradeskills("Current skill: [{}] , Trivial: [{}] , Success chance: [{}] percent", user_skill , spec->trivial , chance); + LogTradeskills("Bonusstat: [{}] , INT: [{}] , WIS: [{}] , DEX: [{}] , STR: [{}]", bonusstat , GetINT() , GetWIS() , GetDEX() , GetSTR()); float res = zone->random.Real(0, 99); int aa_chance = 0; @@ -980,7 +980,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { MessageString(Chat::LightBlue, TRADESKILL_SUCCEED, spec->name.c_str()); - Log(Logs::Detail, Logs::Tradeskills, "Tradeskill success"); + LogTradeskills("Tradeskill success"); itr = spec->onsuccess.begin(); while(itr != spec->onsuccess.end() && !spec->quest) { @@ -1012,7 +1012,7 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) { MessageString(Chat::Emote,TRADESKILL_FAILED); - Log(Logs::Detail, Logs::Tradeskills, "Tradeskill failed"); + LogTradeskills("Tradeskill failed"); if (this->GetGroup()) { entity_list.MessageGroup(this, true, Chat::Skills,"%s was unsuccessful in %s tradeskill attempt.",GetName(),this->GetGender() == 0 ? "his" : this->GetGender() == 1 ? "her" : "its"); @@ -1091,9 +1091,9 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float NotifyNewTitlesAvailable(); } - Log(Logs::Detail, Logs::Tradeskills, "...skillup_modifier: %f , success_modifier: %d , stat modifier: %d", skillup_modifier , success_modifier , stat_modifier); - Log(Logs::Detail, Logs::Tradeskills, "...Stage1 chance was: %f percent", chance_stage1); - Log(Logs::Detail, Logs::Tradeskills, "...Stage2 chance was: %f percent. 0 percent means stage1 failed", chance_stage2); + LogTradeskills("skillup_modifier: [{}] , success_modifier: [{}] , stat modifier: [{}]", skillup_modifier , success_modifier , stat_modifier); + LogTradeskills("Stage1 chance was: [{}] percent", chance_stage1); + LogTradeskills("Stage2 chance was: [{}] percent. 0 percent means stage1 failed", chance_stage2); } bool ZoneDatabase::GetTradeRecipe(const EQEmu::ItemInstance* container, uint8 c_type, uint32 some_id, diff --git a/zone/trading.cpp b/zone/trading.cpp index 088582dc9..1618e7770 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1628,8 +1628,7 @@ void Client::BuyTraderItem(TraderBuy_Struct* tbs, Client* Trader, const EQApplic if((tbs->Price * outtbs->Quantity) <= 0) { Message(Chat::Red, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); Trader->Message(Chat::Red, "Internal error. Aborting trade. Please report this to the ServerOP. Error code is 1"); - Log(Logs::General, Logs::Error, "Bazaar: Zero price transaction between %s and %s aborted." - "Item: %s, Charges: %i, TBS: Qty %i, Price: %i", + LogError("Bazaar: Zero price transaction between [{}] and [{}] aborted. Item: [{}], Charges: [{}], TBS: Qty [{}], Price: [{}]", GetName(), Trader->GetName(), BuyItem->GetItem()->Name, BuyItem->GetCharges(), tbs->Quantity, tbs->Price); TradeRequestFailed(app); diff --git a/zone/zone.cpp b/zone/zone.cpp index 2d51633bb..ee891a056 100755 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -176,7 +176,7 @@ bool Zone::LoadZoneObjects() zoneid, instanceversion); auto results = database.QueryDatabase(query); if (!results.Success()) { - Log(Logs::General, Logs::Error, "Error Loading Objects from DB: %s", + LogError("Error Loading Objects from DB: [{}]", results.ErrorMessage().c_str()); return false; }