From 4b59c71815b1f9ccd836d5f6104d9a5b709d8004 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sun, 24 Sep 2023 22:18:54 +0200 Subject: [PATCH] Include levels for combat jobs --- Influx/Influx/InfluxStatisticsClient.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Influx/Influx/InfluxStatisticsClient.cs b/Influx/Influx/InfluxStatisticsClient.cs index b1c01b0..db9d0d4 100644 --- a/Influx/Influx/InfluxStatisticsClient.cs +++ b/Influx/Influx/InfluxStatisticsClient.cs @@ -26,6 +26,7 @@ internal class InfluxStatisticsClient : IDisposable private readonly ClientState _clientState; private readonly IReadOnlyDictionary _classJobToArrayIndex; private readonly IReadOnlyDictionary _classJobNames; + private readonly Dictionary _expToJobs; public InfluxStatisticsClient(ChatGui chatGui, Configuration configuration, DataManager dataManager, ClientState clientState) @@ -39,6 +40,10 @@ internal class InfluxStatisticsClient : IDisposable .ToDictionary(x => (byte)x.RowId, x => (byte)x.ExpArrayIndex); _classJobNames = dataManager.GetExcelSheet()!.Where(x => x.RowId > 0) .ToDictionary(x => (byte)x.RowId, x => x.Abbreviation.ToString()); + _expToJobs = dataManager.GetExcelSheet()!.Where(x => x.RowId > 0) + .Where(x => x.JobIndex > 0) + .Where(x => x.Abbreviation.ToString() != "SMN") + .ToDictionary(x => x.ExpArrayIndex, x => x.Abbreviation.ToString()); } public bool Enabled => _configuration.Server.Enabled; @@ -109,6 +114,25 @@ internal class InfluxStatisticsClient : IDisposable .Field("squadron_unlocked", localStats.SquadronUnlocked == true ? 1 : 0) .Timestamp(date, WritePrecision.S)); + if (localStats.ClassJobLevels.Count > 0) + { + foreach (var (expIndex, abbreviation) in _expToJobs) + { + var level = localStats.ClassJobLevels[expIndex]; + if (level > 0) + { + values.Add(PointData.Measurement("experience") + .Tag("id", character.CharacterId.ToString()) + .Tag("player_name", character.Name) + .Tag("type", character.CharacterType.ToString()) + .Tag("fc_id", character.FreeCompanyId > 0 ? character.FreeCompanyId.ToString() : null) + .Tag("job", abbreviation) + .Field("level", level) + .Timestamp(date, WritePrecision.S)); + } + } + } + if (localStats.MsqCount != -1) { values.Add(PointData.Measurement("quests")