From 09c0f7e51d1f03bbb8bcae9d6736fca71bbe65cd Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Tue, 21 Dec 2021 02:36:48 -0500 Subject: [PATCH] refactor: use AgentId enums --- Glamaholic/GameFunctions.cs | 5 ++--- Glamaholic/PluginUi.cs | 3 +-- Glamaholic/Ui/Helpers/TryOnHelper.cs | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Glamaholic/GameFunctions.cs b/Glamaholic/GameFunctions.cs index 3d22d4c..6559c3c 100755 --- a/Glamaholic/GameFunctions.cs +++ b/Glamaholic/GameFunctions.cs @@ -114,8 +114,7 @@ namespace Glamaholic { var list = new List(); var agents = Framework.Instance()->GetUiModule()->GetAgentModule(); - // TODO: replace with AgentId.MiragePrismPrismBox when ClientStructs is updated - var dresserAgent = agents->GetAgentByInternalId((AgentId) 292); + var dresserAgent = agents->GetAgentByInternalId(AgentId.MiragePrismPrismBox); var itemsStart = *(IntPtr*) ((IntPtr) dresserAgent + 0x28); if (itemsStart == IntPtr.Zero) { @@ -171,7 +170,7 @@ namespace Glamaholic { } } - private static unsafe AgentInterface* EditorAgent => Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId((AgentId) 294); + private static unsafe AgentInterface* EditorAgent => Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.MiragePrismMiragePlate); internal unsafe void SetGlamourPlateSlot(MirageSource source, int glamId, uint itemId, byte stainId) { this._setGlamourPlateSlot((IntPtr) EditorAgent, source, glamId, itemId, stainId); diff --git a/Glamaholic/PluginUi.cs b/Glamaholic/PluginUi.cs index d4ae73c..a59bebd 100755 --- a/Glamaholic/PluginUi.cs +++ b/Glamaholic/PluginUi.cs @@ -94,8 +94,7 @@ namespace Glamaholic { internal unsafe void TryOn(IEnumerable items) { void SetTryOnSave(bool save) { - // TODO: replace with AgentId.Tryon once ClientStructs is updated for new agents - var tryOnAgent = (IntPtr) Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId((AgentId) 147); + var tryOnAgent = (IntPtr) Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.Tryon); if (tryOnAgent != IntPtr.Zero) { *(byte*) (tryOnAgent + 0x2E2) = (byte) (save ? 1 : 0); } diff --git a/Glamaholic/Ui/Helpers/TryOnHelper.cs b/Glamaholic/Ui/Helpers/TryOnHelper.cs index e11ca4e..7310620 100755 --- a/Glamaholic/Ui/Helpers/TryOnHelper.cs +++ b/Glamaholic/Ui/Helpers/TryOnHelper.cs @@ -47,8 +47,7 @@ namespace Glamaholic.Ui.Helpers { } private static unsafe Dictionary GetTryOnItems() { - // TODO: replace with AgentId.Tryon once ClientStructs is updated for new agents - var agent = (IntPtr) Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId((AgentId) 147); + var agent = (IntPtr) Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.Tryon); var firstItem = agent + 0x2E8; var items = new Dictionary();