public Skill(long amount, Database.Type type, Entity target, Player targetPlayer, Entity source, Player sourcePlayer, int skillId, bool hotdot, bool critic, long time, NpcInfo pet, HitDirection direction) { Amount = amount; Type = type; EntityTarget = target; EntitySource = source; PlayerTarget = targetPlayer; PlayerSource = sourcePlayer; SkillId = skillId; Critic = critic; HotDot = hotdot; Time = time; Pet = pet; Direction = direction; Source = source; Target = target; if (PlayerSource != null) { Source = PlayerSource.User; } if (PlayerTarget != null) { Target = PlayerTarget.User; } }
public Skill(long amount, Database.Type type, EntityId target, EntityId source, int skillId, bool hotdot, bool critic, long time, NpcInfo pet, HitDirection direction) { Amount = amount; Type = type; Target = target; Source = source; SkillId = skillId; Critic = critic; HotDot = hotdot; Time = time; Pet = pet; Direction = direction; }
public int Hits(Entity source, Entity target, int skillid, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "hits/" + source + "/" + targetString + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((int)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Type == type select skills; var hits = result.Count(); _caching[key] = hits; return(hits); }
public int White(Entity source, Entity target, int skillid, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "white/" + source + "/" + targetString + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((int)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Critic == false && skills.Type == type select skills.Critic; var white = result.Count(); _caching[key] = white; return(white); }
public double Average(Entity source, Entity target, int skillid, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "average/" + source + "/" + targetString + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((double)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Type == type select skills.Amount; var average = result.Average(); _caching[key] = average; return(average); }
public long Amount(Entity source, Entity target, int skillid, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "amount/" + source + "/" + targetString + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((long)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Type == type select skills.Amount; var sum = result.Sum(); _caching[key] = sum; return(sum); }
public int CritRate(Entity source, Entity target, int skillid, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "critrate/" + source + "/" + targetString + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((int)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Type == type select skills.Critic; var enumerable = result as bool[] ?? result.ToArray(); var crit = enumerable.Count(x => x) * 100 / enumerable.Length; _caching[key] = crit; return(crit); }
public long LowestCrit(EntityId source, Entity target, int skillid, bool timed, Database.Type type) { var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Critic && skills.Type == type select skills.Amount; var enumerable = result as long[] ?? result.ToArray(); return(!enumerable.Any() ? 0 : enumerable.Min()); }
public long BiggestHit(EntityId source, Entity target, int skillid, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "biggest_hit/" + source + "/" + targetString + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((long)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Type == type select skills.Amount; var max = result.Max(); _caching[key] = max; return(max); }
public long BiggestWhite(EntityId source, Entity target, int skillid, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "biggest_white/" + source + "/" + targetString + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((long)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Critic == false && skills.Type == type select skills.Amount; long max = 0; var enumerable = result as long[] ?? result.ToArray(); if (enumerable.Length != 0) { max = enumerable.Max(); } _caching[key] = max; return(max); }
public double AverageWhite(EntityId source, Entity target, int skillid, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "average_white/" + source + "/" + targetString + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((double)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Critic == false && skills.Type == type select skills.Amount; double sum = 0; var enumerable = result as long[] ?? result.ToArray(); if (enumerable.Length != 0) { sum = enumerable.Average(); } _caching[key] = sum; return(sum); }
public bool Type(EntityId source, Entity target, int skillid, NpcInfo pet, bool timed, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var name = ""; if (pet != null) { name = pet.Name; } var key = "type/" + source + "/" + targetString + "/" + name + "/" + skillid + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((bool)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); IEnumerable <Database.Type> result; if (pet == null) { result = from skills in dataSource where skills.Pet == null && skills.Type == type select skills.Type; } else { result = from skills in dataSource where skills.Pet != null && skills.Pet.Name == pet.Name && skills.Type == type select skills.Type; } var typeExist = result.Count(); _caching[key] = typeExist != 0; return(typeExist != 0); }
public int Crits(Entity source, Entity target, int skillid, bool timed, NpcInfo petInfo, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "crits/" + source + "/" + targetString + "/" + skillid + "/" + (petInfo?.Name ?? "") + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((int)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Critic && skills.Type == type && skills.Pet == petInfo select skills.Critic; var crit = result.Count(); _caching[key] = crit; return(crit); }
public long AmountCrit(Entity source, Entity target, int skillid, bool timed, NpcInfo petInfo, Database.Type type) { var targetString = target?.Id.ToString() ?? ""; var key = "amount_crit/" + source + "/" + targetString + "/" + skillid + "/" + (petInfo?.Name ?? "") + "/" + type + "/" + timed; if (_caching.ContainsKey(key)) { return((long)_caching[key]); } var dataSource = DataSource(source, target, skillid, timed); var result = from skills in dataSource where skills.Critic && skills.Type == type && skills.Pet == petInfo select skills.Amount; long sum = 0; var enumerable = result as long[] ?? result.ToArray(); if (enumerable.Length != 0) { sum = enumerable.Sum(); } _caching[key] = sum; return(sum); }