remove the stop dump zone command from the protocol (#4326)

the stop dump zone command was implemented as a courtesy to other
players in order to take into account when they would stop looking at
unknown information

however, this can be abused, a malicious client can send this command
whenever they would like

cockatrice is not a physical tabletop nor does it aim to be, if you can
take a screenshot of your deck and then close the view, you are not
cheating as you have been given this information

in order to prevent anyone from abusing this we should remove the
command from the protocol, this means servers will ignore this message
and clients will get a little invalid command reply in their debug log

the extension id will remain reserved

shuffling your deck will always invalidate any card view looking at
those cards

if players wish to signal that they stopped looking at their deck for
whatever reason they should just use the chat instead, optionally using
one of the chat macros
This commit is contained in:
ebbit1q
2021-06-02 03:52:20 +02:00
committed by GitHub
parent fac7bfaa92
commit ebe2c494aa
13 changed files with 3 additions and 100 deletions

View File

@@ -34,7 +34,6 @@
#include "pb/command_set_sideboard_lock.pb.h"
#include "pb/command_set_sideboard_plan.pb.h"
#include "pb/command_shuffle.pb.h"
#include "pb/command_stop_dump_zone.pb.h"
#include "pb/command_undo_draw.pb.h"
#include "pb/context_concede.pb.h"
#include "pb/context_connection_state_changed.pb.h"
@@ -65,7 +64,6 @@
#include "pb/event_set_card_counter.pb.h"
#include "pb/event_set_counter.pb.h"
#include "pb/event_shuffle.pb.h"
#include "pb/event_stop_dump_zone.pb.h"
#include "pb/response.pb.h"
#include "pb/response_deck_download.pb.h"
#include "pb/response_dump_zone.pb.h"
@@ -1830,36 +1828,6 @@ Server_Player::cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, G
return Response::RespOk;
}
Response::ResponseCode
Server_Player::cmdStopDumpZone(const Command_StopDumpZone &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges)
{
if (!game->getGameStarted()) {
return Response::RespGameNotStarted;
}
if (conceded) {
return Response::RespContextError;
}
Server_Player *otherPlayer = game->getPlayers().value(cmd.player_id());
if (!otherPlayer) {
return Response::RespNameNotFound;
}
Server_CardZone *zone = otherPlayer->getZones().value(QString::fromStdString(cmd.zone_name()));
if (!zone) {
return Response::RespNameNotFound;
}
if (zone->getType() == ServerInfo_Zone::HiddenZone) {
zone->setCardsBeingLookedAt(0);
Event_StopDumpZone event;
event.set_zone_owner_id(cmd.player_id());
event.set_zone_name(zone->getName().toStdString());
ges.enqueueGameEvent(event, playerId);
}
return Response::RespOk;
}
Response::ResponseCode
Server_Player::cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges)
{
@@ -2115,9 +2083,6 @@ Server_Player::processGameCommand(const GameCommand &command, ResponseContainer
case GameCommand::DUMP_ZONE:
return cmdDumpZone(command.GetExtension(Command_DumpZone::ext), rc, ges);
break;
case GameCommand::STOP_DUMP_ZONE:
return cmdStopDumpZone(command.GetExtension(Command_StopDumpZone::ext), rc, ges);
break;
case GameCommand::REVEAL_CARDS:
return cmdRevealCards(command.GetExtension(Command_RevealCards::ext), rc, ges);
break;