TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
npc_experience Class Reference

Public Member Functions

 npc_experience ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *, uint32, uint32 action) override
 
- Public Member Functions inherited from CreatureScript
virtual bool OnDummyEffect (Unit *, uint32, SpellEffIndex, Creature *)
 
virtual bool OnGossipSelectCode (Player *, Creature *, uint32, uint32, const char *)
 
virtual bool OnQuestAccept (Player *, Creature *, Quest const *)
 
virtual bool OnQuestSelect (Player *, Creature *, Quest const *)
 
virtual bool OnQuestReward (Player *, Creature *, Quest const *, uint32)
 
virtual uint32 GetDialogStatus (Player *, Creature *)
 
virtual CreatureAIGetAI (Creature *) const
 
- Public Member Functions inherited from UnitScript
virtual void OnHeal (Unit *, Unit *, uint32 &)
 
virtual void OnDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifyPeriodicDamageAurasTick (Unit *, Unit *, uint32 &)
 
virtual void ModifyMeleeDamage (Unit *, Unit *, uint32 &)
 
virtual void ModifySpellDamageTaken (Unit *, Unit *, int32 &)
 
- Public Member Functions inherited from ScriptObject
const std::string & GetName () const
 
- Public Member Functions inherited from UpdatableScript< Creature >
virtual void OnUpdate (Creature *, uint32)
 

Additional Inherited Members

- Protected Member Functions inherited from CreatureScript
 CreatureScript (const char *name)
 
- Protected Member Functions inherited from UnitScript
 UnitScript (const char *name, bool addToScripts=true)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
virtual ~ScriptObject ()
 
- Protected Member Functions inherited from UpdatableScript< Creature >
 UpdatableScript ()
 
virtual ~UpdatableScript ()
 

Constructor & Destructor Documentation

npc_experience::npc_experience ( )
inline
1904 : CreatureScript("npc_experience") { }
CreatureScript(const char *name)
Definition: ScriptMgr.cpp:1586

Member Function Documentation

bool npc_experience::OnGossipHello ( Player player,
Creature creature 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

1907  {
1910  player->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_EXP, creature->GetGUID());
1911  return true;
1912  }
#define GOSSIP_TEXT_EXP
Definition: npcs_special.cpp:1897
#define GOSSIP_XP_OFF
Definition: npcs_special.cpp:1898
Definition: ScriptedGossip.h:71
#define GOSSIP_XP_ON
Definition: npcs_special.cpp:1899
Definition: ScriptedGossip.h:73
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: GossipDef.h:59

+ Here is the call graph for this function:

bool npc_experience::OnGossipSelect ( Player player,
Creature ,
uint32  ,
uint32  action 
)
inlineoverridevirtual

Reimplemented from CreatureScript.

1915  {
1916  player->PlayerTalkClass->ClearMenus();
1917  bool noXPGain = player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
1918  bool doSwitch = false;
1919 
1920  switch (action)
1921  {
1922  case GOSSIP_ACTION_INFO_DEF + 1://xp off
1923  {
1924  if (!noXPGain)//does gain xp
1925  doSwitch = true;//switch to don't gain xp
1926  }
1927  break;
1928  case GOSSIP_ACTION_INFO_DEF + 2://xp on
1929  {
1930  if (noXPGain)//doesn't gain xp
1931  doSwitch = true;//switch to gain xp
1932  }
1933  break;
1934  }
1935  if (doSwitch)
1936  {
1937  if (!player->HasEnoughMoney(uint64(EXP_COST)))
1938  player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
1939  else if (noXPGain)
1940  {
1941  player->ModifyMoney(-int64(EXP_COST));
1942  player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
1943  }
1944  else if (!noXPGain)
1945  {
1946  player->ModifyMoney(-EXP_COST);
1947  player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN);
1948  }
1949  }
1950  player->PlayerTalkClass->SendCloseGossip();
1951  return true;
1952  }
#define EXP_COST
Definition: npcs_special.cpp:1896
Definition: ScriptedGossip.h:71
uint64_t uint64
Definition: Define.h:149
Definition: Item.h:152
int64_t int64
Definition: g3dmath.h:169
Definition: Player.h:542
Definition: UpdateFields.h:191

The documentation for this class was generated from the following file: