IGuildController - jimdroberts/FishMMO GitHub Wiki

Description

Interface for a character's guild controller, handling guild membership and events.


API Access

Fields

  • static Action<long, IPlayerCharacter> OnReadID

    Static event for reading a guild ID and player character.

  • event Action OnReceiveGuildInvite

    Event triggered when a guild invite is received.

  • event Action<long, long, GuildRank, string> OnAddGuildMember

    Event triggered when a guild member is added.

  • event Action<HashSet> OnValidateGuildMembers

    Event triggered to validate guild members.

  • event Action OnRemoveGuildMember

    Event triggered when a guild member is removed.

  • event Action OnLeaveGuild

    Event triggered when leaving a guild.

  • event Action OnReceiveGuildResult

    Event triggered when a guild result is received.

Properties

  • long ID { get; set; }

    The unique guild ID.

  • GuildRank Rank { get; set; }

    The rank of the character in the guild.


Basic Usage

Setup

  1. Implement IGuildController on your character or controller class.
  2. Provide logic for managing guild membership, events, and properties.
  3. Use the provided events and properties to handle guild invites, membership changes, and results.

Example

// Example 1: Implementing IGuildController
public class MyGuildController : IGuildController {
    public static Action<long, IPlayerCharacter> OnReadID;
    public event Action<long> OnReceiveGuildInvite;
    public event Action<long, long, GuildRank, string> OnAddGuildMember;
    public event Action<HashSet<long>> OnValidateGuildMembers;
    public event Action<long> OnRemoveGuildMember;
    public event Action OnLeaveGuild;
    public event Action<GuildResultType> OnReceiveGuildResult;
    public long ID { get; set; }
    public GuildRank Rank { get; set; }
}

Best Practices

  • Subscribe to all relevant events to keep UI and gameplay logic in sync with guild state.
  • Use the ID and Rank properties to track the character's guild membership and status.
  • Always unregister event handlers on character stop or destroy to avoid memory leaks.
⚠️ **GitHub.com Fallback** ⚠️