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

Commit

Permalink
fix: fix for healing error. fix for work task await.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 2, 2023
1 parent c96224d commit b365cc8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 22 deletions.
4 changes: 3 additions & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"Configwindow_Param_StopCastingDelay": "Set the range of random delay for stoping casting when target is dead in second.",
"Configwindow_Param_WorkTaskDelay": "Set the work task delay in millisecond. Smaller, more precise, more resource-intensive",
"Configwindow_Param_Display": "Display",
"Configwindow_Param_Advanced": "Advanced",
"Configwindow_Param_PoslockCasting": "Lock the movement when casting.",
"Configwindow_Param_UseStopCasting": "Use stopping casting when target is dead.",
"Configwindow_Param_PoslockModifier": "Set the modifier key to unlock the movement temporary",
Expand All @@ -88,10 +89,11 @@
"Configwindow_Params_LocationWrongTextDesc": "How do you want to be scolded if you have a positional error ?!",
"Configwindow_Param_SayOutStateChanged": "Saying the state changes out",
"Configwindow_Param_ShowInfoOnDtr": "Display plugin state on dtrbar",
"Configwindow_Param_ShowWorkTaskFPS": "Display Task FPS on dtrbar",
"Configwindow_Param_ShowInfoOnToast": "Display plugin state changed on toast",
"Configwindow_Param_Action": "Action",
"Configwindow_Param_UseAOEWhenManual": "Use AOE actions in manual mode",
"Configwindow_Param_AutoBreak": "Automatic breaking",
"Configwindow_Param_AutoBurst": "Automatic burst",
"Configwindow_Param_UseAbility": "Auto-use abilities",
"Configwindow_Param_NoNewHostiles": "Don't attack new mobs by aoe",
"Configwindow_Params_NoNewHostilesDesc": "Nerver use any AOE action when this action may attack the mobs that not is a hostile target.",
Expand Down
3 changes: 1 addition & 2 deletions RotationSolver/Localization/Strings_Major.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ internal partial class Strings
public string Configwindow_Param_WorkTaskDelay { get; set; } = "Set the work task delay in millisecond. Smaller, more precise, more resource-intensive";

public string Configwindow_Param_Display { get; set; } = "Display";
public string Configwindow_Param_Sound { get; set; } = "Sound";
public string Configwindow_Param_Advanced { get; set; } = "Advanced";
public string Configwindow_Param_PoslockCasting { get; set; } = "Lock the movement when casting.";
public string Configwindow_Param_UseStopCasting { get; set; } = "Use stopping casting when target is dead.";
Expand Down Expand Up @@ -149,7 +148,7 @@ internal partial class Strings
public string Configwindow_Param_ShowInfoOnToast { get; set; } = "Display plugin state changed on toast";
public string Configwindow_Param_Action { get; set; } = "Action";
public string Configwindow_Param_UseAOEWhenManual { get; set; } = "Use AOE actions in manual mode";
public string Configwindow_Param_AutoBreak { get; set; } = "Automatic breaking";
public string Configwindow_Param_AutoBurst { get; set; } = "Automatic burst";
public string Configwindow_Param_UseAbility { get; set; } = "Auto-use abilities";
public string Configwindow_Param_NoNewHostiles { get; set; } = "Don't attack new mobs by aoe";
public string Configwindow_Params_NoNewHostilesDesc { get; set; } = "Nerver use any AOE action when this action may attack the mobs that not is a hostile target.";
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver/Updaters/MajorUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ private static void FrameworkUpdate(Framework framework)
public static void Enable()
{
Service.Framework.Update += FrameworkUpdate;
Task.Run(() =>
Task.Run(async () =>
{
while (_work)
{
if (!Service.Configuration.UseWorkTask || !Service.Conditions.Any() || Service.ClientState.LocalPlayer == null)
{
Task.Delay(200);
await Task.Delay(200);
continue;
}

UpdateWork();
Task.Delay(Service.Configuration.WorkTaskDelay);
await Task.Delay(Service.Configuration.WorkTaskDelay);

CalculateFPS();
}
Expand All @@ -76,7 +76,7 @@ private static void CalculateFPS()
var span = now - _lastUpdate;
if (span > _oneSecond)
{
FrameCount = (_frameCount / span.TotalSeconds).ToString("F2");
FrameCount = _frameCount.ToString();
_lastUpdate = now;
_frameCount = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/Updaters/PreviewUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ internal static void UpdatePreview()
private static void UpdateEntry()
{
var showStr = RSCommands.EntryString;
if (Service.Configuration.ShowWorkTaskFPS)
if (Service.Configuration.UseWorkTask && Service.Configuration.ShowWorkTaskFPS)
{
showStr += " " + MajorUpdater.FrameCount + "Hz";
showStr += " - " + MajorUpdater.FrameCount + "Hz";
}
if (Service.Configuration.ShowInfoOnDtr && showStr != null)
{
Expand Down
16 changes: 11 additions & 5 deletions RotationSolver/Updaters/TargetUpdater_Friends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ private unsafe static void UpdateFriends(IEnumerable<BattleChara> allTargets)
UpdateCanHeal(Service.ClientState.LocalPlayer);
}

static RandomDelay _healDelay = new RandomDelay(() => (Service.Configuration.HealDelayMin, Service.Configuration.HealDelayMax));
static RandomDelay _healDelay1 = new RandomDelay(() => (Service.Configuration.HealDelayMin, Service.Configuration.HealDelayMax));

static RandomDelay _healDelay2 = new RandomDelay(() => (Service.Configuration.HealDelayMin, Service.Configuration.HealDelayMax));

static RandomDelay _healDelay3 = new RandomDelay(() => (Service.Configuration.HealDelayMin, Service.Configuration.HealDelayMax));

static RandomDelay _healDelay4 = new RandomDelay(() => (Service.Configuration.HealDelayMin, Service.Configuration.HealDelayMax));

static void UpdateCanHeal(PlayerCharacter player)
{
Expand All @@ -164,10 +170,10 @@ static void UpdateCanHeal(PlayerCharacter player)
}

//Delay
CanHealSingleAbility = _healDelay.Delay(CanHealSingleAbility);
CanHealSingleSpell = _healDelay.Delay(CanHealSingleSpell);
CanHealAreaAbility = _healDelay.Delay(CanHealAreaAbility);
CanHealAreaSpell = _healDelay.Delay(CanHealAreaSpell);
CanHealSingleAbility = _healDelay1.Delay(CanHealSingleAbility);
CanHealSingleSpell = _healDelay2.Delay(CanHealSingleSpell);
CanHealAreaAbility = _healDelay3.Delay(CanHealAreaAbility);
CanHealAreaSpell = _healDelay4.Delay(CanHealAreaSpell);

PartyMembersMinHP = PartyMembersHP.Any() ? PartyMembersHP.Min() : 0;
HPNotFull = PartyMembersMinHP < 1;
Expand Down
13 changes: 5 additions & 8 deletions RotationSolver/Windows/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ private void DrawParamTab()
DrawParamTabItem(LocalizationManager.RightLang.Configwindow_Param_Basic, DrawParamBasic);
DrawParamTabItem(LocalizationManager.RightLang.Configwindow_Param_Delay, DrawParamDelay);
DrawParamTabItem(LocalizationManager.RightLang.Configwindow_Param_Display, DrawParamDisplay);
DrawParamTabItem(LocalizationManager.RightLang.Configwindow_Param_Sound, DrawParamSound);
DrawParamTabItem(LocalizationManager.RightLang.Configwindow_Param_Action, DrawParamAction);
DrawParamTabItem(LocalizationManager.RightLang.Configwindow_Param_Conditon, DrawParamCondition);
DrawParamTabItem(LocalizationManager.RightLang.Configwindow_Param_Target, DrawParamTarget);
Expand Down Expand Up @@ -111,25 +110,23 @@ private void DrawParamDelay()
}
}

private void DrawParamSound()
private void DrawParamAdvanced()
{
DrawIntNumber(LocalizationManager.RightLang.Configwindow_Params_VoiceVolume,
ref Service.Configuration.VoiceVolume, max: 100);
ref Service.Configuration.VoiceVolume, max: 100);

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_SayOutStateChanged,
ref Service.Configuration.SayOutStateChanged);


DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_SayPositional,
ref Service.Configuration.SayPotional);

DrawInputText(LocalizationManager.RightLang.Configwindow_Param_PositionaErrorText,
ref Service.Configuration.PositionalErrorText, 100,
LocalizationManager.RightLang.Configwindow_Params_LocationWrongTextDesc);
}

private void DrawParamAdvanced()
{
ImGui.Separator();

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_PoslockCasting,
ref Service.Configuration.PoslockCasting);

Expand Down Expand Up @@ -235,7 +232,7 @@ private void DrawParamAction()

ImGui.Separator();

DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_AutoBreak,
DrawCheckBox(LocalizationManager.RightLang.Configwindow_Param_AutoBurst,
ref Service.Configuration.AutoBurst);

ImGui.SameLine();
Expand Down

0 comments on commit b365cc8

Please sign in to comment.