Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Autor: Czogi
- //Aby SetUpy zadziałały należy je umieścić za botem w tym samym userscriptcie co menogram.
- //Przykłady tworzenia nowych setupów znajdują się w linii ~240 i tam należy je dodawać w podanej kolejności exp,e2,other.
- //W przypadku napotkania błędu kontakt discord: Сzogi#8027(588099587605135377)
- (async () => {
- const sleep = async (time) => {
- return await new Promise((resolve) => setTimeout(resolve, time));
- };
- const randomValue = () => {
- const length = ~~(Math.random() * (25 - 10) + 10);
- var result = "";
- var characters =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- var charactersLength = characters.length;
- for (var i = 0; i < length; i++) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- }
- return result;
- };
- unsafeWindow.expWindow;
- unsafeWindow.setUpsSelectors;
- const userID = getCookie("user_id");
- const char = getCookie("mchar_id");
- const isSi = getCookie("interface") === "si";
- const world = /(?<=\/)(.*?)(?=\.)/g.exec(location.href)[0].slice(1);
- const expSetUps = [],
- e2SetUps = [],
- otherSetUps = [];
- var init = false;
- const setVisibility = (array, mode, spec = false) => {
- const hLvl = isSi ? unsafeWindow.hero.lvl : unsafeWindow.Engine.hero.d.lvl;
- for (const option of array) {
- if (!spec) {
- option.element.style.display = mode;
- } else if (option.min + 17 <= hLvl || option.max - 17 >= hLvl) {
- option.element.style.display = "none";
- } else {
- option.element.style.display = "unset";
- }
- }
- };
- class Exp {
- constructor(name, trav, min, max, exp) {
- this.name = name;
- this.trav = trav;
- this.min = min;
- this.max = max;
- this.exp = exp;
- if (!expSetUps.length) {
- const separator = document.createElement("option");
- separator.text = "Custom exp";
- separator.disabled = true;
- unsafeWindow.setUpsSelectors[0].appendChild(separator);
- }
- this.element = document.createElement("option");
- this.element.text = name;
- this.element.value = "e";
- unsafeWindow.setUpsSelectors[0].appendChild(this.element);
- }
- applyChanges() {
- if (!expWindow.children[0].children[1].children[1].children[0].checked) {
- expWindow.children[0].children[1].children[1].children[0].click();
- }
- GM_setValue(`${userID}expMode${char}=${world}`, "on");
- GM_setValue(`${userID}otherMap${char}=${world}`, this.exp);
- GM_setValue(`${userID}mapsRet${char}=${world}`, this.trav);
- GM_setValue(`${userID}myMax${char}=${world}`, this.max);
- GM_setValue(`${userID}myMin${char}=${world}`, this.min);
- expWindow.children[1].children[1].children[1].value = this.exp;
- expWindow.children[2].children[1].children[1].value = this.trav;
- expWindow.children[1].children[0].children[0].value = this.min;
- expWindow.children[1].children[0].children[1].value = this.max;
- }
- }
- class E2 {
- constructor(name, trav, lvl, map, elite, cords = [0, 0]) {
- this.name = name;
- this.trav = trav;
- this.lvl = lvl;
- this.map = map;
- this.elite = elite;
- this.cords = cords;
- if (!e2SetUps.length) {
- const separator = document.createElement("option");
- separator.text = "Custom e2";
- separator.disabled = true;
- unsafeWindow.setUpsSelectors[0].appendChild(separator);
- }
- this.element = document.createElement("option");
- this.element.text = name;
- this.element.value = "e2";
- unsafeWindow.setUpsSelectors[0].appendChild(this.element);
- }
- applyChanges() {
- if (expWindow.children[0].children[1].children[1].children[0].checked) {
- expWindow.children[0].children[1].children[1].children[0].click();
- }
- GM_setValue(`${userID}expMode${char}=${world}`, "off");
- GM_setValue(`${userID}mainMap${char}=${world}`, this.map);
- GM_setValue(`${userID}mapsRet${char}=${world}`, this.trav);
- GM_setValue(
- `${userID}tytData${char}=${world}`,
- GM_getValue(`${userID}tytData${char}=${world}`) + this.name
- );
- GM_setValue(
- `myback${userID}${
- isSi ? unsafeWindow.map.id : unsafeWindow.Engine.map.d.id
- }=${world}`,
- this.cords.join(",")
- );
- expWindow.children[1].children[0].children[1].value = this.elite;
- expWindow.children[1].children[1].children[0].value = this.map;
- expWindow.children[1].children[2].children[0].value = this.cords.join(
- ","
- );
- expWindow.children[2].children[1].children[1].value = this.trav;
- }
- }
- class Other {
- constructor(name, trav, lvl = 0, map = 1, cords = [0, 0]) {
- this.name = name;
- this.trav = trav;
- this.lvl = lvl;
- this.map = map;
- this.cords = cords;
- if (!otherSetUps.length) {
- const separator = document.createElement("option");
- separator.text = "Custom inne";
- separator.disabled = true;
- unsafeWindow.setUpsSelectors[0].appendChild(separator);
- }
- this.element = document.createElement("option");
- this.element.text = name;
- this.element.value = "o";
- unsafeWindow.setUpsSelectors[0].appendChild(this.element);
- }
- applyChanges() {
- if (expWindow.children[0].children[1].children[1].children[0].checked) {
- expWindow.children[0].children[1].children[1].children[0].click();
- }
- GM_setValue(`${userID}expMode${char}=${world}`, "off");
- GM_setValue(`${userID}mainMap${char}=${world}`, this.map);
- GM_setValue(`${userID}mapsRet${char}=${world}`, this.trav);
- GM_setValue(
- `${userID}tytData${char}=${world}`,
- GM_getValue(`${userID}tytData${char}=${world}`) + this.name
- );
- GM_setValue(
- `myback${userID}${
- isSi ? unsafeWindow.map.id : unsafeWindow.Engine.map.d.id
- }=${world}`,
- this.cords.join(",")
- );
- expWindow.children[1].children[1].children[0].value = this.map;
- expWindow.children[1].children[2].children[0].value = this.cords.join(
- ","
- );
- expWindow.children[2].children[1].children[1].value = this.trav;
- }
- }
- do {
- if (GM_getValue("last_t") === "exp") {
- try {
- unsafeWindow.setUpsSelectors = Array.apply(
- null,
- Array.apply(null, document.querySelectorAll(".ui-draggable")).find(
- (element) => {
- return element.innerText?.includes("Main\nRelog");
- }
- ).children
- ).find((element) => {
- return element.innerText?.includes("Stan\n\nExp");
- }).children[2].children[6].children[1].children;
- } catch (error) {
- console.error("Nie znaleziono okna bota, ponawianie.");
- }
- }
- await sleep(1000);
- } while (!unsafeWindow.setUpsSelectors);
- //To z lenistwa.
- expWindow =
- setUpsSelectors[0].parentElement.parentElement.parentElement.parentElement;
- const categoriesValues = [];
- for (let i = 0; i < 5; i++) {
- categoriesValues.push(randomValue());
- }
- while (true) {
- const val = GM_getValue("last_t");
- if (val !== "exp") {
- init = false;
- }
- if (
- (!init && val === "exp") ||
- document.querySelector(`.${setUpsSelectors[1].className}`)
- .childElementCount === 5
- ) {
- try {
- unsafeWindow.setUpsSelectors = Array.apply(
- null,
- Array.apply(null, document.querySelectorAll(".ui-draggable")).find(
- (element) => {
- return element.innerText?.includes("Main\nRelog");
- }
- ).children
- ).find((element) => {
- return element.innerText?.includes("Stan\n\nExp");
- }).children[2].children[6].children[1].children;
- const separator = document.createElement("option");
- separator.text = " ";
- separator.disabled = true;
- unsafeWindow.setUpsSelectors[1].appendChild(separator);
- for (const [i, mode] of [
- "Custom Wszystko",
- "Custom Exp",
- "Custom e2",
- "Custom Inne",
- "Custom Dedykowane"
- ].entries()) {
- const filterElem = document.createElement("option");
- filterElem.text = mode;
- filterElem.value = categoriesValues[i];
- unsafeWindow.setUpsSelectors[1].appendChild(filterElem);
- }
- expSetUps.length = 0;
- e2SetUps.length = 0;
- otherSetUps.length = 0;
- ////
- /*
- #EXP - Nazwa(String), Dojście(String), MinLvl(int), MaxLvl(int), Mapy(string)
- #E2 - Nazwa(String), Dojście(String), LvlE2(int), IDMapy(int), NazwaE2(string), KordryPowrotu(array[2](int))
- #OTHER - Nazwa(String), Dojście(String)
- */
- ////
- expSetUps.push(new Exp("123", "123", 1, 15, "123"));
- expSetUps.push(new Exp("123", "123", 123, 123, "123"));
- e2SetUps.push(new E2("123", "123", 123, 123, "123", [1, 2]));
- e2SetUps.push(new E2("123", "123", 123, 123, "123", [1, 2]));
- otherSetUps.push(new Other("123", "123,123"));
- ////
- setUpsSelectors[0].onchange = () => {
- const selectedOption =
- setUpsSelectors[0].options[setUpsSelectors[0].selectedIndex];
- switch (selectedOption.value) {
- case "e":
- expSetUps
- .find((element) => {
- return element.name === selectedOption.text;
- })
- .applyChanges();
- break;
- case "e2":
- e2SetUps
- .find((element) => {
- return element.name === selectedOption.text;
- })
- .applyChanges();
- break;
- case "o":
- otherSetUps
- .find((element) => {
- return element.name === selectedOption.text;
- })
- .applyChanges();
- break;
- }
- };
- setUpsSelectors[1].onchange = () => {
- const selectedOption =
- setUpsSelectors[1].options[setUpsSelectors[1].selectedIndex];
- switch (selectedOption.value) {
- case categoriesValues[0]:
- setVisibility(e2SetUps, "unset");
- setVisibility(otherSetUps, "unset");
- setVisibility(expSetUps, "unset");
- break;
- case categoriesValues[1]:
- setVisibility(e2SetUps, "none");
- setVisibility(expSetUps, "unset");
- setVisibility(otherSetUps, "none");
- break;
- case categoriesValues[2]:
- setVisibility(expSetUps, "none");
- setVisibility(e2SetUps, "unset");
- setVisibility(otherSetUps, "none");
- break;
- case categoriesValues[3]:
- setVisibility(expSetUps, "none");
- setVisibility(e2SetUps, "none");
- setVisibility(otherSetUps, "unset");
- break;
- case categoriesValues[4]:
- setVisibility(expSetUps, "none", true);
- setVisibility(e2SetUps, "none");
- setVisibility(otherSetUps, "none");
- break;
- }
- };
- init = true;
- } catch (error) {
- console.error("Nie znaleziono okna bota, ponawianie.");
- }
- }
- await sleep(600);
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment