fix(Core/Loot): Set skinnable flag only after all loot was taken. Source: TrinityCore. (#9573)

Fixes #9318
This commit is contained in:
UltraNix
2021-12-12 14:31:00 +01:00
committed by GitHub
parent 4e93671b3c
commit b1303e0e96
3 changed files with 35 additions and 21 deletions

View File

@@ -17116,9 +17116,16 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
if (!creature->IsPet() && creature->GetLootMode() > 0)
{
creature->DeleteThreatList();
CreatureTemplate const* cInfo = creature->GetCreatureTemplate();
if (cInfo && (cInfo->lootid || cInfo->maxgold > 0))
// must be after setDeathState which resets dynamic flags
if (!creature->loot.empty())
{
creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
else
{
creature->AllLootRemovedFromCorpse();
}
}
// Call KilledUnit for creatures, this needs to be called after the lootable flag is set