Skip to content

Instantly share code, notes, and snippets.

@QuartzWarrior
Created November 6, 2022 16:17
Show Gist options
  • Select an option

  • Save QuartzWarrior/4bf9f52814edd0d57498eb7e578f4b4c to your computer and use it in GitHub Desktop.

Select an option

Save QuartzWarrior/4bf9f52814edd0d57498eb7e578f4b4c to your computer and use it in GitHub Desktop.
Slay.One Helper - Quick choose abilities, auto-open chests on load, and Custom loadout per gamemode coming soon!
// ==UserScript==
// @name Slay.One Helper
// @namespace https://quartzwarrior.xyz
// @version 0.1
// @description Quick choose abilities, auto-open chests on load. Custom loadout per gamemode coming soon!
// @author QuartzWarrior
// @match https://slay.one/*
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js
// @icon https://www.google.com/s2/favicons?sz=64&domain=slay.one
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
function range(size, startAt = 0) {
return [...Array(size)
.keys()
].map(i => i + startAt);
}
function characterRange(startChar, endChar) {
return String.fromCharCode(...range(endChar.charCodeAt(0) -
startChar.charCodeAt(0), startChar.charCodeAt(0)))
}
// Full abilities list with CSS Selectors (took forever to make)
const abilities = {
"Heal Aura": {
"id": 1,
"upgrades": {
"Rate": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(1) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add",
"Lifetime": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(1) > div:nth-of-type(2) > p:nth-of-type(2) > div:nth-of-type(2).add",
"Radius": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(1) > div:nth-of-type(2) > p:nth-of-type(3) > div:nth-of-type(2).add"
}
},
"Laser Turret": {
"id": 2,
"upgrades": {
"Range": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(2) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add",
"Rate": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(2) > div:nth-of-type(2) > p:nth-of-type(2) > div:nth-of-type(2).add",
"Max": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(2) > div:nth-of-type(2) > p:nth-of-type(3) > div:nth-of-type(2).add",
"Special": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(2) > div:nth-of-type(2) > p:nth-of-type(4) > div:nth-of-type(2).add"
}
},
"Wall": {
"id": 3,
"upgrades": {
"Health": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(3) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Teleport": {
"id": 4,
"upgrades": {
"Range": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(4) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Invisiblitiy": {
"id": 5,
"upgrades": {
"Cost": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(5) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Acid Grenade": {
"id": 6,
"upgrades": {
"Range": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(6) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add",
"Radius": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(6) > div:nth-of-type(2) > p:nth-of-type(2) > div:nth-of-type(2).add",
"Damage": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(6) > div:nth-of-type(2) > p:nth-of-type(3) > div:nth-of-type(2).add"
}
},
"HE Grenade": {
"id": 7,
"upgrades": {
"Damage": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(7) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add",
"Range": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(7) > div:nth-of-type(2) > p:nth-of-type(2) > div:nth-of-type(2).add"
}
},
"Laser Grenade": {
"id": 8,
"upgrades": {
"Lasers": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(8) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Missle Turret": {
"id": 9,
"upgrades": {
"Damage": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(9) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add",
"Radius": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(9) > div:nth-of-type(2) > p:nth-of-type(2) > div:nth-of-type(2).add",
"Max": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(9) > div:nth-of-type(2) > p:nth-of-type(3) > div:nth-of-type(2).add",
"Special": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(9) > div:nth-of-type(2) > p:nth-of-type(4) > div:nth-of-type(2).add"
}
},
"Grenade Turret": {
"id": 10,
"upgrades": {
"Damage": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(10) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add",
"Radius": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(10) > div:nth-of-type(2) > p:nth-of-type(2) > div:nth-of-type(2).add",
"Max": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(10) > div:nth-of-type(2) > p:nth-of-type(3) > div:nth-of-type(2).add"
}
},
"Scan": {
"id": 11,
"upgrades": {
"Duration": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(11) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Shield": {
"id": 12 // No Upgrades
},
"Reflection Shield": {
"id": 13 // No Upgrades
},
"Impulse Grenade": {
"id": 14,
"upgrades": {
"Range": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(14) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Slow Field Grenade": {
"id": 15 // No Upgrades
},
"Auto Turret": {
"id": 16,
"upgrades": {
"Damage": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(16) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add",
"Max": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(16) > div:nth-of-type(2) > p:nth-of-type(2) > div:nth-of-type(2).add"
}
},
"Strength": {
"id": 18,
"upgrades": {
"default": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(18) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Agility": {
"id": 19,
"upgrades": {
"default": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(19) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Regeneration": {
"id": 20,
"upgrades": {
"default": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(20) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Intelligence": {
"id": 21,
"upgrades": {
"default": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(21) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
},
"Lifesteal": {
"id": 22,
"upgrades": {
"default": "html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(22) > div:nth-of-type(2) > p:nth-of-type(1) > div:nth-of-type(2).add"
}
}
}
const chests = [
"html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(5) > ul:nth-of-type(1) > li:nth-of-type(4) > div:nth-of-type(4) > span:nth-of-type(1).label",
"html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(5) > ul:nth-of-type(1) > li:nth-of-type(3) > div:nth-of-type(4) > span:nth-of-type(1).label",
"html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(5) > ul:nth-of-type(1) > li:nth-of-type(2) > div:nth-of-type(4) > span:nth-of-type(1).label",
"html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(5) > ul:nth-of-type(1) > li:nth-of-type(1) > div:nth-of-type(4) > span:nth-of-type(1).label"
]
function closeSkin() {
document.querySelector("html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(3).F-Button.close")
.click()
}
function closeAbilities() {
document.querySelector("html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(42) > div:nth-of-type(3).F-Button.close")
.click()
}
function openAbilities() {
document.querySelector(
"html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(4) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > button:nth-of-type(1) > div:nth-of-type(1).hoverLight.hoverLightnormal"
)
.click()
}
function saveAbilities() {
document.querySelector(
"html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(4) > div:nth-of-type(2) > span:nth-of-type(1).label"
)
.click()
}
function selectAbility(ability) {
document.querySelector("html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type(" +
abilities[ability].id + ") > div:nth-of-type(1).checkbox")
.click()
}
function resetAbilities() {
document.querySelector(
"html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(4) > div:nth-of-type(1) > span:nth-of-type(1).label"
)
.click()
}
function upgradeAbilities(chosen_abilities) {
for (let i in range(chosen_abilities.length)) {
var ability = chosen_abilities[i]
selectAbility(ability.name)
if ("upgrade" in ability) {
var upgrade_values = Object.values(ability.upgrade)
var upgrade_keys = Object.keys(ability.upgrade)
for (let l in range(ability.upgrade.length)) {
for (var _ in range(upgrade_values[l])) {
document.querySelector(abilities[ability.name].upgrades[upgrade_keys[l]])
.click()
}
}
}
}
}
(function () {
'use strict';
/* This section is for AD removing stuff. I also use the AdGuard Extension along with this script, so I am not sure if these imports actually do anything. */
// AdGuard Popup Blocker
$.get("https://userscripts.adtidy.org/release/popup-blocker/2.5/popupblocker.user.js", function (data) {
eval(data)
});
// AdGuard Extra
$.get("https://userscripts.adtidy.org/release/adguard-extra/1.0/adguard-extra.user.js", function (data) {
eval(data)
});
// AdGuard AMP Remover
$.get("https://userscripts.adtidy.org/release/disable-amp/1.0/disable-amp.user.js", function (data) {
eval(data)
});
/* End AD removing section */
// Startup Helper
window.addEventListener('load', function () {
document.querySelector("html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(6) > a:nth-of-type(4).ioGameLink.withClickSound")
.innerText = "Slay.One Helper - By QuartzWarrior"
document.querySelector("html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(6) > a:nth-of-type(4).ioGameLink.withClickSound")
.href = "https://quartzwarrior.xyz"
// Chest Claimer (works like half the time)
console.log("Claiming all chests . . .")
setTimeout(function () {
for (var i in range(chests.length)) {
try {
document.querySelector(chests[i])
.click()
} catch {}
}
}, 3000)
})
/* Notes (CSS Selectors) that I took when browsing the homepage)
// Skin/Character
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(3) > div:nth-of-type(5).one-hero.selected.click
// Close Button for Skin
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(3).F-Button.close
// Ablities
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(4) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(2) > button:nth-of-type(1) > div:nth-of-type(1).hoverLight.hoverLightnormal
// Save Button for Abilities
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(4) > div:nth-of-type(2) > span:nth-of-type(1).label
// Close Button for Abilities
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(42) > div:nth-of-type(3).F-Button.close
// Reset Button for Abilities
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(41) > div:nth-of-type(2) > div:nth-of-type(4) > div:nth-of-type(1) > span:nth-of-type(1).label
// Gold Chest
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(5) > ul:nth-of-type(1) > li:nth-of-type(3) > div:nth-of-type(4) > span:nth-of-type(1).label
// Silver Chest
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(5) > ul:nth-of-type(1) > li:nth-of-type(2) > div:nth-of-type(4) > span:nth-of-type(1).label
// Wooden Chest
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(5) > ul:nth-of-type(1) > li:nth-of-type(1) > div:nth-of-type(4) > span:nth-of-type(1).label
// Gamemodes
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(4) > div:nth-of-type(3) > div:nth-of-type(1) > div:nth-of-type(1) > div:nth-of-type(1).label
// Ranked
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(24) > div:nth-of-type(3) > div:nth-of-type(2) > div:nth-of-type(1).item.ranked
// FFA
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(24) > div:nth-of-type(3) > div:nth-of-type(2) > div:nth-of-type(2).item.ffa
// FFA Start
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(24) > div:nth-of-type(3) > div:nth-of-type(4) > div:nth-of-type(4) > span:nth-of-type(1).label
// Zombies
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(24) > div:nth-of-type(3) > div:nth-of-type(2) > div:nth-of-type(3).item.zombie
// Zombies Start
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(24) > div:nth-of-type(3) > div:nth-of-type(4) > div:nth-of-type(1) > span:nth-of-type(1).label
// Teams
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(24) > div:nth-of-type(3) > div:nth-of-type(2) > div:nth-of-type(4).item.team
// Abilities
// html:nth-of-type(1) > body:nth-of-type(1) > div:nth-of-type(42) > div:nth-of-type(2) > div:nth-of-type(5) > div:nth-of-type({NUMBER}) > div:nth-of-type(1).checkbox
*/
// Up arrow and down arrow listening for quick-abilities
$(document)
.keydown(function (e) {
switch (e.key) {
case "ArrowUp":
break;
case "ArrowDown":
break;
default:
return;
}
e.preventDefault();
try {
openAbilities()
resetAbilities()
var chosen_abilities
if (e.key == "ArrowUp") {
chosen_abilities = GM_getValue("AbilitiesUp")
} else if (e.key == "ArrowDown") {
chosen_abilities = GM_getValue("AbilitiesDown")
}
upgradeAbilities(chosen_abilities)
saveAbilities()
} catch {
console.log("Cannot switch Abilities, please go into the homescreen to switch.")
}
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment