mirror of
https://github.com/xivdev/Penumbra.git
synced 2026-01-02 05:43:42 +01:00
tmp
This commit is contained in:
parent
3c564add0e
commit
73e2793da6
48 changed files with 4231 additions and 456 deletions
|
|
@ -16,7 +16,8 @@ using Penumbra.Collections;
|
|||
using Penumbra.String;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Api;
|
||||
|
||||
public class IpcTester : IDisposable
|
||||
|
|
@ -458,17 +459,17 @@ public class IpcTester : IDisposable
|
|||
}
|
||||
|
||||
DrawIntro( Ipc.RedrawObject.Label, "Redraw Player Character" );
|
||||
if( ImGui.Button( "Redraw##pc" ) && Dalamud.ClientState.LocalPlayer != null )
|
||||
if( ImGui.Button( "Redraw##pc" ) && DalamudServices.ClientState.LocalPlayer != null )
|
||||
{
|
||||
Ipc.RedrawObject.Subscriber( _pi ).Invoke( Dalamud.ClientState.LocalPlayer, RedrawType.Redraw );
|
||||
Ipc.RedrawObject.Subscriber( _pi ).Invoke( DalamudServices.ClientState.LocalPlayer, RedrawType.Redraw );
|
||||
}
|
||||
|
||||
DrawIntro( Ipc.RedrawObjectByIndex.Label, "Redraw by Index" );
|
||||
var tmp = _redrawIndex;
|
||||
ImGui.SetNextItemWidth( 100 * ImGuiHelpers.GlobalScale );
|
||||
if( ImGui.DragInt( "##redrawIndex", ref tmp, 0.1f, 0, Dalamud.Objects.Length ) )
|
||||
if( ImGui.DragInt( "##redrawIndex", ref tmp, 0.1f, 0, DalamudServices.Objects.Length ) )
|
||||
{
|
||||
_redrawIndex = Math.Clamp( tmp, 0, Dalamud.Objects.Length );
|
||||
_redrawIndex = Math.Clamp( tmp, 0, DalamudServices.Objects.Length );
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
|
@ -489,12 +490,12 @@ public class IpcTester : IDisposable
|
|||
|
||||
private void SetLastRedrawn( IntPtr address, int index )
|
||||
{
|
||||
if( index < 0 || index > Dalamud.Objects.Length || address == IntPtr.Zero || Dalamud.Objects[ index ]?.Address != address )
|
||||
if( index < 0 || index > DalamudServices.Objects.Length || address == IntPtr.Zero || DalamudServices.Objects[ index ]?.Address != address )
|
||||
{
|
||||
_lastRedrawnString = "Invalid";
|
||||
}
|
||||
|
||||
_lastRedrawnString = $"{Dalamud.Objects[ index ]!.Name} (0x{address:X}, {index})";
|
||||
_lastRedrawnString = $"{DalamudServices.Objects[ index ]!.Name} (0x{address:X}, {index})";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ using Penumbra.Api.Enums;
|
|||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.String;
|
||||
using Penumbra.String.Classes;
|
||||
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Api;
|
||||
|
||||
public class PenumbraApi : IDisposable, IPenumbraApi
|
||||
|
|
@ -84,9 +85,9 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
public unsafe PenumbraApi( Penumbra penumbra )
|
||||
{
|
||||
_penumbra = penumbra;
|
||||
_lumina = ( Lumina.GameData? )Dalamud.GameData.GetType()
|
||||
_lumina = ( Lumina.GameData? )DalamudServices.GameData.GetType()
|
||||
.GetField( "gameData", BindingFlags.Instance | BindingFlags.NonPublic )
|
||||
?.GetValue( Dalamud.GameData );
|
||||
?.GetValue( DalamudServices.GameData );
|
||||
foreach( var collection in Penumbra.CollectionManager )
|
||||
{
|
||||
SubscribeToCollection( collection );
|
||||
|
|
@ -889,12 +890,12 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
{
|
||||
CheckInitialized();
|
||||
|
||||
if( actorIndex < 0 || actorIndex >= Dalamud.Objects.Length )
|
||||
if( actorIndex < 0 || actorIndex >= DalamudServices.Objects.Length )
|
||||
{
|
||||
return PenumbraApiEc.InvalidArgument;
|
||||
}
|
||||
|
||||
var identifier = Penumbra.Actors.FromObject( Dalamud.Objects[ actorIndex ], false, false, true );
|
||||
var identifier = Penumbra.Actors.FromObject( DalamudServices.Objects[ actorIndex ], false, false, true );
|
||||
if( !identifier.IsValid )
|
||||
{
|
||||
return PenumbraApiEc.InvalidArgument;
|
||||
|
|
@ -1064,12 +1065,12 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
private static unsafe bool AssociatedCollection( int gameObjectIdx, out ModCollection collection )
|
||||
{
|
||||
collection = Penumbra.CollectionManager.Default;
|
||||
if( gameObjectIdx < 0 || gameObjectIdx >= Dalamud.Objects.Length )
|
||||
if( gameObjectIdx < 0 || gameObjectIdx >= DalamudServices.Objects.Length )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var ptr = ( FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* )Dalamud.Objects.GetObjectAddress( gameObjectIdx );
|
||||
var ptr = ( FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* )DalamudServices.Objects.GetObjectAddress( gameObjectIdx );
|
||||
var data = PathResolver.IdentifyCollection( ptr, false );
|
||||
if( data.Valid )
|
||||
{
|
||||
|
|
@ -1082,12 +1083,12 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
[MethodImpl( MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization )]
|
||||
private static unsafe ActorIdentifier AssociatedIdentifier( int gameObjectIdx )
|
||||
{
|
||||
if( gameObjectIdx < 0 || gameObjectIdx >= Dalamud.Objects.Length )
|
||||
if( gameObjectIdx < 0 || gameObjectIdx >= DalamudServices.Objects.Length )
|
||||
{
|
||||
return ActorIdentifier.Invalid;
|
||||
}
|
||||
|
||||
var ptr = ( FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* )Dalamud.Objects.GetObjectAddress( gameObjectIdx );
|
||||
var ptr = ( FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject* )DalamudServices.Objects.GetObjectAddress( gameObjectIdx );
|
||||
return Penumbra.Actors.FromObject( ptr, out _, false, true, true );
|
||||
}
|
||||
|
||||
|
|
@ -1116,7 +1117,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
|||
return _lumina?.GetFileFromDisk< T >( resolvedPath );
|
||||
}
|
||||
|
||||
return Dalamud.GameData.GetFile< T >( resolvedPath );
|
||||
return DalamudServices.GameData.GetFile< T >( resolvedPath );
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue