diff options
| author | Rat <none@none> | 2010-05-11 21:42:39 +0200 |
|---|---|---|
| committer | Rat <none@none> | 2010-05-11 21:42:39 +0200 |
| commit | eae6f5c09410cd61ef51999343a77b67c71a85d0 (patch) | |
| tree | 05a01e3cad9a6c67f366b87e7b13a12c3270ea42 /src/scripts | |
| parent | bf9694a35408237320fdd26908a55f396999c24b (diff) | |
started implementing battleground experience system
-players gain xp by killing enemy players (event bonuses not added for now)
-player can switch xp gain on/off by talking to npc Slahtz or Behsten for a fee of 10golds
NOTE: turning off xp gain will turn off ALL xp gains from quests,monsters,pvp,etc
--HG--
branch : trunk
Diffstat (limited to 'src/scripts')
| -rw-r--r-- | src/scripts/world/npcs_special.cpp | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index c9b48cb293e..cfd1b7698fc 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -2063,6 +2063,10 @@ bool GossipSelect_npc_wormhole(Player* pPlayer, Creature* /*pCreature*/, uint32 return true; } +/*###### +## npc_pet_trainer +######*/ + enum ePetTrainer { TEXT_ISHUNTER = 5838, @@ -2377,7 +2381,64 @@ bool GossipSelect_npc_tabard_vendor(Player* pPlayer, Creature* pCreature, uint32 break; } return true; -} +} + +/*###### +## 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." + + +bool GossipHello_npc_experience(Player* pPlayer, Creature* pCreature) +{ + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_EXP, pCreature->GetGUID()); + return true; +} + +bool GossipSelect_npc_experience(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) +{ + bool noXPGain = pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); + bool doSwitch = false; + + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1://xp off + { + if (!noXPGain)//does gain xp + doSwitch = true;//switch to don't gain xp + } + break; + case GOSSIP_ACTION_INFO_DEF + 2://xp on + { + if (noXPGain)//doesn't gain xp + doSwitch = true;//switch to gain xp + } + break; + } + if (doSwitch) + { + if (pPlayer->GetMoney() < EXP_COST) + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); + else if (noXPGain) + { + pPlayer->ModifyMoney(-EXP_COST); + pPlayer->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); + } + else if (!noXPGain) + { + pPlayer->ModifyMoney(-EXP_COST); + pPlayer->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); + } + } + pPlayer->PlayerTalkClass->CloseGossip(); + return true; +} void AddSC_npcs_special() { @@ -2528,6 +2589,12 @@ void AddSC_npcs_special() newscript->Name = "npc_tabard_vendor"; newscript->pGossipHello = &GossipHello_npc_tabard_vendor; newscript->pGossipSelect = &GossipSelect_npc_tabard_vendor; - newscript->RegisterSelf(); + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_experience"; + newscript->pGossipHello = &GossipHello_npc_experience; + newscript->pGossipSelect = &GossipSelect_npc_experience; + newscript->RegisterSelf(); } |
