mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-21 14:50:26 -08:00
server-side part of client -> server commands almost converted to ProtocolBuffers. not usable yet
This commit is contained in:
@@ -13,6 +13,63 @@ class ServerInfo_User;
|
||||
class Server_Room;
|
||||
class QTimer;
|
||||
|
||||
class CommandContainer;
|
||||
class Command_Ping;
|
||||
class Command_Login;
|
||||
class Command_Message;
|
||||
class Command_ListUsers;
|
||||
class Command_GetGamesOfUser;
|
||||
class Command_GetUserInfo;
|
||||
class Command_AddToList;
|
||||
class Command_RemoveFromList;
|
||||
class Command_DeckList;
|
||||
class Command_DeckNewDir;
|
||||
class Command_DeckDelDir;
|
||||
class Command_DeckDel;
|
||||
class Command_DeckDownload;
|
||||
class Command_DeckUpload;
|
||||
class Command_ListRooms;
|
||||
class Command_JoinRoom;
|
||||
class Command_LeaveRoom;
|
||||
class Command_RoomSay;
|
||||
class Command_CreateGame;
|
||||
class Command_JoinGame;
|
||||
|
||||
class Command_KickFromGame;
|
||||
class Command_LeaveGame;
|
||||
class Command_GameSay;
|
||||
class Command_Shuffle;
|
||||
class Command_Mulligan;
|
||||
class Command_RollDie;
|
||||
class Command_DrawCards;
|
||||
class Command_UndoDraw;
|
||||
class Command_FlipCard;
|
||||
class Command_AttachCard;
|
||||
class Command_CreateToken;
|
||||
class Command_CreateArrow;
|
||||
class Command_DeleteArrow;
|
||||
class Command_SetCardAttr;
|
||||
class Command_SetCardCounter;
|
||||
class Command_IncCardCounter;
|
||||
class Command_ReadyStart;
|
||||
class Command_Concede;
|
||||
class Command_IncCounter;
|
||||
class Command_CreateCounter;
|
||||
class Command_SetCounter;
|
||||
class Command_DelCounter;
|
||||
class Command_NextTurn;
|
||||
class Command_SetActivePhase;
|
||||
class Command_DumpZone;
|
||||
class Command_StopDumpZone;
|
||||
class Command_RevealCards;
|
||||
class Command_MoveCard;
|
||||
class Command_SetSideboardPlan;
|
||||
class Command_DeckSelect;
|
||||
|
||||
class Command_BanFromServer;
|
||||
class Command_UpdateServerMessage;
|
||||
class Command_ShutdownServer;
|
||||
|
||||
class Server_ProtocolHandler : public QObject {
|
||||
Q_OBJECT
|
||||
protected:
|
||||
@@ -40,61 +97,65 @@ private:
|
||||
|
||||
virtual DeckList *getDeckFromDatabase(int deckId) = 0;
|
||||
|
||||
ResponseCode cmdPing(Command_Ping *cmd, CommandContainer *cont);
|
||||
ResponseCode cmdLogin(Command_Login *cmd, CommandContainer *cont);
|
||||
ResponseCode cmdMessage(Command_Message *cmd, CommandContainer *cont);
|
||||
virtual ResponseCode cmdAddToList(Command_AddToList *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdRemoveFromList(Command_RemoveFromList *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckList(Command_DeckList *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckNewDir(Command_DeckNewDir *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckDelDir(Command_DeckDelDir *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckDel(Command_DeckDel *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckUpload(Command_DeckUpload *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckDownload(Command_DeckDownload *cmd, CommandContainer *cont) = 0;
|
||||
ResponseCode cmdGetGamesOfUser(Command_GetGamesOfUser *cmd, CommandContainer *cont);
|
||||
ResponseCode cmdGetUserInfo(Command_GetUserInfo *cmd, CommandContainer *cont);
|
||||
ResponseCode cmdListRooms(Command_ListRooms *cmd, CommandContainer *cont);
|
||||
ResponseCode cmdJoinRoom(Command_JoinRoom *cmd, CommandContainer *cont);
|
||||
ResponseCode cmdLeaveRoom(Command_LeaveRoom *cmd, CommandContainer *cont, Server_Room *room);
|
||||
ResponseCode cmdRoomSay(Command_RoomSay *cmd, CommandContainer *cont, Server_Room *room);
|
||||
ResponseCode cmdListUsers(Command_ListUsers *cmd, CommandContainer *cont);
|
||||
ResponseCode cmdCreateGame(Command_CreateGame *cmd, CommandContainer *cont, Server_Room *room);
|
||||
ResponseCode cmdJoinGame(Command_JoinGame *cmd, CommandContainer *cont, Server_Room *room);
|
||||
ResponseCode cmdLeaveGame(Command_LeaveGame *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdKickFromGame(Command_KickFromGame *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdConcede(Command_Concede *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdReadyStart(Command_ReadyStart *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdDeckSelect(Command_DeckSelect *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdSetSideboardPlan(Command_SetSideboardPlan *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdSay(Command_Say *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdShuffle(Command_Shuffle *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdMulligan(Command_Mulligan *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdRollDie(Command_RollDie *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdDrawCards(Command_DrawCards *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdUndoDraw(Command_UndoDraw *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdMoveCard(Command_MoveCard *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdFlipCard(Command_FlipCard *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdAttachCard(Command_AttachCard *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdCreateToken(Command_CreateToken *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdCreateArrow(Command_CreateArrow *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdDeleteArrow(Command_DeleteArrow *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdSetCardAttr(Command_SetCardAttr *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdSetCardCounter(Command_SetCardCounter *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdIncCardCounter(Command_IncCardCounter *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdIncCounter(Command_IncCounter *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdCreateCounter(Command_CreateCounter *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdSetCounter(Command_SetCounter *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdDelCounter(Command_DelCounter *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdNextTurn(Command_NextTurn *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdSetActivePhase(Command_SetActivePhase *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdDumpZone(Command_DumpZone *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdStopDumpZone(Command_StopDumpZone *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
ResponseCode cmdRevealCards(Command_RevealCards *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player);
|
||||
virtual ResponseCode cmdBanFromServer(Command_BanFromServer *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdShutdownServer(Command_ShutdownServer *cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdUpdateServerMessage(Command_UpdateServerMessage *cmd, CommandContainer *cont) = 0;
|
||||
ResponseCode cmdPing(const Command_Ping &cmd, CommandContainer *cont);
|
||||
ResponseCode cmdLogin(const Command_Login &cmd, CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode cmdMessage(const Command_Message &cmd, CommandContainer *cont, BlaContainer *bla);
|
||||
virtual ResponseCode cmdAddToList(const Command_AddToList &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdRemoveFromList(const Command_RemoveFromList &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckList(const Command_DeckList &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckNewDir(const Command_DeckNewDir &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckDelDir(const Command_DeckDelDir &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckDel(const Command_DeckDel &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckUpload(const Command_DeckUpload &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdDeckDownload(const Command_DeckDownload &cmd, CommandContainer *cont) = 0;
|
||||
ResponseCode cmdGetGamesOfUser(const Command_GetGamesOfUser &cmd, CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode cmdGetUserInfo(const Command_GetUserInfo &cmd, CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode cmdListRooms(const Command_ListRooms &cmd, CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode cmdJoinRoom(const Command_JoinRoom &cmd, CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode cmdListUsers(const Command_ListUsers &cmd, CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode cmdLeaveRoom(const Command_LeaveRoom &cmd, CommandContainer *cont, Server_Room *room);
|
||||
ResponseCode cmdRoomSay(const Command_RoomSay &cmd, CommandContainer *cont, Server_Room *room);
|
||||
ResponseCode cmdCreateGame(const Command_CreateGame &cmd, CommandContainer *cont, Server_Room *room);
|
||||
ResponseCode cmdJoinGame(const Command_JoinGame &cmd, CommandContainer *cont, Server_Room *room);
|
||||
ResponseCode cmdLeaveGame(const Command_LeaveGame &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdKickFromGame(const Command_KickFromGame &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdConcede(const Command_Concede &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdReadyStart(const Command_ReadyStart &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdDeckSelect(const Command_DeckSelect &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdSetSideboardPlan(const Command_SetSideboardPlan &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdGameSay(const Command_GameSay &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdShuffle(const Command_Shuffle &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdMulligan(const Command_Mulligan &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdRollDie(const Command_RollDie &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdDrawCards(const Command_DrawCards &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdUndoDraw(const Command_UndoDraw &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdMoveCard(const Command_MoveCard &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdFlipCard(const Command_FlipCard &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdAttachCard(const Command_AttachCard &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdCreateToken(const Command_CreateToken &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdCreateArrow(const Command_CreateArrow &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdDeleteArrow(const Command_DeleteArrow &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdSetCardAttr(const Command_SetCardAttr &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdSetCardCounter(const Command_SetCardCounter &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdIncCardCounter(const Command_IncCardCounter &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdIncCounter(const Command_IncCounter &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdCreateCounter(const Command_CreateCounter &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdSetCounter(const Command_SetCounter &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdDelCounter(const Command_DelCounter &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdNextTurn(const Command_NextTurn &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdSetActivePhase(const Command_SetActivePhase &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdDumpZone(const Command_DumpZone &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdStopDumpZone(const Command_StopDumpZone &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
ResponseCode cmdRevealCards(const Command_RevealCards &cmd, CommandContainer *cont, Server_Game *game, Server_Player *player, BlaContainer *bla);
|
||||
virtual ResponseCode cmdBanFromServer(const Command_BanFromServer &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdShutdownServer(const Command_ShutdownServer &cmd, CommandContainer *cont) = 0;
|
||||
virtual ResponseCode cmdUpdateServerMessage(const Command_UpdateServerMessage &cmd, CommandContainer *cont) = 0;
|
||||
|
||||
ResponseCode processCommandHelper(Command *command, CommandContainer *cont);
|
||||
ResponseCode processSessionCommandContainer(CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode processRoomCommandContainer(CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode processGameCommandContainer(CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode processModeratorCommandContainer(CommandContainer *cont, BlaContainer *bla);
|
||||
ResponseCode processAdminCommandContainer(CommandContainer *cont, BlaContainer *bla);
|
||||
private slots:
|
||||
void pingClockTimeout();
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user