disable data application and scanner in combat
This commit is contained in:
@@ -177,7 +177,7 @@ public sealed class FileCacheManager : IDisposable
|
|||||||
|
|
||||||
public Task<List<FileCacheEntity>> ValidateLocalIntegrity(IProgress<(int, int, FileCacheEntity)> progress, CancellationToken cancellationToken)
|
public Task<List<FileCacheEntity>> ValidateLocalIntegrity(IProgress<(int, int, FileCacheEntity)> progress, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_mareMediator.Publish(new HaltScanMessage("IntegrityCheck"));
|
_mareMediator.Publish(new HaltScanMessage(nameof(ValidateLocalIntegrity)));
|
||||||
_logger.LogInformation("Validating local storage");
|
_logger.LogInformation("Validating local storage");
|
||||||
var cacheEntries = _fileCaches.SelectMany(v => v.Value).Where(v => v.IsCacheEntry).ToList();
|
var cacheEntries = _fileCaches.SelectMany(v => v.Value).Where(v => v.IsCacheEntry).ToList();
|
||||||
List<FileCacheEntity> brokenEntities = new();
|
List<FileCacheEntity> brokenEntities = new();
|
||||||
@@ -212,7 +212,7 @@ public sealed class FileCacheManager : IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_mareMediator.Publish(new ResumeScanMessage("IntegrityCheck"));
|
_mareMediator.Publish(new ResumeScanMessage(nameof(ValidateLocalIntegrity)));
|
||||||
return Task.FromResult(brokenEntities);
|
return Task.FromResult(brokenEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public sealed class TransientResourceManager : DisposableMediatorSubscriberBase
|
|||||||
Mediator.Subscribe<FrameworkUpdateMessage>(this, (_) => DalamudUtil_FrameworkUpdate());
|
Mediator.Subscribe<FrameworkUpdateMessage>(this, (_) => DalamudUtil_FrameworkUpdate());
|
||||||
Mediator.Subscribe<ClassJobChangedMessage>(this, (msg) =>
|
Mediator.Subscribe<ClassJobChangedMessage>(this, (msg) =>
|
||||||
{
|
{
|
||||||
if (_playerRelatedPointers.Contains(msg.gameObjectHandler))
|
if (_playerRelatedPointers.Contains(msg.GameObjectHandler))
|
||||||
{
|
{
|
||||||
DalamudUtil_ClassJobChanged();
|
DalamudUtil_ClassJobChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
if (!CheckPenumbraApi()) return;
|
if (!CheckPenumbraApi()) return;
|
||||||
|
|
||||||
Mediator.Publish(new HaltScanMessage("TextureConversion"));
|
Mediator.Publish(new HaltScanMessage(nameof(PenumbraConvertTextureFiles)));
|
||||||
int currentTexture = 0;
|
int currentTexture = 0;
|
||||||
foreach (var texture in textures)
|
foreach (var texture in textures)
|
||||||
{
|
{
|
||||||
@@ -519,7 +519,7 @@ public sealed class IpcManager : DisposableMediatorSubscriberBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mediator.Publish(new ResumeScanMessage("TextureConversion"));
|
Mediator.Publish(new ResumeScanMessage(nameof(PenumbraConvertTextureFiles)));
|
||||||
|
|
||||||
await _dalamudUtil.RunOnFrameworkThread(async () =>
|
await _dalamudUtil.RunOnFrameworkThread(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using MareSynchronos.API.Dto.User;
|
using MareSynchronos.API.Dto.User;
|
||||||
using MareSynchronos.FileCache;
|
using MareSynchronos.FileCache;
|
||||||
using MareSynchronos.Interop;
|
using MareSynchronos.Interop;
|
||||||
using MareSynchronos.MareConfiguration;
|
|
||||||
using MareSynchronos.PlayerData.Handlers;
|
using MareSynchronos.PlayerData.Handlers;
|
||||||
using MareSynchronos.PlayerData.Pairs;
|
using MareSynchronos.PlayerData.Pairs;
|
||||||
using MareSynchronos.Services;
|
using MareSynchronos.Services;
|
||||||
@@ -21,13 +20,12 @@ public class PairHandlerFactory
|
|||||||
private readonly IpcManager _ipcManager;
|
private readonly IpcManager _ipcManager;
|
||||||
private readonly ILoggerFactory _loggerFactory;
|
private readonly ILoggerFactory _loggerFactory;
|
||||||
private readonly MareMediator _mareMediator;
|
private readonly MareMediator _mareMediator;
|
||||||
private readonly MareConfigService _mareConfigService;
|
|
||||||
private readonly PluginWarningNotificationService _pluginWarningNotificationManager;
|
private readonly PluginWarningNotificationService _pluginWarningNotificationManager;
|
||||||
|
|
||||||
public PairHandlerFactory(ILoggerFactory loggerFactory, GameObjectHandlerFactory gameObjectHandlerFactory, IpcManager ipcManager,
|
public PairHandlerFactory(ILoggerFactory loggerFactory, GameObjectHandlerFactory gameObjectHandlerFactory, IpcManager ipcManager,
|
||||||
FileDownloadManagerFactory fileDownloadManagerFactory, DalamudUtilService dalamudUtilService,
|
FileDownloadManagerFactory fileDownloadManagerFactory, DalamudUtilService dalamudUtilService,
|
||||||
PluginWarningNotificationService pluginWarningNotificationManager, IHostApplicationLifetime hostApplicationLifetime,
|
PluginWarningNotificationService pluginWarningNotificationManager, IHostApplicationLifetime hostApplicationLifetime,
|
||||||
FileCacheManager fileCacheManager, MareMediator mareMediator, MareConfigService mareConfigService)
|
FileCacheManager fileCacheManager, MareMediator mareMediator)
|
||||||
{
|
{
|
||||||
_loggerFactory = loggerFactory;
|
_loggerFactory = loggerFactory;
|
||||||
_gameObjectHandlerFactory = gameObjectHandlerFactory;
|
_gameObjectHandlerFactory = gameObjectHandlerFactory;
|
||||||
@@ -38,13 +36,12 @@ public class PairHandlerFactory
|
|||||||
_hostApplicationLifetime = hostApplicationLifetime;
|
_hostApplicationLifetime = hostApplicationLifetime;
|
||||||
_fileCacheManager = fileCacheManager;
|
_fileCacheManager = fileCacheManager;
|
||||||
_mareMediator = mareMediator;
|
_mareMediator = mareMediator;
|
||||||
_mareConfigService = mareConfigService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PairHandler Create(OnlineUserIdentDto onlineUserIdentDto)
|
public PairHandler Create(OnlineUserIdentDto onlineUserIdentDto)
|
||||||
{
|
{
|
||||||
return new PairHandler(_loggerFactory.CreateLogger<PairHandler>(), onlineUserIdentDto, _gameObjectHandlerFactory,
|
return new PairHandler(_loggerFactory.CreateLogger<PairHandler>(), onlineUserIdentDto, _gameObjectHandlerFactory,
|
||||||
_ipcManager, _fileDownloadManagerFactory.Create(), _pluginWarningNotificationManager, _dalamudUtilService, _hostApplicationLifetime,
|
_ipcManager, _fileDownloadManagerFactory.Create(), _pluginWarningNotificationManager, _dalamudUtilService, _hostApplicationLifetime,
|
||||||
_fileCacheManager, _mareMediator, _mareConfigService);
|
_fileCacheManager, _mareMediator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -361,6 +361,7 @@ public class PlayerDataFactory
|
|||||||
{
|
{
|
||||||
foreach (var item in previousData.FileReplacements[objectKind].Where(i => i.HasFileReplacement).SelectMany(p => p.GamePaths))
|
foreach (var item in previousData.FileReplacements[objectKind].Where(i => i.HasFileReplacement).SelectMany(p => p.GamePaths))
|
||||||
{
|
{
|
||||||
|
_logger.LogDebug("Persisting {item}", item);
|
||||||
_transientResourceManager.AddSemiTransientResource(objectKind, item);
|
_transientResourceManager.AddSemiTransientResource(objectKind, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using MareSynchronos.API.Dto.User;
|
using MareSynchronos.API.Dto.User;
|
||||||
using MareSynchronos.FileCache;
|
using MareSynchronos.FileCache;
|
||||||
using MareSynchronos.Interop;
|
using MareSynchronos.Interop;
|
||||||
using MareSynchronos.MareConfiguration;
|
|
||||||
using MareSynchronos.PlayerData.Factories;
|
using MareSynchronos.PlayerData.Factories;
|
||||||
using MareSynchronos.PlayerData.Pairs;
|
using MareSynchronos.PlayerData.Pairs;
|
||||||
using MareSynchronos.Services;
|
using MareSynchronos.Services;
|
||||||
@@ -22,7 +21,6 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
private readonly DalamudUtilService _dalamudUtil;
|
private readonly DalamudUtilService _dalamudUtil;
|
||||||
private readonly FileDownloadManager _downloadManager;
|
private readonly FileDownloadManager _downloadManager;
|
||||||
private readonly FileCacheManager _fileDbManager;
|
private readonly FileCacheManager _fileDbManager;
|
||||||
private readonly MareConfigService _mareConfigService;
|
|
||||||
private readonly GameObjectHandlerFactory _gameObjectHandlerFactory;
|
private readonly GameObjectHandlerFactory _gameObjectHandlerFactory;
|
||||||
private readonly IpcManager _ipcManager;
|
private readonly IpcManager _ipcManager;
|
||||||
private readonly IHostApplicationLifetime _lifetime;
|
private readonly IHostApplicationLifetime _lifetime;
|
||||||
@@ -44,8 +42,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
IpcManager ipcManager, FileDownloadManager transferManager,
|
IpcManager ipcManager, FileDownloadManager transferManager,
|
||||||
PluginWarningNotificationService pluginWarningNotificationManager,
|
PluginWarningNotificationService pluginWarningNotificationManager,
|
||||||
DalamudUtilService dalamudUtil, IHostApplicationLifetime lifetime,
|
DalamudUtilService dalamudUtil, IHostApplicationLifetime lifetime,
|
||||||
FileCacheManager fileDbManager, MareMediator mediator,
|
FileCacheManager fileDbManager, MareMediator mediator) : base(logger, mediator)
|
||||||
MareConfigService mareConfigService) : base(logger, mediator)
|
|
||||||
{
|
{
|
||||||
OnlineUser = onlineUser;
|
OnlineUser = onlineUser;
|
||||||
_gameObjectHandlerFactory = gameObjectHandlerFactory;
|
_gameObjectHandlerFactory = gameObjectHandlerFactory;
|
||||||
@@ -55,7 +52,6 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
_dalamudUtil = dalamudUtil;
|
_dalamudUtil = dalamudUtil;
|
||||||
_lifetime = lifetime;
|
_lifetime = lifetime;
|
||||||
_fileDbManager = fileDbManager;
|
_fileDbManager = fileDbManager;
|
||||||
_mareConfigService = mareConfigService;
|
|
||||||
_penumbraCollection = _ipcManager.PenumbraCreateTemporaryCollectionAsync(logger, OnlineUser.User.UID).ConfigureAwait(false).GetAwaiter().GetResult();
|
_penumbraCollection = _ipcManager.PenumbraCreateTemporaryCollectionAsync(logger, OnlineUser.User.UID).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||||
|
|
||||||
Mediator.Subscribe<FrameworkUpdateMessage>(this, (_) => FrameworkUpdate());
|
Mediator.Subscribe<FrameworkUpdateMessage>(this, (_) => FrameworkUpdate());
|
||||||
@@ -77,11 +73,24 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
|
|||||||
});
|
});
|
||||||
Mediator.Subscribe<ClassJobChangedMessage>(this, (msg) =>
|
Mediator.Subscribe<ClassJobChangedMessage>(this, (msg) =>
|
||||||
{
|
{
|
||||||
if (msg.gameObjectHandler == _charaHandler)
|
if (msg.GameObjectHandler == _charaHandler)
|
||||||
{
|
{
|
||||||
_redrawOnNextApplication = true;
|
_redrawOnNextApplication = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Mediator.Subscribe<CombatEndMessage>(this, (msg) =>
|
||||||
|
{
|
||||||
|
if (IsVisible && _cachedData != null)
|
||||||
|
{
|
||||||
|
Guid g = Guid.NewGuid();
|
||||||
|
ApplyCharacterData(g, _cachedData, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Mediator.Subscribe<CombatStartMessage>(this, _ =>
|
||||||
|
{
|
||||||
|
_downloadCancellationTokenSource = _downloadCancellationTokenSource?.CancelRecreate();
|
||||||
|
_applicationCancellationTokenSource = _applicationCancellationTokenSource?.CancelRecreate();
|
||||||
|
});
|
||||||
|
|
||||||
LastAppliedDataSize = -1;
|
LastAppliedDataSize = -1;
|
||||||
}
|
}
|
||||||
@@ -108,15 +117,17 @@ 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 (_charaHandler == null || (PlayerCharacter == IntPtr.Zero))
|
if (_charaHandler == null || (PlayerCharacter == IntPtr.Zero) || _dalamudUtil.IsInCombat)
|
||||||
{
|
{
|
||||||
Logger.LogDebug("[BASE-{appBase}] Received data but player was in invalid state, charaHandlerIsNull: {charaIsNull}, playerPointerIsNull: {ptrIsNull}",
|
Logger.LogDebug("[BASE-{appBase}] Received data but player was in invalid state, inCombat: {inCombat}, charaHandlerIsNull: {charaIsNull}, playerPointerIsNull: {ptrIsNull}",
|
||||||
applicationBase, _charaHandler == null, PlayerCharacter == IntPtr.Zero);
|
applicationBase, _dalamudUtil.IsInCombat, _charaHandler == null, PlayerCharacter == IntPtr.Zero);
|
||||||
var hasDiffMods = characterData.CheckUpdatedData(applicationBase, _cachedData, Logger,
|
var hasDiffMods = characterData.CheckUpdatedData(applicationBase, _cachedData, Logger,
|
||||||
this, forceApplyCustomization, forceApplyMods: false).Any(p => p.Value.Contains(PlayerChanges.ModManip) || p.Value.Contains(PlayerChanges.ModFiles));
|
this, forceApplyCustomization, forceApplyMods: false)
|
||||||
|
.Any(p => p.Value.Contains(PlayerChanges.ModManip) || p.Value.Contains(PlayerChanges.ModFiles));
|
||||||
_forceApplyMods = hasDiffMods || _forceApplyMods || (PlayerCharacter == IntPtr.Zero && _cachedData == null);
|
_forceApplyMods = hasDiffMods || _forceApplyMods || (PlayerCharacter == IntPtr.Zero && _cachedData == null);
|
||||||
_cachedData = characterData;
|
_cachedData = characterData;
|
||||||
Logger.LogDebug("[BASE-{appBase}] Setting data: {hash}, forceApplyMods: {force}", applicationBase, _cachedData.DataHash.Value, _forceApplyMods);
|
Logger.LogDebug("[BASE-{appBase}] Setting data: {hash}, forceApplyMods: {force}", applicationBase, _cachedData.DataHash.Value, _forceApplyMods);
|
||||||
|
if (_dalamudUtil.IsInCombat) SetUploading(isUploading: false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,8 +48,21 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||||||
_playerRelatedObjects[ObjectKind.Companion] = gameObjectHandlerFactory.Create(ObjectKind.Companion, () => dalamudUtil.GetCompanion(), isWatched: true)
|
_playerRelatedObjects[ObjectKind.Companion] = gameObjectHandlerFactory.Create(ObjectKind.Companion, () => dalamudUtil.GetCompanion(), isWatched: true)
|
||||||
.GetAwaiter().GetResult();
|
.GetAwaiter().GetResult();
|
||||||
|
|
||||||
|
Mediator.Subscribe<ClassJobChangedMessage>(this, (msg) =>
|
||||||
|
{
|
||||||
|
if (msg.GameObjectHandler != _playerRelatedObjects[ObjectKind.Player]) return;
|
||||||
|
|
||||||
|
Logger.LogTrace("Removing pet data for {obj}", msg.GameObjectHandler);
|
||||||
|
_playerData.FileReplacements.Remove(ObjectKind.Pet);
|
||||||
|
_playerData.GlamourerString.Remove(ObjectKind.Pet);
|
||||||
|
_playerData.CustomizePlusScale.Remove(ObjectKind.Pet);
|
||||||
|
Mediator.Publish(new CharacterDataCreatedMessage(_playerData.ToAPI()));
|
||||||
|
});
|
||||||
|
|
||||||
Mediator.Subscribe<ClearCacheForObjectMessage>(this, (msg) =>
|
Mediator.Subscribe<ClearCacheForObjectMessage>(this, (msg) =>
|
||||||
{
|
{
|
||||||
|
// ignore pets
|
||||||
|
if (msg.ObjectToCreateFor == _playerRelatedObjects[ObjectKind.Pet]) return;
|
||||||
_ = Task.Run(() =>
|
_ = Task.Run(() =>
|
||||||
{
|
{
|
||||||
Logger.LogTrace("Clearing cache for {obj}", msg.ObjectToCreateFor);
|
Logger.LogTrace("Clearing cache for {obj}", msg.ObjectToCreateFor);
|
||||||
|
|||||||
@@ -51,18 +51,27 @@ public sealed class CharacterAnalyzer : MediatorSubscriberBase, IDisposable
|
|||||||
CurrentFile = 1;
|
CurrentFile = 1;
|
||||||
Logger.LogDebug("=== Computing {amount} remaining files ===", remaining.Count);
|
Logger.LogDebug("=== Computing {amount} remaining files ===", remaining.Count);
|
||||||
|
|
||||||
Mediator.Publish(new HaltScanMessage("CharacterAnalyzer"));
|
Mediator.Publish(new HaltScanMessage(nameof(CharacterAnalyzer)));
|
||||||
|
try
|
||||||
foreach (var file in remaining)
|
|
||||||
{
|
{
|
||||||
Logger.LogDebug("Computing file {file}", file.FilePaths[0]);
|
foreach (var file in remaining)
|
||||||
await file.ComputeSizes(_fileCacheManager, cancelToken).ConfigureAwait(false);
|
{
|
||||||
CurrentFile++;
|
Logger.LogDebug("Computing file {file}", file.FilePaths[0]);
|
||||||
|
await file.ComputeSizes(_fileCacheManager, cancelToken).ConfigureAwait(false);
|
||||||
|
CurrentFile++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_fileCacheManager.WriteOutFullCsv();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogWarning(ex, "Failed to analyze files");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Mediator.Publish(new ResumeScanMessage(nameof(CharacterAnalyzer)));
|
||||||
}
|
}
|
||||||
|
|
||||||
_fileCacheManager.WriteOutFullCsv();
|
|
||||||
|
|
||||||
Mediator.Publish(new ResumeScanMessage("CharacterAnalzyer"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Mediator.Publish(new CharacterDataAnalyzedMessage());
|
Mediator.Publish(new CharacterDataAnalyzedMessage());
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
private bool _sentBetweenAreas = false;
|
private bool _sentBetweenAreas = false;
|
||||||
|
|
||||||
public DalamudUtilService(ILogger<DalamudUtilService> logger, IClientState clientState, IObjectTable objectTable, IFramework framework,
|
public DalamudUtilService(ILogger<DalamudUtilService> logger, IClientState clientState, IObjectTable objectTable, IFramework framework,
|
||||||
IGameGui gameGui, ICondition condition, IDataManager gameData, ITargetManager targetManager, MareMediator mediator, PerformanceCollectorService performanceCollector)
|
IGameGui gameGui, ICondition condition, IDataManager gameData, ITargetManager targetManager,
|
||||||
|
MareMediator mediator, PerformanceCollectorService performanceCollector)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
@@ -73,6 +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 Lazy<Dictionary<ushort, string>> WorldData { get; private set; }
|
public Lazy<Dictionary<ushort, string>> WorldData { get; private set; }
|
||||||
|
|
||||||
@@ -457,19 +459,34 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
Mediator.Publish(new GposeEndMessage());
|
Mediator.Publish(new GposeEndMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_condition[ConditionFlag.InCombat] && !IsInCombat)
|
||||||
|
{
|
||||||
|
_logger.LogDebug("Combat start");
|
||||||
|
IsInCombat = true;
|
||||||
|
Mediator.Publish(new CombatStartMessage());
|
||||||
|
Mediator.Publish(new HaltScanMessage(nameof(IsInCombat)));
|
||||||
|
}
|
||||||
|
else if (!_condition[ConditionFlag.InCombat] && IsInCombat)
|
||||||
|
{
|
||||||
|
_logger.LogDebug("Combat end");
|
||||||
|
IsInCombat = false;
|
||||||
|
Mediator.Publish(new CombatEndMessage());
|
||||||
|
Mediator.Publish(new ResumeScanMessage(nameof(IsInCombat)));
|
||||||
|
}
|
||||||
|
|
||||||
if (_condition[ConditionFlag.WatchingCutscene] && !IsInCutscene)
|
if (_condition[ConditionFlag.WatchingCutscene] && !IsInCutscene)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Cutscene start");
|
_logger.LogDebug("Cutscene start");
|
||||||
IsInCutscene = true;
|
IsInCutscene = true;
|
||||||
Mediator.Publish(new CutsceneStartMessage());
|
Mediator.Publish(new CutsceneStartMessage());
|
||||||
Mediator.Publish(new HaltScanMessage("Cutscene"));
|
Mediator.Publish(new HaltScanMessage(nameof(IsInCutscene)));
|
||||||
}
|
}
|
||||||
else if (!_condition[ConditionFlag.WatchingCutscene] && IsInCutscene)
|
else if (!_condition[ConditionFlag.WatchingCutscene] && IsInCutscene)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Cutscene end");
|
_logger.LogDebug("Cutscene end");
|
||||||
IsInCutscene = false;
|
IsInCutscene = false;
|
||||||
Mediator.Publish(new CutsceneEndMessage());
|
Mediator.Publish(new CutsceneEndMessage());
|
||||||
Mediator.Publish(new ResumeScanMessage("Cutscene"));
|
Mediator.Publish(new ResumeScanMessage(nameof(IsInCutscene)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsInCutscene) { Mediator.Publish(new CutsceneFrameworkUpdateMessage()); return; }
|
if (IsInCutscene) { Mediator.Publish(new CutsceneFrameworkUpdateMessage()); return; }
|
||||||
@@ -485,7 +502,7 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
_logger.LogDebug("Zone switch/Gpose start");
|
_logger.LogDebug("Zone switch/Gpose start");
|
||||||
_sentBetweenAreas = true;
|
_sentBetweenAreas = true;
|
||||||
Mediator.Publish(new ZoneSwitchStartMessage());
|
Mediator.Publish(new ZoneSwitchStartMessage());
|
||||||
Mediator.Publish(new HaltScanMessage("Zone switch"));
|
Mediator.Publish(new HaltScanMessage(nameof(ConditionFlag.BetweenAreas)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,10 +514,11 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
_logger.LogDebug("Zone switch/Gpose end");
|
_logger.LogDebug("Zone switch/Gpose end");
|
||||||
_sentBetweenAreas = false;
|
_sentBetweenAreas = false;
|
||||||
Mediator.Publish(new ZoneSwitchEndMessage());
|
Mediator.Publish(new ZoneSwitchEndMessage());
|
||||||
Mediator.Publish(new ResumeScanMessage("Zone switch"));
|
Mediator.Publish(new ResumeScanMessage(nameof(ConditionFlag.BetweenAreas)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Mediator.Publish(new FrameworkUpdateMessage());
|
if (!IsInCombat)
|
||||||
|
Mediator.Publish(new FrameworkUpdateMessage());
|
||||||
|
|
||||||
if (DateTime.Now < _delayedFrameworkUpdateCheck.AddSeconds(1)) return;
|
if (DateTime.Now < _delayedFrameworkUpdateCheck.AddSeconds(1)) return;
|
||||||
|
|
||||||
@@ -520,6 +538,9 @@ public class DalamudUtilService : IHostedService, IMediatorSubscriber
|
|||||||
Mediator.Publish(new DalamudLogoutMessage());
|
Mediator.Publish(new DalamudLogoutMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsInCombat)
|
||||||
|
Mediator.Publish(new FrameworkUpdateMessage());
|
||||||
|
|
||||||
Mediator.Publish(new DelayedFrameworkUpdateMessage());
|
Mediator.Publish(new DelayedFrameworkUpdateMessage());
|
||||||
|
|
||||||
_delayedFrameworkUpdateCheck = DateTime.Now;
|
_delayedFrameworkUpdateCheck = DateTime.Now;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public record OpenSettingsUiMessage : MessageBase;
|
|||||||
public record DalamudLoginMessage : MessageBase;
|
public record DalamudLoginMessage : MessageBase;
|
||||||
public record DalamudLogoutMessage : MessageBase;
|
public record DalamudLogoutMessage : MessageBase;
|
||||||
public record FrameworkUpdateMessage : SameThreadMessage;
|
public record FrameworkUpdateMessage : SameThreadMessage;
|
||||||
public record ClassJobChangedMessage(GameObjectHandler gameObjectHandler) : MessageBase;
|
public record ClassJobChangedMessage(GameObjectHandler GameObjectHandler) : MessageBase;
|
||||||
public record DelayedFrameworkUpdateMessage : SameThreadMessage;
|
public record DelayedFrameworkUpdateMessage : SameThreadMessage;
|
||||||
public record ZoneSwitchStartMessage : MessageBase;
|
public record ZoneSwitchStartMessage : MessageBase;
|
||||||
public record ZoneSwitchEndMessage : MessageBase;
|
public record ZoneSwitchEndMessage : MessageBase;
|
||||||
@@ -78,6 +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 CombatEndMessage : 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
|
||||||
@@ -173,7 +173,7 @@ public sealed class PerformanceCollectorService : IHostedService
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var last = entries.Value.Last();
|
var last = entries.Value.ToList().Last();
|
||||||
if (last.Item1.AddMinutes(10) < TimeOnly.FromDateTime(DateTime.Now) && !_performanceCounters.TryRemove(entries.Key, out _))
|
if (last.Item1.AddMinutes(10) < TimeOnly.FromDateTime(DateTime.Now) && !_performanceCounters.TryRemove(entries.Key, out _))
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Could not remove performance counter {counter}", entries.Key);
|
_logger.LogDebug("Could not remove performance counter {counter}", entries.Key);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
|
|||||||
|
|
||||||
public async Task DownloadFiles(GameObjectHandler gameObject, List<FileReplacementData> fileReplacementDto, CancellationToken ct)
|
public async Task DownloadFiles(GameObjectHandler gameObject, List<FileReplacementData> fileReplacementDto, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Mediator.Publish(new HaltScanMessage("Download"));
|
Mediator.Publish(new HaltScanMessage(nameof(DownloadFiles)));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await DownloadFilesInternal(gameObject, fileReplacementDto, ct).ConfigureAwait(false);
|
await DownloadFilesInternal(gameObject, fileReplacementDto, ct).ConfigureAwait(false);
|
||||||
@@ -77,7 +77,7 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Mediator.Publish(new DownloadFinishedMessage(gameObject));
|
Mediator.Publish(new DownloadFinishedMessage(gameObject));
|
||||||
Mediator.Publish(new ResumeScanMessage("Download"));
|
Mediator.Publish(new ResumeScanMessage(nameof(DownloadFiles)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
namespace MareSynchronos.WebAPI.Files
|
||||||
|
|
||||||
namespace MareSynchronos.WebAPI.Files
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class for streaming data with throttling support.
|
/// Class for streaming data with throttling support.
|
||||||
|
|||||||
Reference in New Issue
Block a user