From 293ba6d3e366443fa4cc03bec6a80bf8850833de Mon Sep 17 00:00:00 2001 From: Revision Date: Thu, 16 Jan 2025 01:56:27 +0100 Subject: [PATCH] Check multipliers Added checks to make sure at least one multiplier is set higher than 1 --- src/mod_weekendbonus.h | 1 + src/mod_weekendbonus_world.cpp | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/mod_weekendbonus.h b/src/mod_weekendbonus.h index 0cddeda..efe18d5 100644 --- a/src/mod_weekendbonus.h +++ b/src/mod_weekendbonus.h @@ -30,6 +30,7 @@ public: private: void LoadDefaultValues(); void SetRates(bool /*active*/); + bool HasActiveMultipliers(); bool Triggered; time_t LocalTime; diff --git a/src/mod_weekendbonus_world.cpp b/src/mod_weekendbonus_world.cpp index 3bb7fe0..645b970 100644 --- a/src/mod_weekendbonus_world.cpp +++ b/src/mod_weekendbonus_world.cpp @@ -2,6 +2,11 @@ void WeekendBonus::OnStartup() { + if (!HasActiveMultipliers) + { + return; + } + Triggered = false; LocalTime = time(NULL); @@ -11,6 +16,11 @@ void WeekendBonus::OnStartup() void WeekendBonus::OnUpdate(uint32 diff) { + if (!HasActiveMultipliers) + { + return; + } + CheckTime += Milliseconds(diff); if (CheckTime > CheckFrequency) { @@ -40,3 +50,13 @@ void WeekendBonus::OnUpdate(uint32 diff) } } } + +bool WeekendBonus::HasActiveMultipliers() +{ + if (ExperienceMultiplier > 1 || MoneyMultiplier > 1 || ProfessionsMultiplier > 1 || ReputationMultiplier > 1 || ProficienciesMultiplier > 1 || HonorMultiplier > 1) + { + return true; + } + + return false; +}