Core/Loot: Properly clear tracked looted objects with item loot
Port From (https://github.com/TrinityCore/TrinityCore/commit/0461826689dad8f318e86395ce1060c8f29f7920)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user