Minor quest/stat updates

This commit is contained in:
Liza 2024-01-11 13:56:39 +01:00
parent b0c8aee855
commit b757d93780
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 14 additions and 5 deletions

View File

@ -150,6 +150,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
values.Add(PointData.Measurement("currency")
.Tag("id", character.CharacterId.ToString())
.Tag("player_name", owner.Name)
.Tag("player_id", character.OwnerId.ToString())
.Tag("type", character.CharacterType.ToString())
.Tag("retainer_name", character.Name)
.Field("gil", currencies.Gil)
@ -162,6 +163,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
values.Add(PointData.Measurement("retainer")
.Tag("id", character.CharacterId.ToString())
.Tag("player_name", owner.Name)
.Tag("player_id", character.OwnerId.ToString())
.Tag("type", character.CharacterType.ToString())
.Tag("retainer_name", character.Name)
.Tag("class", _classJobNames[character.ClassJob])

View File

@ -56,7 +56,8 @@ internal sealed class LocalStatsCalculator : IDisposable
_clientState.Login += UpdateStatistics;
_clientState.TerritoryChanged += UpdateStatistics;
_addonLifecycle.RegisterListener(AddonEvent.PreFinalize, "SelectYesno", UpdateStatistics);
_addonLifecycle.RegisterListener(AddonEvent.PostSetup, "SelectYesno", UpdateStatisticsLogout);
_addonLifecycle.RegisterListener(AddonEvent.PreSetup, "JournalAccept", UpdateStatistics);
Task.Run(() =>
{
@ -64,6 +65,9 @@ internal sealed class LocalStatsCalculator : IDisposable
foreach (var quest in dataManager.GetExcelSheet<Quest>()!.Where(x => x.JournalGenre.Row is >= 1 and <= 12))
{
var previousQuests = quest.PreviousQuest?.Select(x => x.Row).Where(x => x != 0).ToList();
if (previousQuests != null && quest.Unknown12 != 0)
previousQuests.Add(quest.Unknown12);
msq.Add(new QuestInfo
{
RowId = quest.RowId,
@ -148,21 +152,24 @@ internal sealed class LocalStatsCalculator : IDisposable
public void Dispose()
{
_addonLifecycle.UnregisterListener(AddonEvent.PreFinalize, "SelectYesno", UpdateStatistics);
_addonLifecycle.UnregisterListener(AddonEvent.PreSetup, "JournalAccept", UpdateStatistics);
_addonLifecycle.UnregisterListener(AddonEvent.PostSetup, "SelectYesno", UpdateStatisticsLogout);
_clientState.Login -= UpdateStatistics;
_clientState.TerritoryChanged -= UpdateStatistics;
}
private void UpdateStatistics(ushort territoryType) => UpdateStatistics();
private unsafe void UpdateStatistics(AddonEvent type, AddonArgs args)
private unsafe void UpdateStatisticsLogout(AddonEvent type, AddonArgs args)
{
AddonSelectYesno* addonSelectYesNo = (AddonSelectYesno*)args.Addon;
string text = MemoryHelper.ReadSeString(&addonSelectYesNo->PromptText->NodeText).ToString().Replace("\n", "").Replace("\r", "");
string? text = MemoryHelper.ReadSeString(&addonSelectYesNo->PromptText->NodeText)?.ToString();
text = text?.Replace("\n", "").Replace("\r", "");
if (text == _gameStrings.LogoutToTitleScreen || text == _gameStrings.LogoutAndExitGame)
UpdateStatistics();
}
private void UpdateStatistics(AddonEvent type, AddonArgs args) => UpdateStatistics();
private unsafe void UpdateStatistics()
{
var localContentId = _clientState.LocalContentId;