From 70ba7c9c856eda73397fbee4d4234e38046aed71 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 2 Sep 2019 03:35:19 -0500 Subject: [PATCH] Logs::NPCScaling to LogNPCScaling --- zone/npc.cpp | 2 +- zone/npc_scale_manager.cpp | 45 ++++++++++++++------------------------ 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 2e81653f5..8ccde1363 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -2153,7 +2153,7 @@ void NPC::ModifyNPCStat(const char *identifier, const char *new_value) std::string variable_key = StringFormat("modify_stat_%s", id.c_str()); SetEntityVariable(variable_key.c_str(), new_value); - Log(Logs::Detail, Logs::NPCScaling, "NPC::ModifyNPCStat key: %s val: %s ", variable_key.c_str(), new_value); + LogNPCScaling("NPC::ModifyNPCStat key: [{}] val: [{}] ", variable_key.c_str(), new_value); if (id == "ac") { AC = atoi(val.c_str()); diff --git a/zone/npc_scale_manager.cpp b/zone/npc_scale_manager.cpp index 5daabcb16..be9891e7f 100644 --- a/zone/npc_scale_manager.cpp +++ b/zone/npc_scale_manager.cpp @@ -24,10 +24,11 @@ /** * @param npc */ -void NpcScaleManager::ScaleNPC(NPC * npc) +void NpcScaleManager::ScaleNPC(NPC *npc) { - if (npc->IsSkipAutoScale()) + if (npc->IsSkipAutoScale()) { return; + } int8 npc_type = GetNPCScalingType(npc); int npc_level = npc->GetLevel(); @@ -36,7 +37,8 @@ void NpcScaleManager::ScaleNPC(NPC * npc) global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level); if (!scale_data.level) { - Log(Logs::General, Logs::NPCScaling, "NPC: %s - scaling data not found for type: %i level: %i", + LogNPCScaling( + "NPC: [{}] - scaling data not found for type: [{}] level: [{}]", npc->GetCleanName(), npc_type, npc_level @@ -109,11 +111,7 @@ void NpcScaleManager::ScaleNPC(NPC * npc) int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass()); min_dmg = (min_dmg * class_level_damage_mod) / 220; - Log(Logs::Moderate, - Logs::NPCScaling, - "ClassLevelDamageMod::min_dmg base: %i calc: %i", - scale_data.min_dmg, - min_dmg); + LogNPCScaling("ClassLevelDamageMod::min_dmg base: [{}] calc: [{}]", scale_data.min_dmg, min_dmg); } npc->ModifyNPCStat("min_hit", std::to_string(min_dmg).c_str()); @@ -124,12 +122,7 @@ void NpcScaleManager::ScaleNPC(NPC * npc) int32 class_level_damage_mod = GetClassLevelDamageMod(npc->GetLevel(), npc->GetClass()); max_dmg = (scale_data.max_dmg * class_level_damage_mod) / 220; - Log(Logs::Moderate, - Logs::NPCScaling, - "ClassLevelDamageMod::max_dmg base: %i calc: %i", - scale_data.max_dmg, - max_dmg - ); + LogNPCScaling("ClassLevelDamageMod::max_dmg base: [{}] calc: [{}]", scale_data.max_dmg, max_dmg); } npc->ModifyNPCStat("max_hit", std::to_string(max_dmg).c_str()); @@ -160,14 +153,14 @@ void NpcScaleManager::ScaleNPC(NPC * npc) } } - Log(Logs::General, - Logs::NPCScaling, - "(%s) level: %i type: %i Auto: %s Setting: %s", + LogNPCScaling( + "([{}]) level: [{}] type: [{}] Auto: [{}] Setting: [{}]", npc->GetCleanName(), npc_level, npc_type, (is_auto_scaled ? "true" : "false"), - scale_log.c_str()); + scale_log.c_str() + ); } } @@ -249,7 +242,7 @@ bool NpcScaleManager::LoadScaleData() ); } - Log(Logs::General, Logs::NPCScaling, "Global Base Scaling Data Loaded..."); + LogNPCScaling("Global Base Scaling Data Loaded"); return true; } @@ -426,7 +419,7 @@ int8 NpcScaleManager::GetNPCScalingType(NPC *&npc) if (npc->IsRareSpawn() || npc_name.find('#') != std::string::npos || isupper(npc_name[0])) { return 1; } - + return 0; } @@ -489,10 +482,8 @@ bool NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically(NPC *&npc) global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level); if (!scale_data.level) { - Log( - Logs::General, - Logs::NPCScaling, - "NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically NPC: %s - scaling data not found for type: %i level: %i", + LogNPCScaling( + "NpcScaleManager::ApplyGlobalBaseScalingToNPCStatically NPC: [{}] - scaling data not found for type: [{}] level: [{}]", npc->GetCleanName(), npc_type, npc_level @@ -577,10 +568,8 @@ bool NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically(NPC *&npc) global_npc_scale scale_data = GetGlobalScaleDataForTypeLevel(npc_type, npc_level); if (!scale_data.level) { - Log( - Logs::General, - Logs::NPCScaling, - "NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically NPC: %s - scaling data not found for type: %i level: %i", + LogNPCScaling( + "NpcScaleManager::ApplyGlobalBaseScalingToNPCDynamically NPC: [{}] - scaling data not found for type: [{}] level: [{}]", npc->GetCleanName(), npc_type, npc_level