aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortkrokli <tkrokli@users.noreply.github.com>2016-08-25 09:07:45 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-18 16:23:19 +0100
commitac88c6ec17d1e97a366a78df2dcc7f3b2fd9a1d8 (patch)
treed3e96ee6c37675eebdad38a7ec0806b24187b5b2 /src
parentd01dbdc52806626e7c0a03448f80c42e3fa1f4ec (diff)
Core/Scripts: move npc_experience hardcoded text to DB
(cherry picked from commit 8df4706992f0fa39af5892dce2c23a0dde5bd9c1) Rename 2016_08_28_17750_world.sql to 2016_08_25_05_world.sql (cherry picked from commit 9c41af16cae65c6a7cc97a22fd877993eb9dfa49)
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/World/npcs_special.cpp55
1 files changed, 21 insertions, 34 deletions
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 93e51090ffe..23d5e24cbf7 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -1841,10 +1841,13 @@ 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."
+enum BehstenSlahtz
+{
+ MENU_ID_XP_ON_OFF = 10638,
+ NPC_TEXT_XP_ON_OFF = 14736,
+ OPTION_ID_XP_OFF = 0, // "I no longer wish to gain experience."
+ OPTION_ID_XP_ON = 1 // "I wish to start gaining experience again."
+};
class npc_experience : public CreatureScript
{
@@ -1853,48 +1856,32 @@ public:
bool OnGossipHello(Player* player, Creature* creature) override
{
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
- player->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_EXP, creature->GetGUID());
+ if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN)) // not gaining XP
+ {
+ player->ADD_GOSSIP_ITEM_DB(MENU_ID_XP_ON_OFF, OPTION_ID_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->SEND_GOSSIP_MENU(NPC_TEXT_XP_ON_OFF, creature->GetGUID());
+ }
+ else // currently gaining XP
+ {
+ player->ADD_GOSSIP_ITEM_DB(MENU_ID_XP_ON_OFF, OPTION_ID_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ player->SEND_GOSSIP_MENU(NPC_TEXT_XP_ON_OFF, creature->GetGUID());
+ }
return true;
}
bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) override
{
player->PlayerTalkClass->ClearMenus();
- bool noXPGain = player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
- bool doSwitch = false;
switch (action)
{
- case GOSSIP_ACTION_INFO_DEF + 1://xp off
- {
- if (!noXPGain)//does gain xp
- doSwitch = true;//switch to don't gain xp
- }
+ case GOSSIP_ACTION_INFO_DEF + 1: // XP ON selected
+ player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); // turn on XP gain
break;
- case GOSSIP_ACTION_INFO_DEF + 2://xp on
- {
- if (noXPGain)//doesn't gain xp
- doSwitch = true;//switch to gain xp
- }
+ case GOSSIP_ACTION_INFO_DEF + 2: // XP OFF selected
+ player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); // turn off XP gain
break;
}
- if (doSwitch)
- {
- if (!player->HasEnoughMoney(uint64(EXP_COST)))
- player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
- else if (noXPGain)
- {
- player->ModifyMoney(-int64(EXP_COST));
- player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
- }
- else if (!noXPGain)
- {
- player->ModifyMoney(-EXP_COST);
- player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
- }
- }
player->PlayerTalkClass->SendCloseGossip();
return true;
}