Skip to content

Commit 67b7caa

Browse files
committed
Begin fixing broken stuff
1 parent b25d26c commit 67b7caa

File tree

4 files changed

+65
-41
lines changed

4 files changed

+65
-41
lines changed

ECommons/BannedSymbols.txt

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1-
T:Dalamud.Interface.Utility.Raii.ImRaii
2-
M:Lumina.Text.ReadOnly.ReadOnlySeString.ExtractText
3-
P:Lumina.Excel.Sheets.World.Region
1+
T:Dalamud.Interface.Utility.Raii.ImRaii;Use native ImGui methods for compatibility
2+
M:Lumina.Text.ReadOnly.ReadOnlySeString.ExtractText;Use GetText extension method for consistency
3+
P:Lumina.Excel.Sheets.World.Region;Unreliable - use GetRegion() extension method
4+
P:Dalamud.Plugin.Services.IPlayerState.CharacterName;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
5+
P:Dalamud.Plugin.Services.IPlayerState.EntityId;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
6+
P:Dalamud.Plugin.Services.IPlayerState.CurrentWorld;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
7+
P:Dalamud.Plugin.Services.IPlayerState.HomeWorld;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
8+
P:Dalamud.Plugin.Services.IPlayerState.Tribe;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
9+
P:Dalamud.Plugin.Services.IPlayerState.ClassJob;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
10+
P:Dalamud.Plugin.Services.IPlayerState.Level;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
11+
P:Dalamud.Plugin.Services.IPlayerState.IsLevelSynced;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
12+
P:Dalamud.Plugin.Services.IPlayerState.EffectiveLevel;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
13+
P:Dalamud.Plugin.Services.IPlayerState.GuardianDeity;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
14+
P:Dalamud.Plugin.Services.IPlayerState.BirthMonth;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
15+
P:Dalamud.Plugin.Services.IPlayerState.BirthDay;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
16+
P:Dalamud.Plugin.Services.IPlayerState.FirstClass;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
17+
P:Dalamud.Plugin.Services.IPlayerState.StartTown;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
18+
P:Dalamud.Plugin.Services.IPlayerState.BaseStrength;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
19+
P:Dalamud.Plugin.Services.IPlayerState.BaseDexterity;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
20+
P:Dalamud.Plugin.Services.IPlayerState.BaseVitality;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
21+
P:Dalamud.Plugin.Services.IPlayerState.BaseIntelligence;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
22+
P:Dalamud.Plugin.Services.IPlayerState.BaseMind;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
23+
P:Dalamud.Plugin.Services.IPlayerState.BasePiety;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
24+
P:Dalamud.Plugin.Services.IPlayerState.GrandCompany;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
25+
P:Dalamud.Plugin.Services.IPlayerState.HomeAetheryte;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
26+
P:Dalamud.Plugin.Services.IPlayerState.FavoriteAetherytes;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
27+
P:Dalamud.Plugin.Services.IPlayerState.FreeAetheryte;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
28+
P:Dalamud.Plugin.Services.IPlayerState.BaseRestedExperience;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
29+
P:Dalamud.Plugin.Services.IPlayerState.PlayerCommendations;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
30+
P:Dalamud.Plugin.Services.IPlayerState.DeliveryLevel;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
31+
P:Dalamud.Plugin.Services.IPlayerState.MentorVersion;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
32+
P:Dalamud.Plugin.Services.IPlayerState.IsMentor;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
33+
P:Dalamud.Plugin.Services.IPlayerState.IsBattleMentor;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
34+
P:Dalamud.Plugin.Services.IPlayerState.IsTradeMentor;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
35+
P:Dalamud.Plugin.Services.IPlayerState.IsNovice;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
36+
P:Dalamud.Plugin.Services.IPlayerState.IsReturner;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
37+
M:Dalamud.Plugin.Services.IPlayerState.GetAttribute;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
38+
M:Dalamud.Plugin.Services.IPlayerState.GetGrandCompanyRank;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
39+
M:Dalamud.Plugin.Services.IPlayerState.GetClassJobLevel;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
40+
M:Dalamud.Plugin.Services.IPlayerState.GetClassJobExperience;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.
41+
M:Dalamud.Plugin.Services.IPlayerState.GetDesynthesisLevel;IPlayerState usage discouraged because of poor implementation. You can remove a method or property from BannedSymbols.txt if there is no other sane way to obtain desired data.

ECommons/ECommons.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<Authors>NightmareXIV</Authors>
5-
<BaseVersion>3.1.0.9</BaseVersion>
5+
<BaseVersion>3.1.0.10</BaseVersion>
66
<PackageKind></PackageKind>
77
<VersionSuffix Condition="'$(PackageKind)' != ''">-$(PackageKind)</VersionSuffix>
88
<Version>$(BaseVersion)$(VersionSuffix)</Version>

ECommons/GameHelpers/LegacyPlayer.cs

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,66 +33,52 @@ public static unsafe class Player
3333
{
3434
public static readonly Number MaxLevel = 100;
3535
public static IPlayerCharacter Object => Svc.Objects.LocalPlayer;
36-
public static bool Available => Svc.Objects.LocalPlayer != null;
37-
[Obsolete("Use GameHelpers.Player.Available")]
36+
public static bool Available => Object != null;
3837
public static bool AvailableThreadSafe => GameObjectManager.Instance()->Objects.IndexSorted[0].Value != null;
3938
public static bool Interactable => Available && Object.IsTargetable;
4039
public static bool IsBusy => GenericHelpers.IsOccupied() || Object.IsCasting || IsMoving || IsAnimationLocked || Svc.Condition[ConditionFlag.InCombat];
4140
public static ulong CID => Svc.PlayerState.ContentId;
42-
public static StatusList Status => Svc.Objects.LocalPlayer?.StatusList;
43-
44-
public static string Name => Svc.PlayerState.CharacterName;
45-
public static string NameWithWorld => GetNameWithWorld(Object);
46-
public static string GetNameWithWorld(this IPlayerCharacter pc) => pc == null ? null : (pc.Name.ToString() + "@" + pc.HomeWorld.ValueNullable?.Name.ToString());
41+
public static StatusList Status => Object?.StatusList;
42+
public static string? Name => Object?.Name.ToString();
43+
public static string? NameWithWorld => GetNameWithWorld(Object);
44+
public static string? GetNameWithWorld(this IPlayerCharacter pc) => pc == null ? null : (pc.Name.ToString() + "@" + pc.HomeWorld.ValueNullable?.Name.ToString());
4745
public static RowRef<Race> Race => Svc.PlayerState.Race;
4846
public static Sex Sex => Svc.PlayerState.Sex;
4947

5048
/// <remarks>Is unaffected by Level Sync</remarks>
51-
public static int Level => Svc.PlayerState.Level;
49+
public static int Level => Object?.Level ?? 0;
5250
public static bool IsLevelSynced => PlayerState.Instance()->IsLevelSynced;
53-
public static int SyncedLevel => Svc.PlayerState.EffectiveLevel;
51+
public static int SyncedLevel => ECommons.GameHelpers.Player.SyncedLevel;
5452
[Obsolete("Use Level instead")]
5553
public static int UnsyncedLevel => GetUnsyncedLevel(GetJob(Object));
5654
public static int GetUnsyncedLevel(Job job) => Svc.PlayerState.GetClassJobLevel(job.GetGameData().Value);
5755

58-
public static bool IsInHomeWorld => Available && Svc.PlayerState.CurrentWorld.RowId == Svc.PlayerState.HomeWorld.RowId;
59-
public static bool IsInHomeDC => Available && Svc.PlayerState.CurrentWorld.Value.DataCenter.RowId == Svc.PlayerState.HomeWorld.Value.DataCenter.RowId;
60-
[Obsolete("Use GameHelpers.Player.HomeWorldName")]
61-
public static string HomeWorld => Svc.PlayerState.HomeWorld.Value.Name.ToString();
62-
[Obsolete("Use GameHelpers.Player.CurrentWorldName")]
63-
public static string CurrentWorld => Svc.PlayerState.CurrentWorld.Value.Name.ToString();
64-
[Obsolete("Use GameHelpers.Player.HomeDataCenterName")]
65-
public static string HomeDataCenter => Svc.PlayerState.HomeWorld.Value.DataCenter.Value.Name.ToString();
66-
[Obsolete("Use GameHelpers.Player.CurrentDataCenterName")]
67-
public static string CurrentDataCenter => Svc.PlayerState.CurrentWorld.Value.DataCenter.Value.Name.ToString();
56+
public static bool IsInHomeWorld => Available && Object.CurrentWorld.RowId == Object.HomeWorld.RowId;
57+
public static bool IsInHomeDC => Available && Object.CurrentWorld.Value.DataCenter.RowId == Object.HomeWorld.Value.DataCenter.RowId;
58+
public static string HomeWorld => Object.HomeWorld.Value.Name.ToString();
59+
public static string CurrentWorld => Object.CurrentWorld.Value.Name.ToString();
60+
public static string HomeDataCenter => Object.HomeWorld.Value.DataCenter.Value.Name.ToString();
61+
public static string CurrentDataCenter => Object.CurrentWorld.Value.DataCenter.Value.Name.ToString();
6862

6963
public static Character* Character => (Character*)Object.Address;
7064
public static BattleChara* BattleChara => (BattleChara*)Object.Address;
7165
public static GameObject* GameObject => (GameObject*)Object.Address;
7266

73-
[Obsolete("Use GameHelpers.Player.Territory.RowId")]
7467
public static uint Territory => Svc.ClientState.TerritoryType;
75-
[Obsolete("Use GameHelpers.Player.TerritoryIntendedUseEnum")]
7668
public static TerritoryIntendedUseEnum TerritoryIntendedUse => (TerritoryIntendedUseEnum)(Svc.Data.GetExcelSheet<TerritoryType>().GetRowOrDefault(Territory)?.TerritoryIntendedUse.ValueNullable?.RowId ?? default);
77-
[Obsolete("Use GameHelpers.Player.HomeAetheryteTerritory.RowId")]
7869
public static uint HomeAetheryteTerritory => Svc.Data.GetExcelSheet<Aetheryte>().GetRowOrDefault(PlayerState.Instance()->HomeAetheryteId).Value.Territory.RowId;
7970
public static bool IsInDuty => GameMain.Instance()->CurrentContentFinderConditionId != 0;
8071
public static bool IsOnIsland => MJIManager.Instance()->IsPlayerInSanctuary;
8172
public static bool IsInPvP => GameMain.IsInPvPInstance();
8273

83-
public static RowRef<ClassJob> ClassJob => Svc.PlayerState.ClassJob;
84-
public static Job Job => (Job)Svc.PlayerState.ClassJob.RowId;
74+
public static RowRef<ClassJob> ClassJob => Object?.ClassJob ?? default;
75+
public static Job Job => Object?.GetJob() ?? 0;
8576
public static GrandCompany GrandCompany => (GrandCompany)PlayerState.Instance()->GrandCompany;
86-
[Obsolete("Use GameHelpers.Player.Job")]
8777
public static Job GetJob(this IPlayerCharacter pc) => (Job)(pc?.ClassJob.RowId ?? 0);
8878

89-
[Obsolete("Use GameHelpers.Player.HomeWorld.RowId")]
90-
public static uint HomeWorldId => Svc.PlayerState.HomeWorld.RowId;
91-
[Obsolete("Use GameHelpers.Player.CurrentWorld.RowId")]
92-
public static uint CurrentWorldId => Svc.PlayerState.CurrentWorld.RowId;
93-
[Obsolete("Use GameHelpers.Player.ClassJob.RowId")]
94-
public static uint JobId => Svc.PlayerState.ClassJob.RowId;
95-
[Obsolete("Use GameHelpers.Player.OnlineStatus.RowId")]
79+
public static uint HomeWorldId => Object.HomeWorld.RowId;
80+
public static uint CurrentWorldId => Object.CurrentWorld.RowId;
81+
public static uint JobId => Object.ClassJob.RowId;
9682
public static uint OnlineStatus => Player.Object?.OnlineStatus.RowId ?? 0;
9783

9884
public static Vector3 Position => Available ? Object.Position : Vector3.Zero;

ECommons/GameHelpers/Player.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ public static bool IsBusy
4444
|| Svc.Condition[ConditionFlag.InCombat]
4545
|| GameMain.Instance()->TerritoryLoadState != 2;
4646

47-
public static string Name => Svc.PlayerState.CharacterName;
47+
public static string? Name => Object.Name.ToString();
4848
public static string NameWithWorld => GetNameWithWorld(Object) ?? string.Empty;
4949
public static string GetNameWithWorld(this IPlayerCharacter? pc) => pc == null ? string.Empty : (pc.Name.ToString() + "@" + pc.HomeWorld.ValueNullable?.Name.ToString());
5050
public static ulong CID => Svc.PlayerState.ContentId;
5151
public static StatusList Status => Object?.StatusList ?? default!;
5252
public static Sex Sex => Svc.PlayerState.Sex;
5353

5454
/// <remarks>Unsynced level</remarks>
55-
public static int Level => Svc.PlayerState.Level;
55+
public static int Level => Object?.Level ?? 0;
5656
public static Number MaxLevel => PlayerState.Instance()->MaxLevel;
5757
public static bool IsLevelSynced => PlayerState.Instance()->IsLevelSynced;
5858
public static int SyncedLevel => PlayerState.Instance()->SyncedLevel;
@@ -62,14 +62,14 @@ public static bool IsBusy
6262
#region Excel
6363
public static RowRef<Race> Race => Svc.PlayerState.Race;
6464
public static RowRef<Tribe> Tribe => Lumina.Excel.Sheets.Tribe.GetRef(PlayerState.Instance()->Tribe);
65-
public static RowRef<World> HomeWorld => Svc.PlayerState.HomeWorld;
66-
public static RowRef<World> CurrentWorld => Svc.PlayerState.CurrentWorld;
65+
public static RowRef<World> HomeWorld => Object?.HomeWorld ?? default;
66+
public static RowRef<World> CurrentWorld => Object?.CurrentWorld ?? default;
6767
public static RowRef<WorldDCGroupType> HomeDateCenter => HomeWorld.Value.DataCenter;
6868
public static RowRef<WorldDCGroupType> CurrentDataCenter => CurrentWorld.Value.DataCenter;
6969
public static RowRef<TerritoryType> Territory => TerritoryType.GetRef(Svc.ClientState.TerritoryType);
7070
public static RowRef<TerritoryIntendedUse> TerritoryIntendedUse => Territory.Value.TerritoryIntendedUse;
7171
public static RowRef<TerritoryType> HomeAetheryteTerritory => Aetheryte.GetRef(PlayerState.Instance()->HomeAetheryteId).Value.Territory;
72-
public static RowRef<ClassJob> ClassJob => Svc.PlayerState.ClassJob;
72+
public static RowRef<ClassJob> ClassJob => Object?.ClassJob ?? default;
7373
public static RowRef<OnlineStatus> OnlineStatus => Object?.OnlineStatus ?? default;
7474
public static RowRef<ContentFinderCondition> ContentFinderCondition => Lumina.Excel.Sheets.ContentFinderCondition.GetRef(GameMain.Instance()->CurrentContentFinderConditionId);
7575

0 commit comments

Comments
 (0)