punish v6.8.18.0
This commit is contained in:
commit
060278c1b7
317 changed files with 554155 additions and 0 deletions
53
LLib/LLib.GameUI/LAddon.cs
Normal file
53
LLib/LLib.GameUI/LAddon.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Dalamud.Game.NativeWrapper;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
|
||||
namespace LLib.GameUI;
|
||||
|
||||
public static class LAddon
|
||||
{
|
||||
private const int UnitListCount = 18;
|
||||
|
||||
public unsafe static AtkUnitBase* GetAddonById(uint id)
|
||||
{
|
||||
AtkUnitList* ptr = &AtkStage.Instance()->RaptureAtkUnitManager->AtkUnitManager.DepthLayerOneList;
|
||||
for (int i = 0; i < 18; i++)
|
||||
{
|
||||
AtkUnitList* ptr2 = ptr + i;
|
||||
foreach (int item in Enumerable.Range(0, Math.Min(ptr2->Count, ptr2->Entries.Length)))
|
||||
{
|
||||
AtkUnitBase* value = ptr2->Entries[item].Value;
|
||||
if (value != null && value->Id == id)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public unsafe static bool TryGetAddonByName<T>(this IGameGui gameGui, string addonName, out T* addonPtr) where T : unmanaged
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(gameGui, "gameGui");
|
||||
ArgumentException.ThrowIfNullOrEmpty(addonName, "addonName");
|
||||
AtkUnitBasePtr addonByName = gameGui.GetAddonByName(addonName);
|
||||
if (!addonByName.IsNull)
|
||||
{
|
||||
addonPtr = (T*)addonByName.Address;
|
||||
return true;
|
||||
}
|
||||
addonPtr = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public unsafe static bool IsAddonReady(AtkUnitBase* addon)
|
||||
{
|
||||
if (addon->IsVisible)
|
||||
{
|
||||
return addon->UldManager.LoadedState == AtkLoadState.Loaded;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
21
LLib/LLib.GameUI/LAtkValue.cs
Normal file
21
LLib/LLib.GameUI/LAtkValue.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using Dalamud.Memory;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
|
||||
namespace LLib.GameUI;
|
||||
|
||||
public static class LAtkValue
|
||||
{
|
||||
public unsafe static string? ReadAtkString(this AtkValue atkValue)
|
||||
{
|
||||
if (atkValue.Type == FFXIVClientStructs.FFXIV.Component.GUI.ValueType.Undefined)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (atkValue.String.HasValue)
|
||||
{
|
||||
return MemoryHelper.ReadSeStringNullTerminated(new IntPtr((byte*)atkValue.String)).WithCertainMacroCodeReplacements();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
16
LLib/LLib.GameUI/SeStringExtensions.cs
Normal file
16
LLib/LLib.GameUI/SeStringExtensions.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
namespace LLib.GameUI;
|
||||
|
||||
public static class SeStringExtensions
|
||||
{
|
||||
public static string WithCertainMacroCodeReplacements(this SeString? str)
|
||||
{
|
||||
if (str == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return new ReadOnlySeString(str.Encode()).WithCertainMacroCodeReplacements();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue