mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Scripts: move npc_experience hardcoded text to DB
(cherry picked from commit8df4706992) Rename 2016_08_28_17750_world.sql to 2016_08_25_05_world.sql (cherry picked from commit9c41af16ca)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user