Scripts/Naxxramas: Fix possible exploit on Gothik because of wrong used unitflag.
Changed UNIT_FLAG_OOC_NOT_ATTACKABLE to UNIT_FLAG_NON_ATTACKABLE. Thanks Aokromes for the tip. Also some cleanup.
This commit is contained in:
@@ -130,32 +130,32 @@ const Position PosSummonDead[POS_DEAD] =
|
|||||||
{2664.8f, -3340.7f, 268.23f, 3.7f},
|
{2664.8f, -3340.7f, 268.23f, 3.7f},
|
||||||
};
|
};
|
||||||
|
|
||||||
const float PosGroundLiveSide[4] = {2691.2f, -3387.0f, 267.68f, 1.52f};
|
float const PosGroundLiveSide[4] = {2691.2f, -3387.0f, 267.68f, 1.52f};
|
||||||
const float PosGroundDeadSide[4] = {2693.5f, -3334.6f, 267.68f, 4.67f};
|
float const PosGroundDeadSide[4] = {2693.5f, -3334.6f, 267.68f, 4.67f};
|
||||||
const float PosPlatform[4] = {2640.5f, -3360.6f, 285.26f, 0.0f};
|
float const PosPlatform[4] = {2640.5f, -3360.6f, 285.26f, 0.0f};
|
||||||
|
|
||||||
// Predicate function to check that the r efzr unit is NOT on the same side as the source.
|
// Predicate function to check that the r efzr unit is NOT on the same side as the source.
|
||||||
struct NotOnSameSide : public std::unary_function<Unit *, bool> {
|
struct NotOnSameSide : public std::unary_function<Unit*, bool>
|
||||||
bool m_inLiveSide;
|
{
|
||||||
NotOnSameSide(Unit *pSource) : m_inLiveSide(IN_LIVE_SIDE(pSource)) {}
|
NotOnSameSide(Unit* source) : _onLiveSide(IN_LIVE_SIDE(source)) {}
|
||||||
bool operator() (const Unit *pTarget) {
|
|
||||||
return (m_inLiveSide != IN_LIVE_SIDE(pTarget));
|
bool operator() (Unit const* target)
|
||||||
|
{
|
||||||
|
return (_onLiveSide != IN_LIVE_SIDE(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _onLiveSide;
|
||||||
};
|
};
|
||||||
|
|
||||||
class boss_gothik : public CreatureScript
|
class boss_gothik : public CreatureScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
boss_gothik() : CreatureScript("boss_gothik") { }
|
boss_gothik() : CreatureScript("boss_gothik") { }
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const
|
|
||||||
{
|
|
||||||
return new boss_gothikAI (pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct boss_gothikAI : public BossAI
|
struct boss_gothikAI : public BossAI
|
||||||
{
|
{
|
||||||
boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {}
|
boss_gothikAI(Creature* creature) : BossAI(creature, BOSS_GOTHIK) {}
|
||||||
|
|
||||||
uint32 waveCount;
|
uint32 waveCount;
|
||||||
typedef std::vector<Creature*> TriggerVct;
|
typedef std::vector<Creature*> TriggerVct;
|
||||||
@@ -172,7 +172,7 @@ public:
|
|||||||
LiveTriggerGUID.clear();
|
LiveTriggerGUID.clear();
|
||||||
DeadTriggerGUID.clear();
|
DeadTriggerGUID.clear();
|
||||||
|
|
||||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE);
|
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
|
||||||
me->SetReactState(REACT_PASSIVE);
|
me->SetReactState(REACT_PASSIVE);
|
||||||
if (instance)
|
if (instance)
|
||||||
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
|
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
|
||||||
@@ -185,10 +185,10 @@ public:
|
|||||||
void EnterCombat(Unit * /*who*/)
|
void EnterCombat(Unit * /*who*/)
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i < POS_LIVE; ++i)
|
for (uint32 i = 0; i < POS_LIVE; ++i)
|
||||||
if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i]))
|
if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i]))
|
||||||
LiveTriggerGUID.push_back(trigger->GetGUID());
|
LiveTriggerGUID.push_back(trigger->GetGUID());
|
||||||
for (uint32 i = 0; i < POS_DEAD; ++i)
|
for (uint32 i = 0; i < POS_DEAD; ++i)
|
||||||
if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i]))
|
if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i]))
|
||||||
DeadTriggerGUID.push_back(trigger->GetGUID());
|
DeadTriggerGUID.push_back(trigger->GetGUID());
|
||||||
|
|
||||||
if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD)
|
if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD)
|
||||||
@@ -199,7 +199,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_EnterCombat();
|
_EnterCombat();
|
||||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE);
|
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE);
|
||||||
waveCount = 0;
|
waveCount = 0;
|
||||||
events.ScheduleEvent(EVENT_SUMMON, 30000);
|
events.ScheduleEvent(EVENT_SUMMON, 30000);
|
||||||
DoTeleportTo(PosPlatform);
|
DoTeleportTo(PosPlatform);
|
||||||
@@ -208,7 +208,7 @@ public:
|
|||||||
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY);
|
instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustSummoned(Creature *summon)
|
void JustSummoned(Creature* summon)
|
||||||
{
|
{
|
||||||
if (summon->GetEntry() == WORLD_TRIGGER)
|
if (summon->GetEntry() == WORLD_TRIGGER)
|
||||||
summon->setActive(true);
|
summon->setActive(true);
|
||||||
@@ -254,26 +254,26 @@ public:
|
|||||||
{
|
{
|
||||||
case MOB_LIVE_TRAINEE:
|
case MOB_LIVE_TRAINEE:
|
||||||
{
|
{
|
||||||
if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[0]))
|
if (Creature* liveTrigger = Unit::GetCreature(*me, LiveTriggerGUID[0]))
|
||||||
DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1);
|
DoSummon(MOB_LIVE_TRAINEE, liveTrigger, 1);
|
||||||
if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1]))
|
if (Creature* liveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1]))
|
||||||
DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1);
|
DoSummon(MOB_LIVE_TRAINEE, liveTrigger1, 1);
|
||||||
if (Creature *LiveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2]))
|
if (Creature* liveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2]))
|
||||||
DoSummon(MOB_LIVE_TRAINEE, LiveTrigger2, 1);
|
DoSummon(MOB_LIVE_TRAINEE, liveTrigger2, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MOB_LIVE_KNIGHT:
|
case MOB_LIVE_KNIGHT:
|
||||||
{
|
{
|
||||||
if (Creature *LiveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3]))
|
if (Creature* liveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3]))
|
||||||
DoSummon(MOB_LIVE_KNIGHT, LiveTrigger3, 1);
|
DoSummon(MOB_LIVE_KNIGHT, liveTrigger3, 1);
|
||||||
if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5]))
|
if (Creature* liveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5]))
|
||||||
DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1);
|
DoSummon(MOB_LIVE_KNIGHT, liveTrigger5, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MOB_LIVE_RIDER:
|
case MOB_LIVE_RIDER:
|
||||||
{
|
{
|
||||||
if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
if (Creature* liveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
||||||
DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1);
|
DoSummon(MOB_LIVE_RIDER, liveTrigger4, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -284,22 +284,22 @@ public:
|
|||||||
{
|
{
|
||||||
case MOB_LIVE_TRAINEE:
|
case MOB_LIVE_TRAINEE:
|
||||||
{
|
{
|
||||||
if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
if (Creature* liveTrigger = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
||||||
DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1);
|
DoSummon(MOB_LIVE_TRAINEE, liveTrigger, 1);
|
||||||
if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
if (Creature* liveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
||||||
DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1);
|
DoSummon(MOB_LIVE_TRAINEE, liveTrigger2, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MOB_LIVE_KNIGHT:
|
case MOB_LIVE_KNIGHT:
|
||||||
{
|
{
|
||||||
if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
if (Creature* liveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
||||||
DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1);
|
DoSummon(MOB_LIVE_KNIGHT, liveTrigger5, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MOB_LIVE_RIDER:
|
case MOB_LIVE_RIDER:
|
||||||
{
|
{
|
||||||
if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
if (Creature* liveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4]))
|
||||||
DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1);
|
DoSummon(MOB_LIVE_RIDER, liveTrigger4, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,10 +311,10 @@ public:
|
|||||||
bool checklife = false;
|
bool checklife = false;
|
||||||
bool checkdead = false;
|
bool checkdead = false;
|
||||||
|
|
||||||
Map* pMap = me->GetMap();
|
Map* map = me->GetMap();
|
||||||
if (pMap && pMap->IsDungeon())
|
if (map && map->IsDungeon())
|
||||||
{
|
{
|
||||||
Map::PlayerList const &PlayerList = pMap->GetPlayers();
|
Map::PlayerList const &PlayerList = map->GetPlayers();
|
||||||
if (!PlayerList.isEmpty())
|
if (!PlayerList.isEmpty())
|
||||||
{
|
{
|
||||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||||
@@ -345,7 +345,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellHit(Unit * /*caster*/, const SpellEntry *spell)
|
void SpellHit(Unit* /*caster*/, SpellEntry const* spell)
|
||||||
{
|
{
|
||||||
uint32 spellId = 0;
|
uint32 spellId = 0;
|
||||||
switch(spell->Id)
|
switch(spell->Id)
|
||||||
@@ -362,7 +362,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpellHitTarget(Unit *pTarget, const SpellEntry *spell)
|
void SpellHitTarget(Unit* target, SpellEntry const* spell)
|
||||||
{
|
{
|
||||||
if (!me->isInCombat())
|
if (!me->isInCombat())
|
||||||
return;
|
return;
|
||||||
@@ -370,19 +370,19 @@ public:
|
|||||||
switch(spell->Id)
|
switch(spell->Id)
|
||||||
{
|
{
|
||||||
case SPELL_INFORM_DEAD_TRAINEE:
|
case SPELL_INFORM_DEAD_TRAINEE:
|
||||||
DoSummon(MOB_DEAD_TRAINEE, pTarget, 0);
|
DoSummon(MOB_DEAD_TRAINEE, target, 0);
|
||||||
break;
|
break;
|
||||||
case SPELL_INFORM_DEAD_KNIGHT:
|
case SPELL_INFORM_DEAD_KNIGHT:
|
||||||
DoSummon(MOB_DEAD_KNIGHT, pTarget, 0);
|
DoSummon(MOB_DEAD_KNIGHT, target, 0);
|
||||||
break;
|
break;
|
||||||
case SPELL_INFORM_DEAD_RIDER:
|
case SPELL_INFORM_DEAD_RIDER:
|
||||||
DoSummon(MOB_DEAD_RIDER, pTarget, 1.0f);
|
DoSummon(MOB_DEAD_RIDER, target, 1.0f);
|
||||||
DoSummon(MOB_DEAD_HORSE, pTarget, 1.0f);
|
DoSummon(MOB_DEAD_HORSE, target, 1.0f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
void UpdateAI(uint32 const diff)
|
||||||
{
|
{
|
||||||
if (!UpdateVictim() || !CheckInRoom())
|
if (!UpdateVictim() || !CheckInRoom())
|
||||||
return;
|
return;
|
||||||
@@ -443,7 +443,7 @@ public:
|
|||||||
DoScriptText(SAY_TELEPORT, me);
|
DoScriptText(SAY_TELEPORT, me);
|
||||||
DoTeleportTo(PosGroundLiveSide);
|
DoTeleportTo(PosGroundLiveSide);
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||||
summons.DoAction(0, 0);
|
summons.DoAction(0, 0);
|
||||||
summons.DoZoneInCombat();
|
summons.DoZoneInCombat();
|
||||||
events.ScheduleEvent(EVENT_BOLT, 1000);
|
events.ScheduleEvent(EVENT_BOLT, 1000);
|
||||||
@@ -464,13 +464,9 @@ public:
|
|||||||
{
|
{
|
||||||
me->AttackStop();
|
me->AttackStop();
|
||||||
if (IN_LIVE_SIDE(me))
|
if (IN_LIVE_SIDE(me))
|
||||||
{
|
|
||||||
DoTeleportTo(PosGroundDeadSide);
|
DoTeleportTo(PosGroundDeadSide);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
DoTeleportTo(PosGroundLiveSide);
|
DoTeleportTo(PosGroundLiveSide);
|
||||||
}
|
|
||||||
|
|
||||||
me->getThreatManager().resetAggro(NotOnSameSide(me));
|
me->getThreatManager().resetAggro(NotOnSameSide(me));
|
||||||
if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0))
|
if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0))
|
||||||
@@ -489,21 +485,20 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CreatureAI* GetAI(Creature* creature) const
|
||||||
|
{
|
||||||
|
return new boss_gothikAI(creature);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class mob_gothik_minion : public CreatureScript
|
class mob_gothik_minion : public CreatureScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
mob_gothik_minion() : CreatureScript("mob_gothik_minion") { }
|
mob_gothik_minion() : CreatureScript("mob_gothik_minion") { }
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const
|
|
||||||
{
|
|
||||||
return new mob_gothik_minionAI (pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct mob_gothik_minionAI : public CombatAI
|
struct mob_gothik_minionAI : public CombatAI
|
||||||
{
|
{
|
||||||
mob_gothik_minionAI(Creature *c) : CombatAI(c)
|
mob_gothik_minionAI(Creature* creature) : CombatAI(creature)
|
||||||
{
|
{
|
||||||
liveSide = IN_LIVE_SIDE(me);
|
liveSide = IN_LIVE_SIDE(me);
|
||||||
}
|
}
|
||||||
@@ -511,23 +506,23 @@ public:
|
|||||||
bool liveSide;
|
bool liveSide;
|
||||||
bool gateClose;
|
bool gateClose;
|
||||||
|
|
||||||
bool isOnSameSide(const Unit *pWho) const
|
bool isOnSameSide(Unit const* who) const
|
||||||
{
|
{
|
||||||
return (liveSide == IN_LIVE_SIDE(pWho));
|
return (liveSide == IN_LIVE_SIDE(who));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoAction(const int32 param)
|
void DoAction(int32 const param)
|
||||||
{
|
{
|
||||||
gateClose = param;
|
gateClose = param;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DamageTaken(Unit *attacker, uint32 &damage)
|
void DamageTaken(Unit* attacker, uint32 &damage)
|
||||||
{
|
{
|
||||||
if (gateClose && !isOnSameSide(attacker))
|
if (gateClose && !isOnSameSide(attacker))
|
||||||
damage = 0;
|
damage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustDied(Unit * /*killer*/)
|
void JustDied(Unit* /*killer*/)
|
||||||
{
|
{
|
||||||
if (me->isSummon())
|
if (me->isSummon())
|
||||||
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
||||||
@@ -545,10 +540,10 @@ public:
|
|||||||
if (!_EnterEvadeMode())
|
if (!_EnterEvadeMode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Map* pMap = me->GetMap();
|
Map* map = me->GetMap();
|
||||||
if (pMap->IsDungeon())
|
if (map->IsDungeon())
|
||||||
{
|
{
|
||||||
Map::PlayerList const &PlayerList = pMap->GetPlayers();
|
Map::PlayerList const &PlayerList = map->GetPlayers();
|
||||||
if (!PlayerList.isEmpty())
|
if (!PlayerList.isEmpty())
|
||||||
{
|
{
|
||||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||||
@@ -566,7 +561,7 @@ public:
|
|||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
void UpdateAI(uint32 const diff)
|
||||||
{
|
{
|
||||||
if (gateClose && (!isOnSameSide(me) || (me->getVictim() && !isOnSameSide(me->getVictim()))))
|
if (gateClose && (!isOnSameSide(me) || (me->getVictim() && !isOnSameSide(me->getVictim()))))
|
||||||
{
|
{
|
||||||
@@ -578,6 +573,10 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CreatureAI* GetAI(Creature* creature) const
|
||||||
|
{
|
||||||
|
return new mob_gothik_minionAI(creature);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_gothik()
|
void AddSC_boss_gothik()
|
||||||
|
|||||||
Reference in New Issue
Block a user