Add options what to do when not on Home World
This commit is contained in:
parent
1cd1a2ede4
commit
576baf0175
@ -15,6 +15,7 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
public bool ReserveDifferentSealCountAtMaxRank { get; set; }
|
public bool ReserveDifferentSealCountAtMaxRank { get; set; }
|
||||||
public int ReservedSealCountAtMaxRank { get; set; }
|
public int ReservedSealCountAtMaxRank { get; set; }
|
||||||
public int PauseAtRank { get; set; }
|
public int PauseAtRank { get; set; }
|
||||||
|
public EBehaviorOnOtherWorld BehaviorOnOtherWorld { get; set; } = EBehaviorOnOtherWorld.Warning;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A config-only setting, not exposed in the UI.
|
/// A config-only setting, not exposed in the UI.
|
||||||
@ -40,4 +41,11 @@ internal sealed class Configuration : IPluginConfiguration
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum EBehaviorOnOtherWorld
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Warning,
|
||||||
|
DisableTurnIn,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public sealed partial class DeliverooPlugin : IDalamudPlugin
|
|||||||
_iconCache = new IconCache(textureProvider);
|
_iconCache = new IconCache(textureProvider);
|
||||||
_configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState, _pluginLog, _iconCache);
|
_configWindow = new ConfigWindow(_pluginInterface, this, _configuration, _gcRewardsCache, _clientState, _pluginLog, _iconCache);
|
||||||
_windowSystem.AddWindow(_configWindow);
|
_windowSystem.AddWindow(_configWindow);
|
||||||
_turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _condition, _gcRewardsCache, _configWindow, _iconCache);
|
_turnInWindow = new TurnInWindow(this, _pluginInterface, _configuration, _condition, _clientState, _gcRewardsCache, _configWindow, _iconCache);
|
||||||
_windowSystem.AddWindow(_turnInWindow);
|
_windowSystem.AddWindow(_turnInWindow);
|
||||||
_sealCaps = dataManager.GetExcelSheet<GrandCompanyRank>()!.Where(x => x.RowId > 0)
|
_sealCaps = dataManager.GetExcelSheet<GrandCompanyRank>()!.Where(x => x.RowId > 0)
|
||||||
.ToDictionary(x => x.RowId, x => x.MaxSeals);
|
.ToDictionary(x => x.RowId, x => x.MaxSeals);
|
||||||
|
@ -170,7 +170,9 @@ internal sealed class ConfigWindow : LImGui.LWindow
|
|||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3);
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool addThis = ImGui.Selectable($"{item.Name}{(item.Limited ? $" {SeIconChar.Hyadelyn.ToIconString()}" : "")}##SelectVenture{item.IconId}");
|
bool addThis =
|
||||||
|
ImGui.Selectable(
|
||||||
|
$"{item.Name}{(item.Limited ? $" {SeIconChar.Hyadelyn.ToIconString()}" : "")}##SelectVenture{item.IconId}");
|
||||||
if (addThis || addFirst)
|
if (addThis || addFirst)
|
||||||
{
|
{
|
||||||
_configuration.ItemsAvailableForPurchase.Add(item.ItemId);
|
_configuration.ItemsAvailableForPurchase.Add(item.ItemId);
|
||||||
@ -244,7 +246,8 @@ internal sealed class ConfigWindow : LImGui.LWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiComponents.HelpMarker("The default filter for all characters is 'Hide Gear Set Items', but you may want to override this to hide all Armoury Chest items (regardless of whether they're part of a gear set) e.g. for your main character.");
|
ImGuiComponents.HelpMarker(
|
||||||
|
"The default filter for all characters is 'Hide Gear Set Items', but you may want to override this to hide all Armoury Chest items (regardless of whether they're part of a gear set) e.g. for your main character.");
|
||||||
|
|
||||||
bool ignoreMinimumSealsToKeep = charConfiguration.IgnoreMinimumSealsToKeep;
|
bool ignoreMinimumSealsToKeep = charConfiguration.IgnoreMinimumSealsToKeep;
|
||||||
if (ImGui.Checkbox("Ignore 'Minimum Seals to keep' setting", ref ignoreMinimumSealsToKeep))
|
if (ImGui.Checkbox("Ignore 'Minimum Seals to keep' setting", ref ignoreMinimumSealsToKeep))
|
||||||
@ -254,7 +257,8 @@ internal sealed class ConfigWindow : LImGui.LWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiComponents.HelpMarker("When enabled, all GC seals will be spent. This is effectively the same as setting 'Minimum Seals to keep' to 0.");
|
ImGuiComponents.HelpMarker(
|
||||||
|
"When enabled, all GC seals will be spent. This is effectively the same as setting 'Minimum Seals to keep' to 0.");
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
ImGui.EndDisabled();
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
@ -309,7 +313,8 @@ internal sealed class ConfigWindow : LImGui.LWindow
|
|||||||
int reservedSealCount = _configuration.ReservedSealCount;
|
int reservedSealCount = _configuration.ReservedSealCount;
|
||||||
if (ImGui.InputInt("Minimum Seals to keep (e.g. for Squadron Missions)", ref reservedSealCount, 1000))
|
if (ImGui.InputInt("Minimum Seals to keep (e.g. for Squadron Missions)", ref reservedSealCount, 1000))
|
||||||
{
|
{
|
||||||
_configuration.ReservedSealCount = Math.Max(0, Math.Min((int)_plugin.GetMaxSealCap(), reservedSealCount));
|
_configuration.ReservedSealCount =
|
||||||
|
Math.Max(0, Math.Min((int)_plugin.GetMaxSealCap(), reservedSealCount));
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,11 +333,14 @@ internal sealed class ConfigWindow : LImGui.LWindow
|
|||||||
int reservedSealCountAtMaxRank = _configuration.ReservedSealCountAtMaxRank;
|
int reservedSealCountAtMaxRank = _configuration.ReservedSealCountAtMaxRank;
|
||||||
if (ImGui.InputInt("Minimum seals to keep at max rank", ref reservedSealCountAtMaxRank))
|
if (ImGui.InputInt("Minimum seals to keep at max rank", ref reservedSealCountAtMaxRank))
|
||||||
{
|
{
|
||||||
_configuration.ReservedSealCountAtMaxRank = Math.Max(0, Math.Min((int)_plugin.GetMaxSealCap(), reservedSealCountAtMaxRank));
|
_configuration.ReservedSealCountAtMaxRank = Math.Max(0,
|
||||||
|
Math.Min((int)_plugin.GetMaxSealCap(), reservedSealCountAtMaxRank));
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Unindent();
|
ImGui.Unindent();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndDisabled();
|
ImGui.EndDisabled();
|
||||||
|
|
||||||
ImGui.SetNextItemWidth(ImGuiHelpers.GlobalScale * 120);
|
ImGui.SetNextItemWidth(ImGuiHelpers.GlobalScale * 120);
|
||||||
@ -340,13 +348,24 @@ internal sealed class ConfigWindow : LImGui.LWindow
|
|||||||
.Select(x => x == 1 ? (0, "---") : (x, $"Rank {x}"))
|
.Select(x => x == 1 ? (0, "---") : (x, $"Rank {x}"))
|
||||||
.ToList();
|
.ToList();
|
||||||
int pauseAtRank = Math.Max(rankUpComboValues.FindIndex(x => x.Rank == _configuration.PauseAtRank), 0);
|
int pauseAtRank = Math.Max(rankUpComboValues.FindIndex(x => x.Rank == _configuration.PauseAtRank), 0);
|
||||||
if (ImGui.Combo("Pause when reaching selected FC Rank", ref pauseAtRank, rankUpComboValues.Select(x => x.Name).ToArray(),
|
if (ImGui.Combo("Pause when reaching selected FC Rank", ref pauseAtRank,
|
||||||
|
rankUpComboValues.Select(x => x.Name).ToArray(),
|
||||||
rankUpComboValues.Count))
|
rankUpComboValues.Count))
|
||||||
{
|
{
|
||||||
_configuration.PauseAtRank = rankUpComboValues[pauseAtRank].Rank;
|
_configuration.PauseAtRank = rankUpComboValues[pauseAtRank].Rank;
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.SetNextItemWidth(ImGuiHelpers.GlobalScale * 120);
|
||||||
|
string[] behaviorOnOtherWorldNames = { "---", "Show Warning", "Disable Turn-In" };
|
||||||
|
int behaviorOnOtherWorld = (int)_configuration.BehaviorOnOtherWorld;
|
||||||
|
if (ImGui.Combo("Behavior when not on Home World", ref behaviorOnOtherWorld,
|
||||||
|
behaviorOnOtherWorldNames, behaviorOnOtherWorldNames.Length))
|
||||||
|
{
|
||||||
|
_configuration.BehaviorOnOtherWorld = (Configuration.EBehaviorOnOtherWorld)behaviorOnOtherWorld;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.EndTabItem();
|
ImGui.EndTabItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,17 +44,20 @@ internal sealed class TurnInWindow : LImGui.LWindow
|
|||||||
private readonly DalamudPluginInterface _pluginInterface;
|
private readonly DalamudPluginInterface _pluginInterface;
|
||||||
private readonly Configuration _configuration;
|
private readonly Configuration _configuration;
|
||||||
private readonly ICondition _condition;
|
private readonly ICondition _condition;
|
||||||
|
private readonly IClientState _clientState;
|
||||||
private readonly GcRewardsCache _gcRewardsCache;
|
private readonly GcRewardsCache _gcRewardsCache;
|
||||||
private readonly IconCache _iconCache;
|
private readonly IconCache _iconCache;
|
||||||
|
|
||||||
public TurnInWindow(DeliverooPlugin plugin, DalamudPluginInterface pluginInterface, Configuration configuration,
|
public TurnInWindow(DeliverooPlugin plugin, DalamudPluginInterface pluginInterface, Configuration configuration,
|
||||||
ICondition condition, GcRewardsCache gcRewardsCache, ConfigWindow configWindow, IconCache iconCache)
|
ICondition condition, IClientState clientState, GcRewardsCache gcRewardsCache, ConfigWindow configWindow,
|
||||||
|
IconCache iconCache)
|
||||||
: base("GC Delivery###DeliverooTurnIn")
|
: base("GC Delivery###DeliverooTurnIn")
|
||||||
{
|
{
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
_pluginInterface = pluginInterface;
|
_pluginInterface = pluginInterface;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_condition = condition;
|
_condition = condition;
|
||||||
|
_clientState = clientState;
|
||||||
_gcRewardsCache = gcRewardsCache;
|
_gcRewardsCache = gcRewardsCache;
|
||||||
_iconCache = iconCache;
|
_iconCache = iconCache;
|
||||||
|
|
||||||
@ -93,6 +96,10 @@ internal sealed class TurnInWindow : LImGui.LWindow
|
|||||||
private bool UseCharacterSpecificItemsToPurchase =>
|
private bool UseCharacterSpecificItemsToPurchase =>
|
||||||
_plugin.CharacterConfiguration is { OverrideItemsToPurchase: true };
|
_plugin.CharacterConfiguration is { OverrideItemsToPurchase: true };
|
||||||
|
|
||||||
|
private bool IsOnHomeWorld =>
|
||||||
|
_clientState.LocalPlayer == null ||
|
||||||
|
_clientState.LocalPlayer.HomeWorld.Id == _clientState.LocalPlayer.CurrentWorld.Id;
|
||||||
|
|
||||||
private IItemsToPurchase ItemsWrapper => UseCharacterSpecificItemsToPurchase
|
private IItemsToPurchase ItemsWrapper => UseCharacterSpecificItemsToPurchase
|
||||||
? new CharacterSpecificItemsToPurchase(_plugin.CharacterConfiguration!, _pluginInterface)
|
? new CharacterSpecificItemsToPurchase(_plugin.CharacterConfiguration!, _pluginInterface)
|
||||||
: new GlobalItemsToPurchase(_configuration, _pluginInterface);
|
: new GlobalItemsToPurchase(_configuration, _pluginInterface);
|
||||||
@ -146,6 +153,12 @@ internal sealed class TurnInWindow : LImGui.LWindow
|
|||||||
ImGui.TextColored(ImGuiColors.DalamudRed, "You do not have the required rank for Expert Delivery.");
|
ImGui.TextColored(ImGuiColors.DalamudRed, "You do not have the required rank for Expert Delivery.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (_configuration.BehaviorOnOtherWorld == Configuration.EBehaviorOnOtherWorld.DisableTurnIn && !IsOnHomeWorld)
|
||||||
|
{
|
||||||
|
State = false;
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudRed, "You are not on your home world.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool state = State;
|
bool state = State;
|
||||||
if (ImGui.Checkbox("Handle GC turn ins/exchange automatically", ref state))
|
if (ImGui.Checkbox("Handle GC turn ins/exchange automatically", ref state))
|
||||||
@ -160,6 +173,12 @@ internal sealed class TurnInWindow : LImGui.LWindow
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (_configuration.BehaviorOnOtherWorld == Configuration.EBehaviorOnOtherWorld.Warning && !IsOnHomeWorld)
|
||||||
|
{
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudRed,
|
||||||
|
"Turn-In disabled, you are not on your home world and will not earn FC points.");
|
||||||
|
}
|
||||||
|
|
||||||
if (Multiplier == 1m)
|
if (Multiplier == 1m)
|
||||||
{
|
{
|
||||||
ImGui.TextColored(ImGuiColors.DalamudYellow, "You do not have an active seal buff.");
|
ImGui.TextColored(ImGuiColors.DalamudYellow, "You do not have an active seal buff.");
|
||||||
|
Loading…
Reference in New Issue
Block a user