BuffBroadcasts - jimdroberts/FishMMO GitHub Wiki
Defines broadcast structures for character buff actions, including adding and removing single or multiple buffs. Used for networked communication of buff changes between client and server.
-
public struct BuffAddBroadcast : IBroadcast
Broadcast for adding a single buff to a character. Contains the template ID of the buff to be added.
- int TemplateID: Template ID of the buff to add.
-
public struct BuffAddMultipleBroadcast : IBroadcast
Broadcast for adding multiple buffs to a character at once. Used for bulk buff addition or synchronization.
- List Buffs: List of buffs to add.
-
public struct BuffRemoveBroadcast : IBroadcast
Broadcast for removing a single buff from a character. Contains the template ID of the buff to be removed.
- int TemplateID: Template ID of the buff to remove.
-
public struct BuffRemoveMultipleBroadcast : IBroadcast
Broadcast for removing multiple buffs from a character at once. Used for bulk buff removal or synchronization.
- List Buffs: List of buffs to remove.
- Use these broadcast structs to send and receive buff actions between client and server.
- Populate the fields as required for each buff operation (add, remove, bulk, etc.).
// Example 1: Adding a single buff
BuffAddBroadcast addBuff = new BuffAddBroadcast {
TemplateID = 4001
};
networkManager.ClientManager.Broadcast(addBuff);
// Example 2: Removing multiple buffs
BuffRemoveMultipleBroadcast removeBuffs = new BuffRemoveMultipleBroadcast {
Buffs = new List<BuffRemoveBroadcast> {
new BuffRemoveBroadcast { TemplateID = 4001 },
new BuffRemoveBroadcast { TemplateID = 4002 }
}
};
networkManager.ClientManager.Broadcast(removeBuffs);
- Always validate buff template IDs before sending or processing broadcasts.
- Use bulk updates for efficient synchronization of multiple buffs.
- Keep buff logic modular and well-documented for maintainability.
- Use the provided broadcast structs for clear, type-safe network communication.