Merge pull request #2991 from megamage/master
Core/Entities: Do not call AddObjectToRemoveList(Pet*) in Map::MoveAllCreaturesInMoveList() - Closes #2892. Scripts: Fix a crash in npc_brunnhildar_prisoner script. Closes #2825.
This commit is contained in:
@@ -832,6 +832,15 @@ void Map::MoveAllCreaturesInMoveList()
|
|||||||
#ifdef TRINITY_DEBUG
|
#ifdef TRINITY_DEBUG
|
||||||
sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", c->GetGUIDLow(), c->GetEntry());
|
sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", c->GetGUIDLow(), c->GetEntry());
|
||||||
#endif
|
#endif
|
||||||
|
//AddObjectToRemoveList(Pet*) should only be called in Pet::Remove
|
||||||
|
//This may happen when a player just logs in and a pet moves to a nearby unloaded cell
|
||||||
|
//To avoid this, we can load nearby cells when player log in
|
||||||
|
//But this check is always needed to ensure safety
|
||||||
|
//TODO: pets will disappear if this is outside CreatureRespawnRelocation
|
||||||
|
//need to check why pet is frequently relocated to an unloaded cell
|
||||||
|
if (c->isPet())
|
||||||
|
((Pet*)c)->Remove(PET_SAVE_NOT_IN_SLOT, true);
|
||||||
|
else
|
||||||
AddObjectToRemoveList(c);
|
AddObjectToRemoveList(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -925,7 +934,7 @@ bool Map::CreatureRespawnRelocation(Creature *c)
|
|||||||
c->UpdateObjectVisibility(false);
|
c->UpdateObjectVisibility(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ public:
|
|||||||
{
|
{
|
||||||
npc_brunnhildar_prisonerAI(Creature* creature) : ScriptedAI(creature) {}
|
npc_brunnhildar_prisonerAI(Creature* creature) : ScriptedAI(creature) {}
|
||||||
|
|
||||||
Unit* drake;
|
uint64 drakeGUID;
|
||||||
uint16 enter_timer;
|
uint16 enter_timer;
|
||||||
bool hasEmptySeats;
|
bool hasEmptySeats;
|
||||||
|
|
||||||
@@ -566,14 +566,25 @@ public:
|
|||||||
{
|
{
|
||||||
me->CastSpell(me, SPELL_ICE_PRISON, true);
|
me->CastSpell(me, SPELL_ICE_PRISON, true);
|
||||||
enter_timer = 0;
|
enter_timer = 0;
|
||||||
drake = NULL;
|
drakeGUID = 0;
|
||||||
hasEmptySeats = false;
|
hasEmptySeats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
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
|
// drake unsummoned, passengers dropped
|
||||||
if (drake && !me->IsOnVehicle(drake) && !hasEmptySeats)
|
if (!me->IsOnVehicle(drake) && !hasEmptySeats)
|
||||||
me->ForcedDespawn(3000);
|
me->ForcedDespawn(3000);
|
||||||
|
|
||||||
if (enter_timer <= 0)
|
if (enter_timer <= 0)
|
||||||
@@ -593,9 +604,16 @@ public:
|
|||||||
|
|
||||||
void MoveInLineOfSight(Unit* unit)
|
void MoveInLineOfSight(Unit* unit)
|
||||||
{
|
{
|
||||||
if (!unit || !drake)
|
if (!unit || !drakeGUID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Creature* drake = Unit::GetCreature(*me, drakeGUID);
|
||||||
|
if (!drake)
|
||||||
|
{
|
||||||
|
drakeGUID = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!me->IsOnVehicle(drake) && !me->HasAura(SPELL_ICE_PRISON))
|
if (!me->IsOnVehicle(drake) && !me->HasAura(SPELL_ICE_PRISON))
|
||||||
{
|
{
|
||||||
if (unit->IsVehicle() && me->IsWithinDist(unit, 25.0f, true) && unit->ToCreature() && unit->ToCreature()->GetEntry() == 29709)
|
if (unit->IsVehicle() && me->IsWithinDist(unit, 25.0f, true) && unit->ToCreature() && unit->ToCreature()->GetEntry() == 29709)
|
||||||
@@ -651,7 +669,7 @@ public:
|
|||||||
enter_timer = 500;
|
enter_timer = 500;
|
||||||
|
|
||||||
if (hitter->IsVehicle())
|
if (hitter->IsVehicle())
|
||||||
drake = hitter;
|
drakeGUID = hitter->GetGUID();
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user