diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 40211f2a1..727899977 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -4084,9 +4084,12 @@ namespace Game.Entities return m_AELootView[lootObjectGuid]; } - public void RemoveAELootedObject(ObjectGuid lootObjectGuid) + public void RemoveAELootedWorldObject(ObjectGuid lootWorldObjectGuid) { - m_AELootView.Remove(lootObjectGuid); + var itr = m_AELootView.FirstOrDefault(pair => pair.Value == lootWorldObjectGuid); + + if (itr.Key != ObjectGuid.Empty) + m_AELootView.Remove(itr.Key); } public bool HasLootWorldObjectGUID(ObjectGuid lootWorldObjectGuid) @@ -5816,7 +5819,7 @@ namespace Game.Entities // dont allow protected item to be looted by someone else if (!item.rollWinnerGUID.IsEmpty() && item.rollWinnerGUID != GetGUID()) { - SendLootRelease(GetLootGUID()); + SendLootReleaseAll(); return; } @@ -5941,9 +5944,8 @@ namespace Game.Entities public void SendLoot(ObjectGuid guid, LootType loot_type, bool aeLooting = false) { - ObjectGuid currentLootGuid = GetLootGUID(); - if (!currentLootGuid.IsEmpty() && !aeLooting) - Session.DoLootRelease(currentLootGuid); + if (!GetLootGUID().IsEmpty() && !aeLooting) + Session.DoLootReleaseAll(); Loot loot; PermissionTypes permission = PermissionTypes.All; diff --git a/Source/Game/Handlers/LootHandler.cs b/Source/Game/Handlers/LootHandler.cs index 287935d94..0e591aa17 100644 --- a/Source/Game/Handlers/LootHandler.cs +++ b/Source/Game/Handlers/LootHandler.cs @@ -317,7 +317,9 @@ namespace Game if (player.GetLootGUID() == lguid) player.SetLootGUID(ObjectGuid.Empty); + player.SendLootRelease(lguid); + player.RemoveAELootedWorldObject(lguid); player.RemoveUnitFlag(UnitFlags.Looting); @@ -387,7 +389,7 @@ namespace Game ItemTemplate proto = pItem.GetTemplate(); // destroy only 5 items from stack in case prospecting and milling - if (proto.GetFlags().HasAnyFlag(ItemFlags.IsProspectable | ItemFlags.IsMillable)) + if (pItem.loot.loot_type == LootType.Prospecting || pItem.loot.loot_type == LootType.Milling) { pItem.m_lootGenerated = false; pItem.loot.Clear(); @@ -448,7 +450,6 @@ namespace Game //Player is not looking at loot list, he doesn't need to see updates on the loot list loot.RemoveLooter(player.GetGUID()); - player.RemoveAELootedObject(loot.GetGUID()); } void DoLootReleaseAll()