Struct GuildAuthority
- Namespace
- FishMMO.Server.Implementation.World.SceneServer
- Assembly
- FishMMO.Server.dll
One character's authoritative standing in one guild, resolved from the database.
public readonly struct GuildAuthority
- Inherited Members
Remarks
This is what every server-side guild permission decision consults. It is deliberately a value produced by a database read rather than anything cached on the character: the controller's copy of a player's rank is a client-visible convenience that can be a broadcast out of date, and "a broadcast out of date" is precisely the window in which a demoted officer would still be able to kick.
The permission model this carries replaces the old GuildRank enum comparisons.
A rank no longer implies its powers by its NAME or its position — it holds a mask, and the
position is used for one thing only: seniority, so that "you cannot act on somebody at or
above you" still has an answer.
Constructors
GuildAuthority(bool, long, long, byte, GuildPermissions, byte, long, IReadOnlyList<GuildRankData>)
Creates a resolved standing.
public GuildAuthority(bool isMember, long guildID, long characterID, byte rankOrder, GuildPermissions permissions, byte leaderRankOrder, long membershipVersion, IReadOnlyList<GuildRankData> ladder)
Parameters
isMemberboolWhether a membership row was found.
guildIDlongThe guild.
characterIDlongThe character.
rankOrderbyteLadder position.
permissionsGuildPermissionsPermission mask.
leaderRankOrderbyteHighest ladder position in the guild.
membershipVersionlongMembership row concurrency token.
ladderIReadOnlyList<GuildRankData>The guild's rank rows.
Fields
CharacterID
The character the standing belongs to.
public readonly long CharacterID
Field Value
GuildID
The guild this standing is in.
public readonly long GuildID
Field Value
IsMember
Whether the character actually holds a membership row in this guild.
public readonly bool IsMember
Field Value
Remarks
False is the value every failure resolves to — no membership, wrong guild, database unavailable. A caller that forgets to check it gets Permissions of None and a RankOrder of zero, so the failure mode of forgetting is refusal rather than escalation.
Ladder
The guild's whole rank ladder, ordered by rank order ascending.
public readonly IReadOnlyList<GuildRankData> Ladder
Field Value
Remarks
Carried along because almost every caller that needs one rank needs to validate a second one in the same breath — "does the rank I am promoting into exist", "what mask does it hold" — and re-reading the ladder per question would turn one round trip into four, each able to observe a different edit.
LeaderRankOrder
The highest rank order that exists in this guild — the leader's seat.
public readonly byte LeaderRankOrder
Field Value
MembershipVersion
The concurrency token of the character's membership row.
public readonly long MembershipVersion
Field Value
Permissions
The permissions the character's rank holds.
public readonly GuildPermissions Permissions
Field Value
RankOrder
The character's position on the ladder. Higher is more senior.
public readonly byte RankOrder
Field Value
Properties
IsLeader
Whether this standing occupies the guild's top seat.
public bool IsLeader { get; }
Property Value
Remarks
Computed from the ladder rather than compared against a constant, because a guild that has added ranks above the seeded three has a leader seat this file cannot know.
Methods
Has(GuildPermissions)
Whether this standing holds every bit of the requested permission.
public bool Has(GuildPermissions permission)
Parameters
permissionGuildPermissionsThe permission, or combination, required.
Returns
- bool
True when the holder may proceed.
Remarks
Non-membership is folded in rather than left to the caller. A struct that answered "yes, this non-member has Invite" because its default mask happened to be non-empty is a bug waiting for one careless construction.
None(long, long)
A standing that permits nothing.
public static GuildAuthority None(long guildID, long characterID)
Parameters
Returns
- GuildAuthority
A non-member standing.
Outranks(byte)
Whether this standing is strictly senior to the given ladder position.
public bool Outranks(byte otherRankOrder)
Parameters
otherRankOrderbyteThe other character's ladder position.
Returns
- bool
True when the holder outranks the position.
Remarks
STRICTLY. Equal ranks may not act on each other — two officers demoting each other in a loop is not a feature, and the leader seat being unique is what keeps a guild from having two people able to disband it out from under one another.
PermissionsAt(byte)
The permission mask held by a given ladder position in this guild.
public GuildPermissions PermissionsAt(byte rankOrder)
Parameters
rankOrderbyteThe position to look up.
Returns
- GuildPermissions
The mask, or None when no such rank exists.
Remarks
A position with no row returns nothing rather than falling back to the seeded defaults. The fallback exists for a guild whose ladder has not been written at all — a guild that HAS a ladder and is being asked about a position outside it is being asked about a rank that does not exist, and inventing permissions for it is how a deleted rank would keep working.
TryGetRank(byte, out GuildRankData)
Finds a rank row by its ladder position.
public bool TryGetRank(byte rankOrder, out GuildRankData rank)
Parameters
rankOrderbyteThe position to look up.
rankGuildRankDataThe matching row.
Returns
- bool
True when the guild has a rank at that position.