update module (#8)

* update module

* update readme
This commit is contained in:
Micrah
2019-12-21 14:29:57 +11:00
committed by WiZZy
parent ee4f5fe791
commit 457e8853d1
8 changed files with 110 additions and 54 deletions

View File

@@ -3,10 +3,10 @@
#include "Configuration/Config.h"
#include "Player.h"
#include "AccountMgr.h"
#include "Chat.h"
#include "ScriptMgr.h"
#include "Define.h"
#include "GossipDef.h"
#include "Chat.h"
bool RewardSystem_Enable;
uint32 Max_roll;
@@ -14,23 +14,21 @@ uint32 Max_roll;
class reward_system : public PlayerScript
{
public:
reward_system() : PlayerScript("rewardsystem") {}
reward_system() : PlayerScript("reward_system") {}
uint32 RewardTimer;
int32 roll;
void OnLogin(Player* p)
{
if (RewardSystem_Enable)
{
ChatHandler(p->GetSession()).SendSysMessage("This server is running the |cff4CFF00Player Reward System |rmodule.");
RewardTimer = (sConfigMgr->GetIntDefault("RewardTime", 1)*HOUR*IN_MILLISECONDS);
}
}
void OnLogin(Player* player) override
{
if (sConfigMgr->GetBoolDefault("RewardSystem.Announce", true)) {
ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00Reward Time Played |rmodule.");
}
}
void OnBeforeUpdate(Player* player, uint32 p_time)
void OnBeforeUpdate(Player* player, uint32 p_time) override
{
if (RewardSystem_Enable)
if (sConfigMgr->GetBoolDefault("RewardSystemEnable", true))
{
if (RewardTimer > 0)
{
@@ -89,7 +87,6 @@ public:
std::string cfg_def_file = cfg_file + ".dist";
sConfigMgr->LoadMore(cfg_def_file.c_str());
sConfigMgr->LoadMore(cfg_file.c_str());
RewardSystem_Enable = sConfigMgr->GetBoolDefault("RewardSystemEnable", true);
Max_roll = sConfigMgr->GetIntDefault("MaxRoll", 1000);
}
}
@@ -99,4 +96,4 @@ void AddRewardSystemScripts()
{
new reward_system();
new reward_system_conf();
}
}