Table of Contents

Class GuildSystem

Namespace
FishMMO.Server.Implementation.World.SceneServer
Assembly
FishMMO.Server.dll

Guild permission resolution: the single place the server decides what a character may do in a guild, and the lazy migration that gives a pre-permissions guild its rank ladder.

[CreateAssetMenu(fileName = "GuildSystem", menuName = "FishMMO/Server/SceneServer/Guild System", order = 1)]
[RequiresDataContainer(typeof(GuildSystemRuntimeData))]
[RequiresDataContainer(typeof(GuildCharacterMappingData))]
[RequiresDataContainer(typeof(GuildSystemMainThreadQueueData))]
[RequiresDataContainer(typeof(AsyncWorkerData))]
public class GuildSystem : ServerBehaviour, IServerBehaviour<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>, IServerComponent<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>, IGuildSystem<NetworkConnection>, IServerBehaviour, IServerComponent
Inheritance
Object
ScriptableObject
GuildSystem
Implements
IServerBehaviour<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>
IServerComponent<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>
IGuildSystem<NetworkConnection>
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Remarks

Split out of GuildSystem.cs because it is the security surface of the whole feature. Every operation in the main file now funnels through ResolveGuildAuthorityAsync(long, long), and a reviewer asking "can a member kick a leader?" should be able to answer it from one file rather than from thirty scattered comparisons.

The old model compared a GuildRank enum: Rank >= GuildRank.Officer and friends. That is gone. A rank is a row a guild owns, carrying a name it chose and a permission mask; the row's ORDER is used for seniority alone.

Fields

GuildCreateAchievementTemplate

[Header("Achievements")]
public AchievementTemplate GuildCreateAchievementTemplate

Field Value

AchievementTemplate

GuildJoinAchievementTemplate

Achievement to increment when a player joins a guild.

public AchievementTemplate GuildJoinAchievementTemplate

Field Value

AchievementTemplate

Properties

MaxGuildSize

Maximum number of members allowed in a guild.

public int MaxGuildSize { get; }

Property Value

int

UpdatePumpRate

Gets the update pump rate for guild synchronization.

public float UpdatePumpRate { get; }

Property Value

float

Methods

AddGuildCharacterTracker(long, long)

Adds a mapping for the Guild to Guild Members connected to this Scene Server.

public void AddGuildCharacterTracker(long guildID, long characterID)

Parameters

guildID long

ID of the guild.

characterID long

ID of the character to add.

CharacterSystem_OnConnect(NetworkConnection, IPlayerCharacter)

Handles character connect event, adding the character to the guild tracker and persisting guild update.

public void CharacterSystem_OnConnect(NetworkConnection conn, IPlayerCharacter character)

Parameters

conn NetworkConnection

Network connection of the character.

character IPlayerCharacter

The character that connected.

CharacterSystem_OnDisconnect(NetworkConnection, IPlayerCharacter)

Handles character disconnect event, removing the character from the guild tracker and persisting guild update.

public void CharacterSystem_OnDisconnect(NetworkConnection conn, IPlayerCharacter character)

Parameters

conn NetworkConnection

Network connection of the character.

character IPlayerCharacter

The character that disconnected.

InitializeOnce()

Initializes the guild system, registering chat commands and broadcast handlers, and character events.

public override ServerComponentInitializationStatus InitializeOnce()

Returns

ServerComponentInitializationStatus

OnDeinitialize()

Cleans up the guild system, unregistering broadcast handlers and character events.

public override void OnDeinitialize()

OnGuildInvite(IPlayerCharacter, ChatBroadcast)

Handles guild invite chat commands.

public bool OnGuildInvite(IPlayerCharacter sender, ChatBroadcast msg)

Parameters

sender IPlayerCharacter

The character sending the invite.

msg ChatBroadcast

Chat broadcast message containing the target character name.

Returns

bool

True if invite was sent, false otherwise.

OnServerGuildAcceptInviteBroadcastReceived(NetworkConnection, GuildAcceptInviteBroadcast, Channel)

Handles acceptance of a guild invitation, validates the invite, fires an async task to check capacity, persist membership, and marshal results back to the main thread.

public void OnServerGuildAcceptInviteBroadcastReceived(NetworkConnection conn, GuildAcceptInviteBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the accepting character.

msg GuildAcceptInviteBroadcast

GuildAcceptInviteBroadcast message containing acceptance details.

channel Channel

Network channel used for the broadcast.

OnServerGuildApplicationListRequestBroadcastReceived(NetworkConnection, GuildApplicationListRequestBroadcast, Channel)

Handles a request for the guild's pending application queue.

public void OnServerGuildApplicationListRequestBroadcastReceived(NetworkConnection conn, GuildApplicationListRequestBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildApplicationListRequestBroadcast

The request. Carries nothing.

channel Channel

Network channel used for the broadcast.

OnServerGuildApplyBroadcastReceived(NetworkConnection, GuildApplyBroadcast, Channel)

Handles a request to apply to a guild found in the directory.

public void OnServerGuildApplyBroadcastReceived(NetworkConnection conn, GuildApplyBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The applying connection.

msg GuildApplyBroadcast

The guild and the applicant's message.

channel Channel

Network channel used for the broadcast.

Remarks

Refused for a character who is already in a guild — checked here on the cheap side, and again in the SQL, because the controller's guild ID is main-thread state and the membership row is the truth.

OnServerGuildChangeRankBroadcastReceived(NetworkConnection, GuildChangeRankBroadcast, Channel)

Handles guild rank change broadcast, validates leader and target, and fires an async task to update ranks in the database. Only guild leaders can promote another member to a new rank.

public void OnServerGuildChangeRankBroadcastReceived(NetworkConnection conn, GuildChangeRankBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the requester.

msg GuildChangeRankBroadcast

GuildChangeRankBroadcast message containing target member ID and new rank.

channel Channel

Network channel used for the broadcast.

OnServerGuildCreateBroadcastReceived(NetworkConnection, GuildCreateBroadcast, Channel)

Handles guild creation broadcast, validates and creates a new guild for the requesting character. Fires an async task that checks name availability, creates the guild, persists membership, and marshals the result back to the main thread.

public void OnServerGuildCreateBroadcastReceived(NetworkConnection conn, GuildCreateBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the requester.

msg GuildCreateBroadcast

GuildCreateBroadcast message containing guild creation details.

channel Channel

Network channel used for the broadcast.

OnServerGuildCreateRankBroadcastReceived(NetworkConnection, GuildCreateRankBroadcast, Channel)

Handles a request to add a rank to the ladder.

public void OnServerGuildCreateRankBroadcastReceived(NetworkConnection conn, GuildCreateRankBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildCreateRankBroadcast

The requested position, name and mask.

channel Channel

Network channel used for the broadcast.

OnServerGuildDeclineInviteBroadcastReceived(NetworkConnection, GuildDeclineInviteBroadcast, Channel)

Handles decline of a guild invitation, removes pending invitation for the character.

public void OnServerGuildDeclineInviteBroadcastReceived(NetworkConnection conn, GuildDeclineInviteBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the declining character.

msg GuildDeclineInviteBroadcast

GuildDeclineInviteBroadcast message containing decline details.

channel Channel

Network channel used for the broadcast.

OnServerGuildDeleteRankBroadcastReceived(NetworkConnection, GuildDeleteRankBroadcast, Channel)

Handles a request to remove a rank from the ladder.

public void OnServerGuildDeleteRankBroadcastReceived(NetworkConnection conn, GuildDeleteRankBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildDeleteRankBroadcast

The rank to remove.

channel Channel

Network channel used for the broadcast.

OnServerGuildDirectoryRequestBroadcastReceived(NetworkConnection, GuildDirectoryRequestBroadcast, Channel)

Handles a request for a page of the recruitment directory.

public void OnServerGuildDirectoryRequestBroadcastReceived(NetworkConnection conn, GuildDirectoryRequestBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildDirectoryRequestBroadcast

The optional search term.

channel Channel

Network channel used for the broadcast.

Remarks

The ONE guild request a non-member may make, so it does not go through TryBeginGuildRequest — which requires a guild — and instead does the connection checks itself. Browsing is deliberately open to members too: a player shopping for a new guild has not left their old one yet.

OnServerGuildDisbandBroadcastReceived(NetworkConnection, GuildDisbandBroadcast, Channel)

Handles a request to disband the guild.

public void OnServerGuildDisbandBroadcastReceived(NetworkConnection conn, GuildDisbandBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the leader.

msg GuildDisbandBroadcast

The broadcast carrying the confirmation name.

channel Channel

Network channel used for the broadcast.

OnServerGuildEditRankBroadcastReceived(NetworkConnection, GuildEditRankBroadcast, Channel)

Handles a request to rename a rank or change its permissions.

public void OnServerGuildEditRankBroadcastReceived(NetworkConnection conn, GuildEditRankBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildEditRankBroadcast

The requested name and mask.

channel Channel

Network channel used for the broadcast.

OnServerGuildInviteBroadcastReceived(NetworkConnection, GuildInviteBroadcast, Channel)

Handles guild invitation broadcast, validates inviter and target, and sends invitation to the target character. Only guild leaders or officers can invite, and invitations are tracked to prevent duplicates. Fires an async task to verify guild capacity before sending the invite.

public void OnServerGuildInviteBroadcastReceived(NetworkConnection conn, GuildInviteBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the inviter.

msg GuildInviteBroadcast

GuildInviteBroadcast message containing inviter and target IDs.

channel Channel

Network channel used for the broadcast.

OnServerGuildLeaveBroadcastReceived(NetworkConnection, GuildLeaveBroadcast, Channel)

Handles guild leave broadcast, validates character, captures necessary data, and fires an async task that handles leadership transfer, member removal, and guild cleanup.

public void OnServerGuildLeaveBroadcastReceived(NetworkConnection conn, GuildLeaveBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the leaving character.

msg GuildLeaveBroadcast

GuildLeaveBroadcast message containing leave details.

channel Channel

Network channel used for the broadcast.

OnServerGuildLogRequestBroadcastReceived(NetworkConnection, GuildLogRequestBroadcast, Channel)

Handles a request for the guild's recent activity log.

public void OnServerGuildLogRequestBroadcastReceived(NetworkConnection conn, GuildLogRequestBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the requester.

msg GuildLogRequestBroadcast

The request broadcast.

channel Channel

Network channel used for the broadcast.

Remarks

The guild is taken from the requester's SERVER-side controller, never from the message. The request carries no guild id precisely so that there is nothing to forge: a player can only ever ask for the log of the guild the server already believes they are in.

OnServerGuildRankListRequestBroadcastReceived(NetworkConnection, GuildRankListRequestBroadcast, Channel)

Handles a request for the guild's rank ladder.

public void OnServerGuildRankListRequestBroadcastReceived(NetworkConnection conn, GuildRankListRequestBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildRankListRequestBroadcast

The request. Carries nothing.

channel Channel

Network channel used for the broadcast.

Remarks

Any member may read the ladder — a player cannot be expected to work within rules they are not allowed to see, and the permission masks in it are already implied by which buttons every other member visibly has.

OnServerGuildRemoveBroadcastReceived(NetworkConnection, GuildRemoveBroadcast, Channel)

Handles guild member removal broadcast, validates and removes a member from the guild. Only officers and leaders can remove other members.

public void OnServerGuildRemoveBroadcastReceived(NetworkConnection conn, GuildRemoveBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the requester.

msg GuildRemoveBroadcast

GuildRemoveBroadcast message containing member ID to remove.

channel Channel

Network channel used for the broadcast.

OnServerGuildResolveApplicationBroadcastReceived(NetworkConnection, GuildResolveApplicationBroadcast, Channel)

Handles an accept or decline of one pending application.

public void OnServerGuildResolveApplicationBroadcastReceived(NetworkConnection conn, GuildResolveApplicationBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildResolveApplicationBroadcast

The application and the decision.

channel Channel

Network channel used for the broadcast.

OnServerGuildSetMemberNoteBroadcastReceived(NetworkConnection, GuildSetMemberNoteBroadcast, Channel)

Handles a request to set one of a member's two notes.

public void OnServerGuildSetMemberNoteBroadcastReceived(NetworkConnection conn, GuildSetMemberNoteBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildSetMemberNoteBroadcast

The member, the note and which note it is.

channel Channel

Network channel used for the broadcast.

Remarks

E6. The two notes are separately permissioned, and the officer note is separately permissioned for READING as well — a rank may be allowed to write public notes without being allowed to see the officer ones.

OnServerGuildSetMessageOfTheDayBroadcastReceived(NetworkConnection, GuildSetMessageOfTheDayBroadcast, Channel)

Handles a request to change the guild message of the day.

public void OnServerGuildSetMessageOfTheDayBroadcastReceived(NetworkConnection conn, GuildSetMessageOfTheDayBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the requester.

msg GuildSetMessageOfTheDayBroadcast

The requested message of the day.

channel Channel

Network channel used for the broadcast.

OnServerGuildSetNoticeBroadcastReceived(NetworkConnection, GuildSetNoticeBroadcast, Channel)

Handles a request to change the guild notice.

public void OnServerGuildSetNoticeBroadcastReceived(NetworkConnection conn, GuildSetNoticeBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the requester.

msg GuildSetNoticeBroadcast

The requested notice text.

channel Channel

Network channel used for the broadcast.

OnServerGuildSetRecruitmentBroadcastReceived(NetworkConnection, GuildSetRecruitmentBroadcast, Channel)

Handles a request to change the guild's recruitment advertisement.

public void OnServerGuildSetRecruitmentBroadcastReceived(NetworkConnection conn, GuildSetRecruitmentBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

The requesting connection.

msg GuildSetRecruitmentBroadcast

The proposed blurb, tags and recruiting flag.

channel Channel

Network channel used for the broadcast.

OnServerGuildTransferLeadershipBroadcastReceived(NetworkConnection, GuildTransferLeadershipBroadcast, Channel)

Handles a request to transfer guild leadership to another member.

public void OnServerGuildTransferLeadershipBroadcastReceived(NetworkConnection conn, GuildTransferLeadershipBroadcast msg, Channel channel)

Parameters

conn NetworkConnection

Network connection of the current leader.

msg GuildTransferLeadershipBroadcast

The broadcast naming the successor.

channel Channel

Network channel used for the broadcast.

Remarks

The successor may be OFFLINE. Leadership is a database rank, not a session, and a guild whose leader can only hand over while the successor happens to be logged in is a guild that stays stuck for exactly the reason S5 describes.

OnUpdate(float)

Drains the main-thread queue each frame.

protected override void OnUpdate(float deltaTime)

Parameters

deltaTime float

RemoveGuildCharacterTracker(long, long)

Removes the mapping of Guild to Guild Members connected to this Scene Server.

public void RemoveGuildCharacterTracker(long guildID, long characterID)

Parameters

guildID long

ID of the guild.

characterID long

ID of the character to remove.