added files
This commit is contained in:
parent
b0841dd6e8
commit
ad47988d91
2 changed files with 701 additions and 0 deletions
340
common/protocol_commands.cpp
Normal file
340
common/protocol_commands.cpp
Normal file
|
@ -0,0 +1,340 @@
|
|||
#include "protocol.h"
|
||||
#include "protocol_commands.h"
|
||||
|
||||
Command_Ping::Command_Ping()
|
||||
: Command("ping")
|
||||
{
|
||||
}
|
||||
Command_Login::Command_Login(const QString &_username, const QString &_password)
|
||||
: Command("login"), username(_username), password(_password)
|
||||
{
|
||||
setParameter("username", username);
|
||||
setParameter("password", password);
|
||||
}
|
||||
void Command_Login::extractParameters()
|
||||
{
|
||||
Command::extractParameters();
|
||||
username = parameters["username"];
|
||||
password = parameters["password"];
|
||||
}
|
||||
Command_ChatListChannels::Command_ChatListChannels()
|
||||
: Command("chat_list_channels")
|
||||
{
|
||||
}
|
||||
Command_ChatJoinChannel::Command_ChatJoinChannel(const QString &_channel)
|
||||
: Command("chat_join_channel"), channel(_channel)
|
||||
{
|
||||
setParameter("channel", channel);
|
||||
}
|
||||
void Command_ChatJoinChannel::extractParameters()
|
||||
{
|
||||
Command::extractParameters();
|
||||
channel = parameters["channel"];
|
||||
}
|
||||
Command_ChatLeaveChannel::Command_ChatLeaveChannel(const QString &_channel)
|
||||
: ChatCommand("chat_leave_channel", _channel)
|
||||
{
|
||||
}
|
||||
Command_ChatSay::Command_ChatSay(const QString &_channel, const QString &_message)
|
||||
: ChatCommand("chat_say", _channel), message(_message)
|
||||
{
|
||||
setParameter("message", message);
|
||||
}
|
||||
void Command_ChatSay::extractParameters()
|
||||
{
|
||||
ChatCommand::extractParameters();
|
||||
message = parameters["message"];
|
||||
}
|
||||
Command_ListGames::Command_ListGames()
|
||||
: Command("list_games")
|
||||
{
|
||||
}
|
||||
Command_CreateGame::Command_CreateGame(const QString &_description, const QString &_password, int _maxPlayers, bool _spectatorsAllowed)
|
||||
: Command("create_game"), description(_description), password(_password), maxPlayers(_maxPlayers), spectatorsAllowed(_spectatorsAllowed)
|
||||
{
|
||||
setParameter("description", description);
|
||||
setParameter("password", password);
|
||||
setParameter("max_players", maxPlayers);
|
||||
setParameter("spectators_allowed", spectatorsAllowed);
|
||||
}
|
||||
void Command_CreateGame::extractParameters()
|
||||
{
|
||||
Command::extractParameters();
|
||||
description = parameters["description"];
|
||||
password = parameters["password"];
|
||||
maxPlayers = parameters["max_players"].toInt();
|
||||
spectatorsAllowed = (parameters["spectators_allowed"] == "1");
|
||||
}
|
||||
Command_JoinGame::Command_JoinGame(int _gameId, const QString &_password, bool _spectator)
|
||||
: Command("join_game"), gameId(_gameId), password(_password), spectator(_spectator)
|
||||
{
|
||||
setParameter("game_id", gameId);
|
||||
setParameter("password", password);
|
||||
setParameter("spectator", spectator);
|
||||
}
|
||||
void Command_JoinGame::extractParameters()
|
||||
{
|
||||
Command::extractParameters();
|
||||
gameId = parameters["game_id"].toInt();
|
||||
password = parameters["password"];
|
||||
spectator = (parameters["spectator"] == "1");
|
||||
}
|
||||
Command_LeaveGame::Command_LeaveGame(int _gameId)
|
||||
: GameCommand("leave_game", _gameId)
|
||||
{
|
||||
}
|
||||
Command_Say::Command_Say(int _gameId, const QString &_message)
|
||||
: GameCommand("say", _gameId), message(_message)
|
||||
{
|
||||
setParameter("message", message);
|
||||
}
|
||||
void Command_Say::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
message = parameters["message"];
|
||||
}
|
||||
Command_Shuffle::Command_Shuffle(int _gameId)
|
||||
: GameCommand("shuffle", _gameId)
|
||||
{
|
||||
}
|
||||
Command_RollDie::Command_RollDie(int _gameId, int _sides)
|
||||
: GameCommand("roll_die", _gameId), sides(_sides)
|
||||
{
|
||||
setParameter("sides", sides);
|
||||
}
|
||||
void Command_RollDie::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
sides = parameters["sides"].toInt();
|
||||
}
|
||||
Command_DrawCards::Command_DrawCards(int _gameId, int _number)
|
||||
: GameCommand("draw_cards", _gameId), number(_number)
|
||||
{
|
||||
setParameter("number", number);
|
||||
}
|
||||
void Command_DrawCards::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
number = parameters["number"].toInt();
|
||||
}
|
||||
Command_MoveCard::Command_MoveCard(int _gameId, const QString &_startZone, int _cardId, const QString &_targetZone, int _x, int _y, bool _faceDown)
|
||||
: GameCommand("move_card", _gameId), startZone(_startZone), cardId(_cardId), targetZone(_targetZone), x(_x), y(_y), faceDown(_faceDown)
|
||||
{
|
||||
setParameter("start_zone", startZone);
|
||||
setParameter("card_id", cardId);
|
||||
setParameter("target_zone", targetZone);
|
||||
setParameter("x", x);
|
||||
setParameter("y", y);
|
||||
setParameter("faceDown", faceDown);
|
||||
}
|
||||
void Command_MoveCard::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
startZone = parameters["start_zone"];
|
||||
cardId = parameters["card_id"].toInt();
|
||||
targetZone = parameters["target_zone"];
|
||||
x = parameters["x"].toInt();
|
||||
y = parameters["y"].toInt();
|
||||
faceDown = (parameters["faceDown"] == "1");
|
||||
}
|
||||
Command_CreateToken::Command_CreateToken(int _gameId, const QString &_zone, const QString &_name, const QString &_pt, int _x, int _y)
|
||||
: GameCommand("create_token", _gameId), zone(_zone), name(_name), pt(_pt), x(_x), y(_y)
|
||||
{
|
||||
setParameter("zone", zone);
|
||||
setParameter("name", name);
|
||||
setParameter("pt", pt);
|
||||
setParameter("x", x);
|
||||
setParameter("y", y);
|
||||
}
|
||||
void Command_CreateToken::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
zone = parameters["zone"];
|
||||
name = parameters["name"];
|
||||
pt = parameters["pt"];
|
||||
x = parameters["x"].toInt();
|
||||
y = parameters["y"].toInt();
|
||||
}
|
||||
Command_CreateArrow::Command_CreateArrow(int _gameId, int _startPlayerId, const QString &_startZone, int _startCardId, int _targetPlayerId, const QString &_targetPlayerZone, int _targetCardId, int _color)
|
||||
: GameCommand("create_arrow", _gameId), startPlayerId(_startPlayerId), startZone(_startZone), startCardId(_startCardId), targetPlayerId(_targetPlayerId), targetPlayerZone(_targetPlayerZone), targetCardId(_targetCardId), color(_color)
|
||||
{
|
||||
setParameter("start_player_id", startPlayerId);
|
||||
setParameter("start_zone", startZone);
|
||||
setParameter("start_card_id", startCardId);
|
||||
setParameter("target_player_id", targetPlayerId);
|
||||
setParameter("target_player_zone", targetPlayerZone);
|
||||
setParameter("target_card_id", targetCardId);
|
||||
setParameter("color", color);
|
||||
}
|
||||
void Command_CreateArrow::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
startPlayerId = parameters["start_player_id"].toInt();
|
||||
startZone = parameters["start_zone"];
|
||||
startCardId = parameters["start_card_id"].toInt();
|
||||
targetPlayerId = parameters["target_player_id"].toInt();
|
||||
targetPlayerZone = parameters["target_player_zone"];
|
||||
targetCardId = parameters["target_card_id"].toInt();
|
||||
color = parameters["color"].toInt();
|
||||
}
|
||||
Command_DeleteArrow::Command_DeleteArrow(int _gameId, int _arrowId)
|
||||
: GameCommand("delete_arrow", _gameId), arrowId(_arrowId)
|
||||
{
|
||||
setParameter("arrow_id", arrowId);
|
||||
}
|
||||
void Command_DeleteArrow::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
arrowId = parameters["arrow_id"].toInt();
|
||||
}
|
||||
Command_SetCardAttr::Command_SetCardAttr(int _gameId, const QString &_zone, int _cardId, const QString &_attrName, const QString &_attrValue)
|
||||
: GameCommand("set_card_attr", _gameId), zone(_zone), cardId(_cardId), attrName(_attrName), attrValue(_attrValue)
|
||||
{
|
||||
setParameter("zone", zone);
|
||||
setParameter("card_id", cardId);
|
||||
setParameter("attr_name", attrName);
|
||||
setParameter("attr_value", attrValue);
|
||||
}
|
||||
void Command_SetCardAttr::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
zone = parameters["zone"];
|
||||
cardId = parameters["card_id"].toInt();
|
||||
attrName = parameters["attr_name"];
|
||||
attrValue = parameters["attr_value"];
|
||||
}
|
||||
Command_ReadyStart::Command_ReadyStart(int _gameId)
|
||||
: GameCommand("ready_start", _gameId)
|
||||
{
|
||||
}
|
||||
Command_IncCounter::Command_IncCounter(int _gameId, int _counterId, int _delta)
|
||||
: GameCommand("inc_counter", _gameId), counterId(_counterId), delta(_delta)
|
||||
{
|
||||
setParameter("counter_id", counterId);
|
||||
setParameter("delta", delta);
|
||||
}
|
||||
void Command_IncCounter::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
counterId = parameters["counter_id"].toInt();
|
||||
delta = parameters["delta"].toInt();
|
||||
}
|
||||
Command_AddCounter::Command_AddCounter(int _gameId, const QString &_counterName, int _color, int _radius, int _value)
|
||||
: GameCommand("add_counter", _gameId), counterName(_counterName), color(_color), radius(_radius), value(_value)
|
||||
{
|
||||
setParameter("counter_name", counterName);
|
||||
setParameter("color", color);
|
||||
setParameter("radius", radius);
|
||||
setParameter("value", value);
|
||||
}
|
||||
void Command_AddCounter::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
counterName = parameters["counter_name"];
|
||||
color = parameters["color"].toInt();
|
||||
radius = parameters["radius"].toInt();
|
||||
value = parameters["value"].toInt();
|
||||
}
|
||||
Command_SetCounter::Command_SetCounter(int _gameId, int _counterId, int _value)
|
||||
: GameCommand("set_counter", _gameId), counterId(_counterId), value(_value)
|
||||
{
|
||||
setParameter("counter_id", counterId);
|
||||
setParameter("value", value);
|
||||
}
|
||||
void Command_SetCounter::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
counterId = parameters["counter_id"].toInt();
|
||||
value = parameters["value"].toInt();
|
||||
}
|
||||
Command_DelCounter::Command_DelCounter(int _gameId, int _counterId)
|
||||
: GameCommand("del_counter", _gameId), counterId(_counterId)
|
||||
{
|
||||
setParameter("counter_id", counterId);
|
||||
}
|
||||
void Command_DelCounter::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
counterId = parameters["counter_id"].toInt();
|
||||
}
|
||||
Command_NextTurn::Command_NextTurn(int _gameId)
|
||||
: GameCommand("next_turn", _gameId)
|
||||
{
|
||||
}
|
||||
Command_SetActivePhase::Command_SetActivePhase(int _gameId, int _phase)
|
||||
: GameCommand("set_active_phase", _gameId), phase(_phase)
|
||||
{
|
||||
setParameter("phase", phase);
|
||||
}
|
||||
void Command_SetActivePhase::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
phase = parameters["phase"].toInt();
|
||||
}
|
||||
Command_DumpZone::Command_DumpZone(int _gameId, int _playerId, const QString &_zoneName, int _numberCards)
|
||||
: GameCommand("dump_zone", _gameId), playerId(_playerId), zoneName(_zoneName), numberCards(_numberCards)
|
||||
{
|
||||
setParameter("player_id", playerId);
|
||||
setParameter("zone_name", zoneName);
|
||||
setParameter("number_cards", numberCards);
|
||||
}
|
||||
void Command_DumpZone::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
playerId = parameters["player_id"].toInt();
|
||||
zoneName = parameters["zone_name"];
|
||||
numberCards = parameters["number_cards"].toInt();
|
||||
}
|
||||
Command_StopDumpZone::Command_StopDumpZone(int _gameId, int _playerId, const QString &_zoneName)
|
||||
: GameCommand("stop_dump_zone", _gameId), playerId(_playerId), zoneName(_zoneName)
|
||||
{
|
||||
setParameter("player_id", playerId);
|
||||
setParameter("zone_name", zoneName);
|
||||
}
|
||||
void Command_StopDumpZone::extractParameters()
|
||||
{
|
||||
GameCommand::extractParameters();
|
||||
playerId = parameters["player_id"].toInt();
|
||||
zoneName = parameters["zone_name"];
|
||||
}
|
||||
Command_DumpAll::Command_DumpAll(int _gameId)
|
||||
: GameCommand("dump_all", _gameId)
|
||||
{
|
||||
}
|
||||
Command_SubmitDeck::Command_SubmitDeck(int _gameId)
|
||||
: GameCommand("submit_deck", _gameId)
|
||||
{
|
||||
}
|
||||
void Command::initializeHash()
|
||||
{
|
||||
commandHash.insert("ping", Command_Ping::newCommand);
|
||||
commandHash.insert("login", Command_Login::newCommand);
|
||||
commandHash.insert("chat_list_channels", Command_ChatListChannels::newCommand);
|
||||
commandHash.insert("chat_join_channel", Command_ChatJoinChannel::newCommand);
|
||||
commandHash.insert("chat_leave_channel", Command_ChatLeaveChannel::newCommand);
|
||||
commandHash.insert("chat_say", Command_ChatSay::newCommand);
|
||||
commandHash.insert("list_games", Command_ListGames::newCommand);
|
||||
commandHash.insert("create_game", Command_CreateGame::newCommand);
|
||||
commandHash.insert("join_game", Command_JoinGame::newCommand);
|
||||
commandHash.insert("leave_game", Command_LeaveGame::newCommand);
|
||||
commandHash.insert("say", Command_Say::newCommand);
|
||||
commandHash.insert("shuffle", Command_Shuffle::newCommand);
|
||||
commandHash.insert("roll_die", Command_RollDie::newCommand);
|
||||
commandHash.insert("draw_cards", Command_DrawCards::newCommand);
|
||||
commandHash.insert("move_card", Command_MoveCard::newCommand);
|
||||
commandHash.insert("create_token", Command_CreateToken::newCommand);
|
||||
commandHash.insert("create_arrow", Command_CreateArrow::newCommand);
|
||||
commandHash.insert("delete_arrow", Command_DeleteArrow::newCommand);
|
||||
commandHash.insert("set_card_attr", Command_SetCardAttr::newCommand);
|
||||
commandHash.insert("ready_start", Command_ReadyStart::newCommand);
|
||||
commandHash.insert("inc_counter", Command_IncCounter::newCommand);
|
||||
commandHash.insert("add_counter", Command_AddCounter::newCommand);
|
||||
commandHash.insert("set_counter", Command_SetCounter::newCommand);
|
||||
commandHash.insert("del_counter", Command_DelCounter::newCommand);
|
||||
commandHash.insert("next_turn", Command_NextTurn::newCommand);
|
||||
commandHash.insert("set_active_phase", Command_SetActivePhase::newCommand);
|
||||
commandHash.insert("dump_zone", Command_DumpZone::newCommand);
|
||||
commandHash.insert("stop_dump_zone", Command_StopDumpZone::newCommand);
|
||||
commandHash.insert("dump_all", Command_DumpAll::newCommand);
|
||||
commandHash.insert("submit_deck", Command_SubmitDeck::newCommand);
|
||||
}
|
361
common/protocol_commands.h
Normal file
361
common/protocol_commands.h
Normal file
|
@ -0,0 +1,361 @@
|
|||
#ifndef PROTOCOL_COMMANDS_H
|
||||
#define PROTOCOL_COMMANDS_H
|
||||
|
||||
#include "protocol.h"
|
||||
|
||||
class Command_Ping : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_Ping();
|
||||
static Command *newCommand() { return new Command_Ping; }
|
||||
};
|
||||
class Command_Login : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString username;
|
||||
QString password;
|
||||
public:
|
||||
Command_Login(const QString &_username = QString(), const QString &_password = QString());
|
||||
QString getUsername() const { return username; }
|
||||
QString getPassword() const { return password; }
|
||||
static Command *newCommand() { return new Command_Login; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_ChatListChannels : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_ChatListChannels();
|
||||
static Command *newCommand() { return new Command_ChatListChannels; }
|
||||
};
|
||||
class Command_ChatJoinChannel : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString channel;
|
||||
public:
|
||||
Command_ChatJoinChannel(const QString &_channel = QString());
|
||||
QString getChannel() const { return channel; }
|
||||
static Command *newCommand() { return new Command_ChatJoinChannel; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_ChatLeaveChannel : public ChatCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_ChatLeaveChannel(const QString &_channel = QString());
|
||||
static Command *newCommand() { return new Command_ChatLeaveChannel; }
|
||||
};
|
||||
class Command_ChatSay : public ChatCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString message;
|
||||
public:
|
||||
Command_ChatSay(const QString &_channel = QString(), const QString &_message = QString());
|
||||
QString getMessage() const { return message; }
|
||||
static Command *newCommand() { return new Command_ChatSay; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_ListGames : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_ListGames();
|
||||
static Command *newCommand() { return new Command_ListGames; }
|
||||
};
|
||||
class Command_CreateGame : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString description;
|
||||
QString password;
|
||||
int maxPlayers;
|
||||
bool spectatorsAllowed;
|
||||
public:
|
||||
Command_CreateGame(const QString &_description = QString(), const QString &_password = QString(), int _maxPlayers = -1, bool _spectatorsAllowed = false);
|
||||
QString getDescription() const { return description; }
|
||||
QString getPassword() const { return password; }
|
||||
int getMaxPlayers() const { return maxPlayers; }
|
||||
bool getSpectatorsAllowed() const { return spectatorsAllowed; }
|
||||
static Command *newCommand() { return new Command_CreateGame; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_JoinGame : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int gameId;
|
||||
QString password;
|
||||
bool spectator;
|
||||
public:
|
||||
Command_JoinGame(int _gameId = -1, const QString &_password = QString(), bool _spectator = false);
|
||||
int getGameId() const { return gameId; }
|
||||
QString getPassword() const { return password; }
|
||||
bool getSpectator() const { return spectator; }
|
||||
static Command *newCommand() { return new Command_JoinGame; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_LeaveGame : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_LeaveGame(int _gameId = -1);
|
||||
static Command *newCommand() { return new Command_LeaveGame; }
|
||||
};
|
||||
class Command_Say : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString message;
|
||||
public:
|
||||
Command_Say(int _gameId = -1, const QString &_message = QString());
|
||||
QString getMessage() const { return message; }
|
||||
static Command *newCommand() { return new Command_Say; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_Shuffle : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_Shuffle(int _gameId = -1);
|
||||
static Command *newCommand() { return new Command_Shuffle; }
|
||||
};
|
||||
class Command_RollDie : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int sides;
|
||||
public:
|
||||
Command_RollDie(int _gameId = -1, int _sides = -1);
|
||||
int getSides() const { return sides; }
|
||||
static Command *newCommand() { return new Command_RollDie; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_DrawCards : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int number;
|
||||
public:
|
||||
Command_DrawCards(int _gameId = -1, int _number = -1);
|
||||
int getNumber() const { return number; }
|
||||
static Command *newCommand() { return new Command_DrawCards; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_MoveCard : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString startZone;
|
||||
int cardId;
|
||||
QString targetZone;
|
||||
int x;
|
||||
int y;
|
||||
bool faceDown;
|
||||
public:
|
||||
Command_MoveCard(int _gameId = -1, const QString &_startZone = QString(), int _cardId = -1, const QString &_targetZone = QString(), int _x = -1, int _y = -1, bool _faceDown = false);
|
||||
QString getStartZone() const { return startZone; }
|
||||
int getCardId() const { return cardId; }
|
||||
QString getTargetZone() const { return targetZone; }
|
||||
int getX() const { return x; }
|
||||
int getY() const { return y; }
|
||||
bool getFaceDown() const { return faceDown; }
|
||||
static Command *newCommand() { return new Command_MoveCard; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_CreateToken : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString zone;
|
||||
QString name;
|
||||
QString pt;
|
||||
int x;
|
||||
int y;
|
||||
public:
|
||||
Command_CreateToken(int _gameId = -1, const QString &_zone = QString(), const QString &_name = QString(), const QString &_pt = QString(), int _x = -1, int _y = -1);
|
||||
QString getZone() const { return zone; }
|
||||
QString getName() const { return name; }
|
||||
QString getPt() const { return pt; }
|
||||
int getX() const { return x; }
|
||||
int getY() const { return y; }
|
||||
static Command *newCommand() { return new Command_CreateToken; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_CreateArrow : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int startPlayerId;
|
||||
QString startZone;
|
||||
int startCardId;
|
||||
int targetPlayerId;
|
||||
QString targetPlayerZone;
|
||||
int targetCardId;
|
||||
int color;
|
||||
public:
|
||||
Command_CreateArrow(int _gameId = -1, int _startPlayerId = -1, const QString &_startZone = QString(), int _startCardId = -1, int _targetPlayerId = -1, const QString &_targetPlayerZone = QString(), int _targetCardId = -1, int _color = -1);
|
||||
int getStartPlayerId() const { return startPlayerId; }
|
||||
QString getStartZone() const { return startZone; }
|
||||
int getStartCardId() const { return startCardId; }
|
||||
int getTargetPlayerId() const { return targetPlayerId; }
|
||||
QString getTargetPlayerZone() const { return targetPlayerZone; }
|
||||
int getTargetCardId() const { return targetCardId; }
|
||||
int getColor() const { return color; }
|
||||
static Command *newCommand() { return new Command_CreateArrow; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_DeleteArrow : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int arrowId;
|
||||
public:
|
||||
Command_DeleteArrow(int _gameId = -1, int _arrowId = -1);
|
||||
int getArrowId() const { return arrowId; }
|
||||
static Command *newCommand() { return new Command_DeleteArrow; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_SetCardAttr : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString zone;
|
||||
int cardId;
|
||||
QString attrName;
|
||||
QString attrValue;
|
||||
public:
|
||||
Command_SetCardAttr(int _gameId = -1, const QString &_zone = QString(), int _cardId = -1, const QString &_attrName = QString(), const QString &_attrValue = QString());
|
||||
QString getZone() const { return zone; }
|
||||
int getCardId() const { return cardId; }
|
||||
QString getAttrName() const { return attrName; }
|
||||
QString getAttrValue() const { return attrValue; }
|
||||
static Command *newCommand() { return new Command_SetCardAttr; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_ReadyStart : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_ReadyStart(int _gameId = -1);
|
||||
static Command *newCommand() { return new Command_ReadyStart; }
|
||||
};
|
||||
class Command_IncCounter : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int counterId;
|
||||
int delta;
|
||||
public:
|
||||
Command_IncCounter(int _gameId = -1, int _counterId = -1, int _delta = -1);
|
||||
int getCounterId() const { return counterId; }
|
||||
int getDelta() const { return delta; }
|
||||
static Command *newCommand() { return new Command_IncCounter; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_AddCounter : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString counterName;
|
||||
int color;
|
||||
int radius;
|
||||
int value;
|
||||
public:
|
||||
Command_AddCounter(int _gameId = -1, const QString &_counterName = QString(), int _color = -1, int _radius = -1, int _value = -1);
|
||||
QString getCounterName() const { return counterName; }
|
||||
int getColor() const { return color; }
|
||||
int getRadius() const { return radius; }
|
||||
int getValue() const { return value; }
|
||||
static Command *newCommand() { return new Command_AddCounter; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_SetCounter : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int counterId;
|
||||
int value;
|
||||
public:
|
||||
Command_SetCounter(int _gameId = -1, int _counterId = -1, int _value = -1);
|
||||
int getCounterId() const { return counterId; }
|
||||
int getValue() const { return value; }
|
||||
static Command *newCommand() { return new Command_SetCounter; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_DelCounter : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int counterId;
|
||||
public:
|
||||
Command_DelCounter(int _gameId = -1, int _counterId = -1);
|
||||
int getCounterId() const { return counterId; }
|
||||
static Command *newCommand() { return new Command_DelCounter; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_NextTurn : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_NextTurn(int _gameId = -1);
|
||||
static Command *newCommand() { return new Command_NextTurn; }
|
||||
};
|
||||
class Command_SetActivePhase : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int phase;
|
||||
public:
|
||||
Command_SetActivePhase(int _gameId = -1, int _phase = -1);
|
||||
int getPhase() const { return phase; }
|
||||
static Command *newCommand() { return new Command_SetActivePhase; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_DumpZone : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int playerId;
|
||||
QString zoneName;
|
||||
int numberCards;
|
||||
public:
|
||||
Command_DumpZone(int _gameId = -1, int _playerId = -1, const QString &_zoneName = QString(), int _numberCards = -1);
|
||||
int getPlayerId() const { return playerId; }
|
||||
QString getZoneName() const { return zoneName; }
|
||||
int getNumberCards() const { return numberCards; }
|
||||
static Command *newCommand() { return new Command_DumpZone; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_StopDumpZone : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int playerId;
|
||||
QString zoneName;
|
||||
public:
|
||||
Command_StopDumpZone(int _gameId = -1, int _playerId = -1, const QString &_zoneName = QString());
|
||||
int getPlayerId() const { return playerId; }
|
||||
QString getZoneName() const { return zoneName; }
|
||||
static Command *newCommand() { return new Command_StopDumpZone; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_DumpAll : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_DumpAll(int _gameId = -1);
|
||||
static Command *newCommand() { return new Command_DumpAll; }
|
||||
};
|
||||
class Command_SubmitDeck : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_SubmitDeck(int _gameId = -1);
|
||||
static Command *newCommand() { return new Command_SubmitDeck; }
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue