halt applying data during performance
This commit is contained in:
@@ -37,7 +37,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
private bool _isVisible;
|
private bool _isVisible;
|
||||||
private string _penumbraCollection;
|
private string _penumbraCollection;
|
||||||
private bool _redrawOnNextApplication = false;
|
private bool _redrawOnNextApplication = false;
|
||||||
private CombatData? _dataReceivedInCombat;
|
private CombatData? _dataReceivedInDowntime;
|
||||||
public long LastAppliedDataSize { get; private set; }
|
public long LastAppliedDataSize { get; private set; }
|
||||||
|
|
||||||
public PairHandler(ILogger<PairHandler> logger, OnlineUserIdentDto onlineUser,
|
public PairHandler(ILogger<PairHandler> logger, OnlineUserIdentDto onlineUser,
|
||||||
@@ -81,18 +81,18 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
_redrawOnNextApplication = true;
|
_redrawOnNextApplication = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Mediator.Subscribe<CombatEndMessage>(this, (msg) =>
|
Mediator.Subscribe<CombatOrPerformanceEndMessage>(this, (msg) =>
|
||||||
{
|
{
|
||||||
if (IsVisible && _dataReceivedInCombat != null)
|
if (IsVisible && _dataReceivedInDowntime != null)
|
||||||
{
|
{
|
||||||
ApplyCharacterData(_dataReceivedInCombat.ApplicationId,
|
ApplyCharacterData(_dataReceivedInDowntime.ApplicationId,
|
||||||
_dataReceivedInCombat.CharacterData, _dataReceivedInCombat.Forced);
|
_dataReceivedInDowntime.CharacterData, _dataReceivedInDowntime.Forced);
|
||||||
_dataReceivedInCombat = null;
|
_dataReceivedInDowntime = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Mediator.Subscribe<CombatStartMessage>(this, _ =>
|
Mediator.Subscribe<CombatOrPerformanceStartMessage>(this, _ =>
|
||||||
{
|
{
|
||||||
_dataReceivedInCombat = null;
|
_dataReceivedInDowntime = null;
|
||||||
_downloadCancellationTokenSource = _downloadCancellationTokenSource?.CancelRecreate();
|
_downloadCancellationTokenSource = _downloadCancellationTokenSource?.CancelRecreate();
|
||||||
_applicationCancellationTokenSource = _applicationCancellationTokenSource?.CancelRecreate();
|
_applicationCancellationTokenSource = _applicationCancellationTokenSource?.CancelRecreate();
|
||||||
});
|
});
|
||||||
@@ -122,10 +122,10 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
|
|
||||||
public void ApplyCharacterData(Guid applicationBase, CharacterData characterData, bool forceApplyCustomization = false)
|
public void ApplyCharacterData(Guid applicationBase, CharacterData characterData, bool forceApplyCustomization = false)
|
||||||
{
|
{
|
||||||
if (_dalamudUtil.IsInCombat)
|
if (_dalamudUtil.IsInCombatOrPerforming)
|
||||||
{
|
{
|
||||||
Logger.LogDebug("[BASE-{appBase}] Received data but player is in combat", applicationBase);
|
Logger.LogDebug("[BASE-{appBase}] Received data but player is in combat or performing", applicationBase);
|
||||||
_dataReceivedInCombat = new(applicationBase, characterData, forceApplyCustomization);
|
_dataReceivedInDowntime = new(applicationBase, characterData, forceApplyCustomization);
|
||||||
SetUploading(isUploading: false);
|
SetUploading(isUploading: false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
public bool IsLoggedIn { get; private set; }
|
public bool IsLoggedIn { get; private set; }
|
||||||
public bool IsOnFrameworkThread => _framework.IsInFrameworkUpdateThread;
|
public bool IsOnFrameworkThread => _framework.IsInFrameworkUpdateThread;
|
||||||
public bool IsZoning => _condition[ConditionFlag.BetweenAreas] || _condition[ConditionFlag.BetweenAreas51];
|
public bool IsZoning => _condition[ConditionFlag.BetweenAreas] || _condition[ConditionFlag.BetweenAreas51];
|
||||||
public bool IsInCombat { get; private set; } = false;
|
public bool IsInCombatOrPerforming { get; private set; } = false;
|
||||||
|
|
||||||
public Lazy<Dictionary<ushort, string>> WorldData { get; private set; }
|
public Lazy<Dictionary<ushort, string>> WorldData { get; private set; }
|
||||||
|
|
||||||
@@ -459,19 +459,19 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
Mediator.Publish(new GposeEndMessage());
|
Mediator.Publish(new GposeEndMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_condition[ConditionFlag.InCombat] && !IsInCombat)
|
if ((_condition[ConditionFlag.Performing] || _condition[ConditionFlag.InCombat]) && !IsInCombatOrPerforming)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Combat start");
|
_logger.LogDebug("Combat/Performance start");
|
||||||
IsInCombat = true;
|
IsInCombatOrPerforming = true;
|
||||||
Mediator.Publish(new CombatStartMessage());
|
Mediator.Publish(new CombatOrPerformanceStartMessage());
|
||||||
Mediator.Publish(new HaltScanMessage(nameof(IsInCombat)));
|
Mediator.Publish(new HaltScanMessage(nameof(IsInCombatOrPerforming)));
|
||||||
}
|
}
|
||||||
else if (!_condition[ConditionFlag.InCombat] && IsInCombat)
|
else if ((!_condition[ConditionFlag.Performing] && !_condition[ConditionFlag.InCombat]) && IsInCombatOrPerforming)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Combat end");
|
_logger.LogDebug("Combat/Performance end");
|
||||||
IsInCombat = false;
|
IsInCombatOrPerforming = false;
|
||||||
Mediator.Publish(new CombatEndMessage());
|
Mediator.Publish(new CombatOrPerformanceEndMessage());
|
||||||
Mediator.Publish(new ResumeScanMessage(nameof(IsInCombat)));
|
Mediator.Publish(new ResumeScanMessage(nameof(IsInCombatOrPerforming)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_condition[ConditionFlag.WatchingCutscene] && !IsInCutscene)
|
if (_condition[ConditionFlag.WatchingCutscene] && !IsInCutscene)
|
||||||
@@ -517,7 +517,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
Mediator.Publish(new ResumeScanMessage(nameof(ConditionFlag.BetweenAreas)));
|
Mediator.Publish(new ResumeScanMessage(nameof(ConditionFlag.BetweenAreas)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsInCombat)
|
if (!IsInCombatOrPerforming)
|
||||||
Mediator.Publish(new FrameworkUpdateMessage());
|
Mediator.Publish(new FrameworkUpdateMessage());
|
||||||
|
|
||||||
if (DateTime.Now < _delayedFrameworkUpdateCheck.AddSeconds(1)) return;
|
if (DateTime.Now < _delayedFrameworkUpdateCheck.AddSeconds(1)) return;
|
||||||
@@ -538,7 +538,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
Mediator.Publish(new DalamudLogoutMessage());
|
Mediator.Publish(new DalamudLogoutMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsInCombat)
|
if (IsInCombatOrPerforming)
|
||||||
Mediator.Publish(new FrameworkUpdateMessage());
|
Mediator.Publish(new FrameworkUpdateMessage());
|
||||||
|
|
||||||
Mediator.Publish(new DelayedFrameworkUpdateMessage());
|
Mediator.Publish(new DelayedFrameworkUpdateMessage());
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ public record OpenPermissionWindow(Pair Pair) : MessageBase;
|
|||||||
public record DownloadLimitChangedMessage() : SameThreadMessage;
|
public record DownloadLimitChangedMessage() : SameThreadMessage;
|
||||||
public record CensusUpdateMessage(byte Gender, byte RaceId, byte TribeId) : MessageBase;
|
public record CensusUpdateMessage(byte Gender, byte RaceId, byte TribeId) : MessageBase;
|
||||||
public record TargetPairMessage(Pair Pair) : MessageBase;
|
public record TargetPairMessage(Pair Pair) : MessageBase;
|
||||||
public record CombatStartMessage : MessageBase;
|
public record CombatOrPerformanceStartMessage : MessageBase;
|
||||||
public record CombatEndMessage : MessageBase;
|
public record CombatOrPerformanceEndMessage : MessageBase;
|
||||||
|
|
||||||
#pragma warning restore S2094
|
#pragma warning restore S2094
|
||||||
#pragma warning restore MA0048 // File name must match type name
|
#pragma warning restore MA0048 // File name must match type name
|
||||||
Reference in New Issue
Block a user