mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Loot: Corrected loot release logic on leaving world and swapping bags
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user