Merge branch 'master' into reshade-addon

This commit is contained in:
goat 2024-07-23 02:18:04 +02:00 committed by GitHub
commit a57694d7e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 49 additions and 42 deletions

View file

@ -9,7 +9,7 @@
</PropertyGroup>
<PropertyGroup Label="Feature">
<DalamudVersion>10.0.0.5</DalamudVersion>
<DalamudVersion>10.0.0.6</DalamudVersion>
<Description>XIV Launcher addon framework</Description>
<AssemblyVersion>$(DalamudVersion)</AssemblyVersion>
<Version>$(DalamudVersion)</Version>

View file

@ -18,4 +18,9 @@ public unsafe class NINGauge : JobGaugeBase<FFXIVClientStructs.FFXIV.Client.Game
/// Gets the amount of Ninki available.
/// </summary>
public byte Ninki => this.Struct->Ninki;
/// <summary>
/// Gets the current charges for Kazematoi
/// </summary>
public byte Kazematoi => this.Struct->Kazematoi;
}

View file

@ -131,9 +131,12 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
/// </summary>
internal void HandleRemovedNodes()
{
foreach (var data in this.entries.Where(d => d.ShouldBeRemoved))
foreach (var data in this.entries)
{
this.RemoveEntry(data);
if (data.ShouldBeRemoved)
{
this.RemoveEntry(data);
}
}
this.entries.RemoveAll(d => d.ShouldBeRemoved);
@ -210,7 +213,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
// If we have an unmodified DTR but still have entries, we need to
// work to reset our state.
if (!this.CheckForDalamudNodes())
if (!this.CheckForDalamudNodes(dtr))
this.RecreateNodes();
var collisionNode = dtr->GetNodeById(17);
@ -223,40 +226,35 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
foreach (var data in this.entries)
{
var isHide = data.UserHidden || !data.Shown;
if (data is { Dirty: true, Added: true, Text: not null, TextNode: not null })
{
var node = data.TextNode;
if (data.Storage == null)
{
data.Storage = Utf8String.CreateEmpty();
}
data.Storage->SetString(data.Text.EncodeWithNullTerminator());
node->SetText(data.Storage->StringPtr);
ushort w = 0, h = 0;
if (!isHide)
{
node->GetTextDrawSize(&w, &h, node->NodeText.StringPtr);
node->AtkResNode.SetWidth(w);
}
node->AtkResNode.ToggleVisibility(!isHide);
data.Dirty = false;
}
if (!data.Added)
{
data.Added = this.AddNode(data.TextNode);
}
var isHide = !data.Shown || data.UserHidden;
var node = data.TextNode;
var nodeHidden = !node->AtkResNode.IsVisible();
if (!isHide)
{
if (nodeHidden)
node->AtkResNode.ToggleVisibility(true);
if (data is { Added: true, Text: not null, TextNode: not null } && (data.Dirty || nodeHidden))
{
if (data.Storage == null)
{
data.Storage = Utf8String.CreateEmpty();
}
data.Storage->SetString(data.Text.EncodeWithNullTerminator());
node->SetText(data.Storage->StringPtr);
ushort w = 0, h = 0;
node->GetTextDrawSize(&w, &h, node->NodeText.StringPtr);
node->AtkResNode.SetWidth(w);
}
var elementWidth = data.TextNode->AtkResNode.Width + this.configuration.DtrSpacing;
if (this.configuration.DtrSwapDirection)
@ -270,17 +268,20 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
data.TextNode->AtkResNode.SetPositionFloat(runningXPos, 2);
}
}
else
else if (!nodeHidden)
{
// If we want the node hidden, shift it up, to prevent collision conflicts
data.TextNode->AtkResNode.SetYFloat(-collisionNode->Height * dtr->RootNode->ScaleX);
node->AtkResNode.SetYFloat(-collisionNode->Height * dtr->RootNode->ScaleX);
node->AtkResNode.ToggleVisibility(false);
}
data.Dirty = false;
}
}
private void HandleAddedNodes()
{
if (this.newEntries.Any())
if (!this.newEntries.IsEmpty)
{
foreach (var newEntry in this.newEntries)
{
@ -354,11 +355,8 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
/// Checks if there are any Dalamud nodes in the DTR.
/// </summary>
/// <returns>True if there are nodes with an ID > 1000.</returns>
private bool CheckForDalamudNodes()
private bool CheckForDalamudNodes(AtkUnitBase* dtr)
{
var dtr = this.GetDtr();
if (dtr == null || dtr->RootNode == null) return false;
for (var i = 0; i < dtr->UldManager.NodeListCount; i++)
{
if (dtr->UldManager.NodeList[i]->NodeId > 1000)

View file

@ -137,14 +137,17 @@ public sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry
get => this.shownBacking;
set
{
this.shownBacking = value;
this.Dirty = true;
if (value != this.shownBacking)
{
this.shownBacking = value;
this.Dirty = true;
}
}
}
/// <inheritdoc/>
[Api10ToDo("Maybe make this config scoped to internalname?")]
public bool UserHidden => this.configuration.DtrIgnore?.Any(x => x == this.Title) ?? false;
public bool UserHidden => this.configuration.DtrIgnore?.Contains(this.Title) ?? false;
/// <summary>
/// Gets or sets the internal text node of this entry.

View file

@ -2889,6 +2889,7 @@ internal class PluginInstallerWindow : Window, IDisposable
}
configuration.QueueSave();
_ = pluginManager.ReloadPluginMastersAsync();
}
if (repoManifest?.IsTestingExclusive == true)

View file

@ -72,7 +72,7 @@ internal sealed class ExposedPlugin(LocalPlugin plugin) : IExposedPlugin
public bool HasMainUi => plugin.DalamudInterface?.LocalUiBuilder.HasMainUi ?? false;
/// <inheritdoc/>
public bool HasConfigUi => plugin.DalamudInterface?.LocalUiBuilder.HasMainUi ?? false;
public bool HasConfigUi => plugin.DalamudInterface?.LocalUiBuilder.HasConfigUi ?? false;
/// <inheritdoc/>
public void OpenMainUi()