Fixed compiled errors

This commit is contained in:
Revision
2025-02-14 23:42:27 +01:00
parent 7b2557c826
commit 99f2aa39a7
3 changed files with 15 additions and 6 deletions

View File

@@ -1,9 +1,6 @@
#ifndef MOD_WEEKENDBONUS_H
#define MOD_WEEKENDBONUS_H
#include "Chat.h"
#include "Config.h"
#include "Player.h"
#include "ScriptMgr.h"
enum Day

View File

@@ -1,9 +1,13 @@
#include "mod_weekendbonus.h"
#include "Config.h"
void WeekendBonus::OnAfterConfigLoad(bool reload)
{
if (!reload)
{
LoadDefaultValues();
}
ExperienceMultiplier = sConfigMgr->GetOption<float>("WeekendBonus.Multiplier.Experience", 2.0f);
MoneyMultiplier = sConfigMgr->GetOption<float>("WeekendBonus.Multiplier.Money", 2.0f);
@@ -15,11 +19,15 @@ void WeekendBonus::OnAfterConfigLoad(bool reload)
if (reload)
{
if ((localtime(&LocalTime)->tm_wday == Day::FRIDAY && localtime(&LocalTime)->tm_hour >= 18) || localtime(&LocalTime)->tm_wday == Day::SATURDAY || localtime(&LocalTime)->tm_wday == Day::SUNDAY)
{
SetRates(true);
}
else
{
SetRates(false);
}
}
}
void WeekendBonus::LoadDefaultValues()
{

View File

@@ -1,5 +1,7 @@
#include "mod_weekendbonus.h"
#include "WorldSessionMgr.h"
void WeekendBonus::OnStartup()
{
if (!HasActiveMultipliers())
@@ -11,8 +13,10 @@ void WeekendBonus::OnStartup()
LocalTime = time(NULL);
if ((localtime(&LocalTime)->tm_wday == Day::FRIDAY && localtime(&LocalTime)->tm_hour >= 18) || localtime(&LocalTime)->tm_wday == Day::SATURDAY || localtime(&LocalTime)->tm_wday == Day::SUNDAY)
{
SetRates(true);
}
}
void WeekendBonus::OnUpdate(uint32 diff)
{
@@ -28,12 +32,12 @@ void WeekendBonus::OnUpdate(uint32 diff)
if ((localtime(&LocalTime)->tm_wday == Day::FRIDAY && localtime(&LocalTime)->tm_hour >= 18) && !Triggered)
{
sWorld->SendServerMessage(SERVER_MSG_STRING, "The weekend bonus is now active, granting you bonuses!");
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, "The weekend bonus is now active, granting you bonuses!");
SetRates(true);
}
else if (localtime(&LocalTime)->tm_wday == Day::MONDAY && Triggered)
{
sWorld->SendServerMessage(SERVER_MSG_STRING, "The weekend bonus is no longer active.");
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, "The weekend bonus is no longer active.");
SetRates(false);
}
@@ -45,7 +49,7 @@ void WeekendBonus::OnUpdate(uint32 diff)
AnnouncementTime += Milliseconds(diff);
if (AnnouncementTime > AnnouncementFrequency)
{
sWorld->SendServerMessage(SERVER_MSG_STRING, "The weekend bonus is active, granting you bonuses!");
sWorldSessionMgr->SendServerMessage(SERVER_MSG_STRING, "The weekend bonus is active, granting you bonuses!");
AnnouncementTime = 0s;
}
}