public int HitsReceived(Entity target, Entity source, bool timed) { var sourceString = source?.Id.ToString() ?? ""; var key = "hits_received/" + target + "/" + sourceString + "/" + timed; if (_caching.ContainsKey(key)) { return((int)_caching[key]); } IEnumerable <Skill> result = new List <Skill>(); if (TargetSourceSkill.ContainsKey(target)) { if (!timed && source != null) { if (TargetSourceSkill[target].ContainsKey(source)) { result = from skills in TargetSourceSkill[target][source] where skills.Type == Database.Type.Damage select skills; } } else { result = from skills in TargetSourceSkill[target].Values from skill in skills where skill.Type == Database.Type.Damage select skill; } } var count = result.Count(); _caching.Add(key, count); return(count); }
public long DamageReceived(Entity target, Entity source, bool timed) { var sourceString = source?.Id.ToString() ?? ""; var key = "damage_received/" + target + "/" + sourceString + "/" + timed; if (_caching.ContainsKey(key)) { return((long)_caching[key]); } IEnumerable <long> result = new List <long>(); if (TargetSourceSkill.ContainsKey(target)) { if (!timed && source != null) { if (TargetSourceSkill[target].ContainsKey(source)) { result = from skills in TargetSourceSkill[target][source] where skills.Type == Database.Type.Damage select skills.Amount; } } else { result = from skills in TargetSourceSkill[target].Values from skill in skills where skill.Type == Database.Type.Damage select skill.Amount; } } var sum = result.Sum(); _caching.Add(key, sum); return(sum); }
public List <Skill> GetSkillsReceived(Entity target, bool timed) { if (!TargetSourceSkill.ContainsKey(target)) { return(new List <Skill>()); } var result = from skills in TargetSourceSkill[target].Values from skill in skills select skill; return(result.ToList()); }
public IEnumerable <KeyValuePair <Entity, Tera.Game.Skill> > SkillsIdByTarget(Entity target) { if (!TargetSourceSkill.ContainsKey(target)) { return(new List <KeyValuePair <Entity, Tera.Game.Skill> >()); } var result = from skills in TargetSourceSkill[target].Values from skill in skills select new KeyValuePair <Entity, Tera.Game.Skill>(skill.Source, SkillResult.GetSkill(skill.Source, skill.Pet, skill.SkillId, skill.HotDot, PacketProcessor.Instance.EntityTracker, BasicTeraData.Instance.SkillDatabase, BasicTeraData.Instance.HotDotDatabase, BasicTeraData.Instance.PetSkillDatabase)); return(result.Where(x => x.Value != null).Distinct()); }