Maintenance Mori


API | Ranking | Battle League | Legend League | Guild Battle | Grand War


API

The API domain is https://api.mentemori.icu/


[world_id] parameters are four digit integers of the following format: SWWW

Example: Korea W4 is 2004.

0 may be passed in for [world_id] parameters to fetch data for all worlds at once.


[wgroup_id] parameters are world group IDs. These can be found from the /wgroups endpoint.

[server] parameters are one of: jp1, jp2, jp3, jp4, jp5, kr1, kr2, ap1, ap2, us1, eu1, gl1, gl2.


All endpoints return a payload of the following format:

        {
            "status": 200,
            "timestamp": 1600000000,
            "data": ...
        }
      

/worlds

List of worlds with data available, as well as what data is available.

        "data": [
            {
                "world_id": 1001,
                "ranking": true,
                "temple": false,
        	"localgvg": true
            },
            ...
        ]

/wgroups

List of world groups, as well as what data is available.

        "data": [
            {
                "group_id": 1,
                "worlds": [1001, 1002, 1003, 1004],
                "legendleague": true,
                "globalgvg": true
            },
            ...
        ]

/[world_id]/player_ranking/latest

Player rankings for a world. Includes BP, Player Rank, Story, and Tower rankings.

        "data": {
            "world_id": 1001,
            "rankings": {
                "bp": [
                    { "id": 123456789001, "name": "Player", "bp": 100000000 },
                    ...
                ],
                "rank": [
                    { "id": 123456789001, "name": "Player", "rank": 400 },
                    ...
                ],
                "quest": [
                    { "id": 123456789001, "name": "Player", "quest_id": 700 },
                    ...
                ],
                "tower": [
                    { "id": 123456789001, "name": "Player", "tower_id": 800 },
                    ...
                ],
                "tower_blue": [
                    { "id": 123456789001, "name": "Player", "tower_id": 800 },
                    ...
                ]
                "tower_red": [
                    { "id": 123456789001, "name": "Player", "tower_id": 800 },
                    ...
                ]
                "tower_green": [
                    { "id": 123456789001, "name": "Player", "tower_id": 800 },
                    ...
                ]
                "tower_yellow": [
                    { "id": 123456789001, "name": "Player", "tower_id": 800 },
                    ...
                ]
            },
            "player_info": {
                "123456789001": {
                    "id": 123456789001,
                    "name": "Player",
                    "bp": 1000000000",
                    "rank": 400,
                    "quest_id": 700,
                    "tower_id": 800,
                    "icon_id": 21,
                    "guild_id": 987654321001,
                    "guild_name": "Guild",
                    "guild_join_time": 1600000000000,
                    "guild_position": 1,
                    "prev_legend_league_class": 5
                },
                ...
            }
        }

/[world_id]/guild_ranking/latest

Guild rankings for a world. Includes BP, Guild Level, and Guild Stock rankings.

        "data": {
            "world_id": 1001,
            "rankings": {
                "bp": [
                    { "id": 987654321001, "name": "Guild", "bp": 100000000 },
                    ...
                ],
                "level": [
                    { "id": 987654321001, "name": "Guild", "level": 20 },
                    ...
                ],
                "stock": [
                    { "id": 987654321001, "name": "Guild", "stock": 14400 },
                    ...
                ]
            },
            "guild_info": {
                "987654321001": {
                    "id": 987654321001,
                    "name": "Guild",
                    "bp": 10000000000",
                    "level": 20,
                    "stock": 14400,
                    "exp": 1405123,
                    "num_members": 34,
                    "leader_id": 123456789001,
                    "leader_name": "Player",
                    "policy": 1,
                    "description": "Just another guild",
                    "free_join": false,
                    "bp_requirement": 999999999
                },
                ...
            }
        }

/[world_id]/temple/latest

Temple data for a world.

        "data": {
            "world_id":  1001,
            "quest_ids": [208001, 308003, 408006, 408009]
        }
    

/[world_id]/arena/latest

Battle League data for a world.

/[world_id]/localgvg/latest

Guild Battle data for a world.

        "data": {
            "world_id": 1001,
            "castles": [
                {
                    "CastleId": 1,
                    "GuildId": 123456789001,
                    "AttackerGuildId": 0,
                    "AttackPartyCount": 0,
                    "DefensePartyCount": 120,
                    "GvgCastleState": 0,
                    "UtcFallenTimeStamp": 0
                },
                ...
            ],
            "guilds": {
                "123456789001": "Guild",
                ...
            }
        }

/wg/[wgroup_id]/legend/latest

Legend League data for a world group.

/wg/[wgroup_id]/globalgvg/[class]/[block]/latest

Grand War data for a block. [class] should be one of 1 = Elite Class, 2 = Expert Class, or 3 = Grand Master. [block] should be one of 0 = A, 1 = B, 2 = C, 3 = D.

        "data": {
            "matching_number": 1102,
            "castles": [
                {
                    "CastleId": 1,
                    "GuildId": 123456789001,
                    "AttackerGuildId": 0,
                    "AttackPartyCount": 0,
                    "DefensePartyCount": 120,
                    "GvgCastleState": 0,
                    "UtcFallenTimeStamp": 0
                },
                ...
            ],
            "guilds": {
                "123456789001": "Guild",
                ...
            }
        }

/[server]/destiny_log/latest

Invocation of Chance logs for a server.

        "data": [
            {
                "Name": "MaintenanceMori",
                "UserItem": {
                    "ItemCount": 1,
                    "ItemId": 41,
                    "ItemType": 6,
                }
            },
            ...
        ]
    

/[server]/stars_guidance_log/latest

Invocation of The Stars' Guidance logs for a server.

        "data": [
            {
                "Name": "MaintenanceMori",
                "UserItem": {
                    "ItemCount": 1,
                    "ItemId": 41,
                    "ItemType": 6,
                }
            },
            ...
        ]
    

/gvg

Realtime Guild Battle and Grand War data.

This endpoint uses WebSockets, obeying the protocol described below. All frames are binary frames, and all integers follow little-endian encoding.

A stream ID is a 4-byte integer containing:

This stream ID should be encoded in little-endian. For example, the stream ID 0x17810015 corresponds to Guild Battle Castle 21 on World 6017. This is sent/received over the network as the 4-byte sequence 0x15 0x00 0x81 0x17.

After connecting to the endpoint, clients should send one or more stream IDs indicating which castles it wishes to listen for updates on. Using Castle ID = 0 here will subscribe the client to all changes in the corresponding instance of Guild Battle/Grand War.

A client may send the stream ID of a stream it is currently listening on to unsubscribe itself from that stream.

For Grand War, the World ID used when subscribing/unsubscribing should be 0. Guild Information Messages will set the world ID corresponding to the world of the guild.

The server will send two types of messages: guild information messages and castle status messages. These messages can be distinguished by the Castle ID field of the included stream IDs -- guild information messages always have Castle ID = 0.

Note that all guild IDs sent contain only the first 9 digits of the full guild ID. The last 3 digits are always equal to the last three digits of the world ID.

A single WebSocket message may contain one or more of the two types of messages.

Structures:

        struct StreamId {
          uint32_t castle_id: 5;
          uint32_t block: 3;
          uint32_t group: 8;
          uint32_t gvg_class: 3;
          uint32_t world_id: 13;
        };

        struct GuildInformation {
          struct StreamId stream_id;
          uint32_t guild_id;
          uint8_t guild_name_len;
          char guild_name[];
        };

        struct CastleStatus {
          struct StreamId stream_id;
          uint32_t guild_id;
          uint32_t attacker_guild_id;
          uint32_t utc_fallen_timestamp;
          uint16_t defense_count;
          uint16_t attack_count;
          uint8_t state;
          uint8_t reserved[3];
        };