using Robust.Shared.Serialization;
using Robust.Shared.Network; // Required for NetUserId
namespace Content.Shared.Civ14.CivFactions;
///
/// Base class for faction-related network events for easier subscription if needed.
///
[Serializable, NetSerializable]
public abstract class BaseFactionRequestEvent : EntityEventArgs
{
// Can add common fields here if necessary later
}
///
/// Sent from Client -> Server when a player wants to create a new faction.
///
[Serializable, NetSerializable]
public sealed class CreateFactionRequestEvent : BaseFactionRequestEvent
{
public string FactionName { get; }
///
/// Initialises a new request to create a faction with the specified name.
///
/// The desired name for the new faction.
public CreateFactionRequestEvent(string factionName)
{
FactionName = factionName;
}
}
///
/// Sent from Client -> Server when a player wants to leave their current faction.
///
[Serializable, NetSerializable]
public sealed class LeaveFactionRequestEvent : BaseFactionRequestEvent
{
// No extra data needed, server knows sender.
}
///
/// Sent from Client -> Server when a player wants to invite another player.
///
[Serializable, NetSerializable]
public sealed class InviteFactionRequestEvent : BaseFactionRequestEvent
{
///
/// The NetUserId of the player being invited.
///
public NetUserId TargetPlayerUserId { get; }
///
/// Initialises a new invitation request event targeting the specified player for faction invitation.
///
/// The user ID of the player to invite to the faction.
public InviteFactionRequestEvent(NetUserId targetPlayerUserId)
{
TargetPlayerUserId = targetPlayerUserId;
}
}
///
/// Sent from Server -> Client (Target) to notify them of a faction invitation.
///
[Serializable, NetSerializable]
public sealed class FactionInviteOfferEvent : EntityEventArgs // Not inheriting BaseFactionRequestEvent
{
public string InviterName { get; }
public string FactionName { get; }
public NetUserId InviterUserId { get; } ///
/// Initialises a new faction invitation offer with the inviter's name, faction name, and inviter's user ID.
///
/// The display name of the player sending the invitation.
/// The name of the faction the invitation is for.
/// The user ID of the player sending the invitation.
public FactionInviteOfferEvent(string inviterName, string factionName, NetUserId inviterUserId)
{
InviterName = inviterName;
FactionName = factionName;
InviterUserId = inviterUserId;
}
}
///
/// Sent from Client (Target) -> Server when a player accepts a faction invitation.
///
[Serializable, NetSerializable]
public sealed class AcceptFactionInviteEvent : BaseFactionRequestEvent
{
///
/// The name of the faction being joined.
///
public string FactionName { get; }
///
/// The NetUserId of the player who originally sent the invite.
///
public NetUserId InviterUserId { get; } ///
/// Initialises a new event indicating that a player has accepted a faction invitation.
///
/// The name of the faction being joined.
/// The user ID of the player who sent the invitation.
public AcceptFactionInviteEvent(string factionName)
{
FactionName = factionName;
}
}
// Optional: Decline event if explicit decline handling is needed beyond timeout/ignoring.
// [Serializable, NetSerializable]
// public sealed class DeclineFactionInviteEvent : BaseFactionRequestEvent { ... }
///
/// Sent from Server -> Client (specific player) when their faction membership status changes.
///
[Serializable, NetSerializable]
public sealed class PlayerFactionStatusChangedEvent : EntityEventArgs
{
public bool IsInFaction { get; }
public string? FactionName { get; } ///
/// Initialises a new event indicating a player's faction membership status and, if applicable, the faction's name.
///
/// Whether the player is currently in a faction.
/// The name of the faction if the player is a member; otherwise, null.
public PlayerFactionStatusChangedEvent(bool isInFaction, string? factionName)
{
IsInFaction = isInFaction;
FactionName = factionName;
}
}