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:
parent
fac7bfaa92
commit
ebe2c494aa
13 changed files with 3 additions and 100 deletions
|
@ -757,13 +757,6 @@ void MessageLogWidget::logSpectatorSay(QString spectatorName,
|
||||||
appendMessage(std::move(message), {}, spectatorName, spectatorUserLevel, userPrivLevel, false);
|
appendMessage(std::move(message), {}, spectatorName, spectatorUserLevel, userPrivLevel, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLogWidget::logStopDumpZone(Player *player, CardZone *zone)
|
|
||||||
{
|
|
||||||
appendHtmlServerMessage(tr("%1 stops looking at %2.")
|
|
||||||
.arg(sanitizeHtml(player->getName()))
|
|
||||||
.arg(zone->getTranslatedName(zone->getPlayer() == player, CaseLookAtZone)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessageLogWidget::logUnattachCard(Player *player, QString cardName)
|
void MessageLogWidget::logUnattachCard(Player *player, QString cardName)
|
||||||
{
|
{
|
||||||
appendHtmlServerMessage(
|
appendHtmlServerMessage(
|
||||||
|
@ -824,7 +817,6 @@ void MessageLogWidget::connectToPlayer(Player *player)
|
||||||
SLOT(logAttachCard(Player *, QString, Player *, QString)));
|
SLOT(logAttachCard(Player *, QString, Player *, QString)));
|
||||||
connect(player, SIGNAL(logUnattachCard(Player *, QString)), this, SLOT(logUnattachCard(Player *, QString)));
|
connect(player, SIGNAL(logUnattachCard(Player *, QString)), this, SLOT(logUnattachCard(Player *, QString)));
|
||||||
connect(player, SIGNAL(logDumpZone(Player *, CardZone *, int)), this, SLOT(logDumpZone(Player *, CardZone *, int)));
|
connect(player, SIGNAL(logDumpZone(Player *, CardZone *, int)), this, SLOT(logDumpZone(Player *, CardZone *, int)));
|
||||||
connect(player, SIGNAL(logStopDumpZone(Player *, CardZone *)), this, SLOT(logStopDumpZone(Player *, CardZone *)));
|
|
||||||
connect(player, SIGNAL(logDrawCards(Player *, int)), this, SLOT(logDrawCards(Player *, int)));
|
connect(player, SIGNAL(logDrawCards(Player *, int)), this, SLOT(logDrawCards(Player *, int)));
|
||||||
connect(player, SIGNAL(logUndoDraw(Player *, QString)), this, SLOT(logUndoDraw(Player *, QString)));
|
connect(player, SIGNAL(logUndoDraw(Player *, QString)), this, SLOT(logUndoDraw(Player *, QString)));
|
||||||
connect(player, SIGNAL(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int)), this,
|
connect(player, SIGNAL(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int)), this,
|
||||||
|
|
|
@ -93,7 +93,6 @@ public slots:
|
||||||
void logShuffle(Player *player, CardZone *zone, int start, int end);
|
void logShuffle(Player *player, CardZone *zone, int start, int end);
|
||||||
void
|
void
|
||||||
logSpectatorSay(QString spectatorName, UserLevelFlags spectatorUserLevel, QString userPrivLevel, QString message);
|
logSpectatorSay(QString spectatorName, UserLevelFlags spectatorUserLevel, QString userPrivLevel, QString message);
|
||||||
void logStopDumpZone(Player *player, CardZone *zone);
|
|
||||||
void logUnattachCard(Player *player, QString cardName);
|
void logUnattachCard(Player *player, QString cardName);
|
||||||
void logUndoDraw(Player *player, QString cardName);
|
void logUndoDraw(Player *player, QString cardName);
|
||||||
void setContextJudgeName(QString player);
|
void setContextJudgeName(QString player);
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
#include "pb/event_set_card_counter.pb.h"
|
#include "pb/event_set_card_counter.pb.h"
|
||||||
#include "pb/event_set_counter.pb.h"
|
#include "pb/event_set_counter.pb.h"
|
||||||
#include "pb/event_shuffle.pb.h"
|
#include "pb/event_shuffle.pb.h"
|
||||||
#include "pb/event_stop_dump_zone.pb.h"
|
|
||||||
#include "pb/serverinfo_player.pb.h"
|
#include "pb/serverinfo_player.pb.h"
|
||||||
#include "pb/serverinfo_user.pb.h"
|
#include "pb/serverinfo_user.pb.h"
|
||||||
#include "pb/serverinfo_zone.pb.h"
|
#include "pb/serverinfo_zone.pb.h"
|
||||||
|
@ -1984,19 +1983,6 @@ void Player::eventDumpZone(const Event_DumpZone &event)
|
||||||
emit logDumpZone(this, zone, event.number_cards());
|
emit logDumpZone(this, zone, event.number_cards());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::eventStopDumpZone(const Event_StopDumpZone &event)
|
|
||||||
{
|
|
||||||
Player *zoneOwner = game->getPlayers().value(event.zone_owner_id(), 0);
|
|
||||||
if (!zoneOwner) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CardZone *zone = zoneOwner->getZones().value(QString::fromStdString(event.zone_name()), 0);
|
|
||||||
if (!zone) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emit logStopDumpZone(this, zone);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Player::eventMoveCard(const Event_MoveCard &event, const GameEventContext &context)
|
void Player::eventMoveCard(const Event_MoveCard &event, const GameEventContext &context)
|
||||||
{
|
{
|
||||||
Player *startPlayer = game->getPlayers().value(event.start_player_id());
|
Player *startPlayer = game->getPlayers().value(event.start_player_id());
|
||||||
|
@ -2314,9 +2300,6 @@ void Player::processGameEvent(GameEvent::GameEventType type, const GameEvent &ev
|
||||||
case GameEvent::DUMP_ZONE:
|
case GameEvent::DUMP_ZONE:
|
||||||
eventDumpZone(event.GetExtension(Event_DumpZone::ext));
|
eventDumpZone(event.GetExtension(Event_DumpZone::ext));
|
||||||
break;
|
break;
|
||||||
case GameEvent::STOP_DUMP_ZONE:
|
|
||||||
eventStopDumpZone(event.GetExtension(Event_StopDumpZone::ext));
|
|
||||||
break;
|
|
||||||
case GameEvent::MOVE_CARD:
|
case GameEvent::MOVE_CARD:
|
||||||
eventMoveCard(event.GetExtension(Event_MoveCard::ext), context);
|
eventMoveCard(event.GetExtension(Event_MoveCard::ext), context);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -47,7 +47,6 @@ class Event_SetCardAttr;
|
||||||
class Event_SetCardCounter;
|
class Event_SetCardCounter;
|
||||||
class Event_SetCounter;
|
class Event_SetCounter;
|
||||||
class Event_Shuffle;
|
class Event_Shuffle;
|
||||||
class Event_StopDumpZone;
|
|
||||||
class GameCommand;
|
class GameCommand;
|
||||||
class GameEvent;
|
class GameEvent;
|
||||||
class GameEventContext;
|
class GameEventContext;
|
||||||
|
@ -135,7 +134,6 @@ signals:
|
||||||
void logSetPT(Player *player, CardItem *card, QString newPT);
|
void logSetPT(Player *player, CardItem *card, QString newPT);
|
||||||
void logSetAnnotation(Player *player, CardItem *card, QString newAnnotation);
|
void logSetAnnotation(Player *player, CardItem *card, QString newAnnotation);
|
||||||
void logDumpZone(Player *player, CardZone *zone, int numberCards);
|
void logDumpZone(Player *player, CardZone *zone, int numberCards);
|
||||||
void logStopDumpZone(Player *player, CardZone *zone);
|
|
||||||
void logRevealCards(Player *player,
|
void logRevealCards(Player *player,
|
||||||
CardZone *zone,
|
CardZone *zone,
|
||||||
int cardId,
|
int cardId,
|
||||||
|
@ -312,7 +310,6 @@ private:
|
||||||
void eventSetCounter(const Event_SetCounter &event);
|
void eventSetCounter(const Event_SetCounter &event);
|
||||||
void eventDelCounter(const Event_DelCounter &event);
|
void eventDelCounter(const Event_DelCounter &event);
|
||||||
void eventDumpZone(const Event_DumpZone &event);
|
void eventDumpZone(const Event_DumpZone &event);
|
||||||
void eventStopDumpZone(const Event_StopDumpZone &event);
|
|
||||||
void eventMoveCard(const Event_MoveCard &event, const GameEventContext &context);
|
void eventMoveCard(const Event_MoveCard &event, const GameEventContext &context);
|
||||||
void eventFlipCard(const Event_FlipCard &event);
|
void eventFlipCard(const Event_FlipCard &event);
|
||||||
void eventDestroyCard(const Event_DestroyCard &event);
|
void eventDestroyCard(const Event_DestroyCard &event);
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "carditem.h"
|
#include "carditem.h"
|
||||||
#include "gamescene.h"
|
#include "gamescene.h"
|
||||||
#include "pb/command_shuffle.pb.h"
|
#include "pb/command_shuffle.pb.h"
|
||||||
#include "pb/command_stop_dump_zone.pb.h"
|
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "settingscache.h"
|
#include "settingscache.h"
|
||||||
#include "zoneviewzone.h"
|
#include "zoneviewzone.h"
|
||||||
|
@ -200,12 +199,6 @@ void ZoneViewWidget::handleScrollBarChange(int value)
|
||||||
void ZoneViewWidget::closeEvent(QCloseEvent *event)
|
void ZoneViewWidget::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
disconnect(zone, SIGNAL(beingDeleted()), this, 0);
|
disconnect(zone, SIGNAL(beingDeleted()), this, 0);
|
||||||
if (zone->getNumberCards() != -2) {
|
|
||||||
Command_StopDumpZone cmd;
|
|
||||||
cmd.set_player_id(player->getId());
|
|
||||||
cmd.set_zone_name(zone->getName().toStdString());
|
|
||||||
player->sendGameCommand(cmd);
|
|
||||||
}
|
|
||||||
if (shuffleCheckBox.isChecked())
|
if (shuffleCheckBox.isChecked())
|
||||||
player->sendGameCommand(Command_Shuffle());
|
player->sendGameCommand(Command_Shuffle());
|
||||||
emit closePressed(this);
|
emit closePressed(this);
|
||||||
|
|
|
@ -48,7 +48,6 @@ SET(PROTO_FILES
|
||||||
command_set_sideboard_lock.proto
|
command_set_sideboard_lock.proto
|
||||||
command_shuffle.proto
|
command_shuffle.proto
|
||||||
commands.proto
|
commands.proto
|
||||||
command_stop_dump_zone.proto
|
|
||||||
command_undo_draw.proto
|
command_undo_draw.proto
|
||||||
context_concede.proto
|
context_concede.proto
|
||||||
context_connection_state_changed.proto
|
context_connection_state_changed.proto
|
||||||
|
@ -102,7 +101,6 @@ SET(PROTO_FILES
|
||||||
event_set_card_counter.proto
|
event_set_card_counter.proto
|
||||||
event_set_counter.proto
|
event_set_counter.proto
|
||||||
event_shuffle.proto
|
event_shuffle.proto
|
||||||
event_stop_dump_zone.proto
|
|
||||||
event_user_joined.proto
|
event_user_joined.proto
|
||||||
event_user_left.proto
|
event_user_left.proto
|
||||||
event_user_message.proto
|
event_user_message.proto
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
syntax = "proto2";
|
|
||||||
import "game_commands.proto";
|
|
||||||
message Command_StopDumpZone {
|
|
||||||
extend GameCommand {
|
|
||||||
optional Command_StopDumpZone ext = 1025;
|
|
||||||
}
|
|
||||||
optional sint32 player_id = 1;
|
|
||||||
optional string zone_name = 2;
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
syntax = "proto2";
|
|
||||||
import "game_event.proto";
|
|
||||||
|
|
||||||
message Event_StopDumpZone {
|
|
||||||
extend GameEvent {
|
|
||||||
optional Event_StopDumpZone ext = 2019;
|
|
||||||
}
|
|
||||||
optional sint32 zone_owner_id = 1;
|
|
||||||
optional string zone_name = 2;
|
|
||||||
}
|
|
|
@ -26,7 +26,7 @@ message GameCommand {
|
||||||
NEXT_TURN = 1022;
|
NEXT_TURN = 1022;
|
||||||
SET_ACTIVE_PHASE = 1023;
|
SET_ACTIVE_PHASE = 1023;
|
||||||
DUMP_ZONE = 1024;
|
DUMP_ZONE = 1024;
|
||||||
STOP_DUMP_ZONE = 1025;
|
STOP_DUMP_ZONE = 1025; // deprecated
|
||||||
REVEAL_CARDS = 1026;
|
REVEAL_CARDS = 1026;
|
||||||
MOVE_CARD = 1027;
|
MOVE_CARD = 1027;
|
||||||
SET_SIDEBOARD_PLAN = 1028;
|
SET_SIDEBOARD_PLAN = 1028;
|
||||||
|
|
|
@ -28,7 +28,7 @@ message GameEvent {
|
||||||
SET_ACTIVE_PLAYER = 2016;
|
SET_ACTIVE_PLAYER = 2016;
|
||||||
SET_ACTIVE_PHASE = 2017;
|
SET_ACTIVE_PHASE = 2017;
|
||||||
DUMP_ZONE = 2018;
|
DUMP_ZONE = 2018;
|
||||||
STOP_DUMP_ZONE = 2019;
|
STOP_DUMP_ZONE = 2019; // deprecated
|
||||||
CHANGE_ZONE_PROPERTIES = 2020;
|
CHANGE_ZONE_PROPERTIES = 2020;
|
||||||
REVERSE_TURN = 2021;
|
REVERSE_TURN = 2021;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include "pb/command_set_sideboard_lock.pb.h"
|
#include "pb/command_set_sideboard_lock.pb.h"
|
||||||
#include "pb/command_set_sideboard_plan.pb.h"
|
#include "pb/command_set_sideboard_plan.pb.h"
|
||||||
#include "pb/command_shuffle.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/command_undo_draw.pb.h"
|
||||||
#include "pb/context_concede.pb.h"
|
#include "pb/context_concede.pb.h"
|
||||||
#include "pb/context_connection_state_changed.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_card_counter.pb.h"
|
||||||
#include "pb/event_set_counter.pb.h"
|
#include "pb/event_set_counter.pb.h"
|
||||||
#include "pb/event_shuffle.pb.h"
|
#include "pb/event_shuffle.pb.h"
|
||||||
#include "pb/event_stop_dump_zone.pb.h"
|
|
||||||
#include "pb/response.pb.h"
|
#include "pb/response.pb.h"
|
||||||
#include "pb/response_deck_download.pb.h"
|
#include "pb/response_deck_download.pb.h"
|
||||||
#include "pb/response_dump_zone.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;
|
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
|
Response::ResponseCode
|
||||||
Server_Player::cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer & /*rc*/, GameEventStorage &ges)
|
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:
|
case GameCommand::DUMP_ZONE:
|
||||||
return cmdDumpZone(command.GetExtension(Command_DumpZone::ext), rc, ges);
|
return cmdDumpZone(command.GetExtension(Command_DumpZone::ext), rc, ges);
|
||||||
break;
|
break;
|
||||||
case GameCommand::STOP_DUMP_ZONE:
|
|
||||||
return cmdStopDumpZone(command.GetExtension(Command_StopDumpZone::ext), rc, ges);
|
|
||||||
break;
|
|
||||||
case GameCommand::REVEAL_CARDS:
|
case GameCommand::REVEAL_CARDS:
|
||||||
return cmdRevealCards(command.GetExtension(Command_RevealCards::ext), rc, ges);
|
return cmdRevealCards(command.GetExtension(Command_RevealCards::ext), rc, ges);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -55,7 +55,6 @@ class Command_DelCounter;
|
||||||
class Command_NextTurn;
|
class Command_NextTurn;
|
||||||
class Command_SetActivePhase;
|
class Command_SetActivePhase;
|
||||||
class Command_DumpZone;
|
class Command_DumpZone;
|
||||||
class Command_StopDumpZone;
|
|
||||||
class Command_RevealCards;
|
class Command_RevealCards;
|
||||||
class Command_ReverseTurn;
|
class Command_ReverseTurn;
|
||||||
class Command_MoveCard;
|
class Command_MoveCard;
|
||||||
|
@ -226,8 +225,6 @@ public:
|
||||||
Response::ResponseCode
|
Response::ResponseCode
|
||||||
cmdSetActivePhase(const Command_SetActivePhase &cmd, ResponseContainer &rc, GameEventStorage &ges);
|
cmdSetActivePhase(const Command_SetActivePhase &cmd, ResponseContainer &rc, GameEventStorage &ges);
|
||||||
Response::ResponseCode cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges);
|
Response::ResponseCode cmdDumpZone(const Command_DumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges);
|
||||||
Response::ResponseCode
|
|
||||||
cmdStopDumpZone(const Command_StopDumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges);
|
|
||||||
Response::ResponseCode cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer &rc, GameEventStorage &ges);
|
Response::ResponseCode cmdRevealCards(const Command_RevealCards &cmd, ResponseContainer &rc, GameEventStorage &ges);
|
||||||
Response::ResponseCode
|
Response::ResponseCode
|
||||||
cmdReverseTurn(const Command_ReverseTurn & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges);
|
cmdReverseTurn(const Command_ReverseTurn & /*cmd*/, ResponseContainer & /*rc*/, GameEventStorage &ges);
|
||||||
|
|
|
@ -42,7 +42,6 @@ const ProtoFiles = [
|
||||||
"command_set_sideboard_lock.proto",
|
"command_set_sideboard_lock.proto",
|
||||||
"command_set_sideboard_plan.proto",
|
"command_set_sideboard_plan.proto",
|
||||||
"command_shuffle.proto",
|
"command_shuffle.proto",
|
||||||
"command_stop_dump_zone.proto",
|
|
||||||
"command_undo_draw.proto",
|
"command_undo_draw.proto",
|
||||||
"commands.proto",
|
"commands.proto",
|
||||||
"context_concede.proto",
|
"context_concede.proto",
|
||||||
|
@ -97,7 +96,6 @@ const ProtoFiles = [
|
||||||
"event_set_card_counter.proto",
|
"event_set_card_counter.proto",
|
||||||
"event_set_counter.proto",
|
"event_set_counter.proto",
|
||||||
"event_shuffle.proto",
|
"event_shuffle.proto",
|
||||||
"event_stop_dump_zone.proto",
|
|
||||||
"event_user_joined.proto",
|
"event_user_joined.proto",
|
||||||
"event_user_left.proto",
|
"event_user_left.proto",
|
||||||
"event_user_message.proto",
|
"event_user_message.proto",
|
||||||
|
|
Loading…
Reference in a new issue