From fc5266e115b6702d65b4f6d2f69aaa281ad9847f Mon Sep 17 00:00:00 2001 From: Trevius Date: Sun, 25 Jan 2015 12:31:07 -0600 Subject: [PATCH] Added Logs::Mercenaries to the new Logging System. Logging of Mercenary information is off by default with the required SQL. --- changelog.txt | 1 + common/eqemu_logsys.cpp | 3 + common/eqemu_logsys.h | 2 + common/version.h | 2 +- utils/sql/db_update_manifest.txt | 1 + ...2015_01_25_logsys_Mercenaries_category.sql | 1 + zone/client.cpp | 9 +- zone/client_packet.cpp | 30 ++--- zone/merc.cpp | 123 ++++++------------ zone/merc.h | 1 - zone/zone.cpp | 3 +- 11 files changed, 61 insertions(+), 115 deletions(-) create mode 100644 utils/sql/git/required/2015_01_25_logsys_Mercenaries_category.sql diff --git a/changelog.txt b/changelog.txt index 54385b20f..5711f9d01 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- == 01/25/2015 == Trevius: Fixed an issue where Mercenaries were causing several DB queries per second while suspended. +Trevius: Added Logs::Mercenaries to the new Logging System. Logging of Mercenary information is off by default with the required SQL. == 01/24/2015 == Uleat: Added equipment light source functionality to all mob derived classes (may still need tweaking...) diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 13302fbd2..7f462696b 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -188,6 +188,7 @@ uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){ case Logs::Quests: return Console::Color::LightCyan; case Logs::Commands: + case Logs::Mercenaries: return Console::Color::LightMagenta; case Logs::Crash: return Console::Color::LightRed; @@ -210,6 +211,7 @@ std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category){ case Logs::Quests: return LC_CYAN; case Logs::Commands: + case Logs::Mercenaries: return LC_MAGENTA; case Logs::Crash: return LC_RED; @@ -232,6 +234,7 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){ case Logs::Quests: return 258; /* Light Cyan */ case Logs::Commands: + case Logs::Mercenaries: return 5; /* Light Purple */ case Logs::Crash: return 13; /* Red */ diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 1656a936d..491ded3c6 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -76,6 +76,7 @@ namespace Logs{ Zone_Server, MySQLError, MySQLQuery, + Mercenaries, MaxCategoryID /* Don't Remove this*/ }; @@ -118,6 +119,7 @@ namespace Logs{ "Zone Server", "MySQL Error", "MySQL Query", + "Mercenaries", }; } diff --git a/common/version.h b/common/version.h index 5d09e7f7e..624418df5 100644 --- a/common/version.h +++ b/common/version.h @@ -30,7 +30,7 @@ Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9068 +#define CURRENT_BINARY_DATABASE_VERSION 9069 #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ #ifndef WIN32 diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index b6ce65332..e76c74852 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -322,6 +322,7 @@ 9066|2014_12_31_npc_types_default_values_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'bodytype'|contains|YES 9067|2015_01_21_npc_types_update.sql|SHOW COLUMNS FROM `npc_types` LIKE 'light'|empty| 9068|2015_01_15_logsys_categories_table.sql|SHOW TABLES LIKE 'logsys_categories'|empty| +9069|2015_01_25_logsys_Mercenaries_category.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Mercenaries'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2015_01_25_logsys_Mercenaries_category.sql b/utils/sql/git/required/2015_01_25_logsys_Mercenaries_category.sql new file mode 100644 index 000000000..960f187bb --- /dev/null +++ b/utils/sql/git/required/2015_01_25_logsys_Mercenaries_category.sql @@ -0,0 +1 @@ +INSERT INTO `logsys_categories` (`log_category_id`,`log_category_description`,`log_to_console`,`log_to_file`,`log_to_gmsay`) VALUES ('37', 'Mercenaries', '0', '0', '0'); \ No newline at end of file diff --git a/zone/client.cpp b/zone/client.cpp index ecd777653..a9133e409 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7275,8 +7275,7 @@ void Client::SendMercPersonalInfo() stancecount += zone->merc_stance_list[GetMercInfo().MercTemplateID].size(); if(stancecount > MAX_MERC_STANCES || mercCount > MAX_MERC || mercTypeCount > MAX_MERC_GRADES) { - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercPersonalInfo Cancelled: (%i) (%i) (%i)", stancecount, mercCount, mercTypeCount); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo canceled: (%i) (%i) (%i)", stancecount, mercCount, mercTypeCount); SendMercMerchantResponsePacket(0); return; } @@ -7370,15 +7369,13 @@ void Client::SendMercPersonalInfo() return; } } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercPersonalInfo Send Successful"); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo Send Successful"); SendMercMerchantResponsePacket(0); } else { - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercPersonalInfo Send Failed Due to no MercData for %i", GetMercInfo().MercTemplateID); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo Send Failed Due to no MercData for %i", GetMercInfo().MercTemplateID); } } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 9796cc52a..309c273f7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9314,8 +9314,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) uint32 merc_command = mc->MercCommand; // Seen 0 (zone in with no merc or suspended), 1 (dismiss merc), 5 (normal state), 20 (unknown), 36 (zone in with merc) int32 option = mc->Option; // Seen -1 (zone in with no merc), 0 (setting to passive stance), 1 (normal or setting to balanced stance) - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Command %i, Option %i received.", merc_command, option); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Command %i, Option %i received.", merc_command, option); if (!RuleB(Mercs, AllowMercs)) return; @@ -9349,8 +9348,7 @@ void Client::Handle_OP_MercenaryCommand(const EQApplicationPacket *app) merc->SetStance(mercTemplate->Stances[option]); GetMercInfo().Stance = mercTemplate->Stances[option]; - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Set Stance: %u", merc->GetStance()); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Set Stance: %u", merc->GetStance()); } } } @@ -9373,8 +9371,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) uint32 merchant_id = mmsr->MercMerchantID; uint32 altCurrentType = 19; - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Data Request for Merchant ID (%i)", merchant_id); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Data Request for Merchant ID (%i)", merchant_id); //client is requesting data about currently owned mercenary if (merchant_id == 0) { @@ -9382,14 +9379,12 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) //send info about your current merc(s) if (GetMercInfo().mercid) { - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercPersonalInfo Request"); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo Request"); SendMercPersonalInfo(); } else { - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercPersonalInfo Not Sent - MercID (%i)", GetMercInfo().mercid); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercPersonalInfo Not Sent - MercID (%i)", GetMercInfo().mercid); } } @@ -9502,8 +9497,7 @@ void Client::Handle_OP_MercenaryDataUpdateRequest(const EQApplicationPacket *app return; } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Data Update Request Received."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Data Update Request Received."); if (GetMercID()) { @@ -9529,8 +9523,7 @@ void Client::Handle_OP_MercenaryDismiss(const EQApplicationPacket *app) Command = VARSTRUCT_DECODE_TYPE(uint8, InBuffer); } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Dismiss Request ( %i ) Received.", Command); // Handle the dismiss here... DismissMerc(GetMercInfo().mercid); @@ -9555,8 +9548,7 @@ void Client::Handle_OP_MercenaryHire(const EQApplicationPacket *app) uint32 merc_unk1 = mmrq->MercUnk01; uint32 merc_unk2 = mmrq->MercUnk02; - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Template ID (%i), Merchant ID (%i), Unknown1 (%i), Unknown2 (%i)", merc_template_id, merchant_id, merc_unk1, merc_unk2); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Template ID (%i), Merchant ID (%i), Unknown1 (%i), Unknown2 (%i)", merc_template_id, merchant_id, merc_unk1, merc_unk2); //HirePending = true; SetHoTT(0); @@ -9622,8 +9614,7 @@ void Client::Handle_OP_MercenarySuspendRequest(const EQApplicationPacket *app) SuspendMercenary_Struct* sm = (SuspendMercenary_Struct*)app->pBuffer; uint32 merc_suspend = sm->SuspendMerc; // Seen 30 for suspending or unsuspending - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Suspend ( %i ) received.", merc_suspend); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Suspend ( %i ) received.", merc_suspend); if (!RuleB(Mercs, AllowMercs)) return; @@ -9643,8 +9634,7 @@ void Client::Handle_OP_MercenaryTimerRequest(const EQApplicationPacket *app) return; } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Timer Request received."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Timer Request received."); if (!RuleB(Mercs, AllowMercs)) { return; diff --git a/zone/merc.cpp b/zone/merc.cpp index 963beb9e5..b37e73567 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2242,10 +2242,9 @@ bool Merc::AICastSpell(int8 iChance, int32 iSpellTypes) { case TANK: //check for taunt if(CheckAETaunt()) { - if(MERC_DEBUG > 0) - GetOwner()->Message(7, "AE Taunting"); //get AE taunt selectedMercSpell = GetBestMercSpellForAETaunt(this); + Log.Out(Logs::General, Logs::Mercenaries, "AE Taunting"); } if(selectedMercSpell.spellid == 0 && CheckTaunt()) { @@ -4125,8 +4124,7 @@ bool Merc::CheckAETaunt() { } if(result >= 1) { - if(MERC_DEBUG > 0) - Message(7, "%s: Attempting AE Taunt", GetCleanName()); + Log.Out(Logs::General, Logs::Mercenaries, "%s: Attempting AE Taunt", GetCleanName()); return true; } } @@ -4691,15 +4689,6 @@ bool Merc::LoadMercSpells() { AIautocastspell_timer->Trigger(); } - if(MERC_DEBUG > 0) { - /*GetMercOwner()->Message(7, "Mercenary Debug: Loaded %i spells for merc.", merc_spells.size()); - - GetMercOwner()->Message(7, "Mercenary Debug: Spell list for merc."); - for (int i = merc_spells.size() - 1; i >= 0; i--) { - GetMercOwner()->Message(7, "%i] Slot: %i, SpellID: %i, Type: %i, Stance: %i, Proc Chance: %i", i, merc_spells[i].slot, merc_spells[i].spellid, merc_spells[i].type, merc_spells[i].stance, merc_spells[i].proc_chance); - }*/ - } - return true; } @@ -4949,8 +4938,7 @@ bool Merc::Spawn(Client *owner) { SendPosition(); - if (MERC_DEBUG > 0) - owner->Message(7, "Mercenary Debug: Spawn."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Spawn."); //UpdateMercAppearance(); @@ -5096,8 +5084,7 @@ void Client::SendMercResponsePackets(uint32 ResponseType) SendMercMerchantResponsePacket(3); break; } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercResponsePackets %i.", ResponseType); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercResponsePackets %i.", ResponseType); } void Client::UpdateMercTimer() @@ -5138,8 +5125,7 @@ void Client::UpdateMercTimer() SendMercResponsePackets(16); } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: UpdateMercTimer Complete."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: UpdateMercTimer Complete."); // Normal upkeep charge message //Message(7, "You have been charged a mercenary upkeep cost of %i plat, and %i gold and your mercenary upkeep cost timer has been reset to 15 minutes.", upkeep_plat, upkeep_gold, (int)(RuleI(Mercs, UpkeepIntervalMS) / 1000 / 60)); @@ -5192,8 +5178,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) { } } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: CheckCanHireMerc True."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: CheckCanHireMerc True."); return true; } @@ -5266,8 +5251,7 @@ bool Client::CheckCanSpawnMerc(uint32 template_id) { return false; } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: CheckCanSpawnMerc True."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: CheckCanSpawnMerc True."); return true; } @@ -5289,8 +5273,7 @@ bool Client::CheckCanUnsuspendMerc() { return false; } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: CheckCanUnsuspendMerc True."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: CheckCanUnsuspendMerc True."); return true; } @@ -5305,8 +5288,7 @@ void Client::CheckMercSuspendTimer() { GetMercInfo().SuspendedTime = 0; SendMercResponsePackets(0); SendMercSuspendResponsePacket(GetMercInfo().SuspendedTime); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: CheckMercSuspendTimer Ready."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: CheckMercSuspendTimer Ready."); } } } @@ -5319,8 +5301,7 @@ void Client::SuspendMercCommand() { { if(!CheckCanUnsuspendMerc()) { - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SuspendMercCommand Unable to Unsuspend."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SuspendMercCommand Unable to Unsuspend."); return; } @@ -5330,15 +5311,13 @@ void Client::SuspendMercCommand() { if(merc) { SpawnMerc(merc, true); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SuspendMercCommand Successful Unsuspend."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SuspendMercCommand Successful Unsuspend."); } else { //merc failed to spawn SendMercResponsePackets(3); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SuspendMercCommand Failed to Spawn Merc."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SuspendMercCommand Failed to Spawn Merc."); } } else @@ -5348,8 +5327,7 @@ void Client::SuspendMercCommand() { if(CurrentMerc && GetMercID()) { CurrentMerc->Suspend(); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SuspendMercCommand Successful Suspend."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SuspendMercCommand Successful Suspend."); } } } @@ -5384,8 +5362,7 @@ void Client::SpawnMercOnZone() { { SpawnMerc(merc, false); } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SpawnMercOnZone Normal Merc."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SpawnMercOnZone Normal Merc."); } else { @@ -5401,8 +5378,7 @@ void Client::SpawnMercOnZone() { // Send Mercenary Status/Timer packet SendMercTimer(GetMerc()); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SpawnMercOnZone Suspended Merc."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SpawnMercOnZone Suspended Merc."); } } else @@ -5422,20 +5398,17 @@ void Client::SendMercTimer(Merc* merc) { if (!merc) { SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercTimer No Merc."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercTimer No Merc."); } else if (merc->IsSuspended()) { SendMercTimerPacket(NO_MERC_ID, MERC_STATE_SUSPENDED, GetMercInfo().SuspendedTime, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercTimer Suspended Merc."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercTimer Suspended Merc."); } else { SendMercTimerPacket(merc->GetID(), MERC_STATE_NORMAL, NOT_SUSPENDED_TIME, GetMercInfo().MercTimerRemaining, RuleI(Mercs, SuspendIntervalMS)); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SendMercTimer Normal Merc."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SendMercTimer Normal Merc."); } } @@ -5457,8 +5430,7 @@ void Client::SpawnMerc(Merc* merc, bool setMaxStats) { merc->Unsuspend(setMaxStats); merc->SetStance(GetMercInfo().Stance); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SpawnMerc Success."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SpawnMerc Success."); return; @@ -5487,8 +5459,7 @@ bool Merc::Suspend() { // Start the timer to send the packet that refreshes the Unsuspend Button mercOwner->GetPTimers().Start(pTimerMercSuspend, RuleI(Mercs, SuspendIntervalS)); - if (MERC_DEBUG > 0) - mercOwner->Message(7, "Mercenary Debug: Suspend Complete."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Suspend Complete."); return true; } @@ -5574,14 +5545,12 @@ bool Client::DismissMerc(uint32 MercID) { bool Dismissed = true; if (!database.DeleteMerc(MercID)) { - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Dismiss Failed for MercID %i", MercID); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Dismiss Failed for MercID %i", MercID); Dismissed = false; } else { - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Dismiss Successful."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Dismiss Successful."); } if (GetMerc()) @@ -5740,16 +5709,14 @@ bool Merc::MercJoinClientGroup() { database.SetGroupID(this->GetName(), g->GetID(), mercOwner->CharacterID(), true); database.RefreshGroupFromDB(mercOwner); g->SaveGroupLeaderAA(); - if(MERC_DEBUG > 0) - mercOwner->Message(7, "Mercenary Debug: Mercenary joined new group."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Mercenary joined new group."); } else { g->DisbandGroup(); Suspend(); - if(MERC_DEBUG > 0) - mercOwner->Message(7, "Mercenary Debug: Mercenary disbanded new group."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Mercenary disbanded new group."); } } @@ -5761,15 +5728,13 @@ bool Merc::MercJoinClientGroup() { // Update members that are out of zone GetGroup()->SendGroupJoinOOZ(this); - if(MERC_DEBUG > 0) - mercOwner->Message(7, "Mercenary Debug: Mercenary joined existing group."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Mercenary joined existing group."); } else { Suspend(); - if(MERC_DEBUG > 0) - mercOwner->Message(7, "Mercenary Debug: Mercenary failed to join the group - Suspending"); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Mercenary failed to join the group - Suspending"); } } @@ -5820,8 +5785,7 @@ Merc* Client::GetMerc() { if(GetMercID() == 0) { - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: GetMerc 0."); + Log.Out(Logs::Detail, Logs::Mercenaries, "Mercenary Debug: GetMerc 0."); return (nullptr); } @@ -5829,16 +5793,14 @@ Merc* Client::GetMerc() { if(tmp == nullptr) { SetMercID(0); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: GetMerc No Merc."); + Log.Out(Logs::Detail, Logs::Mercenaries, "Mercenary Debug: GetMerc No Merc."); return (nullptr); } if(tmp->GetOwnerID() != GetID()) { SetMercID(0); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: GetMerc Owner Mismatch."); + Log.Out(Logs::Detail, Logs::Mercenaries, "Mercenary Debug: GetMerc Owner Mismatch."); return (nullptr); } @@ -5856,8 +5818,7 @@ uint8 Client::GetNumMercs() { numMercs++; } } - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: GetNumMercs %i.", numMercs); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: GetNumMercs %i.", numMercs); return numMercs; } @@ -5898,8 +5859,7 @@ void Client::SetMerc(Merc* newmerc) { GetMercInfo().Gender = 0; GetMercInfo().State = 0; memset(GetMercInfo().merc_name, 0, 64); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SetMerc No Merc."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SetMerc No Merc."); } else { @@ -5916,8 +5876,7 @@ void Client::SetMerc(Merc* newmerc) { GetMercInfo().Gender = newmerc->GetGender(); GetMercInfo().State = newmerc->IsSuspended() ? MERC_STATE_SUSPENDED : MERC_STATE_NORMAL; snprintf(GetMercInfo().merc_name, 64, "%s", newmerc->GetName()); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: SetMerc New Merc."); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: SetMerc New Merc."); } } @@ -5937,8 +5896,7 @@ void Client::SendMercMerchantResponsePacket(int32 response_type) { MercenaryMerchantResponse_Struct* mmr = (MercenaryMerchantResponse_Struct*)outapp->pBuffer; mmr->ResponseType = response_type; // send specified response type FastQueuePacket(&outapp); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Sent SendMercMerchantResponsePacket %i.", response_type); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercMerchantResponsePacket %i.", response_type); } } @@ -5947,8 +5905,7 @@ void Client::SendMercenaryUnknownPacket(uint8 type) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnknown1, 1); outapp->WriteUInt8(type); FastQueuePacket(&outapp); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Sent SendMercenaryUnknownPacket %i.", type); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercenaryUnknownPacket %i.", type); } @@ -5957,8 +5914,7 @@ void Client::SendMercenaryUnsuspendPacket(uint8 type) { EQApplicationPacket *outapp = new EQApplicationPacket(OP_MercenaryUnsuspendResponse, 1); outapp->WriteUInt8(type); FastQueuePacket(&outapp); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Sent SendMercenaryUnsuspendPacket %i.", type); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercenaryUnsuspendPacket %i.", type); } @@ -5968,8 +5924,7 @@ void Client::SendMercSuspendResponsePacket(uint32 suspended_time) { SuspendMercenaryResponse_Struct* smr = (SuspendMercenaryResponse_Struct*)outapp->pBuffer; smr->SuspendTime = suspended_time; // Seen 0 (not suspended) or c9 c2 64 4f (suspended on Sat Mar 17 11:58:49 2012) - Unix Timestamp FastQueuePacket(&outapp); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Sent SendMercSuspendResponsePacket %i.", suspended_time); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercSuspendResponsePacket %i.", suspended_time); } @@ -5984,8 +5939,7 @@ void Client::SendMercTimerPacket(int32 entity_id, int32 merc_state, int32 suspen mss->UpdateInterval = update_interval; // Seen 900000 - 15 minutes in ms mss->MercUnk01 = unk01; // Seen 180000 - 3 minutes in ms - Used for the unsuspend button refresh timer FastQueuePacket(&outapp); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Sent SendMercTimerPacket %i, %i, %i, %i, %i.", entity_id, merc_state, suspended_time, update_interval, unk01); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercTimerPacket %i, %i, %i, %i, %i.", entity_id, merc_state, suspended_time, update_interval, unk01); } @@ -5996,8 +5950,7 @@ void Client::SendMercAssignPacket(uint32 entityID, uint32 unk01, uint32 unk02) { mas->MercUnk01 = unk01; mas->MercUnk02 = unk02; FastQueuePacket(&outapp); - if (MERC_DEBUG > 0) - Message(7, "Mercenary Debug: Sent SendMercAssignPacket %i, %i, %i.", entityID, unk01, unk02); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Sent SendMercAssignPacket %i, %i, %i.", entityID, unk01, unk02); } void NPC::LoadMercTypes() { diff --git a/zone/merc.h b/zone/merc.h index 210ef5518..31433a060 100644 --- a/zone/merc.h +++ b/zone/merc.h @@ -13,7 +13,6 @@ struct MercTemplate; struct NPCType; struct NewSpawn_Struct; -#define MERC_DEBUG 0 #define MAXMERCS 1 #define TANK 1 #define HEALER 2 diff --git a/zone/zone.cpp b/zone/zone.cpp index bcbf7ff41..5885b6e95 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -656,8 +656,7 @@ void Zone::LoadMercSpells(){ merc_spells_list[classid].push_back(tempMercSpellEntry); } - if(MERC_DEBUG > 0) - Log.Out(Logs::General, Logs::None, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); + Log.Out(Logs::General, Logs::Mercenaries, "Mercenary Debug: Loaded %i merc spells.", merc_spells_list[1].size() + merc_spells_list[2].size() + merc_spells_list[9].size() + merc_spells_list[12].size()); }