Add ghost role raffles (#26629)

* Add ghost role raffles

* GRR: Fix dialogue sizing, fix merge

* GRR: Add raffle deciders (winner picker)

* GRR: Make settings prototype based with option to override

* GRR: Use Raffles folder and namespace

* GRR: DataFieldify and TimeSpanify

* GRR: Don't actually DataFieldify HashSet<ICommonSession>s

* GRR: add GetGhostRoleCount() + docs

* update engine on branch

* Ghost role raffles: docs, fix window size, cleanup, etc

* GRR: Admin UI

* GRR: Admin UI: Display initial/max/ext of selected raffle settings proto

* GRR: Make a ton of roles raffled
This commit is contained in:
no
2024-05-07 03:48:16 +02:00
committed by GitHub
parent 6685146a1e
commit 630a7a78ed
44 changed files with 1138 additions and 51 deletions

View File

@@ -12,6 +12,21 @@ namespace Content.Shared.Ghost.Roles
public string Description { get; set; }
public string Rules { get; set; }
public HashSet<JobRequirement>? Requirements { get; set; }
/// <inheritdoc cref="GhostRoleKind"/>
public GhostRoleKind Kind { get; set; }
/// <summary>
/// if <see cref="Kind"/> is <see cref="GhostRoleKind.RaffleInProgress"/>, specifies how many players are currently
/// in the raffle for this role.
/// </summary>
public uint RafflePlayerCount { get; set; }
/// <summary>
/// if <see cref="Kind"/> is <see cref="GhostRoleKind.RaffleInProgress"/>, specifies when raffle finishes.
/// </summary>
public TimeSpan RaffleEndTime { get; set; }
}
[NetSerializable, Serializable]
@@ -26,24 +41,62 @@ namespace Content.Shared.Ghost.Roles
}
[NetSerializable, Serializable]
public sealed class GhostRoleTakeoverRequestMessage : EuiMessageBase
public sealed class RequestGhostRoleMessage : EuiMessageBase
{
public uint Identifier { get; }
public GhostRoleTakeoverRequestMessage(uint identifier)
public RequestGhostRoleMessage(uint identifier)
{
Identifier = identifier;
}
}
[NetSerializable, Serializable]
public sealed class GhostRoleFollowRequestMessage : EuiMessageBase
public sealed class FollowGhostRoleMessage : EuiMessageBase
{
public uint Identifier { get; }
public GhostRoleFollowRequestMessage(uint identifier)
public FollowGhostRoleMessage(uint identifier)
{
Identifier = identifier;
}
}
[NetSerializable, Serializable]
public sealed class LeaveGhostRoleRaffleMessage : EuiMessageBase
{
public uint Identifier { get; }
public LeaveGhostRoleRaffleMessage(uint identifier)
{
Identifier = identifier;
}
}
/// <summary>
/// Determines whether a ghost role is a raffle role, and if it is, whether it's running.
/// </summary>
[NetSerializable, Serializable]
public enum GhostRoleKind
{
/// <summary>
/// Role is not a raffle role and can be taken immediately.
/// </summary>
FirstComeFirstServe,
/// <summary>
/// Role is a raffle role, but raffle hasn't started yet.
/// </summary>
RaffleReady,
/// <summary>
/// Role is raffle role and currently being raffled, but player hasn't joined raffle.
/// </summary>
RaffleInProgress,
/// <summary>
/// Role is raffle role and currently being raffled, and player joined raffle.
/// </summary>
RaffleJoined
}
}