Add option to disable game chat.
This commit is contained in:
parent
c40c2d194b
commit
57597669fe
|
@ -2,80 +2,101 @@
|
|||
|
||||
cah.$ = {};
|
||||
|
||||
cah.$.GamePlayerStatus = function() {
|
||||
cah.$.AjaxOperation = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.GamePlayerStatus.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GamePlayerStatus.SPECTATOR = "sv";
|
||||
cah.$.GamePlayerStatus.WINNER = "sw";
|
||||
cah.$.GamePlayerStatus.IDLE = "si";
|
||||
cah.$.GamePlayerStatus.HOST = "sh";
|
||||
cah.$.GamePlayerStatus.JUDGING = "sjj";
|
||||
cah.$.GamePlayerStatus.JUDGE = "sj";
|
||||
cah.$.GamePlayerStatus.PLAYING = "sp";
|
||||
cah.$.GamePlayerStatus_msg = {};
|
||||
cah.$.GamePlayerStatus_msg['sjj'] = "Selecting";
|
||||
cah.$.GamePlayerStatus_msg['sv'] = "Spectator";
|
||||
cah.$.GamePlayerStatus_msg['sw'] = "Winner!";
|
||||
cah.$.GamePlayerStatus_msg['sh'] = "Host";
|
||||
cah.$.GamePlayerStatus_msg['si'] = "";
|
||||
cah.$.GamePlayerStatus_msg['sj'] = "Card Czar";
|
||||
cah.$.GamePlayerStatus_msg['sp'] = "Playing";
|
||||
cah.$.GamePlayerStatus_msg_2 = {};
|
||||
cah.$.GamePlayerStatus_msg_2['sjj'] = "Select a winning card.";
|
||||
cah.$.GamePlayerStatus_msg_2['sv'] = "You are just spectating.";
|
||||
cah.$.GamePlayerStatus_msg_2['sw'] = "You have won!";
|
||||
cah.$.GamePlayerStatus_msg_2['sh'] = "Wait for players then click Start Game.";
|
||||
cah.$.GamePlayerStatus_msg_2['si'] = "Waiting for players...";
|
||||
cah.$.GamePlayerStatus_msg_2['sj'] = "You are the Card Czar.";
|
||||
cah.$.GamePlayerStatus_msg_2['sp'] = "Select a card to play.";
|
||||
cah.$.AjaxOperation.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.AjaxOperation.NAMES = "gn";
|
||||
cah.$.AjaxOperation.SCORE = "SC";
|
||||
cah.$.AjaxOperation.LEAVE_GAME = "lg";
|
||||
cah.$.AjaxOperation.JOIN_GAME = "jg";
|
||||
cah.$.AjaxOperation.CHAT = "c";
|
||||
cah.$.AjaxOperation.GAME_LIST = "ggl";
|
||||
cah.$.AjaxOperation.CARDCAST_ADD_CARDSET = "cac";
|
||||
cah.$.AjaxOperation.CARDCAST_LIST_CARDSETS = "clc";
|
||||
cah.$.AjaxOperation.PLAY_CARD = "pc";
|
||||
cah.$.AjaxOperation.CHANGE_GAME_OPTIONS = "cgo";
|
||||
cah.$.AjaxOperation.GET_GAME_INFO = "ggi";
|
||||
cah.$.AjaxOperation.GET_CARDS = "gc";
|
||||
cah.$.AjaxOperation.ADMIN_SET_VERBOSE_LOG = "svl";
|
||||
cah.$.AjaxOperation.REGISTER = "r";
|
||||
cah.$.AjaxOperation.CARDCAST_REMOVE_CARDSET = "crc";
|
||||
cah.$.AjaxOperation.WHOIS = "Wi";
|
||||
cah.$.AjaxOperation.KICK = "K";
|
||||
cah.$.AjaxOperation.FIRST_LOAD = "fl";
|
||||
cah.$.AjaxOperation.START_GAME = "sg";
|
||||
cah.$.AjaxOperation.LOG_OUT = "lo";
|
||||
cah.$.AjaxOperation.BAN = "b";
|
||||
cah.$.AjaxOperation.CREATE_GAME = "cg";
|
||||
cah.$.AjaxOperation.STOP_GAME = "Sg";
|
||||
cah.$.AjaxOperation.GAME_CHAT = "GC";
|
||||
cah.$.AjaxOperation.SPECTATE_GAME = "vg";
|
||||
cah.$.AjaxOperation.JUDGE_SELECT = "js";
|
||||
|
||||
cah.$.GamePlayerInfo = function() {
|
||||
cah.$.AjaxRequest = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.GamePlayerInfo.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GamePlayerInfo.STATUS = "st";
|
||||
cah.$.GamePlayerInfo.SCORE = "sc";
|
||||
cah.$.GamePlayerInfo.NAME = "N";
|
||||
cah.$.AjaxRequest.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.AjaxRequest.SERIAL = "s";
|
||||
cah.$.AjaxRequest.OP = "o";
|
||||
cah.$.AjaxRequest.WALL = "wall";
|
||||
cah.$.AjaxRequest.PERSISTENT_ID = "pid";
|
||||
cah.$.AjaxRequest.EMOTE = "me";
|
||||
cah.$.AjaxRequest.CARDCAST_ID = "cci";
|
||||
cah.$.AjaxRequest.GAME_ID = "gid";
|
||||
cah.$.AjaxRequest.GAME_OPTIONS = "go";
|
||||
cah.$.AjaxRequest.MESSAGE = "m";
|
||||
cah.$.AjaxRequest.NICKNAME = "n";
|
||||
cah.$.AjaxRequest.PASSWORD = "pw";
|
||||
cah.$.AjaxRequest.CARD_ID = "cid";
|
||||
cah.$.AjaxRequest.ID_CODE = "idc";
|
||||
|
||||
cah.$.GameOptionData = function() {
|
||||
cah.$.AjaxResponse = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.GameOptionData.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GameOptionData.TIMER_MULTIPLIER = "tm";
|
||||
cah.$.GameOptionData.PASSWORD = "pw";
|
||||
cah.$.GameOptionData.SPECTATOR_LIMIT = "vL";
|
||||
cah.$.GameOptionData.SCORE_LIMIT = "sl";
|
||||
cah.$.GameOptionData.BLANKS_LIMIT = "bl";
|
||||
cah.$.GameOptionData.PLAYER_LIMIT = "pL";
|
||||
cah.$.GameOptionData.CARD_SETS = "css";
|
||||
cah.$.AjaxResponse.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.AjaxResponse.NAMES = "nl";
|
||||
cah.$.AjaxResponse.CLIENT_NAME = "cn";
|
||||
cah.$.AjaxResponse.GAME_CHAT_ENABLED = "Gce";
|
||||
cah.$.AjaxResponse.PLAYER_INFO = "pi";
|
||||
cah.$.AjaxResponse.CONNECTED_AT = "ca";
|
||||
cah.$.AjaxResponse.WHITE_CARDS = "wc";
|
||||
cah.$.AjaxResponse.HAND = "h";
|
||||
cah.$.AjaxResponse.ERROR_CODE = "ec";
|
||||
cah.$.AjaxResponse.GLOBAL_CHAT_ENABLED = "gce";
|
||||
cah.$.AjaxResponse.SERVER_STARTED = "SS";
|
||||
cah.$.AjaxResponse.NEXT = "next";
|
||||
cah.$.AjaxResponse.GAME_INFO = "gi";
|
||||
cah.$.AjaxResponse.ERROR = "e";
|
||||
cah.$.AjaxResponse.GAME_STATE_DESCRIPTION = "gss";
|
||||
cah.$.AjaxResponse.ID_CODE = "idc";
|
||||
cah.$.AjaxResponse.CARD_SETS = "css";
|
||||
cah.$.AjaxResponse.SERIAL = "s";
|
||||
cah.$.AjaxResponse.PERSISTENT_ID = "pid";
|
||||
cah.$.AjaxResponse.USER_PERMALINK = "up";
|
||||
cah.$.AjaxResponse.GAMES = "gl";
|
||||
cah.$.AjaxResponse.SIGIL = "?";
|
||||
cah.$.AjaxResponse.GAME_ID = "gid";
|
||||
cah.$.AjaxResponse.MAX_GAMES = "mg";
|
||||
cah.$.AjaxResponse.IN_PROGRESS = "ip";
|
||||
cah.$.AjaxResponse.GAME_OPTIONS = "go";
|
||||
cah.$.AjaxResponse.NICKNAME = "n";
|
||||
cah.$.AjaxResponse.BLACK_CARD = "bc";
|
||||
cah.$.AjaxResponse.GAME_PERMALINK = "gp";
|
||||
cah.$.AjaxResponse.IDLE = "idl";
|
||||
cah.$.AjaxResponse.CARD_ID = "cid";
|
||||
cah.$.AjaxResponse.IP_ADDRESS = "IP";
|
||||
cah.$.AjaxResponse.SESSION_PERMALINK = "sP";
|
||||
|
||||
cah.$.GameInfo = function() {
|
||||
cah.$.BlackCardData = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.GameInfo.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GameInfo.GAME_OPTIONS = "go";
|
||||
cah.$.GameInfo.CREATED = "gca";
|
||||
cah.$.GameInfo.PLAYERS = "P";
|
||||
cah.$.GameInfo.SPECTATORS = "V";
|
||||
cah.$.GameInfo.HOST = "H";
|
||||
cah.$.GameInfo.STATE = "S";
|
||||
cah.$.GameInfo.ID = "gid";
|
||||
cah.$.GameInfo.HAS_PASSWORD = "hp";
|
||||
|
||||
cah.$.GameState = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.GameState.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GameState.ROUND_OVER = "ro";
|
||||
cah.$.GameState.LOBBY = "l";
|
||||
cah.$.GameState.JUDGING = "j";
|
||||
cah.$.GameState.PLAYING = "p";
|
||||
cah.$.GameState_msg = {};
|
||||
cah.$.GameState_msg['p'] = "In Progress";
|
||||
cah.$.GameState_msg['j'] = "In Progress";
|
||||
cah.$.GameState_msg['l'] = "Not Started";
|
||||
cah.$.GameState_msg['ro'] = "In Progress";
|
||||
cah.$.BlackCardData.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.BlackCardData.DRAW = "D";
|
||||
cah.$.BlackCardData.PICK = "PK";
|
||||
cah.$.BlackCardData.TEXT = "T";
|
||||
cah.$.BlackCardData.ID = "cid";
|
||||
cah.$.BlackCardData.WATERMARK = "W";
|
||||
|
||||
cah.$.CardSetData = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
|
@ -89,96 +110,21 @@ cah.$.CardSetData.BASE_DECK = "bd";
|
|||
cah.$.CardSetData.ID = "cid";
|
||||
cah.$.CardSetData.WEIGHT = "w";
|
||||
|
||||
cah.$.BlackCardData = function() {
|
||||
cah.$.DisconnectReason = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.BlackCardData.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.BlackCardData.DRAW = "D";
|
||||
cah.$.BlackCardData.PICK = "PK";
|
||||
cah.$.BlackCardData.TEXT = "T";
|
||||
cah.$.BlackCardData.ID = "cid";
|
||||
cah.$.BlackCardData.WATERMARK = "W";
|
||||
|
||||
cah.$.WhiteCardData = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.WhiteCardData.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.WhiteCardData.WRITE_IN = "wi";
|
||||
cah.$.WhiteCardData.TEXT = "T";
|
||||
cah.$.WhiteCardData.ID = "cid";
|
||||
cah.$.WhiteCardData.WATERMARK = "W";
|
||||
|
||||
cah.$.Sigil = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.Sigil.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.Sigil.NORMAL_USER = "";
|
||||
cah.$.Sigil.ADMIN = "@";
|
||||
cah.$.Sigil.ID_CODE = "+";
|
||||
|
||||
cah.$.LongPollResponse = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.LongPollResponse.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.LongPollResponse.PLAY_TIMER = "Pt";
|
||||
cah.$.LongPollResponse.PLAYER_INFO = "pi";
|
||||
cah.$.LongPollResponse.FROM = "f";
|
||||
cah.$.LongPollResponse.WHITE_CARDS = "wc";
|
||||
cah.$.LongPollResponse.EVENT = "E";
|
||||
cah.$.LongPollResponse.HAND = "h";
|
||||
cah.$.LongPollResponse.ERROR_CODE = "ec";
|
||||
cah.$.LongPollResponse.MESSAGE = "m";
|
||||
cah.$.LongPollResponse.WINNING_CARD = "WC";
|
||||
cah.$.LongPollResponse.FROM_ADMIN = "fa";
|
||||
cah.$.LongPollResponse.TIMESTAMP = "ts";
|
||||
cah.$.LongPollResponse.GAME_INFO = "gi";
|
||||
cah.$.LongPollResponse.ERROR = "e";
|
||||
cah.$.LongPollResponse.ID_CODE = "idc";
|
||||
cah.$.LongPollResponse.REASON = "qr";
|
||||
cah.$.LongPollResponse.WALL = "wall";
|
||||
cah.$.LongPollResponse.ROUND_WINNER = "rw";
|
||||
cah.$.LongPollResponse.SIGIL = "?";
|
||||
cah.$.LongPollResponse.EMOTE = "me";
|
||||
cah.$.LongPollResponse.CARDCAST_DECK_INFO = "cdi";
|
||||
cah.$.LongPollResponse.GAME_ID = "gid";
|
||||
cah.$.LongPollResponse.ROUND_PERMALINK = "rP";
|
||||
cah.$.LongPollResponse.NICKNAME = "n";
|
||||
cah.$.LongPollResponse.BLACK_CARD = "bc";
|
||||
cah.$.LongPollResponse.GAME_PERMALINK = "gp";
|
||||
cah.$.LongPollResponse.GAME_STATE = "gs";
|
||||
cah.$.LongPollResponse.INTERMISSION = "i";
|
||||
|
||||
cah.$.LongPollEvent = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.LongPollEvent.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.LongPollEvent.GAME_ROUND_COMPLETE = "grc";
|
||||
cah.$.LongPollEvent.BANNED = "B&";
|
||||
cah.$.LongPollEvent.NOOP = "_";
|
||||
cah.$.LongPollEvent.CHAT = "c";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_INFO_CHANGE = "gpic";
|
||||
cah.$.LongPollEvent.HAND_DEAL = "hd";
|
||||
cah.$.LongPollEvent.CARDCAST_ADD_CARDSET = "cac";
|
||||
cah.$.LongPollEvent.PLAYER_LEAVE = "pl";
|
||||
cah.$.LongPollEvent.GAME_BLACK_RESHUFFLE = "gbr";
|
||||
cah.$.LongPollEvent.GAME_JUDGE_SKIPPED = "gjs";
|
||||
cah.$.LongPollEvent.GAME_LIST_REFRESH = "glr";
|
||||
cah.$.LongPollEvent.NEW_PLAYER = "np";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_SKIPPED = "gps";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_JOIN = "gpj";
|
||||
cah.$.LongPollEvent.GAME_WHITE_RESHUFFLE = "gwr";
|
||||
cah.$.LongPollEvent.CARDCAST_REMOVE_CARDSET = "crc";
|
||||
cah.$.LongPollEvent.GAME_OPTIONS_CHANGED = "goc";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_KICKED_IDLE = "gpki";
|
||||
cah.$.LongPollEvent.GAME_SPECTATOR_LEAVE = "gvl";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_LEAVE = "gpl";
|
||||
cah.$.LongPollEvent.GAME_SPECTATOR_JOIN = "gvj";
|
||||
cah.$.LongPollEvent.HURRY_UP = "hu";
|
||||
cah.$.LongPollEvent.GAME_JUDGE_LEFT = "gjl";
|
||||
cah.$.LongPollEvent.KICKED = "k";
|
||||
cah.$.LongPollEvent.KICKED_FROM_GAME_IDLE = "kfgi";
|
||||
cah.$.LongPollEvent.FILTERED_CHAT = "FC";
|
||||
cah.$.LongPollEvent.GAME_STATE_CHANGE = "gsc";
|
||||
cah.$.DisconnectReason.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.DisconnectReason.PING_TIMEOUT = "pt";
|
||||
cah.$.DisconnectReason.BANNED = "B&";
|
||||
cah.$.DisconnectReason.IDLE_TIMEOUT = "it";
|
||||
cah.$.DisconnectReason.KICKED = "k";
|
||||
cah.$.DisconnectReason.MANUAL = "man";
|
||||
cah.$.DisconnectReason_msg = {};
|
||||
cah.$.DisconnectReason_msg['B&'] = "Banned";
|
||||
cah.$.DisconnectReason_msg['pt'] = "Ping timeout";
|
||||
cah.$.DisconnectReason_msg['it'] = "Kicked due to idle";
|
||||
cah.$.DisconnectReason_msg['k'] = "Kicked by server administrator";
|
||||
cah.$.DisconnectReason_msg['man'] = "Leaving";
|
||||
|
||||
cah.$.ErrorCode = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
|
@ -263,7 +209,7 @@ cah.$.ErrorCode_msg['B&'] = "Banned.";
|
|||
cah.$.ErrorCode_msg['mtl'] = "Messages cannot be longer than 200 characters.";
|
||||
cah.$.ErrorCode_msg['in'] = "Nickname must contain only upper and lower case letters, numbers, or underscores, must be 3 to 30 characters long, and must not start with a number.";
|
||||
cah.$.ErrorCode_msg['rW'] = "You must use more unique words in your message.";
|
||||
cah.$.ErrorCode_msg['serr'] = "An error occured on the server.";
|
||||
cah.$.ErrorCode_msg['serr'] = "An error occurred on the server.";
|
||||
cah.$.ErrorCode_msg['CL'] = "Try turning caps lock off.";
|
||||
cah.$.ErrorCode_msg['dnhc'] = "You don't have that card.";
|
||||
cah.$.ErrorCode_msg['as'] = "The game has already started.";
|
||||
|
@ -285,90 +231,144 @@ cah.$.ErrorInformation.WHITE_CARDS_REQUIRED = "wcr";
|
|||
cah.$.ErrorInformation.BLACK_CARDS_REQUIRED = "bcr";
|
||||
cah.$.ErrorInformation.BLACK_CARDS_PRESENT = "bcp";
|
||||
|
||||
cah.$.AjaxResponse = function() {
|
||||
cah.$.GameInfo = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.AjaxResponse.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.AjaxResponse.NAMES = "nl";
|
||||
cah.$.AjaxResponse.CLIENT_NAME = "cn";
|
||||
cah.$.AjaxResponse.PLAYER_INFO = "pi";
|
||||
cah.$.AjaxResponse.CONNECTED_AT = "ca";
|
||||
cah.$.AjaxResponse.WHITE_CARDS = "wc";
|
||||
cah.$.AjaxResponse.HAND = "h";
|
||||
cah.$.AjaxResponse.ERROR_CODE = "ec";
|
||||
cah.$.AjaxResponse.GLOBAL_CHAT_ENABLED = "gce";
|
||||
cah.$.AjaxResponse.SERVER_STARTED = "SS";
|
||||
cah.$.AjaxResponse.NEXT = "next";
|
||||
cah.$.AjaxResponse.GAME_INFO = "gi";
|
||||
cah.$.AjaxResponse.ERROR = "e";
|
||||
cah.$.AjaxResponse.GAME_STATE_DESCRIPTION = "gss";
|
||||
cah.$.AjaxResponse.ID_CODE = "idc";
|
||||
cah.$.AjaxResponse.CARD_SETS = "css";
|
||||
cah.$.AjaxResponse.SERIAL = "s";
|
||||
cah.$.AjaxResponse.PERSISTENT_ID = "pid";
|
||||
cah.$.AjaxResponse.USER_PERMALINK = "up";
|
||||
cah.$.AjaxResponse.GAMES = "gl";
|
||||
cah.$.AjaxResponse.SIGIL = "?";
|
||||
cah.$.AjaxResponse.GAME_ID = "gid";
|
||||
cah.$.AjaxResponse.MAX_GAMES = "mg";
|
||||
cah.$.AjaxResponse.IN_PROGRESS = "ip";
|
||||
cah.$.AjaxResponse.GAME_OPTIONS = "go";
|
||||
cah.$.AjaxResponse.NICKNAME = "n";
|
||||
cah.$.AjaxResponse.BLACK_CARD = "bc";
|
||||
cah.$.AjaxResponse.GAME_PERMALINK = "gp";
|
||||
cah.$.AjaxResponse.IDLE = "idl";
|
||||
cah.$.AjaxResponse.CARD_ID = "cid";
|
||||
cah.$.AjaxResponse.IP_ADDRESS = "IP";
|
||||
cah.$.AjaxResponse.SESSION_PERMALINK = "sP";
|
||||
cah.$.GameInfo.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GameInfo.GAME_OPTIONS = "go";
|
||||
cah.$.GameInfo.CREATED = "gca";
|
||||
cah.$.GameInfo.PLAYERS = "P";
|
||||
cah.$.GameInfo.SPECTATORS = "V";
|
||||
cah.$.GameInfo.HOST = "H";
|
||||
cah.$.GameInfo.STATE = "S";
|
||||
cah.$.GameInfo.ID = "gid";
|
||||
cah.$.GameInfo.HAS_PASSWORD = "hp";
|
||||
|
||||
cah.$.AjaxRequest = function() {
|
||||
cah.$.GameOptionData = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.AjaxRequest.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.AjaxRequest.SERIAL = "s";
|
||||
cah.$.AjaxRequest.OP = "o";
|
||||
cah.$.AjaxRequest.WALL = "wall";
|
||||
cah.$.AjaxRequest.PERSISTENT_ID = "pid";
|
||||
cah.$.AjaxRequest.EMOTE = "me";
|
||||
cah.$.AjaxRequest.CARDCAST_ID = "cci";
|
||||
cah.$.AjaxRequest.GAME_ID = "gid";
|
||||
cah.$.AjaxRequest.GAME_OPTIONS = "go";
|
||||
cah.$.AjaxRequest.MESSAGE = "m";
|
||||
cah.$.AjaxRequest.NICKNAME = "n";
|
||||
cah.$.AjaxRequest.PASSWORD = "pw";
|
||||
cah.$.AjaxRequest.CARD_ID = "cid";
|
||||
cah.$.AjaxRequest.ID_CODE = "idc";
|
||||
cah.$.GameOptionData.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GameOptionData.TIMER_MULTIPLIER = "tm";
|
||||
cah.$.GameOptionData.PASSWORD = "pw";
|
||||
cah.$.GameOptionData.SPECTATOR_LIMIT = "vL";
|
||||
cah.$.GameOptionData.SCORE_LIMIT = "sl";
|
||||
cah.$.GameOptionData.BLANKS_LIMIT = "bl";
|
||||
cah.$.GameOptionData.PLAYER_LIMIT = "pL";
|
||||
cah.$.GameOptionData.CARD_SETS = "css";
|
||||
|
||||
cah.$.AjaxOperation = function() {
|
||||
cah.$.GamePlayerInfo = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.AjaxOperation.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.AjaxOperation.NAMES = "gn";
|
||||
cah.$.AjaxOperation.SCORE = "SC";
|
||||
cah.$.AjaxOperation.LEAVE_GAME = "lg";
|
||||
cah.$.AjaxOperation.JOIN_GAME = "jg";
|
||||
cah.$.AjaxOperation.CHAT = "c";
|
||||
cah.$.AjaxOperation.GAME_LIST = "ggl";
|
||||
cah.$.AjaxOperation.CARDCAST_ADD_CARDSET = "cac";
|
||||
cah.$.AjaxOperation.CARDCAST_LIST_CARDSETS = "clc";
|
||||
cah.$.AjaxOperation.PLAY_CARD = "pc";
|
||||
cah.$.AjaxOperation.CHANGE_GAME_OPTIONS = "cgo";
|
||||
cah.$.AjaxOperation.GET_GAME_INFO = "ggi";
|
||||
cah.$.AjaxOperation.GET_CARDS = "gc";
|
||||
cah.$.AjaxOperation.ADMIN_SET_VERBOSE_LOG = "svl";
|
||||
cah.$.AjaxOperation.REGISTER = "r";
|
||||
cah.$.AjaxOperation.CARDCAST_REMOVE_CARDSET = "crc";
|
||||
cah.$.AjaxOperation.WHOIS = "Wi";
|
||||
cah.$.AjaxOperation.KICK = "K";
|
||||
cah.$.AjaxOperation.FIRST_LOAD = "fl";
|
||||
cah.$.AjaxOperation.START_GAME = "sg";
|
||||
cah.$.AjaxOperation.LOG_OUT = "lo";
|
||||
cah.$.AjaxOperation.BAN = "b";
|
||||
cah.$.AjaxOperation.CREATE_GAME = "cg";
|
||||
cah.$.AjaxOperation.STOP_GAME = "Sg";
|
||||
cah.$.AjaxOperation.GAME_CHAT = "GC";
|
||||
cah.$.AjaxOperation.SPECTATE_GAME = "vg";
|
||||
cah.$.AjaxOperation.JUDGE_SELECT = "js";
|
||||
cah.$.GamePlayerInfo.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GamePlayerInfo.STATUS = "st";
|
||||
cah.$.GamePlayerInfo.SCORE = "sc";
|
||||
cah.$.GamePlayerInfo.NAME = "N";
|
||||
|
||||
cah.$.GamePlayerStatus = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.GamePlayerStatus.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GamePlayerStatus.SPECTATOR = "sv";
|
||||
cah.$.GamePlayerStatus.WINNER = "sw";
|
||||
cah.$.GamePlayerStatus.IDLE = "si";
|
||||
cah.$.GamePlayerStatus.HOST = "sh";
|
||||
cah.$.GamePlayerStatus.JUDGING = "sjj";
|
||||
cah.$.GamePlayerStatus.JUDGE = "sj";
|
||||
cah.$.GamePlayerStatus.PLAYING = "sp";
|
||||
cah.$.GamePlayerStatus_msg = {};
|
||||
cah.$.GamePlayerStatus_msg['sjj'] = "Selecting";
|
||||
cah.$.GamePlayerStatus_msg['sv'] = "Spectator";
|
||||
cah.$.GamePlayerStatus_msg['sw'] = "Winner!";
|
||||
cah.$.GamePlayerStatus_msg['sh'] = "Host";
|
||||
cah.$.GamePlayerStatus_msg['si'] = "";
|
||||
cah.$.GamePlayerStatus_msg['sj'] = "Card Czar";
|
||||
cah.$.GamePlayerStatus_msg['sp'] = "Playing";
|
||||
cah.$.GamePlayerStatus_msg_2 = {};
|
||||
cah.$.GamePlayerStatus_msg_2['sjj'] = "Select a winning card.";
|
||||
cah.$.GamePlayerStatus_msg_2['sv'] = "You are just spectating.";
|
||||
cah.$.GamePlayerStatus_msg_2['sw'] = "You have won!";
|
||||
cah.$.GamePlayerStatus_msg_2['sh'] = "Wait for players then click Start Game.";
|
||||
cah.$.GamePlayerStatus_msg_2['si'] = "Waiting for players...";
|
||||
cah.$.GamePlayerStatus_msg_2['sj'] = "You are the Card Czar.";
|
||||
cah.$.GamePlayerStatus_msg_2['sp'] = "Select a card to play.";
|
||||
|
||||
cah.$.GameState = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.GameState.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.GameState.ROUND_OVER = "ro";
|
||||
cah.$.GameState.LOBBY = "l";
|
||||
cah.$.GameState.JUDGING = "j";
|
||||
cah.$.GameState.PLAYING = "p";
|
||||
cah.$.GameState_msg = {};
|
||||
cah.$.GameState_msg['p'] = "In Progress";
|
||||
cah.$.GameState_msg['j'] = "In Progress";
|
||||
cah.$.GameState_msg['l'] = "Not Started";
|
||||
cah.$.GameState_msg['ro'] = "In Progress";
|
||||
|
||||
cah.$.LongPollEvent = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.LongPollEvent.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.LongPollEvent.GAME_ROUND_COMPLETE = "grc";
|
||||
cah.$.LongPollEvent.BANNED = "B&";
|
||||
cah.$.LongPollEvent.NOOP = "_";
|
||||
cah.$.LongPollEvent.CHAT = "c";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_INFO_CHANGE = "gpic";
|
||||
cah.$.LongPollEvent.HAND_DEAL = "hd";
|
||||
cah.$.LongPollEvent.CARDCAST_ADD_CARDSET = "cac";
|
||||
cah.$.LongPollEvent.PLAYER_LEAVE = "pl";
|
||||
cah.$.LongPollEvent.GAME_BLACK_RESHUFFLE = "gbr";
|
||||
cah.$.LongPollEvent.GAME_JUDGE_SKIPPED = "gjs";
|
||||
cah.$.LongPollEvent.GAME_LIST_REFRESH = "glr";
|
||||
cah.$.LongPollEvent.NEW_PLAYER = "np";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_SKIPPED = "gps";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_JOIN = "gpj";
|
||||
cah.$.LongPollEvent.GAME_WHITE_RESHUFFLE = "gwr";
|
||||
cah.$.LongPollEvent.CARDCAST_REMOVE_CARDSET = "crc";
|
||||
cah.$.LongPollEvent.GAME_OPTIONS_CHANGED = "goc";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_KICKED_IDLE = "gpki";
|
||||
cah.$.LongPollEvent.GAME_SPECTATOR_LEAVE = "gvl";
|
||||
cah.$.LongPollEvent.GAME_PLAYER_LEAVE = "gpl";
|
||||
cah.$.LongPollEvent.GAME_SPECTATOR_JOIN = "gvj";
|
||||
cah.$.LongPollEvent.HURRY_UP = "hu";
|
||||
cah.$.LongPollEvent.GAME_JUDGE_LEFT = "gjl";
|
||||
cah.$.LongPollEvent.KICKED = "k";
|
||||
cah.$.LongPollEvent.KICKED_FROM_GAME_IDLE = "kfgi";
|
||||
cah.$.LongPollEvent.FILTERED_CHAT = "FC";
|
||||
cah.$.LongPollEvent.GAME_STATE_CHANGE = "gsc";
|
||||
|
||||
cah.$.LongPollResponse = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.LongPollResponse.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.LongPollResponse.PLAY_TIMER = "Pt";
|
||||
cah.$.LongPollResponse.PLAYER_INFO = "pi";
|
||||
cah.$.LongPollResponse.FROM = "f";
|
||||
cah.$.LongPollResponse.WHITE_CARDS = "wc";
|
||||
cah.$.LongPollResponse.EVENT = "E";
|
||||
cah.$.LongPollResponse.HAND = "h";
|
||||
cah.$.LongPollResponse.ERROR_CODE = "ec";
|
||||
cah.$.LongPollResponse.MESSAGE = "m";
|
||||
cah.$.LongPollResponse.WINNING_CARD = "WC";
|
||||
cah.$.LongPollResponse.FROM_ADMIN = "fa";
|
||||
cah.$.LongPollResponse.TIMESTAMP = "ts";
|
||||
cah.$.LongPollResponse.GAME_INFO = "gi";
|
||||
cah.$.LongPollResponse.ERROR = "e";
|
||||
cah.$.LongPollResponse.ID_CODE = "idc";
|
||||
cah.$.LongPollResponse.REASON = "qr";
|
||||
cah.$.LongPollResponse.WALL = "wall";
|
||||
cah.$.LongPollResponse.ROUND_WINNER = "rw";
|
||||
cah.$.LongPollResponse.SIGIL = "?";
|
||||
cah.$.LongPollResponse.EMOTE = "me";
|
||||
cah.$.LongPollResponse.CARDCAST_DECK_INFO = "cdi";
|
||||
cah.$.LongPollResponse.GAME_ID = "gid";
|
||||
cah.$.LongPollResponse.ROUND_PERMALINK = "rP";
|
||||
cah.$.LongPollResponse.NICKNAME = "n";
|
||||
cah.$.LongPollResponse.BLACK_CARD = "bc";
|
||||
cah.$.LongPollResponse.GAME_PERMALINK = "gp";
|
||||
cah.$.LongPollResponse.GAME_STATE = "gs";
|
||||
cah.$.LongPollResponse.INTERMISSION = "i";
|
||||
|
||||
cah.$.ReconnectNextAction = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
|
@ -377,19 +377,20 @@ cah.$.ReconnectNextAction.prototype.dummyForAutocomplete = undefined;
|
|||
cah.$.ReconnectNextAction.GAME = "game";
|
||||
cah.$.ReconnectNextAction.NONE = "none";
|
||||
|
||||
cah.$.DisconnectReason = function() {
|
||||
cah.$.Sigil = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.DisconnectReason.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.DisconnectReason.PING_TIMEOUT = "pt";
|
||||
cah.$.DisconnectReason.BANNED = "B&";
|
||||
cah.$.DisconnectReason.IDLE_TIMEOUT = "it";
|
||||
cah.$.DisconnectReason.KICKED = "k";
|
||||
cah.$.DisconnectReason.MANUAL = "man";
|
||||
cah.$.DisconnectReason_msg = {};
|
||||
cah.$.DisconnectReason_msg['B&'] = "Banned";
|
||||
cah.$.DisconnectReason_msg['pt'] = "Ping timeout";
|
||||
cah.$.DisconnectReason_msg['it'] = "Kicked due to idle";
|
||||
cah.$.DisconnectReason_msg['k'] = "Kicked by server administrator";
|
||||
cah.$.DisconnectReason_msg['man'] = "Leaving";
|
||||
cah.$.Sigil.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.Sigil.NORMAL_USER = "";
|
||||
cah.$.Sigil.ADMIN = "@";
|
||||
cah.$.Sigil.ID_CODE = "+";
|
||||
|
||||
cah.$.WhiteCardData = function() {
|
||||
// Dummy constructor to make Eclipse auto-complete.
|
||||
};
|
||||
cah.$.WhiteCardData.prototype.dummyForAutocomplete = undefined;
|
||||
cah.$.WhiteCardData.WRITE_IN = "wi";
|
||||
cah.$.WhiteCardData.TEXT = "T";
|
||||
cah.$.WhiteCardData.ID = "cid";
|
||||
cah.$.WhiteCardData.WATERMARK = "W";
|
||||
|
||||
|
|
|
@ -335,6 +335,9 @@ cah.Game.joinGame = function(gameId, data) {
|
|||
game.showGamePermalink_(data);
|
||||
|
||||
cah.updateHash('game=' + gameId);
|
||||
if (!cah.GAME_CHAT_ENABLED) {
|
||||
cah.log.status_with_game(game, "IMPORTANT: Game chat has been disabled.", "error");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ pyx.max_games=25
|
|||
pyx.include_inactive_cardsets=true
|
||||
pyx.broadcast_connects_and_disconnects=true
|
||||
pyx.global_chat_enabled=true
|
||||
pyx.game_chat_enabled=true
|
||||
# allow fill-in-the-blank cards at all. Limits are set via constants in GameOptions.
|
||||
pyx.allow_blank_cards=true
|
||||
# allow identification codes to be used without HTTPS
|
||||
|
|
712
constants.go
712
constants.go
|
@ -4,111 +4,158 @@ package pyx
|
|||
|
||||
import ()
|
||||
|
||||
// GamePlayerStatus
|
||||
// AjaxOperation
|
||||
const (
|
||||
GamePlayerStatus_SPECTATOR = "sv"
|
||||
GamePlayerStatus_WINNER = "sw"
|
||||
GamePlayerStatus_IDLE = "si"
|
||||
GamePlayerStatus_HOST = "sh"
|
||||
GamePlayerStatus_JUDGING = "sjj"
|
||||
GamePlayerStatus_JUDGE = "sj"
|
||||
GamePlayerStatus_PLAYING = "sp"
|
||||
AjaxOperation_NAMES = "gn"
|
||||
AjaxOperation_SCORE = "SC"
|
||||
AjaxOperation_LEAVE_GAME = "lg"
|
||||
AjaxOperation_JOIN_GAME = "jg"
|
||||
AjaxOperation_CHAT = "c"
|
||||
AjaxOperation_GAME_LIST = "ggl"
|
||||
AjaxOperation_CARDCAST_ADD_CARDSET = "cac"
|
||||
AjaxOperation_CARDCAST_LIST_CARDSETS = "clc"
|
||||
AjaxOperation_PLAY_CARD = "pc"
|
||||
AjaxOperation_CHANGE_GAME_OPTIONS = "cgo"
|
||||
AjaxOperation_GET_GAME_INFO = "ggi"
|
||||
AjaxOperation_GET_CARDS = "gc"
|
||||
AjaxOperation_ADMIN_SET_VERBOSE_LOG = "svl"
|
||||
AjaxOperation_REGISTER = "r"
|
||||
AjaxOperation_CARDCAST_REMOVE_CARDSET = "crc"
|
||||
AjaxOperation_WHOIS = "Wi"
|
||||
AjaxOperation_KICK = "K"
|
||||
AjaxOperation_FIRST_LOAD = "fl"
|
||||
AjaxOperation_START_GAME = "sg"
|
||||
AjaxOperation_LOG_OUT = "lo"
|
||||
AjaxOperation_BAN = "b"
|
||||
AjaxOperation_CREATE_GAME = "cg"
|
||||
AjaxOperation_STOP_GAME = "Sg"
|
||||
AjaxOperation_GAME_CHAT = "GC"
|
||||
AjaxOperation_SPECTATE_GAME = "vg"
|
||||
AjaxOperation_JUDGE_SELECT = "js"
|
||||
)
|
||||
|
||||
var GamePlayerStatusMsgs = map[string]string{
|
||||
"sjj": "Selecting",
|
||||
"sv": "Spectator",
|
||||
"sw": "Winner!",
|
||||
"sh": "Host",
|
||||
"si": "",
|
||||
"sj": "Card Czar",
|
||||
"sp": "Playing",
|
||||
}
|
||||
|
||||
var GamePlayerStatusMsgs2 = map[string]string{
|
||||
"sjj": "Select a winning card.",
|
||||
"sv": "You are just spectating.",
|
||||
"sw": "You have won!",
|
||||
"sh": "Wait for players then click Start Game.",
|
||||
"si": "Waiting for players...",
|
||||
"sj": "You are the Card Czar.",
|
||||
"sp": "Select a card to play.",
|
||||
}
|
||||
|
||||
|
||||
// GamePlayerInfo
|
||||
// AjaxRequest
|
||||
const (
|
||||
GamePlayerInfo_STATUS = "st"
|
||||
GamePlayerInfo_SCORE = "sc"
|
||||
GamePlayerInfo_NAME = "N"
|
||||
AjaxRequest_SERIAL = "s"
|
||||
AjaxRequest_OP = "o"
|
||||
AjaxRequest_WALL = "wall"
|
||||
AjaxRequest_PERSISTENT_ID = "pid"
|
||||
AjaxRequest_EMOTE = "me"
|
||||
AjaxRequest_CARDCAST_ID = "cci"
|
||||
AjaxRequest_GAME_ID = "gid"
|
||||
AjaxRequest_GAME_OPTIONS = "go"
|
||||
AjaxRequest_MESSAGE = "m"
|
||||
AjaxRequest_NICKNAME = "n"
|
||||
AjaxRequest_PASSWORD = "pw"
|
||||
AjaxRequest_CARD_ID = "cid"
|
||||
AjaxRequest_ID_CODE = "idc"
|
||||
)
|
||||
|
||||
type GamePlayerInfo struct {
|
||||
Status string `json:"st"`
|
||||
Score int `json:"sc"`
|
||||
Name string `json:"N"`
|
||||
}
|
||||
|
||||
|
||||
// GameOptionData
|
||||
const (
|
||||
GameOptionData_TIMER_MULTIPLIER = "tm"
|
||||
GameOptionData_PASSWORD = "pw"
|
||||
GameOptionData_SPECTATOR_LIMIT = "vL"
|
||||
GameOptionData_SCORE_LIMIT = "sl"
|
||||
GameOptionData_BLANKS_LIMIT = "bl"
|
||||
GameOptionData_PLAYER_LIMIT = "pL"
|
||||
GameOptionData_CARD_SETS = "css"
|
||||
)
|
||||
|
||||
type GameOptionData struct {
|
||||
TimerMultiplier string `json:"tm"`
|
||||
Password string `json:"pw"`
|
||||
SpectatorLimit int `json:"vL"`
|
||||
ScoreLimit int `json:"sl"`
|
||||
BlanksLimit int `json:"bl"`
|
||||
PlayerLimit int `json:"pL"`
|
||||
CardSets []int `json:"css"`
|
||||
}
|
||||
|
||||
|
||||
// GameInfo
|
||||
const (
|
||||
GameInfo_GAME_OPTIONS = "go"
|
||||
GameInfo_CREATED = "gca"
|
||||
GameInfo_PLAYERS = "P"
|
||||
GameInfo_SPECTATORS = "V"
|
||||
GameInfo_HOST = "H"
|
||||
GameInfo_STATE = "S"
|
||||
GameInfo_ID = "gid"
|
||||
GameInfo_HAS_PASSWORD = "hp"
|
||||
)
|
||||
|
||||
type GameInfo struct {
|
||||
type AjaxRequest struct {
|
||||
Serial int `json:"s"`
|
||||
Op string `json:"o"`
|
||||
Wall bool `json:"wall"`
|
||||
PersistentId string `json:"pid"`
|
||||
Emote bool `json:"me"`
|
||||
CardcastId string `json:"cci"`
|
||||
GameId int `json:"gid"`
|
||||
GameOptions GameOptionData `json:"go"`
|
||||
Created int64 `json:"gca"`
|
||||
Players []string `json:"P"`
|
||||
Spectators []string `json:"V"`
|
||||
Host string `json:"H"`
|
||||
State string `json:"S"`
|
||||
Id int `json:"gid"`
|
||||
HasPassword bool `json:"hp"`
|
||||
Message string `json:"m"`
|
||||
Nickname string `json:"n"`
|
||||
Password string `json:"pw"`
|
||||
CardId int `json:"cid"`
|
||||
IdCode string `json:"idc"`
|
||||
}
|
||||
|
||||
|
||||
// GameState
|
||||
// AjaxResponse
|
||||
const (
|
||||
GameState_ROUND_OVER = "ro"
|
||||
GameState_LOBBY = "l"
|
||||
GameState_JUDGING = "j"
|
||||
GameState_PLAYING = "p"
|
||||
AjaxResponse_NAMES = "nl"
|
||||
AjaxResponse_CLIENT_NAME = "cn"
|
||||
AjaxResponse_GAME_CHAT_ENABLED = "Gce"
|
||||
AjaxResponse_PLAYER_INFO = "pi"
|
||||
AjaxResponse_CONNECTED_AT = "ca"
|
||||
AjaxResponse_WHITE_CARDS = "wc"
|
||||
AjaxResponse_HAND = "h"
|
||||
AjaxResponse_ERROR_CODE = "ec"
|
||||
AjaxResponse_GLOBAL_CHAT_ENABLED = "gce"
|
||||
AjaxResponse_SERVER_STARTED = "SS"
|
||||
AjaxResponse_NEXT = "next"
|
||||
AjaxResponse_GAME_INFO = "gi"
|
||||
AjaxResponse_ERROR = "e"
|
||||
AjaxResponse_GAME_STATE_DESCRIPTION = "gss"
|
||||
AjaxResponse_ID_CODE = "idc"
|
||||
AjaxResponse_CARD_SETS = "css"
|
||||
AjaxResponse_SERIAL = "s"
|
||||
AjaxResponse_PERSISTENT_ID = "pid"
|
||||
AjaxResponse_USER_PERMALINK = "up"
|
||||
AjaxResponse_GAMES = "gl"
|
||||
AjaxResponse_SIGIL = "?"
|
||||
AjaxResponse_GAME_ID = "gid"
|
||||
AjaxResponse_MAX_GAMES = "mg"
|
||||
AjaxResponse_IN_PROGRESS = "ip"
|
||||
AjaxResponse_GAME_OPTIONS = "go"
|
||||
AjaxResponse_NICKNAME = "n"
|
||||
AjaxResponse_BLACK_CARD = "bc"
|
||||
AjaxResponse_GAME_PERMALINK = "gp"
|
||||
AjaxResponse_IDLE = "idl"
|
||||
AjaxResponse_CARD_ID = "cid"
|
||||
AjaxResponse_IP_ADDRESS = "IP"
|
||||
AjaxResponse_SESSION_PERMALINK = "sP"
|
||||
)
|
||||
|
||||
var GameStateMsgs = map[string]string{
|
||||
"p": "In Progress",
|
||||
"j": "In Progress",
|
||||
"l": "Not Started",
|
||||
"ro": "In Progress",
|
||||
type AjaxResponse struct {
|
||||
Names []string `json:"nl"`
|
||||
ClientName string `json:"cn"`
|
||||
GameChatEnabled bool `json:"Gce"`
|
||||
PlayerInfo []GamePlayerInfo `json:"pi"`
|
||||
ConnectedAt int64 `json:"ca"`
|
||||
WhiteCards []int `json:"wc"`
|
||||
Hand []int `json:"h"`
|
||||
ErrorCode string `json:"ec"`
|
||||
GlobalChatEnabled bool `json:"gce"`
|
||||
ServerStarted int64 `json:"SS"`
|
||||
Next string `json:"next"`
|
||||
GameInfo GameInfo `json:"gi"`
|
||||
Error bool `json:"e"`
|
||||
GameStateDescription string `json:"gss"`
|
||||
IdCode string `json:"idc"`
|
||||
CardSets []CardSetData `json:"css"`
|
||||
Serial int `json:"s"`
|
||||
PersistentId string `json:"pid"`
|
||||
UserPermalink string `json:"up"`
|
||||
Games []GameInfo `json:"gl"`
|
||||
Sigil string `json:"?"`
|
||||
GameId *int `json:"gid"`
|
||||
MaxGames int `json:"mg"`
|
||||
InProgress bool `json:"ip"`
|
||||
GameOptions GameOptionData `json:"go"`
|
||||
Nickname string `json:"n"`
|
||||
BlackCard int `json:"bc"`
|
||||
GamePermalink string `json:"gp"`
|
||||
Idle int64 `json:"idl"`
|
||||
CardId int `json:"cid"`
|
||||
IpAddress string `json:"IP"`
|
||||
SessionPermalink string `json:"sP"`
|
||||
}
|
||||
|
||||
|
||||
// BlackCardData
|
||||
const (
|
||||
BlackCardData_DRAW = "D"
|
||||
BlackCardData_PICK = "PK"
|
||||
BlackCardData_TEXT = "T"
|
||||
BlackCardData_ID = "cid"
|
||||
BlackCardData_WATERMARK = "W"
|
||||
)
|
||||
|
||||
type BlackCardData struct {
|
||||
Draw int `json:"D"`
|
||||
Pick int `json:"PK"`
|
||||
Text string `json:"T"`
|
||||
Id int `json:"cid"`
|
||||
Watermark string `json:"W"`
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,142 +181,24 @@ type CardSetData struct {
|
|||
}
|
||||
|
||||
|
||||
// BlackCardData
|
||||
// DisconnectReason
|
||||
const (
|
||||
BlackCardData_DRAW = "D"
|
||||
BlackCardData_PICK = "PK"
|
||||
BlackCardData_TEXT = "T"
|
||||
BlackCardData_ID = "cid"
|
||||
BlackCardData_WATERMARK = "W"
|
||||
DisconnectReason_PING_TIMEOUT = "pt"
|
||||
DisconnectReason_BANNED = "B&"
|
||||
DisconnectReason_IDLE_TIMEOUT = "it"
|
||||
DisconnectReason_KICKED = "k"
|
||||
DisconnectReason_MANUAL = "man"
|
||||
)
|
||||
|
||||
type BlackCardData struct {
|
||||
Draw int `json:"D"`
|
||||
Pick int `json:"PK"`
|
||||
Text string `json:"T"`
|
||||
Id int `json:"cid"`
|
||||
Watermark string `json:"W"`
|
||||
var DisconnectReasonMsgs = map[string]string{
|
||||
"B&": "Banned",
|
||||
"pt": "Ping timeout",
|
||||
"it": "Kicked due to idle",
|
||||
"k": "Kicked by server administrator",
|
||||
"man": "Leaving",
|
||||
}
|
||||
|
||||
|
||||
// WhiteCardData
|
||||
const (
|
||||
WhiteCardData_WRITE_IN = "wi"
|
||||
WhiteCardData_TEXT = "T"
|
||||
WhiteCardData_ID = "cid"
|
||||
WhiteCardData_WATERMARK = "W"
|
||||
)
|
||||
|
||||
type WhiteCardData struct {
|
||||
WriteIn bool `json:"wi"`
|
||||
Text string `json:"T"`
|
||||
Id int `json:"cid"`
|
||||
Watermark string `json:"W"`
|
||||
}
|
||||
|
||||
|
||||
// Sigil
|
||||
const (
|
||||
Sigil_NORMAL_USER = ""
|
||||
Sigil_ADMIN = "@"
|
||||
Sigil_ID_CODE = "+"
|
||||
)
|
||||
|
||||
|
||||
// LongPollResponse
|
||||
const (
|
||||
LongPollResponse_PLAY_TIMER = "Pt"
|
||||
LongPollResponse_PLAYER_INFO = "pi"
|
||||
LongPollResponse_FROM = "f"
|
||||
LongPollResponse_WHITE_CARDS = "wc"
|
||||
LongPollResponse_EVENT = "E"
|
||||
LongPollResponse_HAND = "h"
|
||||
LongPollResponse_ERROR_CODE = "ec"
|
||||
LongPollResponse_MESSAGE = "m"
|
||||
LongPollResponse_WINNING_CARD = "WC"
|
||||
LongPollResponse_FROM_ADMIN = "fa"
|
||||
LongPollResponse_TIMESTAMP = "ts"
|
||||
LongPollResponse_GAME_INFO = "gi"
|
||||
LongPollResponse_ERROR = "e"
|
||||
LongPollResponse_ID_CODE = "idc"
|
||||
LongPollResponse_REASON = "qr"
|
||||
LongPollResponse_WALL = "wall"
|
||||
LongPollResponse_ROUND_WINNER = "rw"
|
||||
LongPollResponse_SIGIL = "?"
|
||||
LongPollResponse_EMOTE = "me"
|
||||
LongPollResponse_CARDCAST_DECK_INFO = "cdi"
|
||||
LongPollResponse_GAME_ID = "gid"
|
||||
LongPollResponse_ROUND_PERMALINK = "rP"
|
||||
LongPollResponse_NICKNAME = "n"
|
||||
LongPollResponse_BLACK_CARD = "bc"
|
||||
LongPollResponse_GAME_PERMALINK = "gp"
|
||||
LongPollResponse_GAME_STATE = "gs"
|
||||
LongPollResponse_INTERMISSION = "i"
|
||||
)
|
||||
|
||||
type LongPollResponse struct {
|
||||
PlayTimer int `json:"Pt"`
|
||||
PlayerInfo []GamePlayerInfo `json:"pi"`
|
||||
From string `json:"f"`
|
||||
WhiteCards [][]WhiteCardData `json:"wc"`
|
||||
Event string `json:"E"`
|
||||
Hand []WhiteCardData `json:"h"`
|
||||
ErrorCode string `json:"ec"`
|
||||
Message string `json:"m"`
|
||||
WinningCard int `json:"WC"`
|
||||
FromAdmin bool `json:"fa"`
|
||||
Timestamp int64 `json:"ts"`
|
||||
GameInfo GameInfo `json:"gi"`
|
||||
Error bool `json:"e"`
|
||||
IdCode string `json:"idc"`
|
||||
Reason string `json:"qr"`
|
||||
Wall bool `json:"wall"`
|
||||
RoundWinner string `json:"rw"`
|
||||
Sigil string `json:"?"`
|
||||
Emote bool `json:"me"`
|
||||
CardcastDeckInfo string `json:"cdi"`
|
||||
GameId *int `json:"gid"`
|
||||
RoundPermalink string `json:"rP"`
|
||||
Nickname string `json:"n"`
|
||||
BlackCard BlackCardData `json:"bc"`
|
||||
GamePermalink string `json:"gp"`
|
||||
GameState string `json:"gs"`
|
||||
Intermission int `json:"i"`
|
||||
}
|
||||
|
||||
|
||||
// LongPollEvent
|
||||
const (
|
||||
LongPollEvent_GAME_ROUND_COMPLETE = "grc"
|
||||
LongPollEvent_BANNED = "B&"
|
||||
LongPollEvent_NOOP = "_"
|
||||
LongPollEvent_CHAT = "c"
|
||||
LongPollEvent_GAME_PLAYER_INFO_CHANGE = "gpic"
|
||||
LongPollEvent_HAND_DEAL = "hd"
|
||||
LongPollEvent_CARDCAST_ADD_CARDSET = "cac"
|
||||
LongPollEvent_PLAYER_LEAVE = "pl"
|
||||
LongPollEvent_GAME_BLACK_RESHUFFLE = "gbr"
|
||||
LongPollEvent_GAME_JUDGE_SKIPPED = "gjs"
|
||||
LongPollEvent_GAME_LIST_REFRESH = "glr"
|
||||
LongPollEvent_NEW_PLAYER = "np"
|
||||
LongPollEvent_GAME_PLAYER_SKIPPED = "gps"
|
||||
LongPollEvent_GAME_PLAYER_JOIN = "gpj"
|
||||
LongPollEvent_GAME_WHITE_RESHUFFLE = "gwr"
|
||||
LongPollEvent_CARDCAST_REMOVE_CARDSET = "crc"
|
||||
LongPollEvent_GAME_OPTIONS_CHANGED = "goc"
|
||||
LongPollEvent_GAME_PLAYER_KICKED_IDLE = "gpki"
|
||||
LongPollEvent_GAME_SPECTATOR_LEAVE = "gvl"
|
||||
LongPollEvent_GAME_PLAYER_LEAVE = "gpl"
|
||||
LongPollEvent_GAME_SPECTATOR_JOIN = "gvj"
|
||||
LongPollEvent_HURRY_UP = "hu"
|
||||
LongPollEvent_GAME_JUDGE_LEFT = "gjl"
|
||||
LongPollEvent_KICKED = "k"
|
||||
LongPollEvent_KICKED_FROM_GAME_IDLE = "kfgi"
|
||||
LongPollEvent_FILTERED_CHAT = "FC"
|
||||
LongPollEvent_GAME_STATE_CHANGE = "gsc"
|
||||
)
|
||||
|
||||
|
||||
// ErrorCode
|
||||
const (
|
||||
ErrorCode_INVALID_NICK = "in"
|
||||
|
@ -353,7 +282,7 @@ var ErrorCodeMsgs = map[string]string{
|
|||
"mtl": "Messages cannot be longer than 200 characters.",
|
||||
"in": "Nickname must contain only upper and lower case letters, numbers, or underscores, must be 3 to 30 characters long, and must not start with a number.",
|
||||
"rW": "You must use more unique words in your message.",
|
||||
"serr": "An error occured on the server.",
|
||||
"serr": "An error occurred on the server.",
|
||||
"CL": "Try turning caps lock off.",
|
||||
"dnhc": "You don't have that card.",
|
||||
"as": "The game has already started.",
|
||||
|
@ -377,141 +306,208 @@ const (
|
|||
)
|
||||
|
||||
|
||||
// AjaxResponse
|
||||
// GameInfo
|
||||
const (
|
||||
AjaxResponse_NAMES = "nl"
|
||||
AjaxResponse_CLIENT_NAME = "cn"
|
||||
AjaxResponse_PLAYER_INFO = "pi"
|
||||
AjaxResponse_CONNECTED_AT = "ca"
|
||||
AjaxResponse_WHITE_CARDS = "wc"
|
||||
AjaxResponse_HAND = "h"
|
||||
AjaxResponse_ERROR_CODE = "ec"
|
||||
AjaxResponse_GLOBAL_CHAT_ENABLED = "gce"
|
||||
AjaxResponse_SERVER_STARTED = "SS"
|
||||
AjaxResponse_NEXT = "next"
|
||||
AjaxResponse_GAME_INFO = "gi"
|
||||
AjaxResponse_ERROR = "e"
|
||||
AjaxResponse_GAME_STATE_DESCRIPTION = "gss"
|
||||
AjaxResponse_ID_CODE = "idc"
|
||||
AjaxResponse_CARD_SETS = "css"
|
||||
AjaxResponse_SERIAL = "s"
|
||||
AjaxResponse_PERSISTENT_ID = "pid"
|
||||
AjaxResponse_USER_PERMALINK = "up"
|
||||
AjaxResponse_GAMES = "gl"
|
||||
AjaxResponse_SIGIL = "?"
|
||||
AjaxResponse_GAME_ID = "gid"
|
||||
AjaxResponse_MAX_GAMES = "mg"
|
||||
AjaxResponse_IN_PROGRESS = "ip"
|
||||
AjaxResponse_GAME_OPTIONS = "go"
|
||||
AjaxResponse_NICKNAME = "n"
|
||||
AjaxResponse_BLACK_CARD = "bc"
|
||||
AjaxResponse_GAME_PERMALINK = "gp"
|
||||
AjaxResponse_IDLE = "idl"
|
||||
AjaxResponse_CARD_ID = "cid"
|
||||
AjaxResponse_IP_ADDRESS = "IP"
|
||||
AjaxResponse_SESSION_PERMALINK = "sP"
|
||||
GameInfo_GAME_OPTIONS = "go"
|
||||
GameInfo_CREATED = "gca"
|
||||
GameInfo_PLAYERS = "P"
|
||||
GameInfo_SPECTATORS = "V"
|
||||
GameInfo_HOST = "H"
|
||||
GameInfo_STATE = "S"
|
||||
GameInfo_ID = "gid"
|
||||
GameInfo_HAS_PASSWORD = "hp"
|
||||
)
|
||||
|
||||
type AjaxResponse struct {
|
||||
Names []string `json:"nl"`
|
||||
ClientName string `json:"cn"`
|
||||
type GameInfo struct {
|
||||
GameOptions GameOptionData `json:"go"`
|
||||
Created int64 `json:"gca"`
|
||||
Players []string `json:"P"`
|
||||
Spectators []string `json:"V"`
|
||||
Host string `json:"H"`
|
||||
State string `json:"S"`
|
||||
Id int `json:"gid"`
|
||||
HasPassword bool `json:"hp"`
|
||||
}
|
||||
|
||||
|
||||
// GameOptionData
|
||||
const (
|
||||
GameOptionData_TIMER_MULTIPLIER = "tm"
|
||||
GameOptionData_PASSWORD = "pw"
|
||||
GameOptionData_SPECTATOR_LIMIT = "vL"
|
||||
GameOptionData_SCORE_LIMIT = "sl"
|
||||
GameOptionData_BLANKS_LIMIT = "bl"
|
||||
GameOptionData_PLAYER_LIMIT = "pL"
|
||||
GameOptionData_CARD_SETS = "css"
|
||||
)
|
||||
|
||||
type GameOptionData struct {
|
||||
TimerMultiplier string `json:"tm"`
|
||||
Password string `json:"pw"`
|
||||
SpectatorLimit int `json:"vL"`
|
||||
ScoreLimit int `json:"sl"`
|
||||
BlanksLimit int `json:"bl"`
|
||||
PlayerLimit int `json:"pL"`
|
||||
CardSets []int `json:"css"`
|
||||
}
|
||||
|
||||
|
||||
// GamePlayerInfo
|
||||
const (
|
||||
GamePlayerInfo_STATUS = "st"
|
||||
GamePlayerInfo_SCORE = "sc"
|
||||
GamePlayerInfo_NAME = "N"
|
||||
)
|
||||
|
||||
type GamePlayerInfo struct {
|
||||
Status string `json:"st"`
|
||||
Score int `json:"sc"`
|
||||
Name string `json:"N"`
|
||||
}
|
||||
|
||||
|
||||
// GamePlayerStatus
|
||||
const (
|
||||
GamePlayerStatus_SPECTATOR = "sv"
|
||||
GamePlayerStatus_WINNER = "sw"
|
||||
GamePlayerStatus_IDLE = "si"
|
||||
GamePlayerStatus_HOST = "sh"
|
||||
GamePlayerStatus_JUDGING = "sjj"
|
||||
GamePlayerStatus_JUDGE = "sj"
|
||||
GamePlayerStatus_PLAYING = "sp"
|
||||
)
|
||||
|
||||
var GamePlayerStatusMsgs = map[string]string{
|
||||
"sjj": "Selecting",
|
||||
"sv": "Spectator",
|
||||
"sw": "Winner!",
|
||||
"sh": "Host",
|
||||
"si": "",
|
||||
"sj": "Card Czar",
|
||||
"sp": "Playing",
|
||||
}
|
||||
|
||||
var GamePlayerStatusMsgs2 = map[string]string{
|
||||
"sjj": "Select a winning card.",
|
||||
"sv": "You are just spectating.",
|
||||
"sw": "You have won!",
|
||||
"sh": "Wait for players then click Start Game.",
|
||||
"si": "Waiting for players...",
|
||||
"sj": "You are the Card Czar.",
|
||||
"sp": "Select a card to play.",
|
||||
}
|
||||
|
||||
|
||||
// GameState
|
||||
const (
|
||||
GameState_ROUND_OVER = "ro"
|
||||
GameState_LOBBY = "l"
|
||||
GameState_JUDGING = "j"
|
||||
GameState_PLAYING = "p"
|
||||
)
|
||||
|
||||
var GameStateMsgs = map[string]string{
|
||||
"p": "In Progress",
|
||||
"j": "In Progress",
|
||||
"l": "Not Started",
|
||||
"ro": "In Progress",
|
||||
}
|
||||
|
||||
|
||||
// LongPollEvent
|
||||
const (
|
||||
LongPollEvent_GAME_ROUND_COMPLETE = "grc"
|
||||
LongPollEvent_BANNED = "B&"
|
||||
LongPollEvent_NOOP = "_"
|
||||
LongPollEvent_CHAT = "c"
|
||||
LongPollEvent_GAME_PLAYER_INFO_CHANGE = "gpic"
|
||||
LongPollEvent_HAND_DEAL = "hd"
|
||||
LongPollEvent_CARDCAST_ADD_CARDSET = "cac"
|
||||
LongPollEvent_PLAYER_LEAVE = "pl"
|
||||
LongPollEvent_GAME_BLACK_RESHUFFLE = "gbr"
|
||||
LongPollEvent_GAME_JUDGE_SKIPPED = "gjs"
|
||||
LongPollEvent_GAME_LIST_REFRESH = "glr"
|
||||
LongPollEvent_NEW_PLAYER = "np"
|
||||
LongPollEvent_GAME_PLAYER_SKIPPED = "gps"
|
||||
LongPollEvent_GAME_PLAYER_JOIN = "gpj"
|
||||
LongPollEvent_GAME_WHITE_RESHUFFLE = "gwr"
|
||||
LongPollEvent_CARDCAST_REMOVE_CARDSET = "crc"
|
||||
LongPollEvent_GAME_OPTIONS_CHANGED = "goc"
|
||||
LongPollEvent_GAME_PLAYER_KICKED_IDLE = "gpki"
|
||||
LongPollEvent_GAME_SPECTATOR_LEAVE = "gvl"
|
||||
LongPollEvent_GAME_PLAYER_LEAVE = "gpl"
|
||||
LongPollEvent_GAME_SPECTATOR_JOIN = "gvj"
|
||||
LongPollEvent_HURRY_UP = "hu"
|
||||
LongPollEvent_GAME_JUDGE_LEFT = "gjl"
|
||||
LongPollEvent_KICKED = "k"
|
||||
LongPollEvent_KICKED_FROM_GAME_IDLE = "kfgi"
|
||||
LongPollEvent_FILTERED_CHAT = "FC"
|
||||
LongPollEvent_GAME_STATE_CHANGE = "gsc"
|
||||
)
|
||||
|
||||
|
||||
// LongPollResponse
|
||||
const (
|
||||
LongPollResponse_PLAY_TIMER = "Pt"
|
||||
LongPollResponse_PLAYER_INFO = "pi"
|
||||
LongPollResponse_FROM = "f"
|
||||
LongPollResponse_WHITE_CARDS = "wc"
|
||||
LongPollResponse_EVENT = "E"
|
||||
LongPollResponse_HAND = "h"
|
||||
LongPollResponse_ERROR_CODE = "ec"
|
||||
LongPollResponse_MESSAGE = "m"
|
||||
LongPollResponse_WINNING_CARD = "WC"
|
||||
LongPollResponse_FROM_ADMIN = "fa"
|
||||
LongPollResponse_TIMESTAMP = "ts"
|
||||
LongPollResponse_GAME_INFO = "gi"
|
||||
LongPollResponse_ERROR = "e"
|
||||
LongPollResponse_ID_CODE = "idc"
|
||||
LongPollResponse_REASON = "qr"
|
||||
LongPollResponse_WALL = "wall"
|
||||
LongPollResponse_ROUND_WINNER = "rw"
|
||||
LongPollResponse_SIGIL = "?"
|
||||
LongPollResponse_EMOTE = "me"
|
||||
LongPollResponse_CARDCAST_DECK_INFO = "cdi"
|
||||
LongPollResponse_GAME_ID = "gid"
|
||||
LongPollResponse_ROUND_PERMALINK = "rP"
|
||||
LongPollResponse_NICKNAME = "n"
|
||||
LongPollResponse_BLACK_CARD = "bc"
|
||||
LongPollResponse_GAME_PERMALINK = "gp"
|
||||
LongPollResponse_GAME_STATE = "gs"
|
||||
LongPollResponse_INTERMISSION = "i"
|
||||
)
|
||||
|
||||
type LongPollResponse struct {
|
||||
PlayTimer int `json:"Pt"`
|
||||
PlayerInfo []GamePlayerInfo `json:"pi"`
|
||||
ConnectedAt int64 `json:"ca"`
|
||||
WhiteCards []int `json:"wc"`
|
||||
Hand []int `json:"h"`
|
||||
From string `json:"f"`
|
||||
WhiteCards [][]WhiteCardData `json:"wc"`
|
||||
Event string `json:"E"`
|
||||
Hand []WhiteCardData `json:"h"`
|
||||
ErrorCode string `json:"ec"`
|
||||
GlobalChatEnabled bool `json:"gce"`
|
||||
ServerStarted int64 `json:"SS"`
|
||||
Next string `json:"next"`
|
||||
Message string `json:"m"`
|
||||
WinningCard int `json:"WC"`
|
||||
FromAdmin bool `json:"fa"`
|
||||
Timestamp int64 `json:"ts"`
|
||||
GameInfo GameInfo `json:"gi"`
|
||||
Error bool `json:"e"`
|
||||
GameStateDescription string `json:"gss"`
|
||||
IdCode string `json:"idc"`
|
||||
CardSets []CardSetData `json:"css"`
|
||||
Serial int `json:"s"`
|
||||
PersistentId string `json:"pid"`
|
||||
UserPermalink string `json:"up"`
|
||||
Games []GameInfo `json:"gl"`
|
||||
Sigil string `json:"?"`
|
||||
GameId *int `json:"gid"`
|
||||
MaxGames int `json:"mg"`
|
||||
InProgress bool `json:"ip"`
|
||||
GameOptions GameOptionData `json:"go"`
|
||||
Nickname string `json:"n"`
|
||||
BlackCard int `json:"bc"`
|
||||
GamePermalink string `json:"gp"`
|
||||
Idle int64 `json:"idl"`
|
||||
CardId int `json:"cid"`
|
||||
IpAddress string `json:"IP"`
|
||||
SessionPermalink string `json:"sP"`
|
||||
}
|
||||
|
||||
|
||||
// AjaxRequest
|
||||
const (
|
||||
AjaxRequest_SERIAL = "s"
|
||||
AjaxRequest_OP = "o"
|
||||
AjaxRequest_WALL = "wall"
|
||||
AjaxRequest_PERSISTENT_ID = "pid"
|
||||
AjaxRequest_EMOTE = "me"
|
||||
AjaxRequest_CARDCAST_ID = "cci"
|
||||
AjaxRequest_GAME_ID = "gid"
|
||||
AjaxRequest_GAME_OPTIONS = "go"
|
||||
AjaxRequest_MESSAGE = "m"
|
||||
AjaxRequest_NICKNAME = "n"
|
||||
AjaxRequest_PASSWORD = "pw"
|
||||
AjaxRequest_CARD_ID = "cid"
|
||||
AjaxRequest_ID_CODE = "idc"
|
||||
)
|
||||
|
||||
type AjaxRequest struct {
|
||||
Serial int `json:"s"`
|
||||
Op string `json:"o"`
|
||||
Reason string `json:"qr"`
|
||||
Wall bool `json:"wall"`
|
||||
PersistentId string `json:"pid"`
|
||||
RoundWinner string `json:"rw"`
|
||||
Sigil string `json:"?"`
|
||||
Emote bool `json:"me"`
|
||||
CardcastId string `json:"cci"`
|
||||
GameId int `json:"gid"`
|
||||
GameOptions GameOptionData `json:"go"`
|
||||
Message string `json:"m"`
|
||||
CardcastDeckInfo string `json:"cdi"`
|
||||
GameId *int `json:"gid"`
|
||||
RoundPermalink string `json:"rP"`
|
||||
Nickname string `json:"n"`
|
||||
Password string `json:"pw"`
|
||||
CardId int `json:"cid"`
|
||||
IdCode string `json:"idc"`
|
||||
BlackCard BlackCardData `json:"bc"`
|
||||
GamePermalink string `json:"gp"`
|
||||
GameState string `json:"gs"`
|
||||
Intermission int `json:"i"`
|
||||
}
|
||||
|
||||
|
||||
// AjaxOperation
|
||||
const (
|
||||
AjaxOperation_NAMES = "gn"
|
||||
AjaxOperation_SCORE = "SC"
|
||||
AjaxOperation_LEAVE_GAME = "lg"
|
||||
AjaxOperation_JOIN_GAME = "jg"
|
||||
AjaxOperation_CHAT = "c"
|
||||
AjaxOperation_GAME_LIST = "ggl"
|
||||
AjaxOperation_CARDCAST_ADD_CARDSET = "cac"
|
||||
AjaxOperation_CARDCAST_LIST_CARDSETS = "clc"
|
||||
AjaxOperation_PLAY_CARD = "pc"
|
||||
AjaxOperation_CHANGE_GAME_OPTIONS = "cgo"
|
||||
AjaxOperation_GET_GAME_INFO = "ggi"
|
||||
AjaxOperation_GET_CARDS = "gc"
|
||||
AjaxOperation_ADMIN_SET_VERBOSE_LOG = "svl"
|
||||
AjaxOperation_REGISTER = "r"
|
||||
AjaxOperation_CARDCAST_REMOVE_CARDSET = "crc"
|
||||
AjaxOperation_WHOIS = "Wi"
|
||||
AjaxOperation_KICK = "K"
|
||||
AjaxOperation_FIRST_LOAD = "fl"
|
||||
AjaxOperation_START_GAME = "sg"
|
||||
AjaxOperation_LOG_OUT = "lo"
|
||||
AjaxOperation_BAN = "b"
|
||||
AjaxOperation_CREATE_GAME = "cg"
|
||||
AjaxOperation_STOP_GAME = "Sg"
|
||||
AjaxOperation_GAME_CHAT = "GC"
|
||||
AjaxOperation_SPECTATE_GAME = "vg"
|
||||
AjaxOperation_JUDGE_SELECT = "js"
|
||||
)
|
||||
|
||||
|
||||
// ReconnectNextAction
|
||||
const (
|
||||
ReconnectNextAction_GAME = "game"
|
||||
|
@ -519,21 +515,27 @@ const (
|
|||
)
|
||||
|
||||
|
||||
// DisconnectReason
|
||||
// Sigil
|
||||
const (
|
||||
DisconnectReason_PING_TIMEOUT = "pt"
|
||||
DisconnectReason_BANNED = "B&"
|
||||
DisconnectReason_IDLE_TIMEOUT = "it"
|
||||
DisconnectReason_KICKED = "k"
|
||||
DisconnectReason_MANUAL = "man"
|
||||
Sigil_NORMAL_USER = ""
|
||||
Sigil_ADMIN = "@"
|
||||
Sigil_ID_CODE = "+"
|
||||
)
|
||||
|
||||
var DisconnectReasonMsgs = map[string]string{
|
||||
"B&": "Banned",
|
||||
"pt": "Ping timeout",
|
||||
"it": "Kicked due to idle",
|
||||
"k": "Kicked by server administrator",
|
||||
"man": "Leaving",
|
||||
|
||||
// WhiteCardData
|
||||
const (
|
||||
WhiteCardData_WRITE_IN = "wi"
|
||||
WhiteCardData_TEXT = "T"
|
||||
WhiteCardData_ID = "cid"
|
||||
WhiteCardData_WATERMARK = "W"
|
||||
)
|
||||
|
||||
type WhiteCardData struct {
|
||||
WriteIn bool `json:"wi"`
|
||||
Text string `json:"T"`
|
||||
Id int `json:"cid"`
|
||||
Watermark string `json:"W"`
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ pyx.server.max_users=${pyx.max_users}
|
|||
pyx.server.max_games=${pyx.max_games}
|
||||
pyx.server.broadcast_connects_and_disconnects=${pyx.broadcast_connects_and_disconnects}
|
||||
pyx.server.global_chat_enabled=${pyx.global_chat_enabled}
|
||||
pyx.server.game_chat_enabled=${pyx.game_chat_enabled}
|
||||
pyx.server.allow_blank_cards=${pyx.allow_blank_cards}
|
||||
pyx.server.id_code_salt=${pyx.id_code_salt}
|
||||
pyx.server.admin_addrs=${pyx.admin_addrs}
|
||||
|
|
|
@ -169,6 +169,14 @@ public class CahModule extends AbstractModule {
|
|||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
@GameChatEnabled
|
||||
Boolean provideGameChatEnabled() {
|
||||
synchronized (properties) {
|
||||
return Boolean.valueOf(properties.getProperty("pyx.server.game_chat_enabled", "true"));
|
||||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ShowGamePermalink
|
||||
Boolean provideShowGamePermalink() {
|
||||
|
@ -365,6 +373,11 @@ public class CahModule extends AbstractModule {
|
|||
public @interface GlobalChatEnabled {
|
||||
}
|
||||
|
||||
@BindingAnnotation
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface GameChatEnabled {
|
||||
}
|
||||
|
||||
@BindingAnnotation
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface InsecureIdAllowed {
|
||||
|
|
|
@ -274,6 +274,8 @@ public class Constants {
|
|||
@GoDataType("[]GameInfo")
|
||||
GAMES("gl"),
|
||||
@GoDataType("bool")
|
||||
GAME_CHAT_ENABLED("Gce"),
|
||||
@GoDataType("bool")
|
||||
GLOBAL_CHAT_ENABLED("gce"),
|
||||
@GoDataType("[]int")
|
||||
HAND("h"),
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.hibernate.Transaction;
|
|||
import com.google.inject.Inject;
|
||||
|
||||
import net.socialgamer.cah.CahModule.BanList;
|
||||
import net.socialgamer.cah.CahModule.GameChatEnabled;
|
||||
import net.socialgamer.cah.CahModule.GlobalChatEnabled;
|
||||
import net.socialgamer.cah.CahModule.IncludeInactiveCardsets;
|
||||
import net.socialgamer.cah.CahModule.ServerStarted;
|
||||
|
@ -72,6 +73,7 @@ public class FirstLoadHandler extends Handler {
|
|||
private final Set<String> banList;
|
||||
private final Session hibernateSession;
|
||||
private final boolean includeInactiveCardsets;
|
||||
private final boolean gameChatEnabled;
|
||||
private final boolean globalChatEnabled;
|
||||
private final boolean showSessionPermalink;
|
||||
private final String sessionPermalinkFormatString;
|
||||
|
@ -82,6 +84,7 @@ public class FirstLoadHandler extends Handler {
|
|||
@Inject
|
||||
public FirstLoadHandler(final Session hibernateSession, @BanList final Set<String> banList,
|
||||
@IncludeInactiveCardsets final boolean includeInactiveCardsets,
|
||||
@GameChatEnabled final boolean gameChatEnabled,
|
||||
@GlobalChatEnabled final boolean globalChatEnabled,
|
||||
@ServerStarted final Date serverStarted,
|
||||
@ShowSessionPermalink final boolean showSessionPermalink,
|
||||
|
@ -91,6 +94,7 @@ public class FirstLoadHandler extends Handler {
|
|||
this.banList = banList;
|
||||
this.hibernateSession = hibernateSession;
|
||||
this.includeInactiveCardsets = includeInactiveCardsets;
|
||||
this.gameChatEnabled = gameChatEnabled;
|
||||
this.globalChatEnabled = globalChatEnabled;
|
||||
this.serverStarted = serverStarted;
|
||||
this.showSessionPermalink = showSessionPermalink;
|
||||
|
@ -103,6 +107,7 @@ public class FirstLoadHandler extends Handler {
|
|||
public Map<ReturnableData, Object> handle(final RequestWrapper request,
|
||||
final HttpSession session) {
|
||||
final HashMap<ReturnableData, Object> ret = new HashMap<ReturnableData, Object>();
|
||||
ret.put(AjaxResponse.GAME_CHAT_ENABLED, gameChatEnabled);
|
||||
ret.put(AjaxResponse.GLOBAL_CHAT_ENABLED, globalChatEnabled);
|
||||
|
||||
if (banList.contains(request.getRemoteAddr())) {
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import net.socialgamer.cah.CahModule.GameChatEnabled;
|
||||
import net.socialgamer.cah.Constants.AjaxOperation;
|
||||
import net.socialgamer.cah.Constants.AjaxRequest;
|
||||
import net.socialgamer.cah.Constants.ErrorCode;
|
||||
|
@ -59,13 +60,15 @@ public class GameChatHandler extends GameWithPlayerHandler {
|
|||
|
||||
private final ChatFilter chatFilter;
|
||||
private final ConnectedUsers users;
|
||||
private final boolean gameChatEnabled;
|
||||
|
||||
@Inject
|
||||
public GameChatHandler(final GameManager gameManager, final ChatFilter chatFilter,
|
||||
final ConnectedUsers users) {
|
||||
final ConnectedUsers users, @GameChatEnabled final boolean gameChatEnabled) {
|
||||
super(gameManager);
|
||||
this.chatFilter = chatFilter;
|
||||
this.users = users;
|
||||
this.gameChatEnabled = gameChatEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,6 +81,9 @@ public class GameChatHandler extends GameWithPlayerHandler {
|
|||
LongPollEvent event = LongPollEvent.CHAT;
|
||||
if (request.getParameter(AjaxRequest.MESSAGE) == null) {
|
||||
return error(ErrorCode.NO_MSG_SPECIFIED);
|
||||
} else if (!gameChatEnabled && !user.isAdmin()) {
|
||||
// game chat can be turned off in the properties file
|
||||
return error(ErrorCode.NOT_ADMIN);
|
||||
} else {
|
||||
final String message = request.getParameter(AjaxRequest.MESSAGE).trim();
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.google.inject.Key;
|
|||
|
||||
import net.socialgamer.cah.CahModule.BroadcastConnectsAndDisconnects;
|
||||
import net.socialgamer.cah.CahModule.CookieDomain;
|
||||
import net.socialgamer.cah.CahModule.GameChatEnabled;
|
||||
import net.socialgamer.cah.CahModule.GlobalChatEnabled;
|
||||
import net.socialgamer.cah.CahModule.InsecureIdAllowed;
|
||||
import net.socialgamer.cah.StartupUtils;
|
||||
|
@ -79,12 +80,15 @@ public class JavascriptConfigServlet extends HttpServlet {
|
|||
final Injector injector = (Injector) getServletContext().getAttribute(StartupUtils.INJECTOR);
|
||||
final String cookieDomain = injector.getInstance(Key.get(String.class, CookieDomain.class));
|
||||
final Boolean globalChatEnabled = injector.getInstance(Key.get(Boolean.class, GlobalChatEnabled.class));
|
||||
final Boolean gameChatEnabled = injector
|
||||
.getInstance(Key.get(Boolean.class, GameChatEnabled.class));
|
||||
final Boolean insecureIdAllowed = injector
|
||||
.getInstance(Key.get(Boolean.class, InsecureIdAllowed.class));
|
||||
final Boolean broadcastingUsers = injector
|
||||
.getInstance(Key.get(Boolean.class, BroadcastConnectsAndDisconnects.class));
|
||||
builder.append(String.format("cah.COOKIE_DOMAIN = '%s';\n", cookieDomain));
|
||||
builder.append(String.format("cah.GLOBAL_CHAT_ENABLED = %b;\n", globalChatEnabled));
|
||||
builder.append(String.format("cah.GAME_CHAT_ENABLED = %b;\n", gameChatEnabled));
|
||||
builder.append(String.format("cah.INSECURE_ID_ALLOWED = %b;\n", insecureIdAllowed));
|
||||
builder.append(String.format("cah.BROADCASTING_USERS = %b;\n", broadcastingUsers));
|
||||
|
||||
|
|
Loading…
Reference in New Issue