minor fixes
This commit is contained in:
@@ -165,13 +165,13 @@ public class PairManager : MediatorSubscriberBase, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
public void MarkPairOnline(OnlineUserIdentDto dto, ApiController controller)
|
||||
public void MarkPairOnline(OnlineUserIdentDto dto, ApiController controller, bool sendNotif = true)
|
||||
{
|
||||
if (!_allClientPairs.ContainsKey(dto.User)) throw new InvalidOperationException("No user found for " + dto);
|
||||
var pair = _allClientPairs[dto.User];
|
||||
if (pair.CachedPlayer != null) return;
|
||||
|
||||
if (_configurationService.Current.ShowOnlineNotifications
|
||||
if (sendNotif && _configurationService.Current.ShowOnlineNotifications
|
||||
&& ((_configurationService.Current.ShowOnlineNotificationsOnlyForIndividualPairs && pair.UserPair != null)
|
||||
|| !_configurationService.Current.ShowOnlineNotificationsOnlyForIndividualPairs)
|
||||
&& (_configurationService.Current.ShowOnlineNotificationsOnlyForNamedPairs && !string.IsNullOrEmpty(pair.GetNote())
|
||||
|
||||
@@ -231,17 +231,24 @@ public class DalamudUtil : IDisposable
|
||||
var obj = (GameObject*)characterAddress;
|
||||
const int tick = 250;
|
||||
int curWaitTime = 0;
|
||||
// ReSharper disable once LoopVariableIsNeverChangedInsideLoop
|
||||
while ((((obj->GetDrawObject() == null
|
||||
|| ((CharacterBase*)obj->GetDrawObject())->HasModelFilesInSlotLoaded != 0
|
||||
|| ((CharacterBase*)obj->GetDrawObject())->HasModelFilesInSlotLoaded != 0))
|
||||
|| ((obj->RenderFlags & 0b100000000000) == 0b100000000000))
|
||||
&& (!ct?.IsCancellationRequested ?? true)
|
||||
&& curWaitTime < timeOut) // 0b100000000000 is "still rendering" or something
|
||||
try
|
||||
{
|
||||
Logger.Verbose($"Waiting for {name} to finish drawing");
|
||||
curWaitTime += tick;
|
||||
Thread.Sleep(tick);
|
||||
// ReSharper disable once LoopVariableIsNeverChangedInsideLoop
|
||||
while ((!ct?.IsCancellationRequested ?? true)
|
||||
&& curWaitTime < timeOut
|
||||
&& (((obj->GetDrawObject() == null
|
||||
|| ((CharacterBase*)obj->GetDrawObject())->HasModelFilesInSlotLoaded != 0
|
||||
|| ((CharacterBase*)obj->GetDrawObject())->HasModelFilesInSlotLoaded != 0))
|
||||
|| ((obj->RenderFlags & 0b100000000000) == 0b100000000000))) // 0b100000000000 is "still rendering" or something
|
||||
{
|
||||
Logger.Verbose($"Waiting for {name} to finish drawing");
|
||||
curWaitTime += tick;
|
||||
Thread.Sleep(tick);
|
||||
}
|
||||
}
|
||||
catch (AccessViolationException ex)
|
||||
{
|
||||
Logger.Warn("Error accessing " + characterAddress.ToString("X") + ", object does not exist anymore?", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ public partial class ApiController : MediatorSubscriberBase, IDisposable, IMareH
|
||||
|
||||
foreach (var entry in await UserGetOnlinePairs().ConfigureAwait(false))
|
||||
{
|
||||
_pairManager.MarkPairOnline(entry, this);
|
||||
_pairManager.MarkPairOnline(entry, this, false);
|
||||
}
|
||||
|
||||
_healthCheckTokenSource?.Cancel();
|
||||
|
||||
Reference in New Issue
Block a user