HotkeyBroadcasts - jimdroberts/FishMMO GitHub Wiki
Defines data structures and broadcast messages for character hotkey assignments, including single and multiple hotkey updates. Used for networked communication of hotkey changes between client and server.
-
public class HotkeyData
Data structure representing a hotkey assignment for a character.
- byte Type: Type of the hotkey (e.g., ability, item).\n - int Slot: Slot index where the hotkey is assigned.\n - long ReferenceID: Reference ID for the hotkey target (e.g., ability or item ID). Defaults to -1 if unset.
-
public struct HotkeySetBroadcast : IBroadcast
Broadcast for setting a single hotkey assignment for a character. Contains the hotkey data to be set.
- HotkeyData HotkeyData: Hotkey data to assign.
-
public struct HotkeySetMultipleBroadcast : IBroadcast
Broadcast for setting multiple hotkey assignments at once. Used for bulk hotkey updates or synchronization.
- List Hotkeys: List of hotkey assignments to set.
- Use these data structures and broadcast structs to send and receive hotkey assignments between client and server.
- Populate the fields as required for each hotkey operation (set, bulk set, etc.).
// Example 1: Setting a single hotkey
HotkeySetBroadcast setHotkey = new HotkeySetBroadcast {
HotkeyData = new HotkeyData {
Type = 1, // Ability
Slot = 2,
ReferenceID = 1001
}
};
networkManager.ClientManager.Broadcast(setHotkey);
// Example 2: Setting multiple hotkeys
HotkeySetMultipleBroadcast setMultiple = new HotkeySetMultipleBroadcast {
Hotkeys = new List<HotkeySetBroadcast> {
new HotkeySetBroadcast { HotkeyData = new HotkeyData { Type = 1, Slot = 2, ReferenceID = 1001 } },
new HotkeySetBroadcast { HotkeyData = new HotkeyData { Type = 2, Slot = 3, ReferenceID = 2001 } }
}
};
networkManager.ClientManager.Broadcast(setMultiple);
- Always validate hotkey types, slots, and reference IDs before sending or processing broadcasts.
- Use bulk updates for efficient synchronization of multiple hotkeys.
- Keep hotkey logic modular and well-documented for maintainability.
- Use the provided data structures and broadcast structs for clear, type-safe network communication.