Client rework for API change and paradigm shift (#39)
* most of the groups refactoring on client * register OnMethods for group stuff * start implementing client (still pretty broken) * finish implementing new api first iteration * idk rework everything for pair shit (still WIP); goal is to remove PairedClients and GroupPairClients from ApiController * move everything to PairManager, remove dictionaries from APiController * remove admin stuff from client, cleanup * adjust reconnection handling, add new settings, todo still to remove access from old stuff that's marked obsolete from config * add back adding servers, fix intro ui * fix obsolete calls * adjust config namespace * add UI for setting animation/sound permissions to syncshells * add ConfigurationService to hot reload config on change from external * move transient data cache to configuration * add deleting service to ui * fix saving of transient resources * fix group pair user assignments * halt scanner when penumbra inactive, add visible/online/offline split to individual pairs and tags * add presence to syncshell ui * move fullpause from config to server config * fixes in code style * more codestyle * show info icon on player in shells, don't show icon when no changes from default state are made, add online notifs * fixes to intro UI --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
This commit is contained in:
26
MareSynchronos/Factories/CachedPlayerFactory.cs
Normal file
26
MareSynchronos/Factories/CachedPlayerFactory.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using MareSynchronos.API.Dto.User;
|
||||
using MareSynchronos.FileCache;
|
||||
using MareSynchronos.Managers;
|
||||
using MareSynchronos.Utils;
|
||||
using MareSynchronos.WebAPI;
|
||||
|
||||
namespace MareSynchronos.Factories;
|
||||
|
||||
public class CachedPlayerFactory
|
||||
{
|
||||
private readonly IpcManager _ipcManager;
|
||||
private readonly DalamudUtil _dalamudUtil;
|
||||
private readonly FileCacheManager _fileCacheManager;
|
||||
|
||||
public CachedPlayerFactory(IpcManager ipcManager, DalamudUtil dalamudUtil, FileCacheManager fileCacheManager)
|
||||
{
|
||||
_ipcManager = ipcManager;
|
||||
_dalamudUtil = dalamudUtil;
|
||||
_fileCacheManager = fileCacheManager;
|
||||
}
|
||||
|
||||
public CachedPlayer Create(OnlineUserIdentDto dto, ApiController apiController)
|
||||
{
|
||||
return new CachedPlayer(dto, _ipcManager, apiController, _dalamudUtil, _fileCacheManager);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Diagnostics;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Resource;
|
||||
using MareSynchronos.API;
|
||||
using MareSynchronos.API.Data.Enum;
|
||||
using MareSynchronos.Interop;
|
||||
using MareSynchronos.Managers;
|
||||
using MareSynchronos.Models;
|
||||
using MareSynchronos.Utils;
|
||||
using Penumbra.Interop.Structs;
|
||||
using Object = FFXIVClientStructs.FFXIV.Client.Graphics.Scene.Object;
|
||||
using Penumbra.String;
|
||||
using Weapon = MareSynchronos.Interop.Weapon;
|
||||
@@ -44,7 +39,7 @@ public class CharacterDataFactory
|
||||
{
|
||||
if (!_ipcManager.Initialized)
|
||||
{
|
||||
throw new ArgumentException("Penumbra is not connected");
|
||||
throw new InvalidOperationException("Penumbra is not connected");
|
||||
}
|
||||
|
||||
bool pointerIsZero = true;
|
||||
@@ -231,7 +226,7 @@ public class CharacterDataFactory
|
||||
}
|
||||
}
|
||||
|
||||
var shpkFileReplacement = CreateFileReplacement(shpkPath, true);
|
||||
var shpkFileReplacement = CreateFileReplacement(shpkPath, doNotReverseResolve: true);
|
||||
DebugPrint(shpkFileReplacement, objectKind, "Shader", inheritanceLevel);
|
||||
cache.AddFileReplacement(objectKind, shpkFileReplacement);
|
||||
}
|
||||
@@ -284,7 +279,7 @@ public class CharacterDataFactory
|
||||
}
|
||||
|
||||
var chara = _dalamudUtil.CreateGameObject(charaPointer)!;
|
||||
while (!_dalamudUtil.IsObjectPresent(chara))
|
||||
while (!DalamudUtil.IsObjectPresent(chara))
|
||||
{
|
||||
Logger.Verbose("Character is null but it shouldn't be, waiting");
|
||||
Thread.Sleep(50);
|
||||
@@ -396,7 +391,7 @@ public class CharacterDataFactory
|
||||
foreach (var item in _transientResourceManager.GetTransientResources((IntPtr)weaponObject))
|
||||
{
|
||||
Logger.Verbose("Found transient weapon resource: " + item);
|
||||
AddReplacement(item, objectKind, previousData, 1, true);
|
||||
AddReplacement(item, objectKind, previousData, 1, doNotReverseResolve: true);
|
||||
}
|
||||
|
||||
if (weaponObject->NextSibling != (IntPtr)weaponObject)
|
||||
@@ -413,7 +408,7 @@ public class CharacterDataFactory
|
||||
foreach (var item in _transientResourceManager.GetTransientResources((IntPtr)offHandWeapon))
|
||||
{
|
||||
Logger.Verbose("Found transient offhand weapon resource: " + item);
|
||||
AddReplacement(item, objectKind, previousData, 1, true);
|
||||
AddReplacement(item, objectKind, previousData, 1, doNotReverseResolve: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,7 +416,7 @@ public class CharacterDataFactory
|
||||
AddReplacementSkeleton(((HumanExt*)human)->Human.RaceSexId, objectKind, previousData);
|
||||
try
|
||||
{
|
||||
AddReplacementsFromTexture(new ByteString(((HumanExt*)human)->Decal->FileName()).ToString(), objectKind, previousData, 0, false);
|
||||
AddReplacementsFromTexture(new ByteString(((HumanExt*)human)->Decal->FileName()).ToString(), objectKind, previousData, 0, doNotReverseResolve: false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -429,7 +424,7 @@ public class CharacterDataFactory
|
||||
}
|
||||
try
|
||||
{
|
||||
AddReplacementsFromTexture(new ByteString(((HumanExt*)human)->LegacyBodyDecal->FileName()).ToString(), objectKind, previousData, 0, false);
|
||||
AddReplacementsFromTexture(new ByteString(((HumanExt*)human)->LegacyBodyDecal->FileName()).ToString(), objectKind, previousData, 0, doNotReverseResolve: false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -448,7 +443,7 @@ public class CharacterDataFactory
|
||||
|
||||
string skeletonPath = $"chara/human/c{raceSexIdString}/skeleton/base/b0001/skl_c{raceSexIdString}b0001.sklb";
|
||||
|
||||
var replacement = CreateFileReplacement(skeletonPath, true);
|
||||
var replacement = CreateFileReplacement(skeletonPath, doNotReverseResolve: true);
|
||||
cache.AddFileReplacement(objectKind, replacement);
|
||||
|
||||
DebugPrint(replacement, objectKind, "SKLB", 0);
|
||||
|
||||
22
MareSynchronos/Factories/PairFactory.cs
Normal file
22
MareSynchronos/Factories/PairFactory.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using MareSynchronos.Managers;
|
||||
using MareSynchronos.MareConfiguration;
|
||||
using MareSynchronos.Models;
|
||||
|
||||
namespace MareSynchronos.Factories;
|
||||
|
||||
public class PairFactory
|
||||
{
|
||||
private readonly ConfigurationService _configService;
|
||||
private readonly ServerConfigurationManager _serverConfigurationManager;
|
||||
|
||||
public PairFactory(ConfigurationService configService, ServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
_configService = configService;
|
||||
_serverConfigurationManager = serverConfigurationManager;
|
||||
}
|
||||
|
||||
public Pair Create()
|
||||
{
|
||||
return new Pair(_configService, _serverConfigurationManager);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user