TrinityCore
Loading...
Searching...
No Matches
shattered_halls.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 "InstanceScript.h"
20#include "Map.h"
21#include "ObjectAccessor.h"
22#include "Player.h"
23#include "ScriptedCreature.h"
24#include "shattered_halls.h"
25#include "SpellScript.h"
26#include "TemporarySummon.h"
27
28Position const Executioner = { 152.8524f, -83.63912f, 2.021005f, 0.06981317f };
29
31{
32 public:
33 at_nethekurse_exit() : AreaTriggerScript("at_nethekurse_exit") { }
34
35 bool OnTrigger(Player* player, AreaTriggerEntry const*) override
36 {
37 if (InstanceScript* is = player->GetInstanceScript())
38 {
39 if (is->instance->IsHeroic())
40 {
41 Creature* executioner = nullptr;
42
43 is->instance->LoadGrid(Executioner.GetPositionX(), Executioner.GetPositionY());
44 if (Creature* kargath = ObjectAccessor::GetCreature(*player, is->GetGuidData(NPC_KARGATH_BLADEFIST)))
45 {
46 if (is->GetGuidData(NPC_SHATTERED_EXECUTIONER).IsEmpty())
47 {
50 }
51 }
52
53 if (executioner)
54 for (uint8 i = 0; i < VictimCount; ++i)
56 }
57 }
58
59 return false;
60 }
61};
62
64{
65 SPELL_CLEAVE = 15284
66};
67
69{
70 public:
71 boss_shattered_executioner() : CreatureScript("boss_shattered_executioner") { }
72
74 {
79
81 {
82 cleaveTimer = 500;
83 }
84
85 void Reset() override
86 {
87 _Reset();
88
89 // _Reset() resets the loot mode, so we add them again, if any
90 uint32 prisonersExecuted = instance->GetData(DATA_PRISONERS_EXECUTED);
91 if (prisonersExecuted == 0)
93 if (prisonersExecuted <= 1)
95 if (prisonersExecuted <= 2)
97
99 me->SetImmuneToPC(false);
100 else
101 me->SetImmuneToPC(true);
102
103 Initialize();
104 }
105
106 void JustSummoned(Creature*) override { } // avoid despawn of prisoners on death/reset
107
108 void JustDied(Unit* /*killer*/) override
109 {
110 _JustDied();
111
113 return;
114
115 Map::PlayerList const& players = instance->instance->GetPlayers();
116 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
117 {
118 Player* pl = itr->GetSource();
121 pl->CompleteQuest(qId);
122 }
123 }
124
125 void SetData(uint32 type, uint32 data) override
126 {
127 if (type == DATA_PRISONERS_EXECUTED && data <= 3)
128 {
130 Unit::Kill(me, victim);
131
132 if (data == 1)
133 {
134 Map::PlayerList const& players = instance->instance->GetPlayers();
135 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
136 {
137 Player* pl = itr->GetSource();
140 pl->FailQuest(qId);
141 }
142 }
143
144 switch (data)
145 {
146 case 3:
148 [[fallthrough]];
149 case 2:
151 [[fallthrough]];
152 case 1:
154 [[fallthrough]];
155 default:
156 break;
157 }
158 }
159 }
160
161 void UpdateAI(uint32 diff) override
162 {
163 if (!UpdateVictim())
164 return;
165
166 if (cleaveTimer <= diff)
167 {
169 cleaveTimer = urand(5000, 7000);
170 }
171 else
172 cleaveTimer -= diff;
173 }
174 private:
176 };
177
178 CreatureAI* GetAI(Creature* creature) const override
179 {
180 return GetShatteredHallsAI<boss_shattered_executionerAI>(creature);
181 }
182};
183
184// 39288, 39289, 39290 - Kargath's Executioner
186{
187 public:
188 spell_kargath_executioner() : SpellScriptLoader("spell_kargath_executioner") { }
189
191 {
192 bool AreaCheck(Unit* target)
193 {
194 if (target->GetMap()->GetId() != 540)
195 return false;
196
197 return true;
198 }
199
200 bool Load() override
201 {
202 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
203 }
204
209 };
210
211 AuraScript* GetAuraScript() const override
212 {
214 }
215};
216
217// 39291 - Remove Kargath's Executioner
250
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ DONE
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:150
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ ALLIANCE
@ LOOT_MODE_HARD_MODE_3
@ LOOT_MODE_HARD_MODE_1
@ LOOT_MODE_HARD_MODE_2
#define SpellEffectFn(F, I, N)
#define AuraCheckAreaTargetFn(F)
Unit * GetCaster() const
HookList< CheckAreaTargetHandler > DoCheckAreaTarget
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void RemoveLootMode(uint16 lootMode)
Definition Creature.h:321
void SetImmuneToPC(bool apply) override
Definition Creature.h:184
void AddLootMode(uint16 lootMode)
Definition Creature.h:320
CreatureAI * AI() const
Definition Creature.h:228
virtual ObjectGuid GetGuidData(uint32 type) const override
InstanceMap * instance
EncounterState GetBossState(uint32 id) const
uint32 GetId() const
Definition Map.cpp:3257
PlayerList const & GetPlayers() const
Definition Map.h:403
void CompleteQuest(uint32 quest_id)
Definition Player.cpp:14936
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15962
void FailQuest(uint32 quest_id)
Definition Player.cpp:15347
Team GetTeam() const
Definition Player.h:2423
iterator end()
Definition RefManager.h:36
iterator begin()
Definition RefManager.h:35
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHitTarget
virtual void DoAction(int32 param)
Definition UnitAI.h:73
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.cpp:11225
Map * GetMap() const
Definition Object.h:411
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1398
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
CreatureAI * GetAI(Creature *creature) const override
AuraScript * GetAuraScript() const override
SpellScript * GetSpellScript() const override
@ DATA_TEAM_IN_INSTANCE
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ SPELL_CLEAVE
Position const Executioner
void AddSC_shattered_halls()
@ DATA_KARGATH
@ DATA_SHATTERED_EXECUTIONER
@ DATA_PRISONERS_EXECUTED
@ DATA_FIRST_PRISONER
@ ACTION_EXECUTIONER_TAUNT
@ NPC_SHATTERED_EXECUTIONER
@ NPC_KARGATH_BLADEFIST
@ SPELL_KARGATH_EXECUTIONER_2
@ SPELL_KARGATH_EXECUTIONER_3
@ SPELL_KARGATH_EXECUTIONER_1
uint32 const VictimCount
FactionSpawnerHelper const executionerVictims[VictimCount]
@ QUEST_IMPRISONED_H
@ QUEST_IMPRISONED_A
Position const & GetPos() const
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88