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 ability remain check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Feb 22, 2023
1 parent 76aa1cd commit 7d8cb22
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
17 changes: 8 additions & 9 deletions RotationSolver/Attributes/RotationDescAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ private RotationDescAttribute()
}

static readonly System.Numerics.Vector2 PIC_SIZE = new System.Numerics.Vector2(24, 24);
const float ATTR_INDENT = 170;

public bool Display(ICustomRotation rotation)
public void Display(ICustomRotation rotation)
{
var acts = rotation.AllActions;

Expand All @@ -113,10 +114,9 @@ public bool Display(ICustomRotation rotation)

bool hasDesc = !string.IsNullOrEmpty(Description);

if (!hasDesc && !allActions.Any()) return false;
if (!hasDesc && !allActions.Any()) return;
ImGui.Separator();

ImGui.Columns(2, this.GetHashCode().ToString(), false);
ImGui.SetColumnWidth(0, 170);
ImGui.Image(IconSet.GetTexture(IconID).ImGuiHandle, PIC_SIZE);
ImGui.SameLine();

Expand All @@ -125,9 +125,10 @@ public bool Display(ICustomRotation rotation)
ImGui.Text(" " + Type.ToName());
if (isOnCommand) ImGui.PopStyleColor();

ImGui.NextColumn();
ImGui.SameLine();
ImGui.Indent(ATTR_INDENT);

if (hasDesc)
if (hasDesc)
{
ImGui.TextWrapped(Description);
}
Expand All @@ -147,9 +148,7 @@ public bool Display(ICustomRotation rotation)
ImGui.Image(item.GetTexture().ImGuiHandle, PIC_SIZE);
notStart = true;
}

ImGui.Columns(1);
return true;
ImGui.Unindent(ATTR_INDENT);
}
public static IEnumerable<RotationDescAttribute[]> Merge(IEnumerable<RotationDescAttribute> rotationDescAttributes)
=> from r in rotationDescAttributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public bool IsEnabled

public BattleChara MoveTarget { get; private set; }

public virtual string Description { get; } = "It seems that the author didn't write a description!";
public virtual string Description { get; } = string.Empty;

/// <summary>
/// Description about the actions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ internal abstract partial class CustomRotation
{
const ImGuiWindowFlags flags =
ImGuiWindowFlags.Tooltip |
ImGuiWindowFlags.NoTitleBar |
ImGuiWindowFlags.NoMove |
ImGuiWindowFlags.NoResize |
ImGuiWindowFlags.NoSavedSettings |
ImGuiWindowFlags.NoBringToFrontOnFocus |
ImGuiWindowFlags.NoDecoration |
ImGuiWindowFlags.NoInputs|
ImGuiWindowFlags.AlwaysAutoResize;

public unsafe void Display(ICustomRotation[] rotations, bool canAddButton)
Expand All @@ -31,7 +32,7 @@ public unsafe void Display(ICustomRotation[] rotations, bool canAddButton)
var id = "Popup" + GetHashCode().ToString();

ImGui.SetWindowPos(id, ImGui.GetIO().MousePos);
ImGui.SetNextWindowSizeConstraints(new Vector2(350, 0), new Vector2(1000, 1000));
ImGui.SetNextWindowSizeConstraints(new Vector2(0, 0), new Vector2(1000, 1500));
if (ImGui.Begin(id, flags))
{
var t = IconSet. GetTexture(IconSet.GetJobIcon(this, IconType.Framed));
Expand All @@ -53,11 +54,9 @@ public unsafe void Display(ICustomRotation[] rotations, bool canAddButton)
attrs.Add(RotationDescAttribute.MergeToOne(m.GetCustomAttributes<RotationDescAttribute>()));
}

bool last = true;
foreach (var a in RotationDescAttribute.Merge(attrs))
{
if (last) ImGui.Separator();
last = RotationDescAttribute.MergeToOne(a)?.Display(this) ?? false;
RotationDescAttribute.MergeToOne(a)?.Display(this);
}

ImGui.End();
Expand Down
11 changes: 6 additions & 5 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,20 @@ private static unsafe void UpdateWeaponTime()
//确定读条时间。
if (WeaponElapsed < 0.3) _lastCastingTotal = castTotal;


//确认能力技的相关信息
var interval = Service.Configuration.WeaponInterval;
if (WeaponRemain < interval || WeaponElapsed == 0)
var checkRemain = WeaponRemain + 0.1f - Service.Configuration.WeaponAhead;
var checkElapsed = WeaponElapsed - 0.1f + Service.Configuration.WeaponAhead;
if (checkRemain < interval || WeaponElapsed == 0)
{
AbilityRemain = 0;
if (WeaponRemain > 0)
if (checkRemain > 0)
{
AbilityRemain = WeaponRemain + interval;
}
AbilityRemainCount = 0;
}
else if (WeaponRemain < 2 * interval)
else if (checkRemain < 2 * interval)
{
AbilityRemain = WeaponRemain - interval;
AbilityRemainCount = 1;
Expand All @@ -137,7 +138,7 @@ private static unsafe void UpdateWeaponTime()
{
var abilityWhole = (int)(weapontotal / Service.Configuration.WeaponInterval - 1);
AbilityRemain = interval - WeaponElapsed % interval;
AbilityRemainCount = (byte)(abilityWhole - (int)(WeaponElapsed / interval));
AbilityRemainCount = (byte)(abilityWhole - (int)(checkElapsed / interval));
}

if (weapontotal > 0) WeaponTotal = weapontotal;
Expand Down
18 changes: 17 additions & 1 deletion RotationSolver/Windows/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,23 @@ private unsafe void DrawParty()
foreach (var member in TargetUpdater.PartyMembers)
{
var cha = (FFXIVClientStructs.FFXIV.Client.Game.Character.Character*)member.GetAddress();
ImGui.Text(((VfxStruct*)cha->Omen)->Flags.ToString());
var omen = (VfxStruct*)cha->Omen;
if ((IntPtr)omen != 0)
{
ImGui.Text("Omen:" + omen->Flags.ToString());
}
omen = (VfxStruct*)cha->VfxData;
if ((IntPtr)omen != 0)
{
ImGui.Text("Data:" + omen->Flags.ToString());
}
omen = (VfxStruct*)cha->VfxData2;
if ((IntPtr)omen != 0)
{
ImGui.Text("Data2:" + omen->Flags.ToString());
}
ImGui.Text(cha->StatusEffectVFXId.ToString());

}
}

Expand Down

0 comments on commit 7d8cb22

Please sign in to comment.