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

Commit

Permalink
style: fixed for random adding.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jan 30, 2023
1 parent e7a7f1b commit 414fe09
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 3 additions & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
"Configwindow_Param_UseOverlayWindow": "Display top overlay",
"Configwindow_Param_UseOverlayWindowDesc": "This window is currently used to cue the body position in advance.",
"Configwindow_Param_Basic": "Basic",
"Configwindow_Param_WeaponDelay": "Set the random interval between GCD (seconds)",
"Configwindow_Param_WeaponDelay": "Set the range of random delay for GCD in second.",
"Configwindow_Param_DeathDelay": "Set the range of random delay for raising deaths in second.",
"Configwindow_Param_HostileDelay": "Set the range of random delay for finding hostile targets in second.",
"Configwindow_Param_WeaponFaster": "Set the time advance of use actions",
"Configwindow_Param_WeaponInterval": "Set the interval between abilities using",
"Configwindow_Param_InterruptibleTime": "Set the delay of interrupting",
Expand Down
2 changes: 0 additions & 2 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ private static void UPdateMPTimer()
_lastMP = player.CurrentMp;
}

static DateTime _lastWeaponGo = DateTime.MinValue;
static float _weaponRandomDelay = -1;
internal static float _lastCastingTotal = 0;
internal unsafe static void DoAction()
{
Expand Down
20 changes: 10 additions & 10 deletions RotationSolver/Updaters/TargetUpdater_Friends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ internal static partial class TargetUpdater
/// </summary>
internal static bool HPNotFull { get; private set; } = false;

static RandomDelay _deathAllDelay = new RandomDelay(() => DeathPeopleAll.Any(),
() => (Service.Configuration.DeathDelayMin, Service.Configuration.DeathDelayMax));

static RandomDelay _deathPartyDelay = new RandomDelay(() => DeathPeopleParty.Any(),
() => (Service.Configuration.DeathDelayMin, Service.Configuration.DeathDelayMax));

internal unsafe static void UpdateFriends()
{
#region Friend
Expand All @@ -122,9 +128,13 @@ internal unsafe static void UpdateFriends()
PartyHealers = PartyMembers.GetObjectInRadius(30).GetJobCategory(JobRole.Healer);
AllianceTanks = AllianceMembers.GetObjectInRadius(30).GetJobCategory(JobRole.Tank);

var lastDeathAll = DeathPeopleAll;
var lastDeathparty = DeathPeopleParty;
DeathPeopleAll = AllianceMembers.GetDeath().GetObjectInRadius(30);
DeathPeopleParty = PartyMembers.GetDeath().GetObjectInRadius(30);
MaintainDeathPeople();
if (!_deathAllDelay.Update()) HostileTargets = lastDeathAll;
if (!_deathPartyDelay.Update()) HostileTargets = lastDeathparty;

WeakenPeople = TargetFilter.GetObjectInRadius(PartyMembers, 30).Where(p =>
{
Expand Down Expand Up @@ -238,13 +248,6 @@ static float GetHealingOfTimeRatio(BattleChara target, params StatusID[] statusI
}

static SortedDictionary<uint, Vector3> _locations = new SortedDictionary<uint, Vector3>();

static RandomDelay _deathAllDelay = new RandomDelay(() => DeathPeopleAll.Any(),
() => (Service.Configuration.DeathDelayMin, Service.Configuration.DeathDelayMax));

static RandomDelay _deathPartyDelay = new RandomDelay(() => DeathPeopleParty.Any(),
() => (Service.Configuration.DeathDelayMin, Service.Configuration.DeathDelayMax));

private static void MaintainDeathPeople()
{
SortedDictionary<uint, Vector3> locs = new SortedDictionary<uint, Vector3>();
Expand All @@ -260,9 +263,6 @@ private static void MaintainDeathPeople()
DeathPeopleAll = FilterForDeath(DeathPeopleAll);
DeathPeopleParty = FilterForDeath(DeathPeopleParty);

if (!_deathAllDelay.Update()) DeathPeopleAll = new BattleChara[0];
if (!_deathPartyDelay.Update()) DeathPeopleParty = new BattleChara[0];

_locations = locs;
}

Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/Updaters/TargetUpdater_Hostile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ internal unsafe static void UpdateHostileTargets()

if (AllTargets != null)
{
var lastHostile = HostileTargets;
HostileTargets = CountDown.CountDownTime > 0 ? AllTargets : inFate > 0 ?
AllTargets.Where(t => t.FateId() == inFate) :
AllTargets.Where(t => (t.TargetObject is BattleChara || ids.Contains(t.ObjectId)) && t.FateId() == 0
Expand All @@ -103,7 +104,7 @@ internal unsafe static void UpdateHostileTargets()
break;
}

if (!_hostileDelay.Update()) HostileTargets = new BattleChara[0];
if (!_hostileDelay.Update()) HostileTargets = lastHostile;

CanInterruptTargets = HostileTargets.Where(tar =>
{
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Windows/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ private static void DrawCheckBox(string name, ref bool value, string description
}
}

private static void DrawRangedFloat(string name, ref float minValue, ref float maxValue, float speed = 0.002f, float min = 0, float max = 1, string description = "")
private static void DrawRangedFloat(string name, ref float minValue, ref float maxValue, float speed = 0.002f, float min = 0, float max = 3, string description = "")
{
ImGui.SetNextItemWidth(100);
if (ImGui.DragFloatRange2(name, ref minValue, ref maxValue, speed, min, max))
Expand Down

0 comments on commit 414fe09

Please sign in to comment.