Last active
November 13, 2021 11:25
-
-
Save duongoku/617b0d40fb96157ee8bb65b5d849064d to your computer and use it in GitHub Desktop.
Script for completing missions on https://riotxarcane.riotgames.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script is for completing all available missions on https://riotxarcane.riotgames.com | |
// Don't use this script if you want the full experience | |
// Author: duongoku | |
// Contact: nguyenvubinhduong@gmail.com | |
// How to use: | |
// 1. Go to https://riotxarcane.riotgames.com, log in and load the game | |
// 2. Once the game is loaded, open the developer's console (pressing Ctrl+Shift+K on Firefox or Ctrl+Shift+J on Chrome) | |
// 3. Focus the "Console" tab (if not focused), paste this code and press Enter | |
const LOCALE = window.location.toString().split('/')[3]; | |
const ROOT = "https://xp1missions.riotgames.com"; | |
function get_token(mission_uid) { | |
let url = `${ROOT}/xp1missions/v1/generateToken/${LOCALE}`; | |
let data = { | |
"mission_uid": mission_uid | |
} | |
let xhr = new XMLHttpRequest(); | |
xhr.open("POST", url, false); | |
xhr.withCredentials = true; | |
xhr.send(JSON.stringify(data)); | |
return JSON.parse(xhr.responseText).token; | |
} | |
function submit_mission(mission_uid) { | |
let url = `${ROOT}/xp1missions/v1/completeMission/${LOCALE}`; | |
let token = get_token(mission_uid); | |
let data = { | |
"mission_uid": mission_uid, | |
"token": token, | |
}; | |
let xhr = new XMLHttpRequest(); | |
xhr.open("POST", url, false); | |
xhr.withCredentials = true; | |
xhr.send(JSON.stringify(data)); | |
return JSON.parse(xhr.responseText); | |
} | |
function get_missions() { | |
let url = `${ROOT}/xp1missions/v1/missions/${LOCALE}`; | |
let xhr = new XMLHttpRequest(); | |
xhr.open("GET", url, false); | |
xhr.withCredentials = true; | |
xhr.send(); | |
return JSON.parse(xhr.responseText); | |
} | |
function start() { | |
while (true) { | |
let missions = get_missions().available_missions; | |
let count = 0; | |
missions.forEach((mission) => { | |
if (mission.mission_type == "simple_interactive") { | |
submit_mission(mission.uid); | |
count += 1; | |
} | |
}); | |
if (count == 0) { | |
break; | |
} | |
} | |
console.log("Done!\nPlease refresh the page to see changes."); | |
} | |
start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment