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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 3 additions and 100 deletions

View file

@ -757,13 +757,6 @@ void MessageLogWidget::logSpectatorSay(QString spectatorName,
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)
{
appendHtmlServerMessage(
@ -824,7 +817,6 @@ void MessageLogWidget::connectToPlayer(Player *player)
SLOT(logAttachCard(Player *, QString, 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(logStopDumpZone(Player *, CardZone *)), this, SLOT(logStopDumpZone(Player *, CardZone *)));
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(logRevealCards(Player *, CardZone *, int, QString, Player *, bool, int)), this,

View file

@ -93,7 +93,6 @@ public slots:
void logShuffle(Player *player, CardZone *zone, int start, int end);
void
logSpectatorSay(QString spectatorName, UserLevelFlags spectatorUserLevel, QString userPrivLevel, QString message);
void logStopDumpZone(Player *player, CardZone *zone);
void logUnattachCard(Player *player, QString cardName);
void logUndoDraw(Player *player, QString cardName);
void setContextJudgeName(QString player);

View file

@ -49,7 +49,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/serverinfo_player.pb.h"
#include "pb/serverinfo_user.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());
}
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)
{
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:
eventDumpZone(event.GetExtension(Event_DumpZone::ext));
break;
case GameEvent::STOP_DUMP_ZONE:
eventStopDumpZone(event.GetExtension(Event_StopDumpZone::ext));
break;
case GameEvent::MOVE_CARD:
eventMoveCard(event.GetExtension(Event_MoveCard::ext), context);
break;

View file

@ -47,7 +47,6 @@ class Event_SetCardAttr;
class Event_SetCardCounter;
class Event_SetCounter;
class Event_Shuffle;
class Event_StopDumpZone;
class GameCommand;
class GameEvent;
class GameEventContext;
@ -135,7 +134,6 @@ signals:
void logSetPT(Player *player, CardItem *card, QString newPT);
void logSetAnnotation(Player *player, CardItem *card, QString newAnnotation);
void logDumpZone(Player *player, CardZone *zone, int numberCards);
void logStopDumpZone(Player *player, CardZone *zone);
void logRevealCards(Player *player,
CardZone *zone,
int cardId,
@ -312,7 +310,6 @@ private:
void eventSetCounter(const Event_SetCounter &event);
void eventDelCounter(const Event_DelCounter &event);
void eventDumpZone(const Event_DumpZone &event);
void eventStopDumpZone(const Event_StopDumpZone &event);
void eventMoveCard(const Event_MoveCard &event, const GameEventContext &context);
void eventFlipCard(const Event_FlipCard &event);
void eventDestroyCard(const Event_DestroyCard &event);

View file

@ -3,7 +3,6 @@
#include "carditem.h"
#include "gamescene.h"
#include "pb/command_shuffle.pb.h"
#include "pb/command_stop_dump_zone.pb.h"
#include "player.h"
#include "settingscache.h"
#include "zoneviewzone.h"
@ -200,12 +199,6 @@ void ZoneViewWidget::handleScrollBarChange(int value)
void ZoneViewWidget::closeEvent(QCloseEvent *event)
{
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())
player->sendGameCommand(Command_Shuffle());
emit closePressed(this);