mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Set ClientState.TerritoryType on load (#2366)
* Set TerritoryType on load * Do not fire TerritoryChanged event on load
This commit is contained in:
parent
e2f3fdd0ff
commit
f687852879
1 changed files with 16 additions and 2 deletions
|
|
@ -72,6 +72,8 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
||||||
this.setupTerritoryTypeHook.Enable();
|
this.setupTerritoryTypeHook.Enable();
|
||||||
this.uiModuleHandlePacketHook.Enable();
|
this.uiModuleHandlePacketHook.Enable();
|
||||||
this.onLogoutHook.Enable();
|
this.onLogoutHook.Enable();
|
||||||
|
|
||||||
|
this.framework.RunOnTick(this.Setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe delegate void ProcessPacketPlayerSetupDelegate(nint a1, nint packet);
|
private unsafe delegate void ProcessPacketPlayerSetupDelegate(nint a1, nint packet);
|
||||||
|
|
@ -180,8 +182,22 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
||||||
this.networkHandlers.CfPop -= this.NetworkHandlersOnCfPop;
|
this.networkHandlers.CfPop -= this.NetworkHandlersOnCfPop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private unsafe void Setup()
|
||||||
|
{
|
||||||
|
this.TerritoryType = (ushort)GameMain.Instance()->CurrentTerritoryTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
private unsafe void SetupTerritoryTypeDetour(EventFramework* eventFramework, ushort territoryType)
|
private unsafe void SetupTerritoryTypeDetour(EventFramework* eventFramework, ushort territoryType)
|
||||||
{
|
{
|
||||||
|
this.SetTerritoryType(territoryType);
|
||||||
|
this.setupTerritoryTypeHook.Original(eventFramework, territoryType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private unsafe void SetTerritoryType(ushort territoryType)
|
||||||
|
{
|
||||||
|
if (this.TerritoryType == territoryType)
|
||||||
|
return;
|
||||||
|
|
||||||
Log.Debug("TerritoryType changed: {0}", territoryType);
|
Log.Debug("TerritoryType changed: {0}", territoryType);
|
||||||
|
|
||||||
this.TerritoryType = territoryType;
|
this.TerritoryType = territoryType;
|
||||||
|
|
@ -207,8 +223,6 @@ internal sealed class ClientState : IInternalDisposableService, IClientState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setupTerritoryTypeHook.Original(eventFramework, territoryType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void UIModuleHandlePacketDetour(
|
private unsafe void UIModuleHandlePacketDetour(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue