aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2011-09-12 13:00:01 -0400
committermegamage <none@none>2011-09-12 13:00:01 -0400
commit937d26e0fe801ca6fe03c8304ca764e7ae121ef0 (patch)
tree23c9c35c94e89abe1a4af704899184d1f0755126 /src
parent2dbf64827aa49e9493262567a48dfbe93f139cb7 (diff)
Temp fix of crash caused by npc_brunnhildar_prisoner script. Solve #2825, #2880 and #2772.
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Northrend/storm_peaks.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp
index 0fedf101a9c..081f8fb1479 100644
--- a/src/server/scripts/Northrend/storm_peaks.cpp
+++ b/src/server/scripts/Northrend/storm_peaks.cpp
@@ -558,7 +558,7 @@ public:
{
npc_brunnhildar_prisonerAI(Creature* creature) : ScriptedAI(creature) {}
- Unit* drake;
+ uint64 drakeGUID;
uint16 enter_timer;
bool hasEmptySeats;
@@ -566,14 +566,25 @@ public:
{
me->CastSpell(me, SPELL_ICE_PRISON, true);
enter_timer = 0;
- drake = NULL;
+ drakeGUID = 0;
hasEmptySeats = false;
}
void UpdateAI(const uint32 diff)
{
+ //TODO: not good script
+ if (!drakeGUID)
+ return;
+
+ Creature* drake = Unit::GetCreature(*me, drakeGUID);
+ if (!drake)
+ {
+ drakeGUID = 0;
+ return;
+ }
+
// drake unsummoned, passengers dropped
- if (drake && !me->IsOnVehicle(drake) && !hasEmptySeats)
+ if (!me->IsOnVehicle(drake) && !hasEmptySeats)
me->ForcedDespawn(3000);
if (enter_timer <= 0)
@@ -593,9 +604,16 @@ public:
void MoveInLineOfSight(Unit* unit)
{
- if (!unit || !drake)
+ if (!unit || !drakeGUID)
return;
+ Creature* drake = Unit::GetCreature(*me, drakeGUID);
+ if (!drake)
+ {
+ drakeGUID = 0;
+ return;
+ }
+
if (!me->IsOnVehicle(drake) && !me->HasAura(SPELL_ICE_PRISON))
{
if (unit->IsVehicle() && me->IsWithinDist(unit, 25.0f, true) && unit->ToCreature() && unit->ToCreature()->GetEntry() == 29709)
@@ -651,7 +669,7 @@ public:
enter_timer = 500;
if (hitter->IsVehicle())
- drake = hitter;
+ drakeGUID = hitter->GetGUID();
else
return;