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

Commit

Permalink
fix: config bool respond changing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 15, 2023
1 parent 21023ba commit aeac629
Show file tree
Hide file tree
Showing 9 changed files with 648 additions and 630 deletions.
1,218 changes: 609 additions & 609 deletions Resources/AnimationLockTime.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ [Serializable] public class GlobalConfig
{ PluginConfigVector4.InfoWindowBg, new (0, 0, 0, 0.4f)},
});

public SortedSet<string> DisabledCombos { get; private set; } = new ();
public SortedSet<Job> DisabledJobs { get; private set; } = new ();
public SortedSet<uint> DisabledActions { get; private set; } = new ();
public SortedSet<uint> NotInCoolDownActions { get; private set; } = new ();
public SortedSet<uint> DisabledItems { get; private set; } = new ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ public RotationConfigBoolean(string name, bool value, string displayName) : base
public override bool DoCommand(IRotationConfigSet set, string str)
{
if (!base.DoCommand(set, str)) return false;
set.SetValue(Name, (!set.GetBool(Name)).ToString());

string numStr = str[Name.Length..].Trim();

if (bool.TryParse(numStr, out _))
{
set.SetValue(Name, numStr.ToString());
}
else
{
set.SetValue(Name, (!set.GetBool(Name)).ToString());
}
return true;
}
}
7 changes: 4 additions & 3 deletions RotationSolver.Basic/Rotations/CustomRotation_BasicInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using ECommons.ExcelServices;
using Lumina.Excel.GeneratedSheets;
using System.Linq;

namespace RotationSolver.Basic.Rotations;

Expand All @@ -23,16 +24,16 @@ public abstract partial class CustomRotation : ICustomRotation

public bool IsEnabled
{
get => !Service.Config.GlobalConfig.DisabledCombos.Contains(Name);
get => !Service.Config.GlobalConfig.DisabledJobs.Contains(Jobs.FirstOrDefault());
set
{
if (value)
{
Service.Config.GlobalConfig.DisabledCombos.Remove(Name);
Service.Config.GlobalConfig.DisabledJobs.Remove(Jobs.FirstOrDefault());
}
else
{
Service.Config.GlobalConfig.DisabledCombos.Add(Name);
Service.Config.GlobalConfig.DisabledJobs.Add(Jobs.FirstOrDefault());
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions RotationSolver/ActionSequencer/ActionCondition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ public bool IsTrue(ICustomRotation combo)
return Condition ? !result : result;
}



[JsonIgnore]
public float Height => ICondition.DefaultHeight;

string searchTxt = string.Empty;

public void Draw(ICustomRotation combo)
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/ActionSequencer/ConditionSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void Draw(ICustomRotation combo)
IsAnd = isAnd != 0;
}

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

var relay = Conditions;
if (ImGuiHelper.DrawEditorList(relay, i => i.Draw(combo)))
Expand All @@ -42,7 +42,7 @@ public void Draw(ICustomRotation combo)

ImGui.EndGroup();

ControlWindow.HighLight(ImGui.GetWindowPos() + start, ImGui.GetItemRectSize());
//ControlWindow.HighLight(ImGui.GetWindowPos() + start, ImGui.GetItemRectSize(), 0.5f);
}

private void AddButton()
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ public static AssemblyInfo GetInfo(this Assembly assembly)
return assemblyInfo;
}

public static Vector4 GetColor(this ICustomRotation rotation)
public static unsafe Vector4 GetColor(this ICustomRotation rotation)
{
if (!rotation.IsEnabled)
{
return *ImGui.GetStyleColorVec4(ImGuiCol.TextDisabled);
}

if (!rotation.IsValid)
{
return ImGuiColors.DPSRed;
Expand Down
9 changes: 5 additions & 4 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"ConfigWindow_Param_AddDotGCDCount": "Set GCD advance of DOT refresh",
"ConfigWindow_Param_MaxPing": "Set the Max Ping that RS can get.",
"ConfigWindow_Param_AutoOffAfterCombat": "Auto turn off when combat is over more than several seconds.",
"ConfigWindow_Param_AutoOffAfterCombatTime": "seconds.",
"ConfigWindow_Param_AutoOffBetweenArea": "Auto turn off when player is between area.",
"ConfigWindow_Param_AutoOffCutScene": "Auto turn off during cut scene.",
"ConfigWindow_Param_AutoOffWhenDead": "Auto turn off when dead.",
Expand All @@ -58,7 +59,7 @@
"ConfigWindow_Param_InterruptDelay": "Set the range of random delay for interrupting hostile targets in second.",
"ConfigWindow_Param_WeakenDelay": "Set the range of random delay for esuna weakens in second.",
"ConfigWindow_Param_HealDelay": "Set the range of random delay for healing people in second.",
"ConfigWindow_Param_CountdownDelay": "Set the range of random delay for count down in the party.",
"ConfigWindow_Param_CountdownDelay": "Set the random delay between which auto mode activation on countdown varies.",
"ConfigWindow_Param_NotInCombatDelay": "Set the range of random delay for Not In Combat in second.",
"ConfigWindow_Param_ClickingDelay": "Set the range of random delay for the interval of clicking actions.",
"ConfigWindow_Param_StopCastingDelay": "Set the range of random delay for stopping casting when target is no need to cast in second.",
Expand Down Expand Up @@ -111,7 +112,7 @@
"ConfigWindow_Param_LessMPNoRaise": "Never raise player if MP is less than the set value",
"ConfigWindow_Param_UseTinctures": "Use Tinctures",
"ConfigWindow_Param_UseHealPotions": "Use Heal Potions",
"ConfigWindow_Param_StartOnCountdown": "Auto turn smart on countdown",
"ConfigWindow_Param_StartOnCountdown": "Auto mode activation delay on countdown start",
"ConfigWindow_Param_StartOnAttackedBySomeone": "Automatically turn on manual mode and target enemy when being attacked",
"ConfigWindow_Param_EsunaAll": "Esuna All Statuses.",
"ConfigWindow_Param_InterruptibleMoreCheck": "Interrupt the action with action type check.",
Expand All @@ -127,8 +128,8 @@
"ConfigWindow_Param_HealthSingleSpell": "HP%% for ST healing GCDs",
"ConfigWindow_Param_HealthHealerRatio": "Heal healer first if its HP%% is lower than this.",
"ConfigWindow_Param_HealthTankRatio": "Heal tank first if its HP%% is lower than this.",
"ConfigWindow_Param_DistanceForMoving": "If the distance between Melee or Tank to target is less than this, using moving ability as attack ability.",
"ConfigWindow_Param_HealWhenNothingTodoBelow": "Healing the members with GCD if there is nothing to do in combat and their min HP% is lower than this.",
"ConfigWindow_Param_DistanceForMoving": "Use gapcloser as a damage ability if the distance to your target is less then this.",
"ConfigWindow_Param_HealWhenNothingTodoBelow": "Healing the members with GCD if there is nothing to do in combat and their min HP%% is lower than this.",
"ConfigWindow_Param_HealthForDyingTank": "Set the HP%% for tank to use invincibility",
"ConfigWindow_Param_MeleeRangeOffset": "Melee Range action using offset",
"ConfigWindow_Param_RightNowTargetToHostileType": "Engage settings",
Expand Down
14 changes: 10 additions & 4 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,9 @@ private static bool GetLocalImage(string name, out TextureWrap texture)
var url = $"RotationSolver.Logos.{name}.png";
if (_textureWrapList.TryGetValue(name, out texture)) return true;


using var stream = typeof(RotationConfigWindow).Assembly.GetManifestResourceStream(url);
if (stream == null) return false;


using var memory = new MemoryStream();
stream.CopyTo(memory);
texture = Svc.PluginInterface.UiBuilder.LoadImage(memory.ToArray());
Expand Down Expand Up @@ -768,6 +766,9 @@ private static void DrawRotationConfiguration()
if (!enable) return;

var set = rotation.Configs;

if(set.Any()) ImGui.Separator();

foreach (var config in set.Configs)
{
var key = config.Name;
Expand Down Expand Up @@ -1001,9 +1002,8 @@ private static unsafe void DrawActions()
}
}

ActionSequencerUpdater.DrawHeader(30 * _scale);

if (_sequencerList != null && _activeAction != null)
if (_activeAction != null)
{
var enable = _activeAction.IsEnabled;
if (ImGui.Checkbox($"{_activeAction.Name}##{_activeAction.Name} Enabled", ref enable))
Expand All @@ -1022,6 +1022,12 @@ private static unsafe void DrawActions()
_activeAction.IsInCooldown = enable;
}

ImGui.Separator();
}

ActionSequencerUpdater.DrawHeader(30 * _scale);
if (_sequencerList != null)
{
_sequencerList.Draw();
}

Expand Down

0 comments on commit aeac629

Please sign in to comment.