From 0c9fd9547812e8bceb7d9e4cfc69466cc7dbb7cf Mon Sep 17 00:00:00 2001 From: goaaats Date: Sun, 3 Apr 2022 03:07:28 +0200 Subject: [PATCH] feat: add mb collect checkbox to general settings --- Dalamud.Injector/EntryPoint.cs | 4 +--- Dalamud/Configuration/Internal/DalamudConfiguration.cs | 5 +++++ Dalamud/DalamudStartInfo.cs | 5 ----- Dalamud/Game/Network/Internal/NetworkHandlers.cs | 7 ++----- Dalamud/Interface/Internal/Windows/SettingsWindow.cs | 6 ++++++ 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Dalamud.Injector/EntryPoint.cs b/Dalamud.Injector/EntryPoint.cs index 92a0861d4..829a15429 100644 --- a/Dalamud.Injector/EntryPoint.cs +++ b/Dalamud.Injector/EntryPoint.cs @@ -281,7 +281,6 @@ namespace Dalamud.Injector AssetDirectory = Path.Combine(xivlauncherDir, "dalamudAssets", "dev"), GameVersion = gameVer, Language = ClientLanguage.English, - OptOutMbCollection = false, }; Log.Debug( @@ -292,8 +291,7 @@ namespace Dalamud.Injector $" DefaultPluginDirectory: {startInfo.DefaultPluginDirectory}\n" + $" AssetDirectory: {startInfo.AssetDirectory}\n" + $" GameVersion: {startInfo.GameVersion}\n" + - $" Language: {startInfo.Language}\n" + - $" OptOutMbCollection: {startInfo.OptOutMbCollection}"); + $" Language: {startInfo.Language}\n"); Log.Information("A Dalamud start info was not found in the program arguments. One has been generated for you."); Log.Information("Copy the following contents into the program arguments:"); diff --git a/Dalamud/Configuration/Internal/DalamudConfiguration.cs b/Dalamud/Configuration/Internal/DalamudConfiguration.cs index 41eeb5b03..e9209e2d0 100644 --- a/Dalamud/Configuration/Internal/DalamudConfiguration.cs +++ b/Dalamud/Configuration/Internal/DalamudConfiguration.cs @@ -295,6 +295,11 @@ namespace Dalamud.Configuration.Internal /// public bool ShowTsm { get; set; } = true; + /// + /// Gets or sets a value indicating whether or not market board data should be uploaded. + /// + public bool DoMbCollect { get; set; } = false; + /// /// Load a configuration from the provided path. /// diff --git a/Dalamud/DalamudStartInfo.cs b/Dalamud/DalamudStartInfo.cs index 891a57dca..767ee5000 100644 --- a/Dalamud/DalamudStartInfo.cs +++ b/Dalamud/DalamudStartInfo.cs @@ -47,11 +47,6 @@ namespace Dalamud [JsonConverter(typeof(GameVersionConverter))] public GameVersion GameVersion { get; init; } - /// - /// Gets a value indicating whether or not market board information should be uploaded by default. - /// - public bool OptOutMbCollection { get; init; } - /// /// Gets a value that specifies how much to wait before a new Dalamud session. /// diff --git a/Dalamud/Game/Network/Internal/NetworkHandlers.cs b/Dalamud/Game/Network/Internal/NetworkHandlers.cs index 3958f3f3b..8220a1473 100644 --- a/Dalamud/Game/Network/Internal/NetworkHandlers.cs +++ b/Dalamud/Game/Network/Internal/NetworkHandlers.cs @@ -25,7 +25,6 @@ namespace Dalamud.Game.Network.Internal { private readonly List marketBoardRequests = new(); - private readonly bool optOutMbUploads; private readonly IMarketBoardUploader uploader; private MarketBoardPurchaseHandler marketBoardPurchaseHandler; @@ -35,8 +34,6 @@ namespace Dalamud.Game.Network.Internal /// public NetworkHandlers() { - this.optOutMbUploads = Service.Get().OptOutMbCollection; - this.uploader = new UniversalisMarketBoardUploader(); Service.Get().NetworkMessage += this.OnNetworkMessage; @@ -58,7 +55,7 @@ namespace Dalamud.Game.Network.Internal if (direction == NetworkMessageDirection.ZoneUp) { - if (!this.optOutMbUploads) + if (configuration.DoMbCollect) { if (opCode == dataManager.ClientOpCodes["MarketBoardPurchaseHandler"]) { @@ -76,7 +73,7 @@ namespace Dalamud.Game.Network.Internal return; } - if (!this.optOutMbUploads) + if (configuration.DoMbCollect) { if (opCode == dataManager.ServerOpCodes["MarketBoardItemRequestStart"]) { diff --git a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs index 6edff8e66..b1f212d49 100644 --- a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs @@ -36,6 +36,7 @@ namespace Dalamud.Interface.Internal.Windows private bool doCfTaskBarFlash; private bool doCfChatMessage; + private bool doMbCollect; private float globalUiScale; private bool doUseAxisFontsFromGame; @@ -91,6 +92,7 @@ namespace Dalamud.Interface.Internal.Windows this.doCfTaskBarFlash = configuration.DutyFinderTaskbarFlash; this.doCfChatMessage = configuration.DutyFinderChatMessage; + this.doMbCollect = configuration.DoMbCollect; this.globalUiScale = configuration.GlobalUiScale; this.fontGamma = configuration.FontGamma; @@ -281,6 +283,9 @@ namespace Dalamud.Interface.Internal.Windows ImGui.Checkbox(Loc.Localize("DalamudSettingsDisableRmtFiltering", "Disable RMT Filtering"), ref this.disableRmtFiltering); ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsDisableRmtFilteringMsgHint", "Disable dalamud's built-in RMT ad filtering.")); + + ImGui.Checkbox(Loc.Localize("DalamudSettingDoMbCollect", "Anonymously upload market board data"), ref this.doMbCollect); + ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingDoMbCollectHint", "Anonymously provide data about in-game economics to Universalis when browsing the market board. This data can't be tied to you in any way and everyone benefits!")); } private void DrawLookAndFeelTab() @@ -849,6 +854,7 @@ namespace Dalamud.Interface.Internal.Windows configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash; configuration.DutyFinderChatMessage = this.doCfChatMessage; + configuration.DoMbCollect = this.doMbCollect; configuration.GlobalUiScale = this.globalUiScale; configuration.ToggleUiHide = this.doToggleUiHide;