FactionBroadcasts - jimdroberts/FishMMO GitHub Wiki
Defines broadcast structures for character faction updates, including single and multiple faction updates. Used for networked communication of faction changes between client and server.
-
public struct FactionUpdateBroadcast : IBroadcast
Broadcast for updating a single faction value for a character. Contains the faction template ID and the new value.
- int TemplateID: Template ID of the faction to update.
- int NewValue: New value for the faction (e.g., reputation or standing).
-
public struct FactionUpdateMultipleBroadcast : IBroadcast
Broadcast for updating multiple faction values for a character at once. Used for bulk faction updates or synchronization.
- List Factions: List of faction updates to apply.
- Use these broadcast structs to send and receive faction updates between client and server.
- Populate the fields as required for each faction update operation (single, bulk, etc.).
// Example 1: Updating a single faction
FactionUpdateBroadcast update = new FactionUpdateBroadcast {
TemplateID = 7001,
NewValue = 50
};
networkManager.ClientManager.Broadcast(update);
// Example 2: Bulk updating factions
FactionUpdateMultipleBroadcast bulkUpdate = new FactionUpdateMultipleBroadcast {
Factions = new List<FactionUpdateBroadcast> {
new FactionUpdateBroadcast { TemplateID = 7001, NewValue = 50 },
new FactionUpdateBroadcast { TemplateID = 7002, NewValue = 10 }
}
};
networkManager.ClientManager.Broadcast(bulkUpdate);
- Always validate faction template IDs and values before sending or processing broadcasts.
- Use bulk updates for efficient synchronization of multiple factions.
- Keep faction logic modular and well-documented for maintainability.
- Use the provided broadcast structs for clear, type-safe network communication.