Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't use a hook for ClientState#TerritoryType #2108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading