Merge branch 'Cockatrice:master' into toggle-normal-untapping-once

This commit is contained in:
Skagra42 2026-08-13 13:09:08 -06:00 committed by GitHub
commit fdd7d4eac0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
543 changed files with 82935 additions and 48240 deletions

View file

@ -5,7 +5,7 @@
#include <google/protobuf/descriptor.h>
#include <google/protobuf/message.h>
#include <google/protobuf/text_format.h>
#include <libcockatrice/utility/trice_limits.h>
#include <libcockatrice/utility/string_limits.h>
// FastFieldValuePrinter is added in protobuf 3.4, going out of our way to add the old FieldValuePrinter is not worth it
#if GOOGLE_PROTOBUF_VERSION > 3004000

View file

@ -122,6 +122,7 @@ set(PROTO_FILES
response_activate.proto
response_adjust_mod.proto
response_ban_history.proto
response_card_art_rule_entry.proto
response_deck_download.proto
response_deck_list.proto
response_deck_upload.proto

View file

@ -1,56 +1,197 @@
syntax = "proto2";
// Commands that are sent during a game to change the game state
/// Commands that are sent during a game to change the game state
message GameCommand {
/// Identifies the concrete game command to execute
enum GameCommandType {
/// Kick a player from the game.
/// Server: Server_AbstractParticipant::cmdKickFromGame
/// Client: reflected via game state events
KICK_FROM_GAME = 1000;
/// Leave the current game voluntarily.
/// Server: Server_AbstractParticipant::cmdLeaveGame
/// Client: reflected via game state events
LEAVE_GAME = 1001;
/// Send an in-game chat message.
/// Server: Server_AbstractParticipant::cmdGameSay
/// Client: PlayerEventHandler::eventGameSay
GAME_SAY = 1002;
/// Shuffle a zone (typically the library).
/// Server: Server_Player::cmdShuffle
/// Client: PlayerEventHandler::eventShuffle
SHUFFLE = 1003;
/// Take a mulligan at game start.
/// Server: Server_Player::cmdMulligan
/// Client: reflected via game state events
MULLIGAN = 1004;
/// Roll one or more dice.
/// Server: Server_AbstractPlayer::cmdRollDie
/// Client: PlayerEventHandler::eventRollDie
ROLL_DIE = 1005;
/// Draw cards from the deck.
/// Server: Server_Player::cmdDrawCards
/// Client: PlayerEventHandler::eventDrawCards
DRAW_CARDS = 1006;
/// Undo a previous draw action.
/// Server: Server_Player::cmdUndoDraw
/// Client: PlayerEventHandler::eventMoveCard (Context_UndoDraw)
UNDO_DRAW = 1007;
/// Flip a card face up or face down.
/// Server: Server_AbstractPlayer::cmdFlipCard
/// Client: PlayerEventHandler::eventFlipCard
FLIP_CARD = 1008;
/// Attach one card to another.
/// Server: Server_AbstractPlayer::cmdAttachCard
/// Client: PlayerEventHandler::eventAttachCard
ATTACH_CARD = 1009;
/// Create a token card.
/// Server: Server_AbstractPlayer::cmdCreateToken
/// Client: PlayerEventHandler::eventCreateToken
CREATE_TOKEN = 1010;
/// Create a visual arrow between objects.
/// Server: Server_AbstractPlayer::cmdCreateArrow
/// Client: PlayerEventHandler::eventCreateArrow
CREATE_ARROW = 1011;
/// Delete a visual arrow.
/// Server: Server_AbstractPlayer::cmdDeleteArrow
/// Client: PlayerEventHandler::eventDeleteArrow
DELETE_ARROW = 1012;
/// Set a card attribute (e.g. tapped, flipped).
/// Server: Server_AbstractPlayer::cmdSetCardAttr
/// Client: PlayerEventHandler::eventSetCardAttr
SET_CARD_ATTR = 1013;
/// Set a counter value on a card.
/// Server: Server_AbstractPlayer::cmdSetCardCounter
/// Client: PlayerEventHandler::eventSetCardCounter
SET_CARD_COUNTER = 1014;
/// Increment a counter on a card.
/// Server: Server_AbstractPlayer::cmdIncCardCounter
/// Client: PlayerEventHandler::eventSetCardCounter
INC_CARD_COUNTER = 1015;
/// Mark the player as ready to start the game.
/// Server: Server_AbstractPlayer::cmdReadyStart
/// Client: reflected via game state events
READY_START = 1016;
/// Concede the game.
/// Server: Server_AbstractPlayer::cmdConcede
/// Client: reflected via game state events
CONCEDE = 1017;
/// Increment a global (non-card) counter.
/// Server: Server_Player::cmdIncCounter
/// Client: PlayerEventHandler::eventSetCounter
INC_COUNTER = 1018;
/// Create a new global counter.
/// Server: Server_Player::cmdCreateCounter
/// Client: PlayerEventHandler::eventCreateCounter
CREATE_COUNTER = 1019;
/// Set a global counter value.
/// Server: Server_Player::cmdSetCounter
/// Client: PlayerEventHandler::eventSetCounter
SET_COUNTER = 1020;
/// Delete a global counter.
/// Server: Server_Player::cmdDelCounter
/// Client: PlayerEventHandler::eventDelCounter
DEL_COUNTER = 1021;
/// Advance to the next turn.
/// Server: Server_Player::cmdNextTurn
/// Client: reflected via active player / phase events
NEXT_TURN = 1022;
/// Set the active phase of the turn.
/// Server: Server_Player::cmdSetActivePhase
/// Client: reflected via game state events
SET_ACTIVE_PHASE = 1023;
/// Dump the contents of a zone.
/// Server: Server_AbstractPlayer::cmdDumpZone
/// Client: PlayerEventHandler::eventDumpZone
DUMP_ZONE = 1024;
// STOP_DUMP_ZONE = 1025; // obsolete
/// Reveal specific cards to players.
/// Server: Server_AbstractPlayer::cmdRevealCards
/// Client: PlayerEventHandler::eventRevealCards
REVEAL_CARDS = 1026;
/// Move a card between zones.
/// Server: Server_AbstractPlayer::cmdMoveCard
/// Client: PlayerEventHandler::eventMoveCard
MOVE_CARD = 1027;
/// Set the sideboard plan for the game.
/// Server: Server_Player::cmdSetSideboardPlan
/// Client: not forwarded as a game event
SET_SIDEBOARD_PLAN = 1028;
/// Select a deck for the game.
/// Server: Server_Player::cmdDeckSelect
/// Client: reflected via lobby / game state
DECK_SELECT = 1029;
/// Lock or unlock sideboarding.
/// Server: Server_Player::cmdSetSideboardLock
/// Client: reflected via game state
SET_SIDEBOARD_LOCK = 1030;
/// Change zone properties (visibility, reveal-top, etc.).
/// Server: Server_Player::cmdChangeZoneProperties
/// Client: PlayerEventHandler::eventChangeZoneProperties
CHANGE_ZONE_PROPERTIES = 1031;
/// Undo a previous concede.
/// Server: Server_AbstractPlayer::cmdUnconcede
/// Client: reflected via game state
UNCONCEDE = 1032;
/// Execute a command on behalf of another player.
/// Server: Server_AbstractParticipant::cmdJudge
/// Client: transparent (wrapped commands handled normally)
JUDGE = 1033;
/// Reverse the current turn order.
/// Server: Server_Player::cmdReverseTurn
/// Client: reflected via subsequent turn events
REVERSE_TURN = 1034;
}
extensions 100 to max;
}
// A wrapper around a normal game command that allows a privileged user to send a command on behalf of another player
/// A wrapper around a normal game command that allows a privileged user
/// to send a command on behalf of another player.
message Command_Judge {
extend GameCommand {
/// Judge command extension payload
optional Command_Judge ext = 1033;
}
// The player on whose behalf this command is sent
/// The player on whose behalf this command is sent.
optional sint32 target_id = 1 [default = -1];
// The wrapped game command
/// One or more wrapped game commands to execute.
repeated GameCommand game_command = 2;
}

View file

@ -11,6 +11,9 @@ message ModeratorCommand {
FORCE_ACTIVATE_USER = 1007;
GET_ADMIN_NOTES = 1008;
UPDATE_ADMIN_NOTES = 1009;
ADD_CARD_ART_RULE = 1010;
REMOVE_CARD_ART_RULE = 1011;
LIST_CARD_ART_RULES = 1012;
}
extensions 100 to max;
}
@ -106,3 +109,29 @@ message Command_UpdateAdminNotes {
optional string user_name = 1;
optional string notes = 2;
}
message Command_AddCardArtRule {
extend ModeratorCommand {
optional Command_AddCardArtRule ext = 1010;
}
optional string card_name = 1;
optional string card_provider_id = 2;
optional string mode = 3; // "ALLOW" or "DENY"
optional string reason = 4;
}
message Command_RemoveCardArtRule {
extend ModeratorCommand {
optional Command_RemoveCardArtRule ext = 1011;
}
optional string card_name = 1;
optional string card_provider_id = 2;
}
message Command_ListCardArtRules {
extend ModeratorCommand {
optional Command_ListCardArtRules ext = 1012;
}
}

View file

@ -1,35 +1,44 @@
syntax = "proto2";
// Sent immediately after a command with the same cmd_id, connecting it to the command sent to the server
/// Server response envelope linking to a command
/**
* This message is sent immediately after a client command, using the same `cmd_id`
* to connect the response to the command.
*
* Responses may contain standard outcome codes (`ResponseCode`) and indicate
* what type of response the server is sending (`ResponseType`).
*/
message Response {
// Outcome of the command sent by the client
enum ResponseCode {
RespNotConnected = -1;
RespNothing = 0;
RespOk = 1;
RespNotInRoom = 2;
RespInternalError = 3;
RespInvalidCommand = 4;
RespInvalidData = 5;
RespNameNotFound = 6;
RespLoginNeeded = 7;
RespFunctionNotAllowed = 8;
RespGameNotStarted = 9;
RespGameFull = 10;
RespContextError = 11;
RespWrongPassword = 12;
RespSpectatorsNotAllowed = 13;
RespOnlyBuddies = 14;
RespUserLevelTooLow = 15;
RespInIgnoreList = 16;
RespWouldOverwriteOldSession = 17;
RespChatFlood = 18;
RespUserIsBanned = 19;
RespAccessDenied = 20;
RespUsernameInvalid = 21;
RespRegistrationRequired = 22;
RespRegistrationAccepted = 23; // Server agrees to process client's registration request
RespUserAlreadyExists = 24; // Client attempted to register a name which is already registered
RespEmailRequiredToRegister = 25; // Server requires email to register accounts but client did not provide one
RespNotConnected = -1; // Client is not connected or session expired
RespNothing = 0; // No response required
RespOk = 1; // Command succeeded
RespNotInRoom = 2; // Client is not in the room for this command
RespInternalError = 3; // Server encountered an unexpected error
RespInvalidCommand = 4; // Command was invalid or unrecognized
RespInvalidData = 5; // Command data was invalid or malformed
RespNameNotFound = 6; // Target user not found
RespLoginNeeded = 7; // Client must log in first
RespFunctionNotAllowed = 8; // Client tried to perform a restricted action
RespGameNotStarted = 9; // Game has not started yet
RespGameFull = 10; // Game is full
RespContextError = 11; // Context (room/game) mismatch
RespWrongPassword = 12; // Password for this room or game is incorrect
RespSpectatorsNotAllowed = 13; // Spectators are not allowed in this room/game
RespOnlyBuddies = 14; // Only buddies can perform this action
RespUserLevelTooLow = 15; // Users permission level is insufficient
RespInIgnoreList = 16; // Target user has ignored the client
RespWouldOverwriteOldSession = 17; // Would overwrite an existing session
RespChatFlood = 18; // Too many messages sent in short time
RespUserIsBanned = 19; // Client is banned
RespAccessDenied = 20; // Access to this action is denied
RespUsernameInvalid = 21; // Username is invalid
RespRegistrationRequired = 22; // Registration is required
RespRegistrationAccepted = 23; // Server agrees to process client's registration request
RespUserAlreadyExists = 24; // Client attempted to register a name which is already registered
RespEmailRequiredToRegister = 25; // Server requires email to register accounts but client did not provide one
RespTooManyRequests = 26; // Server refused to complete command because client has sent too many too quickly
RespPasswordTooShort = 27; // Server requires a decent password
RespAccountNotActivated =
@ -45,32 +54,36 @@ message Response {
RespServerFull = 36; // Server user limit reached
RespEmailBlackListed = 37; // Server has blocked the email address provided for registration for some reason
}
enum ResponseType {
JOIN_ROOM = 1000;
LIST_USERS = 1001;
GET_GAMES_OF_USER = 1002;
GET_USER_INFO = 1003;
DUMP_ZONE = 1004;
LOGIN = 1005;
DECK_LIST = 1006;
DECK_DOWNLOAD = 1007;
DECK_UPLOAD = 1008;
REGISTER = 1009;
ACTIVATE = 1010;
ADJUST_MOD = 1011;
BAN_HISTORY = 1012;
WARN_HISTORY = 1013;
WARN_LIST = 1014;
VIEW_LOG = 1015;
FORGOT_PASSWORD_REQUEST = 1016;
PASSWORD_SALT = 1017;
GET_ADMIN_NOTES = 1018;
REPLAY_LIST = 1100;
REPLAY_DOWNLOAD = 1101;
REPLAY_GET_CODE = 1102;
}
required uint64 cmd_id = 1;
optional ResponseCode response_code = 2;
extensions 100 to max;
// Type of response, used to route handling on the client
enum ResponseType {
JOIN_ROOM = 1000; // Response for joining a room
LIST_USERS = 1001; // Response listing users
GET_GAMES_OF_USER = 1002; // Response with user's games
GET_USER_INFO = 1003; // Response with user info
DUMP_ZONE = 1004; // Response with zone dump
LOGIN = 1005; // Response to login attempt
DECK_LIST = 1006; // Response with deck list
DECK_DOWNLOAD = 1007; // Response for deck download
DECK_UPLOAD = 1008; // Response for deck upload
REGISTER = 1009; // Response to registration
ACTIVATE = 1010; // Response to activation
ADJUST_MOD = 1011; // Response to mod adjustments
BAN_HISTORY = 1012; // Response with ban history
WARN_HISTORY = 1013; // Response with warn history
WARN_LIST = 1014; // Response with current warnings
VIEW_LOG = 1015; // Response with logs
FORGOT_PASSWORD_REQUEST = 1016; // Response to password reset request
PASSWORD_SALT = 1017; // Response containing password salt
GET_ADMIN_NOTES = 1018; // Response with admin notes
REPLAY_LIST = 1100; // Response listing replays
REPLAY_DOWNLOAD = 1101; // Response for replay download
REPLAY_GET_CODE = 1102; // Response containing replay code
CARD_ART_RULE_LIST = 1200; // Response containing a list of card art rules
}
required uint64 cmd_id = 1; // Command ID that this response corresponds to
optional ResponseCode response_code = 2; // Outcome code of the command
extensions 100 to max; // Protobuf extensions reserved for future use
}

View file

@ -0,0 +1,16 @@
syntax = "proto2";
import "response.proto";
message Response_CardArtRuleEntry {
optional string card_name = 1;
optional string card_provider_id = 2;
optional string mode = 3;
optional string reason = 4;
}
message Response_ListCardArtRules {
extend Response {
optional Response_ListCardArtRules ext = 1200;
}
repeated Response_CardArtRuleEntry entries = 1;
}

View file

@ -62,4 +62,7 @@ message ServerInfo_Game {
// whether the game is closed. Closed games are finished and can't be interacted with
optional bool closed = 52;
// the current host of the game, which may differ from the creator after a host transfer
optional ServerInfo_User host_info = 53;
}

View file

@ -1,4 +1,5 @@
syntax = "proto2";
message ServerInfo_User {
enum UserLevelFlag {
IsNothing = 0;
@ -12,6 +13,14 @@ message ServerInfo_User {
optional string left_side = 1;
optional string right_side = 2;
};
message CardArtParams {
optional string card_name = 1;
optional string card_provider_id = 2;
optional double margin_pct_l = 3 [default = 0.33];
optional double margin_pct_r = 4 [default = 0.02];
optional double vertical_offset = 5 [default = 0.35];
optional double zoom = 6 [default = 1.0];
};
optional string name = 1;
optional uint32 user_level = 2;
@ -28,4 +37,5 @@ message ServerInfo_User {
optional string clientid = 13;
optional string privlevel = 14;
optional PawnColorsOverride pawn_colors = 15;
}
optional CardArtParams card_art_params = 16;
}

View file

@ -27,6 +27,7 @@ message SessionCommand {
FORGOT_PASSWORD_RESET = 1022;
FORGOT_PASSWORD_CHALLENGE = 1023;
REQUEST_PASSWORD_SALT = 1024;
SET_CARD_ART_PARAMS = 1025;
REPLAY_LIST = 1100;
REPLAY_DOWNLOAD = 1101;
REPLAY_MODIFY_MATCH = 1102;
@ -205,3 +206,15 @@ message Command_RequestPasswordSalt {
}
required string user_name = 1;
}
message Command_SetCardArtParams {
extend SessionCommand {
optional Command_SetCardArtParams ext = 1025;
}
optional string card_name = 1;
optional string card_provider_id = 2;
optional double margin_pct_l = 3;
optional double margin_pct_r = 4;
optional double vertical_offset = 5;
optional double zoom = 6;
}