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

Commit

Permalink
Merge pull request #506 from ArchiDog1998/main
Browse files Browse the repository at this point in the history
Release please.
  • Loading branch information
ArchiDog1998 authored Nov 7, 2023
2 parents c1dd560 + 2b2f966 commit ba17d70
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 106 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net7.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Authors>ArchiTed</Authors>
<Version>3.4.13</Version>
<Version>3.4.14</Version>
<PlatformTarget>x64</PlatformTarget>
<Platforms>AnyCPU</Platforms>

Expand Down
4 changes: 1 addition & 3 deletions Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"ClickingCount": 56909,
"SayingHelloCount": 0,
"SaidUsers": [
"Ig4lHXUohMZNIeheUtAtRg=="
]
"SaidUsers": []
}
14 changes: 14 additions & 0 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ public float TimeToKill
/// </summary>
public BattleChara Target { get; private set; } = Player.Object;

/// <summary>
/// Is this action's target dead?
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Please use Target.IsDying() instead.", true)]
public bool IsTargetDying => Target?.IsDying() ?? false;

/// <summary>
/// Is this action's target is a boss?
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Please use Target.IsBossFromTTK() or Target.IsBossFromIcon instead.", true)]
public bool IsTargetBoss => Target?.IsBossFromTTK() ?? false;

/// <inheritdoc/>
public BattleChara[] AffectedTargets { get; private set; } = Array.Empty<BattleChara>();

Expand Down
14 changes: 14 additions & 0 deletions RotationSolver.Basic/Actions/IBaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ public interface IBaseAction : IAction
/// </summary>
bool IsSingleTarget { get; }

/// <summary>
/// Is target will die immediately.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Please use Target.IsDying() instead.", true)]
bool IsTargetDying { get; }

/// <summary>
/// Is target a boss.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Please use Target.IsBossFromTTK() or Target.IsBossFromIcon instead.", true)]
bool IsTargetBoss { get; }

/// <summary>
/// How many targets are needed to use this action.
/// </summary>
Expand Down
48 changes: 12 additions & 36 deletions RotationSolver.Basic/Data/StatusID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ public enum StatusID : ushort
///
/// </summary>
Bind1 = 13,
/// <summary>
///
/// </summary>
Bind2 = 1345,

/// <summary>
///
Expand Down Expand Up @@ -987,11 +983,6 @@ public enum StatusID : ushort
/// </summary>
Stun = 2,

/// <summary>
///
/// </summary>
Stun2 = 1343,

/// <summary>
///
/// </summary>
Expand All @@ -1002,11 +993,6 @@ public enum StatusID : ushort
/// </summary>
Sleep2 = 926,

/// <summary>
///
/// </summary>
Sleep3 = 1348,

/// <summary>
///
/// </summary>
Expand All @@ -1022,11 +1008,6 @@ public enum StatusID : ushort
/// </summary>
Silence = 7,

/// <summary>
///
/// </summary>
Silence2 = 1347,

/// <summary>
///
/// </summary>
Expand All @@ -1047,11 +1028,6 @@ public enum StatusID : ushort
/// </summary>
Slow4 = 561,

/// <summary>
///
/// </summary>
Slow5 = 1346,

/// <summary>
///
/// </summary>
Expand All @@ -1062,11 +1038,6 @@ public enum StatusID : ushort
/// </summary>
Blind2 = 564,

/// <summary>
///
/// </summary>
Blind3 = Blind2,

/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -1865,10 +1836,15 @@ public enum StatusID : ushort
/// </summary>
PvP_Hidden = 1316,

/// <summary>
///
/// </summary>
PvP_Bunshin = 2010,
/// <summary>
///
/// </summary>
PvP_FleetingRaijuReady = 3211,

/// <summary>
///
/// </summary>
PvP_Bunshin = 2010,

/// <summary>
///
Expand Down Expand Up @@ -2176,7 +2152,7 @@ public enum StatusID : ushort
/// </summary>
PvP_Cure3Ready = 3083,

#endregion WHM_PvP

#endregion WHM_PvP

#endregion
}
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/Basic/MCH_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ protected static bool OverheatedEndAfterGCD(uint gctCount = 0, float offset = 0)
/// </summary>
public static IBaseAction PvP_HeatBlast { get; } = new BaseAction(ActionID.PvP_HeatBlast)
{
StatusNeed = new StatusID[] { StatusID.PvP_Overheat },
StatusNeed = new StatusID[] { StatusID.PvP_Overheated },
};

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/Basic/RPR_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public abstract class RPR_Base : CustomRotation
public static IBaseAction HellsIngress { get; } = new BaseAction(ActionID.HellsIngress)
{
StatusProvide = new[] { StatusID.EnhancedHarpe },
ActionCheck = (b, m) => !Player.HasStatus(true, StatusID.Bind1, StatusID.Bind2)
ActionCheck = (b, m) => !Player.HasStatus(true, StatusID.Bind1)
};

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/Basic/SAM_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public static bool IsMoonTimeLessThanFlower
/// </summary>
public static IBaseAction HissatsuGyoten { get; } = new BaseAction(ActionID.HissatsuGyoten)
{
ActionCheck = (b, m) => Kenki >= 10 && !Player.HasStatus(true, StatusID.Bind1, StatusID.Bind2),
ActionCheck = (b, m) => Kenki >= 10 && !Player.HasStatus(true, StatusID.Bind1),
ChoiceTarget = TargetFilter.FindTargetForMoving,
};

Expand Down
15 changes: 9 additions & 6 deletions RotationSolver/UI/ConditionDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using RotationSolver.Basic.Configuration.Conditions;
using RotationSolver.Localization;
using RotationSolver.Updaters;
using System.Reflection.Emit;
using Action = System.Action;

namespace RotationSolver.UI;
Expand Down Expand Up @@ -102,9 +101,11 @@ public static void DrawByteEnum<T>(string name, ref T value, Func<T, string> fun
public static bool DrawDragFloat(ConfigUnitType type, string name, ref float value)
{
ImGui.SameLine();
ImGui.SetNextItemWidth(Math.Max(50 * ImGuiHelpers.GlobalScale, ImGui.CalcTextSize(value.ToString()).X));
var result = ImGui.DragFloat(name, ref value);
type.Draw();
var show = type == ConfigUnitType.Percent ? $"{value:F1}{type.ToSymbol()}" : $"{value:F2}{type.ToSymbol()}";

ImGui.SetNextItemWidth(Math.Max(50 * ImGuiHelpers.GlobalScale, ImGui.CalcTextSize(show).X));
var result = ImGui.DragFloat(name, ref value, 0.1f, 0, 0, show);
ImguiTooltips.HoveredTooltip(type.ToDesc());
return result;
}

Expand Down Expand Up @@ -248,12 +249,14 @@ private static void DrawDelay(this DelayCondition condition)
const float MIN = 0, MAX = 60;

ImGui.SetNextItemWidth(80 * ImGuiHelpers.GlobalScale);
if (ImGui.DragFloatRange2($"##Random Delay {condition.GetHashCode()}", ref condition.DelayMin, ref condition.DelayMax, 0.1f, MIN, MAX))
if (ImGui.DragFloatRange2($"##Random Delay {condition.GetHashCode()}", ref condition.DelayMin, ref condition.DelayMax, 0.1f, MIN, MAX,
$"{condition.DelayMin:F1}{ConfigUnitType.Seconds.ToSymbol()}", $"{condition.DelayMax:F1}{ConfigUnitType.Seconds.ToSymbol()}"))
{
condition.DelayMin = Math.Max(Math.Min(condition.DelayMin, condition.DelayMax), MIN);
condition.DelayMax = Math.Min(Math.Max(condition.DelayMin, condition.DelayMax), MAX);
}
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Delay_Description);
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ActionSequencer_Delay_Description +
"\n" + ConfigUnitType.Seconds.ToDesc());
}

private static void DrawBefore(this ICondition condition)
Expand Down
46 changes: 19 additions & 27 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,32 +417,24 @@ public static bool IsInRect(Vector2 leftTop, Vector2 size)
return true;
}

public static void Draw(this ConfigUnitType unit)
{
if (unit == ConfigUnitType.None) return;

var unitName = unit switch
{
ConfigUnitType.Seconds => "(s)",
ConfigUnitType.Degree => "(°)",
ConfigUnitType.Pixels => "(p)",
ConfigUnitType.Yalms => "(y)",
ConfigUnitType.Percent => "(%%)",
_ => string.Empty,
};

ImGui.SameLine();
ImGui.TextColored(ImGuiColors.DalamudViolet, unitName);

var desc = unit switch
{
ConfigUnitType.Seconds => LocalizationManager.RightLang.ConfigUnitType_Seconds,
ConfigUnitType.Degree => LocalizationManager.RightLang.ConfigUnitType_Degree,
ConfigUnitType.Pixels => LocalizationManager.RightLang.ConfigUnitType_Pixels,
ConfigUnitType.Yalms => LocalizationManager.RightLang.ConfigUnitType_Yalms,
ConfigUnitType.Percent => LocalizationManager.RightLang.ConfigUnitType_Ratio,
_ => string.Empty,
};
ImguiTooltips.HoveredTooltip(desc);
}
public static string ToSymbol(this ConfigUnitType unit) => unit switch
{
ConfigUnitType.Seconds => " s",
ConfigUnitType.Degree => " °",
ConfigUnitType.Pixels => " p",
ConfigUnitType.Yalms => " y",
ConfigUnitType.Percent => " %%",
_ => string.Empty,
};

public static string ToDesc(this ConfigUnitType unit) => unit switch
{
ConfigUnitType.Seconds => LocalizationManager.RightLang.ConfigUnitType_Seconds,
ConfigUnitType.Degree => LocalizationManager.RightLang.ConfigUnitType_Degree,
ConfigUnitType.Pixels => LocalizationManager.RightLang.ConfigUnitType_Pixels,
ConfigUnitType.Yalms => LocalizationManager.RightLang.ConfigUnitType_Yalms,
ConfigUnitType.Percent => LocalizationManager.RightLang.ConfigUnitType_Ratio,
_ => string.Empty,
};
}
8 changes: 4 additions & 4 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,21 +1166,21 @@ private static void DrawRotationConfiguration()
ImGui.SetNextItemWidth(Scale * Searchable.DRAG_WIDTH);
if (f.UnitType == ConfigUnitType.Percent)
{
var v = (int)val * 100;
if (ImGui.SliderInt(name, ref v, (int)(f.Min * 100), (int)(f.Max * 100)))
var v = val * 100;
if (ImGui.SliderFloat(name, ref v,f.Min * 100,f.Max * 100, $"{v:F1}{f.UnitType.ToSymbol()}"))
{
set.SetValue(config.Name, (v / 100f).ToString());
}
}
else
{
if (ImGui.DragFloat(name, ref val, f.Speed, f.Min, f.Max))
if (ImGui.DragFloat(name, ref val, f.Speed, f.Min, f.Max, $"{val:F2}{f.UnitType.ToSymbol()}"))
{
set.SetValue(config.Name, val.ToString());
}
}
ImguiTooltips.HoveredTooltip(f.UnitType.ToDesc());

f.UnitType.Draw();
ImGuiHelper.ReactPopup(key, command, Reset);
}
else if (config is RotationConfigString s)
Expand Down
Loading

0 comments on commit ba17d70

Please sign in to comment.