PetBroadcasts - jimdroberts/FishMMO GitHub Wiki

Description

Defines broadcast structures for pet-related actions, such as adding, removing, commanding, summoning, and releasing pets. Used for networked communication of pet events between client and server.


API Access

Fields

  • public struct PetAddBroadcast : IBroadcast

    Broadcast for adding a pet to a character. Contains the pet's unique ID.

    • long ID: Unique ID of the pet to add.
  • public struct PetRemoveBroadcast : IBroadcast

    Broadcast for removing a pet from a character. No additional data required.

  • public struct PetFollowBroadcast : IBroadcast

    Broadcast for commanding a pet to follow its owner. No additional data required.

  • public struct PetStayBroadcast : IBroadcast

    Broadcast for commanding a pet to stay in its current location. No additional data required.

  • public struct PetSummonBroadcast : IBroadcast

    Broadcast for summoning a pet to the owner's location. No additional data required.

  • public struct PetReleaseBroadcast : IBroadcast

    Broadcast for releasing a pet (removing it from ownership). No additional data required.


Basic Usage

Setup

  1. Use these broadcast structs to send and receive pet actions between client and server.
  2. Populate the fields as required for each pet operation (add, remove, follow, stay, summon, release).

Example

// Example 1: Adding a pet
PetAddBroadcast add = new PetAddBroadcast {
    ID = 98765
};
networkManager.ClientManager.Broadcast(add);

// Example 2: Commanding a pet to follow
PetFollowBroadcast follow = new PetFollowBroadcast();
networkManager.ClientManager.Broadcast(follow);

Best Practices

  • Always validate pet IDs before sending or processing broadcasts.
  • Use the appropriate broadcast struct for each pet action.
  • Keep pet logic modular and well-documented for maintainability.
  • Use the provided broadcast structs for clear, type-safe network communication.
⚠️ **GitHub.com Fallback** ⚠️