Skip to content

Commit 475808d

Browse files
authored
Scripts/World: Rewrite Cairne (#31338)
1 parent 5a2cfd0 commit 475808d

File tree

2 files changed

+84
-114
lines changed

2 files changed

+84
-114
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--
2+
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 15 AND `SourceGroup` = 5851;
3+
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
4+
(15,5851,0,0,0,47,0,925,10,0,0,0,0,'',"Group 0: Show Gossip Option 0 if player has taken quest 'Cairne's Hoofprint'");
5+
6+
DELETE FROM `creature_text` WHERE `CreatureID` = 3057;
7+
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
8+
(3057,0,0,"The attackers have fled! Strength and honor to the Horde!",14,0,100,0,0,0,10632,0,"Cairne Bloodhoof");

src/server/scripts/Kalimdor/zone_thunder_bluff.cpp

Lines changed: 76 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -15,153 +15,115 @@
1515
* with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
/* ScriptData
19-
SDName: Thunder_Bluff
20-
SD%Complete: 100
21-
SDComment: Quest support: 925
22-
SDCategory: Thunder Bluff
23-
EndScriptData */
24-
2518
#include "ScriptMgr.h"
2619
#include "ScriptedCreature.h"
2720
#include "ScriptedGossip.h"
2821
#include "Player.h"
2922

30-
/*#####
31-
# npc_cairne_bloodhoof
32-
######*/
33-
3423
enum CairneBloodhoof
3524
{
36-
SPELL_BERSERKER_CHARGE = 16636,
37-
SPELL_CLEAVE = 16044,
25+
SAY_EVADE = 0,
26+
27+
SPELL_CLEAVE = 15284,
3828
SPELL_MORTAL_STRIKE = 16856,
3929
SPELL_THUNDERCLAP = 23931,
40-
SPELL_UPPERCUT = 22916
41-
};
30+
SPELL_UPPERCUT = 22916,
31+
SPELL_WAR_STOMP = 59705,
4232

43-
enum Sounds
44-
{
45-
SOUND_AGGRO = 5884
46-
};
33+
SPELL_CAIRNES_HOOFPRINT = 23123,
4734

48-
enum Gossips
49-
{
50-
GOSSIP_MENU_HCB = 5851,
51-
GOSSIP_OPTION_HCB = 0
35+
EVENT_CLEAVE = 1,
36+
EVENT_MORTAL_STRIKE = 2,
37+
EVENT_THUNDERCLAP = 3,
38+
EVENT_UPPERCUT = 4,
39+
EVENT_WAR_STOMP = 5,
40+
41+
SOUND_AGGRO = 5884
5242
};
5343

54-
/// @todo verify abilities/timers
55-
class npc_cairne_bloodhoof : public CreatureScript
44+
// 3057 - Cairne Bloodhoof
45+
struct npc_cairne_bloodhoof : public ScriptedAI
5646
{
57-
public:
58-
npc_cairne_bloodhoof() : CreatureScript("npc_cairne_bloodhoof") { }
47+
npc_cairne_bloodhoof(Creature* creature) : ScriptedAI(creature) { }
5948

60-
struct npc_cairne_bloodhoofAI : public ScriptedAI
49+
void Reset() override
6150
{
62-
npc_cairne_bloodhoofAI(Creature* creature) : ScriptedAI(creature)
63-
{
64-
Initialize();
65-
}
66-
67-
void Initialize()
68-
{
69-
BerserkerChargeTimer = 30000;
70-
CleaveTimer = 5000;
71-
MortalStrikeTimer = 10000;
72-
ThunderclapTimer = 15000;
73-
UppercutTimer = 10000;
74-
}
75-
76-
uint32 BerserkerChargeTimer;
77-
uint32 CleaveTimer;
78-
uint32 MortalStrikeTimer;
79-
uint32 ThunderclapTimer;
80-
uint32 UppercutTimer;
81-
82-
void Reset() override
83-
{
84-
Initialize();
85-
}
86-
87-
void JustEngagedWith(Unit* /*who*/) override
88-
{
89-
DoPlaySoundToSet(me, SOUND_AGGRO);
90-
}
91-
92-
void UpdateAI(uint32 diff) override
93-
{
94-
if (!UpdateVictim())
95-
return;
51+
_events.Reset();
52+
}
9653

97-
if (BerserkerChargeTimer <= diff)
98-
{
99-
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
100-
DoCast(target, SPELL_BERSERKER_CHARGE);
101-
BerserkerChargeTimer = 25000;
102-
} else BerserkerChargeTimer -= diff;
54+
void JustEngagedWith(Unit* /*who*/) override
55+
{
56+
DoPlaySoundToSet(me, SOUND_AGGRO);
10357

104-
if (UppercutTimer <= diff)
105-
{
106-
DoCastVictim(SPELL_UPPERCUT);
107-
UppercutTimer = 20000;
108-
} else UppercutTimer -= diff;
58+
_events.ScheduleEvent(EVENT_CLEAVE, 5s, 10s);
59+
_events.ScheduleEvent(EVENT_MORTAL_STRIKE, 10s, 15s);
60+
_events.ScheduleEvent(EVENT_THUNDERCLAP, 15s, 20s);
61+
_events.ScheduleEvent(EVENT_UPPERCUT, 10s, 20s);
62+
_events.ScheduleEvent(EVENT_WAR_STOMP, 25s, 30s);
63+
}
10964

110-
if (ThunderclapTimer <= diff)
111-
{
112-
DoCastVictim(SPELL_THUNDERCLAP);
113-
ThunderclapTimer = 15000;
114-
} else ThunderclapTimer -= diff;
65+
void EnterEvadeMode(EvadeReason why) override
66+
{
67+
Talk(SAY_EVADE);
68+
ScriptedAI::EnterEvadeMode(why);
69+
}
11570

116-
if (MortalStrikeTimer <= diff)
117-
{
118-
DoCastVictim(SPELL_MORTAL_STRIKE);
119-
MortalStrikeTimer = 15000;
120-
} else MortalStrikeTimer -= diff;
71+
void UpdateAI(uint32 diff) override
72+
{
73+
if (!UpdateVictim())
74+
return;
12175

122-
if (CleaveTimer <= diff)
123-
{
124-
DoCastVictim(SPELL_CLEAVE);
125-
CleaveTimer = 7000;
126-
} else CleaveTimer -= diff;
76+
if (me->HasUnitState(UNIT_STATE_CASTING))
77+
return;
12778

128-
DoMeleeAttackIfReady();
129-
}
79+
_events.Update(diff);
13080

131-
bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
81+
while (uint32 eventId = _events.ExecuteEvent())
13282
{
133-
uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
134-
ClearGossipMenuFor(player);
135-
if (action == GOSSIP_SENDER_INFO)
83+
switch (eventId)
13684
{
137-
player->CastSpell(player, 23123, false);
138-
SendGossipMenuFor(player, 7014, me->GetGUID());
85+
case EVENT_CLEAVE:
86+
DoCastVictim(SPELL_CLEAVE);
87+
_events.Repeat(5s, 10s);
88+
break;
89+
case EVENT_MORTAL_STRIKE:
90+
DoCastVictim(SPELL_MORTAL_STRIKE);
91+
_events.Repeat(10s, 15s);
92+
break;
93+
case EVENT_THUNDERCLAP:
94+
DoCastSelf(SPELL_THUNDERCLAP);
95+
_events.Repeat(15s, 20s);
96+
break;
97+
case EVENT_UPPERCUT:
98+
DoCastVictim(SPELL_UPPERCUT);
99+
_events.Repeat(20s, 25s);
100+
break;
101+
case EVENT_WAR_STOMP:
102+
DoCastSelf(SPELL_WAR_STOMP);
103+
_events.Repeat(25s, 30s);
104+
break;
105+
default:
106+
break;
139107
}
140-
return true;
141-
}
142-
143-
bool OnGossipHello(Player* player) override
144-
{
145-
InitGossipMenuFor(player, GOSSIP_MENU_HCB);
146-
if (me->IsQuestGiver())
147-
player->PrepareQuestMenu(me->GetGUID());
148-
149-
if (player->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE)
150-
AddGossipItemFor(player, GOSSIP_MENU_HCB, GOSSIP_OPTION_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO);
151108

152-
SendGossipMenuFor(player, 7013, me->GetGUID());
153-
154-
return true;
109+
if (me->HasUnitState(UNIT_STATE_CASTING))
110+
return;
155111
}
156-
};
157112

158-
CreatureAI* GetAI(Creature* creature) const override
113+
DoMeleeAttackIfReady();
114+
}
115+
116+
bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
159117
{
160-
return new npc_cairne_bloodhoofAI(creature);
118+
DoCast(player, SPELL_CAIRNES_HOOFPRINT);
119+
return false;
161120
}
121+
122+
private:
123+
EventMap _events;
162124
};
163125

164126
void AddSC_thunder_bluff()
165127
{
166-
new npc_cairne_bloodhoof();
128+
RegisterCreatureAI(npc_cairne_bloodhoof);
167129
}

0 commit comments

Comments
 (0)