From 643c83a6f3ceeab7416928b9e78ca6c71b8c07e4 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Fri, 19 Dec 2025 13:56:36 +0100 Subject: [PATCH] Touch up CanUnlock. --- Glamourer/Api/StateApi.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Glamourer/Api/StateApi.cs b/Glamourer/Api/StateApi.cs index 8914dee..ffd541e 100644 --- a/Glamourer/Api/StateApi.cs +++ b/Glamourer/Api/StateApi.cs @@ -228,12 +228,12 @@ public sealed class StateApi : IGlamourerApiState, IApiService, IDisposable public GlamourerApiEc CanUnlock(int objectIndex, uint key, out bool isLocked, out bool canUnlock) { var args = ApiHelpers.Args("Index", objectIndex, "Key", key); - isLocked = false; // These seem like reasonable defaults. - canUnlock = false; - if (_helpers.FindExistingState(objectIndex, out var state) != GlamourerApiEc.Success) + isLocked = false; + canUnlock = true; + if (_helpers.FindExistingState(objectIndex, out var state) is not GlamourerApiEc.Success) return ApiHelpers.Return(GlamourerApiEc.ActorNotFound, args); - if (state == null) - return ApiHelpers.Return(GlamourerApiEc.InvalidState, args); // Possibly, the error type could be changed. I just looked at what was available. + if (state is null) + return ApiHelpers.Return(GlamourerApiEc.Success, args); isLocked = state.IsLocked; canUnlock = state.CanUnlock(key); return ApiHelpers.Return(GlamourerApiEc.Success, args);