Skip to content

Commit 75bf9ca

Browse files
committed
functional (probably) for 7.4
1 parent 189f2c4 commit 75bf9ca

File tree

8 files changed

+23
-22
lines changed

8 files changed

+23
-22
lines changed

WoLua/Lua/Api/Game/FateWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public sealed record class FateWrapper(Fate? WorldFate): IWorldObjectWrapper {
2323
internal unsafe FateContext* Struct => this.Valid ? (FateContext*)this.WorldFate!.Address : null;
2424

2525
[LuaDoc("Whether this FATE is a valid object in the game's memory. If this is false, this wrapper is meaningless.")]
26-
public bool Valid => this.WorldFate is Fate fate && Service.ClientState.LocalPlayer?.IsValid() is true;
26+
public bool Valid => this.WorldFate is Fate fate && Service.Objects.LocalPlayer?.IsValid() is true;
2727

2828
[LuaDoc("Whether this FATE still exists in the world. This will be true if the FATE is valid and has not yet ended, even if it is WAITING to end.")]
2929
public bool Exists => this.State is not (FateState.Ended or FateState.Failed);

WoLua/Lua/Api/Game/PlayerApi.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ internal PlayerApi(ScriptContainer source) : base(source) { }
3030
"If you aren't logged in, this will be `false`.",
3131
"If this is `false`, then all player properties will be `nil`.")]
3232
public bool Loaded => !this.Disposed
33-
&& Service.ClientState.LocalPlayer is not null
34-
&& Service.ClientState.LocalContentId is not 0;
33+
&& Service.Objects.LocalPlayer is not null
34+
&& Service.PlayerState.ContentId is not 0;
3535
public static implicit operator bool(PlayerApi? player) => player?.Loaded ?? false;
3636

3737
[LuaDoc("An alternative name for `.Loaded`, to match that used by entity wrappers.")]
3838
public bool Exists => this.Loaded;
3939

4040
[LuaPlayerDoc("This is the _universally unique_ ID of the character currently logged in.")]
4141
public ulong? CharacterId => this.Loaded
42-
? Service.ClientState.LocalContentId
42+
? Service.PlayerState.ContentId
4343
: null;
4444

4545
[LuaDoc("This provides an `EntityWrapper` wrapper object around the currently-logged-in player (or around nothing) _at the time of access_.",
4646
"If you cache this, it may become invalid, such as if the player logs out.",
4747
"It is recommended that you only cache this in a function-local variable, and not rely on it remaining valid between execution frames, especially if you use the action queue.",
4848
"This value itself will _never_ be `nil`, but _will_ represent a nonexistent/invalid game entity if the `Loaded` property is `false`.")]
49-
public EntityWrapper Entity => new(this ? Service.ClientState.LocalPlayer : null);
49+
public EntityWrapper Entity => new(this ? Service.Objects.LocalPlayer : null);
5050

5151
[LuaDoc("This provides a `MountData` wrapper object around the currently-logged-in player's mount (or around nothing) _at the time of access_.",
5252
"If you cache this, it may become invalid, such as if the player logs out, changes mounts, or dismounts entirely.",
@@ -61,7 +61,7 @@ internal PlayerApi(ScriptContainer source) : base(source) { }
6161
"Per FFXIV name formatting, it will contain the first name, a single space, and the last name.",
6262
"See also the `Firstname` and `Lastname` properties.")]
6363
public string? Name => this.Loaded
64-
? Service.ClientState.LocalPlayer!.Name!.TextValue
64+
? Service.Objects.LocalPlayer!.Name!.TextValue
6565
: null;
6666

6767
[LuaPlayerDoc("This is the first name (and only the first name) of the current character.",
@@ -269,7 +269,7 @@ internal PlayerApi(ScriptContainer source) : base(source) { }
269269
[LuaPlayerDoc("Whether the current character is engaged in combat, which restricts certain actions.")]
270270
public bool? InCombat => this.Loaded
271271
? Service.Condition[ConditionFlag.InCombat]
272-
|| Service.ClientState.LocalPlayer!.StatusFlags.HasFlag(StatusFlags.InCombat)
272+
|| Service.Objects.LocalPlayer!.StatusFlags.HasFlag(StatusFlags.InCombat)
273273
: null;
274274

275275
[LuaPlayerDoc("Whether the currect character is presently mounted. It may not be their own mount.")]
@@ -302,7 +302,7 @@ internal PlayerApi(ScriptContainer source) : base(source) { }
302302
public bool? Casting => this.Loaded
303303
? Service.Condition[ConditionFlag.Casting]
304304
|| Service.Condition[ConditionFlag.Casting87]
305-
|| Service.ClientState.LocalPlayer!.StatusFlags.HasFlag(StatusFlags.IsCasting)
305+
|| Service.Objects.LocalPlayer!.StatusFlags.HasFlag(StatusFlags.IsCasting)
306306
: null;
307307

308308
[LuaPlayerDoc("Whether the current character is watching a cutscene. Some commands are not available during cutscenes.")]
@@ -359,7 +359,7 @@ internal PlayerApi(ScriptContainer source) : base(source) { }
359359

360360
[LuaPlayerDoc("Whether the current character has their weapon drawn.")]
361361
public bool? WeaponDrawn => this.Loaded
362-
? Service.ClientState.LocalPlayer!.StatusFlags.HasFlag(StatusFlags.WeaponOut)
362+
? Service.Objects.LocalPlayer!.StatusFlags.HasFlag(StatusFlags.WeaponOut)
363363
: null;
364364

365365
[LuaPlayerDoc("Whether the game considers the current character to be in motion.")]

WoLua/Lua/Api/Game/WorldPosition.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public sealed record class WorldPosition(float? PosX, float? PosY, float? PosZ):
3333
public float? FlatDistanceFrom([AsLuaType("EntityWrapper|FateWrapper|PlayerApi|WorldPosition")] IWorldObjectWrapper? other) => this && other?.Exists is true
3434
? Vector2.Distance(this, other.Position)
3535
: null;
36-
public float? FlatDistance => this.FlatDistanceFrom(FromGameObject(Service.ClientState.LocalPlayer));
36+
public float? FlatDistance => this.FlatDistanceFrom(FromGameObject(Service.Objects.LocalPlayer));
3737

3838
public float? DistanceFrom([AsLuaType("EntityWrapper|FateWrapper|PlayerApi|WorldPosition")] IWorldObjectWrapper? other) => this && other?.Exists is true
3939
? Vector3.Distance(this.GameEnginePosition, other!.Position.GameEnginePosition)
4040
: null;
41-
public float? Distance => this.DistanceFrom(FromGameObject(Service.ClientState.LocalPlayer));
41+
public float? Distance => this.DistanceFrom(FromGameObject(Service.Objects.LocalPlayer));
4242

4343
internal Vector3? UiCoords {
4444
get {

WoLua/Plugin.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,27 +210,27 @@ public void OnCommand(string command, string argline) {
210210
Service.DocumentationGenerator.Run();
211211
break;
212212
case "query":
213-
if (Service.ClientState.LocalContentId == 0 || Service.ClientState.LocalPlayer is null) {
213+
if (Service.PlayerState.ContentId == 0 || Service.Objects.LocalPlayer is null) {
214214
this.Error("No character is loaded. You are probably not logged in.");
215215
break;
216216
}
217217
if (args.Length >= 2) {
218218
switch (args[1].ToLower()) {
219219
case "id":
220-
this.Print($"Your current character ID is {Service.ClientState.LocalContentId}.");
220+
this.Print($"Your current character ID is {Service.PlayerState.ContentId}.");
221221
break;
222222
case "class":
223223
case "job":
224-
if (Service.ClientState.LocalPlayer.ClassJob.Value is ClassJob job) {
225-
this.Print($"You current job is {job.RowId} ({job.Abbreviation}, {job.Name}) at level {Service.ClientState.LocalPlayer.Level}.");
224+
if (Service.Objects.LocalPlayer.ClassJob.Value is ClassJob job) {
225+
this.Print($"You current job is {job.RowId} ({job.Abbreviation}, {job.Name}) at level {Service.Objects.LocalPlayer.Level}.");
226226
}
227227
else {
228228
this.Error("Cannot determine class/job details.");
229229
}
230230
break;
231231
case "mount":
232232
unsafe {
233-
Character* player = (Character*)Service.ClientState.LocalPlayer.Address;
233+
Character* player = (Character*)Service.Objects.LocalPlayer.Address;
234234
if (!player->IsMounted()) {
235235
this.Print("You are not mounted.");
236236
}

WoLua/Service.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ internal class Service {
3939
[PluginService] public static ITargetManager Targets { get; private set; } = null!;
4040
[PluginService] public static IToastGui Toast { get; private set; } = null!;
4141
[PluginService] public static INotificationManager Notifications { get; private set; } = null!;
42+
[PluginService] public static IPlayerState PlayerState { get; private set; } = null!;
4243

4344
public static Hooks Hooks { get; internal set; } = null!;
4445
public static IDtrBarEntry StatusLine { get; private set; } = null!;

WoLua/WoLua.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Dalamud.NET.Sdk/13.1.0">
33
<PropertyGroup>
44
<Product>WoLua</Product>
5-
<Version>4.2.0</Version>
5+
<Version>4.3.0</Version>
66
<Description>Warrior of... Lua? Write your own chat commands in lua for FFXIV/Dalamud!</Description>
77
<Copyright>Copyleft VariableVixen 2022</Copyright>
88
</PropertyGroup>

WoLua/dalamud.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<Platforms>x64</Platforms>
66
<PlatformTarget>x64</PlatformTarget>
7-
<TargetFramework>net9-windows</TargetFramework>
7+
<TargetFramework>net10.0-windows7.0</TargetFramework>
88
<OutputType>Library</OutputType>
99
<Deterministic>false</Deterministic>
1010
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

WoLua/packages.lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": 1,
33
"dependencies": {
4-
"net9.0-windows7.0": {
4+
"net10.0-windows7.0": {
55
"DalamudPackager": {
66
"type": "Direct",
77
"requested": "[13.1.0, )",
@@ -16,9 +16,9 @@
1616
},
1717
"Microsoft.NET.ILLink.Tasks": {
1818
"type": "Direct",
19-
"requested": "[9.0.10, )",
20-
"resolved": "9.0.10",
21-
"contentHash": "sseaSJcBxKEpkc59hnB00b3NmJdGvJLfj74HK+nucHxERxbZSUREuWKjC9ywc+HdzJvJyiP2eiyEOROaGSfcPw=="
19+
"requested": "[10.0.1, )",
20+
"resolved": "10.0.1",
21+
"contentHash": "ISahzLHsHY7vrwqr2p1YWZ+gsxoBRtH7gWRDK8fDUst9pp2He0GiesaqEfeX0V8QMCJM3eNEHGGpnIcPjFo2NQ=="
2222
},
2323
"MoonSharp": {
2424
"type": "Direct",

0 commit comments

Comments
 (0)