Files
Cockatrice/common/pb/serverinfo_zone.proto
Basile Clement 286a7494d3 client: Support arbitrary game zones (#5877)
* Remove `isView` flag from CardZone

This flag is used for two purposes:

 1. It is used as a check for casting to a zone to a `ZoneViewZone`;

 2. Non-view zones are added to the player's zones on construction

This patch removes the `isView` flag and instead:

 1. We directly cast zones to `ZoneViewZone` using a dynamic (qobject)
    cast and use the result of the cast instead of the `isView` flag to
    detect if we are a view zone or not;

 2. The player records its own zones when they are created, simplifying
    control flow.

* Review

* client: Support arbitrary game zones

Currently, the client ignores cards in unknown zones, as there is an
implicit assumption that the set of zones known by the server and the
client are the same.

This patch makes it so that the client accept "custom zones" from the
server (zones outside the builtin deck, graveyard, exile, sideboard,
table, stack and hand zones) using the information from the
ServerInfo_CardZone. Moving cards from/into these zones happens
through a "View custom zone" action in the Game > Player menu and
properly appears in the chat.

Note that this patch intentionally does not introduce any support for
having the server actually create such zones. Instead, this patch aims
to improve backwards compatibility for when we do get to adding this
capability in the future, by making sure that current clients will be
able to interact with future new zones (even if suboptimally).
2025-05-06 21:18:08 -04:00

33 lines
1.2 KiB
Protocol Buffer

syntax = "proto2";
import "serverinfo_card.proto";
message ServerInfo_Zone {
enum ZoneType {
// PrivateZone: Contents of the zone are always visible to the owner,
// but not to anyone else.
// PublicZone: Contents of the zone are always visible to anyone.
// HiddenZone: Contents of the zone are never visible to anyone.
// However, the owner of the zone can issue a dump_zone command,
// setting beingLookedAt to true.
// Cards in a zone with the type HiddenZone are referenced by their
// list index, whereas cards in any other zone are referenced by their ids.
//
// WARNING: Adding new zone types will break compatibility with older
// clients. Older clients will read new zone types as PrivateZone, which
// is likely *NOT* what you want.
PrivateZone = 0;
PublicZone = 1;
HiddenZone = 2;
}
optional string name = 1;
optional ZoneType type = 2;
optional bool with_coords = 3;
optional sint32 card_count = 4;
repeated ServerInfo_Card card_list = 5;
// Reveal top card to all players.
optional bool always_reveal_top_card = 10;
// reveal top card to the owner.
optional bool always_look_at_top_card = 11;
}