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];
|
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)
|
public bool HasLootWorldObjectGUID(ObjectGuid lootWorldObjectGuid)
|
||||||
@@ -5816,7 +5819,7 @@ namespace Game.Entities
|
|||||||
// dont allow protected item to be looted by someone else
|
// dont allow protected item to be looted by someone else
|
||||||
if (!item.rollWinnerGUID.IsEmpty() && item.rollWinnerGUID != GetGUID())
|
if (!item.rollWinnerGUID.IsEmpty() && item.rollWinnerGUID != GetGUID())
|
||||||
{
|
{
|
||||||
SendLootRelease(GetLootGUID());
|
SendLootReleaseAll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5941,9 +5944,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SendLoot(ObjectGuid guid, LootType loot_type, bool aeLooting = false)
|
public void SendLoot(ObjectGuid guid, LootType loot_type, bool aeLooting = false)
|
||||||
{
|
{
|
||||||
ObjectGuid currentLootGuid = GetLootGUID();
|
if (!GetLootGUID().IsEmpty() && !aeLooting)
|
||||||
if (!currentLootGuid.IsEmpty() && !aeLooting)
|
Session.DoLootReleaseAll();
|
||||||
Session.DoLootRelease(currentLootGuid);
|
|
||||||
|
|
||||||
Loot loot;
|
Loot loot;
|
||||||
PermissionTypes permission = PermissionTypes.All;
|
PermissionTypes permission = PermissionTypes.All;
|
||||||
|
|||||||
@@ -317,7 +317,9 @@ namespace Game
|
|||||||
|
|
||||||
if (player.GetLootGUID() == lguid)
|
if (player.GetLootGUID() == lguid)
|
||||||
player.SetLootGUID(ObjectGuid.Empty);
|
player.SetLootGUID(ObjectGuid.Empty);
|
||||||
|
|
||||||
player.SendLootRelease(lguid);
|
player.SendLootRelease(lguid);
|
||||||
|
player.RemoveAELootedWorldObject(lguid);
|
||||||
|
|
||||||
player.RemoveUnitFlag(UnitFlags.Looting);
|
player.RemoveUnitFlag(UnitFlags.Looting);
|
||||||
|
|
||||||
@@ -387,7 +389,7 @@ namespace Game
|
|||||||
ItemTemplate proto = pItem.GetTemplate();
|
ItemTemplate proto = pItem.GetTemplate();
|
||||||
|
|
||||||
// destroy only 5 items from stack in case prospecting and milling
|
// 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.m_lootGenerated = false;
|
||||||
pItem.loot.Clear();
|
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
|
//Player is not looking at loot list, he doesn't need to see updates on the loot list
|
||||||
loot.RemoveLooter(player.GetGUID());
|
loot.RemoveLooter(player.GetGUID());
|
||||||
player.RemoveAELootedObject(loot.GetGUID());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoLootReleaseAll()
|
void DoLootReleaseAll()
|
||||||
|
|||||||
Reference in New Issue
Block a user