AbilityBroadcasts - jimdroberts/FishMMO GitHub Wiki

Description

Defines broadcast structures for character ability actions, including adding known abilities, ability events, and abilities with events. Used for networked communication of ability changes between client and server.


API Access

Fields

  • public struct KnownAbilityAddBroadcast : IBroadcast

    Broadcast for adding a known ability to a character. Contains the template ID of the ability to add.

    • int TemplateID: Template ID of the ability to add.
  • public struct KnownAbilityAddMultipleBroadcast : IBroadcast

    Broadcast for adding multiple known abilities to a character at once. Used for bulk updates or synchronization.

    • List Abilities: List of known abilities to add.
  • public struct KnownAbilityEventAddBroadcast : IBroadcast

    Broadcast for adding a known ability event to a character. Contains the template ID of the ability event to add.

    • int TemplateID: Template ID of the ability event to add.
  • public struct KnownAbilityEventAddMultipleBroadcast : IBroadcast

    Broadcast for adding multiple known ability events to a character at once. Used for bulk updates or synchronization.

    • List AbilityEvents: List of known ability events to add.
  • public struct AbilityAddBroadcast : IBroadcast

    Broadcast for adding an ability to a character, including its events. Contains the ability's instance ID, template ID, and associated event IDs.

    • long ID: Unique instance ID of the ability.
    • int TemplateID: Template ID of the ability.
    • List Events: List of event IDs associated with the ability.
  • public struct AbilityAddMultipleBroadcast : IBroadcast

    Broadcast for adding multiple abilities to a character at once. Used for bulk updates or synchronization.

    • List Abilities: List of abilities to add.

Basic Usage

Setup

  1. Use these broadcast structs to send and receive ability actions between client and server.
  2. Populate the fields as required for each ability operation (add, bulk add, etc.).

Example

// Example 1: Adding a known ability
KnownAbilityAddBroadcast addAbility = new KnownAbilityAddBroadcast {
    TemplateID = 2001
};
networkManager.ClientManager.Broadcast(addAbility);

// Example 2: Adding an ability with events
AbilityAddBroadcast add = new AbilityAddBroadcast {
    ID = 12345,
    TemplateID = 2001,
    Events = new List<int> { 1, 2, 3 }
};
networkManager.ClientManager.Broadcast(add);

Best Practices

  • Always validate ability and event IDs before sending or processing broadcasts.
  • Use bulk updates for efficient synchronization of large ability lists.
  • Keep ability logic modular and well-documented for maintainability.
  • Use the provided broadcast structs for clear, type-safe network communication.
⚠️ **GitHub.com Fallback** ⚠️