Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: organized some configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 13, 2023
1 parent f29a52e commit 11af820
Show file tree
Hide file tree
Showing 14 changed files with 488 additions and 278 deletions.
1 change: 0 additions & 1 deletion RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ public enum PluginConfigBool : byte
[Default(false)] UseTinctures,
[Default(false)] UseHealPotions,

[Default(true)] DrawPositional,
[Default(true)] DrawMeleeOffset,

[Default(true)] ShowMoveTarget,
Expand Down
1 change: 0 additions & 1 deletion RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class PluginConfiguration : IPluginConfiguration
public bool AddEnemyListToHostile = true;
public bool UseTinctures = false;
public bool UseHealPotions = false;
public bool DrawPositional = true;
public bool DrawMeleeOffset = true;
public bool ShowMoveTarget = true;
public bool ShowHealthRatio = false;
Expand Down
4 changes: 1 addition & 3 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using RotationSolver.Basic.Configuration;

namespace RotationSolver.Basic.Rotations;
namespace RotationSolver.Basic.Rotations;

public abstract partial class CustomRotation
{
Expand Down
12 changes: 7 additions & 5 deletions RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
///
/// </summary>
public static IBaseAction VariantRaise { get; } = new RoleAction(ActionID.VariantRaise,
new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Friendly | ActionOption.DutyAction);
new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.RangedMagical, JobRole.RangedPhysical, },
ActionOption.Friendly | ActionOption.DutyAction);

/// <summary>
///
Expand All @@ -233,13 +234,14 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
///
/// </summary>
public static IBaseAction VariantCure { get; } = new RoleAction(ActionID.VariantCure,
new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Heal | ActionOption.DutyAction);
new JobRole[] { JobRole.Melee, JobRole.Tank,JobRole.RangedMagical, JobRole.RangedPhysical },
ActionOption.Heal | ActionOption.DutyAction);

/// <summary>
///
/// </summary>
public static IBaseAction VariantCure2 { get; } = new RoleAction(ActionID.VariantCure2,
new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.Ranged }, ActionOption.Heal | ActionOption.DutyAction);
new JobRole[] { JobRole.Melee, JobRole.Tank, JobRole.RangedMagical, JobRole.RangedPhysical }, ActionOption.Heal | ActionOption.DutyAction);

/// <summary>
///
Expand All @@ -263,13 +265,13 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
///
/// </summary>
public static IBaseAction VariantRampart { get; } = new RoleAction(ActionID.VariantRampart,
new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.Ranged }, ActionOption.Buff | ActionOption.DutyAction);
new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.RangedMagical, JobRole.RangedPhysical, }, ActionOption.Buff | ActionOption.DutyAction);

/// <summary>
///
/// </summary>
public static IBaseAction VariantRampart2 { get; } = new RoleAction(ActionID.VariantRampart2,
new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.Ranged }, ActionOption.Buff | ActionOption.DutyAction);
new JobRole[] { JobRole.Melee, JobRole.Healer, JobRole.RangedMagical, JobRole.RangedPhysical }, ActionOption.Buff | ActionOption.DutyAction);
#endregion

IBaseAction[] _allBaseActions;
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Localization/ConfigTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ internal static class ConfigTranslation
PluginConfigBool.TeachingMode => LocalizationManager.RightLang.ConfigWindow_Param_TeachingMode,
PluginConfigBool.ShowMoveTarget => LocalizationManager.RightLang.ConfigWindow_Param_MovingTargetColor,
PluginConfigBool.ShowTarget => LocalizationManager.RightLang.ConfigWindow_Param_ShowTarget,
PluginConfigBool.DrawPositional => LocalizationManager.RightLang.ConfigWindow_Param_DrawPositional,
PluginConfigBool.DrawMeleeOffset => LocalizationManager.RightLang.ConfigWindow_Param_DrawMeleeOffset,
PluginConfigBool.KeyBoardNoise => LocalizationManager.RightLang.ConfigWindow_Param_KeyBoardNoise,
PluginConfigBool.ShowInfoOnDtr => LocalizationManager.RightLang.ConfigWindow_Param_ShowInfoOnDtr,
Expand Down
9 changes: 7 additions & 2 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
"ConfigWindow_Param_SampleLength": "The sample length of the line.",
"ConfigWindow_Param_KeyBoardNoise": "Simulate the effect of pressing",
"ConfigWindow_Param_KeyBoardNoiseTimes": "Effect times",
"ConfigWindow_Param_DrawPositional": "Draw Positional on the screen",
"ConfigWindow_Param_DrawMeleeOffset": "Draw the offset of melee on the screen",
"ConfigWindow_Param_ShowMoveTarget": "Show the target of the move action",
"ConfigWindow_Param_ShowTarget": "Show Target",
Expand Down Expand Up @@ -462,5 +461,11 @@
"ConfigWindow_List_TerritoryEverywhere": "Everywhere",
"ConfigWindow_List_AddTerritory": "Territory name or id",
"ConfigWindow_List_BeneficialLocations": "Beneficial locations",
"ConfigWindow_List_NoHostilesName": "The name of object that you don't want to attack"
"ConfigWindow_List_NoHostilesName": "The name of object that you don't want to attack",
"ConfigWindow_Basic_AutoSwitch": "Auto Switch",
"ConfigWindow_Basic_Timer": "Timer",
"ConfigWindow_UI_Windows": "Windows",
"ConfigWindow_UI_Overlay": "Overlay",
"ConfigWindow_UI_Information": "Information",
"ConfigWindow_Auto_ActionUsage": "Action Usage"
}
9 changes: 8 additions & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ internal partial class Strings
public string ConfigWindow_Param_SampleLength { get; set; } = "The sample length of the line.";
public string ConfigWindow_Param_KeyBoardNoise { get; set; } = "Simulate the effect of pressing";
public string ConfigWindow_Param_KeyBoardNoiseTimes { get; set; } = "Effect times";
public string ConfigWindow_Param_DrawPositional { get; set; } = "Draw Positional on the screen";
public string ConfigWindow_Param_DrawMeleeOffset { get; set; } = "Draw the offset of melee on the screen";
public string ConfigWindow_Param_ShowMoveTarget { get; set; } = "Show the target of the move action";
public string ConfigWindow_Param_ShowTarget { get; set; } = "Show Target";
Expand Down Expand Up @@ -674,4 +673,12 @@ internal partial class Strings
public string ConfigWindow_List_BeneficialLocations { get; set; } = "Beneficial locations";
public string ConfigWindow_List_NoHostilesName { get; set; } = "The name of object that you don't want to attack";

public string ConfigWindow_Basic_AutoSwitch { get; set; } = "Auto Switch";

public string ConfigWindow_Basic_Timer { get; set; } = "Timer";
public string ConfigWindow_UI_Windows { get; set; } = "Windows";
public string ConfigWindow_UI_Overlay { get; set; } = "Overlay";
public string ConfigWindow_UI_Information { get; set; } = "Information";
public string ConfigWindow_Auto_ActionUsage { get; set; } = "Action Usage";

}
120 changes: 57 additions & 63 deletions RotationSolver/UI/RotationConfigWindowNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,17 @@
using ECommons.ExcelServices;
using ECommons.GameHelpers;
using ECommons.ImGuiMethods;
using F23.StringSimilarity;
using ImGuiNET;
using ImGuiScene;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.ActionSequencer;
using RotationSolver.Basic.Configuration;
using RotationSolver.Basic.Data;
using RotationSolver.Data;
using RotationSolver.Helpers;
using RotationSolver.Localization;
using RotationSolver.TextureItems;
using RotationSolver.UI.SearchableConfigs;
using RotationSolver.UI.SearchableSettings;
using RotationSolver.Updaters;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using GAction = Lumina.Excel.GeneratedSheets.Action;

namespace RotationSolver.UI;
Expand Down Expand Up @@ -502,7 +495,7 @@ private static void DrawAboutCompatibility()

var iconSize = 40 * _scale;

if (ImGui.BeginTable("Incompatible plugin", 4, ImGuiTableFlags.Borders
if (ImGui.BeginTable("Incompatible plugin", 4, ImGuiTableFlags.BordersInner
| ImGuiTableFlags.Resizable
| ImGuiTableFlags.SizingStretchProp))
{
Expand Down Expand Up @@ -1046,7 +1039,7 @@ private static void DrawRotationsLoaded()
.GroupBy(r => r.GetType().Assembly);


if (ImGui.BeginTable("Rotation Solver AssemblyTable", 3, ImGuiTableFlags.Borders
if (ImGui.BeginTable("Rotation Solver AssemblyTable", 3, ImGuiTableFlags.BordersInner
| ImGuiTableFlags.Resizable
| ImGuiTableFlags.SizingStretchProp))
{
Expand Down Expand Up @@ -1209,7 +1202,7 @@ private static void DrawRotationsLibraries()
}
#endregion

#region Ids
#region List
private static uint _territoryId = 0;
private static TerritoryType[] _allTerritories = null;
internal static TerritoryType[] AllTerritories
Expand Down Expand Up @@ -1271,15 +1264,15 @@ private static void DrawList()
private static readonly CollapsingHeaderGroup _idsHeader = new(new()
{
{ () => LocalizationManager.RightLang.ConfigWindow_List_Statuses, DrawActionsStatuses},
{ () => LocalizationManager.RightLang.ConfigWindow_List_Actions, DrawListActions},
{ () => Service.ConfigNew.GetValue(PluginConfigBool.UseDefenseAbility) ? LocalizationManager.RightLang.ConfigWindow_List_Actions : string.Empty, DrawListActions},
{ () => LocalizationManager.RightLang.ConfigWindow_List_Territories, DrawListTerritories},
});
private static void DrawActionsStatuses()
{
ImGui.SetNextItemWidth(ImGui.GetWindowWidth() - ImGui.GetStyle().WindowPadding.X * 2);
ImGui.SetNextItemWidth(ImGui.GetWindowWidth());
ImGui.InputTextWithHint("##Searching the action", LocalizationManager.RightLang.ConfigWindow_List_StatusNameOrId, ref _statusSearching, 128);

if (ImGui.BeginTable("Rotation Solver List Statuses", 2, ImGuiTableFlags.Borders | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame))
if (ImGui.BeginTable("Rotation Solver List Statuses", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame))
{
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableNextRow(ImGuiTableRowFlags.Headers);
Expand Down Expand Up @@ -1310,9 +1303,7 @@ private static void DrawStatusList(string name, HashSet<uint> statuses, Status[]

var popupId = "Rotation Solver Popup" + name;

if (BeginChild("Rotation Solver Child" + name))
{
var count = Math.Max(1, (int)MathF.Floor(ImGui.GetWindowWidth() / (24 * _scale + ImGui.GetStyle().ItemSpacing.X)));
var count = Math.Max(1, (int)MathF.Floor(ImGui.GetColumnWidth() / (24 * _scale + ImGui.GetStyle().ItemSpacing.X)));
var index = 0;

if (IconSet.GetTexture(16220, out var text))
Expand Down Expand Up @@ -1403,8 +1394,6 @@ private static void DrawStatusList(string name, HashSet<uint> statuses, Status[]
ImGui.EndPopup();
}

ImGui.EndChild();
}

if (removeId != 0)
{
Expand All @@ -1415,10 +1404,10 @@ private static void DrawStatusList(string name, HashSet<uint> statuses, Status[]

private static void DrawListActions()
{
ImGui.SetNextItemWidth(ImGui.GetWindowWidth() - ImGui.GetStyle().WindowPadding.X * 2);
ImGui.SetNextItemWidth(ImGui.GetWindowWidth());
ImGui.InputTextWithHint("##Searching the action", LocalizationManager.RightLang.ConfigWindow_List_ActionNameOrId, ref _actionSearching, 128);

if (ImGui.BeginTable("Rotation Solver List Actions", 2, ImGuiTableFlags.Borders | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame))
if (ImGui.BeginTable("Rotation Solver List Actions", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame))
{
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableNextRow(ImGuiTableRowFlags.Headers);
Expand Down Expand Up @@ -1455,67 +1444,63 @@ private static void DrawActionsList(string name, HashSet<uint> actions)

ImGui.Spacing();

if (BeginChild("Rotation Solver Child" + name))

foreach (var action in actions.Select(a => Service.GetSheet<GAction>().GetRow(a))
.Where(a => a != null)
.OrderBy(s => Math.Min(StringComparer.Distance(s.Name, _actionSearching)
, StringComparer.Distance(s.RowId.ToString(), _actionSearching))))
{
foreach (var action in actions.Select(a => Service.GetSheet<GAction>().GetRow(a))
.Where(a => a != null)
.OrderBy(s => Math.Min( StringComparer.Distance(s.Name, _actionSearching)
, StringComparer.Distance(s.RowId.ToString(), _actionSearching))))
{
void Reset() => removeId = action.RowId;
void Reset() => removeId = action.RowId;

var key = "Action" + action.RowId;
var key = "Action" + action.RowId;

if (ImGui.BeginPopup(key))
if (ImGui.BeginPopup(key))
{
if (ImGui.BeginTable(key, 2, ImGuiTableFlags.BordersOuter))
{
if (ImGui.BeginTable(key, 2, ImGuiTableFlags.BordersOuter))
{
Searchable.DrawHotKeys(LocalizationManager.RightLang.ConfigWindow_List_Remove, Reset, "Delete");
ImGui.EndTable();
}

ImGui.EndPopup();
Searchable.DrawHotKeys(LocalizationManager.RightLang.ConfigWindow_List_Remove, Reset, "Delete");
ImGui.EndTable();
}

ImGui.Selectable($"{action.Name} ({action.RowId})");
if (ImGui.IsItemHovered())
ImGui.EndPopup();
}

ImGui.Selectable($"{action.Name} ({action.RowId})");
if (ImGui.IsItemHovered())
{
if (ImGui.IsMouseClicked(ImGuiMouseButton.Right) && !ImGui.IsPopupOpen(key))
{
if (ImGui.IsMouseClicked(ImGuiMouseButton.Right) && !ImGui.IsPopupOpen(key))
{
ImGui.OpenPopup(key);
}
Searchable.ExecuteHotKeys(Reset, Dalamud.Game.ClientState.Keys.VirtualKey.DELETE);
ImGui.OpenPopup(key);
}
Searchable.ExecuteHotKeys(Reset, Dalamud.Game.ClientState.Keys.VirtualKey.DELETE);
}
}


if (ImGui.BeginPopup(popupId))
{
ImGui.SetNextItemWidth(200 * _scale);
ImGui.InputTextWithHint("##Searching the action pop up", LocalizationManager.RightLang.ConfigWindow_List_ActionNameOrId, ref _actionSearching, 128);
if (ImGui.BeginPopup(popupId))
{
ImGui.SetNextItemWidth(200 * _scale);
ImGui.InputTextWithHint("##Searching the action pop up", LocalizationManager.RightLang.ConfigWindow_List_ActionNameOrId, ref _actionSearching, 128);

ImGui.Spacing();
ImGui.Spacing();

if (ImGui.BeginChild("Rotation Solver Add action", new Vector2(-1, 400 * _scale)))
if (ImGui.BeginChild("Rotation Solver Add action", new Vector2(-1, 400 * _scale)))
{
foreach (var action in AllActions.OrderBy(s => Math.Min(StringComparer.Distance(s.Name, _actionSearching)
, StringComparer.Distance(s.RowId.ToString(), _actionSearching))))
{
foreach (var action in AllActions.OrderBy(s => Math.Min( StringComparer.Distance(s.Name, _actionSearching)
, StringComparer.Distance(s.RowId.ToString(), _actionSearching))))
ImGui.Selectable($"{action.Name} ({action.RowId})");
{
ImGui.Selectable($"{action.Name} ({action.RowId})");
{
actions.Add(action.RowId);
OtherConfiguration.Save();
ImGui.CloseCurrentPopup();
}
ImguiTooltips.HoveredTooltip($"{action.Name} ({action.RowId})");
actions.Add(action.RowId);
OtherConfiguration.Save();
ImGui.CloseCurrentPopup();
}
ImGui.EndChild();
ImguiTooltips.HoveredTooltip($"{action.Name} ({action.RowId})");
}

ImGui.EndPopup();
ImGui.EndChild();
}

ImGui.EndChild();
ImGui.EndPopup();
}

if (removeId != 0)
Expand Down Expand Up @@ -1576,7 +1561,7 @@ private static void DrawListTerritories()
}
ImGui.PopFont();

if (ImGui.BeginTable("Rotation Solver List Territories", 2, ImGuiTableFlags.Borders | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame))
if (ImGui.BeginTable("Rotation Solver List Territories", 2, ImGuiTableFlags.BordersInner | ImGuiTableFlags.Resizable | ImGuiTableFlags.SizingStretchSame))
{
ImGui.TableSetupScrollFreeze(0, 1);
ImGui.TableNextRow(ImGuiTableRowFlags.Headers);
Expand Down Expand Up @@ -1640,9 +1625,18 @@ private static void DrawListTerritories()
{

});
private static readonly ISearchable[] _debugSearchable = new ISearchable[]
{
new CheckBoxSearchPlugin(PluginConfigBool.InDebug),
};
private static void DrawDebug()
{
ImGui.Text("Debug");

foreach (var searchable in _debugSearchable)
{
searchable?.Draw(Job);
}
_debugHeader?.Draw();
}

Expand Down
Loading

0 comments on commit 11af820

Please sign in to comment.