aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkrokli <tkrokli@users.noreply.github.com>2016-08-25 09:07:45 +0200
committerAokromes <Aokromes@users.noreply.github.com>2016-08-25 09:07:45 +0200
commit8df4706992f0fa39af5892dce2c23a0dde5bd9c1 (patch)
tree0738497fc4b7c0474336edaa91cd79e57a1b65b3
parent8bc00e8952e5ae35b69edb50785d0a19ebf8e91e (diff)
Core/Scripts: move npc_experience hardcoded text to DB
-rw-r--r--sql/updates/world/3.3.5/2016_08_28_17750_world.sql8
-rw-r--r--src/server/scripts/World/npcs_special.cpp57
2 files changed, 30 insertions, 35 deletions
diff --git a/sql/updates/world/3.3.5/2016_08_28_17750_world.sql b/sql/updates/world/3.3.5/2016_08_28_17750_world.sql
new file mode 100644
index 00000000000..75b89a1159f
--- /dev/null
+++ b/sql/updates/world/3.3.5/2016_08_28_17750_world.sql
@@ -0,0 +1,8 @@
+-- NPC 35364 Slahtz <Experience Eliminator> / 35365 Behsten <Experience Eliminator>
+UPDATE `creature_template` SET `gossip_menu_id`= 10638 WHERE `entry`= 35365; -- 35364 already OK
+
+UPDATE `gossip_menu_option` SET `box_money`= 100000, `box_text`= 'Are you certain you wish to stop gaining experience?', `BoxBroadcastTextID`= 35535 WHERE `menu_id`= 10638 AND `id`= 0;
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id`= 10638 AND `id`= 1;
+INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`OptionBroadcastTextID`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`,`BoxBroadcastTextID`,`VerifiedBuild`) VALUES
+(10638,1,0,'I wish to start gaining experience again.',35532,1,1,0,0,0,100000,'Are you certain you wish to start gaining experience again?',35533,0);
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index eed92818e83..b4019321131 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -1846,10 +1846,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
{
@@ -1858,49 +1861,33 @@ 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(EXP_COST))
- player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
- else if (noXPGain)
- {
- player->ModifyMoney(-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();
+ player->CLOSE_GOSSIP_MENU();
return true;
}
};