Pupix / rift-explorer

🛠 Explore the API of the League of Legends client
MIT License
554 stars 73 forks source link

A question #111

Closed tradce closed 4 years ago

tradce commented 4 years ago

Is there a way to start a 1v0 Teamfight Tactics mode, as the debug key(ctrl+y) is disabled? If yes, may i ask for the code to start the mode? Thanks a lot.

tradce commented 4 years ago

And i got a 400 error with the code below Code: POST /lol-lobby/v2/lobby { "customGameLobby": { "configuration": { "gameMode": "PRACTICETOOL", "gameMutator": "", "gameServerRegion": "", "mapId": 11, "mutators": {"id": 1}, "spectatorPolicy": "AllAllowed", "teamSize": 5 }, "lobbyName": "Name", "lobbyPassword": null }, "isCustom": true }

from: https://riot-api-libraries.readthedocs.io/en/latest/lcu.html

nomi-san commented 4 years ago

TWO methods for you:

1

Create a lobby in this mode, and send request:

GET /lol-lobby/v2/lobby

Enjoy the given JSON, it fills your solution.

2

Why don't use websocket to listen JSON API event? Enter the game mode to track them, you'll gain the JSON too.

Here for nodejs: Pupix's gist And here for C#: my code


Have a great time 😄

tradce commented 4 years ago

I was trying to start a 1-man TFT game and it replies me with this:

"errorCode": "RPC_ERROR", "httpStatus": 500, "implementationDetails": {}, "message": "INVALID_LOBBY"

I don't really know what should be done and I don't know how to use the second one. Maybe a little tutoral on the second one as I don't really know about programming.

tradce commented 4 years ago

I think the rift explorer i am using might be corrupted. Let me try to download it again.

tradce commented 4 years ago

And it's not about corruption...

nomi-san commented 4 years ago

I don't think that RE doesn't work correctly. But you can do some request on web browser with JS.

tradce commented 4 years ago

Thx for helping me twice!

tradce commented 4 years ago

Welp, it seems to be not working for me. If I enter the unofficial LCU one, I got a 400 error Uncaught SyntaxError: Unexpected token ':' If I enter the exactly same code I got from the browser console or even in RE, it just replys me with a 500 error INVALID_LOBBY I don't exactly know what's wrong with the code, but I will send it below. Should I do a big change on the code that I got from console/RE?

Unofficial: POST /lol-lobby/v2/lobby { "customGameLobby": { "configuration": { "gameMode": "PRACTICETOOL", "gameMutator": "", "gameServerRegion": "", "mapId": 11, "mutators": {"id": 1}, "spectatorPolicy": "AllAllowed", "teamSize": 5 }, "lobbyName": "Name", "lobbyPassword": null }, "isCustom": true } (error 400) Code got from console/RE: { "canStartActivity": true, "chatRoomId": "3ee56b17-97c9-4538-9425-515157abdd45", "chatRoomKey": "3ee56b17-97c9-4538-9425-515157abdd45", "gameConfig": { "allowablePremadeSizes": [ 1, 2, 3, 4, 5, 6, 7, 8 ], "customLobbyName": "", "customMutatorName": "", "customRewardsDisabledReasons": [], "customSpectatorPolicy": "NotAllowed", "customSpectators": [], "customTeam100": [], "customTeam200": [], "gameMode": "TFT", "isCustom": false, "isLobbyFull": false, "isTeamBuilderManaged": false, "mapId": 22, "maxHumanPlayers": 0, "maxLobbySize": 8, "maxTeamSize": 8, "pickType": "", "premadeSizeAllowed": true, "queueId": 1090, "showPositionSelector": false }, "invitations": [ { "invitationId": "", "state": "Accepted", "timestamp": "0", "toSummonerId": 2190819524, "toSummonerName": "smallhealthy" } ], "localMember": { "allowedChangeActivity": true, "allowedInviteOthers": true, "allowedKickOthers": true, "allowedStartActivity": true, "allowedToggleInvite": true, "autoFillEligible": false, "autoFillProtectedForPromos": false, "autoFillProtectedForSoloing": false, "autoFillProtectedForStreaking": true, "botChampionId": 0, "botDifficulty": "NONE", "botId": "", "firstPositionPreference": "", "isBot": false, "isLeader": true, "isSpectator": false, "puuid": "aedb04bc-5062-533a-ac6f-06c039a6f4bf", "ready": true, "secondPositionPreference": "", "showGhostedBanner": false, "summonerIconId": 28, "summonerId": 2190819524, "summonerInternalName": "smallhealthy", "summonerLevel": 30, "summonerName": "smallhealthy", "teamId": 0 }, "members": [ { "allowedChangeActivity": true, "allowedInviteOthers": true, "allowedKickOthers": true, "allowedStartActivity": true, "allowedToggleInvite": true, "autoFillEligible": false, "autoFillProtectedForPromos": false, "autoFillProtectedForSoloing": false, "autoFillProtectedForStreaking": true, "botChampionId": 0, "botDifficulty": "NONE", "botId": "", "firstPositionPreference": "", "isBot": false, "isLeader": true, "isSpectator": false, "puuid": "aedb04bc-5062-533a-ac6f-06c039a6f4bf", "ready": true, "secondPositionPreference": "", "showGhostedBanner": false, "summonerIconId": 28, "summonerId": 2190819524, "summonerInternalName": "smallhealthy", "summonerLevel": 30, "summonerName": "smallhealthy", "teamId": 0 } ], "partyId": "3ee56b17-97c9-4538-9425-515157abdd45", "partyType": "closed", "restrictions": [] } (error 500)

tradce commented 4 years ago

I can use the unofficial LCU code before, now not...

tradce commented 4 years ago

I am deeply sorry if I disrupted your daily life...

nomi-san commented 4 years ago

Yep, I think your request body included ..

POST
/lol-lobby/v2/lobby

=> got syntax error 😅 Please remove these lines!

You got status 500 because many keys e.g partyId, chatRoomId, chatRoomKey etc are unique (gen from server for this lobby, cannot duplicate it).

The code from riot-api-libraries.readthedocs.io can be used to create a lobby, but it is not for TFT, and not enough or redundant a few values. Please fill it by the code you got from console.

Example (on browser console):

// Request body
var body = {
  "customGameLobby": {
    "configuration": {
      "gameMode": "TFT", "gameMutator": "", "gameServerRegion": "", "mapId": 22, "mutators": {"id": 1}, "spectatorPolicy": "AllAllowed", "teamSize": 8
    },
    "lobbyName": "Player name's TFT game",
    "lobbyPassword": null
  },
} ;
// Send POST to create a lobby
await request('POST', '/lol-lobby/v2/lobby', JSON.stringify(body));
nicoman132 commented 4 years ago

Yep, I think your request body included ..

POST
/lol-lobby/v2/lobby

=> got syntax error 😅 Please remove these lines!

You got status 500 because many keys e.g partyId, chatRoomId, chatRoomKey etc are unique (gen from server for this lobby, cannot duplicate it).

The code from riot-api-libraries.readthedocs.io can be used to create a lobby, but it is not for TFT, and not enough or redundant a few values. Please fill it by the code you got from console.

Example (on browser console):

// Request body
var body = {
  "customGameLobby": {
    "configuration": {
      "gameMode": "TFT", "gameMutator": "", "gameServerRegion": "", "mapId": 22, "mutators": {"id": 1}, "spectatorPolicy": "AllAllowed", "teamSize": 8
    },
    "lobbyName": "Player name's TFT game",
    "lobbyPassword": null
  },
} ;
// Send POST to create a lobby
await request('POST', '/lol-lobby/v2/lobby', JSON.stringify(body));

Hello sir i am trying to create different custom games i try your "TFT" gamemode but i have this curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic cmlvdDoxTG50UjhIWFE1cmNpVFlFTDlrendn' -d '{ "customGameLobby": { "configuration": { "gameMode": "TFT", "gameMutator": "", "gameServerRegion": "", "mapId": 22, "mutators": {"id": 1}, "spectatorPolicy": "AllAllowed", "teamSize": 8 }, "lobbyName": "Player names TFT game", "lobbyPassword": null }, }' 'https://127.0.0.1:6828/lol-lobby/v2/lobby' Request URL https://127.0.0.1:6828/lol-lobby/v2/lobby Request Headers { "Accept": "application/json" } Response Body { "errorCode": "BAD_REQUEST", "httpStatus": 400, "message": "Error: Missing a name for object member. at offset 279." } Response Code 400 Response Headers { "status": "400", "access-control-allow-origin": "https://127.0.0.1:6828", "content-length": "112", "vary": "origin", "content-type": "application/json" }

ty for reading and sorry for my bad english

nicoman132 commented 4 years ago

Yep, I think your request body included ..

POST
/lol-lobby/v2/lobby

=> got syntax error 😅 Please remove these lines!

You got status 500 because many keys e.g partyId, chatRoomId, chatRoomKey etc are unique (gen from server for this lobby, cannot duplicate it).

The code from riot-api-libraries.readthedocs.io can be used to create a lobby, but it is not for TFT, and not enough or redundant a few values. Please fill it by the code you got from console.

Example (on browser console):

// Request body
var body = {
  "customGameLobby": {
    "configuration": {
      "gameMode": "TFT", "gameMutator": "", "gameServerRegion": "", "mapId": 22, "mutators": {"id": 1}, "spectatorPolicy": "AllAllowed", "teamSize": 8
    },
    "lobbyName": "Player name's TFT game",
    "lobbyPassword": null
  },
} ;
// Send POST to create a lobby
await request('POST', '/lol-lobby/v2/lobby', JSON.stringify(body));

When i add "isCustom": true

Request URL https://127.0.0.1:6828/lol-lobby/v2/lobby Request Headers { "Accept": "application/json" } Response Body { "errorCode": "RPC_ERROR", "httpStatus": 434, "implementationDetails": {}, "message": "Couldn't change lobby: Error creating lobby: Error response for POST /lol-login/v1/session/invoke: LCDS invoke to gameService.createPracticeGame failed: Server.Processing, com.riotgames.platform.game.TooManyPlayersException : too many players" } Response Code 434 Response Headers { "status": "434", "access-control-expose-headers": "content-length", "cache-control": "no-store", "access-control-allow-origin": "https://127.0.0.1:6828", "content-length": "324", "vary": "origin", "content-type": "application/json" }

Hi-Ray commented 4 years ago

@nicoman132 not the place.

Hi-Ray commented 4 years ago

Any issues or questions to do with the LCU api can be directed to the riot games third party developer discord.

For now i will lock this conversation