mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-22 07:10:25 -08:00
Added whitelist for game commands
This commit is contained in:
@@ -184,6 +184,18 @@ Response::ResponseCode Server_ProtocolHandler::processRoomCommandContainer(const
|
||||
|
||||
Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const CommandContainer &cont, ResponseContainer &rc)
|
||||
{
|
||||
static QList<GameCommand::GameCommandType> antifloodCommandsWhiteList = QList<GameCommand::GameCommandType>()
|
||||
// draw, undraw cards (eg: drawing 10 cards one by one from the deck)
|
||||
<< GameCommand::DRAW_CARDS
|
||||
<< GameCommand::UNDO_DRAW
|
||||
// create, delete arrows (eg: targeting with 10 cards during an attack)
|
||||
<< GameCommand::CREATE_ARROW
|
||||
<< GameCommand::DELETE_ARROW
|
||||
// set card attributes (eg: tapping 10 cards at once)
|
||||
<< GameCommand::SET_CARD_ATTR
|
||||
// increment / decrement counter (eg: -10 lifepoints one by one)
|
||||
<< GameCommand::INC_COUNTER;
|
||||
|
||||
if (authState == NotLoggedIn)
|
||||
return Response::RespLoginNeeded;
|
||||
|
||||
@@ -229,7 +241,10 @@ Response::ResponseCode Server_ProtocolHandler::processGameCommandContainer(const
|
||||
int totalCount = 0;
|
||||
if (commandCountOverTime.isEmpty())
|
||||
commandCountOverTime.prepend(0);
|
||||
|
||||
if(!antifloodCommandsWhiteList.contains((GameCommand::GameCommandType) getPbExtension(sc)))
|
||||
++commandCountOverTime[0];
|
||||
|
||||
for (int i = 0; i < commandCountOverTime.size(); ++i)
|
||||
totalCount += commandCountOverTime[i];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user