Initial commit

Added the script taken directly from the old assistant code.
This commit is contained in:
Revision
2021-12-08 18:11:27 +01:00
parent 341ec2cef1
commit 4a2fd85f5d
6 changed files with 78 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
void AddWeekendBonusScripts();
void Addmod_weekendbonusScripts()
{
AddWeekendBonusScripts();
}

39
src/WeekendBonus.cpp Normal file
View File

@@ -0,0 +1,39 @@
#include "Chat.h"
#include "Config.h"
#include "Player.h"
#include "ScriptMgr.h"
class WeekendBonus : public PlayerScript
{
public:
WeekendBonus() : PlayerScript("WeekendBonus") {}
void OnGiveXP(Player* player, uint32& amount, Unit* /*victim*/) override
{
time_t t = time(NULL);
if (localtime(&t)->tm_wday == 5 /*Friday*/ || localtime(&t)->tm_wday == 6 /*Saturday*/ || localtime(&t)->tm_wday == 0 /*Sunday*/)
amount *= sConfigMgr->GetIntDefault("Multiplier.Experience", 1);
}
void OnReputationChange(Player* player, uint32 /*factionId*/, int32& standing, bool /*incremental*/) override
{
time_t t = time(NULL);
if (localtime(&t)->tm_wday == 5 /*Friday*/ || localtime(&t)->tm_wday == 6 /*Saturday*/ || localtime(&t)->tm_wday == 0 /*Sunday*/)
standing *= sConfigMgr->GetIntDefault("Multiplier.Reputation", 1);
}
void OnLogin(Player* player) override
{
time_t t = time(NULL);
if (localtime(&t)->tm_wday == 5 /*Friday*/ || localtime(&t)->tm_wday == 6 /*Saturday*/ || localtime(&t)->tm_wday == 0 /*Sunday*/)
ChatHandler(player->GetSession()).SendSysMessage("The weekend bonus is active, increasing the experience and reputation received!");
}
};
void AddWeekendBonusScripts()
{
new WeekendBonus();
}