Skip to content

Commit

Permalink
fix: Don't use a hook for ClientState#TerritoryType
Browse files Browse the repository at this point in the history
- We can just read this from the game data.
  • Loading branch information
KazWolfe committed Nov 19, 2024
1 parent d538ce6 commit 52ac48c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Dalamud/Game/ClientState/ClientState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private unsafe ClientState(TargetSigScanner sigScanner, Dalamud dalamud, GameLif
public ClientLanguage ClientLanguage { get; }

/// <inheritdoc/>
public ushort TerritoryType { get; private set; }
public ushort TerritoryType => this.GetCurrentTerritoryTypeId();

/// <inheritdoc/>
public unsafe uint MapId
Expand Down Expand Up @@ -185,7 +185,6 @@ private unsafe void SetupTerritoryTypeDetour(EventFramework* eventFramework, ush
{
Log.Debug("TerritoryType changed: {0}", territoryType);

this.TerritoryType = territoryType;
this.TerritoryChanged?.InvokeSafely(territoryType);

var rowRef = LuminaUtils.CreateRef<TerritoryType>(territoryType);
Expand Down Expand Up @@ -326,6 +325,11 @@ private void NetworkHandlersOnCfPop(ContentFinderCondition e)
{
this.CfPop?.InvokeSafely(e);
}

private unsafe ushort GetCurrentTerritoryTypeId()
{
return (ushort)GameMain.Instance()->CurrentTerritoryTypeId;
}
}

/// <summary>
Expand Down

0 comments on commit 52ac48c

Please sign in to comment.