PalacePal/Pal.Client/Configuration/IPalacePalConfiguration.cs

111 lines
3.2 KiB
C#
Raw Normal View History

2023-02-15 01:38:04 +00:00
using System;
using System.Collections.Generic;
using System.Numerics;
using ImGuiNET;
2023-02-15 13:35:11 +00:00
using Newtonsoft.Json;
2023-02-15 01:38:04 +00:00
namespace Pal.Client.Configuration
{
public interface IVersioned
{
int Version { get; set; }
}
public interface IConfigurationInConfigDirectory : IVersioned
{
}
public interface IPalacePalConfiguration : IConfigurationInConfigDirectory
{
bool FirstUse { get; set; }
EMode Mode { get; set; }
string BetaKey { get; }
DeepDungeonConfiguration DeepDungeons { get; set; }
RendererConfiguration Renderer { get; set; }
2023-02-21 16:32:13 +00:00
BackupConfiguration Backups { get; set; }
2023-02-15 01:38:04 +00:00
IAccountConfiguration CreateAccount(string server, Guid accountId);
IAccountConfiguration? FindAccount(string server);
void RemoveAccount(string server);
2023-02-15 22:17:19 +00:00
bool HasRoleOnCurrentServer(string server, string role);
2023-02-15 01:38:04 +00:00
}
public class DeepDungeonConfiguration
{
public MarkerConfiguration Traps { get; set; } = new()
{
Show = true,
Color = ImGui.ColorConvertFloat4ToU32(new Vector4(1, 0, 0, 0.4f)),
OnlyVisibleAfterPomander = true,
Fill = false
};
public MarkerConfiguration HoardCoffers { get; set; } = new()
{
Show = true,
Color = ImGui.ColorConvertFloat4ToU32(new Vector4(0, 1, 1, 0.4f)),
OnlyVisibleAfterPomander = true,
Fill = false
};
public MarkerConfiguration SilverCoffers { get; set; } = new()
{
Show = false,
Color = ImGui.ColorConvertFloat4ToU32(new Vector4(1, 1, 1, 0.4f)),
OnlyVisibleAfterPomander = false,
Fill = true
};
2023-02-26 16:31:37 +00:00
public MarkerConfiguration GoldCoffers { get; set; } = new()
{
Show = false,
Color = ImGui.ColorConvertFloat4ToU32(new Vector4(1, 1, 0, 0.4f)),
OnlyVisibleAfterPomander = false,
Fill = true
};
2023-02-15 01:38:04 +00:00
}
public class MarkerConfiguration
{
2023-02-15 13:35:11 +00:00
[JsonRequired]
2023-02-15 01:38:04 +00:00
public bool Show { get; set; }
2023-02-15 13:35:11 +00:00
[JsonRequired]
2023-02-15 01:38:04 +00:00
public uint Color { get; set; }
2023-02-15 13:35:11 +00:00
2023-02-15 01:38:04 +00:00
public bool OnlyVisibleAfterPomander { get; set; }
public bool Fill { get; set; }
}
public class RendererConfiguration
{
public ERenderer SelectedRenderer { get; set; } = ERenderer.Splatoon;
}
public interface IAccountConfiguration
{
bool IsUsable { get; }
string Server { get; }
Guid AccountId { get; }
2023-02-15 01:38:04 +00:00
/// <summary>
/// This is taken from the JWT, and is only refreshed on a successful login.
///
/// If you simply reload the plugin without any server interaction, this doesn't change.
///
/// This has no impact on what roles the JWT actually contains, but is just to make it
/// easier to draw a consistent UI. The server will still reject unauthorized calls.
/// </summary>
List<string> CachedRoles { get; set; }
bool EncryptIfNeeded();
2023-02-15 01:38:04 +00:00
}
2023-02-21 16:32:13 +00:00
public class BackupConfiguration
{
public int MinimumBackupsToKeep { get; set; } = 3;
public int DaysToDeleteAfter { get; set; } = 21;
}
2023-02-15 01:38:04 +00:00
}