Table of Contents

Class HotkeySystem

Namespace
FishMMO.Server.Implementation.World.SceneServer
Assembly
FishMMO.Server.dll

Manages player hotkey configurations, allowing clients to set and update hotkey bindings for abilities and items.

[CreateAssetMenu(fileName = "HotkeySystem", menuName = "FishMMO/Server/SceneServer/Hotkey System", order = 1)]
[RequiresDataContainer(typeof(HotkeySystemRuntimeData))]
public class HotkeySystem : ServerBehaviour, IServerBehaviour<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>, IServerComponent<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>, IHotkeySystem, IServerBehaviour, IServerComponent
Inheritance
Object
ScriptableObject
HotkeySystem
Implements
IServerBehaviour<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>
IServerComponent<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.MemberwiseClone()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Methods

ForgetAbilityBindings(IPlayerCharacter, long)

Clears every ability binding that names abilityID.

public bool ForgetAbilityBindings(IPlayerCharacter playerCharacter, long abilityID)

Parameters

playerCharacter IPlayerCharacter

The character whose bar is corrected.

abilityID long

The forgotten ability's instance ID.

Returns

bool

True when at least one binding was cleared.

Remarks

Called when an ability is forgotten. Without it the bar keeps naming an id nothing resolves any more, and nothing revalidates in between: bindings are checked when they are MADE and once at login, so the dead slot survives until the character relogs — and the client can only hide it locally, leaving the server's bar and the database row still naming it.

Staging the write and echoing the whole bar happen here rather than at the call site, so the correction reaches the database and the client in the same session. There is no hotkey-removal message and none is needed — a clear is an ordinary HotkeySetBroadcast carrying Type = 0 and ReferenceID = HotkeyData.UnsetReferenceID.

InitializeOnce()

Initializes the hotkey system, registering broadcast handlers for hotkey set and hotkey set multiple requests.

public override ServerComponentInitializationStatus InitializeOnce()

Returns

ServerComponentInitializationStatus

OnDeinitialize()

Cleans up the hotkey system, unregistering broadcast handlers.

public override void OnDeinitialize()

OnServerHotkeySetBroadcastReceived(NetworkConnection, HotkeySetBroadcast, Channel)

Handles broadcast to set a single hotkey for a player character. Validates the hotkey list and slot, then updates the hotkey data for the specified slot.

public void OnServerHotkeySetBroadcastReceived(NetworkConnection conn, HotkeySetBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the requesting client.

msg HotkeySetBroadcast

HotkeySetBroadcast message containing hotkey data.

channel Channel

Network channel used for the broadcast.

OnServerHotkeySetMultipleBroadcastReceived(NetworkConnection, HotkeySetMultipleBroadcast, Channel)

Handles broadcast to set multiple hotkeys for a player character. Iterates through each hotkey message, validates the hotkey list and slot, then updates the hotkey data for each slot.

public void OnServerHotkeySetMultipleBroadcastReceived(NetworkConnection conn, HotkeySetMultipleBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the requesting client.

msg HotkeySetMultipleBroadcast

HotkeySetMultipleBroadcast message containing multiple hotkey data entries.

channel Channel

Network channel used for the broadcast.

OnUpdate(float)

Drains stale ingress entries with bounded cleanup each frame.

protected override void OnUpdate(float deltaTime)

Parameters

deltaTime float

RestagesAfter(DatabaseResult<BulkWriteResult>)

Whether a bar write that did not land complete is handed back to be re-staged from the live bar. Pure.

public static bool RestagesAfter(DatabaseResult<BulkWriteResult> result)

Parameters

result DatabaseResult<BulkWriteResult>

The write's outcome.

Returns

bool

True when the bar should be written again.

Remarks

Everything short of a complete write is retried — a cleared slot must reach the database — except a refusal by the ownership gate, whole (FORBIDDEN) or per row (Unowned): the claim the bar was written under is gone, the character is no longer this server's, and it is being evicted. Re-staging would only have the next pump refuse it again. The re-stage itself also looks only at resident characters, so an evicted one would be skipped there too; this keeps the queue from carrying it.