playship_ludo_pseudo_quick
Version:
Server side neutrino plugin code for ludo game
270 lines (262 loc) • 5.29 kB
JavaScript
const OBJECT_TYPES = {
RED_PIECE: 'redPiece',
BLUE_PIECE: 'bluePiece',
YELLOW_PIECE: 'yellowPiece',
GREEN_PIECE: 'greenPiece',
};
const PIECE_HEAVEN_END_GAME_REASON = 'Piece reached heaven';
const ALL_PLAYERS_EXHAUSTED_MOVED
= 'All players have exhausted their moves';
const MAX_KILLS_REACHED_REASON = 'Max kills reached';
const TIME_HACK_DETECTION = 'Time hack detected from client';
const MAX_MISS_MOVES = 'Max miss moves reached';
const SERVER_ERROR_REASON = 'Server error';
const PLAYER_PROPS = {
REMAINING_EXTRA_TIME : {
name : 'remainingExtraTime',
type : 'number'
},
KILLS: {
name: 'kills',
type: 'number',
},
GOT_KILLED : {
name: 'gotKilled',
type : 'number'
},
KILL_TYPES: {
name: 'killTypes',
type: 'object',
},
COLOR: 'color',
ROTATION: {
name: 'rotation',
type: 'number',
},
DIE_ROLL: {
name: 'dieRoll',
type: 'number',
},
MISS_MOVES: {
name: 'missMoves',
type: 'number',
},
IS_ASCENDED: {
name: 'isAscended',
type: 'boolean',
},
ASCEND_COUNT: {
name: 'ascendCount',
type: 'number',
},
TURN_COUNT: {
name: 'turnCount',
type: 'number',
},
ARE_PAWNS_DESTROYED: {
name: 'arePawnsDestroyed',
type: 'boolean',
},
CONSECUTIVE_SIXES : {
name: 'consecutiveSixes',
type: 'number',
},
AUTO_ROLL_COUNT : {
name : 'autoRollCount',
type : 'number'
},
PLAYER_ROLL_COUNT : {
name : 'playerROllCount',
type : 'number'
},
TURN_SKIP_DIE_ROLL_SIX : {
name : 'turnSkipDieRollSix',
type : 'boolean'
},
TOTAL_TIME_PLAYED : {
name : 'totalTimePlayed',
type : 'number',
},
ABSOLUTE_WIN_TYPE : {
name : 'absoluteWinType',
type : 'number'
},
ABSOLUTE_LOST_TYPE : {
name : 'absoluteWinType',
type : 'number'
},
EXTRA_TIME : {
name : 'extraTime',
type : 'number',
},
MISSED_SAFE_ZONES : {
name : 'missedSafeZones',
type : 'number'
}
};
const OBJECT_PROPS = {
SELF_SHARE: {
name: 'shareSelf',
type: 'number',
},
OPP_SHARE: {
name: 'shareOpp',
type: 'number',
},
SCORE: {
name: 'score',
type: 'number',
},
PATH_INDEX: 'pathIndex',
CAN_SELECT : {
name : 'canSelect',
type : 'boolean'
},
};
const GAME_PROPS = {
EXTRA_TIME_START_TIME : {
name : 'extraTimeStartTime',
type : 'number'
},
EXTRA_TIME_CHECK_TIME : {
name : 'extraTimeCheckTime',
type : 'number'
},
REMAINING_EXTRA_TIME : {
name : 'remainingExtraTime',
type : 'number'
},
IS_GAME_PAUSED : {
name : 'isGamePaused',
type : 'boolean'
},
IS_TURN_PROCESSED: {
name: 'isTurnProcessed',
type: 'boolean',
},
IS_TURN_PROCESSED_SERVER: {
name: 'isTurnProcessedServer',
type: 'boolean',
},
MAPPER: '_mapper',
GAME_OVER_REASON: 'goreason',
NEXT_TURN_TS: {
name: 'nextTurnTs',
type: 'number',
},
IS_CONTINUE: {
name: 'isContinue',
type: 'number',
},
GAME_OVER_TS: {
name: 'gameOverTs',
type: 'number',
},
LAST_TIP_TS: 'lastTipTs',
IS_SKIP_CHECKED: 'isSkipChecked',
GAME_TIMER_END_TS: {
name: 'gameTimerEndTs',
type: 'number',
},
GAME_TIMER_START_TS: {
name: 'gameTimerStartTs',
type: 'number',
},
GAME_TIMER_DELAY_TS: {
name: 'gameTimerDelayTs',
type: 'number',
},
GAME_TIMER: {
name: 'gameDuration',
type: 'number',
},
GAME_TIMER_REMAINING: {
name: 'gameDurationLeft',
type: 'number',
},
TOTAL_EXTRA_TIME : {
name : 'totalExtraTime',
type : 'number'
},
IS_FINAL_TURNS: {
name: 'isFinalTurns',
type: 'boolean',
},
FINAL_REM_PLAYERS : {
name : 'playersListFinalTurn',
type : 'array'
},
IS_DICE_REVEALED: {
name: 'isDiceRevealed',
type: 'boolean',
},
PLAYER_SEATING: {
name : 'playerSeating',
type : 'array'
},
IS_EXTRA_ANIM_TIME_REQ : {
name : 'isExtraAnimTimeReq',
type : 'boolean'
},
EXTRA_TIME_FOR_SKIP : {
name : 'extranTimeForSkip',
type : 'boolean'
},
NO_POSSIBLE_MOVE : {
name : 'isPawnMovementPossible',
type : "boolean"
},
ABSOLUTE_WIN_TYPE : {
name : 'absoluteWinType',
type : 'number'
},
FORFEIT_HIGHEST_PLAYER_SCORE : {
name : 'forfeitHighestPlayerScore',
type : 'number'
},
FORFEIT_HIGHEST_PLAYER_ID : {
name: 'forfeitHighestPlayerId',
type: 'number'
},
IS_FORFEIT_FRAUD_BY_ANY_PLAYER : {
name : 'isForfeitFraudByAnyPlayer',
type : 'boolean'
},
IS_TURN_SKIPPED: 'isTurnSkipped',
IS_TURN_COMPLETED : {
name : 'isTurnCompleted',
type : 'boolean'
}
};
const BATTLE_TYPES = {
TOURNAMENT : 1,
H2H : 0
}
const NEW_EVENTS = {
MISS_TURN : 'miss_turn',
FORFEIT : 'forfeit',
TURN : 'turn',
KILL : 'kill',
SAFE_ZONE : 'safe_zone',
HOME : 'home',
DICE_ROLL : 'diceRoll',
FORFEIT_FRAUD : 'FWH',
FRAUD_FIRST_KILL : 'FKT',
FRAUD_QUADRANT_KILL : 'QTK',
FRAUD_FORFEIT_WINNER : 'FWHB',
FRAUD_QUADRANT_KILL_SAFE_ZONE : 'QTKB'
}
module.exports = {
OBJECT_TYPES,
TIME_HACK_DETECTION,
PLAYER_PROPS,
GAME_PROPS,
PIECE_HEAVEN_END_GAME_REASON,
MAX_KILLS_REACHED_REASON,
MAX_MISS_MOVES,
SERVER_ERROR_REASON,
OBJECT_PROPS,
ALL_PLAYERS_EXHAUSTED_MOVED,
NEW_EVENTS,
BATTLE_TYPES
};