Use IndividualCollections in PathResolver.

This commit is contained in:
Ottermandias 2022-11-17 15:22:31 +01:00
parent f8c0702432
commit 6a6eac1c3b
10 changed files with 128 additions and 245 deletions

View file

@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Dalamud.Game.ClientState.Objects.Enums;
using FFXIVClientStructs.FFXIV.Client.Game.Character;
using Newtonsoft.Json.Linq;
using Penumbra.String;
@ -38,7 +37,7 @@ public readonly struct ActorIdentifier : IEquatable<ActorIdentifier>
IdentifierType.Player => HomeWorld == other.HomeWorld && PlayerName.EqualsCi(other.PlayerName),
IdentifierType.Owned => HomeWorld == other.HomeWorld && PlayerName.EqualsCi(other.PlayerName) && Manager.DataIdEquals(this, other),
IdentifierType.Special => Special == other.Special,
IdentifierType.Npc => Index == other.Index && DataId == other.DataId && Manager.DataIdEquals(this, other),
IdentifierType.Npc => Manager.DataIdEquals(this, other) && (Index == other.Index || Index == ushort.MaxValue || other.Index == ushort.MaxValue),
_ => false,
};
}
@ -75,7 +74,7 @@ public readonly struct ActorIdentifier : IEquatable<ActorIdentifier>
IdentifierType.Player => HashCode.Combine(IdentifierType.Player, PlayerName, HomeWorld),
IdentifierType.Owned => HashCode.Combine(IdentifierType.Owned, Kind, PlayerName, HomeWorld, DataId),
IdentifierType.Special => HashCode.Combine(IdentifierType.Special, Special),
IdentifierType.Npc => HashCode.Combine(IdentifierType.Npc, Kind, Index, DataId),
IdentifierType.Npc => HashCode.Combine(IdentifierType.Npc, Kind, DataId),
_ => 0,
};

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Dalamud;
@ -70,7 +69,10 @@ public sealed partial class ActorManager : DataSharer
public unsafe ActorIdentifier GetCurrentPlayer()
{
var address = (Character*)(_objects[0]?.Address ?? IntPtr.Zero);
return address == null ? ActorIdentifier.Invalid : CreatePlayer(new ByteString(address->GameObject.Name), address->HomeWorld);
return address == null
? ActorIdentifier.Invalid
: CreateIndividualUnchecked(IdentifierType.Player, new ByteString(address->GameObject.Name), address->HomeWorld,
ObjectKind.None, uint.MaxValue);
}
public ActorIdentifier GetInspectPlayer()