Add Remove Buff Behavior and patch infinite use Imagination Backpack(#845)

Testing does not reveal any issues with existing buff removals sending this GM as well and may fix more bugs that were unknown, or cause more.
This commit is contained in:
David Markowitz
2022-11-27 16:40:14 -08:00
committed by GitHub
parent 1556f580d6
commit 3939f19b08
10 changed files with 71 additions and 3 deletions

View File

@@ -123,13 +123,15 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO
m_Buffs.emplace(id, buff);
}
void BuffComponent::RemoveBuff(int32_t id) {
void BuffComponent::RemoveBuff(int32_t id, bool fromUnEquip, bool removeImmunity) {
const auto& iter = m_Buffs.find(id);
if (iter == m_Buffs.end()) {
return;
}
GameMessages::SendRemoveBuff(m_Parent, fromUnEquip, removeImmunity, id);
m_Buffs.erase(iter);
RemoveBuffEffect(id);

View File

@@ -78,8 +78,9 @@ public:
/**
* Removes a buff from the parent entity, reversing its effects
* @param id the id of the buff to remove
* @param removeImmunity whether or not to remove immunity on removing the buff
*/
void RemoveBuff(int32_t id);
void RemoveBuff(int32_t id, bool fromUnEquip = false, bool removeImmunity = false);
/**
* Returns whether or not the entity has a buff identified by `id`

View File

@@ -986,6 +986,7 @@ void InventoryComponent::ApplyBuff(Item* item) const {
}
}
// TODO Something needs to send the remove buff GameMessage as well when it is unequipping items that would remove buffs.
void InventoryComponent::RemoveBuff(Item* item) const {
const auto buffs = FindBuffs(item, false);