mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-31 21:03:48 +01:00
Touch up CanUnlock.
This commit is contained in:
parent
5656d88c94
commit
643c83a6f3
1 changed files with 5 additions and 5 deletions
|
|
@ -228,12 +228,12 @@ public sealed class StateApi : IGlamourerApiState, IApiService, IDisposable
|
||||||
public GlamourerApiEc CanUnlock(int objectIndex, uint key, out bool isLocked, out bool canUnlock)
|
public GlamourerApiEc CanUnlock(int objectIndex, uint key, out bool isLocked, out bool canUnlock)
|
||||||
{
|
{
|
||||||
var args = ApiHelpers.Args("Index", objectIndex, "Key", key);
|
var args = ApiHelpers.Args("Index", objectIndex, "Key", key);
|
||||||
isLocked = false; // These seem like reasonable defaults.
|
isLocked = false;
|
||||||
canUnlock = false;
|
canUnlock = true;
|
||||||
if (_helpers.FindExistingState(objectIndex, out var state) != GlamourerApiEc.Success)
|
if (_helpers.FindExistingState(objectIndex, out var state) is not GlamourerApiEc.Success)
|
||||||
return ApiHelpers.Return(GlamourerApiEc.ActorNotFound, args);
|
return ApiHelpers.Return(GlamourerApiEc.ActorNotFound, args);
|
||||||
if (state == null)
|
if (state is null)
|
||||||
return ApiHelpers.Return(GlamourerApiEc.InvalidState, args); // Possibly, the error type could be changed. I just looked at what was available.
|
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
||||||
isLocked = state.IsLocked;
|
isLocked = state.IsLocked;
|
||||||
canUnlock = state.CanUnlock(key);
|
canUnlock = state.CanUnlock(key);
|
||||||
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue