mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 05:23:56 -07:00
[Server][Game] Make undo draw failure visible in chat
This commit is contained in:
parent
5219cffa6b
commit
b4da05e75f
8 changed files with 35 additions and 0 deletions
|
|
@ -806,6 +806,12 @@ void MessageLogWidget::logUndoDraw(PlayerLogic *player, QString cardName)
|
|||
}
|
||||
}
|
||||
|
||||
void MessageLogWidget::logUndoDrawFailed(PlayerLogic *player)
|
||||
{
|
||||
appendHtmlServerMessage(
|
||||
tr("%1 failed to undo their last draw.").arg(sanitizeHtml(player->getPlayerInfo()->getName())));
|
||||
}
|
||||
|
||||
void MessageLogWidget::setContextJudgeName(QString name)
|
||||
{
|
||||
messagePrefix = QString("<span style=\"color:black\">");
|
||||
|
|
@ -839,6 +845,7 @@ void MessageLogWidget::connectToPlayerEventHandler(PlayerEventHandler *playerEve
|
|||
connect(playerEventHandler, &PlayerEventHandler::logDumpZone, this, &MessageLogWidget::logDumpZone);
|
||||
connect(playerEventHandler, &PlayerEventHandler::logDrawCards, this, &MessageLogWidget::logDrawCards);
|
||||
connect(playerEventHandler, &PlayerEventHandler::logUndoDraw, this, &MessageLogWidget::logUndoDraw);
|
||||
connect(playerEventHandler, &PlayerEventHandler::logUndoDrawFailed, this, &MessageLogWidget::logUndoDrawFailed);
|
||||
connect(playerEventHandler, &PlayerEventHandler::logRevealCards, this, &MessageLogWidget::logRevealCards);
|
||||
connect(playerEventHandler, &PlayerEventHandler::logAlwaysRevealTopCard, this,
|
||||
&MessageLogWidget::logAlwaysRevealTopCard);
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ public slots:
|
|||
void logSpectatorSay(const ServerInfo_User &spectator, QString message);
|
||||
void logUnattachCard(PlayerLogic *player, QString cardName);
|
||||
void logUndoDraw(PlayerLogic *player, QString cardName);
|
||||
void logUndoDrawFailed(PlayerLogic *player);
|
||||
void setContextJudgeName(QString player);
|
||||
void appendHtmlServerMessage(const QString &html,
|
||||
bool optionalIsBold = false,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include <libcockatrice/protocol/pb/event_set_card_counter.pb.h>
|
||||
#include <libcockatrice/protocol/pb/event_set_counter.pb.h>
|
||||
#include <libcockatrice/protocol/pb/event_shuffle.pb.h>
|
||||
#include <libcockatrice/protocol/pb/event_undo_draw_failed.pb.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
|
||||
PlayerEventHandler::PlayerEventHandler(PlayerLogic *_player) : QObject(_player), player(_player)
|
||||
|
|
@ -581,6 +582,11 @@ void PlayerEventHandler::eventChangeZoneProperties(const Event_ChangeZonePropert
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerEventHandler::eventUndoDrawFailed(const Event_UndoDrawFailed &)
|
||||
{
|
||||
emit logUndoDrawFailed(player);
|
||||
}
|
||||
|
||||
void PlayerEventHandler::processGameEvent(GameEvent::GameEventType type,
|
||||
const GameEvent &event,
|
||||
const GameEventContext &context,
|
||||
|
|
@ -644,6 +650,9 @@ void PlayerEventHandler::processGameEvent(GameEvent::GameEventType type,
|
|||
case GameEvent::CHANGE_ZONE_PROPERTIES:
|
||||
eventChangeZoneProperties(event.GetExtension(Event_ChangeZoneProperties::ext));
|
||||
break;
|
||||
case GameEvent::UNDO_DRAW_FAILED:
|
||||
eventUndoDrawFailed(event.GetExtension(Event_UndoDrawFailed::ext));
|
||||
break;
|
||||
default: {
|
||||
qWarning() << "unhandled game event" << type;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ class Event_SetCardAttr;
|
|||
class Event_SetCardCounter;
|
||||
class Event_SetCounter;
|
||||
class Event_Shuffle;
|
||||
class Event_UndoDrawFailed;
|
||||
|
||||
class PlayerEventHandler : public QObject
|
||||
{
|
||||
|
||||
|
|
@ -52,6 +54,7 @@ signals:
|
|||
void logCreateToken(PlayerLogic *player, QString cardName, QString pt, bool faceDown);
|
||||
void logDrawCards(PlayerLogic *player, int number, bool deckIsEmpty);
|
||||
void logUndoDraw(PlayerLogic *player, QString cardName);
|
||||
void logUndoDrawFailed(PlayerLogic *player);
|
||||
void logMoveCard(PlayerLogic *player,
|
||||
CardItem *card,
|
||||
CardZoneLogic *startZone,
|
||||
|
|
@ -108,6 +111,7 @@ public:
|
|||
void eventDrawCards(const Event_DrawCards &event);
|
||||
void eventRevealCards(const Event_RevealCards &event, EventProcessingOptions options);
|
||||
void eventChangeZoneProperties(const Event_ChangeZoneProperties &event);
|
||||
void eventUndoDrawFailed(const Event_UndoDrawFailed &event);
|
||||
|
||||
private:
|
||||
PlayerLogic *player;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue