mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Update StateApi.cs
This commit is contained in:
parent
0442fb7b60
commit
8f362c5121
1 changed files with 8 additions and 4 deletions
|
|
@ -180,14 +180,18 @@ public sealed class StateApi : IGlamourerApiState, IApiService, IDisposable
|
|||
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
||||
}
|
||||
|
||||
public (GlamourerApiEc, bool?) IsUnlocked(int objectIndex, uint key)
|
||||
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)
|
||||
return (ApiHelpers.Return(GlamourerApiEc.ActorNotFound, args), null);
|
||||
return ApiHelpers.Return(GlamourerApiEc.ActorNotFound, args);
|
||||
if (state == null)
|
||||
return (ApiHelpers.Return(GlamourerApiEc.InvalidState, args), null); // Possibly, the error type could be changed. I just looked at what was available.
|
||||
return (ApiHelpers.Return(GlamourerApiEc.Success, args), state.CanUnlock(key));
|
||||
return ApiHelpers.Return(GlamourerApiEc.InvalidState, args); // Possibly, the error type could be changed. I just looked at what was available.
|
||||
isLocked = state.IsLocked;
|
||||
canUnlock = state.CanUnlock(key);
|
||||
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
||||
}
|
||||
|
||||
public GlamourerApiEc UnlockStateName(string playerName, uint key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue