mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Some more general cleanup.
This commit is contained in:
parent
44fc83784d
commit
3679b780cf
13 changed files with 116 additions and 111 deletions
|
|
@ -7,7 +7,7 @@ namespace Penumbra.GameData.Enums
|
||||||
{
|
{
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
MainHand = 1,
|
MainHand = 1,
|
||||||
Offhand = 2,
|
OffHand = 2,
|
||||||
Head = 3,
|
Head = 3,
|
||||||
Body = 4,
|
Body = 4,
|
||||||
Hands = 5,
|
Hands = 5,
|
||||||
|
|
@ -17,9 +17,9 @@ namespace Penumbra.GameData.Enums
|
||||||
Ears = 9,
|
Ears = 9,
|
||||||
Neck = 10,
|
Neck = 10,
|
||||||
Wrists = 11,
|
Wrists = 11,
|
||||||
RingR = 12,
|
RFinger = 12,
|
||||||
BothHand = 13,
|
BothHand = 13,
|
||||||
RingL = 14, // Not officially existing, means "weapon could be equipped in either hand" for the game.
|
LFinger = 14, // Not officially existing, means "weapon could be equipped in either hand" for the game.
|
||||||
HeadBody = 15,
|
HeadBody = 15,
|
||||||
BodyHandsLegsFeet = 16,
|
BodyHandsLegsFeet = 16,
|
||||||
SoulCrystal = 17,
|
SoulCrystal = 17,
|
||||||
|
|
@ -36,17 +36,17 @@ namespace Penumbra.GameData.Enums
|
||||||
{
|
{
|
||||||
return value switch
|
return value switch
|
||||||
{
|
{
|
||||||
EquipSlot.Head => "met",
|
EquipSlot.Head => "met",
|
||||||
EquipSlot.Hands => "glv",
|
EquipSlot.Hands => "glv",
|
||||||
EquipSlot.Legs => "dwn",
|
EquipSlot.Legs => "dwn",
|
||||||
EquipSlot.Feet => "sho",
|
EquipSlot.Feet => "sho",
|
||||||
EquipSlot.Body => "top",
|
EquipSlot.Body => "top",
|
||||||
EquipSlot.Ears => "ear",
|
EquipSlot.Ears => "ear",
|
||||||
EquipSlot.Neck => "nek",
|
EquipSlot.Neck => "nek",
|
||||||
EquipSlot.RingR => "rir",
|
EquipSlot.RFinger => "rir",
|
||||||
EquipSlot.RingL => "ril",
|
EquipSlot.LFinger => "ril",
|
||||||
EquipSlot.Wrists => "wrs",
|
EquipSlot.Wrists => "wrs",
|
||||||
_ => throw new InvalidEnumArgumentException(),
|
_ => throw new InvalidEnumArgumentException(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace Penumbra.GameData.Enums
|
||||||
return value switch
|
return value switch
|
||||||
{
|
{
|
||||||
EquipSlot.MainHand => EquipSlot.MainHand,
|
EquipSlot.MainHand => EquipSlot.MainHand,
|
||||||
EquipSlot.Offhand => EquipSlot.Offhand,
|
EquipSlot.OffHand => EquipSlot.OffHand,
|
||||||
EquipSlot.Head => EquipSlot.Head,
|
EquipSlot.Head => EquipSlot.Head,
|
||||||
EquipSlot.Body => EquipSlot.Body,
|
EquipSlot.Body => EquipSlot.Body,
|
||||||
EquipSlot.Hands => EquipSlot.Hands,
|
EquipSlot.Hands => EquipSlot.Hands,
|
||||||
|
|
@ -65,9 +65,9 @@ namespace Penumbra.GameData.Enums
|
||||||
EquipSlot.Ears => EquipSlot.Ears,
|
EquipSlot.Ears => EquipSlot.Ears,
|
||||||
EquipSlot.Neck => EquipSlot.Neck,
|
EquipSlot.Neck => EquipSlot.Neck,
|
||||||
EquipSlot.Wrists => EquipSlot.Wrists,
|
EquipSlot.Wrists => EquipSlot.Wrists,
|
||||||
EquipSlot.RingR => EquipSlot.RingR,
|
EquipSlot.RFinger => EquipSlot.RFinger,
|
||||||
EquipSlot.BothHand => EquipSlot.MainHand,
|
EquipSlot.BothHand => EquipSlot.MainHand,
|
||||||
EquipSlot.RingL => EquipSlot.RingR,
|
EquipSlot.LFinger => EquipSlot.RFinger,
|
||||||
EquipSlot.HeadBody => EquipSlot.Body,
|
EquipSlot.HeadBody => EquipSlot.Body,
|
||||||
EquipSlot.BodyHandsLegsFeet => EquipSlot.Body,
|
EquipSlot.BodyHandsLegsFeet => EquipSlot.Body,
|
||||||
EquipSlot.SoulCrystal => EquipSlot.SoulCrystal,
|
EquipSlot.SoulCrystal => EquipSlot.SoulCrystal,
|
||||||
|
|
@ -96,12 +96,12 @@ namespace Penumbra.GameData.Enums
|
||||||
{
|
{
|
||||||
return value switch
|
return value switch
|
||||||
{
|
{
|
||||||
EquipSlot.Ears => true,
|
EquipSlot.Ears => true,
|
||||||
EquipSlot.Neck => true,
|
EquipSlot.Neck => true,
|
||||||
EquipSlot.RingR => true,
|
EquipSlot.RFinger => true,
|
||||||
EquipSlot.RingL => true,
|
EquipSlot.LFinger => true,
|
||||||
EquipSlot.Wrists => true,
|
EquipSlot.Wrists => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,8 +117,8 @@ namespace Penumbra.GameData.Enums
|
||||||
{ EquipSlot.Body.ToSuffix(), EquipSlot.Body },
|
{ EquipSlot.Body.ToSuffix(), EquipSlot.Body },
|
||||||
{ EquipSlot.Ears.ToSuffix(), EquipSlot.Ears },
|
{ EquipSlot.Ears.ToSuffix(), EquipSlot.Ears },
|
||||||
{ EquipSlot.Neck.ToSuffix(), EquipSlot.Neck },
|
{ EquipSlot.Neck.ToSuffix(), EquipSlot.Neck },
|
||||||
{ EquipSlot.RingR.ToSuffix(), EquipSlot.RingR },
|
{ EquipSlot.RFinger.ToSuffix(), EquipSlot.RFinger },
|
||||||
{ EquipSlot.RingL.ToSuffix(), EquipSlot.RingL },
|
{ EquipSlot.LFinger.ToSuffix(), EquipSlot.LFinger },
|
||||||
{ EquipSlot.Wrists.ToSuffix(), EquipSlot.Wrists },
|
{ EquipSlot.Wrists.ToSuffix(), EquipSlot.Wrists },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ namespace Penumbra.GameData
|
||||||
switch( ( EquipSlot )item.EquipSlotCategory.Row )
|
switch( ( EquipSlot )item.EquipSlotCategory.Row )
|
||||||
{
|
{
|
||||||
case EquipSlot.MainHand:
|
case EquipSlot.MainHand:
|
||||||
case EquipSlot.Offhand:
|
case EquipSlot.OffHand:
|
||||||
case EquipSlot.BothHand:
|
case EquipSlot.BothHand:
|
||||||
if( item.ModelMain != 0 )
|
if( item.ModelMain != 0 )
|
||||||
{
|
{
|
||||||
|
|
@ -88,7 +88,7 @@ namespace Penumbra.GameData
|
||||||
|
|
||||||
break;
|
break;
|
||||||
// Accessories
|
// Accessories
|
||||||
case EquipSlot.RingR:
|
case EquipSlot.RFinger:
|
||||||
case EquipSlot.Wrists:
|
case EquipSlot.Wrists:
|
||||||
case EquipSlot.Ears:
|
case EquipSlot.Ears:
|
||||||
case EquipSlot.Neck:
|
case EquipSlot.Neck:
|
||||||
|
|
@ -304,7 +304,7 @@ namespace Penumbra.GameData
|
||||||
switch( slot )
|
switch( slot )
|
||||||
{
|
{
|
||||||
case EquipSlot.MainHand:
|
case EquipSlot.MainHand:
|
||||||
case EquipSlot.Offhand:
|
case EquipSlot.OffHand:
|
||||||
{
|
{
|
||||||
var (begin, _) = FindIndexRange( _weapons, ( ( ulong )setId << 32 ) | ( ( ulong )weaponType << 16 ) | variant,
|
var (begin, _) = FindIndexRange( _weapons, ( ( ulong )setId << 32 ) | ( ( ulong )weaponType << 16 ) | variant,
|
||||||
0xFFFFFFFFFFFF );
|
0xFFFFFFFFFFFF );
|
||||||
|
|
|
||||||
15
Penumbra.GameData/Structs/ActorArmor.cs
Normal file
15
Penumbra.GameData/Structs/ActorArmor.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Penumbra.GameData.Structs
|
||||||
|
{
|
||||||
|
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
||||||
|
public readonly struct ActorArmor
|
||||||
|
{
|
||||||
|
public readonly SetId Set;
|
||||||
|
public readonly byte Variant;
|
||||||
|
public readonly StainId Stain;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
=> $"{Set},{Variant},{Stain}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,81 +1,82 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Dalamud.Game.ClientState.Actors.Types;
|
using Dalamud.Game.ClientState.Actors.Types;
|
||||||
|
using Penumbra.GameData.Enums;
|
||||||
|
|
||||||
// Read the customization data regarding weapons and displayable equipment from an actor struct.
|
// Read the customization data regarding weapons and displayable equipment from an actor struct.
|
||||||
// Stores the data in a 56 bytes, i.e. 7 longs for easier comparison.
|
// Stores the data in a 56 bytes, i.e. 7 longs for easier comparison.
|
||||||
namespace Penumbra.GameData.Structs
|
namespace Penumbra.GameData.Structs
|
||||||
{
|
{
|
||||||
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
||||||
public class CharEquipment
|
public class ActorEquipment
|
||||||
{
|
{
|
||||||
private const int MainWeaponOffset = 0x0F08;
|
public const int MainWeaponOffset = 0x0F08;
|
||||||
private const int OffWeaponOffset = 0x0F70;
|
public const int OffWeaponOffset = 0x0F70;
|
||||||
private const int EquipmentOffset = 0x1040;
|
public const int EquipmentOffset = 0x1040;
|
||||||
private const int EquipmentSlots = 10;
|
public const int EquipmentSlots = 10;
|
||||||
private const int WeaponSlots = 2;
|
public const int WeaponSlots = 2;
|
||||||
|
|
||||||
public readonly ActorWeapon Mainhand;
|
public ActorWeapon MainHand;
|
||||||
public readonly ActorWeapon Offhand;
|
public ActorWeapon OffHand;
|
||||||
public readonly ActorEquip Head;
|
public ActorArmor Head;
|
||||||
public readonly ActorEquip Body;
|
public ActorArmor Body;
|
||||||
public readonly ActorEquip Hands;
|
public ActorArmor Hands;
|
||||||
public readonly ActorEquip Legs;
|
public ActorArmor Legs;
|
||||||
public readonly ActorEquip Feet;
|
public ActorArmor Feet;
|
||||||
public readonly ActorEquip Ear;
|
public ActorArmor Ears;
|
||||||
public readonly ActorEquip Neck;
|
public ActorArmor Neck;
|
||||||
public readonly ActorEquip Wrist;
|
public ActorArmor Wrists;
|
||||||
public readonly ActorEquip RFinger;
|
public ActorArmor RFinger;
|
||||||
public readonly ActorEquip LFinger;
|
public ActorArmor LFinger;
|
||||||
public readonly ushort IsSet; // Also fills struct size to 56, a multiple of 8.
|
public ushort IsSet; // Also fills struct size to 56, a multiple of 8.
|
||||||
|
|
||||||
public CharEquipment()
|
public ActorEquipment()
|
||||||
=> Clear();
|
=> Clear();
|
||||||
|
|
||||||
public CharEquipment( Actor actor )
|
public ActorEquipment( Actor actor )
|
||||||
: this( actor.Address )
|
: this( actor.Address )
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
=> IsSet == 0
|
=> IsSet == 0
|
||||||
? "(Not Set)"
|
? "(Not Set)"
|
||||||
: $"({Mainhand}) | ({Offhand}) | ({Head}) | ({Body}) | ({Hands}) | ({Legs}) | "
|
: $"({MainHand}) | ({OffHand}) | ({Head}) | ({Body}) | ({Hands}) | ({Legs}) | "
|
||||||
+ $"({Feet}) | ({Ear}) | ({Neck}) | ({Wrist}) | ({LFinger}) | ({RFinger})";
|
+ $"({Feet}) | ({Ears}) | ({Neck}) | ({Wrists}) | ({LFinger}) | ({RFinger})";
|
||||||
|
|
||||||
public bool Equal( Actor rhs )
|
public bool Equal( Actor rhs )
|
||||||
=> CompareData( new CharEquipment( rhs ) );
|
=> CompareData( new ActorEquipment( rhs ) );
|
||||||
|
|
||||||
public bool Equal( CharEquipment rhs )
|
public bool Equal( ActorEquipment rhs )
|
||||||
=> CompareData( rhs );
|
=> CompareData( rhs );
|
||||||
|
|
||||||
public bool CompareAndUpdate( Actor rhs )
|
public bool CompareAndUpdate( Actor rhs )
|
||||||
=> CompareAndOverwrite( new CharEquipment( rhs ) );
|
=> CompareAndOverwrite( new ActorEquipment( rhs ) );
|
||||||
|
|
||||||
public bool CompareAndUpdate( CharEquipment rhs )
|
public bool CompareAndUpdate( ActorEquipment rhs )
|
||||||
=> CompareAndOverwrite( rhs );
|
=> CompareAndOverwrite( rhs );
|
||||||
|
|
||||||
private unsafe CharEquipment( IntPtr actorAddress )
|
private unsafe ActorEquipment( IntPtr actorAddress )
|
||||||
{
|
{
|
||||||
IsSet = 1;
|
IsSet = 1;
|
||||||
var actorPtr = ( byte* )actorAddress.ToPointer();
|
var actorPtr = ( byte* )actorAddress.ToPointer();
|
||||||
fixed( ActorWeapon* main = &Mainhand, off = &Offhand )
|
fixed( ActorWeapon* main = &MainHand, off = &OffHand )
|
||||||
{
|
{
|
||||||
Buffer.MemoryCopy( actorPtr + MainWeaponOffset, main, sizeof( ActorWeapon ), sizeof( ActorWeapon ) );
|
Buffer.MemoryCopy( actorPtr + MainWeaponOffset, main, sizeof( ActorWeapon ), sizeof( ActorWeapon ) );
|
||||||
Buffer.MemoryCopy( actorPtr + OffWeaponOffset, off, sizeof( ActorWeapon ), sizeof( ActorWeapon ) );
|
Buffer.MemoryCopy( actorPtr + OffWeaponOffset, off, sizeof( ActorWeapon ), sizeof( ActorWeapon ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed( ActorEquip* equipment = &Head )
|
fixed( ActorArmor* equipment = &Head )
|
||||||
{
|
{
|
||||||
Buffer.MemoryCopy( actorPtr + EquipmentOffset, equipment, EquipmentSlots * sizeof( ActorEquip ),
|
Buffer.MemoryCopy( actorPtr + EquipmentOffset, equipment, EquipmentSlots * sizeof( ActorArmor ),
|
||||||
EquipmentSlots * sizeof( ActorEquip ) );
|
EquipmentSlots * sizeof( ActorArmor ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe void Clear()
|
public unsafe void Clear()
|
||||||
{
|
{
|
||||||
fixed( ActorWeapon* main = &Mainhand )
|
fixed( ActorWeapon* main = &MainHand )
|
||||||
{
|
{
|
||||||
var structSizeEights = ( 2 + EquipmentSlots * sizeof( ActorEquip ) + WeaponSlots * sizeof( ActorWeapon ) ) / 8;
|
var structSizeEights = ( 2 + EquipmentSlots * sizeof( ActorArmor ) + WeaponSlots * sizeof( ActorWeapon ) ) / 8;
|
||||||
for( ulong* ptr = ( ulong* )main, end = ptr + structSizeEights; ptr != end; ++ptr )
|
for( ulong* ptr = ( ulong* )main, end = ptr + structSizeEights; ptr != end; ++ptr )
|
||||||
{
|
{
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
|
|
@ -83,11 +84,11 @@ namespace Penumbra.GameData.Structs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe bool CompareAndOverwrite( CharEquipment rhs )
|
private unsafe bool CompareAndOverwrite( ActorEquipment rhs )
|
||||||
{
|
{
|
||||||
var structSizeEights = ( 2 + EquipmentSlots * sizeof( ActorEquip ) + WeaponSlots * sizeof( ActorWeapon ) ) / 8;
|
var structSizeEights = ( 2 + EquipmentSlots * sizeof( ActorArmor ) + WeaponSlots * sizeof( ActorWeapon ) ) / 8;
|
||||||
var ret = true;
|
var ret = true;
|
||||||
fixed( ActorWeapon* data1 = &Mainhand, data2 = &rhs.Mainhand )
|
fixed( ActorWeapon* data1 = &MainHand, data2 = &rhs.MainHand )
|
||||||
{
|
{
|
||||||
var ptr1 = ( ulong* )data1;
|
var ptr1 = ( ulong* )data1;
|
||||||
var ptr2 = ( ulong* )data2;
|
var ptr2 = ( ulong* )data2;
|
||||||
|
|
@ -104,10 +105,10 @@ namespace Penumbra.GameData.Structs
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe bool CompareData( CharEquipment rhs )
|
private unsafe bool CompareData( ActorEquipment rhs )
|
||||||
{
|
{
|
||||||
var structSizeEights = ( 2 + EquipmentSlots * sizeof( ActorEquip ) + WeaponSlots * sizeof( ActorWeapon ) ) / 8;
|
var structSizeEights = ( 2 + EquipmentSlots * sizeof( ActorArmor ) + WeaponSlots * sizeof( ActorWeapon ) ) / 8;
|
||||||
fixed( ActorWeapon* data1 = &Mainhand, data2 = &rhs.Mainhand )
|
fixed( ActorWeapon* data1 = &MainHand, data2 = &rhs.MainHand )
|
||||||
{
|
{
|
||||||
var ptr1 = ( ulong* )data1;
|
var ptr1 = ( ulong* )data1;
|
||||||
var ptr2 = ( ulong* )data2;
|
var ptr2 = ( ulong* )data2;
|
||||||
|
|
@ -2,17 +2,6 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Penumbra.GameData.Structs
|
namespace Penumbra.GameData.Structs
|
||||||
{
|
{
|
||||||
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
|
||||||
public readonly struct ActorEquip
|
|
||||||
{
|
|
||||||
public readonly SetId Set;
|
|
||||||
public readonly byte Variant;
|
|
||||||
public readonly StainId Stain;
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
=> $"{Set},{Variant},{Stain}";
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
[StructLayout( LayoutKind.Sequential, Pack = 1 )]
|
||||||
public readonly struct ActorWeapon
|
public readonly struct ActorWeapon
|
||||||
{
|
{
|
||||||
|
|
@ -63,8 +63,8 @@ namespace Penumbra.GameData.Structs
|
||||||
EquipSlot.Ears => 0,
|
EquipSlot.Ears => 0,
|
||||||
EquipSlot.Neck => 2,
|
EquipSlot.Neck => 2,
|
||||||
EquipSlot.Wrists => 4,
|
EquipSlot.Wrists => 4,
|
||||||
EquipSlot.RingR => 6,
|
EquipSlot.RFinger => 6,
|
||||||
EquipSlot.RingL => 8,
|
EquipSlot.LFinger => 8,
|
||||||
_ => throw new InvalidEnumArgumentException(),
|
_ => throw new InvalidEnumArgumentException(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -98,8 +98,8 @@ namespace Penumbra.GameData.Structs
|
||||||
EquipSlot.Ears => EqdpEntry.EarsMask,
|
EquipSlot.Ears => EqdpEntry.EarsMask,
|
||||||
EquipSlot.Neck => EqdpEntry.NeckMask,
|
EquipSlot.Neck => EqdpEntry.NeckMask,
|
||||||
EquipSlot.Wrists => EqdpEntry.WristsMask,
|
EquipSlot.Wrists => EqdpEntry.WristsMask,
|
||||||
EquipSlot.RingR => EqdpEntry.RingRMask,
|
EquipSlot.RFinger => EqdpEntry.RingRMask,
|
||||||
EquipSlot.RingL => EqdpEntry.RingLMask,
|
EquipSlot.LFinger => EqdpEntry.RingLMask,
|
||||||
_ => 0,
|
_ => 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,6 @@ namespace Penumbra.PlayerWatch
|
||||||
|
|
||||||
public void AddPlayerToWatch( string name );
|
public void AddPlayerToWatch( string name );
|
||||||
public void RemovePlayerFromWatch( string playerName );
|
public void RemovePlayerFromWatch( string playerName );
|
||||||
public CharEquipment UpdateActorWithoutEvent( Actor actor );
|
public ActorEquipment UpdateActorWithoutEvent( Actor actor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Penumbra.PlayerWatch
|
||||||
|
|
||||||
private readonly DalamudPluginInterface _pi;
|
private readonly DalamudPluginInterface _pi;
|
||||||
internal readonly HashSet< PlayerWatcher > RegisteredWatchers = new();
|
internal readonly HashSet< PlayerWatcher > RegisteredWatchers = new();
|
||||||
private readonly Dictionary< string, (CharEquipment, HashSet< PlayerWatcher >) > _equip = new();
|
private readonly Dictionary< string, (ActorEquipment, HashSet< PlayerWatcher >) > _equip = new();
|
||||||
private int _frameTicker;
|
private int _frameTicker;
|
||||||
private IntPtr _lastGPoseAddress = IntPtr.Zero;
|
private IntPtr _lastGPoseAddress = IntPtr.Zero;
|
||||||
|
|
||||||
|
|
@ -41,9 +41,9 @@ namespace Penumbra.PlayerWatch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal CharEquipment UpdateActorWithoutEvent( Actor actor )
|
internal ActorEquipment UpdateActorWithoutEvent( Actor actor )
|
||||||
{
|
{
|
||||||
var equipment = new CharEquipment( actor );
|
var equipment = new ActorEquipment( actor );
|
||||||
if( _equip.ContainsKey( actor.Name ) )
|
if( _equip.ContainsKey( actor.Name ) )
|
||||||
{
|
{
|
||||||
_equip[ actor.Name ] = ( equipment, _equip[ actor.Name ].Item2 );
|
_equip[ actor.Name ] = ( equipment, _equip[ actor.Name ].Item2 );
|
||||||
|
|
@ -60,7 +60,7 @@ namespace Penumbra.PlayerWatch
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_equip[ playerName ] = ( new CharEquipment(), new HashSet< PlayerWatcher > { watcher } );
|
_equip[ playerName ] = ( new ActorEquipment(), new HashSet< PlayerWatcher > { watcher } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ namespace Penumbra.PlayerWatch
|
||||||
_playerWatch!.RemovePlayerFromWatch( playerName, this );
|
_playerWatch!.RemovePlayerFromWatch( playerName, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharEquipment UpdateActorWithoutEvent( Actor actor )
|
public ActorEquipment UpdateActorWithoutEvent( Actor actor )
|
||||||
{
|
{
|
||||||
CheckValidity();
|
CheckValidity();
|
||||||
return _playerWatch!.UpdateActorWithoutEvent( actor );
|
return _playerWatch!.UpdateActorWithoutEvent( actor );
|
||||||
|
|
|
||||||
|
|
@ -111,9 +111,9 @@ namespace Penumbra.Meta.Files
|
||||||
EquipSlot.Hands => 2,
|
EquipSlot.Hands => 2,
|
||||||
EquipSlot.Wrists => 2,
|
EquipSlot.Wrists => 2,
|
||||||
EquipSlot.Legs => 3,
|
EquipSlot.Legs => 3,
|
||||||
EquipSlot.RingR => 3,
|
EquipSlot.RFinger => 3,
|
||||||
EquipSlot.Feet => 4,
|
EquipSlot.Feet => 4,
|
||||||
EquipSlot.RingL => 4,
|
EquipSlot.LFinger => 4,
|
||||||
_ => throw new InvalidEnumArgumentException(),
|
_ => throw new InvalidEnumArgumentException(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ namespace Penumbra.Meta.Files
|
||||||
EquipSlot.Neck => Eqdp( ObjectType.Accessory, gr ),
|
EquipSlot.Neck => Eqdp( ObjectType.Accessory, gr ),
|
||||||
EquipSlot.Ears => Eqdp( ObjectType.Accessory, gr ),
|
EquipSlot.Ears => Eqdp( ObjectType.Accessory, gr ),
|
||||||
EquipSlot.Wrists => Eqdp( ObjectType.Accessory, gr ),
|
EquipSlot.Wrists => Eqdp( ObjectType.Accessory, gr ),
|
||||||
EquipSlot.RingL => Eqdp( ObjectType.Accessory, gr ),
|
EquipSlot.LFinger => Eqdp( ObjectType.Accessory, gr ),
|
||||||
EquipSlot.RingR => Eqdp( ObjectType.Accessory, gr ),
|
EquipSlot.RFinger => Eqdp( ObjectType.Accessory, gr ),
|
||||||
_ => throw new NotImplementedException(),
|
_ => throw new NotImplementedException(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ namespace Penumbra.UI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var actors = ( Dictionary< string, CharEquipment >? )_plugin.PlayerWatcher.GetType()
|
var actors = ( Dictionary< string, ActorEquipment >? )_plugin.PlayerWatcher.GetType()
|
||||||
.GetField( "_equip", BindingFlags.Instance | BindingFlags.NonPublic )
|
.GetField( "_equip", BindingFlags.Instance | BindingFlags.NonPublic )
|
||||||
?.GetValue( _plugin.PlayerWatcher )
|
?.GetValue( _plugin.PlayerWatcher )
|
||||||
?? new Dictionary< string, CharEquipment >();
|
?? new Dictionary< string, ActorEquipment >();
|
||||||
if( !actors.Any() )
|
if( !actors.Any() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -48,7 +48,7 @@ namespace Penumbra.UI
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( actor.Key );
|
ImGui.Text( actor.Key );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( $"{actor.Value.Mainhand}" );
|
ImGui.Text( $"{actor.Value.MainHand}" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( $"{actor.Value.Head}" );
|
ImGui.Text( $"{actor.Value.Head}" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
|
@ -67,7 +67,7 @@ namespace Penumbra.UI
|
||||||
ImGui.Text( "(not set)" );
|
ImGui.Text( "(not set)" );
|
||||||
}
|
}
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( identifier.Identify( actor.Value.Mainhand.Set, actor.Value.Mainhand.Type, actor.Value.Mainhand.Variant, EquipSlot.MainHand )?.Name.ToString() ?? "Unknown" );
|
ImGui.Text( identifier.Identify( actor.Value.MainHand.Set, actor.Value.MainHand.Type, actor.Value.MainHand.Variant, EquipSlot.MainHand )?.Name.ToString() ?? "Unknown" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( identifier.Identify( actor.Value.Head.Set, actor.Value.Head.Variant, 0, EquipSlot.Head )?.Name.ToString() ?? "Unknown" );
|
ImGui.Text( identifier.Identify( actor.Value.Head.Set, actor.Value.Head.Variant, 0, EquipSlot.Head )?.Name.ToString() ?? "Unknown" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
|
@ -82,13 +82,13 @@ namespace Penumbra.UI
|
||||||
ImGui.TableNextRow();
|
ImGui.TableNextRow();
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( $"{actor.Value.Offhand}" );
|
ImGui.Text( $"{actor.Value.OffHand}" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( $"{actor.Value.Ear}" );
|
ImGui.Text( $"{actor.Value.Ears}" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( $"{actor.Value.Neck}" );
|
ImGui.Text( $"{actor.Value.Neck}" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( $"{actor.Value.Wrist}" );
|
ImGui.Text( $"{actor.Value.Wrists}" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( $"{actor.Value.LFinger}" );
|
ImGui.Text( $"{actor.Value.LFinger}" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
|
@ -97,17 +97,17 @@ namespace Penumbra.UI
|
||||||
ImGui.TableNextRow();
|
ImGui.TableNextRow();
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( identifier.Identify( actor.Value.Offhand.Set, actor.Value.Offhand.Type, actor.Value.Offhand.Variant, EquipSlot.Offhand )?.Name.ToString() ?? "Unknown" );
|
ImGui.Text( identifier.Identify( actor.Value.OffHand.Set, actor.Value.OffHand.Type, actor.Value.OffHand.Variant, EquipSlot.OffHand )?.Name.ToString() ?? "Unknown" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( identifier.Identify( actor.Value.Ear.Set, actor.Value.Ear.Variant, 0, EquipSlot.Ears )?.Name.ToString() ?? "Unknown" );
|
ImGui.Text( identifier.Identify( actor.Value.Ears.Set, actor.Value.Ears.Variant, 0, EquipSlot.Ears )?.Name.ToString() ?? "Unknown" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( identifier.Identify( actor.Value.Neck.Set, actor.Value.Neck.Variant, 0, EquipSlot.Neck )?.Name.ToString() ?? "Unknown" );
|
ImGui.Text( identifier.Identify( actor.Value.Neck.Set, actor.Value.Neck.Variant, 0, EquipSlot.Neck )?.Name.ToString() ?? "Unknown" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( identifier.Identify( actor.Value.Wrist.Set, actor.Value.Wrist.Variant, 0, EquipSlot.Wrists )?.Name.ToString() ?? "Unknown" );
|
ImGui.Text( identifier.Identify( actor.Value.Wrists.Set, actor.Value.Wrists.Variant, 0, EquipSlot.Wrists )?.Name.ToString() ?? "Unknown" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( identifier.Identify( actor.Value.LFinger.Set, actor.Value.LFinger.Variant, 0, EquipSlot.RingL )?.Name.ToString() ?? "Unknown" );
|
ImGui.Text( identifier.Identify( actor.Value.LFinger.Set, actor.Value.LFinger.Variant, 0, EquipSlot.LFinger )?.Name.ToString() ?? "Unknown" );
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.Text( identifier.Identify( actor.Value.RFinger.Set, actor.Value.RFinger.Variant, 0, EquipSlot.RingL )?.Name.ToString() ?? "Unknown" );
|
ImGui.Text( identifier.Identify( actor.Value.RFinger.Set, actor.Value.RFinger.Variant, 0, EquipSlot.LFinger )?.Name.ToString() ?? "Unknown" );
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ namespace Penumbra.UI
|
||||||
( "Ears", EquipSlot.Ears ),
|
( "Ears", EquipSlot.Ears ),
|
||||||
( "Neck", EquipSlot.Neck ),
|
( "Neck", EquipSlot.Neck ),
|
||||||
( "Wrist", EquipSlot.Wrists ),
|
( "Wrist", EquipSlot.Wrists ),
|
||||||
( "Left Finger", EquipSlot.RingL ),
|
( "Left Finger", EquipSlot.LFinger ),
|
||||||
( "Right Finger", EquipSlot.RingR ),
|
( "Right Finger", EquipSlot.RFinger ),
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly (string, Race)[] Races =
|
private static readonly (string, Race)[] Races =
|
||||||
|
|
@ -308,8 +308,8 @@ namespace Penumbra.UI
|
||||||
EquipSlot.Neck => ( entry.HasFlag( EqdpEntry.Neck1 ), entry.HasFlag( EqdpEntry.Neck2 ) ),
|
EquipSlot.Neck => ( entry.HasFlag( EqdpEntry.Neck1 ), entry.HasFlag( EqdpEntry.Neck2 ) ),
|
||||||
EquipSlot.Ears => ( entry.HasFlag( EqdpEntry.Ears1 ), entry.HasFlag( EqdpEntry.Ears2 ) ),
|
EquipSlot.Ears => ( entry.HasFlag( EqdpEntry.Ears1 ), entry.HasFlag( EqdpEntry.Ears2 ) ),
|
||||||
EquipSlot.Wrists => ( entry.HasFlag( EqdpEntry.Wrists1 ), entry.HasFlag( EqdpEntry.Wrists2 ) ),
|
EquipSlot.Wrists => ( entry.HasFlag( EqdpEntry.Wrists1 ), entry.HasFlag( EqdpEntry.Wrists2 ) ),
|
||||||
EquipSlot.RingR => ( entry.HasFlag( EqdpEntry.RingR1 ), entry.HasFlag( EqdpEntry.RingR2 ) ),
|
EquipSlot.RFinger => ( entry.HasFlag( EqdpEntry.RingR1 ), entry.HasFlag( EqdpEntry.RingR2 ) ),
|
||||||
EquipSlot.RingL => ( entry.HasFlag( EqdpEntry.RingL1 ), entry.HasFlag( EqdpEntry.RingL2 ) ),
|
EquipSlot.LFinger => ( entry.HasFlag( EqdpEntry.RingL1 ), entry.HasFlag( EqdpEntry.RingL2 ) ),
|
||||||
_ => ( false, false ),
|
_ => ( false, false ),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -350,11 +350,11 @@ namespace Penumbra.UI
|
||||||
value = bit1 ? value | EqdpEntry.Wrists1 : value & ~EqdpEntry.Wrists1;
|
value = bit1 ? value | EqdpEntry.Wrists1 : value & ~EqdpEntry.Wrists1;
|
||||||
value = bit2 ? value | EqdpEntry.Wrists2 : value & ~EqdpEntry.Wrists2;
|
value = bit2 ? value | EqdpEntry.Wrists2 : value & ~EqdpEntry.Wrists2;
|
||||||
return value;
|
return value;
|
||||||
case EquipSlot.RingR:
|
case EquipSlot.RFinger:
|
||||||
value = bit1 ? value | EqdpEntry.RingR1 : value & ~EqdpEntry.RingR1;
|
value = bit1 ? value | EqdpEntry.RingR1 : value & ~EqdpEntry.RingR1;
|
||||||
value = bit2 ? value | EqdpEntry.RingR2 : value & ~EqdpEntry.RingR2;
|
value = bit2 ? value | EqdpEntry.RingR2 : value & ~EqdpEntry.RingR2;
|
||||||
return value;
|
return value;
|
||||||
case EquipSlot.RingL:
|
case EquipSlot.LFinger:
|
||||||
value = bit1 ? value | EqdpEntry.RingL1 : value & ~EqdpEntry.RingL1;
|
value = bit1 ? value | EqdpEntry.RingL1 : value & ~EqdpEntry.RingL1;
|
||||||
value = bit2 ? value | EqdpEntry.RingL2 : value & ~EqdpEntry.RingL2;
|
value = bit2 ? value | EqdpEntry.RingL2 : value & ~EqdpEntry.RingL2;
|
||||||
return value;
|
return value;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue