private void OnVisualSound(Decal.Adapter.Message pMsg) { try { if(MyCastList.Count == 0 && OtherCastList.Count == 0) {return;} int AnimationTarget = 0; try{AnimationTarget = pMsg.Value<int>(0);}catch{AnimationTarget = 0;} if(AnimationTarget == 0) { return;} if(Core.WorldFilter[AnimationTarget].ObjectClass != ObjectClass.Monster) {return;} if(!CombatHudMobTrackingList.Any(x => x.Id == AnimationTarget)) { CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[AnimationTarget])); } MonsterObject MobTarget = CombatHudMobTrackingList.Find(x => x.Id == AnimationTarget); int SpellAnimation = pMsg.Value<int>(1); double AnimationDuration = pMsg.Value<double>(2); if(MyCastList.Count > 0 && MyCastList.Any(x => x.SpellAnimation == SpellAnimation && x.SpellTargetId == AnimationTarget)) { SpellCastInfo MyCastSpell = MyCastList.Find(x => x.SpellAnimation == SpellAnimation && x.SpellTargetId == AnimationTarget); int index = MobTarget.DebuffSpellList.FindIndex(x => x.SpellId == MyCastSpell.SpellCastId); if(index >= 0) { MobTarget.DebuffSpellList[index].SpellCastTime = DateTime.Now; MobTarget.DebuffSpellList[index].SecondsRemaining = SpellIndex[MyCastSpell.SpellCastId].duration; } else { MonsterObject.DebuffSpell dbspellnew = new MonsterObject.DebuffSpell(); dbspellnew.SpellId = MyCastSpell.SpellCastId; dbspellnew.SpellCastTime = DateTime.Now; dbspellnew.SecondsRemaining = SpellIndex[MyCastSpell.SpellCastId].duration; MobTarget.DebuffSpellList.Add(dbspellnew); } MyCastList.Remove(MyCastSpell); UpdateTactician(); } if(OtherCastList.Count > 0 && OtherCastList.Any(x => x.Animation == SpellAnimation)) { int index_o = OtherCastList.FindIndex(x => x.Animation == SpellAnimation); if(index_o >= 0) { OtherDebuffCastInfo OtherCastSpell = OtherCastList[index_o]; int index = MobTarget.DebuffSpellList.FindIndex(x => x.SpellId == OtherCastSpell.SpellId); if(index >= 0) { MobTarget.DebuffSpellList[index].SpellCastTime = DateTime.Now; MobTarget.DebuffSpellList[index].SecondsRemaining = SpellIndex[OtherCastSpell.SpellId].duration; } else { MonsterObject.DebuffSpell dbspellnew = new MonsterObject.DebuffSpell(); dbspellnew.SpellId = OtherCastSpell.SpellId; dbspellnew.SpellCastTime = DateTime.Now; dbspellnew.SecondsRemaining = SpellIndex[OtherCastSpell.SpellId].duration; MobTarget.DebuffSpellList.Add(dbspellnew); } OtherCastList.Remove(OtherCastSpell); UpdateTactician(); } } MyCastList.RemoveAll(x => (DateTime.Now - x.CastTime).TotalSeconds > 8); OtherCastList.RemoveAll(x => (DateTime.Now - x.HeardTime).TotalSeconds > 8); }catch(Exception ex){LogError(ex);} }
private void OnIdentCombat(Decal.Adapter.Message pMsg) { try { int PossibleMobID = Convert.ToInt32(pMsg["object"]); if(Core.WorldFilter[PossibleMobID].ObjectClass == ObjectClass.Monster) { if(CombatHudMobTrackingList.Count == 0) { CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[PossibleMobID])); } else if(!CombatHudMobTrackingList.Any(x => x.Id == PossibleMobID)) { CombatHudMobTrackingList.Add(new MonsterObject(Core.WorldFilter[PossibleMobID])); } MonsterObject UpdateMonster = CombatHudMobTrackingList.First(x => x.Id == PossibleMobID); if((pMsg.Value<int>("flags") & 0x200) == 0x200) { //Empty try/catch to deal with cast not valid error. (infrequent) try { if(pMsg.Value<int>(22) > 0) {UpdateMonster.HealthMax = pMsg.Value<int>(22);} if(pMsg.Value<int>(20) > 0) {UpdateMonster.HealthCurrent = pMsg.Value<int>(20);} }catch{} // if(pMsg.Value<int>(20) > 0){CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).StaminaMax = pMsg.Value<int>(20);} // if(pMsg.Value<int>(28) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).StaminaCurrent = pMsg.Value<int>(28);} // if(pMsg.Value<int>(22) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).ManaMax = pMsg.Value<int>(22);} // if(pMsg.Value<int>(29) > 0) {CombatHudMobTrackingList.First(x => x.Id == PossibleMobID).ManaCurrent = pMsg.Value<int>(29);} if(UpdateMonster.HealthMax > 0) { UpdateMonster.HealthRemaining = Convert.ToInt32((double)UpdateMonster.HealthCurrent/(double)UpdateMonster.HealthMax*100); } } } UpdateTactician(); UpdateFocusHud(); } catch (Exception ex) {LogError(ex);} }