Core/Instances: If a boss kills itself, still save the group to the instance (#16978)

(cherry picked from commit a4b00886718148dd021871ead5ac8a1e8a64285f)
This commit is contained in:
Henry Gordon authored and Aokromes committed 2016-05-12 08:48:25 +02:00
1 parent 05d4b503ea
commit 4158049767
1 file changed
+11 -3
+11 -3
View File
@@ -14119,12 +14119,19 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
Player* creditedPlayer = GetCharmerOrOwnerPlayerOrPlayerItself();
/// @todo do instance binding anyway if the charmer/owner is offline
if (instanceMap->IsDungeon() && creditedPlayer)
if (instanceMap->IsDungeon() && (creditedPlayer || this == victim))
{
if (instanceMap->IsRaidOrHeroicDungeon())
{
if (creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
((InstanceMap*)instanceMap)->PermBindAllPlayers(creditedPlayer);
{
// if the boss killed itself we still need to bind players to the instance
if (!creditedPlayer && instanceMap->HavePlayers())
creditedPlayer = instanceMap->GetPlayers().getFirst()->GetSource();
if (creditedPlayer)
((InstanceMap*)instanceMap)->PermBindAllPlayers(creditedPlayer);
}
}
else
{
@@ -14132,7 +14139,8 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// until the players leave the instance
time_t resettime = creature->GetRespawnTimeEx() + 2 * HOUR;
if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(creature->GetInstanceId()))
if (save->GetResetTime() < resettime) save->SetResetTime(resettime);
if (save->GetResetTime() < resettime)
save->SetResetTime(resettime);
}
}
}