mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-20 23:07:43 +01:00
Merge remote-tracking branch 'origin/master' into api14-rollup
This commit is contained in:
commit
63b7ecf0d7
71 changed files with 1283 additions and 312 deletions
|
|
@ -77,7 +77,7 @@ internal partial class ChatHandlers : IServiceType
|
|||
}
|
||||
|
||||
// For injections while logged in
|
||||
if (clientState.LocalPlayer != null && clientState.TerritoryType == 0 && !this.hasSeenLoadingMsg)
|
||||
if (clientState.IsLoggedIn && clientState.TerritoryType == 0 && !this.hasSeenLoadingMsg)
|
||||
this.PrintWelcomeMessage();
|
||||
|
||||
#if !DEBUG && false
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
|
@ -22,7 +23,7 @@ namespace Dalamud.Game.ClientState.Aetherytes;
|
|||
internal sealed unsafe partial class AetheryteList : IServiceType, IAetheryteList
|
||||
{
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly ClientState clientState = Service<ClientState>.Get();
|
||||
private readonly ObjectTable objectTable = Service<ObjectTable>.Get();
|
||||
|
||||
private readonly Telepo* telepoInstance = Telepo.Instance();
|
||||
|
||||
|
|
@ -37,7 +38,7 @@ internal sealed unsafe partial class AetheryteList : IServiceType, IAetheryteLis
|
|||
{
|
||||
get
|
||||
{
|
||||
if (this.clientState.LocalPlayer == null)
|
||||
if (this.objectTable.LocalPlayer == null)
|
||||
return 0;
|
||||
|
||||
this.Update();
|
||||
|
|
@ -59,7 +60,7 @@ internal sealed unsafe partial class AetheryteList : IServiceType, IAetheryteLis
|
|||
return null;
|
||||
}
|
||||
|
||||
if (this.clientState.LocalPlayer == null)
|
||||
if (this.objectTable.LocalPlayer == null)
|
||||
return null;
|
||||
|
||||
return new AetheryteEntry(this.telepoInstance->TeleportList[index]);
|
||||
|
|
@ -69,7 +70,7 @@ internal sealed unsafe partial class AetheryteList : IServiceType, IAetheryteLis
|
|||
private void Update()
|
||||
{
|
||||
// this is very very important as otherwise it crashes
|
||||
if (this.clientState.LocalPlayer == null)
|
||||
if (this.objectTable.LocalPlayer == null)
|
||||
return;
|
||||
|
||||
this.telepoInstance->UpdateAetheryteList();
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using CSBuddy = FFXIVClientStructs.FFXIV.Client.Game.UI.Buddy;
|
||||
using CSUIState = FFXIVClientStructs.FFXIV.Client.Game.UI.UIState;
|
||||
|
||||
using CSBuddy = FFXIVClientStructs.FFXIV.Client.Game.UI.Buddy;
|
||||
using CSBuddyMember = FFXIVClientStructs.FFXIV.Client.Game.UI.Buddy.BuddyMember;
|
||||
|
|
@ -27,7 +29,7 @@ internal sealed partial class BuddyList : IServiceType, IBuddyList
|
|||
private const uint InvalidEntityId = 0xE0000000;
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly ClientState clientState = Service<ClientState>.Get();
|
||||
private readonly PlayerState playerState = Service<PlayerState>.Get();
|
||||
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private BuddyList()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using Dalamud.Game.ClientState.Objects;
|
|||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Game.Network.Internal;
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
|
|
@ -15,7 +16,6 @@ using Dalamud.Utility;
|
|||
|
||||
using FFXIVClientStructs.FFXIV.Application.Network;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.Network;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
|
|
@ -23,6 +23,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
|||
using Lumina.Excel.Sheets;
|
||||
|
||||
using Action = System.Action;
|
||||
using CSUIState = FFXIVClientStructs.FFXIV.Client.Game.UI.UIState;
|
||||
|
||||
namespace Dalamud.Game.ClientState;
|
||||
|
||||
|
|
@ -46,6 +47,12 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
|||
[ServiceManager.ServiceDependency]
|
||||
private readonly NetworkHandlers networkHandlers = Service<NetworkHandlers>.Get();
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly PlayerState playerState = Service<PlayerState>.Get();
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly ObjectTable objectTable = Service<ObjectTable>.Get();
|
||||
|
||||
private Hook<LogoutCallbackInterface.Delegates.OnLogout> onLogoutHook;
|
||||
private bool initialized;
|
||||
private ushort territoryTypeId;
|
||||
|
|
@ -184,10 +191,10 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
|||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IPlayerCharacter? LocalPlayer => Service<ObjectTable>.GetNullable()?[0] as IPlayerCharacter;
|
||||
public IPlayerCharacter? LocalPlayer => this.objectTable.LocalPlayer;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public unsafe ulong LocalContentId => PlayerState.Instance()->ContentId;
|
||||
public unsafe ulong LocalContentId => this.playerState.ContentId;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public unsafe bool IsLoggedIn
|
||||
|
|
@ -241,7 +248,7 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
|||
public bool IsClientIdle(out ConditionFlag blockingFlag)
|
||||
{
|
||||
blockingFlag = 0;
|
||||
if (this.LocalPlayer is null) return true;
|
||||
if (this.objectTable.LocalPlayer is null) return true;
|
||||
|
||||
var condition = Service<Conditions.Condition>.GetNullable();
|
||||
|
||||
|
|
@ -280,7 +287,7 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
|||
|
||||
this.TerritoryType = (ushort)GameMain.Instance()->CurrentTerritoryTypeId;
|
||||
this.MapId = AgentMap.Instance()->CurrentMapId;
|
||||
this.Instance = UIState.Instance()->PublicInstance.InstanceId;
|
||||
this.Instance = CSUIState.Instance()->PublicInstance.InstanceId;
|
||||
|
||||
this.initialized = true;
|
||||
|
||||
|
|
@ -369,7 +376,7 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
|||
if (condition == null || gameGui == null || data == null)
|
||||
return;
|
||||
|
||||
if (condition.Any() && this.lastConditionNone && this.LocalPlayer != null)
|
||||
if (condition.Any() && this.lastConditionNone && this.objectTable.LocalPlayer != null)
|
||||
{
|
||||
Log.Debug("Is login");
|
||||
this.lastConditionNone = false;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Numerics;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Memory;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
|
@ -61,15 +62,11 @@ internal sealed partial class FateTable : IServiceType, IFateTable
|
|||
/// <inheritdoc/>
|
||||
public bool IsValid(IFate fate)
|
||||
{
|
||||
var clientState = Service<ClientState>.GetNullable();
|
||||
|
||||
if (fate == null || clientState == null)
|
||||
if (fate == null)
|
||||
return false;
|
||||
|
||||
if (clientState.LocalContentId == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
var playerState = Service<PlayerState>.Get();
|
||||
return playerState.IsLoaded == true;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
|
|||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
|
@ -29,14 +30,14 @@ internal sealed partial class ObjectTable : IServiceType, IObjectTable
|
|||
{
|
||||
private static int objectTableLength;
|
||||
|
||||
private readonly ClientState clientState;
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly PlayerState playerState = Service<PlayerState>.Get();
|
||||
|
||||
private readonly CachedEntry[] cachedObjectTable;
|
||||
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private unsafe ObjectTable(ClientState clientState)
|
||||
private unsafe ObjectTable()
|
||||
{
|
||||
this.clientState = clientState;
|
||||
|
||||
var nativeObjectTable = CSGameObjectManager.Instance()->Objects.IndexSorted;
|
||||
objectTableLength = nativeObjectTable.Length;
|
||||
|
||||
|
|
@ -59,6 +60,9 @@ internal sealed partial class ObjectTable : IServiceType, IObjectTable
|
|||
/// <inheritdoc/>
|
||||
public int Length => objectTableLength;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IPlayerCharacter? LocalPlayer => this[0] as IPlayerCharacter;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<IBattleChara> PlayerObjects => this.GetPlayerObjects();
|
||||
|
||||
|
|
@ -135,10 +139,10 @@ internal sealed partial class ObjectTable : IServiceType, IObjectTable
|
|||
{
|
||||
ThreadSafety.AssertMainThread();
|
||||
|
||||
if (this.clientState.LocalContentId == 0)
|
||||
if (address == nint.Zero)
|
||||
return null;
|
||||
|
||||
if (address == nint.Zero)
|
||||
if (!this.playerState.IsLoaded)
|
||||
return null;
|
||||
|
||||
var obj = (CSGameObject*)address;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Memory;
|
||||
|
||||
namespace Dalamud.Game.ClientState.Objects.Types;
|
||||
|
||||
|
|
@ -170,15 +169,11 @@ internal partial class GameObject
|
|||
/// <returns>True or false.</returns>
|
||||
public static bool IsValid(IGameObject? actor)
|
||||
{
|
||||
var clientState = Service<ClientState>.GetNullable();
|
||||
|
||||
if (actor is null || clientState == null)
|
||||
if (actor == null)
|
||||
return false;
|
||||
|
||||
if (clientState.LocalContentId == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
var playerState = Service<PlayerState>.Get();
|
||||
return playerState.IsLoaded == true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
|
@ -26,7 +27,7 @@ internal sealed unsafe partial class PartyList : IServiceType, IPartyList
|
|||
private const int AllianceLength = 20;
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly ClientState clientState = Service<ClientState>.Get();
|
||||
private readonly PlayerState playerState = Service<PlayerState>.Get();
|
||||
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private PartyList()
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ public sealed unsafe partial class StatusList
|
|||
/// <returns>The status object containing the requested data.</returns>
|
||||
public static StatusList? CreateStatusListReference(nint address)
|
||||
{
|
||||
if (address == IntPtr.Zero)
|
||||
return null;
|
||||
|
||||
// The use case for CreateStatusListReference and CreateStatusReference to be static is so
|
||||
// fake status lists can be generated. Since they aren't exposed as services, it's either
|
||||
// here or somewhere else.
|
||||
|
|
@ -89,9 +92,7 @@ public sealed unsafe partial class StatusList
|
|||
/// <returns>The status object containing the requested data.</returns>
|
||||
public static IStatus? CreateStatusReference(nint address)
|
||||
{
|
||||
var clientState = Service<ClientState>.Get();
|
||||
|
||||
if (clientState.LocalContentId == 0)
|
||||
if (address == IntPtr.Zero)
|
||||
return null;
|
||||
|
||||
if (address == 0)
|
||||
|
|
|
|||
|
|
@ -11,18 +11,18 @@ using Dalamud.Game.Gui;
|
|||
using Dalamud.Game.Network.Internal.MarketBoardUploaders;
|
||||
using Dalamud.Game.Network.Internal.MarketBoardUploaders.Universalis;
|
||||
using Dalamud.Game.Network.Structures;
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Hooking;
|
||||
using Dalamud.Networking.Http;
|
||||
using Dalamud.Utility;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Control;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.InstanceContent;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using FFXIVClientStructs.FFXIV.Client.Network;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Info;
|
||||
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.Network.Internal;
|
||||
|
|
@ -269,29 +269,8 @@ internal unsafe class NetworkHandlers : IInternalDisposableService
|
|||
|
||||
private static (ulong UploaderId, uint WorldId) GetUploaderInfo()
|
||||
{
|
||||
var agentLobby = AgentLobby.Instance();
|
||||
|
||||
var uploaderId = agentLobby->LobbyData.ContentId;
|
||||
if (uploaderId == 0)
|
||||
{
|
||||
var playerState = PlayerState.Instance();
|
||||
if (playerState->IsLoaded)
|
||||
{
|
||||
uploaderId = playerState->ContentId;
|
||||
}
|
||||
}
|
||||
|
||||
var worldId = agentLobby->LobbyData.CurrentWorldId;
|
||||
if (worldId == 0)
|
||||
{
|
||||
var localPlayer = Control.GetLocalPlayer();
|
||||
if (localPlayer != null)
|
||||
{
|
||||
worldId = localPlayer->CurrentWorld;
|
||||
}
|
||||
}
|
||||
|
||||
return (uploaderId, worldId);
|
||||
var playerState = Service<PlayerState>.Get();
|
||||
return (playerState.ContentId, playerState.CurrentWorld.RowId);
|
||||
}
|
||||
|
||||
private unsafe nint CfPopDetour(PublicContentDirector.EnterContentInfoPacket* packetData)
|
||||
|
|
|
|||
27
Dalamud/Game/Player/MentorVersion.cs
Normal file
27
Dalamud/Game/Player/MentorVersion.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
namespace Dalamud.Game.Player;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the mentor certification version for a player.
|
||||
/// </summary>
|
||||
public enum MentorVersion : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the player has never held mentor status in any expansion.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the player was last a mentor during the <c>Shadowbringers</c> expansion.
|
||||
/// </summary>
|
||||
Shadowbringers = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the player was last a mentor during the <c>Endwalker</c> expansion.
|
||||
/// </summary>
|
||||
Endwalker = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the player was last a mentor during the <c>Dawntrail</c> expansion.
|
||||
/// </summary>
|
||||
Dawntrail = 3,
|
||||
}
|
||||
489
Dalamud/Game/Player/PlayerAttribute.cs
Normal file
489
Dalamud/Game/Player/PlayerAttribute.cs
Normal file
|
|
@ -0,0 +1,489 @@
|
|||
namespace Dalamud.Game.Player;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a player's attribute.
|
||||
/// </summary>
|
||||
public enum PlayerAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Strength.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects physical damage dealt by gladiator's arms, marauder's arms, dark knight's arms, gunbreaker's arms, pugilist's arms, lancer's arms, samurai's arms, reaper's arms, thaumaturge's arms, arcanist's arms, red mage's arms, pictomancer's arms, conjurer's arms, astrologian's arms, sage's arms, and blue mage's arms.
|
||||
/// </remarks>
|
||||
Strength = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Dexterity.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects physical damage dealt by rogue's arms, viper's arms, archer's arms, machinist's arms, and dancer's arms.
|
||||
/// </remarks>
|
||||
Dexterity = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Vitality.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects maximum HP.
|
||||
/// </remarks>
|
||||
Vitality = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Intelligence.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects attack magic potency when role is DPS.
|
||||
/// </remarks>
|
||||
Intelligence = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Mind.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects healing magic potency. Also affects attack magic potency when role is Healer.
|
||||
/// </remarks>
|
||||
Mind = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Piety.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects MP regeneration. Regeneration rate is determined by piety. Only applicable when in battle and role is Healer.
|
||||
/// </remarks>
|
||||
Piety = 6,
|
||||
|
||||
/// <summary>
|
||||
/// Health Points.
|
||||
/// </summary>
|
||||
HP = 7,
|
||||
|
||||
/// <summary>
|
||||
/// Mana Points.
|
||||
/// </summary>
|
||||
MP = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Tactical Points.
|
||||
/// </summary>
|
||||
TP = 9,
|
||||
|
||||
/// <summary>
|
||||
/// Gathering Point.
|
||||
/// </summary>
|
||||
GP = 10,
|
||||
|
||||
/// <summary>
|
||||
/// Crafting Points.
|
||||
/// </summary>
|
||||
CP = 11,
|
||||
|
||||
/// <summary>
|
||||
/// Physical Damage.
|
||||
/// </summary>
|
||||
PhysicalDamage = 12,
|
||||
|
||||
/// <summary>
|
||||
/// Magic Damage.
|
||||
/// </summary>
|
||||
MagicDamage = 13,
|
||||
|
||||
/// <summary>
|
||||
/// Delay.
|
||||
/// </summary>
|
||||
Delay = 14,
|
||||
|
||||
/// <summary>
|
||||
/// Additional Effect.
|
||||
/// </summary>
|
||||
AdditionalEffect = 15,
|
||||
|
||||
/// <summary>
|
||||
/// Attack Speed.
|
||||
/// </summary>
|
||||
AttackSpeed = 16,
|
||||
|
||||
/// <summary>
|
||||
/// Block Rate.
|
||||
/// </summary>
|
||||
BlockRate = 17,
|
||||
|
||||
/// <summary>
|
||||
/// Block Strength.
|
||||
/// </summary>
|
||||
BlockStrength = 18,
|
||||
|
||||
/// <summary>
|
||||
/// Tenacity.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of physical and magic damage dealt and received, as well as HP restored. The higher the value, the more damage dealt, the more HP restored, and the less damage taken. Only applicable when role is Tank.
|
||||
/// </remarks>
|
||||
Tenacity = 19,
|
||||
|
||||
/// <summary>
|
||||
/// Attack Power.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects amount of damage dealt by physical attacks. The higher the value, the more damage dealt.
|
||||
/// </remarks>
|
||||
AttackPower = 20,
|
||||
|
||||
/// <summary>
|
||||
/// Defense.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of damage taken by physical attacks. The higher the value, the less damage taken.
|
||||
/// </remarks>
|
||||
Defense = 21,
|
||||
|
||||
/// <summary>
|
||||
/// Direct Hit Rate.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the rate at which your physical and magic attacks land direct hits, dealing slightly more damage than normal hits. The higher the value, the higher the frequency with which your hits will be direct. Higher values will also result in greater damage for actions which guarantee direct hits.
|
||||
/// </remarks>
|
||||
DirectHitRate = 22,
|
||||
|
||||
/// <summary>
|
||||
/// Evasion.
|
||||
/// </summary>
|
||||
Evasion = 23,
|
||||
|
||||
/// <summary>
|
||||
/// Magic Defense.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of damage taken by magic attacks. The higher the value, the less damage taken.
|
||||
/// </remarks>
|
||||
MagicDefense = 24,
|
||||
|
||||
/// <summary>
|
||||
/// Critical Hit Power.
|
||||
/// </summary>
|
||||
CriticalHitPower = 25,
|
||||
|
||||
/// <summary>
|
||||
/// Critical Hit Resilience.
|
||||
/// </summary>
|
||||
CriticalHitResilience = 26,
|
||||
|
||||
/// <summary>
|
||||
/// Critical Hit.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of physical and magic damage dealt, as well as HP restored. The higher the value, the higher the frequency with which your hits will be critical/higher the potency of critical hits.
|
||||
/// </remarks>
|
||||
CriticalHit = 27,
|
||||
|
||||
/// <summary>
|
||||
/// Critical Hit Evasion.
|
||||
/// </summary>
|
||||
CriticalHitEvasion = 28,
|
||||
|
||||
/// <summary>
|
||||
/// Slashing Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases damage done by slashing attacks.
|
||||
/// </remarks>
|
||||
SlashingResistance = 29,
|
||||
|
||||
/// <summary>
|
||||
/// Piercing Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases damage done by piercing attacks.
|
||||
/// </remarks>
|
||||
PiercingResistance = 30,
|
||||
|
||||
/// <summary>
|
||||
/// Blunt Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases damage done by blunt attacks.
|
||||
/// </remarks>
|
||||
BluntResistance = 31,
|
||||
|
||||
/// <summary>
|
||||
/// Projectile Resistance.
|
||||
/// </summary>
|
||||
ProjectileResistance = 32,
|
||||
|
||||
/// <summary>
|
||||
/// Attack Magic Potency.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of damage dealt by magic attacks.
|
||||
/// </remarks>
|
||||
AttackMagicPotency = 33,
|
||||
|
||||
/// <summary>
|
||||
/// Healing Magic Potency.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of HP restored via healing magic.
|
||||
/// </remarks>
|
||||
HealingMagicPotency = 34,
|
||||
|
||||
/// <summary>
|
||||
/// Enhancement Magic Potency.
|
||||
/// </summary>
|
||||
EnhancementMagicPotency = 35,
|
||||
|
||||
/// <summary>
|
||||
/// Elemental Bonus.
|
||||
/// </summary>
|
||||
ElementalBonus = 36,
|
||||
|
||||
/// <summary>
|
||||
/// Fire Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases fire-aspected damage.
|
||||
/// </remarks>
|
||||
FireResistance = 37,
|
||||
|
||||
/// <summary>
|
||||
/// Ice Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases ice-aspected damage.
|
||||
/// </remarks>
|
||||
IceResistance = 38,
|
||||
|
||||
/// <summary>
|
||||
/// Wind Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases wind-aspected damage.
|
||||
/// </remarks>
|
||||
WindResistance = 39,
|
||||
|
||||
/// <summary>
|
||||
/// Earth Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases earth-aspected damage.
|
||||
/// </remarks>
|
||||
EarthResistance = 40,
|
||||
|
||||
/// <summary>
|
||||
/// Lightning Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases lightning-aspected damage.
|
||||
/// </remarks>
|
||||
LightningResistance = 41,
|
||||
|
||||
/// <summary>
|
||||
/// Water Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Decreases water-aspected damage.
|
||||
/// </remarks>
|
||||
WaterResistance = 42,
|
||||
|
||||
/// <summary>
|
||||
/// Magic Resistance.
|
||||
/// </summary>
|
||||
MagicResistance = 43,
|
||||
|
||||
/// <summary>
|
||||
/// Determination.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of damage dealt by both physical and magic attacks, as well as the amount of HP restored by healing spells.
|
||||
/// </remarks>
|
||||
Determination = 44,
|
||||
|
||||
/// <summary>
|
||||
/// Skill Speed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects both the casting and recast timers, as well as the damage over time potency for weaponskills and auto-attacks. The higher the value, the shorter the timers/higher the potency.
|
||||
/// </remarks>
|
||||
SkillSpeed = 45,
|
||||
|
||||
/// <summary>
|
||||
/// Spell Speed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects both the casting and recast timers for spells. The higher the value, the shorter the timers. Also affects a spell's damage over time or healing over time potency.
|
||||
/// </remarks>
|
||||
SpellSpeed = 46,
|
||||
|
||||
/// <summary>
|
||||
/// Haste.
|
||||
/// </summary>
|
||||
Haste = 47,
|
||||
|
||||
/// <summary>
|
||||
/// Morale.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// In PvP, replaces physical and magical defense in determining damage inflicted by other players. Also influences the amount of damage dealt to other players.
|
||||
/// </remarks>
|
||||
Morale = 48,
|
||||
|
||||
/// <summary>
|
||||
/// Enmity.
|
||||
/// </summary>
|
||||
Enmity = 49,
|
||||
|
||||
/// <summary>
|
||||
/// Enmity Reduction.
|
||||
/// </summary>
|
||||
EnmityReduction = 50,
|
||||
|
||||
/// <summary>
|
||||
/// Desynthesis Skill Gain.
|
||||
/// </summary>
|
||||
DesynthesisSkillGain = 51,
|
||||
|
||||
/// <summary>
|
||||
/// EXP Bonus.
|
||||
/// </summary>
|
||||
EXPBonus = 52,
|
||||
|
||||
/// <summary>
|
||||
/// Regen.
|
||||
/// </summary>
|
||||
Regen = 53,
|
||||
|
||||
/// <summary>
|
||||
/// Special Attribute.
|
||||
/// </summary>
|
||||
SpecialAttribute = 54,
|
||||
|
||||
/// <summary>
|
||||
/// Main Attribute.
|
||||
/// </summary>
|
||||
MainAttribute = 55,
|
||||
|
||||
/// <summary>
|
||||
/// Secondary Attribute.
|
||||
/// </summary>
|
||||
SecondaryAttribute = 56,
|
||||
|
||||
/// <summary>
|
||||
/// Slow Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shortens the duration of slow.
|
||||
/// </remarks>
|
||||
SlowResistance = 57,
|
||||
|
||||
/// <summary>
|
||||
/// Petrification Resistance.
|
||||
/// </summary>
|
||||
PetrificationResistance = 58,
|
||||
|
||||
/// <summary>
|
||||
/// Paralysis Resistance.
|
||||
/// </summary>
|
||||
ParalysisResistance = 59,
|
||||
|
||||
/// <summary>
|
||||
/// Silence Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shortens the duration of silence.
|
||||
/// </remarks>
|
||||
SilenceResistance = 60,
|
||||
|
||||
/// <summary>
|
||||
/// Blind Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shortens the duration of blind.
|
||||
/// </remarks>
|
||||
BlindResistance = 61,
|
||||
|
||||
/// <summary>
|
||||
/// Poison Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shortens the duration of poison.
|
||||
/// </remarks>
|
||||
PoisonResistance = 62,
|
||||
|
||||
/// <summary>
|
||||
/// Stun Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shortens the duration of stun.
|
||||
/// </remarks>
|
||||
StunResistance = 63,
|
||||
|
||||
/// <summary>
|
||||
/// Sleep Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shortens the duration of sleep.
|
||||
/// </remarks>
|
||||
SleepResistance = 64,
|
||||
|
||||
/// <summary>
|
||||
/// Bind Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shortens the duration of bind.
|
||||
/// </remarks>
|
||||
BindResistance = 65,
|
||||
|
||||
/// <summary>
|
||||
/// Heavy Resistance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Shortens the duration of heavy.
|
||||
/// </remarks>
|
||||
HeavyResistance = 66,
|
||||
|
||||
/// <summary>
|
||||
/// Doom Resistance.
|
||||
/// </summary>
|
||||
DoomResistance = 67,
|
||||
|
||||
/// <summary>
|
||||
/// Reduced Durability Loss.
|
||||
/// </summary>
|
||||
ReducedDurabilityLoss = 68,
|
||||
|
||||
/// <summary>
|
||||
/// Increased Spiritbond Gain.
|
||||
/// </summary>
|
||||
IncreasedSpiritbondGain = 69,
|
||||
|
||||
/// <summary>
|
||||
/// Craftsmanship.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of progress achieved in a single synthesis step.
|
||||
/// </remarks>
|
||||
Craftsmanship = 70,
|
||||
|
||||
/// <summary>
|
||||
/// Control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the amount of quality improved in a single synthesis step.
|
||||
/// </remarks>
|
||||
Control = 71,
|
||||
|
||||
/// <summary>
|
||||
/// Gathering.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects the rate at which items are gathered.
|
||||
/// </remarks>
|
||||
Gathering = 72,
|
||||
|
||||
/// <summary>
|
||||
/// Perception.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Affects item yield when gathering as a botanist or miner, and the size of fish when fishing or spearfishing.
|
||||
/// </remarks>
|
||||
Perception = 73,
|
||||
}
|
||||
232
Dalamud/Game/Player/PlayerState.cs
Normal file
232
Dalamud/Game/Player/PlayerState.cs
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
|
||||
using Lumina.Excel;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
using CSPlayerState = FFXIVClientStructs.FFXIV.Client.Game.UI.PlayerState;
|
||||
using GrandCompany = Lumina.Excel.Sheets.GrandCompany;
|
||||
|
||||
namespace Dalamud.Game.Player;
|
||||
|
||||
/// <summary>
|
||||
/// This class contains the PlayerState wrappers.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[ServiceManager.EarlyLoadedService]
|
||||
[ResolveVia<IPlayerState>]
|
||||
internal unsafe class PlayerState : IServiceType, IPlayerState
|
||||
{
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private PlayerState()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsLoaded => CSPlayerState.Instance()->IsLoaded;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string CharacterName => this.IsLoaded ? CSPlayerState.Instance()->CharacterNameString : string.Empty;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint EntityId => this.IsLoaded ? CSPlayerState.Instance()->EntityId : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ulong ContentId => this.IsLoaded ? CSPlayerState.Instance()->ContentId : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<World> CurrentWorld
|
||||
{
|
||||
get
|
||||
{
|
||||
var agentLobby = AgentLobby.Instance();
|
||||
return agentLobby->IsLoggedIn
|
||||
? LuminaUtils.CreateRef<World>(agentLobby->LobbyData.CurrentWorldId)
|
||||
: default;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<World> HomeWorld
|
||||
{
|
||||
get
|
||||
{
|
||||
var agentLobby = AgentLobby.Instance();
|
||||
return agentLobby->IsLoggedIn
|
||||
? LuminaUtils.CreateRef<World>(agentLobby->LobbyData.HomeWorldId)
|
||||
: default;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Sex Sex => this.IsLoaded ? (Sex)CSPlayerState.Instance()->Sex : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<Race> Race => this.IsLoaded ? LuminaUtils.CreateRef<Race>(CSPlayerState.Instance()->Race) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<Tribe> Tribe => this.IsLoaded ? LuminaUtils.CreateRef<Tribe>(CSPlayerState.Instance()->Tribe) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<ClassJob> ClassJob => this.IsLoaded ? LuminaUtils.CreateRef<ClassJob>(CSPlayerState.Instance()->CurrentClassJobId) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public short Level => this.IsLoaded ? CSPlayerState.Instance()->CurrentLevel : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsLevelSynced => this.IsLoaded && CSPlayerState.Instance()->IsLevelSynced;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public short EffectiveLevel => this.IsLoaded ? (this.IsLevelSynced ? CSPlayerState.Instance()->SyncedLevel : CSPlayerState.Instance()->CurrentLevel) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<GuardianDeity> GuardianDeity => this.IsLoaded ? LuminaUtils.CreateRef<GuardianDeity>(CSPlayerState.Instance()->GuardianDeity) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public byte BirthMonth => this.IsLoaded ? CSPlayerState.Instance()->BirthMonth : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public byte BirthDay => this.IsLoaded ? CSPlayerState.Instance()->BirthDay : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<ClassJob> FirstClass => this.IsLoaded ? LuminaUtils.CreateRef<ClassJob>(CSPlayerState.Instance()->FirstClass) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<Town> StartTown => this.IsLoaded ? LuminaUtils.CreateRef<Town>(CSPlayerState.Instance()->StartTown) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int BaseStrength => this.IsLoaded ? CSPlayerState.Instance()->BaseStrength : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int BaseDexterity => this.IsLoaded ? CSPlayerState.Instance()->BaseDexterity : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int BaseVitality => this.IsLoaded ? CSPlayerState.Instance()->BaseVitality : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int BaseIntelligence => this.IsLoaded ? CSPlayerState.Instance()->BaseIntelligence : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int BaseMind => this.IsLoaded ? CSPlayerState.Instance()->BaseMind : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int BasePiety => this.IsLoaded ? CSPlayerState.Instance()->BasePiety : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<GrandCompany> GrandCompany => this.IsLoaded ? LuminaUtils.CreateRef<GrandCompany>(CSPlayerState.Instance()->GrandCompany) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<Aetheryte> HomeAetheryte => this.IsLoaded ? LuminaUtils.CreateRef<Aetheryte>(CSPlayerState.Instance()->HomeAetheryteId) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IReadOnlyList<RowRef<Aetheryte>> FavoriteAetherytes
|
||||
{
|
||||
get
|
||||
{
|
||||
var playerState = CSPlayerState.Instance();
|
||||
if (!playerState->IsLoaded)
|
||||
return default;
|
||||
|
||||
var count = playerState->FavouriteAetheryteCount;
|
||||
if (count == 0)
|
||||
return default;
|
||||
|
||||
var array = new RowRef<Aetheryte>[count];
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
array[i] = LuminaUtils.CreateRef<Aetheryte>(playerState->FavouriteAetherytes[i]);
|
||||
|
||||
return array;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public RowRef<Aetheryte> FreeAetheryte => this.IsLoaded ? LuminaUtils.CreateRef<Aetheryte>(CSPlayerState.Instance()->FreeAetheryteId) : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint BaseRestedExperience => this.IsLoaded ? CSPlayerState.Instance()->BaseRestedExperience : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public short PlayerCommendations => this.IsLoaded ? CSPlayerState.Instance()->PlayerCommendations : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public byte DeliveryLevel => this.IsLoaded ? CSPlayerState.Instance()->DeliveryLevel : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public MentorVersion MentorVersion => this.IsLoaded ? (MentorVersion)CSPlayerState.Instance()->MentorVersion : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsMentor => this.IsLoaded && CSPlayerState.Instance()->IsMentor();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsBattleMentor => this.IsLoaded && CSPlayerState.Instance()->IsBattleMentor();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsTradeMentor => this.IsLoaded && CSPlayerState.Instance()->IsTradeMentor();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsNovice => this.IsLoaded && CSPlayerState.Instance()->IsNovice();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool IsReturner => this.IsLoaded && CSPlayerState.Instance()->IsReturner();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int GetAttribute(PlayerAttribute attribute) => this.IsLoaded ? CSPlayerState.Instance()->Attributes[(int)attribute] : default;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public byte GetGrandCompanyRank(GrandCompany grandCompany)
|
||||
{
|
||||
if (!this.IsLoaded)
|
||||
return default;
|
||||
|
||||
return grandCompany.RowId switch
|
||||
{
|
||||
1 => CSPlayerState.Instance()->GCRankMaelstrom,
|
||||
2 => CSPlayerState.Instance()->GCRankTwinAdders,
|
||||
3 => CSPlayerState.Instance()->GCRankImmortalFlames,
|
||||
_ => default,
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public short GetClassJobLevel(ClassJob classJob)
|
||||
{
|
||||
if (classJob.ExpArrayIndex == -1)
|
||||
return default;
|
||||
|
||||
if (!this.IsLoaded)
|
||||
return default;
|
||||
|
||||
return CSPlayerState.Instance()->ClassJobLevels[classJob.ExpArrayIndex];
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int GetClassJobExperience(ClassJob classJob)
|
||||
{
|
||||
if (classJob.ExpArrayIndex == -1)
|
||||
return default;
|
||||
|
||||
if (!this.IsLoaded)
|
||||
return default;
|
||||
|
||||
return CSPlayerState.Instance()->ClassJobExperience[classJob.ExpArrayIndex];
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public float GetDesynthesisLevel(ClassJob classJob)
|
||||
{
|
||||
if (classJob.DohDolJobIndex == -1)
|
||||
return default;
|
||||
|
||||
if (!this.IsLoaded)
|
||||
return default;
|
||||
|
||||
return CSPlayerState.Instance()->DesynthesisLevels[classJob.DohDolJobIndex] / 100f;
|
||||
}
|
||||
}
|
||||
17
Dalamud/Game/Player/Sex.cs
Normal file
17
Dalamud/Game/Player/Sex.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
namespace Dalamud.Game.Player;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the sex of a character.
|
||||
/// </summary>
|
||||
public enum Sex : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Male sex.
|
||||
/// </summary>
|
||||
Male = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Female sex.
|
||||
/// </summary>
|
||||
Female = 1,
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ using Dalamud.Configuration.Internal;
|
|||
using Dalamud.Data;
|
||||
using Dalamud.Game.ClientState.Objects.Enums;
|
||||
using Dalamud.Game.Config;
|
||||
using Dalamud.Game.Player;
|
||||
using Dalamud.Game.Text.Evaluator.Internal;
|
||||
using Dalamud.Game.Text.Noun;
|
||||
using Dalamud.Game.Text.Noun.Enums;
|
||||
|
|
@ -35,7 +36,6 @@ using Lumina.Text.Payloads;
|
|||
using Lumina.Text.ReadOnly;
|
||||
|
||||
using AddonSheet = Lumina.Excel.Sheets.Addon;
|
||||
using PlayerState = FFXIVClientStructs.FFXIV.Client.Game.UI.PlayerState;
|
||||
using StatusSheet = Lumina.Excel.Sheets.Status;
|
||||
|
||||
namespace Dalamud.Game.Text.Evaluator;
|
||||
|
|
@ -68,6 +68,9 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
|||
[ServiceManager.ServiceDependency]
|
||||
private readonly SheetRedirectResolver sheetRedirectResolver = Service<SheetRedirectResolver>.Get();
|
||||
|
||||
[ServiceManager.ServiceDependency]
|
||||
private readonly PlayerState playerState = Service<PlayerState>.Get();
|
||||
|
||||
private readonly ConcurrentDictionary<StringCacheKey<ActionKind>, string> actStrCache = [];
|
||||
private readonly ConcurrentDictionary<StringCacheKey<ObjectKind>, string> objStrCache = [];
|
||||
|
||||
|
|
@ -564,7 +567,7 @@ internal class SeStringEvaluator : IServiceType, ISeStringEvaluator
|
|||
return false;
|
||||
|
||||
// the game uses LocalPlayer here, but using PlayerState seems more safe.
|
||||
return this.ResolveStringExpression(in context, PlayerState.Instance()->EntityId == entityId ? eTrue : eFalse);
|
||||
return this.ResolveStringExpression(in context, this.playerState.EntityId == entityId ? eTrue : eFalse);
|
||||
}
|
||||
|
||||
private bool TryResolveColor(in SeStringContext context, in ReadOnlySePayloadSpan payload)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue