check for glamourer api and if not present do not use glamourer

This commit is contained in:
Stanley Dimant
2022-08-25 14:09:50 +02:00
parent cbe45a8ad6
commit 4e2d371f10
2 changed files with 41 additions and 17 deletions

View File

@@ -235,56 +235,81 @@ public class CachedPlayer
RequestedPenumbraRedraw = true;
Logger.Debug(
$"Request Redraw for {PlayerName}");
if (_ipcManager.CheckGlamourerApi())
{
_ipcManager.GlamourerApplyAll(glamourerData, PlayerCharacter.Address);
// todo: remove
}
else
{
_ipcManager.PenumbraRedraw(PlayerCharacter.Address);
}
}
else if (objectKind == ObjectKind.MinionOrMount)
{
var minionOrMount = ((Character*)PlayerCharacter.Address)->CompanionObject;
if (minionOrMount != null)
{
Logger.Debug($"Request Redraw for Minion/Mount");
if (_ipcManager.CheckGlamourerApi())
{
_ipcManager.GlamourerApplyAll(glamourerData, obj: (IntPtr)minionOrMount);
// todo: remove
}
else
{
_ipcManager.PenumbraRedraw((IntPtr)minionOrMount);
}
}
}
else if (objectKind == ObjectKind.Pet)
{
var pet = _dalamudUtil.GetPet(PlayerCharacter.Address);
if (pet != IntPtr.Zero)
{
Logger.Debug("Request Redraw for Pet");
if (_ipcManager.CheckGlamourerApi())
{
_ipcManager.GlamourerApplyAll(glamourerData, pet);
// todo: remove
}
else
{
_ipcManager.PenumbraRedraw(pet);
}
}
}
else if (objectKind == ObjectKind.Companion)
{
var companion = _dalamudUtil.GetCompanion(PlayerCharacter.Address);
if (companion != IntPtr.Zero)
{
Logger.Debug("Request Redraw for Companion");
if (_ipcManager.CheckGlamourerApi())
{
_ipcManager.GlamourerApplyAll(glamourerData, companion);
// todo: remove
}
else
{
_ipcManager.PenumbraRedraw(companion);
}
}
}
}
private unsafe void RevertCustomizationData(ObjectKind objectKind)
{
if (PlayerCharacter is null) return;
if (objectKind == ObjectKind.Player)
{
if (_ipcManager.CheckGlamourerApi())
{
_ipcManager.GlamourerApplyOnlyCustomization(_originalGlamourerData, PlayerCharacter);
_ipcManager.GlamourerApplyOnlyEquipment(_lastGlamourerData, PlayerCharacter);
// todo: remove
}
else
{
_ipcManager.PenumbraRedraw(PlayerCharacter.Address);
}
}
else if (objectKind == ObjectKind.MinionOrMount)
{
var minionOrMount = ((Character*)PlayerCharacter.Address)->CompanionObject;

View File

@@ -40,7 +40,6 @@ namespace MareSynchronos.UI
public static bool CtrlPressed() => (GetKeyState(0xA2) & 0x8000) != 0 || (GetKeyState(0xA3) & 0x8000) != 0;
// todo remove after rework
public ApiController ApiController => _apiController;
public UiShared(IpcManager ipcManager, ApiController apiController, FileCacheManager fileCacheManager, FileDialogManager fileDialogManager, Configuration pluginConfiguration, DalamudUtil dalamudUtil, DalamudPluginInterface pluginInterface, Dalamud.Localization localization)