Add BoardShape to custom lobby rules with 'Default' (auto by player count)
- CustomLobby: add BoardShapeOverride (null/"Default" → AutoShape at game start)
- CustomRulesOverride: add optional BoardShape string field for lobby creation/update
- CustomRulesDto: add BoardShape field exposed to clients ("Default" | shape name)
- GameCreateCustomLobbyHandler: store + pass BoardShapeOverride; ToDto gains
optional boardShape param so shape is reflected in the creation response
- GameGetLobbyHandler / GameJoinCustomLobbyHandler / GameListCustomLobbiesHandler
/ GameListActiveLobbiesHandler: all pass lobby.BoardShapeOverride to ToDto
- GameUpdateLobbyRulesHandler: store BoardShapeOverride when rules are edited
- GameLobbyReadyHandler: resolve boardShape — use explicit override when set,
otherwise fall back to BoardShapeGenerator.AutoShape(playerCount)
- EF migration AddBoardShapeOverride: adds board_shape_override column
Valid BoardShape values: null | "Default" | "Rectangle" | "Cross" |
"Triangular" | "RadialStar" | "HexRing"
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -78,7 +78,13 @@ public sealed class CustomLobby
|
||||
public int? BoardWidthOverride { get; set; }
|
||||
|
||||
/// <summary>Board height override in rows.</summary>
|
||||
public int? BoardHeightOverride { get; set; }
|
||||
public int? BoardHeightOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Board shape override. Null or "Default" = use BoardShapeGenerator.AutoShape(playerCount).
|
||||
/// Valid explicit values: "Rectangle" | "Cross" | "Triangular" | "RadialStar" | "HexRing".
|
||||
/// </summary>
|
||||
public string? BoardShapeOverride { get; set; }
|
||||
|
||||
/// <summary>Percentage (0–100) of tiles that start with a random basic affinity. 0 = all void.</summary>
|
||||
public int? StartingRandomTilePctOverride { get; set; }
|
||||
|
||||
+460
@@ -0,0 +1,460 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using SOR.Database.Contexts;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Game
|
||||
{
|
||||
[DbContext(typeof(GameDbContext))]
|
||||
[Migration("20260326150147_AddBoardShapeOverride")]
|
||||
partial class AddBoardShapeOverride
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("game")
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.CustomLobby", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AdditionalPlayersJson")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("additional_players_json");
|
||||
|
||||
b.Property<int?>("BoardHeightOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("BoardShapeOverride")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("BoardWidthOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool?>("DiscardOnMaxHandOverride")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("DrawPerTurnOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool?>("FirstPlayerSkipsDrawOverride")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("GameMode")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("FFA")
|
||||
.HasColumnName("game_mode");
|
||||
|
||||
b.Property<Guid?>("GameSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("GuestAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("GuestDeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("GuestFirstTurnPref")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("GuestReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("HandSizeCapOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("HostAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("HostDeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("HostFirstTurnPref")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("HostReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MaxArchTier1Override")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MaxDeckSizeOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MinDeckSizeOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MpBuffOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("OpeningHandSizeOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("SpAccumulationPerTurnOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SpCapOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool?>("SpHasCapOverride")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("StartingRandomTilePctOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TeamCount")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(1)
|
||||
.HasColumnName("team_count");
|
||||
|
||||
b.Property<int?>("TimeLimitMinutesOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("TurnLimitOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("TurnTimerSecondsOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HostAccountId");
|
||||
|
||||
b.HasIndex("Status", "CreatedAt");
|
||||
|
||||
b.ToTable("custom_lobbies", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameActionLog", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ActionType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ActorAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("GameSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("OccurredAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("PayloadJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("payload");
|
||||
|
||||
b.Property<string>("ResultJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("result");
|
||||
|
||||
b.Property<int>("SequenceNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActorAccountId");
|
||||
|
||||
b.HasIndex("GameSessionId", "SequenceNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("action_logs", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameRuleSet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("BoardHeight")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("BoardWidth")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("DiscardOnMaxHand")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("DrawPerTurn")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("FirstPlayerSkipsDraw")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("HandSizeCap")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsCustomDefault")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRankedDefault")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("LoserOpReward")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxArchTier1")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxDeckSize")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MinDeckSize")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MpBuff")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("OpeningHandSize")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RankDiffOpMultiplierPct")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SpAccumulationPerTurn")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SpCap")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("SpHasCap")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("StartingRandomTilePct")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TimeLimitMinutes")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TurnLimit")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TurnTimerSeconds")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("WinnerOpReward")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IsCustomDefault");
|
||||
|
||||
b.HasIndex("IsRankedDefault");
|
||||
|
||||
b.ToTable("game_rule_sets", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameSession", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AdditionalPlayersJson")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("additional_players_json");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("EndedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("GameMode")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("FFA")
|
||||
.HasColumnName("game_mode");
|
||||
|
||||
b.Property<DateTimeOffset?>("LastActionAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("PlayerCount")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(2)
|
||||
.HasColumnName("player_count");
|
||||
|
||||
b.Property<Guid>("PlayerOneAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("PlayerOneDeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("PlayerOneReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid>("PlayerTwoAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("PlayerTwoDeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("PlayerTwoReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("RuleSnapshotJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("rule_snapshot");
|
||||
|
||||
b.Property<DateTimeOffset?>("StartedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("StateJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("state");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WinCondition")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("WinnerAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlayerOneAccountId");
|
||||
|
||||
b.HasIndex("PlayerTwoAccountId");
|
||||
|
||||
b.HasIndex("Status", "CreatedAt");
|
||||
|
||||
b.ToTable("game_sessions", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.LobbyPreset", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OwnerAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("RulesJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerAccountId");
|
||||
|
||||
b.ToTable("lobby_presets", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.MatchmakingEntry", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("DeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("JoinedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("MatchedGameSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("RankScore")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset?>("ResolvedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId", "Status");
|
||||
|
||||
b.HasIndex("Status", "RankScore");
|
||||
|
||||
b.ToTable("matchmaking_entries", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameActionLog", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Game.GameSession", "Session")
|
||||
.WithMany("ActionLog")
|
||||
.HasForeignKey("GameSessionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Session");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameSession", b =>
|
||||
{
|
||||
b.Navigation("ActionLog");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Game
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddBoardShapeOverride : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "BoardShapeOverride",
|
||||
schema: "game",
|
||||
table: "custom_lobbies",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BoardShapeOverride",
|
||||
schema: "game",
|
||||
table: "custom_lobbies");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,8 +119,13 @@ public sealed record CustomRulesOverride(
|
||||
int? TurnTimerSeconds = null,
|
||||
int? TimeLimitMinutes = null,
|
||||
int? TurnLimit = null,
|
||||
int? MpBuff = null,
|
||||
int? StartingRandomTilePct = null);
|
||||
int? MpBuff = null,
|
||||
int? StartingRandomTilePct = null,
|
||||
/// <summary>
|
||||
/// Board shape. Null or "Default" = auto-select by player count via BoardShapeGenerator.AutoShape.
|
||||
/// Explicit values: "Rectangle" | "Cross" | "Triangular" | "RadialStar" | "HexRing".
|
||||
/// </summary>
|
||||
string? BoardShape = null);
|
||||
|
||||
/// <summary>Join an open custom lobby with the specified deck.</summary>
|
||||
public sealed record JoinCustomLobbyRequest(Guid LobbyId, Guid DeckId, string? Password = null);
|
||||
@@ -672,9 +677,11 @@ public sealed record CustomRulesDto(
|
||||
int TurnTimerSeconds,
|
||||
int TimeLimitMinutes,
|
||||
int TurnLimit,
|
||||
int MpBuff,
|
||||
int StartingRandomTilePct,
|
||||
bool HasPassword);
|
||||
int MpBuff,
|
||||
int StartingRandomTilePct,
|
||||
/// <summary>"Default" = auto by player count; otherwise explicit shape name.</summary>
|
||||
string BoardShape,
|
||||
bool HasPassword);
|
||||
|
||||
/// <summary>Client-facing lobby preset summary.</summary>
|
||||
public sealed record LobbyPresetDto(
|
||||
|
||||
@@ -94,6 +94,7 @@ internal sealed class GameCreateCustomLobbyHandler : GameHandlerBase, IMessageHa
|
||||
TurnLimitOverride = req.Rules?.TurnLimit,
|
||||
MpBuffOverride = req.Rules?.MpBuff,
|
||||
StartingRandomTilePctOverride = req.Rules?.StartingRandomTilePct,
|
||||
BoardShapeOverride = req.Rules?.BoardShape,
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
|
||||
@@ -104,14 +105,15 @@ internal sealed class GameCreateCustomLobbyHandler : GameHandlerBase, IMessageHa
|
||||
new CreateCustomLobbyResponse(
|
||||
LobbyId : lobby.Id,
|
||||
LobbyName : lobby.Name,
|
||||
ActiveRules : ToDto(effective, req.Password != null),
|
||||
ActiveRules : ToDto(effective, req.Password != null, req.Rules?.BoardShape),
|
||||
MaxPlayers : lobby.MaxPlayers,
|
||||
GameMode : lobby.GameMode,
|
||||
TeamCount : lobby.TeamCount));
|
||||
}
|
||||
|
||||
// Shared helper used by list/join handlers as well.
|
||||
internal static CustomRulesDto ToDto(GameRules r, bool hasPassword = false) => new(
|
||||
// boardShape: the lobby's BoardShapeOverride string; null/"Default" → shown as "Default".
|
||||
internal static CustomRulesDto ToDto(GameRules r, bool hasPassword = false, string? boardShape = null) => new(
|
||||
OpeningHandSize : r.OpeningHandSize,
|
||||
FirstPlayerSkipsDraw : r.FirstPlayerSkipsDraw,
|
||||
SpAccumulationPerTurn : r.SpAccumulationPerTurn,
|
||||
@@ -130,5 +132,8 @@ internal sealed class GameCreateCustomLobbyHandler : GameHandlerBase, IMessageHa
|
||||
TurnLimit : r.TurnLimit,
|
||||
MpBuff : r.MpBuff,
|
||||
StartingRandomTilePct : r.StartingRandomTilePct,
|
||||
BoardShape : string.IsNullOrEmpty(boardShape) || boardShape == "Default"
|
||||
? "Default"
|
||||
: boardShape,
|
||||
HasPassword : hasPassword);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ internal sealed class GameGetLobbyHandler : GameHandlerBase, IMessageHandler
|
||||
TimeLimitMinutes = lobby.TimeLimitMinutesOverride ?? GameRules.Default.TimeLimitMinutes,
|
||||
TurnLimit = lobby.TurnLimitOverride ?? GameRules.Default.TurnLimit,
|
||||
MpBuff = lobby.MpBuffOverride ?? GameRules.Default.MpBuff,
|
||||
}, lobby.Password != null);
|
||||
}, lobby.Password != null, lobby.BoardShapeOverride);
|
||||
|
||||
var dto = new CustomLobbyDetailDto(
|
||||
LobbyId : lobby.Id,
|
||||
|
||||
@@ -171,7 +171,7 @@ internal sealed class GameJoinCustomLobbyHandler : GameHandlerBase, IMessageHand
|
||||
new JoinCustomLobbyResponse(
|
||||
LobbyId : lobby.Id,
|
||||
Status : lobby.Status == CustomLobbyStatus.Full ? "WaitingForReady" : "WaitingForPlayers",
|
||||
ActiveRules : GameCreateCustomLobbyHandler.ToDto(effective, lobby.Password != null),
|
||||
ActiveRules : GameCreateCustomLobbyHandler.ToDto(effective, lobby.Password != null, lobby.BoardShapeOverride),
|
||||
GameSessionId : null,
|
||||
HostAccountId : lobby.HostAccountId,
|
||||
HostDisplayName : hostName,
|
||||
|
||||
@@ -94,6 +94,7 @@ internal sealed class GameListActiveLobbiesHandler : GameHandlerBase, IMessageHa
|
||||
TurnLimit : l.TurnLimitOverride ?? GameRules.Default.TurnLimit,
|
||||
MpBuff : l.MpBuffOverride ?? GameRules.Default.MpBuff,
|
||||
StartingRandomTilePct : l.StartingRandomTilePctOverride ?? GameRules.Default.StartingRandomTilePct,
|
||||
BoardShape : l.BoardShapeOverride ?? "Default",
|
||||
HasPassword : l.Password != null)));
|
||||
|
||||
return ServerMessage.Reply("game.custom.list_active.ack", message.Seq,
|
||||
|
||||
@@ -117,6 +117,7 @@ internal sealed class GameListCustomLobbiesHandler : GameHandlerBase, IMessageHa
|
||||
TurnLimit : l.TurnLimitOverride ?? GameRules.Default.TurnLimit,
|
||||
MpBuff : l.MpBuffOverride ?? GameRules.Default.MpBuff,
|
||||
StartingRandomTilePct : l.StartingRandomTilePctOverride ?? GameRules.Default.StartingRandomTilePct,
|
||||
BoardShape : l.BoardShapeOverride ?? "Default",
|
||||
HasPassword : l.Password != null),
|
||||
CreatedAt : l.CreatedAt,
|
||||
MaxPlayers : l.MaxPlayers,
|
||||
|
||||
@@ -205,8 +205,12 @@ internal sealed class GameLobbyReadyHandler : GameHandlerBase, IMessageHandler
|
||||
.Where(r => r.IsCustomDefault)
|
||||
.FirstOrDefaultAsync(ct);
|
||||
|
||||
// Auto-select board shape when the lobby doesn't specify one explicitly.
|
||||
var boardShape = BoardShapeGenerator.AutoShape(playerCount);
|
||||
// Resolve board shape: use lobby override if explicitly set (not null/"Default"),
|
||||
// otherwise auto-select based on player count.
|
||||
var boardShape = !string.IsNullOrEmpty(lobby.BoardShapeOverride)
|
||||
&& lobby.BoardShapeOverride != "Default"
|
||||
? lobby.BoardShapeOverride
|
||||
: BoardShapeGenerator.AutoShape(playerCount);
|
||||
|
||||
// Build effective rules: lobby override → admin custom-default → hard-coded default.
|
||||
var rules = new GameRules
|
||||
|
||||
@@ -71,6 +71,7 @@ internal sealed class GameUpdateLobbyRulesHandler : GameHandlerBase, IMessageHan
|
||||
lobby.TurnLimitOverride = r.TurnLimit;
|
||||
lobby.MpBuffOverride = r.MpBuff;
|
||||
lobby.StartingRandomTilePctOverride = r.StartingRandomTilePct;
|
||||
lobby.BoardShapeOverride = r.BoardShape;
|
||||
|
||||
await _gameDb.SaveChangesAsync(ct);
|
||||
|
||||
@@ -94,7 +95,7 @@ internal sealed class GameUpdateLobbyRulesHandler : GameHandlerBase, IMessageHan
|
||||
TurnLimit = r.TurnLimit ?? GameRules.Default.TurnLimit,
|
||||
MpBuff = r.MpBuff ?? GameRules.Default.MpBuff,
|
||||
StartingRandomTilePct = r.StartingRandomTilePct ?? GameRules.Default.StartingRandomTilePct,
|
||||
}, lobby.Password != null);
|
||||
}, lobby.Password != null, r.BoardShape);
|
||||
|
||||
var updatedPush = ServerMessage.Push("game.custom.lobby_updated",
|
||||
new LobbyUpdatedPush(lobby.Id, effective));
|
||||
|
||||
Reference in New Issue
Block a user