Skip to content

Latest commit

 

History

History
171 lines (152 loc) · 3.75 KB

battle.md

File metadata and controls

171 lines (152 loc) · 3.75 KB

Battle


Start

When a user client receives this response it should launch the game (spring.exe) with the start script.

  • Endpoint Type: Request -> Response
  • Source: Server
  • Target: User
  • Required Scopes: tachyon.lobby

Request

JSONSchema
{
    "title": "BattleStartRequest",
    "tachyon": {
        "source": "server",
        "target": "user",
        "scopes": ["tachyon.lobby"]
    },
    "type": "object",
    "properties": {
        "type": { "const": "request" },
        "messageId": { "type": "string" },
        "commandId": { "const": "battle/start" },
        "data": {
            "$ref": "../../definitions/privateBattle.json",
            "title": "BattleStartRequestData"
        }
    },
    "required": ["type", "messageId", "commandId", "data"]
}
Example
{
    "type": "request",
    "messageId": "qui incididunt",
    "commandId": "battle/start",
    "data": {
        "username": "anim",
        "password": "dolore",
        "ip": "ipsum magna exercitation esse dolore",
        "port": 18847608.56628418,
        "engine": {
            "version": "sit dolor"
        },
        "game": {
            "springName": "ex id aliqua consectetur"
        },
        "map": {
            "springName": "non deserunt velit"
        }
    }
}

TypeScript Definition

export interface BattleStartRequest {
    type: "request";
    messageId: string;
    commandId: "battle/start";
    data: BattleStartRequestData;
}
export interface BattleStartRequestData {
    username: string;
    password: string;
    ip: string;
    port: number;
    engine: {
        version: string;
    };
    game: {
        springName: string;
    };
    map: {
        springName: string;
    };
}

Response

JSONSchema
{
    "title": "BattleStartResponse",
    "tachyon": {
        "source": "user",
        "target": "server",
        "scopes": ["tachyon.lobby"]
    },
    "anyOf": [
        {
            "title": "BattleStartOkResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "battle/start" },
                "status": { "const": "success" }
            },
            "required": ["type", "messageId", "commandId", "status"]
        },
        {
            "title": "BattleStartFailResponse",
            "type": "object",
            "properties": {
                "type": { "const": "response" },
                "messageId": { "type": "string" },
                "commandId": { "const": "battle/start" },
                "status": { "const": "failed" },
                "reason": {
                    "enum": [
                        "internal_error",
                        "unauthorized",
                        "invalid_request",
                        "command_unimplemented"
                    ]
                },
                "details": { "type": "string" }
            },
            "required": ["type", "messageId", "commandId", "status", "reason"]
        }
    ]
}
Example
{
    "type": "response",
    "messageId": "mollit reprehenderit",
    "commandId": "battle/start",
    "status": "success"
}

TypeScript Definition

export interface BattleStartOkResponse {
    type: "response";
    messageId: string;
    commandId: "battle/start";
    status: "success";
}

Possible Failed Reasons: internal_error, unauthorized, invalid_request, command_unimplemented