mirror of
https://github.com/noisiver/mod-weekendbonus.git
synced 2026-01-13 00:58:36 +00:00
Initial commit
Added the script taken directly from the old assistant code.
This commit is contained in:
6
src/ModWeekendBonus_Loader.cpp
Normal file
6
src/ModWeekendBonus_Loader.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
void AddWeekendBonusScripts();
|
||||
|
||||
void Addmod_weekendbonusScripts()
|
||||
{
|
||||
AddWeekendBonusScripts();
|
||||
}
|
||||
39
src/WeekendBonus.cpp
Normal file
39
src/WeekendBonus.cpp
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user