diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index a1c4696b4..9c423760e 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -104,7 +104,23 @@ void TempSummon::Update(uint32 diff) break; } + case TEMPSUMMON_TIMED_DESPAWN_OOC_ALIVE: + { + if (!IsInCombat() && m_deathState != CORPSE) + { + if (m_timer <= diff) + { + UnSummon(); + return; + } + m_timer -= diff; + } + else if (m_timer != m_lifetime) + m_timer = m_lifetime; + + break; + } case TEMPSUMMON_CORPSE_TIMED_DESPAWN: { if (m_deathState == CORPSE) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 600778d1a..87991d6d0 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -46,6 +46,7 @@ enum TempSummonType TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears TEMPSUMMON_MANUAL_DESPAWN = 8, // despawns when UnSummon() is called TEMPSUMMON_DESPAWNED = 9, // xinef: DONT USE, INTERNAL USE ONLY + TEMPSUMMON_TIMED_DESPAWN_OOC_ALIVE = 10, // despawns after a specified time after the creature is out of combat and alive }; enum PhaseMasks diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index 31136c4c1..8e5a327a7 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -1185,9 +1185,9 @@ public: return; } player->CastSpell(player, spellInfoTrigger->Id, false); - // @todo: this is not correct! should despawn 5-6 seconds when out of combat, but can't be handled by tempsummon timer alone apparently - if (TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5 * 60 * 1000)) + if (TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_DESPAWN_OOC_ALIVE, 6000)) { + summons->SetCorpseDelay(5 * MINUTE); summons->SetTarget(player->GetGUID()); summons->SetLootRecipient(player); summons->CastSpell(summons, SPELL_SPAWN_IN, false);