re-added files
This commit is contained in:
parent
1d6923f2a2
commit
e1fc3ddb88
3 changed files with 1296 additions and 0 deletions
607
common/protocol_items.cpp
Normal file
607
common/protocol_items.cpp
Normal file
|
@ -0,0 +1,607 @@
|
|||
#include "protocol.h"
|
||||
#include "protocol_items.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("face_down", 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["face_down"] == "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)
|
||||
{
|
||||
}
|
||||
Event_Say::Event_Say(int _gameId, bool _isPublic, int _playerId, const QString &_message)
|
||||
: GameEvent("say", _gameId, _isPublic, _playerId), message(_message)
|
||||
{
|
||||
setParameter("message", message);
|
||||
}
|
||||
void Event_Say::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
message = parameters["message"];
|
||||
}
|
||||
Event_Join::Event_Join(int _gameId, bool _isPublic, int _playerId, const QString &_playerName, bool _spectator)
|
||||
: GameEvent("join", _gameId, _isPublic, _playerId), playerName(_playerName), spectator(_spectator)
|
||||
{
|
||||
setParameter("player_name", playerName);
|
||||
setParameter("spectator", spectator);
|
||||
}
|
||||
void Event_Join::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
playerName = parameters["player_name"];
|
||||
spectator = (parameters["spectator"] == "1");
|
||||
}
|
||||
Event_Leave::Event_Leave(int _gameId, bool _isPublic, int _playerId)
|
||||
: GameEvent("leave", _gameId, _isPublic, _playerId)
|
||||
{
|
||||
}
|
||||
Event_GameClosed::Event_GameClosed(int _gameId, bool _isPublic, int _playerId)
|
||||
: GameEvent("game_closed", _gameId, _isPublic, _playerId)
|
||||
{
|
||||
}
|
||||
Event_ReadyStart::Event_ReadyStart(int _gameId, bool _isPublic, int _playerId)
|
||||
: GameEvent("ready_start", _gameId, _isPublic, _playerId)
|
||||
{
|
||||
}
|
||||
Event_SetupZones::Event_SetupZones(int _gameId, bool _isPublic, int _playerId, int _deckSize, int _sbSize)
|
||||
: GameEvent("setup_zones", _gameId, _isPublic, _playerId), deckSize(_deckSize), sbSize(_sbSize)
|
||||
{
|
||||
setParameter("deck_size", deckSize);
|
||||
setParameter("sb_size", sbSize);
|
||||
}
|
||||
void Event_SetupZones::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
deckSize = parameters["deck_size"].toInt();
|
||||
sbSize = parameters["sb_size"].toInt();
|
||||
}
|
||||
Event_GameStart::Event_GameStart(int _gameId, bool _isPublic, int _playerId)
|
||||
: GameEvent("game_start", _gameId, _isPublic, _playerId)
|
||||
{
|
||||
}
|
||||
Event_Shuffle::Event_Shuffle(int _gameId, bool _isPublic, int _playerId)
|
||||
: GameEvent("shuffle", _gameId, _isPublic, _playerId)
|
||||
{
|
||||
}
|
||||
Event_RollDie::Event_RollDie(int _gameId, bool _isPublic, int _playerId, int _sides, int _value)
|
||||
: GameEvent("roll_die", _gameId, _isPublic, _playerId), sides(_sides), value(_value)
|
||||
{
|
||||
setParameter("sides", sides);
|
||||
setParameter("value", value);
|
||||
}
|
||||
void Event_RollDie::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
sides = parameters["sides"].toInt();
|
||||
value = parameters["value"].toInt();
|
||||
}
|
||||
Event_MoveCard::Event_MoveCard(int _gameId, bool _isPublic, int _playerId, int _cardId, const QString &_cardName, const QString &_startZone, int _position, const QString &_targetZone, int _x, int _y, bool _faceDown)
|
||||
: GameEvent("move_card", _gameId, _isPublic, _playerId), cardId(_cardId), cardName(_cardName), startZone(_startZone), position(_position), targetZone(_targetZone), x(_x), y(_y), faceDown(_faceDown)
|
||||
{
|
||||
setParameter("card_id", cardId);
|
||||
setParameter("card_name", cardName);
|
||||
setParameter("start_zone", startZone);
|
||||
setParameter("position", position);
|
||||
setParameter("target_zone", targetZone);
|
||||
setParameter("x", x);
|
||||
setParameter("y", y);
|
||||
setParameter("face_down", faceDown);
|
||||
}
|
||||
void Event_MoveCard::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
cardId = parameters["card_id"].toInt();
|
||||
cardName = parameters["card_name"];
|
||||
startZone = parameters["start_zone"];
|
||||
position = parameters["position"].toInt();
|
||||
targetZone = parameters["target_zone"];
|
||||
x = parameters["x"].toInt();
|
||||
y = parameters["y"].toInt();
|
||||
faceDown = (parameters["face_down"] == "1");
|
||||
}
|
||||
Event_CreateToken::Event_CreateToken(int _gameId, bool _isPublic, int _playerId, const QString &_zone, int _cardId, const QString &_cardName, const QString &_pt, int _x, int _y)
|
||||
: GameEvent("create_token", _gameId, _isPublic, _playerId), zone(_zone), cardId(_cardId), cardName(_cardName), pt(_pt), x(_x), y(_y)
|
||||
{
|
||||
setParameter("zone", zone);
|
||||
setParameter("card_id", cardId);
|
||||
setParameter("card_name", cardName);
|
||||
setParameter("pt", pt);
|
||||
setParameter("x", x);
|
||||
setParameter("y", y);
|
||||
}
|
||||
void Event_CreateToken::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
zone = parameters["zone"];
|
||||
cardId = parameters["card_id"].toInt();
|
||||
cardName = parameters["card_name"];
|
||||
pt = parameters["pt"];
|
||||
x = parameters["x"].toInt();
|
||||
y = parameters["y"].toInt();
|
||||
}
|
||||
Event_CreateArrow::Event_CreateArrow(int _gameId, bool _isPublic, int _playerId, int _arrowId, int _startPlayerId, const QString &_startZone, int _startCardId, int _targetPlayerId, const QString &_targetZone, int _targetCardId, int _color)
|
||||
: GameEvent("create_arrow", _gameId, _isPublic, _playerId), arrowId(_arrowId), startPlayerId(_startPlayerId), startZone(_startZone), startCardId(_startCardId), targetPlayerId(_targetPlayerId), targetZone(_targetZone), targetCardId(_targetCardId), color(_color)
|
||||
{
|
||||
setParameter("arrow_id", arrowId);
|
||||
setParameter("start_player_id", startPlayerId);
|
||||
setParameter("start_zone", startZone);
|
||||
setParameter("start_card_id", startCardId);
|
||||
setParameter("target_player_id", targetPlayerId);
|
||||
setParameter("target_zone", targetZone);
|
||||
setParameter("target_card_id", targetCardId);
|
||||
setParameter("color", color);
|
||||
}
|
||||
void Event_CreateArrow::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
arrowId = parameters["arrow_id"].toInt();
|
||||
startPlayerId = parameters["start_player_id"].toInt();
|
||||
startZone = parameters["start_zone"];
|
||||
startCardId = parameters["start_card_id"].toInt();
|
||||
targetPlayerId = parameters["target_player_id"].toInt();
|
||||
targetZone = parameters["target_zone"];
|
||||
targetCardId = parameters["target_card_id"].toInt();
|
||||
color = parameters["color"].toInt();
|
||||
}
|
||||
Event_DeleteArrow::Event_DeleteArrow(int _gameId, bool _isPublic, int _playerId, int _arrowId)
|
||||
: GameEvent("delete_arrow", _gameId, _isPublic, _playerId), arrowId(_arrowId)
|
||||
{
|
||||
setParameter("arrow_id", arrowId);
|
||||
}
|
||||
void Event_DeleteArrow::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
arrowId = parameters["arrow_id"].toInt();
|
||||
}
|
||||
Event_SetCardAttr::Event_SetCardAttr(int _gameId, bool _isPublic, int _playerId, const QString &_zone, int _cardId, const QString &_attrName, const QString &_attrValue)
|
||||
: GameEvent("set_card_attr", _gameId, _isPublic, _playerId), zone(_zone), cardId(_cardId), attrName(_attrName), attrValue(_attrValue)
|
||||
{
|
||||
setParameter("zone", zone);
|
||||
setParameter("card_id", cardId);
|
||||
setParameter("attr_name", attrName);
|
||||
setParameter("attr_value", attrValue);
|
||||
}
|
||||
void Event_SetCardAttr::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
zone = parameters["zone"];
|
||||
cardId = parameters["card_id"].toInt();
|
||||
attrName = parameters["attr_name"];
|
||||
attrValue = parameters["attr_value"];
|
||||
}
|
||||
Event_AddCounter::Event_AddCounter(int _gameId, bool _isPublic, int _playerId, int _counterId, const QString &_counterName, int _color, int _radius, int _value)
|
||||
: GameEvent("add_counter", _gameId, _isPublic, _playerId), counterId(_counterId), counterName(_counterName), color(_color), radius(_radius), value(_value)
|
||||
{
|
||||
setParameter("counter_id", counterId);
|
||||
setParameter("counter_name", counterName);
|
||||
setParameter("color", color);
|
||||
setParameter("radius", radius);
|
||||
setParameter("value", value);
|
||||
}
|
||||
void Event_AddCounter::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
counterId = parameters["counter_id"].toInt();
|
||||
counterName = parameters["counter_name"];
|
||||
color = parameters["color"].toInt();
|
||||
radius = parameters["radius"].toInt();
|
||||
value = parameters["value"].toInt();
|
||||
}
|
||||
Event_SetCounter::Event_SetCounter(int _gameId, bool _isPublic, int _playerId, int _counterId, int _value)
|
||||
: GameEvent("set_counter", _gameId, _isPublic, _playerId), counterId(_counterId), value(_value)
|
||||
{
|
||||
setParameter("counter_id", counterId);
|
||||
setParameter("value", value);
|
||||
}
|
||||
void Event_SetCounter::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
counterId = parameters["counter_id"].toInt();
|
||||
value = parameters["value"].toInt();
|
||||
}
|
||||
Event_DelCounter::Event_DelCounter(int _gameId, bool _isPublic, int _playerId, int _counterId)
|
||||
: GameEvent("del_counter", _gameId, _isPublic, _playerId), counterId(_counterId)
|
||||
{
|
||||
setParameter("counter_id", counterId);
|
||||
}
|
||||
void Event_DelCounter::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
counterId = parameters["counter_id"].toInt();
|
||||
}
|
||||
Event_SetActivePlayer::Event_SetActivePlayer(int _gameId, bool _isPublic, int _playerId, int _activePlayerId)
|
||||
: GameEvent("set_active_player", _gameId, _isPublic, _playerId), activePlayerId(_activePlayerId)
|
||||
{
|
||||
setParameter("active_player_id", activePlayerId);
|
||||
}
|
||||
void Event_SetActivePlayer::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
activePlayerId = parameters["active_player_id"].toInt();
|
||||
}
|
||||
Event_SetActivePhase::Event_SetActivePhase(int _gameId, bool _isPublic, int _playerId, int _phase)
|
||||
: GameEvent("set_active_phase", _gameId, _isPublic, _playerId), phase(_phase)
|
||||
{
|
||||
setParameter("phase", phase);
|
||||
}
|
||||
void Event_SetActivePhase::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
phase = parameters["phase"].toInt();
|
||||
}
|
||||
Event_DumpZone::Event_DumpZone(int _gameId, bool _isPublic, int _playerId, int _zoneOwnerId, const QString &_zone, int _numberCards)
|
||||
: GameEvent("dump_zone", _gameId, _isPublic, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone), numberCards(_numberCards)
|
||||
{
|
||||
setParameter("zone_owner_id", zoneOwnerId);
|
||||
setParameter("zone", zone);
|
||||
setParameter("number_cards", numberCards);
|
||||
}
|
||||
void Event_DumpZone::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
zoneOwnerId = parameters["zone_owner_id"].toInt();
|
||||
zone = parameters["zone"];
|
||||
numberCards = parameters["number_cards"].toInt();
|
||||
}
|
||||
Event_StopDumpZone::Event_StopDumpZone(int _gameId, bool _isPublic, int _playerId, int _zoneOwnerId, const QString &_zone)
|
||||
: GameEvent("stop_dump_zone", _gameId, _isPublic, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone)
|
||||
{
|
||||
setParameter("zone_owner_id", zoneOwnerId);
|
||||
setParameter("zone", zone);
|
||||
}
|
||||
void Event_StopDumpZone::extractParameters()
|
||||
{
|
||||
GameEvent::extractParameters();
|
||||
zoneOwnerId = parameters["zone_owner_id"].toInt();
|
||||
zone = parameters["zone"];
|
||||
}
|
||||
void ProtocolItem::initializeHashAuto()
|
||||
{
|
||||
itemNameHash.insert("cmdping", Command_Ping::newItem);
|
||||
itemNameHash.insert("cmdlogin", Command_Login::newItem);
|
||||
itemNameHash.insert("cmdchat_list_channels", Command_ChatListChannels::newItem);
|
||||
itemNameHash.insert("cmdchat_join_channel", Command_ChatJoinChannel::newItem);
|
||||
itemNameHash.insert("cmdchat_leave_channel", Command_ChatLeaveChannel::newItem);
|
||||
itemNameHash.insert("cmdchat_say", Command_ChatSay::newItem);
|
||||
itemNameHash.insert("cmdlist_games", Command_ListGames::newItem);
|
||||
itemNameHash.insert("cmdcreate_game", Command_CreateGame::newItem);
|
||||
itemNameHash.insert("cmdjoin_game", Command_JoinGame::newItem);
|
||||
itemNameHash.insert("cmdleave_game", Command_LeaveGame::newItem);
|
||||
itemNameHash.insert("cmdsay", Command_Say::newItem);
|
||||
itemNameHash.insert("cmdshuffle", Command_Shuffle::newItem);
|
||||
itemNameHash.insert("cmdroll_die", Command_RollDie::newItem);
|
||||
itemNameHash.insert("cmddraw_cards", Command_DrawCards::newItem);
|
||||
itemNameHash.insert("cmdmove_card", Command_MoveCard::newItem);
|
||||
itemNameHash.insert("cmdcreate_token", Command_CreateToken::newItem);
|
||||
itemNameHash.insert("cmdcreate_arrow", Command_CreateArrow::newItem);
|
||||
itemNameHash.insert("cmddelete_arrow", Command_DeleteArrow::newItem);
|
||||
itemNameHash.insert("cmdset_card_attr", Command_SetCardAttr::newItem);
|
||||
itemNameHash.insert("cmdready_start", Command_ReadyStart::newItem);
|
||||
itemNameHash.insert("cmdinc_counter", Command_IncCounter::newItem);
|
||||
itemNameHash.insert("cmdadd_counter", Command_AddCounter::newItem);
|
||||
itemNameHash.insert("cmdset_counter", Command_SetCounter::newItem);
|
||||
itemNameHash.insert("cmddel_counter", Command_DelCounter::newItem);
|
||||
itemNameHash.insert("cmdnext_turn", Command_NextTurn::newItem);
|
||||
itemNameHash.insert("cmdset_active_phase", Command_SetActivePhase::newItem);
|
||||
itemNameHash.insert("cmddump_zone", Command_DumpZone::newItem);
|
||||
itemNameHash.insert("cmdstop_dump_zone", Command_StopDumpZone::newItem);
|
||||
itemNameHash.insert("cmddump_all", Command_DumpAll::newItem);
|
||||
itemNameHash.insert("cmdsubmit_deck", Command_SubmitDeck::newItem);
|
||||
itemNameHash.insert("game_eventsay", Event_Say::newItem);
|
||||
itemNameHash.insert("game_eventjoin", Event_Join::newItem);
|
||||
itemNameHash.insert("game_eventleave", Event_Leave::newItem);
|
||||
itemNameHash.insert("game_eventgame_closed", Event_GameClosed::newItem);
|
||||
itemNameHash.insert("game_eventready_start", Event_ReadyStart::newItem);
|
||||
itemNameHash.insert("game_eventsetup_zones", Event_SetupZones::newItem);
|
||||
itemNameHash.insert("game_eventgame_start", Event_GameStart::newItem);
|
||||
itemNameHash.insert("game_eventshuffle", Event_Shuffle::newItem);
|
||||
itemNameHash.insert("game_eventroll_die", Event_RollDie::newItem);
|
||||
itemNameHash.insert("game_eventmove_card", Event_MoveCard::newItem);
|
||||
itemNameHash.insert("game_eventcreate_token", Event_CreateToken::newItem);
|
||||
itemNameHash.insert("game_eventcreate_arrow", Event_CreateArrow::newItem);
|
||||
itemNameHash.insert("game_eventdelete_arrow", Event_DeleteArrow::newItem);
|
||||
itemNameHash.insert("game_eventset_card_attr", Event_SetCardAttr::newItem);
|
||||
itemNameHash.insert("game_eventadd_counter", Event_AddCounter::newItem);
|
||||
itemNameHash.insert("game_eventset_counter", Event_SetCounter::newItem);
|
||||
itemNameHash.insert("game_eventdel_counter", Event_DelCounter::newItem);
|
||||
itemNameHash.insert("game_eventset_active_player", Event_SetActivePlayer::newItem);
|
||||
itemNameHash.insert("game_eventset_active_phase", Event_SetActivePhase::newItem);
|
||||
itemNameHash.insert("game_eventdump_zone", Event_DumpZone::newItem);
|
||||
itemNameHash.insert("game_eventstop_dump_zone", Event_StopDumpZone::newItem);
|
||||
}
|
51
common/protocol_items.dat
Normal file
51
common/protocol_items.dat
Normal file
|
@ -0,0 +1,51 @@
|
|||
0:ping
|
||||
0:login:s,username:s,password
|
||||
0:chat_list_channels
|
||||
0:chat_join_channel:s,channel
|
||||
1:chat_leave_channel
|
||||
1:chat_say:s,message
|
||||
0:list_games
|
||||
0:create_game:s,description:s,password:i,max_players:b,spectators_allowed
|
||||
0:join_game:i,game_id:s,password:b,spectator
|
||||
2:leave_game
|
||||
2:say:s,message
|
||||
2:shuffle
|
||||
2:roll_die:i,sides
|
||||
2:draw_cards:i,number
|
||||
2:move_card:s,start_zone:i,card_id:s,target_zone:i,x:i,y:b,face_down
|
||||
2:create_token:s,zone:s,name:s,pt:i,x:i,y
|
||||
2:create_arrow:i,start_player_id:s,start_zone:i,start_card_id:i,target_player_id:s,target_player_zone:i,target_card_id:i,color
|
||||
2:delete_arrow:i,arrow_id
|
||||
2:set_card_attr:s,zone:i,card_id:s,attr_name:s,attr_value
|
||||
2:ready_start
|
||||
2:inc_counter:i,counter_id:i,delta
|
||||
2:add_counter:s,counter_name:i,color:i,radius:i,value
|
||||
2:set_counter:i,counter_id:i,value
|
||||
2:del_counter:i,counter_id
|
||||
2:next_turn
|
||||
2:set_active_phase:i,phase
|
||||
2:dump_zone:i,player_id:s,zone_name:i,number_cards
|
||||
2:stop_dump_zone:i,player_id:s,zone_name
|
||||
2:dump_all
|
||||
2:submit_deck
|
||||
3:say:s,message
|
||||
3:join:s,player_name:b,spectator
|
||||
3:leave
|
||||
3:game_closed
|
||||
3:ready_start
|
||||
3:setup_zones:i,deck_size:i,sb_size
|
||||
3:game_start
|
||||
3:shuffle
|
||||
3:roll_die:i,sides:i,value
|
||||
3:move_card:i,card_id:s,card_name:s,start_zone:i,position:s,target_zone:i,x:i,y:b,face_down
|
||||
3:create_token:s,zone:i,card_id:s,card_name:s,pt:i,x:i,y
|
||||
3:create_arrow:i,arrow_id:i,start_player_id:s,start_zone:i,start_card_id:i,target_player_id:s,target_zone:i,target_card_id:i,color
|
||||
3:delete_arrow:i,arrow_id
|
||||
3:set_card_attr:s,zone:i,card_id:s,attr_name:s,attr_value
|
||||
3:add_counter:i,counter_id:s,counter_name:i,color:i,radius:i,value
|
||||
3:set_counter:i,counter_id:i,value
|
||||
3:del_counter:i,counter_id
|
||||
3:set_active_player:i,active_player_id
|
||||
3:set_active_phase:i,phase
|
||||
3:dump_zone:i,zone_owner_id:s,zone:i,number_cards
|
||||
3:stop_dump_zone:i,zone_owner_id:s,zone
|
638
common/protocol_items.h
Normal file
638
common/protocol_items.h
Normal file
|
@ -0,0 +1,638 @@
|
|||
#ifndef PROTOCOL_ITEMS_H
|
||||
#define PROTOCOL_ITEMS_H
|
||||
|
||||
#include "protocol.h"
|
||||
|
||||
class Command_Ping : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_Ping();
|
||||
static ProtocolItem *newItem() { 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 ProtocolItem *newItem() { return new Command_Login; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_ChatListChannels : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_ChatListChannels();
|
||||
static ProtocolItem *newItem() { 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 ProtocolItem *newItem() { return new Command_ChatJoinChannel; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_ChatLeaveChannel : public ChatCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_ChatLeaveChannel(const QString &_channel = QString());
|
||||
static ProtocolItem *newItem() { 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 ProtocolItem *newItem() { return new Command_ChatSay; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_ListGames : public Command {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_ListGames();
|
||||
static ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { return new Command_JoinGame; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_LeaveGame : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_LeaveGame(int _gameId = -1);
|
||||
static ProtocolItem *newItem() { 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 ProtocolItem *newItem() { return new Command_Say; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_Shuffle : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_Shuffle(int _gameId = -1);
|
||||
static ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { return new Command_SetCardAttr; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_ReadyStart : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_ReadyStart(int _gameId = -1);
|
||||
static ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { return new Command_DelCounter; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_NextTurn : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_NextTurn(int _gameId = -1);
|
||||
static ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { 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 ProtocolItem *newItem() { return new Command_StopDumpZone; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Command_DumpAll : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_DumpAll(int _gameId = -1);
|
||||
static ProtocolItem *newItem() { return new Command_DumpAll; }
|
||||
};
|
||||
class Command_SubmitDeck : public GameCommand {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Command_SubmitDeck(int _gameId = -1);
|
||||
static ProtocolItem *newItem() { return new Command_SubmitDeck; }
|
||||
};
|
||||
class Event_Say : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString message;
|
||||
public:
|
||||
Event_Say(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_message = QString());
|
||||
QString getMessage() const { return message; }
|
||||
static ProtocolItem *newItem() { return new Event_Say; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_Join : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString playerName;
|
||||
bool spectator;
|
||||
public:
|
||||
Event_Join(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_playerName = QString(), bool _spectator = false);
|
||||
QString getPlayerName() const { return playerName; }
|
||||
bool getSpectator() const { return spectator; }
|
||||
static ProtocolItem *newItem() { return new Event_Join; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_Leave : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Event_Leave(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
||||
static ProtocolItem *newItem() { return new Event_Leave; }
|
||||
};
|
||||
class Event_GameClosed : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Event_GameClosed(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
||||
static ProtocolItem *newItem() { return new Event_GameClosed; }
|
||||
};
|
||||
class Event_ReadyStart : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Event_ReadyStart(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
||||
static ProtocolItem *newItem() { return new Event_ReadyStart; }
|
||||
};
|
||||
class Event_SetupZones : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int deckSize;
|
||||
int sbSize;
|
||||
public:
|
||||
Event_SetupZones(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _deckSize = -1, int _sbSize = -1);
|
||||
int getDeckSize() const { return deckSize; }
|
||||
int getSbSize() const { return sbSize; }
|
||||
static ProtocolItem *newItem() { return new Event_SetupZones; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_GameStart : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Event_GameStart(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
||||
static ProtocolItem *newItem() { return new Event_GameStart; }
|
||||
};
|
||||
class Event_Shuffle : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
public:
|
||||
Event_Shuffle(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
||||
static ProtocolItem *newItem() { return new Event_Shuffle; }
|
||||
};
|
||||
class Event_RollDie : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int sides;
|
||||
int value;
|
||||
public:
|
||||
Event_RollDie(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _sides = -1, int _value = -1);
|
||||
int getSides() const { return sides; }
|
||||
int getValue() const { return value; }
|
||||
static ProtocolItem *newItem() { return new Event_RollDie; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_MoveCard : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int cardId;
|
||||
QString cardName;
|
||||
QString startZone;
|
||||
int position;
|
||||
QString targetZone;
|
||||
int x;
|
||||
int y;
|
||||
bool faceDown;
|
||||
public:
|
||||
Event_MoveCard(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _cardId = -1, const QString &_cardName = QString(), const QString &_startZone = QString(), int _position = -1, const QString &_targetZone = QString(), int _x = -1, int _y = -1, bool _faceDown = false);
|
||||
int getCardId() const { return cardId; }
|
||||
QString getCardName() const { return cardName; }
|
||||
QString getStartZone() const { return startZone; }
|
||||
int getPosition() const { return position; }
|
||||
QString getTargetZone() const { return targetZone; }
|
||||
int getX() const { return x; }
|
||||
int getY() const { return y; }
|
||||
bool getFaceDown() const { return faceDown; }
|
||||
static ProtocolItem *newItem() { return new Event_MoveCard; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_CreateToken : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString zone;
|
||||
int cardId;
|
||||
QString cardName;
|
||||
QString pt;
|
||||
int x;
|
||||
int y;
|
||||
public:
|
||||
Event_CreateToken(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_zone = QString(), int _cardId = -1, const QString &_cardName = QString(), const QString &_pt = QString(), int _x = -1, int _y = -1);
|
||||
QString getZone() const { return zone; }
|
||||
int getCardId() const { return cardId; }
|
||||
QString getCardName() const { return cardName; }
|
||||
QString getPt() const { return pt; }
|
||||
int getX() const { return x; }
|
||||
int getY() const { return y; }
|
||||
static ProtocolItem *newItem() { return new Event_CreateToken; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_CreateArrow : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int arrowId;
|
||||
int startPlayerId;
|
||||
QString startZone;
|
||||
int startCardId;
|
||||
int targetPlayerId;
|
||||
QString targetZone;
|
||||
int targetCardId;
|
||||
int color;
|
||||
public:
|
||||
Event_CreateArrow(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _arrowId = -1, int _startPlayerId = -1, const QString &_startZone = QString(), int _startCardId = -1, int _targetPlayerId = -1, const QString &_targetZone = QString(), int _targetCardId = -1, int _color = -1);
|
||||
int getArrowId() const { return arrowId; }
|
||||
int getStartPlayerId() const { return startPlayerId; }
|
||||
QString getStartZone() const { return startZone; }
|
||||
int getStartCardId() const { return startCardId; }
|
||||
int getTargetPlayerId() const { return targetPlayerId; }
|
||||
QString getTargetZone() const { return targetZone; }
|
||||
int getTargetCardId() const { return targetCardId; }
|
||||
int getColor() const { return color; }
|
||||
static ProtocolItem *newItem() { return new Event_CreateArrow; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_DeleteArrow : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int arrowId;
|
||||
public:
|
||||
Event_DeleteArrow(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _arrowId = -1);
|
||||
int getArrowId() const { return arrowId; }
|
||||
static ProtocolItem *newItem() { return new Event_DeleteArrow; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_SetCardAttr : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString zone;
|
||||
int cardId;
|
||||
QString attrName;
|
||||
QString attrValue;
|
||||
public:
|
||||
Event_SetCardAttr(int _gameId = -1, bool _isPublic = false, int _playerId = -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 ProtocolItem *newItem() { return new Event_SetCardAttr; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_AddCounter : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int counterId;
|
||||
QString counterName;
|
||||
int color;
|
||||
int radius;
|
||||
int value;
|
||||
public:
|
||||
Event_AddCounter(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _counterId = -1, const QString &_counterName = QString(), int _color = -1, int _radius = -1, int _value = -1);
|
||||
int getCounterId() const { return counterId; }
|
||||
QString getCounterName() const { return counterName; }
|
||||
int getColor() const { return color; }
|
||||
int getRadius() const { return radius; }
|
||||
int getValue() const { return value; }
|
||||
static ProtocolItem *newItem() { return new Event_AddCounter; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_SetCounter : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int counterId;
|
||||
int value;
|
||||
public:
|
||||
Event_SetCounter(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _counterId = -1, int _value = -1);
|
||||
int getCounterId() const { return counterId; }
|
||||
int getValue() const { return value; }
|
||||
static ProtocolItem *newItem() { return new Event_SetCounter; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_DelCounter : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int counterId;
|
||||
public:
|
||||
Event_DelCounter(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _counterId = -1);
|
||||
int getCounterId() const { return counterId; }
|
||||
static ProtocolItem *newItem() { return new Event_DelCounter; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_SetActivePlayer : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int activePlayerId;
|
||||
public:
|
||||
Event_SetActivePlayer(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _activePlayerId = -1);
|
||||
int getActivePlayerId() const { return activePlayerId; }
|
||||
static ProtocolItem *newItem() { return new Event_SetActivePlayer; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_SetActivePhase : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int phase;
|
||||
public:
|
||||
Event_SetActivePhase(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _phase = -1);
|
||||
int getPhase() const { return phase; }
|
||||
static ProtocolItem *newItem() { return new Event_SetActivePhase; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_DumpZone : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int zoneOwnerId;
|
||||
QString zone;
|
||||
int numberCards;
|
||||
public:
|
||||
Event_DumpZone(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString(), int _numberCards = -1);
|
||||
int getZoneOwnerId() const { return zoneOwnerId; }
|
||||
QString getZone() const { return zone; }
|
||||
int getNumberCards() const { return numberCards; }
|
||||
static ProtocolItem *newItem() { return new Event_DumpZone; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
class Event_StopDumpZone : public GameEvent {
|
||||
Q_OBJECT
|
||||
private:
|
||||
int zoneOwnerId;
|
||||
QString zone;
|
||||
public:
|
||||
Event_StopDumpZone(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString());
|
||||
int getZoneOwnerId() const { return zoneOwnerId; }
|
||||
QString getZone() const { return zone; }
|
||||
static ProtocolItem *newItem() { return new Event_StopDumpZone; }
|
||||
protected:
|
||||
void extractParameters();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue