TrinityCore
zone_thunder_bluff.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/* ScriptData
19SDName: Thunder_Bluff
20SD%Complete: 100
21SDComment: Quest support: 925
22SDCategory: Thunder Bluff
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "ScriptedCreature.h"
27#include "ScriptedGossip.h"
28#include "Player.h"
29
30/*#####
31# npc_cairne_bloodhoof
32######*/
33
35{
37 SPELL_CLEAVE = 16044,
40 SPELL_UPPERCUT = 22916
41};
42
44{
45 SOUND_AGGRO = 5884
46};
47
49{
52};
53
56{
57public:
58 npc_cairne_bloodhoof() : CreatureScript("npc_cairne_bloodhoof") { }
59
61 {
63 {
64 Initialize();
65 }
66
68 {
70 CleaveTimer = 5000;
71 MortalStrikeTimer = 10000;
72 ThunderclapTimer = 15000;
73 UppercutTimer = 10000;
74 }
75
81
82 void Reset() override
83 {
84 Initialize();
85 }
86
87 void JustEngagedWith(Unit* /*who*/) override
88 {
90 }
91
92 void UpdateAI(uint32 diff) override
93 {
94 if (!UpdateVictim())
95 return;
96
97 if (BerserkerChargeTimer <= diff)
98 {
101 BerserkerChargeTimer = 25000;
102 } else BerserkerChargeTimer -= diff;
103
104 if (UppercutTimer <= diff)
105 {
107 UppercutTimer = 20000;
108 } else UppercutTimer -= diff;
109
110 if (ThunderclapTimer <= diff)
111 {
113 ThunderclapTimer = 15000;
114 } else ThunderclapTimer -= diff;
115
116 if (MortalStrikeTimer <= diff)
117 {
119 MortalStrikeTimer = 15000;
120 } else MortalStrikeTimer -= diff;
121
122 if (CleaveTimer <= diff)
123 {
125 CleaveTimer = 7000;
126 } else CleaveTimer -= diff;
127 }
128
129 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
130 {
131 uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
132 ClearGossipMenuFor(player);
133 if (action == GOSSIP_SENDER_INFO)
134 {
135 player->CastSpell(player, 23123, false);
136 SendGossipMenuFor(player, 7014, me->GetGUID());
137 }
138 return true;
139 }
140
141 bool OnGossipHello(Player* player) override
142 {
144 if (me->IsQuestGiver())
145 player->PrepareQuestMenu(me->GetGUID());
146
147 if (player->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE)
149
150 SendGossipMenuFor(player, 7013, me->GetGUID());
151
152 return true;
153 }
154 };
155
156 CreatureAI* GetAI(Creature* creature) const override
157 {
158 return new npc_cairne_bloodhoofAI(creature);
159 }
160};
161
163{
165}
uint32_t uint32
Definition: Define.h:142
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:145
void AddGossipItemFor(Player *player, GossipOptionNpc optionNpc, std::string text, uint32 sender, uint32 action)
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void ClearGossipMenuFor(Player *player)
void InitGossipMenuFor(Player *player, uint32 menuId)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_SENDER_INFO
Sounds
Definition: boss_beauty.cpp:23
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void PrepareQuestMenu(ObjectGuid guid)
Definition: Player.cpp:14474
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: Player.cpp:16050
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition: Player.h:2380
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool IsQuestGiver() const
Definition: Unit.h:994
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
CreatureAI * GetAI(Creature *creature) const override
Gossips
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
bool OnGossipSelect(Player *player, uint32, uint32 gossipListId) override
CairneBloodhoof
@ SPELL_CLEAVE
@ SPELL_MORTAL_STRIKE
@ SPELL_THUNDERCLAP
@ SPELL_BERSERKER_CHARGE
@ SPELL_UPPERCUT
@ SOUND_AGGRO
@ GOSSIP_OPTION_HCB
@ GOSSIP_MENU_HCB
void AddSC_thunder_bluff()