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

Commit

Permalink
fix: add an option to click simulation intense!
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 2, 2023
1 parent ce74808 commit faef1be
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 29 deletions.
6 changes: 5 additions & 1 deletion RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ public class PluginConfiguration : IPluginConfiguration
public Vector3 MovingTargetColor = new(0f, 1f, 0.8f);
public Vector3 TargetColor = new(1f, 0.2f, 0f);
public Vector3 SubTargetColor = new(1f, 0.9f, 0f);
public bool KeyBoardNoise = false;
public bool KeyBoardNoise = true;
public int KeyBoardNoiseMin = 2;
public int KeyBoardNoiseMax = 3;
public float KeyBoardNoiseTimeMin = 0.1f;
public float KeyBoardNoiseTimeMax = 0.2f;
public bool UseGroundBeneficialAbility = true;
public bool MoveAreaActionFarthest = true;
public bool StartOnCountdown = true;
Expand Down
23 changes: 22 additions & 1 deletion RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.Conditions;
using Lumina.Excel.GeneratedSheets;
using RotationSolver.Actions.BaseAction;
using RotationSolver.Basic;
using RotationSolver.Basic.Data;
Expand Down Expand Up @@ -47,7 +48,7 @@ internal static unsafe void DoAnAction(bool isGCD)
if (nextAction.Use())
{
if (nextAction is BaseAction a && a.ShouldEndSpecial) ResetSpecial();
if (Service.Config.KeyBoardNoise) PreviewUpdater.PulseActionBar(nextAction.AdjustedID);
if (Service.Config.KeyBoardNoise) Task.Run(() => PulseSimulation(nextAction.AdjustedID));
if (nextAction is BaseAction act)
{
#if DEBUG
Expand All @@ -64,6 +65,26 @@ internal static unsafe void DoAnAction(bool isGCD)
return;
}

static bool started = false;
static async void PulseSimulation(uint id)
{
if (started) return;
started = true;
try
{
for (int i = 0; i < new Random().Next(Service.Config.KeyBoardNoiseMin,
Service.Config.KeyBoardNoiseMax); i++)
{
PreviewUpdater.PulseActionBar(id);
var time = Service.Config.KeyBoardNoiseTimeMin +
new Random().NextDouble() * (Service.Config.KeyBoardNoiseTimeMax - Service.Config.KeyBoardNoiseTimeMin);
await Task.Delay((int)(time * 1000));
}
}
finally { started = false; }
started = false;
}

internal static void ResetSpecial() => DoSpecialCommandType(SpecialCommandType.EndSpecial, false);
private static void CancelState()
{
Expand Down
4 changes: 3 additions & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ internal partial class Strings
public string ConfigWindow_Param_HealDelay { get; set; } = "Set the range of random delay for healing people in second.";

public string ConfigWindow_Param_NotInCombatDelay { get; set; } = "Set the range of random delay for Not In Combat in second.";
public string ConfigWindow_Param_StopCastingDelay { get; set; } = "Set the range of random delay for stoping casting when target is no need to cast in second.";
public string ConfigWindow_Param_StopCastingDelay { get; set; } = "Set the range of random delay for stopping casting when target is no need to cast in second.";
public string ConfigWindow_Param_Display { get; set; } = "Display";
public string ConfigWindow_Param_Advanced { get; set; } = "Advanced";
public string ConfigWindow_Param_PoslockCasting { get; set; } = "Lock the movement when casting.";
Expand All @@ -144,6 +144,8 @@ internal partial class Strings
public string ConfigWindow_Param_TargetColor { get; set; } = "Target color";
public string ConfigWindow_Param_SubTargetColor { get; set; } = "Sub-target color";
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_KeyBoardNoiseTime { get; set; } = "Effect interval";
public string ConfigWindow_Param_VoiceVolume { get; set; } = "Voice volume";
public string ConfigWindow_Param_VoiceName { get; set; } = "Voice Name";
public string ConfigWindow_Param_FlytextPositional { get; set; } = "Hint positional anticipation by flytext";
Expand Down
54 changes: 28 additions & 26 deletions RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@ private void DrawParamDisplay()
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_KeyBoardNoise,
ref Service.Config.KeyBoardNoise);

if (Service.Config.KeyBoardNoise)
{
ImGui.Indent();

DrawRangedInt(LocalizationManager.RightLang.ConfigWindow_Param_KeyBoardNoiseTimes,
ref Service.Config.KeyBoardNoiseMin, ref Service.Config.KeyBoardNoiseMax);

DrawRangedFloat(LocalizationManager.RightLang.ConfigWindow_Param_KeyBoardNoiseTime,
ref Service.Config.KeyBoardNoiseTimeMin, ref Service.Config.KeyBoardNoiseTimeMax);

ImGui.Unindent();
}

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_ShowInfoOnDtr,
ref Service.Config.ShowInfoOnDtr);

Expand Down Expand Up @@ -480,10 +493,7 @@ internal static void DrawCheckBox(string name, ref bool value, string descriptio
Service.Config.Save();
otherThing?.Invoke();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
{
ImGui.SetTooltip(description);
}
ImGuiHelper.HoveredString(description);
}

private static void DrawRangedFloat(string name, ref float minValue, ref float maxValue, float speed = 0.01f, float min = 0, float max = 3, string description = "")
Expand All @@ -493,10 +503,17 @@ private static void DrawRangedFloat(string name, ref float minValue, ref float m
{
Service.Config.Save();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
ImGuiHelper.HoveredString(description);
}

private static void DrawRangedInt(string name, ref int minValue, ref int maxValue, float speed = 0.01f, int min = 0, int max = 3, string description = "")
{
ImGui.SetNextItemWidth(100);
if (ImGui.DragIntRange2(name, ref minValue, ref maxValue, speed, min, max))
{
ImGui.SetTooltip(description);
Service.Config.Save();
}
ImGuiHelper.HoveredString(description);
}

private static void DrawFloatNumber(string name, ref float value, float speed = 0.002f, float min = 0, float max = 1, string description = "")
Expand All @@ -506,10 +523,7 @@ private static void DrawFloatNumber(string name, ref float value, float speed =
{
Service.Config.Save();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
{
ImGui.SetTooltip(description);
}
ImGuiHelper.HoveredString(description);
}

private static void DrawIntNumber(string name, ref int value, float speed = 0.2f, int min = 0, int max = 1, string description = "", Action otherThing = null)
Expand All @@ -520,10 +534,7 @@ private static void DrawIntNumber(string name, ref int value, float speed = 0.2f
Service.Config.Save();
otherThing?.Invoke();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
{
ImGui.SetTooltip(description);
}
ImGuiHelper.HoveredString(description);
}

private static void DrawColor3(string name, ref Vector3 value, string description = "")
Expand All @@ -533,10 +544,7 @@ private static void DrawColor3(string name, ref Vector3 value, string descriptio
{
Service.Config.Save();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
{
ImGui.SetTooltip(description);
}
ImGuiHelper.HoveredString(description);
}

private static void DrawCombo<T>(string name, ref int value, Func<T, string> toString, T[] choices = null, string description = "") where T : struct, Enum
Expand All @@ -556,10 +564,7 @@ private static void DrawCombo<T>(string name, ref int value, Func<T, string> toS
}
ImGui.EndCombo();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
{
ImGui.SetTooltip(description);
}
ImGuiHelper.HoveredString(description);
}

private static void DrawInputText(string name, ref string value, uint maxLength, string description = "")
Expand All @@ -569,9 +574,6 @@ private static void DrawInputText(string name, ref string value, uint maxLength,
{
Service.Config.Save();
}
if (!string.IsNullOrEmpty(description) && ImGui.IsItemHovered())
{
ImGui.SetTooltip(description);
}
ImGuiHelper.HoveredString(description);
}
}

0 comments on commit faef1be

Please sign in to comment.