mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-31 04:43:43 +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)
|
||||
{
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue