feat(Core/Conf): toggle XP price (#4388)

This commit is contained in:
Francesco Borzì
2021-02-02 04:11:54 +01:00
committed by GitHub
parent 2bbfb20d6f
commit f85cb30c99
4 changed files with 16 additions and 4 deletions

View File

@@ -371,6 +371,7 @@ enum WorldIntConfigs
CONFIG_GUILD_BANK_TAB_COST_4,
CONFIG_GUILD_BANK_TAB_COST_5,
CONFIG_GM_LEVEL_CHANNEL_MODERATION,
CONFIG_TOGGLE_XP_COST,
CONFIG_NPC_EVADE_IF_NOT_REACHABLE,
INT_CONFIG_VALUE_COUNT
};

View File

@@ -1294,6 +1294,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_PVP_TOKEN_COUNT] = 1;
m_bool_configs[CONFIG_NO_RESET_TALENT_COST] = sConfigMgr->GetBoolDefault("NoResetTalentsCost", false);
m_int_configs[CONFIG_TOGGLE_XP_COST] = sConfigMgr->GetIntDefault("ToggleXP.Cost", 100000);
m_bool_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowKickInWorld", false);
m_bool_configs[CONFIG_SHOW_MUTE_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowMuteInWorld", false);
m_bool_configs[CONFIG_SHOW_BAN_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowBanInWorld", false);

View File

@@ -1994,7 +1994,6 @@ public:
## npc_experience
######*/
#define EXP_COST 100000 //10 00 00 copper (10golds)
#define GOSSIP_TEXT_EXP 14736
#define GOSSIP_XP_OFF "I no longer wish to gain experience."
#define GOSSIP_XP_ON "I wish to start gaining experience again."
@@ -2017,6 +2016,7 @@ public:
ClearGossipMenuFor(player);
bool noXPGain = player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
bool doSwitch = false;
auto toggleXpCost = sWorld->getIntConfig(CONFIG_TOGGLE_XP_COST);
switch (action)
{
@@ -2035,16 +2035,18 @@ public:
}
if (doSwitch)
{
if (!player->HasEnoughMoney(EXP_COST))
if (!player->HasEnoughMoney(toggleXpCost))
{
player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
}
else if (noXPGain)
{
player->ModifyMoney(-EXP_COST);
player->ModifyMoney(-toggleXpCost);
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
}
else if (!noXPGain)
{
player->ModifyMoney(-EXP_COST);
player->ModifyMoney(-toggleXpCost);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
}
}

View File

@@ -3318,6 +3318,14 @@ PvPToken.ItemCount = 1
NoResetTalentsCost = 0
#
# ToggleXP.Cost
# Description: Cost of locking/unlocking XP
# Default: 100000 - (10 Gold)
#
ToggleXP.Cost = 100000
#
# Guild.AllowMultipleGuildMaster
# Description: Allow more than one guild master. Additional Guild Masters must be set using