chat event
This commit is contained in:
parent
e1fc3ddb88
commit
d329376e93
7 changed files with 94 additions and 73 deletions
|
@ -6,6 +6,8 @@ TEMPLATE = app
|
||||||
TARGET =
|
TARGET =
|
||||||
DEPENDPATH += .
|
DEPENDPATH += .
|
||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
|
MOC_DIR = build
|
||||||
|
OBJECTS_DIR = build
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
HEADERS += protocol.h widget.h protocol_items.h
|
HEADERS += protocol.h widget.h protocol_items.h
|
||||||
|
|
|
@ -121,16 +121,25 @@ void GameEvent::extractParameters()
|
||||||
gameId = parameters["game_id"].toInt(&ok);
|
gameId = parameters["game_id"].toInt(&ok);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
gameId = -1;
|
gameId = -1;
|
||||||
isPublic = parameters["is_public"].toInt();
|
|
||||||
playerId = parameters["player_id"].toInt(&ok);
|
playerId = parameters["player_id"].toInt(&ok);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
playerId = -1;
|
playerId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameEvent::GameEvent(const QString &_eventName, int _gameId, bool _isPublic, int _playerId)
|
GameEvent::GameEvent(const QString &_eventName, int _gameId, int _playerId)
|
||||||
: ProtocolItem(_eventName), gameId(_gameId), isPublic(_isPublic), playerId(_playerId)
|
: ProtocolItem(_eventName), gameId(_gameId), playerId(_playerId)
|
||||||
{
|
{
|
||||||
setParameter("game_id", gameId);
|
setParameter("game_id", gameId);
|
||||||
setParameter("is_public", isPublic);
|
|
||||||
setParameter("player_id", playerId);
|
setParameter("player_id", playerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatEvent::extractParameters()
|
||||||
|
{
|
||||||
|
channel = parameters["channel"];
|
||||||
|
}
|
||||||
|
|
||||||
|
ChatEvent::ChatEvent(const QString &_eventName, const QString &_channel)
|
||||||
|
: ProtocolItem(_eventName), channel(_channel)
|
||||||
|
{
|
||||||
|
setParameter("channel", channel);
|
||||||
|
}
|
||||||
|
|
|
@ -103,13 +103,23 @@ class GameEvent : public ProtocolItem {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
int gameId;
|
int gameId;
|
||||||
bool isPublic;
|
|
||||||
int playerId;
|
int playerId;
|
||||||
protected:
|
protected:
|
||||||
QString getItemType() const { return "game_event"; }
|
QString getItemType() const { return "game_event"; }
|
||||||
void extractParameters();
|
void extractParameters();
|
||||||
public:
|
public:
|
||||||
GameEvent(const QString &_eventName, int _gameId, bool _isPublic, int _playerId);
|
GameEvent(const QString &_eventName, int _gameId, int _playerId);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ChatEvent : public ProtocolItem {
|
||||||
|
Q_OBJECT
|
||||||
|
private:
|
||||||
|
QString channel;
|
||||||
|
protected:
|
||||||
|
QString getItemType() const { return "chat_event"; }
|
||||||
|
void extractParameters();
|
||||||
|
public:
|
||||||
|
ChatEvent(const QString &_eventName, const QString &_channel);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -305,8 +305,8 @@ Command_SubmitDeck::Command_SubmitDeck(int _gameId)
|
||||||
: GameCommand("submit_deck", _gameId)
|
: GameCommand("submit_deck", _gameId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Event_Say::Event_Say(int _gameId, bool _isPublic, int _playerId, const QString &_message)
|
Event_Say::Event_Say(int _gameId, int _playerId, const QString &_message)
|
||||||
: GameEvent("say", _gameId, _isPublic, _playerId), message(_message)
|
: GameEvent("say", _gameId, _playerId), message(_message)
|
||||||
{
|
{
|
||||||
setParameter("message", message);
|
setParameter("message", message);
|
||||||
}
|
}
|
||||||
|
@ -315,8 +315,8 @@ void Event_Say::extractParameters()
|
||||||
GameEvent::extractParameters();
|
GameEvent::extractParameters();
|
||||||
message = parameters["message"];
|
message = parameters["message"];
|
||||||
}
|
}
|
||||||
Event_Join::Event_Join(int _gameId, bool _isPublic, int _playerId, const QString &_playerName, bool _spectator)
|
Event_Join::Event_Join(int _gameId, int _playerId, const QString &_playerName, bool _spectator)
|
||||||
: GameEvent("join", _gameId, _isPublic, _playerId), playerName(_playerName), spectator(_spectator)
|
: GameEvent("join", _gameId, _playerId), playerName(_playerName), spectator(_spectator)
|
||||||
{
|
{
|
||||||
setParameter("player_name", playerName);
|
setParameter("player_name", playerName);
|
||||||
setParameter("spectator", spectator);
|
setParameter("spectator", spectator);
|
||||||
|
@ -327,20 +327,20 @@ void Event_Join::extractParameters()
|
||||||
playerName = parameters["player_name"];
|
playerName = parameters["player_name"];
|
||||||
spectator = (parameters["spectator"] == "1");
|
spectator = (parameters["spectator"] == "1");
|
||||||
}
|
}
|
||||||
Event_Leave::Event_Leave(int _gameId, bool _isPublic, int _playerId)
|
Event_Leave::Event_Leave(int _gameId, int _playerId)
|
||||||
: GameEvent("leave", _gameId, _isPublic, _playerId)
|
: GameEvent("leave", _gameId, _playerId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Event_GameClosed::Event_GameClosed(int _gameId, bool _isPublic, int _playerId)
|
Event_GameClosed::Event_GameClosed(int _gameId, int _playerId)
|
||||||
: GameEvent("game_closed", _gameId, _isPublic, _playerId)
|
: GameEvent("game_closed", _gameId, _playerId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Event_ReadyStart::Event_ReadyStart(int _gameId, bool _isPublic, int _playerId)
|
Event_ReadyStart::Event_ReadyStart(int _gameId, int _playerId)
|
||||||
: GameEvent("ready_start", _gameId, _isPublic, _playerId)
|
: GameEvent("ready_start", _gameId, _playerId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Event_SetupZones::Event_SetupZones(int _gameId, bool _isPublic, int _playerId, int _deckSize, int _sbSize)
|
Event_SetupZones::Event_SetupZones(int _gameId, int _playerId, int _deckSize, int _sbSize)
|
||||||
: GameEvent("setup_zones", _gameId, _isPublic, _playerId), deckSize(_deckSize), sbSize(_sbSize)
|
: GameEvent("setup_zones", _gameId, _playerId), deckSize(_deckSize), sbSize(_sbSize)
|
||||||
{
|
{
|
||||||
setParameter("deck_size", deckSize);
|
setParameter("deck_size", deckSize);
|
||||||
setParameter("sb_size", sbSize);
|
setParameter("sb_size", sbSize);
|
||||||
|
@ -351,16 +351,16 @@ void Event_SetupZones::extractParameters()
|
||||||
deckSize = parameters["deck_size"].toInt();
|
deckSize = parameters["deck_size"].toInt();
|
||||||
sbSize = parameters["sb_size"].toInt();
|
sbSize = parameters["sb_size"].toInt();
|
||||||
}
|
}
|
||||||
Event_GameStart::Event_GameStart(int _gameId, bool _isPublic, int _playerId)
|
Event_GameStart::Event_GameStart(int _gameId, int _playerId)
|
||||||
: GameEvent("game_start", _gameId, _isPublic, _playerId)
|
: GameEvent("game_start", _gameId, _playerId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Event_Shuffle::Event_Shuffle(int _gameId, bool _isPublic, int _playerId)
|
Event_Shuffle::Event_Shuffle(int _gameId, int _playerId)
|
||||||
: GameEvent("shuffle", _gameId, _isPublic, _playerId)
|
: GameEvent("shuffle", _gameId, _playerId)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Event_RollDie::Event_RollDie(int _gameId, bool _isPublic, int _playerId, int _sides, int _value)
|
Event_RollDie::Event_RollDie(int _gameId, int _playerId, int _sides, int _value)
|
||||||
: GameEvent("roll_die", _gameId, _isPublic, _playerId), sides(_sides), value(_value)
|
: GameEvent("roll_die", _gameId, _playerId), sides(_sides), value(_value)
|
||||||
{
|
{
|
||||||
setParameter("sides", sides);
|
setParameter("sides", sides);
|
||||||
setParameter("value", value);
|
setParameter("value", value);
|
||||||
|
@ -371,8 +371,8 @@ void Event_RollDie::extractParameters()
|
||||||
sides = parameters["sides"].toInt();
|
sides = parameters["sides"].toInt();
|
||||||
value = parameters["value"].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)
|
Event_MoveCard::Event_MoveCard(int _gameId, 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)
|
: GameEvent("move_card", _gameId, _playerId), cardId(_cardId), cardName(_cardName), startZone(_startZone), position(_position), targetZone(_targetZone), x(_x), y(_y), faceDown(_faceDown)
|
||||||
{
|
{
|
||||||
setParameter("card_id", cardId);
|
setParameter("card_id", cardId);
|
||||||
setParameter("card_name", cardName);
|
setParameter("card_name", cardName);
|
||||||
|
@ -395,8 +395,8 @@ void Event_MoveCard::extractParameters()
|
||||||
y = parameters["y"].toInt();
|
y = parameters["y"].toInt();
|
||||||
faceDown = (parameters["face_down"] == "1");
|
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)
|
Event_CreateToken::Event_CreateToken(int _gameId, 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)
|
: GameEvent("create_token", _gameId, _playerId), zone(_zone), cardId(_cardId), cardName(_cardName), pt(_pt), x(_x), y(_y)
|
||||||
{
|
{
|
||||||
setParameter("zone", zone);
|
setParameter("zone", zone);
|
||||||
setParameter("card_id", cardId);
|
setParameter("card_id", cardId);
|
||||||
|
@ -415,8 +415,8 @@ void Event_CreateToken::extractParameters()
|
||||||
x = parameters["x"].toInt();
|
x = parameters["x"].toInt();
|
||||||
y = parameters["y"].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)
|
Event_CreateArrow::Event_CreateArrow(int _gameId, 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)
|
: GameEvent("create_arrow", _gameId, _playerId), arrowId(_arrowId), startPlayerId(_startPlayerId), startZone(_startZone), startCardId(_startCardId), targetPlayerId(_targetPlayerId), targetZone(_targetZone), targetCardId(_targetCardId), color(_color)
|
||||||
{
|
{
|
||||||
setParameter("arrow_id", arrowId);
|
setParameter("arrow_id", arrowId);
|
||||||
setParameter("start_player_id", startPlayerId);
|
setParameter("start_player_id", startPlayerId);
|
||||||
|
@ -439,8 +439,8 @@ void Event_CreateArrow::extractParameters()
|
||||||
targetCardId = parameters["target_card_id"].toInt();
|
targetCardId = parameters["target_card_id"].toInt();
|
||||||
color = parameters["color"].toInt();
|
color = parameters["color"].toInt();
|
||||||
}
|
}
|
||||||
Event_DeleteArrow::Event_DeleteArrow(int _gameId, bool _isPublic, int _playerId, int _arrowId)
|
Event_DeleteArrow::Event_DeleteArrow(int _gameId, int _playerId, int _arrowId)
|
||||||
: GameEvent("delete_arrow", _gameId, _isPublic, _playerId), arrowId(_arrowId)
|
: GameEvent("delete_arrow", _gameId, _playerId), arrowId(_arrowId)
|
||||||
{
|
{
|
||||||
setParameter("arrow_id", arrowId);
|
setParameter("arrow_id", arrowId);
|
||||||
}
|
}
|
||||||
|
@ -449,8 +449,8 @@ void Event_DeleteArrow::extractParameters()
|
||||||
GameEvent::extractParameters();
|
GameEvent::extractParameters();
|
||||||
arrowId = parameters["arrow_id"].toInt();
|
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)
|
Event_SetCardAttr::Event_SetCardAttr(int _gameId, 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)
|
: GameEvent("set_card_attr", _gameId, _playerId), zone(_zone), cardId(_cardId), attrName(_attrName), attrValue(_attrValue)
|
||||||
{
|
{
|
||||||
setParameter("zone", zone);
|
setParameter("zone", zone);
|
||||||
setParameter("card_id", cardId);
|
setParameter("card_id", cardId);
|
||||||
|
@ -465,8 +465,8 @@ void Event_SetCardAttr::extractParameters()
|
||||||
attrName = parameters["attr_name"];
|
attrName = parameters["attr_name"];
|
||||||
attrValue = parameters["attr_value"];
|
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)
|
Event_AddCounter::Event_AddCounter(int _gameId, 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)
|
: GameEvent("add_counter", _gameId, _playerId), counterId(_counterId), counterName(_counterName), color(_color), radius(_radius), value(_value)
|
||||||
{
|
{
|
||||||
setParameter("counter_id", counterId);
|
setParameter("counter_id", counterId);
|
||||||
setParameter("counter_name", counterName);
|
setParameter("counter_name", counterName);
|
||||||
|
@ -483,8 +483,8 @@ void Event_AddCounter::extractParameters()
|
||||||
radius = parameters["radius"].toInt();
|
radius = parameters["radius"].toInt();
|
||||||
value = parameters["value"].toInt();
|
value = parameters["value"].toInt();
|
||||||
}
|
}
|
||||||
Event_SetCounter::Event_SetCounter(int _gameId, bool _isPublic, int _playerId, int _counterId, int _value)
|
Event_SetCounter::Event_SetCounter(int _gameId, int _playerId, int _counterId, int _value)
|
||||||
: GameEvent("set_counter", _gameId, _isPublic, _playerId), counterId(_counterId), value(_value)
|
: GameEvent("set_counter", _gameId, _playerId), counterId(_counterId), value(_value)
|
||||||
{
|
{
|
||||||
setParameter("counter_id", counterId);
|
setParameter("counter_id", counterId);
|
||||||
setParameter("value", value);
|
setParameter("value", value);
|
||||||
|
@ -495,8 +495,8 @@ void Event_SetCounter::extractParameters()
|
||||||
counterId = parameters["counter_id"].toInt();
|
counterId = parameters["counter_id"].toInt();
|
||||||
value = parameters["value"].toInt();
|
value = parameters["value"].toInt();
|
||||||
}
|
}
|
||||||
Event_DelCounter::Event_DelCounter(int _gameId, bool _isPublic, int _playerId, int _counterId)
|
Event_DelCounter::Event_DelCounter(int _gameId, int _playerId, int _counterId)
|
||||||
: GameEvent("del_counter", _gameId, _isPublic, _playerId), counterId(_counterId)
|
: GameEvent("del_counter", _gameId, _playerId), counterId(_counterId)
|
||||||
{
|
{
|
||||||
setParameter("counter_id", counterId);
|
setParameter("counter_id", counterId);
|
||||||
}
|
}
|
||||||
|
@ -505,8 +505,8 @@ void Event_DelCounter::extractParameters()
|
||||||
GameEvent::extractParameters();
|
GameEvent::extractParameters();
|
||||||
counterId = parameters["counter_id"].toInt();
|
counterId = parameters["counter_id"].toInt();
|
||||||
}
|
}
|
||||||
Event_SetActivePlayer::Event_SetActivePlayer(int _gameId, bool _isPublic, int _playerId, int _activePlayerId)
|
Event_SetActivePlayer::Event_SetActivePlayer(int _gameId, int _playerId, int _activePlayerId)
|
||||||
: GameEvent("set_active_player", _gameId, _isPublic, _playerId), activePlayerId(_activePlayerId)
|
: GameEvent("set_active_player", _gameId, _playerId), activePlayerId(_activePlayerId)
|
||||||
{
|
{
|
||||||
setParameter("active_player_id", activePlayerId);
|
setParameter("active_player_id", activePlayerId);
|
||||||
}
|
}
|
||||||
|
@ -515,8 +515,8 @@ void Event_SetActivePlayer::extractParameters()
|
||||||
GameEvent::extractParameters();
|
GameEvent::extractParameters();
|
||||||
activePlayerId = parameters["active_player_id"].toInt();
|
activePlayerId = parameters["active_player_id"].toInt();
|
||||||
}
|
}
|
||||||
Event_SetActivePhase::Event_SetActivePhase(int _gameId, bool _isPublic, int _playerId, int _phase)
|
Event_SetActivePhase::Event_SetActivePhase(int _gameId, int _playerId, int _phase)
|
||||||
: GameEvent("set_active_phase", _gameId, _isPublic, _playerId), phase(_phase)
|
: GameEvent("set_active_phase", _gameId, _playerId), phase(_phase)
|
||||||
{
|
{
|
||||||
setParameter("phase", phase);
|
setParameter("phase", phase);
|
||||||
}
|
}
|
||||||
|
@ -525,8 +525,8 @@ void Event_SetActivePhase::extractParameters()
|
||||||
GameEvent::extractParameters();
|
GameEvent::extractParameters();
|
||||||
phase = parameters["phase"].toInt();
|
phase = parameters["phase"].toInt();
|
||||||
}
|
}
|
||||||
Event_DumpZone::Event_DumpZone(int _gameId, bool _isPublic, int _playerId, int _zoneOwnerId, const QString &_zone, int _numberCards)
|
Event_DumpZone::Event_DumpZone(int _gameId, int _playerId, int _zoneOwnerId, const QString &_zone, int _numberCards)
|
||||||
: GameEvent("dump_zone", _gameId, _isPublic, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone), numberCards(_numberCards)
|
: GameEvent("dump_zone", _gameId, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone), numberCards(_numberCards)
|
||||||
{
|
{
|
||||||
setParameter("zone_owner_id", zoneOwnerId);
|
setParameter("zone_owner_id", zoneOwnerId);
|
||||||
setParameter("zone", zone);
|
setParameter("zone", zone);
|
||||||
|
@ -539,8 +539,8 @@ void Event_DumpZone::extractParameters()
|
||||||
zone = parameters["zone"];
|
zone = parameters["zone"];
|
||||||
numberCards = parameters["number_cards"].toInt();
|
numberCards = parameters["number_cards"].toInt();
|
||||||
}
|
}
|
||||||
Event_StopDumpZone::Event_StopDumpZone(int _gameId, bool _isPublic, int _playerId, int _zoneOwnerId, const QString &_zone)
|
Event_StopDumpZone::Event_StopDumpZone(int _gameId, int _playerId, int _zoneOwnerId, const QString &_zone)
|
||||||
: GameEvent("stop_dump_zone", _gameId, _isPublic, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone)
|
: GameEvent("stop_dump_zone", _gameId, _playerId), zoneOwnerId(_zoneOwnerId), zone(_zone)
|
||||||
{
|
{
|
||||||
setParameter("zone_owner_id", zoneOwnerId);
|
setParameter("zone_owner_id", zoneOwnerId);
|
||||||
setParameter("zone", zone);
|
setParameter("zone", zone);
|
||||||
|
|
|
@ -362,7 +362,7 @@ class Event_Say : public GameEvent {
|
||||||
private:
|
private:
|
||||||
QString message;
|
QString message;
|
||||||
public:
|
public:
|
||||||
Event_Say(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_message = QString());
|
Event_Say(int _gameId = -1, int _playerId = -1, const QString &_message = QString());
|
||||||
QString getMessage() const { return message; }
|
QString getMessage() const { return message; }
|
||||||
static ProtocolItem *newItem() { return new Event_Say; }
|
static ProtocolItem *newItem() { return new Event_Say; }
|
||||||
protected:
|
protected:
|
||||||
|
@ -374,7 +374,7 @@ private:
|
||||||
QString playerName;
|
QString playerName;
|
||||||
bool spectator;
|
bool spectator;
|
||||||
public:
|
public:
|
||||||
Event_Join(int _gameId = -1, bool _isPublic = false, int _playerId = -1, const QString &_playerName = QString(), bool _spectator = false);
|
Event_Join(int _gameId = -1, int _playerId = -1, const QString &_playerName = QString(), bool _spectator = false);
|
||||||
QString getPlayerName() const { return playerName; }
|
QString getPlayerName() const { return playerName; }
|
||||||
bool getSpectator() const { return spectator; }
|
bool getSpectator() const { return spectator; }
|
||||||
static ProtocolItem *newItem() { return new Event_Join; }
|
static ProtocolItem *newItem() { return new Event_Join; }
|
||||||
|
@ -385,21 +385,21 @@ class Event_Leave : public GameEvent {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
Event_Leave(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
Event_Leave(int _gameId = -1, int _playerId = -1);
|
||||||
static ProtocolItem *newItem() { return new Event_Leave; }
|
static ProtocolItem *newItem() { return new Event_Leave; }
|
||||||
};
|
};
|
||||||
class Event_GameClosed : public GameEvent {
|
class Event_GameClosed : public GameEvent {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
Event_GameClosed(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
Event_GameClosed(int _gameId = -1, int _playerId = -1);
|
||||||
static ProtocolItem *newItem() { return new Event_GameClosed; }
|
static ProtocolItem *newItem() { return new Event_GameClosed; }
|
||||||
};
|
};
|
||||||
class Event_ReadyStart : public GameEvent {
|
class Event_ReadyStart : public GameEvent {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
Event_ReadyStart(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
Event_ReadyStart(int _gameId = -1, int _playerId = -1);
|
||||||
static ProtocolItem *newItem() { return new Event_ReadyStart; }
|
static ProtocolItem *newItem() { return new Event_ReadyStart; }
|
||||||
};
|
};
|
||||||
class Event_SetupZones : public GameEvent {
|
class Event_SetupZones : public GameEvent {
|
||||||
|
@ -408,7 +408,7 @@ private:
|
||||||
int deckSize;
|
int deckSize;
|
||||||
int sbSize;
|
int sbSize;
|
||||||
public:
|
public:
|
||||||
Event_SetupZones(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _deckSize = -1, int _sbSize = -1);
|
Event_SetupZones(int _gameId = -1, int _playerId = -1, int _deckSize = -1, int _sbSize = -1);
|
||||||
int getDeckSize() const { return deckSize; }
|
int getDeckSize() const { return deckSize; }
|
||||||
int getSbSize() const { return sbSize; }
|
int getSbSize() const { return sbSize; }
|
||||||
static ProtocolItem *newItem() { return new Event_SetupZones; }
|
static ProtocolItem *newItem() { return new Event_SetupZones; }
|
||||||
|
@ -419,14 +419,14 @@ class Event_GameStart : public GameEvent {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
Event_GameStart(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
Event_GameStart(int _gameId = -1, int _playerId = -1);
|
||||||
static ProtocolItem *newItem() { return new Event_GameStart; }
|
static ProtocolItem *newItem() { return new Event_GameStart; }
|
||||||
};
|
};
|
||||||
class Event_Shuffle : public GameEvent {
|
class Event_Shuffle : public GameEvent {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
Event_Shuffle(int _gameId = -1, bool _isPublic = false, int _playerId = -1);
|
Event_Shuffle(int _gameId = -1, int _playerId = -1);
|
||||||
static ProtocolItem *newItem() { return new Event_Shuffle; }
|
static ProtocolItem *newItem() { return new Event_Shuffle; }
|
||||||
};
|
};
|
||||||
class Event_RollDie : public GameEvent {
|
class Event_RollDie : public GameEvent {
|
||||||
|
@ -435,7 +435,7 @@ private:
|
||||||
int sides;
|
int sides;
|
||||||
int value;
|
int value;
|
||||||
public:
|
public:
|
||||||
Event_RollDie(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _sides = -1, int _value = -1);
|
Event_RollDie(int _gameId = -1, int _playerId = -1, int _sides = -1, int _value = -1);
|
||||||
int getSides() const { return sides; }
|
int getSides() const { return sides; }
|
||||||
int getValue() const { return value; }
|
int getValue() const { return value; }
|
||||||
static ProtocolItem *newItem() { return new Event_RollDie; }
|
static ProtocolItem *newItem() { return new Event_RollDie; }
|
||||||
|
@ -454,7 +454,7 @@ private:
|
||||||
int y;
|
int y;
|
||||||
bool faceDown;
|
bool faceDown;
|
||||||
public:
|
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);
|
Event_MoveCard(int _gameId = -1, 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; }
|
int getCardId() const { return cardId; }
|
||||||
QString getCardName() const { return cardName; }
|
QString getCardName() const { return cardName; }
|
||||||
QString getStartZone() const { return startZone; }
|
QString getStartZone() const { return startZone; }
|
||||||
|
@ -477,7 +477,7 @@ private:
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
public:
|
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);
|
Event_CreateToken(int _gameId = -1, 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; }
|
QString getZone() const { return zone; }
|
||||||
int getCardId() const { return cardId; }
|
int getCardId() const { return cardId; }
|
||||||
QString getCardName() const { return cardName; }
|
QString getCardName() const { return cardName; }
|
||||||
|
@ -500,7 +500,7 @@ private:
|
||||||
int targetCardId;
|
int targetCardId;
|
||||||
int color;
|
int color;
|
||||||
public:
|
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);
|
Event_CreateArrow(int _gameId = -1, 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 getArrowId() const { return arrowId; }
|
||||||
int getStartPlayerId() const { return startPlayerId; }
|
int getStartPlayerId() const { return startPlayerId; }
|
||||||
QString getStartZone() const { return startZone; }
|
QString getStartZone() const { return startZone; }
|
||||||
|
@ -518,7 +518,7 @@ class Event_DeleteArrow : public GameEvent {
|
||||||
private:
|
private:
|
||||||
int arrowId;
|
int arrowId;
|
||||||
public:
|
public:
|
||||||
Event_DeleteArrow(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _arrowId = -1);
|
Event_DeleteArrow(int _gameId = -1, int _playerId = -1, int _arrowId = -1);
|
||||||
int getArrowId() const { return arrowId; }
|
int getArrowId() const { return arrowId; }
|
||||||
static ProtocolItem *newItem() { return new Event_DeleteArrow; }
|
static ProtocolItem *newItem() { return new Event_DeleteArrow; }
|
||||||
protected:
|
protected:
|
||||||
|
@ -532,7 +532,7 @@ private:
|
||||||
QString attrName;
|
QString attrName;
|
||||||
QString attrValue;
|
QString attrValue;
|
||||||
public:
|
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());
|
Event_SetCardAttr(int _gameId = -1, int _playerId = -1, const QString &_zone = QString(), int _cardId = -1, const QString &_attrName = QString(), const QString &_attrValue = QString());
|
||||||
QString getZone() const { return zone; }
|
QString getZone() const { return zone; }
|
||||||
int getCardId() const { return cardId; }
|
int getCardId() const { return cardId; }
|
||||||
QString getAttrName() const { return attrName; }
|
QString getAttrName() const { return attrName; }
|
||||||
|
@ -550,7 +550,7 @@ private:
|
||||||
int radius;
|
int radius;
|
||||||
int value;
|
int value;
|
||||||
public:
|
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);
|
Event_AddCounter(int _gameId = -1, int _playerId = -1, int _counterId = -1, const QString &_counterName = QString(), int _color = -1, int _radius = -1, int _value = -1);
|
||||||
int getCounterId() const { return counterId; }
|
int getCounterId() const { return counterId; }
|
||||||
QString getCounterName() const { return counterName; }
|
QString getCounterName() const { return counterName; }
|
||||||
int getColor() const { return color; }
|
int getColor() const { return color; }
|
||||||
|
@ -566,7 +566,7 @@ private:
|
||||||
int counterId;
|
int counterId;
|
||||||
int value;
|
int value;
|
||||||
public:
|
public:
|
||||||
Event_SetCounter(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _counterId = -1, int _value = -1);
|
Event_SetCounter(int _gameId = -1, int _playerId = -1, int _counterId = -1, int _value = -1);
|
||||||
int getCounterId() const { return counterId; }
|
int getCounterId() const { return counterId; }
|
||||||
int getValue() const { return value; }
|
int getValue() const { return value; }
|
||||||
static ProtocolItem *newItem() { return new Event_SetCounter; }
|
static ProtocolItem *newItem() { return new Event_SetCounter; }
|
||||||
|
@ -578,7 +578,7 @@ class Event_DelCounter : public GameEvent {
|
||||||
private:
|
private:
|
||||||
int counterId;
|
int counterId;
|
||||||
public:
|
public:
|
||||||
Event_DelCounter(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _counterId = -1);
|
Event_DelCounter(int _gameId = -1, int _playerId = -1, int _counterId = -1);
|
||||||
int getCounterId() const { return counterId; }
|
int getCounterId() const { return counterId; }
|
||||||
static ProtocolItem *newItem() { return new Event_DelCounter; }
|
static ProtocolItem *newItem() { return new Event_DelCounter; }
|
||||||
protected:
|
protected:
|
||||||
|
@ -589,7 +589,7 @@ class Event_SetActivePlayer : public GameEvent {
|
||||||
private:
|
private:
|
||||||
int activePlayerId;
|
int activePlayerId;
|
||||||
public:
|
public:
|
||||||
Event_SetActivePlayer(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _activePlayerId = -1);
|
Event_SetActivePlayer(int _gameId = -1, int _playerId = -1, int _activePlayerId = -1);
|
||||||
int getActivePlayerId() const { return activePlayerId; }
|
int getActivePlayerId() const { return activePlayerId; }
|
||||||
static ProtocolItem *newItem() { return new Event_SetActivePlayer; }
|
static ProtocolItem *newItem() { return new Event_SetActivePlayer; }
|
||||||
protected:
|
protected:
|
||||||
|
@ -600,7 +600,7 @@ class Event_SetActivePhase : public GameEvent {
|
||||||
private:
|
private:
|
||||||
int phase;
|
int phase;
|
||||||
public:
|
public:
|
||||||
Event_SetActivePhase(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _phase = -1);
|
Event_SetActivePhase(int _gameId = -1, int _playerId = -1, int _phase = -1);
|
||||||
int getPhase() const { return phase; }
|
int getPhase() const { return phase; }
|
||||||
static ProtocolItem *newItem() { return new Event_SetActivePhase; }
|
static ProtocolItem *newItem() { return new Event_SetActivePhase; }
|
||||||
protected:
|
protected:
|
||||||
|
@ -613,7 +613,7 @@ private:
|
||||||
QString zone;
|
QString zone;
|
||||||
int numberCards;
|
int numberCards;
|
||||||
public:
|
public:
|
||||||
Event_DumpZone(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString(), int _numberCards = -1);
|
Event_DumpZone(int _gameId = -1, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString(), int _numberCards = -1);
|
||||||
int getZoneOwnerId() const { return zoneOwnerId; }
|
int getZoneOwnerId() const { return zoneOwnerId; }
|
||||||
QString getZone() const { return zone; }
|
QString getZone() const { return zone; }
|
||||||
int getNumberCards() const { return numberCards; }
|
int getNumberCards() const { return numberCards; }
|
||||||
|
@ -627,7 +627,7 @@ private:
|
||||||
int zoneOwnerId;
|
int zoneOwnerId;
|
||||||
QString zone;
|
QString zone;
|
||||||
public:
|
public:
|
||||||
Event_StopDumpZone(int _gameId = -1, bool _isPublic = false, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString());
|
Event_StopDumpZone(int _gameId = -1, int _playerId = -1, int _zoneOwnerId = -1, const QString &_zone = QString());
|
||||||
int getZoneOwnerId() const { return zoneOwnerId; }
|
int getZoneOwnerId() const { return zoneOwnerId; }
|
||||||
QString getZone() const { return zone; }
|
QString getZone() const { return zone; }
|
||||||
static ProtocolItem *newItem() { return new Event_StopDumpZone; }
|
static ProtocolItem *newItem() { return new Event_StopDumpZone; }
|
||||||
|
|
|
@ -44,9 +44,9 @@ while (<file>) {
|
||||||
$type = 'game_event';
|
$type = 'game_event';
|
||||||
$namePrefix = 'Event';
|
$namePrefix = 'Event';
|
||||||
$baseClass = 'GameEvent';
|
$baseClass = 'GameEvent';
|
||||||
$parentConstructorCall = "$baseClass(\"$name1\", _gameId, _isPublic, _playerId)";
|
$parentConstructorCall = "$baseClass(\"$name1\", _gameId, _playerId)";
|
||||||
$constructorParamsH = "int _gameId = -1, bool _isPublic = false, int _playerId = -1";
|
$constructorParamsH = "int _gameId = -1, int _playerId = -1";
|
||||||
$constructorParamsCpp = "int _gameId, bool _isPublic, int _playerId";
|
$constructorParamsCpp = "int _gameId, int _playerId";
|
||||||
}
|
}
|
||||||
$className = $namePrefix . '_' . $name2;
|
$className = $namePrefix . '_' . $name2;
|
||||||
print headerfile "class $className : public $baseClass {\n"
|
print headerfile "class $className : public $baseClass {\n"
|
||||||
|
|
|
@ -50,7 +50,7 @@ void Widget::startClicked()
|
||||||
ProtocolResponse *test4 = new ProtocolResponse(123, ProtocolResponse::RespContextError);
|
ProtocolResponse *test4 = new ProtocolResponse(123, ProtocolResponse::RespContextError);
|
||||||
test4->write(xmlWriter);
|
test4->write(xmlWriter);
|
||||||
|
|
||||||
GameEvent *test5 = new Event_RollDie(1234, true, 1, 20, 13);
|
GameEvent *test5 = new Event_RollDie(1234, 1, 20, 13);
|
||||||
test5->write(xmlWriter);
|
test5->write(xmlWriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue