forked from liza/Deliveroo
Fix default config not having venture saved until you open the config window
This commit is contained in:
parent
b4606c34d3
commit
64a0843b7f
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Dalamud.Configuration;
|
||||
using Deliveroo.GameData;
|
||||
|
||||
namespace Deliveroo;
|
||||
|
||||
@ -19,4 +20,14 @@ internal sealed class Configuration : IPluginConfiguration
|
||||
public int Limit { get; set; }
|
||||
}
|
||||
|
||||
public bool AddVentureIfNoItemToPurchaseSelected()
|
||||
{
|
||||
if (ItemsAvailableForPurchase.Count == 0)
|
||||
{
|
||||
ItemsAvailableForPurchase.Add(ItemIds.Venture);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game;
|
||||
@ -19,7 +18,6 @@ using Deliveroo.Windows;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using Newtonsoft.Json;
|
||||
using Condition = Dalamud.Game.ClientState.Conditions.Condition;
|
||||
|
||||
namespace Deliveroo;
|
||||
@ -93,6 +91,9 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
||||
|
||||
if (_clientState.IsLoggedIn)
|
||||
Login(this, EventArgs.Empty);
|
||||
|
||||
if (_configuration.AddVentureIfNoItemToPurchaseSelected())
|
||||
_pluginInterface.SavePluginConfig(_configuration);
|
||||
}
|
||||
|
||||
public string Name => "Deliveroo";
|
||||
|
@ -52,11 +52,8 @@ internal sealed class ConfigWindow : Window
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
if (_configuration.ItemsAvailableForPurchase.Count == 0)
|
||||
{
|
||||
_configuration.ItemsAvailableForPurchase.Add(ItemIds.Venture);
|
||||
if (_configuration.AddVentureIfNoItemToPurchaseSelected())
|
||||
Save();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabBar("DeliverooConfigTabs"))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user