8 Commits

Author SHA1 Message Date
bashermens
6056978687 quickfix: crashlog - item::CheckSoulboundTradeExpired
quickfix: crashlog - item::CheckSoulboundTradeExpired
2025-12-24 23:48:23 +01:00
bashermens
7a1fa7b081 quickfix: crashlog player::RestoreSpellMods
quickfix: crashlog player::RestoreSpellMods
2025-12-24 23:48:06 +01:00
bashermens
7aaefb76d9 Update Item.cpp 2025-12-24 22:36:45 +01:00
bashermens
896e1d3f38 Update Unit.cpp 2025-12-24 22:02:38 +01:00
bashermens
a3b2c7ad0e Update Unit.cpp 2025-12-24 22:01:20 +01:00
bashermens
c91ce7f7c2 fix: crashlog player::RestoreSpellMods 2025-12-24 21:44:21 +01:00
bashermens
befa0158e2 Update Item.cpp 2025-12-24 21:24:17 +01:00
bashermens
58e3316c45 fix crashlog 2025-12-24 21:22:31 +01:00
2 changed files with 13 additions and 3 deletions

View File

@@ -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
}

View File

@@ -15971,6 +15971,11 @@ void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
if (IsInWorld()) // not in world and not being removed atm
RemoveFromWorld();
// Added for mod_playerbots crash fixes; cancel and remove pending events before aura/spellmod cleanup.
// Without this SpellEvent may be cancelled later during EventProcessor destruction after auras/spellmods
// are already removed and leading to invalid access in Player::RestoreSpellMods on logout.
m_Events.KillAllEvents(false);
ASSERT(GetGUID());
// A unit may be in removelist and not in world, but it is still in grid