private void SetHP(NPC boss, float maxHp, float curHp, HpChangeSource src) { boss.MaxHP = maxHp; if (src == HpChangeSource.BossGage) { boss.HasGage = true; } else if (src == HpChangeSource.Me && boss.HasGage) { FlushCache(); return; } CacheHP(boss.EntityId, curHp); if (src == HpChangeSource.Me) { FlushCache(); } }
public void AddOrUpdateNpc(ulong entityId, float maxHp, float curHp, bool isBoss, HpChangeSource src, uint templateId = 0, uint zoneId = 0, bool visibility = true, int remainingEnrageTime = 0) { Dispatcher.InvokeAsync(() => { var boss = GetOrAddNpc(entityId, zoneId, templateId, isBoss, visibility); SetHP(boss, maxHp, curHp, src); SetEnrageTime(entityId, remainingEnrageTime); if (boss.Visible == visibility) { return; } boss.Visible = visibility; Dispatcher.Invoke(() => CheckPendingAbnormalities(boss)); NpcListChanged?.Invoke(); }); }