feat: add mb collect checkbox to general settings

This commit is contained in:
goaaats 2022-04-03 03:07:28 +02:00
parent 76b2129a93
commit 0c9fd95478
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
5 changed files with 14 additions and 13 deletions

View file

@ -281,7 +281,6 @@ namespace Dalamud.Injector
AssetDirectory = Path.Combine(xivlauncherDir, "dalamudAssets", "dev"), AssetDirectory = Path.Combine(xivlauncherDir, "dalamudAssets", "dev"),
GameVersion = gameVer, GameVersion = gameVer,
Language = ClientLanguage.English, Language = ClientLanguage.English,
OptOutMbCollection = false,
}; };
Log.Debug( Log.Debug(
@ -292,8 +291,7 @@ namespace Dalamud.Injector
$" DefaultPluginDirectory: {startInfo.DefaultPluginDirectory}\n" + $" DefaultPluginDirectory: {startInfo.DefaultPluginDirectory}\n" +
$" AssetDirectory: {startInfo.AssetDirectory}\n" + $" AssetDirectory: {startInfo.AssetDirectory}\n" +
$" GameVersion: {startInfo.GameVersion}\n" + $" GameVersion: {startInfo.GameVersion}\n" +
$" Language: {startInfo.Language}\n" + $" Language: {startInfo.Language}\n");
$" OptOutMbCollection: {startInfo.OptOutMbCollection}");
Log.Information("A Dalamud start info was not found in the program arguments. One has been generated for you."); 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:"); Log.Information("Copy the following contents into the program arguments:");

View file

@ -295,6 +295,11 @@ namespace Dalamud.Configuration.Internal
/// </summary> /// </summary>
public bool ShowTsm { get; set; } = true; public bool ShowTsm { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether or not market board data should be uploaded.
/// </summary>
public bool DoMbCollect { get; set; } = false;
/// <summary> /// <summary>
/// Load a configuration from the provided path. /// Load a configuration from the provided path.
/// </summary> /// </summary>

View file

@ -47,11 +47,6 @@ namespace Dalamud
[JsonConverter(typeof(GameVersionConverter))] [JsonConverter(typeof(GameVersionConverter))]
public GameVersion GameVersion { get; init; } public GameVersion GameVersion { get; init; }
/// <summary>
/// Gets a value indicating whether or not market board information should be uploaded by default.
/// </summary>
public bool OptOutMbCollection { get; init; }
/// <summary> /// <summary>
/// Gets a value that specifies how much to wait before a new Dalamud session. /// Gets a value that specifies how much to wait before a new Dalamud session.
/// </summary> /// </summary>

View file

@ -25,7 +25,6 @@ namespace Dalamud.Game.Network.Internal
{ {
private readonly List<MarketBoardItemRequest> marketBoardRequests = new(); private readonly List<MarketBoardItemRequest> marketBoardRequests = new();
private readonly bool optOutMbUploads;
private readonly IMarketBoardUploader uploader; private readonly IMarketBoardUploader uploader;
private MarketBoardPurchaseHandler marketBoardPurchaseHandler; private MarketBoardPurchaseHandler marketBoardPurchaseHandler;
@ -35,8 +34,6 @@ namespace Dalamud.Game.Network.Internal
/// </summary> /// </summary>
public NetworkHandlers() public NetworkHandlers()
{ {
this.optOutMbUploads = Service<DalamudStartInfo>.Get().OptOutMbCollection;
this.uploader = new UniversalisMarketBoardUploader(); this.uploader = new UniversalisMarketBoardUploader();
Service<GameNetwork>.Get().NetworkMessage += this.OnNetworkMessage; Service<GameNetwork>.Get().NetworkMessage += this.OnNetworkMessage;
@ -58,7 +55,7 @@ namespace Dalamud.Game.Network.Internal
if (direction == NetworkMessageDirection.ZoneUp) if (direction == NetworkMessageDirection.ZoneUp)
{ {
if (!this.optOutMbUploads) if (configuration.DoMbCollect)
{ {
if (opCode == dataManager.ClientOpCodes["MarketBoardPurchaseHandler"]) if (opCode == dataManager.ClientOpCodes["MarketBoardPurchaseHandler"])
{ {
@ -76,7 +73,7 @@ namespace Dalamud.Game.Network.Internal
return; return;
} }
if (!this.optOutMbUploads) if (configuration.DoMbCollect)
{ {
if (opCode == dataManager.ServerOpCodes["MarketBoardItemRequestStart"]) if (opCode == dataManager.ServerOpCodes["MarketBoardItemRequestStart"])
{ {

View file

@ -36,6 +36,7 @@ namespace Dalamud.Interface.Internal.Windows
private bool doCfTaskBarFlash; private bool doCfTaskBarFlash;
private bool doCfChatMessage; private bool doCfChatMessage;
private bool doMbCollect;
private float globalUiScale; private float globalUiScale;
private bool doUseAxisFontsFromGame; private bool doUseAxisFontsFromGame;
@ -91,6 +92,7 @@ namespace Dalamud.Interface.Internal.Windows
this.doCfTaskBarFlash = configuration.DutyFinderTaskbarFlash; this.doCfTaskBarFlash = configuration.DutyFinderTaskbarFlash;
this.doCfChatMessage = configuration.DutyFinderChatMessage; this.doCfChatMessage = configuration.DutyFinderChatMessage;
this.doMbCollect = configuration.DoMbCollect;
this.globalUiScale = configuration.GlobalUiScale; this.globalUiScale = configuration.GlobalUiScale;
this.fontGamma = configuration.FontGamma; 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.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.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() private void DrawLookAndFeelTab()
@ -849,6 +854,7 @@ namespace Dalamud.Interface.Internal.Windows
configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash; configuration.DutyFinderTaskbarFlash = this.doCfTaskBarFlash;
configuration.DutyFinderChatMessage = this.doCfChatMessage; configuration.DutyFinderChatMessage = this.doCfChatMessage;
configuration.DoMbCollect = this.doMbCollect;
configuration.GlobalUiScale = this.globalUiScale; configuration.GlobalUiScale = this.globalUiScale;
configuration.ToggleUiHide = this.doToggleUiHide; configuration.ToggleUiHide = this.doToggleUiHide;