mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 21:37:22 +01:00
Pet Nicknames IPC implementation (#74)
* Pet Nicknames IPC implementation * Moodles works again
This commit is contained in:
parent
9c954471fb
commit
bf338ec697
7 changed files with 168 additions and 12 deletions
|
|
@ -21,6 +21,7 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
private Task? _cacheCreationTask;
|
||||
private CancellationTokenSource _honorificCts = new();
|
||||
private CancellationTokenSource _moodlesCts = new();
|
||||
private CancellationTokenSource _petNicknamesCts = new();
|
||||
private bool _isZoning = false;
|
||||
private readonly Dictionary<ObjectKind, CancellationTokenSource> _glamourerCts = new();
|
||||
|
||||
|
|
@ -122,9 +123,15 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
MoodlesChanged();
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: if event is needed for petnames add it here similar to moodles
|
||||
|
||||
Mediator.Subscribe<PetNamesMessage>(this, (msg) =>
|
||||
{
|
||||
if (_isZoning) return;
|
||||
if (!string.Equals(msg.PetNicknamesData, _playerData.MoodlesData, StringComparison.Ordinal))
|
||||
{
|
||||
Logger.LogDebug("Received Pet Nicknames change, updating player");
|
||||
PetNicknamesChanged();
|
||||
}
|
||||
});
|
||||
Mediator.Subscribe<PenumbraModSettingChangedMessage>(this, (msg) =>
|
||||
{
|
||||
Logger.LogDebug("Received Penumbra Mod settings change, updating player");
|
||||
|
|
@ -194,6 +201,20 @@ public sealed class CacheCreationService : DisposableMediatorSubscriberBase
|
|||
}, token);
|
||||
}
|
||||
|
||||
private void PetNicknamesChanged()
|
||||
{
|
||||
_petNicknamesCts?.Cancel();
|
||||
_petNicknamesCts?.Dispose();
|
||||
_petNicknamesCts = new();
|
||||
var token = _petNicknamesCts.Token;
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(3), token).ConfigureAwait(false);
|
||||
await AddPlayerCacheToCreate().ConfigureAwait(false);
|
||||
}, token);
|
||||
}
|
||||
|
||||
private void ProcessCacheCreation()
|
||||
{
|
||||
if (_isZoning) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue