TrinityCore
darkmoon_faire.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "Player.h"
20#include "ScriptedCreature.h"
21#include "ScriptedGossip.h"
22
24{
25 NPC_SELINA_DOURMAN = 10445
26};
27
29{
31};
32
34{
37};
38
40{
47};
48
50{
52 POI_CANNON = 2717,
56 POI_RING_TOSS = 2721
57};
58
60{
62};
63
65{
66 SAY_WELCOME = 0
67};
68
69// 10445 - Selina Dourman
71{
72 npc_selina_dourman(Creature* creature) : ScriptedAI(creature), _talkCooldown(false) { }
73
74 bool OnGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
75 {
76 switch (menuId)
77 {
79 {
80 uint32 poiId = 0;
81 switch (gossipListId)
82 {
84 poiId = POI_TONK_ARENA;
85 break;
87 poiId = POI_CANNON;
88 break;
90 poiId = POI_WHACK_A_GNOLL;
91 break;
93 poiId = POI_RING_TOSS;
94 break;
97 break;
99 poiId = POI_FORTUNE_TELLER;
100 break;
101 default:
102 break;
103 }
104 if (poiId)
105 player->PlayerTalkClass->SendPointOfInterest(poiId);
106 break;
107 }
110 CloseGossipMenuFor(player);
111 break;
112 default:
113 break;
114 }
115
116 return false;
117 }
118
119 void DoWelcomeTalk(Unit* talkTarget)
120 {
121 if (!talkTarget || _talkCooldown)
122 return;
123
124 _talkCooldown = true;
126 Talk(SAY_WELCOME, talkTarget);
127 }
128
129 void UpdateAI(uint32 diff) override
130 {
131 _events.Update(diff);
132
133 switch (_events.ExecuteEvent())
134 {
136 _talkCooldown = false;
137 break;
138 default:
139 break;
140 }
141 }
142
143private:
146};
147
148// 7016 - Darkmoon Faire Entrance
150{
151public:
152 at_darkmoon_faire_entrance() : AreaTriggerScript("at_darkmoon_faire_entrance") { }
153
154 bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
155 {
156 if (Creature* selinaDourman = player->FindNearestCreature(NPC_SELINA_DOURMAN, 50.f))
157 if (npc_selina_dourman* selinaDourmanAI = CAST_AI(npc_selina_dourman, selinaDourman->GetAI()))
158 selinaDourmanAI->DoWelcomeTalk(player);
159
160 return true;
161 }
162};
163
165{
168}
Texts
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
void CloseGossipMenuFor(Player *player)
#define CAST_AI(a, b)
Definition: UnitAI.h:28
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition: Player.h:2380
Definition: Unit.h:627
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
@ NPC_SELINA_DOURMAN
PointsOfInterest
@ POI_WHACK_A_GNOLL
@ POI_SHOOTING_GALLERY
@ POI_RING_TOSS
@ POI_CANNON
@ POI_TONK_ARENA
@ POI_FORTUNE_TELLER
GossipMenuOptions
@ GOSSIP_MENU_OPTION_RING_TOSS_POI
@ GOSSIP_MENU_OPTION_FORTUNE_TELLER_POI
@ GOSSIP_MENU_OPTION_WHACK_A_GNOLL_POI
@ GOSSIP_MENU_OPTION_TONK_ARENA_POI
@ GOSSIP_MENU_OPTION_SHOOTING_GALLERY_POI
@ GOSSIP_MENU_OPTION_CANNON_POI
Gossips
@ GOSSIP_MENU_SELINA_ITEM
@ GOSSIP_MENU_SELINA_POIS
@ SPELL_REPLACE_DARKMOON_ADVENTURES_GUIDE
@ SAY_WELCOME
void AddSC_event_darkmoon_faire()
@ EVENT_SELINA_TALK_COOLDOWN
bool OnGossipSelect(Player *player, uint32 menuId, uint32 gossipListId) override
npc_selina_dourman(Creature *creature)
void UpdateAI(uint32 diff) override
void DoWelcomeTalk(Unit *talkTarget)