clear actionqueue on zoneswitch

This commit is contained in:
Stanley Dimant
2022-09-17 13:29:08 +02:00
parent a27fa1a13d
commit 6149d7eb73
6 changed files with 38 additions and 30 deletions

View File

@@ -269,7 +269,7 @@ public class CachedPlayer
ct.ThrowIfCancellationRequested();
if (_ipcManager.CheckGlamourerApi() && !string.IsNullOrEmpty(glamourerData))
{
_ipcManager.GlamourerApplyAll(glamourerData, obj: (IntPtr)minionOrMount);
_ipcManager.GlamourerApplyAll(glamourerData, (IntPtr)minionOrMount);
}
else
{
@@ -426,8 +426,8 @@ public class CachedPlayer
{
if (!_dalamudUtil.IsPlayerPresent || !_ipcManager.Initialized || !_apiController.IsConnected) return;
PlayerCharacter = _dalamudUtil.GetPlayerCharacterFromObjectTableByName(PlayerName!)?.Address ?? IntPtr.Zero;
if (PlayerCharacter == IntPtr.Zero)
var curPlayerCharacter = _dalamudUtil.GetPlayerCharacterFromObjectTableByName(PlayerName!)?.Address ?? IntPtr.Zero;
if (PlayerCharacter == IntPtr.Zero || PlayerCharacter != curPlayerCharacter)
{
DisposePlayer();
return;

View File

@@ -61,13 +61,12 @@ namespace MareSynchronos.Managers
_penumbraObjectIsRedrawn = pi.GetIpcSubscriber<IntPtr, int, object?>("Penumbra.GameObjectRedrawn");
_penumbraGetMetaManipulations =
pi.GetIpcSubscriber<string>("Penumbra.GetPlayerMetaManipulations");
_glamourerApiVersion = pi.GetIpcSubscriber<int>("Glamourer.ApiVersion");
_glamourerGetAllCustomization = pi.GetIpcSubscriber<GameObject?, string>("Glamourer.GetAllCustomizationFromCharacter");
_glamourerApplyAll = pi.GetIpcSubscriber<string, GameObject?, object>("Glamourer.ApplyAllToCharacter");
_glamourerApplyOnlyCustomization = pi.GetIpcSubscriber<string, GameObject?, object>("Glamourer.ApplyOnlyCustomizationToCharacter");
_glamourerApplyOnlyEquipment = pi.GetIpcSubscriber<string, GameObject?, object>("Glamourer.ApplyOnlyEquipmentToCharacter");
_glamourerRevertCustomization = pi.GetIpcSubscriber<GameObject?, object>("Glamourer.RevertCharacter");
_penumbraSetTemporaryMod = pi.GetIpcSubscriber<string, string, Dictionary<string, string>, string, int,
int>("Penumbra.AddTemporaryMod");
_penumbraCreateTemporaryCollection =
pi.GetIpcSubscriber<string, string, bool, (int, string)>("Penumbra.CreateTemporaryCollection");
_penumbraRemoveTemporaryCollection =
pi.GetIpcSubscriber<string, int>("Penumbra.RemoveTemporaryCollection");
_penumbraGameObjectResourcePathResolved = pi.GetIpcSubscriber<IntPtr, string, string, object?>("Penumbra.GameObjectResourcePathResolved");
_penumbraGameObjectResourcePathResolved.Subscribe(ResourceLoaded);
@@ -75,15 +74,12 @@ namespace MareSynchronos.Managers
_penumbraInit.Subscribe(PenumbraInit);
_penumbraDispose.Subscribe(PenumbraDispose);
_penumbraSetTemporaryMod =
pi
.GetIpcSubscriber<string, string, Dictionary<string, string>, string, int,
int>("Penumbra.AddTemporaryMod");
_penumbraCreateTemporaryCollection =
pi.GetIpcSubscriber<string, string, bool, (int, string)>("Penumbra.CreateTemporaryCollection");
_penumbraRemoveTemporaryCollection =
pi.GetIpcSubscriber<string, int>("Penumbra.RemoveTemporaryCollection");
_glamourerApiVersion = pi.GetIpcSubscriber<int>("Glamourer.ApiVersion");
_glamourerGetAllCustomization = pi.GetIpcSubscriber<GameObject?, string>("Glamourer.GetAllCustomizationFromCharacter");
_glamourerApplyAll = pi.GetIpcSubscriber<string, GameObject?, object>("Glamourer.ApplyAllToCharacter");
_glamourerApplyOnlyCustomization = pi.GetIpcSubscriber<string, GameObject?, object>("Glamourer.ApplyOnlyCustomizationToCharacter");
_glamourerApplyOnlyEquipment = pi.GetIpcSubscriber<string, GameObject?, object>("Glamourer.ApplyOnlyEquipmentToCharacter");
_glamourerRevertCustomization = pi.GetIpcSubscriber<GameObject?, object>("Glamourer.RevertCharacter");
_heelsGetApiVersion = pi.GetIpcSubscriber<string>("HeelsPlugin.ApiVersion");
_heelsGetOffset = pi.GetIpcSubscriber<float>("HeelsPlugin.GetOffset");
@@ -98,8 +94,14 @@ namespace MareSynchronos.Managers
PenumbraInitialized?.Invoke();
}
this._dalamudUtil = dalamudUtil;
_dalamudUtil = dalamudUtil;
_dalamudUtil.FrameworkUpdate += HandleActionQueue;
_dalamudUtil.ZoneSwitchEnd += ClearActionQueue;
}
private void ClearActionQueue()
{
actionQueue.Clear();
}
private void ResourceLoaded(IntPtr ptr, string arg1, string arg2)
@@ -178,6 +180,7 @@ namespace MareSynchronos.Managers
Logger.Verbose("Action queue clear or not, disposing");
_dalamudUtil.FrameworkUpdate -= HandleActionQueue;
_dalamudUtil.ZoneSwitchEnd -= ClearActionQueue;
actionQueue.Clear();
_penumbraDispose.Unsubscribe(PenumbraDispose);

View File

@@ -46,7 +46,7 @@ public class OnlinePlayerManager : IDisposable
_dalamudUtil.LogIn += DalamudUtilOnLogIn;
_dalamudUtil.LogOut += DalamudUtilOnLogOut;
_dalamudUtil.ZoneSwitched += DalamudUtilOnZoneSwitched;
_dalamudUtil.ZoneSwitchStart += DalamudUtilOnZoneSwitched;
if (_dalamudUtil.IsLoggedIn)
{
@@ -145,7 +145,7 @@ public class OnlinePlayerManager : IDisposable
_dalamudUtil.LogIn -= DalamudUtilOnLogIn;
_dalamudUtil.LogOut -= DalamudUtilOnLogOut;
_dalamudUtil.ZoneSwitched -= DalamudUtilOnZoneSwitched;
_dalamudUtil.ZoneSwitchStart -= DalamudUtilOnZoneSwitched;
_dalamudUtil.DelayedFrameworkUpdate -= FrameworkOnUpdate;
}

View File

@@ -240,8 +240,8 @@ namespace MareSynchronos.Managers
if (cacheDto == null || token.IsCancellationRequested) return;
#if DEBUG
var json = JsonConvert.SerializeObject(cacheDto, Formatting.Indented);
Logger.Verbose(json);
//var json = JsonConvert.SerializeObject(cacheDto, Formatting.Indented);
//Logger.Verbose(json);
#endif
if ((LastCreatedCharacterData?.GetHashCode() ?? 0) == cacheDto.GetHashCode())