clear actionqueue on zoneswitch
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.4.7</Version>
|
||||
<Version>0.4.8</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace MareSynchronos.Utils
|
||||
public event ClassJobChanged? ClassJobChanged;
|
||||
private uint? classJobId = 0;
|
||||
public event FrameworkUpdate? DelayedFrameworkUpdate;
|
||||
public event VoidDelegate? ZoneSwitched;
|
||||
public event VoidDelegate? ZoneSwitchStart;
|
||||
public event VoidDelegate? ZoneSwitchEnd;
|
||||
private DateTime _delayedFrameworkUpdateCheck = DateTime.Now;
|
||||
private bool _sentBetweenAreas = false;
|
||||
|
||||
@@ -74,15 +75,19 @@ namespace MareSynchronos.Utils
|
||||
{
|
||||
if (!_sentBetweenAreas)
|
||||
{
|
||||
Logger.Debug("Invoking between areas");
|
||||
Logger.Debug("Zone switch start");
|
||||
_sentBetweenAreas = true;
|
||||
ZoneSwitched?.Invoke();
|
||||
ZoneSwitchStart?.Invoke();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
else if (_sentBetweenAreas)
|
||||
{
|
||||
Logger.Debug("Zone switch end");
|
||||
_sentBetweenAreas = false;
|
||||
ZoneSwitchEnd?.Invoke();
|
||||
}
|
||||
|
||||
foreach (FrameworkUpdate? frameworkInvocation in (FrameworkUpdate?.GetInvocationList() ?? Array.Empty<FrameworkUpdate>()).Cast<FrameworkUpdate>())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user