public override void PrintTankStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint) { var stats = SelectStatsToPrint(statisticTypeToPrint); if (stats.TankAttempts == 0) { return; } conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" пнуть:", TextColor.BrightRed), new TextMessageBlock("\t Средний: ", TextColor.White), new TextMessageBlock(((double)stats.TotalTankDamage / (stats.SuccessTankAttempts > 0?stats.SuccessTankAttempts:1)).ToString("P"), TextColor.BrightWhite), new TextMessageBlock("\t Максимальный: ", TextColor.White), new TextMessageBlock(stats.MaxTankDamage.ToString(), TextColor.BrightWhite), new TextMessageBlock("\t Шанс: ", TextColor.White), new TextMessageBlock(((double)stats.SuccessTankAttempts / stats.TankAttempts).ToString("P"), TextColor.BrightWhite), })); conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock("\t\t Шанс сбить: ", TextColor.White), new TextMessageBlock(((double)stats.BashTankAttempts / (stats.SuccessTankAttempts > 0 ? stats.SuccessTankAttempts: 1)).ToString("P"), TextColor.BrightWhite), new TextMessageBlock("\t Шанс упасть: ", TextColor.White), new TextMessageBlock(((double)stats.FallTankAttempts / (stats.TankAttempts - stats.SuccessTankAttempts > 0 ? stats.TankAttempts - stats.SuccessTankAttempts: 1)).ToString("P"), TextColor.BrightWhite), })); }
//public Task<Response<IReadOnlyList<ArchiveItem>>> GetArchiveListAsync() //{ // return TryExecuteAsync<IReadOnlyList<ArchiveItem>>(async () => // { // if (!_postRepository.Any(p => // p.PostPublish.IsPublished && !p.PostPublish.IsDeleted)) // return new SuccessResponse<IReadOnlyList<ArchiveItem>>(); // var list = await _postRepository.SelectGroupAsync(post => new // { // year = post.PostPublish.PubDateUtc.Value.Year, // month = post.PostPublish.PubDateUtc.Value.Month // }, monthList => new ArchiveItem // { // Year = monthList.Key.year, // Month = monthList.Key.month, // Count = monthList.Select(p => p.Id).Count() // }); // return new SuccessResponse<IReadOnlyList<ArchiveItem>>(list); // }); //} public Task <Response> UpdatePostStatisticAsync(Guid postId, StatisticTypes statisticTypes) { return(TryExecuteAsync <Response>(async() => { var pp = _postExtensionRepository.Get(postId); if (pp == null) { return new FailedResponse((int)ResponseFailureCode.PostNotFound); } if (statisticTypes == StatisticTypes.Hits) { pp.Hits += 1; } if (statisticTypes == StatisticTypes.Likes) { pp.Likes += 1; } if (statisticTypes == StatisticTypes.Views) { pp.Views += 1; } await _postExtensionRepository.UpdateAsync(pp); return new SuccessResponse(); }, keyParameter: postId)); }
public static float GetStatistic(StatisticTypes code) { float value = 0; ENgetstatistic((int)code, ref value); return(value); }
public override void PrintDamageStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint) { var stat = SelectStatsToPrint(statisticTypeToPrint); if (stat.TotalAttempts == 0) { return; } //for nice printing if (_skillName.Length < 4) { conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock($" {_skillName}: ", TextColor.BrightYellow), new TextMessageBlock("\t Средний: ", TextColor.White), new TextMessageBlock(((double)stat.TotalDamage / stat.TotalAttempts).ToString("00.00"), TextColor.BrightWhite), new TextMessageBlock("\t Максимальный: ", TextColor.White), new TextMessageBlock(stat.MaxDamage.ToString(), TextColor.BrightWhite), })); } else { conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock($" {_skillName}:", TextColor.BrightYellow), new TextMessageBlock("\t Средний: ", TextColor.White), new TextMessageBlock(((double)stat.TotalDamage / stat.TotalAttempts).ToString("00.00"), TextColor.BrightWhite), new TextMessageBlock("\t Максимальный: ", TextColor.White), new TextMessageBlock(stat.MaxDamage.ToString(), TextColor.BrightWhite), })); } }
public Task <Response> UpdateStatisticAsync(Guid postId, StatisticTypes statisticTypes) { return(TryExecuteAsync(async() => { var pp = await _postExtensionRepository.GetAsync(postId); if (pp == null) { return new FailedResponse((int)ResponseFailureCode.PostNotFound); } switch (statisticTypes) { case StatisticTypes.Hits: pp.Hits += 1; break; case StatisticTypes.Likes: pp.Likes += 1; break; default: throw new ArgumentOutOfRangeException(nameof(statisticTypes), statisticTypes, null); } await _postExtensionRepository.UpdateAsync(pp); return new SuccessResponse(); }, keyParameter: postId)); }
private IList CreateStatisticDatas(StatisticTypes sType) { switch (sType) { //case StatisticTypes.ORGAndEQUStatisticType: // return StatisticHelper.StatisticEquipment(_activityGuid); //case StatisticTypes.FreqPartPlanStatisticType: // return StatisticHelper.StatisticFreqPartPlan(_activityGuid); //case StatisticTypes.SurroundStatStatisticType: // return StatisticHelper.StatisticSurroundStation(_activityGuid); //case StatisticTypes.FreqAssignStatisticType: // return StatisticHelper.StatisticFreqAssign(_activityGuid); //case StatisticTypes.EquInspectionSticType: //设备检测 // return StatisticHelper.StatisticEquInspection(_activityGuid); case StatisticTypes.PersonPlanStatisticType: return(StatisticHelper.StatisticPersonPlan(_activityGuid)); case StatisticTypes.PersonRPStatisticType: return(StatisticHelper.StatisticPersonRP()); case StatisticTypes.PersonOutStatisticType: return(StatisticHelper.StatisticPersonOut()); default: return(null); } }
public override void PrintDamageStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint) { var stats = SelectStatsToPrint(statisticTypeToPrint); if (stats.TotalAttempts == 0 || stats.SuccessAttempts == 0) { return; } conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" заколоть:", TextColor.BrightYellow), new TextMessageBlock("\t Средний: ", TextColor.White), new TextMessageBlock(((double)stats.TotalDamage / stats.SuccessAttempts).ToString("00.00"), TextColor.BrightWhite), new TextMessageBlock("\t Максимальный: ", TextColor.White), new TextMessageBlock(stats.MaxDamage.ToString(), TextColor.BrightWhite), new TextMessageBlock("\t Шанс: ", TextColor.White), new TextMessageBlock(((double)stats.SuccessAttempts / stats.TotalAttempts).ToString("P"), TextColor.BrightWhite), })); conveyor.PushMessage(new OutputToMainWindowMessage(new [] { new TextMessageBlock("\t\t Шанс отравить: ", TextColor.White), new TextMessageBlock(((double)stats.PoisonAttempts / stats.SuccessAttempts).ToString("P"), TextColor.BrightWhite), })); }
private DodgeSkillStats SelectStatsToPrint(StatisticTypes statisticTypeToPrint) { if (statisticTypeToPrint == StatisticTypes.Zone) { return(_zoneStats); } if (statisticTypeToPrint == StatisticTypes.Fight) { return(_fightStats); } return(_sessionStats); }
public override void PrintDamageStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint) { var stats = SelectStatsToPrint(statisticTypeToPrint); if (stats.Attempts == 0) { return; } conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" обезоруж.:", TextColor.BrightYellow), new TextMessageBlock("\t Шанс: ", TextColor.White), new TextMessageBlock(((double)stats.SuccessAttempts / stats.Attempts).ToString("P"), TextColor.BrightWhite) })); }
public override void PrintTankStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint) { var stats = SelectStatsToPrint(statisticTypeToPrint); if (stats.TankAttempts == 0) { return; } conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" подножка:", TextColor.BrightRed), new TextMessageBlock("\t Шанс: ", TextColor.White), new TextMessageBlock(((double)stats.SuccessTankAttempts / stats.TankAttempts).ToString("P"), TextColor.BrightWhite), })); }
public override void Reset(StatisticTypes statisticTypeToReset) { if (statisticTypeToReset == StatisticTypes.Zone) { _zoneStats = new DodgeSkillStats(); } if (statisticTypeToReset == StatisticTypes.Fight) { _fightStats = new DodgeSkillStats(); } if (statisticTypeToReset == StatisticTypes.Session) { _sessionStats = new DodgeSkillStats(); } }
public override void PrintTankStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint) { var stats = SelectStatsToPrint(statisticTypeToPrint); if (stats.TotalTankAttempts == 0) { return; } conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" героич.:", TextColor.BrightRed), new TextMessageBlock("\t Средний: ", TextColor.White), new TextMessageBlock(((double)stats.TotalTankDamage / stats.TotalTankAttempts).ToString("P"), TextColor.BrightWhite), new TextMessageBlock("\t Максимальный: ", TextColor.White), new TextMessageBlock(stats.MaxTankDamage.ToString(), TextColor.BrightWhite), })); }
public static int GetCurrentStat(this CharacterInstance ch, StatisticTypes statistic) { var currentClass = RepositoryManager.Instance.GetClass(ch.CurrentClass); var max = 20; if (ch.IsNpc() || currentClass.PrimaryAttribute == statistic) { max = 25; } if (currentClass.SecondaryAttribute == statistic) { max = 22; } if (currentClass.DeficientAttribute == statistic) { max = 16; } return(max); }
public void ResetStats(StatisticTypes statisticTypeToReset) { if (statisticTypeToReset == StatisticTypes.Session) { _sessionStats = new DamageStats(); } if (statisticTypeToReset == StatisticTypes.Zone) { _zoneStats = new DamageStats(); } if (statisticTypeToReset == StatisticTypes.Fight) { _fightStats = new DamageStats(); } foreach (var damageSkill in _damageSkills) { damageSkill.Reset(statisticTypeToReset); } }
public void PrintStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint) { if (statisticTypeToPrint == StatisticTypes.Session) { conveyor.PushMessage(new OutputToMainWindowMessage("Статистика за текущую сессию:", TextColor.BrightWhite)); PrintStatistics(conveyor, _sessionStats, statisticTypeToPrint); } if (statisticTypeToPrint == StatisticTypes.Zone) { conveyor.PushMessage(new OutputToMainWindowMessage("Статистика за последнюю зону:", TextColor.BrightWhite)); PrintStatistics(conveyor, _zoneStats, statisticTypeToPrint); } if (statisticTypeToPrint == StatisticTypes.Fight) { conveyor.PushMessage(new OutputToMainWindowMessage("Статистика за последний бой:", TextColor.BrightWhite)); PrintStatistics(conveyor, _fightStats, statisticTypeToPrint); } }
public void AddSeriesDataPoint(StatisticTypes statisticType, string seriesName, double value, bool includeInAggregate) { // add dictionary to store statistic's specific series value if (!Series.ContainsKey(statisticType)) { Series[statisticType] = new List <IJcwChartStatistic> (); } // if the series name contains a line terminator, replace it with a dash seriesName = seriesName.Replace("\n", " - "); // Store the series value. Series[statisticType].Add(new ChartStatistic() { Name = seriesName, Value = value, IncludeInAggregate = includeInAggregate, CanIncludeInAggregate = includeInAggregate, }); }
public override void PrintTankStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint) { }
private void PrintStatistics(MessageConveyor conveyor, DamageStats stat, StatisticTypes statisticTypeToPrint) { conveyor.PushMessage(new OutputToMainWindowMessage("Ваши повреждения:", TextColor.BrightYellow)); if (stat.TotalRounds > 0) { conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" Дамаг в раунд средний: ", TextColor.White), new TextMessageBlock((stat.TotalDamage / stat.TotalRounds).ToString("00.00"), TextColor.BrightWhite), new TextMessageBlock("\t Максимальный: ", TextColor.White), new TextMessageBlock(stat.MaxRoundDamage.ToString("00.00"), TextColor.BrightWhite), })); conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" Дамаг cуммарный: ", TextColor.White), new TextMessageBlock(stat.TotalDamage.ToString(CultureInfo.InvariantCulture), TextColor.BrightWhite), })); } if (stat.TotalDamageMessages > 0) { conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" Крит шанс: ", TextColor.White), new TextMessageBlock(((double)stat.TotalCritDamageMessages / stat.TotalDamageMessages).ToString("P"), TextColor.BrightWhite), })); } if (stat.TotalCasts > 0) { conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" Шанс фейл каста: ", TextColor.White), new TextMessageBlock(((double)stat.FailedCasts / stat.TotalCasts).ToString("P"), TextColor.BrightWhite), })); } if (stat.StunRounds > 0 && stat.TotalRounds > 0) { conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" Шанс оглушить: ", TextColor.White), new TextMessageBlock(((double)stat.StunRounds / stat.TotalRounds).ToString("P"), TextColor.BrightWhite), })); } conveyor.PushMessage(new OutputToMainWindowMessage("Умения/заклинания:", TextColor.BrightYellow)); foreach (var damageSkill in _damageSkills) { damageSkill.PrintDamageStatistics(conveyor, statisticTypeToPrint); } conveyor.PushMessage(new OutputToMainWindowMessage("Повреждения по вам:", TextColor.BrightRed)); if (stat.TotalTankRounds > 0) { conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" Дамаг в раунд средний: ", TextColor.White), new TextMessageBlock((stat.TotalTankDamage / stat.TotalTankRounds).ToString("00.00"), TextColor.BrightWhite), new TextMessageBlock("\t Максимальный: ", TextColor.White), new TextMessageBlock(stat.MaxTankRoundDamage.ToString("00.00"), TextColor.BrightWhite), })); conveyor.PushMessage(new OutputToMainWindowMessage(new[] { new TextMessageBlock(" Дамаг cуммарный: ", TextColor.White), new TextMessageBlock(stat.TotalTankDamage.ToString(CultureInfo.InvariantCulture), TextColor.BrightWhite), })); } conveyor.PushMessage(new OutputToMainWindowMessage("Умения/заклинания:", TextColor.BrightRed)); foreach (var damageSkill in _damageSkills) { damageSkill.PrintTankStatistics(conveyor, statisticTypeToPrint); } var expMessages = new List <TextMessageBlock>(); if (stat.TotalExp > 0) { expMessages.Add(new TextMessageBlock("Опыт: ", TextColor.White)); expMessages.Add(new TextMessageBlock(stat.TotalExp.ToString(CultureInfo.InvariantCulture), TextColor.BrightWhite)); expMessages.Add(new TextMessageBlock("\t", TextColor.White)); } if (stat.TotalSlava > 0) { expMessages.Add(new TextMessageBlock("Слава: ", TextColor.White)); expMessages.Add(new TextMessageBlock(stat.TotalSlava.ToString(CultureInfo.InvariantCulture), TextColor.BrightWhite)); } if (expMessages.Any()) { conveyor.PushMessage(new OutputToMainWindowMessage(expMessages)); } }
public T GetStatistic <T>(StatisticTypes type) => Statistics.ContainsKey(type) ? (T)Statistics[type] : default(T);
public abstract void PrintTankStatistics(MessageConveyor conveyor, StatisticTypes statisticTypeToPrint);
public abstract void Reset(StatisticTypes statisticTypeToReset);
public UserControl GetUC(StatisticTypes types) { UserControl UC = null; switch (types) { case StatisticTypes.EquInspectionSticType: if (!GetUI(ActivityStep.FreqPlanning)) { return(null); } EquInspectionStatisticControl _uc1 = new EquInspectionStatisticControl(); _uc1.ShowStatisticList = false; _uc1.ShowLegend = false; _uc1.StatisticSource = (StatisticHelper.StatisticEquInspection(CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid) as IList <EquInspectionStatisticData>).ToList(); UC = _uc1; UC.Tag = "设备检测统计"; break; case StatisticTypes.FreqAssignStatisticType: if (!GetUI(ActivityStep.FreqPlanning)) { return(null); } FreqAssignStatisticControl _uc2 = new FreqAssignStatisticControl(); _uc2.ShowStatisticList = false; _uc2.ShowLegend = false; _uc2.StatisticSource = (StatisticHelper.StatisticFreqAssign(CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid) as IList <FreqAssignStatisticData>).ToList(); UC = _uc2; UC.Tag = "频率指配统计"; break; case StatisticTypes.FreqPartPlanStatisticType: if (!GetUI(ActivityStep.FreqPlanning)) { return(null); } FreqPartPlanStatisticControl _uc3 = new FreqPartPlanStatisticControl(); _uc3.ShowStatisticList = false; _uc3.ShowLegend = false; _uc3.StatisticSource = (StatisticHelper.StatisticFreqPartPlan(CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid) as IList <FreqPartPlanStatisticData>).ToList(); UC = _uc3; UC.Tag = "频率保障方案统计"; break; case StatisticTypes.ORGAndEQUStatisticType: if (!GetUI(ActivityStep.FreqPlanning)) { return(null); } ORGAndEQUStatisticControl _uc4 = new ORGAndEQUStatisticControl(); _uc4.ShowStatisticList = false; _uc4.ShowLegend = false; System.Collections.IList list = StatisticHelper.StatisticEquipment(CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid); _uc4.StatisticSource = (StatisticHelper.StatisticEquipment(CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid) as IList <EquStatisticData>).ToList(); UC = _uc4; UC.Tag = "参保单位统计"; break; case StatisticTypes.SurroundStatStatisticType: if (!GetUI(ActivityStep.StationPlanning)) { return(null); } RoundStatStatisticControl _uc5 = new RoundStatStatisticControl(); _uc5.ShowStatisticList = false; _uc5.ShowLegend = false; _uc5.StatisticSource = (StatisticHelper.StatisticSurroundStation(CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid) as IList <SurroundStatStatisticData>).ToList(); UC = _uc5; UC.Tag = "周围台站统计"; break; case StatisticTypes.PersonPlanStatisticType: if (!GetUI(ActivityStep.StaffPlanning)) { return(null); } PersonPlanStatisticControl _uc6 = new PersonPlanStatisticControl(); _uc6.ShowStatisticList = false; _uc6.ShowLegend = false; IList _statisticSource = StatisticHelper.StatisticPersonPlan(CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid); _uc6.PersonPlanStatisticSource = _statisticSource as IList <PersonPlanStatisticData>; _uc6.StatisticSource = _statisticSource; UC = _uc6; UC.Tag = "人员预案统计"; break; default: return(null); } return(UC); }