IGuildController - jimdroberts/FishMMO GitHub Wiki
Interface for a character's guild controller, handling guild membership and events.
-
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.
-
long ID { get; set; }
The unique guild ID.
-
GuildRank Rank { get; set; }
The rank of the character in the guild.
- Implement IGuildController on your character or controller class.
- Provide logic for managing guild membership, events, and properties.
- Use the provided events and properties to handle guild invites, membership changes, and results.
// 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; }
}
- 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.