Core/Loot: Corrected loot release logic on leaving world and swapping bags

This commit is contained in:
Shauren
2022-09-13 14:10:47 +02:00
parent e9d083a2ee
commit 30ad7e3337
2 changed files with 8 additions and 9 deletions

View File

@@ -1633,9 +1633,7 @@ void Player::RemoveFromWorld()
StopCastingBindSight();
UnsummonPetTemporaryIfAny();
ClearComboPoints();
ObjectGuid lootGuid = GetLootGUID();
if (!lootGuid.IsEmpty())
m_session->DoLootRelease(lootGuid);
m_session->DoLootReleaseAll();
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
}
@@ -13044,7 +13042,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
// if player is moving bags and is looting an item inside this bag
// release the loot
if (!GetLootGUID().IsEmpty())
if (!GetAELootView().empty())
{
bool released = false;
if (IsBagPos(src))
@@ -13054,9 +13052,9 @@ void Player::SwapItem(uint16 src, uint16 dst)
{
if (Item* bagItem = bag->GetItemByPos(i))
{
if (bagItem->GetGUID() == GetLootGUID())
if (HasLootWorldObjectGUID(bagItem->GetGUID()))
{
m_session->DoLootRelease(GetLootGUID());
m_session->DoLootReleaseAll();
released = true; // so we don't need to look at dstBag
break;
}
@@ -13071,9 +13069,9 @@ void Player::SwapItem(uint16 src, uint16 dst)
{
if (Item* bagItem = bag->GetItemByPos(i))
{
if (bagItem->GetGUID() == GetLootGUID())
if (HasLootWorldObjectGUID(bagItem->GetGUID()))
{
m_session->DoLootRelease(GetLootGUID());
m_session->DoLootReleaseAll();
break;
}
}

View File

@@ -347,7 +347,8 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
player->SendLootRelease(lguid);
player->RemoveAELootedWorldObject(lguid);
player->RemoveUnitFlag(UNIT_FLAG_LOOTING);
if (player->GetAELootView().empty())
player->RemoveUnitFlag(UNIT_FLAG_LOOTING);
if (!player->IsInWorld())
return;