1.9.0.0 (Testing) Release

This commit is contained in:
Asriel Camora
2023-10-17 03:36:31 -07:00
parent 398c7f0500
commit 234eb3a7ab
37 changed files with 3692 additions and 1314 deletions
+81 -9
View File
@@ -1,7 +1,7 @@
using Craftimizer.Simulator;
using Craftimizer.Simulator.Actions;
using Craftimizer.Solver;
using Dalamud.Configuration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -10,8 +10,64 @@ namespace Craftimizer.Plugin;
[Serializable]
public class Macro
{
public static event Action<Macro>? OnMacroChanged;
public string Name { get; set; } = string.Empty;
public List<ActionType> Actions { get; set; } = new();
[JsonProperty(PropertyName = "Actions")]
private List<ActionType> actions { get; set; } = new();
[JsonIgnore]
public IReadOnlyList<ActionType> Actions
{
get => actions;
set => ActionEnumerable = value;
}
[JsonIgnore]
public IEnumerable<ActionType> ActionEnumerable
{
set
{
actions = new(value);
OnMacroChanged?.Invoke(this);
}
}
}
[Serializable]
public class MacroCopyConfiguration
{
public enum CopyType
{
OpenWindow, // useful for big macros
CopyToMacro, // (add option for down or right) (max macro count; open copy-paste window if too much)
CopyToClipboard,
}
public CopyType Type { get; set; } = CopyType.OpenWindow;
// CopyToMacro
public bool CopyDown { get; set; }
public bool SharedMacro { get; set; }
public int StartMacroIdx { get; set; } = 1;
public int MaxMacroCount { get; set; } = 5;
// Add /nextmacro [down]
public bool UseNextMacro { get; set; }
// Add /mlock
public bool UseMacroLock { get; set; }
public bool AddNotification { get; set; } = true;
// Requires AddNotification
public bool AddNotificationSound { get; set; } = true;
public int IntermediateNotificationSound { get; set; } = 10;
public int EndNotificationSound { get; set; } = 6;
// For SND
public bool RemoveWaitTimes { get; set; }
// For SND; Cannot use CopyToMacro
public bool CombineMacro { get; set; }
}
[Serializable]
@@ -19,9 +75,12 @@ public class Configuration : IPluginConfiguration
{
public int Version { get; set; } = 1;
public bool OverrideUncraftability { get; set; } = true;
public bool HideUnlearnedActions { get; set; } = true;
public List<Macro> Macros { get; set; } = new();
public static event Action? OnMacroListChanged;
[JsonProperty(PropertyName = "Macros")]
private List<Macro> macros { get; set; } = new();
[JsonIgnore]
public IReadOnlyList<Macro> Macros => macros;
public bool ConditionRandomness { get; set; } = true;
public SolverConfig SimulatorSolverConfig { get; set; } = SolverConfig.SimulatorDefault;
public SolverConfig SynthHelperSolverConfig { get; set; } = SolverConfig.SynthHelperDefault;
@@ -29,10 +88,23 @@ public class Configuration : IPluginConfiguration
public bool ShowOptimalMacroStat { get; set; } = true;
public int SynthHelperStepCount { get; set; } = 5;
public Simulator.Simulator CreateSimulator(SimulationState state) =>
ConditionRandomness ?
new Simulator.Simulator(state) :
new SimulatorNoRandom(state);
public MacroCopyConfiguration MacroCopy { get; set; } = new();
public void AddMacro(Macro macro)
{
macros.Add(macro);
Save();
OnMacroListChanged?.Invoke();
}
public void RemoveMacro(Macro macro)
{
if (macros.Remove(macro))
{
Save();
OnMacroListChanged?.Invoke();
}
}
public void Save() =>
Service.PluginInterface.SavePluginConfig(this);