Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name UC Topscore bot
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Automate topscoring of UC arcade games
- // @author GenericSkid & Ceanko
- // @match https://www.unknowncheats.me/forum/arcade.php?do=play&gameid=*
- // @grant none
- // ==/UserScript==
- (function() {
- var gameElem = $("#game_embedobj");
- // check if game exists, automate score if exists
- if (gameElem.length) {
- var game = gameElem.attr("src").split("/")[2].split(".")[0];
- var highscore = parseInt($("div.smallfont:contains('Score to Beat:')").next().text().replace(/,/g,""));
- // Insert to form
- var sidePanel = document.getElementById("collapseobj_gamepanel");
- var form = document.createElement("form");
- form.action = "https://www.unknowncheats.me/forum/index.php?act=Arcade&do=newscore";
- form.method = "POST";
- form.target = "_self";
- form.id = "cheat_frm";
- var frmName = document.createElement("input");
- frmName.name = "gname";
- frmName.type = "hidden";
- frmName.value = game;
- var frmScore = document.createElement("input");
- frmScore.name = "gscore";
- frmScore.type = "hidden";
- frmScore.value = highscore + 1;
- var frmSubmit = document.createElement("input");
- frmSubmit.type = "submit";
- frmSubmit.value = "Submit score";
- form.appendChild(frmName);
- form.appendChild(frmScore);
- form.appendChild(frmSubmit);
- sidePanel.appendChild(form);
- // automate press button
- submitScore();
- } else {
- // no game on page, visit next page
- visitNext();
- }
- // function for submitting forms without redirection
- function submitScore(){
- $.ajax({
- url:'https://www.unknowncheats.me/forum/index.php?act=Arcade&do=newscore',
- type:'POST',
- data:$('#cheat_frm').serialize(),
- success:function(){
- visitNext();
- }
- });
- }
- // visit next page
- function visitNext() {
- // get gameID
- var gameID = parseInt(window.location.href.split("&gameid=")[1]);
- // visit next game, max game should be around 400
- window.location.href = "https://www.unknowncheats.me/forum/arcade.php?do=play&gameid=" + (gameID + 1);
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment