mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
quickfix: crashlog - item::CheckSoulboundTradeExpired
quickfix: crashlog - item::CheckSoulboundTradeExpired
This commit is contained in:
@@ -1277,10 +1277,15 @@ void Item::ClearSoulboundTradeable(Player* currentOwner)
|
||||
|
||||
bool Item::CheckSoulboundTradeExpire()
|
||||
{
|
||||
// called from owner's update - GetOwner() MUST be valid
|
||||
if (GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + 2 * HOUR < GetOwner()->GetTotalPlayedTime())
|
||||
// we have to check the owner for mod_playerbots since bots programically call methods like DestroyItem,
|
||||
// MoveItemToMail, DestroyItemCount which do not handle soulboundTradeable clearing.
|
||||
Player* owner = GetOwner();
|
||||
if (!owner)
|
||||
return true; // remove from tradeable list
|
||||
|
||||
if (GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + 2 * HOUR < owner->GetTotalPlayedTime())
|
||||
{
|
||||
ClearSoulboundTradeable(GetOwner());
|
||||
ClearSoulboundTradeable(owner);
|
||||
return true; // remove from tradeable list
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user