Core/Loot: Allocate Loot separately from objects
Port From (https://github.com/TrinityCore/TrinityCore/commit/7957e2d380e08fa831765f610c0e29d2f3e11a04)
This commit is contained in:
@@ -772,23 +772,16 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendPacket(partyKillLog);
|
||||
|
||||
if (creature != null)
|
||||
{
|
||||
LootList lootList = new();
|
||||
lootList.Owner = creature.GetGUID();
|
||||
lootList.LootObj = creature.loot.GetGUID();
|
||||
player.SendMessageToSet(lootList, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (creature)
|
||||
{
|
||||
creature.loot = new Loot();
|
||||
Loot loot = creature.loot;
|
||||
loot.SetGUID(ObjectGuid.Create(HighGuid.LootObject, creature.GetMapId(), 0, creature.GetMap().GenerateLowGuid(HighGuid.LootObject)));
|
||||
if (creature.GetMap().Is25ManRaid())
|
||||
loot.maxDuplicates = 3;
|
||||
|
||||
loot.Clear();
|
||||
uint lootid = creature.GetCreatureTemplate().LootId;
|
||||
if (lootid != 0)
|
||||
loot.FillLoot(lootid, LootStorage.Creature, looter, false, false, creature.GetLootMode(), creature.GetMap().GetDifficultyLootItemContext());
|
||||
@@ -807,6 +800,13 @@ namespace Game.Entities
|
||||
if (!loot.Empty())
|
||||
group.UpdateLooterGuid(creature);
|
||||
}
|
||||
else
|
||||
{
|
||||
LootList lootList = new();
|
||||
lootList.Owner = creature.GetGUID();
|
||||
lootList.LootObj = creature.loot.GetGUID();
|
||||
player.SendMessageToSet(lootList, true);
|
||||
}
|
||||
}
|
||||
|
||||
player.RewardPlayerAndGroupAtKill(victim, false);
|
||||
@@ -907,7 +907,7 @@ namespace Game.Entities
|
||||
if (!creature.IsPet())
|
||||
{
|
||||
// must be after setDeathState which resets dynamic flags
|
||||
if (!creature.loot.IsLooted())
|
||||
if (creature.loot != null && !creature.loot.IsLooted())
|
||||
creature.SetDynamicFlag(UnitDynFlags.Lootable);
|
||||
else
|
||||
creature.AllLootRemovedFromCorpse();
|
||||
|
||||
Reference in New Issue
Block a user