fix(Core/Creature): Allow temp summons to respawn when despawning on … (#21363)
This commit is contained in:
@@ -2198,7 +2198,7 @@ void Creature::DespawnOnEvade(Seconds respawnDelay)
|
|||||||
|
|
||||||
if (TempSummon* whoSummon = ToTempSummon())
|
if (TempSummon* whoSummon = ToTempSummon())
|
||||||
{
|
{
|
||||||
LOG_WARN("entities.unit", "DespawnOnEvade called on a temporary summon.");
|
GetMap()->ScheduleCreatureRespawn(GetGUID(), respawnDelay, GetHomePosition());
|
||||||
whoSummon->UnSummon();
|
whoSummon->UnSummon();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,13 +310,9 @@ void TempSummon::UnSummon(uint32 msTime)
|
|||||||
if (WorldObject* owner = GetSummoner())
|
if (WorldObject* owner = GetSummoner())
|
||||||
{
|
{
|
||||||
if (owner->IsCreature() && owner->ToCreature()->IsAIEnabled)
|
if (owner->IsCreature() && owner->ToCreature()->IsAIEnabled)
|
||||||
{
|
|
||||||
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
|
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
|
||||||
}
|
|
||||||
else if (owner->IsGameObject() && owner->ToGameObject()->AI())
|
else if (owner->IsGameObject() && owner->ToGameObject()->AI())
|
||||||
{
|
|
||||||
owner->ToGameObject()->AI()->SummonedCreatureDespawn(this);
|
owner->ToGameObject()->AI()->SummonedCreatureDespawn(this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AddObjectToRemoveList();
|
AddObjectToRemoveList();
|
||||||
|
|||||||
@@ -3718,12 +3718,14 @@ void Map::RemoveOldCorpses()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::ScheduleCreatureRespawn(ObjectGuid creatureGuid, Milliseconds respawnTimer)
|
void Map::ScheduleCreatureRespawn(ObjectGuid creatureGuid, Milliseconds respawnTimer, Position pos)
|
||||||
{
|
{
|
||||||
_creatureRespawnScheduler.Schedule(respawnTimer, [this, creatureGuid](TaskContext)
|
_creatureRespawnScheduler.Schedule(respawnTimer, [this, creatureGuid, pos](TaskContext)
|
||||||
{
|
{
|
||||||
if (Creature* creature = GetCreature(creatureGuid))
|
if (Creature* creature = GetCreature(creatureGuid))
|
||||||
creature->Respawn();
|
creature->Respawn();
|
||||||
|
else
|
||||||
|
SummonCreature(creatureGuid.GetEntry(), pos);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ public:
|
|||||||
|
|
||||||
TaskScheduler _creatureRespawnScheduler;
|
TaskScheduler _creatureRespawnScheduler;
|
||||||
|
|
||||||
void ScheduleCreatureRespawn(ObjectGuid /*creatureGuid*/, Milliseconds /*respawnTimer*/);
|
void ScheduleCreatureRespawn(ObjectGuid /*creatureGuid*/, Milliseconds /*respawnTimer*/, Position pos = Position());
|
||||||
|
|
||||||
void LoadCorpseData();
|
void LoadCorpseData();
|
||||||
void DeleteCorpseData();
|
void DeleteCorpseData();
|
||||||
|
|||||||
@@ -1161,17 +1161,6 @@ public:
|
|||||||
{
|
{
|
||||||
IsSindragosaIntroDone = true;
|
IsSindragosaIntroDone = true;
|
||||||
HandleDropAttempt();
|
HandleDropAttempt();
|
||||||
if (instance->IsHeroic())
|
|
||||||
{
|
|
||||||
if (HeroicAttempts)
|
|
||||||
{
|
|
||||||
Events.ScheduleEvent(EVENT_RESPAWN_SINDRAGOSA, 30s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Events.ScheduleEvent(EVENT_RESPAWN_SINDRAGOSA, 30s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable)
|
if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -369,6 +369,9 @@ public:
|
|||||||
break;
|
break;
|
||||||
case NPC_ALGALON:
|
case NPC_ALGALON:
|
||||||
m_uiAlgalonGUID = creature->GetGUID();
|
m_uiAlgalonGUID = creature->GetGUID();
|
||||||
|
|
||||||
|
if (!m_algalonTimer)
|
||||||
|
creature->DespawnOrUnsummon();
|
||||||
break;
|
break;
|
||||||
case NPC_HARPOON_FIRE_STATE:
|
case NPC_HARPOON_FIRE_STATE:
|
||||||
{
|
{
|
||||||
@@ -811,17 +814,6 @@ public:
|
|||||||
go->EnableCollision(false);
|
go->EnableCollision(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data == FAIL)
|
|
||||||
{
|
|
||||||
scheduler.Schedule(5s, [this](TaskContext)
|
|
||||||
{
|
|
||||||
if (m_algalonTimer && (m_algalonTimer <= 60 || m_algalonTimer == TIMER_ALGALON_TO_SUMMON))
|
|
||||||
{
|
|
||||||
instance->SummonCreature(NPC_ALGALON, AlgalonLandPos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Achievement
|
// Achievement
|
||||||
|
|||||||
Reference in New Issue
Block a user