EquipmentBroadcasts - jimdroberts/FishMMO GitHub Wiki
Defines broadcast structures for equipment inventory actions, including setting, equipping, and unequipping items. Used for networked communication of equipment inventory changes between client and server.
-
public struct EquipmentSetItemBroadcast : IBroadcast
Broadcast for setting a single item in the equipment inventory. Contains all data needed to place or update an item in an equipment slot.
- long InstanceID: Unique instance ID of the item.
- int TemplateID: Template ID of the item type.
- int Slot: Slot index in the equipment inventory.
- int Seed: Seed value for item randomization or uniqueness.
- uint StackSize: Stack size of the item.
-
public struct EquipmentSetMultipleItemsBroadcast : IBroadcast
Broadcast for setting multiple items in the equipment inventory at once. Used for bulk updates or synchronization.
- List Items: List of items to set in the equipment inventory.
-
public struct EquipmentEquipItemBroadcast : IBroadcast
Broadcast for equipping an item from an inventory slot to an equipment slot.
- int InventoryIndex: Index of the item in the inventory.
- byte Slot: Equipment slot to equip the item to.
- InventoryType FromInventory: Type of inventory the item is being equipped from.
-
public struct EquipmentUnequipItemBroadcast : IBroadcast
Broadcast for unequipping an item from an equipment slot to an inventory slot.
- byte Slot: Equipment slot to unequip the item from.
- InventoryType ToInventory: Type of inventory the item is being moved to.
- Use these broadcast structs to send and receive equipment inventory actions between client and server.
- Populate the fields as required for each equipment operation (set, equip, unequip, etc.).
// Example 1: Equipping an item
EquipmentEquipItemBroadcast equip = new EquipmentEquipItemBroadcast {
InventoryIndex = 3,
Slot = 1,
FromInventory = InventoryType.Inventory
};
networkManager.ClientManager.Broadcast(equip);
// Example 2: Unequipping an item
EquipmentUnequipItemBroadcast unequip = new EquipmentUnequipItemBroadcast {
Slot = 1,
ToInventory = InventoryType.Inventory
};
networkManager.ClientManager.Broadcast(unequip);
- Always validate slot indices and item data before sending or processing broadcasts.
- Use bulk updates for efficient synchronization of large inventories.
- Keep equipment logic modular and well-documented for maintainability.
- Use the provided broadcast structs for clear, type-safe network communication.