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:
Aaron Kimbrell
2026-09-27 08:27:22 -05:00
parent 8bf56dbdc3
commit 71ecd3737c
4 changed files with 10 additions and 3 deletions

View File

@@ -27,7 +27,9 @@ void ApplyBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext b
if (buffComponent == nullptr) return;
buffComponent->RemoveBuff(m_BuffId);
// UnCast only runs when the item (or item set) that cast the buff is unequipped. Live servers sent those
// removals with bFromUnEquip set (2014 captures: buffs 3, 4, 5, 50 and 61, all cancel_on_unequip).
buffComponent->RemoveBuff(m_BuffId, true);
}
void ApplyBuffBehavior::Calculate(BehaviorContext* context, RakNet::BitStream& bitStream, BehaviorBranchContext branch) {