mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
fix(Core/Unit): Invalidate update object cache when changing health in the same world update tick. (#19287)
* fix(Core/Unit): Invalidate update object cache when changing health in the same world update tick. Should fix an issue when the client sees dead NPCs when they are not. * Fix styling * Another codestyle fix
This commit is contained in:
committed by
GitHub
parent
9453bfbad2
commit
04acfd96a0
@@ -21628,6 +21628,20 @@ bool Unit::IsInDisallowedMountForm() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void Unit::SetUInt32Value(uint16 index, uint32 value)
|
||||
{
|
||||
Object::SetUInt32Value(index, value);
|
||||
|
||||
switch (index)
|
||||
{
|
||||
// Invalidating the cache on health change should fix an issue where the client sees dead NPCs when they are not.
|
||||
// We might also need to invalidate the cache for some other fields as well.
|
||||
case UNIT_FIELD_HEALTH:
|
||||
InvalidateValuesUpdateCache();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string Unit::GetDebugInfo() const
|
||||
{
|
||||
std::stringstream sstr;
|
||||
|
||||
@@ -1571,6 +1571,8 @@ public:
|
||||
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply);
|
||||
void ApplyCastTimePercentMod(float val, bool apply);
|
||||
|
||||
void SetUInt32Value(uint16 index, uint32 value);
|
||||
|
||||
UnitFlags GetUnitFlags() const { return UnitFlags(GetUInt32Value(UNIT_FIELD_FLAGS)); }
|
||||
bool HasUnitFlag(UnitFlags flags) const { return HasFlag(UNIT_FIELD_FLAGS, flags); }
|
||||
void SetUnitFlag(UnitFlags flags) { SetFlag(UNIT_FIELD_FLAGS, flags); }
|
||||
|
||||
Reference in New Issue
Block a user