Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP deep dungeon auto clear modules #580

Merged
merged 34 commits into from
Feb 2, 2025
Merged

WIP deep dungeon auto clear modules #580

merged 34 commits into from
Feb 2, 2025

Conversation

xanunderscore
Copy link
Collaborator

@xanunderscore xanunderscore commented Jan 29, 2025

note that, because PalacePal doesn't have an IPC and it sounded like a huge PITA to add one, and it wouldn't even work in UIDev, the new zone module's trap avoidance functionality relies on just directly opening the PP sqlite file and reading trap locations from there.

i'm not a big fan of this solution but also like, i have no idea how to do it better, other than copying PP's entire dataset into the vbm source tree and assuming it will never change

In addition to some changes to the boss modules themselves since they mostly suck:

UIDev

  • draws in a separate movable window now
  • added support to read FFXIV game path from environment variable - mine is installed into a custom location via steam and it doesn't seem like steam exposes any means of reporting custom paths for games
  • added shitty "offline texture provider" to be able to draw the DD minimap in the replay viewer in UIDev. the red and blue channels are swapped because of an endianness mismatch or something. i didn't really feel like putting in the extra effort of converting them but i could if someone really wants it

framework

  • added replay "memory" support to replay viewer, it will reopen the previous replay to the same playback position if desired
  • added Source attribute to ForbiddenZones, which for now is just the caster's instanceID, if one exists
  • ActionManagerEx now checks for action LOS before blocking movement in preparation for a cast
  • added InstanceContentDeepDungeon pomander and magicite use functions to CS, we can hook these and add to manual queue at some point if needed
  • added code that fixes multiple charge GCDs that are conditionally affected by haste, of which only one exists, which is Drill
  • improved interact-with-target code
    • added a slightly larger zone around target object to fix an edge case in the thancred solo duty in EW
    • switched to the interact function in TargetSystem that doesn't actually change your hard target as that's unnecessary
    • clear forcedmovement during the actual interact window to prevent immediate interruption of the interact action

ui

  • added separate Zone Module Window which can optionally be drawn. this is a regular imgui window. vbm's minimap is great, but i have it configured to ignore mouse input, which may not be desirable for zone modules. if present, the zone module window will also display in the replay viewer
  • if the Zone Module Window wants to be drawn and there is no active boss module, the hints window will not appear (since its contents are expected to be drawn in the ZM window instead)

other

fixed/improved some of my rotation code

  • dumb oversight in PLD caused it to sometimes never use divine might holy spirit even in a buff window
  • reworked DRG, MCH, and MNK to use NextGCD, a previously wasted feature, to correctly predict reassemble/life surge/true north usage
  • took out the cast time stuff, replaced with the new framework-level solution

// the only separate-cooldown GCD that increases to >1 charge via trait is currently MCH Drill; others have multiple charges at unlock - SGE Phlegma, RPR Soul Slice, BLU Surpanakha
var cooldownSingleCharge = IsGCD && max > 1 && cdg.Total > 0 ? cdg.Total / max : Cooldown;

return !IsMultiCharge || cdg.Total < cooldownSingleCharge ? cdg.Remaining : cooldownSingleCharge - cdg.Elapsed;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I don't understand this change... Can you elaborate?

Copy link
Collaborator Author

@xanunderscore xanunderscore Feb 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have the level 94 trait Enhanced Multiweapon on machinist, Drill stops being affected by skill speed/haste/slows, so the separate cooldown is always 20s and using both charges will set it to 40. before then it is affected by haste despite still technically having multiple charges, so like in Palace of the Dead, where you have some inherent skillspeed from the aetherpool gear, the single charge cooldown of Drill is 19.2s and using the one charge you have at that level will set the cooldown to 38.4s. also, if you use a single charge of drill at these levels while slowed or hasted, you can get a cooldown total of like 32 or 54 seconds, and checking Cooldown against that gives you incorrect results.

so what this line is doing is just dividing cdg.Total by the maximum number of charges of the ability, which SHOULD give us the effective single charge CD.

i do not think it's possible to accurately calculate this information based on only the user's stats, because the total cooldown is basically snapshotting the stats we had when the skill was used, which may not be the ones we have now

Copy link
Owner

@awgil awgil Feb 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, then why can't we just always return cdg.Total / MaxChargesAtCap() - cdg.Elapsed, clamped to 0? Why do we need IsGCD etc checks here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that should work in theory yeah. this code was originally only checking for specifically Drill, since it's the only action that is affected and i wanted to avoid introducing other bugs, but it seemed to work fine in practice

@@ -18,6 +18,7 @@
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this property set, the plugin will fail to load because it won't be able to find the sqlite3 DLL

@@ -19,6 +19,8 @@ protected virtual void Dispose(bool disposing)

public virtual void Update() { }
public virtual bool WantToBeDrawn() => false; // return true if it wants to be drawn (higher priority than inactive boss modules, but lower priority than active)
public virtual bool DrawSeparately => false; // return true if the contents of DrawExtra should be shown in a separate window
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need two modes? What are the usecases for both options?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only usecase in master atm is the Sastasha module, which draws one line of hints in the regular bossmod hints window, and I felt like drawing a whole separate window for that would probably be overkill

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd then make two independent functions (draw extra in main window & draw dedicated window).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh well yeah but we still need to know whether to display the hints window and the zone module window

@@ -134,6 +135,8 @@ public sealed class Actor(ulong instanceID, uint oid, int spawnIndex, string nam
public bool PredictedDead => PredictedHPRaw <= 1 && !IsStrikingDummy;
public float PredictedHPRatio => (float)PredictedHPRaw / HPMP.MaxHP;

public bool IsTransformed => Statuses.Any(Autorotation.RotationModuleManager.IsTransformStatus);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these statuses need to be moved to Data\ (something like CommonStatusId or something...). This is a logical dependency inversion here.

@@ -481,6 +513,17 @@ private bool UseBozjaFromHolsterDirectorDetour(PublicContentBozja* self, uint ho
return res;
}

// TODO add to manual q
private void UsePomanderDetour(InstanceContentDeepDungeon* self, uint slot)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I remember you also mentioned some bozja thing not getting hooked?..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public ReplayManager(RotationDatabase rotationDB, string fileDialogStartPath)
{
this.rotationDB = rotationDB;
this.fileDialogStartPath = fileDialogStartPath;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming convention (_ prefix for private variables), no this. please, it's too ugly.

[PropertyDisplay("Remember playback position for previously opened replays")]
public bool RememberReplayTimes;

public List<ReplayMemory> ReplayHistory = [];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of storing this 'invisible' state in configs tbh. At very least, it would mean that config would always be 'modified' in UIDev, preventing close by esc.

I wonder if we need a separate config (user preferences or something), it could also be used to store shit like default filtered statuses in planner, default filtered out actions for replays, etc etc etc.

@@ -53,6 +53,7 @@ public readonly bool InRect(WDir direction, float lenFront, float lenBack, float
}

// 2d vector that represents world-space position on XZ plane
[Serializable]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh?

@@ -48,6 +49,7 @@
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="11.0.0" />
<PackageReference Include="SharpDX.Mathematics" Version="4.2.0" />
<PackageReference Include="System.Data.Sqlite" Version="1.0.119" />
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What code uses it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AutoClear.cs, scroll to the bottom

@awgil awgil merged commit 9f8048f into awgil:master Feb 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants