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

Public Member Functions

 npc_innkeeper ()
 
bool OnGossipHello (Player *player, Creature *creature) override
 
bool OnGossipSelect (Player *player, Creature *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_innkeeper::npc_innkeeper ( )
inline
50 : CreatureScript("npc_innkeeper") { }
CreatureScript(const char *name)
Definition: ScriptMgr.cpp:1586

Member Function Documentation

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

Reimplemented from CreatureScript.

53  {
55  {
56  const char* localizedEntry;
57  switch (player->GetSession()->GetSessionDbcLocale())
58  {
59  case LOCALE_frFR: localizedEntry = LOCALE_TRICK_OR_TREAT_2; break;
60  case LOCALE_deDE: localizedEntry = LOCALE_TRICK_OR_TREAT_3; break;
61  case LOCALE_esES: localizedEntry = LOCALE_TRICK_OR_TREAT_6; break;
62  case LOCALE_enUS: default: localizedEntry = LOCALE_TRICK_OR_TREAT_0;
63  }
64  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
65  }
66 
67  if (creature->IsQuestGiver())
68  player->PrepareQuestMenu(creature->GetGUID());
69 
70  if (creature->IsVendor())
72 
73  if (creature->IsInnkeeper())
74  {
75  const char* localizedEntry;
76  switch (player->GetSession()->GetSessionDbcLocale())
77  {
78  case LOCALE_deDE: localizedEntry = LOCALE_INNKEEPER_3; break;
79  case LOCALE_enUS: default: localizedEntry = LOCALE_INNKEEPER_0;
80  }
81  player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INN);
82  }
83 
84  player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
85  player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
86  return true;
87  }
bool IsVendor() const
Definition: Unit.h:1564
Definition: npc_innkeeper.cpp:35
#define LOCALE_TRICK_OR_TREAT_6
Definition: npc_innkeeper.cpp:42
Definition: ScriptedGossip.h:71
Definition: ScriptedGossip.h:59
#define LOCALE_INNKEEPER_0
Definition: npc_innkeeper.cpp:44
#define GOSSIP_TEXT_BROWSE_GOODS
Definition: ScriptedGossip.h:26
Definition: GossipDef.h:63
Definition: Common.h:119
#define LOCALE_INNKEEPER_3
Definition: npc_innkeeper.cpp:45
bool IsQuestGiver() const
Definition: Unit.h:1566
Definition: ScriptedGossip.h:65
Definition: SharedDefines.h:3727
bool IsInnkeeper() const
Definition: Unit.h:1572
Definition: GossipDef.h:60
#define LOCALE_TRICK_OR_TREAT_2
Definition: npc_innkeeper.cpp:40
bool IsHolidayActive(HolidayIds id)
Definition: GameEventMgr.cpp:1673
Definition: ScriptedGossip.h:73
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Common.h:117
Definition: GossipDef.h:59
Definition: Common.h:123
#define LOCALE_TRICK_OR_TREAT_0
Definition: npc_innkeeper.cpp:39
uint32 GetEntry() const
Definition: Object.h:107
Definition: Common.h:120
#define LOCALE_TRICK_OR_TREAT_3
Definition: npc_innkeeper.cpp:41

+ Here is the call graph for this function:

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

Reimplemented from CreatureScript.

90  {
91  player->PlayerTalkClass->ClearMenus();
92  if (action == GOSSIP_ACTION_INFO_DEF + 1 && IsHolidayActive(HOLIDAY_HALLOWS_END) && !player->HasAura(SPELL_TRICK_OR_TREATED))
93  {
94  player->CastSpell(player, SPELL_TRICK_OR_TREATED, true);
95 
96  if (urand(0, 1))
97  player->CastSpell(player, SPELL_TREAT, true);
98  else
99  {
100  uint32 trickspell = 0;
101  switch (urand(0, 13))
102  {
103  case 0: trickspell = 24753; break; // cannot cast, random 30sec
104  case 1: trickspell = 24713; break; // lepper gnome costume
105  case 2: trickspell = 24735; break; // male ghost costume
106  case 3: trickspell = 24736; break; // female ghostcostume
107  case 4: trickspell = 24710; break; // male ninja costume
108  case 5: trickspell = 24711; break; // female ninja costume
109  case 6: trickspell = 24708; break; // male pirate costume
110  case 7: trickspell = 24709; break; // female pirate costume
111  case 8: trickspell = 24723; break; // skeleton costume
112  case 9: trickspell = 24753; break; // Trick
113  case 10: trickspell = 24924; break; // Hallow's End Candy
114  case 11: trickspell = 24925; break; // Hallow's End Candy
115  case 12: trickspell = 24926; break; // Hallow's End Candy
116  case 13: trickspell = 24927; break; // Hallow's End Candy
117  }
118  player->CastSpell(player, trickspell, true);
119  }
120  player->CLOSE_GOSSIP_MENU();
121  return true;
122  }
123 
124  player->CLOSE_GOSSIP_MENU();
125 
126  switch (action)
127  {
128  case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); break;
129  case GOSSIP_ACTION_INN: player->SetBindPoint(creature->GetGUID()); break;
130  }
131  return true;
132  }
Definition: npc_innkeeper.cpp:36
Definition: npc_innkeeper.cpp:35
Definition: ScriptedGossip.h:71
Definition: ScriptedGossip.h:59
Definition: ScriptedGossip.h:65
Definition: SharedDefines.h:3727
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:45
uint32_t uint32
Definition: Define.h:150
bool IsHolidayActive(HolidayIds id)
Definition: GameEventMgr.cpp:1673
ObjectGuid const & GetGUID() const
Definition: Object.h:105

+ Here is the call graph for this function:


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