mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
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:
@@ -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);
|
||||
|
@@ -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`
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user