Skip to content

Commit

Permalink
Merge pull request #414 from BrakusTapus/main
Browse files Browse the repository at this point in the history
Update to include other half of the planet
  • Loading branch information
LTS-FFXIV authored Sep 27, 2024
2 parents 3de4d1f + 16ecc26 commit f1aea59
Show file tree
Hide file tree
Showing 21 changed files with 77 additions and 75 deletions.
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/ActionBasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private bool NeedsCasting(bool skipCastingCheck)
{
var player = Player.Object;
return CastTime > 0 && !player.HasStatus(true, new[] { StatusID.Swiftcast, StatusID.Triplecast, StatusID.Dualcast }) && !ActionsNoNeedCasting.Contains(ID) &&
(DataCenter.SpecialType == SpecialCommandType.NoCasting || (DateTime.UtcNow > DataCenter.KnockbackStart && DateTime.UtcNow < DataCenter.KnockbackFinished) ||
(DataCenter.SpecialType == SpecialCommandType.NoCasting || (DateTime.Now > DataCenter.KnockbackStart && DateTime.Now < DataCenter.KnockbackFinished) ||
(DataCenter.NoPoslock && DataCenter.IsMoving && !skipCastingCheck));
}

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/ActionTargetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ private readonly bool CanGetTarget(IGameObject target, IGameObject subTarget)
private static IBattleChara? RandomObject(IEnumerable<IBattleChara> objs)
{
return objs.FirstOrDefault();
//Random ran = new(DateTime.UtcNow.Millisecond);
//Random ran = new(DateTime.Now.Millisecond);
//var count = objs.Count();
//if (count == 0) return null;
//return objs.ElementAt(ran.Next(count));
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Data/ObjectListDelay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ObjectListDelay<T> : IEnumerable<T> where T : IGameObject
private IEnumerable<T> _list = new List<T>();
private readonly Func<(float min, float max)> _getRange;
private SortedList<ulong, DateTime> _revealTime = new();
private readonly Random _ran = new(DateTime.UtcNow.Millisecond);
private readonly Random _ran = new(DateTime.Now.Millisecond);

/// <summary>
/// Initializes a new instance of the <see cref="ObjectListDelay{T}"/> class.
Expand Down Expand Up @@ -43,7 +43,7 @@ public void Delay(IEnumerable<T> originData)
{
var outList = new List<T>(originData.Count());
var revealTime = new SortedList<ulong, DateTime>();
var now = DateTime.UtcNow;
var now = DateTime.Now;

foreach (var item in originData)
{
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Data/OffsetDelay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public bool Delay(bool originData)
if (originData != _lastValue)
{
_lastValue = originData;
_changeTimes.Enqueue(DateTime.UtcNow + TimeSpan.FromSeconds(GetDelay()));
_changeTimes.Enqueue(DateTime.Now + TimeSpan.FromSeconds(GetDelay()));
}

if (_changeTimes.TryPeek(out var time) && time < DateTime.UtcNow)
if (_changeTimes.TryPeek(out var time) && time < DateTime.Now)
{
_changeTimes.Dequeue();
_nowValue = !_nowValue;
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver.Basic/Data/RandomDelay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public struct RandomDelay
/// <param name="getRange">A function that returns the range of delay times.</param>
public RandomDelay(Func<(float min, float max)> getRange)
{
_startDelayTime = DateTime.UtcNow;
_startDelayTime = DateTime.Now;
_delayTime = -1;
_ran = new Random(DateTime.UtcNow.Millisecond);
_ran = new Random(DateTime.Now.Millisecond);
_lastValue = false;
GetRange = getRange ?? throw new ArgumentNullException(nameof(getRange));
}
Expand Down Expand Up @@ -62,11 +62,11 @@ public bool Delay(bool originData)
if (_delayTime < 0 && !_lastValue)
{
_lastValue = true;
_startDelayTime = DateTime.UtcNow;
_startDelayTime = DateTime.Now;
_delayTime = min + (float)_ran.NextDouble() * (max - min);
}
// Time's up
else if ((DateTime.UtcNow - _startDelayTime).TotalSeconds >= _delayTime)
else if ((DateTime.Now - _startDelayTime).TotalSeconds >= _delayTime)
{
_delayTime = -1;
return true;
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Data/VfxNewData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public VfxNewData(ulong objectId, string path)
{
ObjectId = objectId;
Path = path;
Time = DateTime.UtcNow;
Time = DateTime.Now;
}

/// <summary>
/// Gets the duration since the VFX data was created.
/// </summary>
public TimeSpan TimeDuration => DateTime.UtcNow - Time;
public TimeSpan TimeDuration => DateTime.Now - Time;

/// <summary>
/// Returns a string that represents the current object.
Expand Down
34 changes: 17 additions & 17 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ public static MajorConditionSet RightSet
|| Svc.GamepadState.Raw(Dalamud.Game.ClientState.GamePad.GamepadButtons.R1) >=
0.5f;

internal static DateTime EffectTime { private get; set; } = DateTime.UtcNow;
internal static DateTime EffectEndTime { private get; set; } = DateTime.UtcNow;
internal static DateTime EffectTime { private get; set; } = DateTime.Now;
internal static DateTime EffectEndTime { private get; set; } = DateTime.Now;

internal static int AttackedTargetsCount { get; set; } = 48;
internal static Queue<(ulong id, DateTime time)> AttackedTargets { get; } = new(AttackedTargetsCount);

internal static bool InEffectTime => DateTime.UtcNow >= EffectTime && DateTime.UtcNow <= EffectEndTime;
internal static bool InEffectTime => DateTime.Now >= EffectTime && DateTime.Now <= EffectEndTime;
internal static Dictionary<ulong, uint> HealHP { get; set; } = [];
internal static Dictionary<ulong, uint> ApplyStatus { get; set; } = [];
internal static uint MPGain { get; set; }
Expand Down Expand Up @@ -138,7 +138,7 @@ public static IAction? CommandNextAction
var next = NextActs.FirstOrDefault();

while (next != null && NextActs.Count > 0 &&
(next.DeadTime < DateTime.UtcNow || IActionHelper.IsLastAction(true, next.Act)))
(next.DeadTime < DateTime.Now || IActionHelper.IsLastAction(true, next.Act)))
{
NextActs.RemoveAt(0);
next = NextActs.FirstOrDefault();
Expand All @@ -155,7 +155,7 @@ public static IAction? CommandNextAction
internal static void AddCommandAction(IAction act, double time)
{
var index = NextActs.FindIndex(i => i.Act.ID == act.ID);
var newItem = new NextAct(act, DateTime.UtcNow.AddSeconds(time));
var newItem = new NextAct(act, DateTime.Now.AddSeconds(time));
if (index < 0)
{
NextActs.Add(newItem);
Expand Down Expand Up @@ -251,7 +251,7 @@ public static float GCDTime(uint gcdCount = 0, float offset = 0)
public static uint[] DutyActions { get; internal set; } = new uint[2];

static DateTime _specialStateStartTime = DateTime.MinValue;
private static double SpecialTimeElapsed => (DateTime.UtcNow - _specialStateStartTime).TotalSeconds;
private static double SpecialTimeElapsed => (DateTime.Now - _specialStateStartTime).TotalSeconds;
public static double SpecialTimeLeft => Service.Config.SpecialDuration - SpecialTimeElapsed;

static SpecialCommandType _specialType = SpecialCommandType.EndSpecial;
Expand All @@ -262,7 +262,7 @@ internal static SpecialCommandType SpecialType
set
{
_specialType = value;
_specialStateStartTime = value == SpecialCommandType.EndSpecial ? DateTime.MinValue : DateTime.UtcNow;
_specialStateStartTime = value == SpecialCommandType.EndSpecial ? DateTime.MinValue : DateTime.Now;
}
}

Expand Down Expand Up @@ -290,7 +290,7 @@ internal static float RaidTimeRaw
if (_startRaidTime == DateTime.MinValue) return 0;

// Calculate and return the total seconds elapsed since the raid started.
return (float)(DateTime.UtcNow - _startRaidTime).TotalSeconds;
return (float)(DateTime.Now - _startRaidTime).TotalSeconds;
}
set
{
Expand All @@ -302,7 +302,7 @@ internal static float RaidTimeRaw
else
{
// Set the raid start time to the current time minus the provided value in seconds.
_startRaidTime = DateTime.UtcNow - TimeSpan.FromSeconds(value);
_startRaidTime = DateTime.Now - TimeSpan.FromSeconds(value);
}
}
}
Expand Down Expand Up @@ -539,11 +539,11 @@ public static bool HasPet
Svc.Condition[ConditionFlag.OccupiedInCutSceneEvent] ||
Svc.Condition[ConditionFlag.Jumping61])
{
_petLastSeen = DateTime.UtcNow;
_petLastSeen = DateTime.Now;
return true;
}

if (!hasPet && _petLastSeen.AddSeconds(3) < DateTime.UtcNow)
if (!hasPet && _petLastSeen.AddSeconds(3) < DateTime.Now)
{
return false;
}
Expand Down Expand Up @@ -666,7 +666,7 @@ public static float DPSTaken
{
try
{
var recs = _damages.Where(r => DateTime.UtcNow - r.ReceiveTime < TimeSpan.FromMilliseconds(5));
var recs = _damages.Where(r => DateTime.Now - r.ReceiveTime < TimeSpan.FromMilliseconds(5));

if (!recs.Any()) return 0;

Expand All @@ -684,8 +684,8 @@ public static float DPSTaken
}

public static ActionRec[] RecordActions => _actions.Reverse().ToArray();
private static DateTime _timeLastActionUsed = DateTime.UtcNow;
public static TimeSpan TimeSinceLastAction => DateTime.UtcNow - _timeLastActionUsed;
private static DateTime _timeLastActionUsed = DateTime.Now;
public static TimeSpan TimeSinceLastAction => DateTime.Now - _timeLastActionUsed;

public static ActionID LastAction { get; private set; } = 0;

Expand Down Expand Up @@ -718,7 +718,7 @@ internal static unsafe void AddActionRec(Action act)
_actions.Dequeue();
}

_timeLastActionUsed = DateTime.UtcNow;
_timeLastActionUsed = DateTime.Now;
_actions.Enqueue(new ActionRec(_timeLastActionUsed, act));
}

Expand All @@ -727,7 +727,7 @@ internal static void ResetAllRecords()
LastAction = 0;
LastGCD = 0;
LastAbility = 0;
_timeLastActionUsed = DateTime.UtcNow;
_timeLastActionUsed = DateTime.Now;
_actions.Clear();

VfxDataQueue.Clear();
Expand All @@ -740,7 +740,7 @@ internal static void AddDamageRec(float damageRatio)
_damages.Dequeue();
}

_damages.Enqueue(new DamageRec(DateTime.UtcNow, damageRatio));
_damages.Enqueue(new DamageRec(DateTime.Now, damageRatio));
}

internal static DateTime KnockbackFinished { get; set; } = DateTime.MinValue;
Expand Down
9 changes: 4 additions & 5 deletions RotationSolver.Basic/Helpers/ObjectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static class ObjectHelper
{
return obj == null ? null : Service.GetSheet<Lumina.Excel.GeneratedSheets.BNpcBase>().GetRow(obj.DataId);
}

internal static bool CanProvoke(this IGameObject target)
{
if (target == null) return false;
Expand Down Expand Up @@ -112,8 +112,7 @@ internal static bool IsAttackable(this IBattleChara battleChara)

if (Service.CountDownTime > 0 || DataCenter.IsPvP) return true;

return DataCenter.RightNowTargetToHostileType switch
{
return DataCenter.RightNowTargetToHostileType switch {
TargetHostileType.AllTargetsCanAttack => true,
TargetHostileType.TargetsHaveTarget => battleChara.TargetObject is IBattleChara,
TargetHostileType.AllTargetsWhenSolo => DataCenter.PartyMembers.Length < 2 || battleChara.TargetObject is IBattleChara,
Expand Down Expand Up @@ -382,7 +381,7 @@ internal static float GetTimeToKill(this IBattleChara b, bool wholeTime = false)
}
}

var timespan = DateTime.UtcNow - startTime;
var timespan = DateTime.Now - startTime;
if (startTime == DateTime.MinValue || timespan < CheckSpan) return float.NaN;

var ratioNow = b.GetHealthRatio();
Expand All @@ -409,7 +408,7 @@ internal static bool IsAttacked(this IBattleChara b)
{
if (id == b.GameObjectId)
{
return now - time <= TimeSpan.FromSeconds(1);
return now - time >= TimeSpan.FromSeconds(1);
}
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Helpers/WarningHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal static bool AddSystemWarning(string warning)
{
try
{
systemWarnings.Add(warning, DateTime.UtcNow);
systemWarnings.Add(warning, DateTime.Now);
return true;
}
catch (Exception ex)
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ partial class CustomRotation
if (Service.Config.HealWhenNothingTodo && InCombat)
{
// Please don't tell me someone's fps is less than 1!!
if (DateTime.UtcNow - _nextTimeToHeal > TimeSpan.FromSeconds(1))
if (DateTime.Now - _nextTimeToHeal > TimeSpan.FromSeconds(1))
{
var min = Service.Config.HealWhenNothingTodoDelay.X;
var max = Service.Config.HealWhenNothingTodoDelay.Y;
_nextTimeToHeal = DateTime.UtcNow + TimeSpan.FromSeconds(_random.NextDouble() * (max - min) + min);
_nextTimeToHeal = DateTime.Now + TimeSpan.FromSeconds(_random.NextDouble() * (max - min) + min);
}
else if (_nextTimeToHeal < DateTime.UtcNow)
else if (_nextTimeToHeal < DateTime.Now)
{
_nextTimeToHeal = DateTime.UtcNow;
_nextTimeToHeal = DateTime.Now;

if (PartyMembersMinHP < Service.Config.HealWhenNothingTodoBelow)
{
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver/Commands/RSCommands_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ internal static unsafe bool CanDoAnAction(bool isGCD)
if (!Player.Available) return false;

// Do not click the button in random time.
if (DateTime.UtcNow - _lastClickTime < TimeSpan.FromMilliseconds(new Random().Next(
if (DateTime.Now - _lastClickTime < TimeSpan.FromMilliseconds(new Random().Next(
(int)(Service.Config.ClickingDelay.X * 1000), (int)(Service.Config.ClickingDelay.Y * 1000)))) return false;
_lastClickTime = DateTime.UtcNow;
_lastClickTime = DateTime.Now;

if (!isGCD && ActionUpdater.NextAction is IBaseAction act1 && act1.Info.IsRealGCD) return false;

Expand Down Expand Up @@ -73,7 +73,7 @@ public static void DoAction()
OtherConfiguration.RotationSolverRecord.ClickingCount++;

_lastActionID = nextAction.AdjustedID;
_lastUsedTime = DateTime.UtcNow;
_lastUsedTime = DateTime.Now;

if (nextAction is BaseAction act)
{
Expand Down Expand Up @@ -239,7 +239,7 @@ internal static void UpdateRotationState()

// Cancel when after combat.
else if (ActionUpdater.AutoCancelTime != DateTime.MinValue
&& DateTime.UtcNow > ActionUpdater.AutoCancelTime)
&& DateTime.Now > ActionUpdater.AutoCancelTime)
{
CancelState();
ActionUpdater.AutoCancelTime = DateTime.MinValue;
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static AssemblyInfo GetInfo(this Assembly assembly)
var name = assembly.GetName().Name;
var location = assembly.Location;
var company = assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company;
var assemblyInfo = new AssemblyInfo(name, company, location, string.Empty, company, name, DateTime.UtcNow);
var assemblyInfo = new AssemblyInfo(name, company, location, string.Empty, company, name, DateTime.Now);

_assemblyInfos[assembly] = assemblyInfo;

Expand Down Expand Up @@ -70,7 +70,7 @@ public static Assembly LoadCustomRotationAssembly(string filePath)
link?.Donate,
link?.UserName,
link?.Repository,
DateTime.UtcNow);
DateTime.Now);

var existingAssembly = GetAssemblyFromPath(filePath);
if (existingAssembly != null)
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Helpers/WarningHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static void AddSystemWarning(string message)
}
if (!DataCenter.SystemWarnings.ContainsKey(message))
{
DataCenter.SystemWarnings.Add(message, DateTime.UtcNow);
DataCenter.SystemWarnings.Add(message, DateTime.Now);
}
}
}
5 changes: 4 additions & 1 deletion RotationSolver/UI/RotationConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,10 @@ private static unsafe void DrawStatus()
ImGui.Text($"Merged Status: {DataCenter.MergedStatus}");
ImGui.Text($"TargetingType: {DataCenter.TargetingType}");
ImGui.Text($"DeathTarget: {DataCenter.DeathTarget}");

foreach (var item in DataCenter.AttackedTargets)
{
ImGui.Text(item.id.ToString());
}

// VFX info
ImGui.Text("VFX Data:");
Expand Down
Loading

0 comments on commit f1aea59

Please sign in to comment.