mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
fix(buffs): remove equipment buffs with bFromUnEquip on unequip
Unequipping an item uncasts its equip skills; ApplyBuffBehavior::UnCast now removes the buff with bFromUnEquip set, as live did (2014 captures: RemoveBuff for buffs 3, 4, 5, 50 and 61 always carried bFromUnEquip, and those are exactly the cancel_on_unequip buffs in the CDClient). The client only drops a buff for such a removal when it was added with cancelOnUnEquip (LWOBuffComponent::RemoveBuffIcon @ 0x00cf99b0), so BuffComponent::RemoveBuff does the same to stay in step with it. Also corrects the bFromRemoveBehavior comment: the client does not ignore the message, it only removes buffs added with cancelOnRemoveBuff. Replaces the TODO in InventoryComponent::RemoveBuff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -229,6 +229,10 @@ void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity
|
||||
// If the buff is already scheduled to be removed, don't do it again
|
||||
if (iter == m_Buffs.end() || m_BuffsToRemove.contains(id)) return;
|
||||
|
||||
// The client only removes a buff for an unequip when it was applied with cancelOnUnequip
|
||||
// (LWOBuffComponent::RemoveBuffIcon @ 00cf99b0 in 1.10.64); keep the server's copy in step with it.
|
||||
if (fromUnEquip && !iter->second.cancelOnUnequip) return;
|
||||
|
||||
if (!ignoreRefCount && !iter->second.cancelOnRemoveBuff) {
|
||||
iter->second.refCount--;
|
||||
LOG_DEBUG("refCount for buff %i is now %i", id, iter->second.refCount);
|
||||
|
||||
Reference in New Issue
Block a user