mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-15 21:24:18 +01:00
Merge 8f362c5121 into 5b6517aae8
This commit is contained in:
commit
2658db3ec1
2 changed files with 17 additions and 0 deletions
|
|
@ -53,6 +53,7 @@ public sealed class IpcProviders : IDisposable, IApiService
|
|||
IpcSubscribers.RevertState.Provider(pi, api.State),
|
||||
IpcSubscribers.RevertStateName.Provider(pi, api.State),
|
||||
IpcSubscribers.UnlockState.Provider(pi, api.State),
|
||||
IpcSubscribers.CanUnlock.Provider(pi, api.State),
|
||||
IpcSubscribers.UnlockStateName.Provider(pi, api.State),
|
||||
IpcSubscribers.DeletePlayerState.Provider(pi, api.State),
|
||||
IpcSubscribers.UnlockAll.Provider(pi, api.State),
|
||||
|
|
@ -76,3 +77,5 @@ public sealed class IpcProviders : IDisposable, IApiService
|
|||
_disposedProvider.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -178,6 +178,20 @@ public sealed class StateApi : IGlamourerApiState, IApiService, IDisposable
|
|||
return ApiHelpers.Return(GlamourerApiEc.Success, args);
|
||||
}
|
||||
|
||||
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);
|
||||
if (state == null)
|
||||
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)
|
||||
{
|
||||
var args = ApiHelpers.Args("Name", playerName, "Key", key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue