Edit config/script

Players can now enable or disable each feature with config.
This commit is contained in:
Lee
2017-05-26 01:42:50 +01:00
committed by GitHub
3 changed files with 190 additions and 124 deletions

View File

@@ -5,7 +5,41 @@
# Description: Enable PremiumAccount for players
# Default: 1 - (Enabled)
# 0 - (Disabled)
PremiumAccount = 1
# Morph
# Description: Enable Morph & demorph option for players
# Default: 1 - (Enabled)
# 0 - (Disabled)
Morph = 1
# Bank
# Description: Allow Players to use mobile bank
# Default: 1 - (Enabled)
# 0 - (Disabled)
Bank = 1
# Auction
# Description: Allow Players to use mobile Auction
# Default: 1 - (Enabled)
# 0 - (Disabled)
Auction = 1
# Mount
# Description: Allow Players to use mount
# Default: 1 - (Enabled)
# 0 - (Disabled)
Mount = 1
# Vendor
# Description: Allow Players to use vendor
# Default: 1 - (Enabled)
# 0 - (Disabled)
Vendor = 1
# Mail Box
# Description: Allow Players Access ingame Mail
# Default: 1 - (Enabled)
# 0 - (Disabled)
MailBox = 1

View File

@@ -1,3 +1,5 @@
void AddSC_premium_account();
void AddPremiumScripts() {
AddSC_premium_account();
}

View File

@@ -5,6 +5,7 @@
#include "ScriptedGossip.h"
#include "ScriptMgr.h"
#include "Spell.h"
#include "Configuration/Config.h"
enum vendor
{
@@ -34,12 +35,21 @@ public:
return false;
player->PlayerTalkClass->ClearMenus();
if (sConfigMgr->GetBoolDefault("Morph", true))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Morph", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Demorph", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
}
if (sConfigMgr->GetBoolDefault("Bank", true))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Show Bank", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
if (sConfigMgr->GetBoolDefault("MailBox", true))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Mail Box", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
if (sConfigMgr->GetBoolDefault("Vendor", true))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Vendor", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
if (sConfigMgr->GetBoolDefault("Mount", true))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT_16, "Mount", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
if (sConfigMgr->GetBoolDefault("Auction", true))
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, "Auction House", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7);
player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, item->GetGUID());
return false; // Cast the spell on use normally
@@ -143,7 +153,27 @@ public:
}
};
class premium_world : public WorldScript
{
public:
premium_world() : WorldScript("premiumworld") { }
void OnBeforeConfigLoad(bool reload) override
{
if (!reload) {
std::string cfg_file = "premium.conf";
std::string cfg_def_file = cfg_file + ".dist";
sConfigMgr->LoadMore(cfg_def_file.c_str());
sConfigMgr->LoadMore(cfg_file.c_str());
}
}
};
void AddSC_premium_account()
{
new premium_account();
new premium_world();
}