Skip to content

Commit

Permalink
Merge pull request #171 from spaceelysian/main
Browse files Browse the repository at this point in the history
Removing wrong action code.
  • Loading branch information
NostraThomas99 authored Jun 13, 2024
2 parents b0d1238 + 989a094 commit 53e0ec6
Show file tree
Hide file tree
Showing 13 changed files with 3 additions and 76 deletions.
5 changes: 0 additions & 5 deletions RotationSolver.Basic/Actions/ActionConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,4 @@ public bool IsEnabled
/// Is this action in the cd window.
/// </summary>
public bool IsInCooldown { get; set; } = true;

/// <summary>
/// Is this action should be a mistake action.
/// </summary>
public bool IsInMistake { get; set; }
}
5 changes: 0 additions & 5 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,6 @@ public const string
[Range(0, 1, ConfigUnitType.Percent, 0.002f)]
public float TargetIconSize { get; set; } = 0.3f;

[UI("How likely is it that RSR will click the wrong action. (To be removed)",
Filter = BasicParams)]
[Range(0, 1, ConfigUnitType.Percent, 0.002f)]
public float MistakeRatio { get; set; } = 0;

[UI("Heal tank first if their HP is lower than this.",
Filter = HealingActionCondition, Section = 1,
PvEFilter = JobFilterType.Healer, PvPFilter = JobFilterType.Healer)]
Expand Down
10 changes: 1 addition & 9 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,9 @@ public static void DoAction()
return;
}

var wrong = new Random().NextDouble() < Service.Config.MistakeRatio && ActionUpdater.WrongAction != null;
var nextAction = wrong ? ActionUpdater.WrongAction : ActionUpdater.NextAction;
var nextAction = ActionUpdater.NextAction;
if (nextAction == null) return;

if (wrong)
{
Svc.Toasts.ShowError(string.Format(UiString.ClickingMistakeMessage.Local(), nextAction));
ControlWindow.Wrong = nextAction;
ControlWindow.DidTime = DateTime.Now;
}

#if DEBUG
//if (nextAction is BaseAction acti)
// Svc.Log.Debug($"Will Do {acti}");
Expand Down
6 changes: 0 additions & 6 deletions RotationSolver/Data/UiString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ internal enum UiString
[Description("Show on CD window")]
ConfigWindow_Actions_ShowOnCDWindow,

[Description("Can be used by mistake")]
ConfigWindow_Actions_IsInMistake,

[Description("TTK that this action needs the target be before it is used.")]
ConfigWindow_Actions_TTK,

Expand Down Expand Up @@ -312,9 +309,6 @@ internal enum UiString
[Description("Actions")]
ConfigWindow_Timeline_Actions,

[Description("OOOps! RSR clicked the wrong action ({0})!")]
ClickingMistakeMessage,

[Description("Ability")]
ActionAbility,

Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
"ShowNextActionWindowName": "Show Next Action Window",
"ShowCooldownWindowName": "Show Cooldown Window",
"UseAdditionalConditionsName": "Use additional conditions",
"MistakeRatioName": "How likely is it that RS will click the wrong action.",
"NotInCombatDelayName": "The range of random delay for Not In Combat.",
"UseWorkTaskName": "Use work task for acceleration.",
"ToggleManualName": "Make /rotation Manual as a toggle command.",
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Localization/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
"ShowNextActionWindowName": "Show Next Action Window",
"ShowCooldownWindowName": "Show Cooldown Window",
"UseAdditionalConditionsName": "Use additional conditions",
"MistakeRatioName": "How likely is it that RS will click the wrong action.",
"NotInCombatDelayName": "The range of random delay for Not In Combat.",
"UseWorkTaskName": "Use work task for acceleration.",
"ToggleManualName": "Make /rotation Manual as a toggle command.",
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Localization/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
"ShowNextActionWindowName": "Show Next Action Window",
"ShowCooldownWindowName": "Show Cooldown Window",
"UseAdditionalConditionsName": "Use additional conditions",
"MistakeRatioName": "How likely is it that RS will click the wrong action.",
"NotInCombatDelayName": "The range of random delay for Not In Combat.",
"UseWorkTaskName": "Use work task for acceleration.",
"ToggleManualName": "Make /rotation Manual as a toggle command.",
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Localization/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
"ShowNextActionWindowName": "Show Next Action Window",
"ShowCooldownWindowName": "Show Cooldown Window",
"UseAdditionalConditionsName": "Use additional conditions",
"MistakeRatioName": "How likely is it that RS will click the wrong action.",
"NotInCombatDelayName": "The range of random delay for Not In Combat.",
"UseWorkTaskName": "Use work task for acceleration.",
"ToggleManualName": "Make /rotation Manual as a toggle command.",
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Localization/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
"ShowNextActionWindowName": "Show Next Action Window",
"ShowCooldownWindowName": "Show Cooldown Window",
"UseAdditionalConditionsName": "Use additional conditions",
"MistakeRatioName": "How likely is it that RS will click the wrong action.",
"NotInCombatDelayName": "The range of random delay for Not In Combat.",
"UseWorkTaskName": "Use work task for acceleration.",
"ToggleManualName": "Make /rotation Manual as a toggle command.",
Expand Down
1 change: 0 additions & 1 deletion RotationSolver/Localization/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
"ShowNextActionWindowName": "显示下一个动作窗口",
"ShowCooldownWindowName": "显示冷却窗口",
"UseAdditionalConditionsName": "使用附加条件",
"MistakeRatioName": "有多大的可能性RS会点击错误的技能。",
"NotInCombatDelayName": "设置脱战的随机延迟范围。",
"UseWorkTaskName": "使用WorkTask来加速。",
"ToggleManualName": "将/rotation Manual作为切换命令。",
Expand Down
11 changes: 0 additions & 11 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace RotationSolver.UI;

internal class ControlWindow : CtrlWindow
{
public static IAction? Wrong { get; set; }
public static DateTime DidTime { get; set; }

public ControlWindow()
Expand Down Expand Up @@ -187,16 +186,6 @@ private static void DrawSpecials()
ImGui.Text("Auto: " + DataCenter.AutoStatus.ToString());
}
}

if (Service.Config.MistakeRatio > 0)
{
ImGui.SameLine();
ImGui.TextColored(ImGuiColors.DPSRed, " | Mistake | \n | Mistake | ");
ImGui.SameLine();

DrawIAction(DateTime.Now - DidTime < TimeSpan.FromSeconds(5) ? Wrong : null,
Service.Config.ControlWindowGCDSize, 1);
}
}

static void DrawCommandAction(IAction? gcd, IAction? ability, SpecialCommandType command, Vector4 color)
Expand Down
11 changes: 0 additions & 11 deletions RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1436,17 +1436,6 @@ static void DrawConfigsOfBaseAction(IBaseAction a)
{
var config = a.Config;

if (Service.Config.MistakeRatio > 0
&& !a.Setting.IsFriendly
&& a.Setting.TargetType != TargetType.Move)
{
var enable = config.IsInMistake;
if (ImGui.Checkbox($"{UiString.ConfigWindow_Actions_IsInMistake.Local()}##{a.Name}InMistake", ref enable))
{
config.IsInMistake = enable;
}
}

ImGui.Separator();

var ttk = config.TimeToKill;
Expand Down
25 changes: 2 additions & 23 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,10 @@ private static void UpdateOmen(IBaseAction? value)
}
}

internal static IAction? WrongAction { get; set; }
static readonly Random _wrongRandom = new();

internal static void ClearNextAction()
{
SetAction(0);
WrongAction = NextAction = NextGCDAction = null;
NextAction = NextGCDAction = null;
}

internal static void UpdateNextAction()
Expand All @@ -93,24 +90,6 @@ internal static void UpdateNextAction()
if (localPlayer != null && customRotation != null
&& customRotation.TryInvoke(out var newAction, out var gcdAction))
{
if (Service.Config.MistakeRatio > 0)
{
var actions = customRotation.AllActions.Where(a =>
{
if (a.ID == newAction?.ID) return false;
if (a is IBaseAction action)
{
return !action.Setting.IsFriendly && action.Config.IsInMistake
&& action.Setting.TargetType != TargetType.Move
&& action.CanUse(out _, usedUp: true, skipStatusProvideCheck: true, skipClippingCheck: true, skipAoeCheck: true);
}
return false;
});

var count = actions.Count();
WrongAction = count > 0 ? actions.ElementAt(_wrongRandom.Next(count)) : null;
}

NextAction = newAction;

if (gcdAction is IBaseAction GcdAction)
Expand All @@ -126,7 +105,7 @@ internal static void UpdateNextAction()
Svc.Log.Error(ex, "Failed to update next action.");
}

WrongAction = NextAction = NextGCDAction = null;
NextAction = NextGCDAction = null;
}

private static List<uint> actionOverrideList;
Expand Down

0 comments on commit 53e0ec6

Please sign in to comment.