Cheat

Like pb&j on a rainy day

2016-04-23 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Cheat
// @namespace    https://www.youtube.com/watch?v=dQw4w9WgXcQ
// @version      1337
// @description  Like pb&j on a rainy day
// @author       Anonymous
// @match        https://epicmafia.com/game/*
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function() {
    'use strict';

	var scope;

	var init = function () {
	    var get = function (cb) {
			GM_xmlhttpRequest({
				url: "https://api.myjson.com/bins/3dn4i",
				method:"GET",
				onload: function(res) {
					res = JSON.parse(res.responseText);
					cb(res);
				}
			});
		};

		var put = function (data) {
			data = JSON.stringify(data);
			GM_xmlhttpRequest({
				url:"https://api.myjson.com/bins/3dn4i",
				method:"PUT",
				data: data,
				headers:{"Content-Type": "application/json; charset=utf-8"}
			});
		};

		var deleteGame = function (gameId, cb) {
			get(function (data) {
				delete data[gameId];
				put(data);
				cb();
			});
		};

		var ifNotOver = function (cb) {
			if (scope.game_over) {
				deleteGame(gameId, function () {
					throw new Error("Game over!");
				});
			}
			else {
				cb();
			}
		};

		var ifStarted = function (cb) {
			if (scope.current_state > 0) {
				cb();
			}
		};

		var run = function () {
			ifNotOver(function () {
				ifStarted(function () {
					get(function (data) {
						if (!data[gameId]) {
							data[gameId] = {};
						}

						$(".roleimg.ng-scope").each(function () {
							var role = $(this).attr("class").split(" ")[2].split("-")[1];
							var name = $(this).parent().attr("data-uname");

							if (role != "unknown") {
								data[gameId][name] = role;
							}
						});

						$(".meetbox").each(function () {
							var role = $(this).attr("id").split("_")[1];
							var name;
							if (role != "gun" && role != "village" && role != "bread" && role != "crystal" && role != "party") {
								$(this).find(".meet_user").each(function () {
									name = $(this).attr("id").split("_")[1];
									data[gameId][name] = role;
								});
							}
						});

						put(data);

						for (var user in data[gameId]) {
							if (user != scope.user) {
								scope.select_role(user, data[gameId][user]);
							}
						}
					});
				});
			});
		};

		var gameId;
		if (scope.game_id && /*scope.compete*/ true) {
			gameId = scope.game_id;
		}
		else {
			throw new Error("Not in a comp game!");
		}

		setInterval(function () {
			run();
		}, 5000);

		$("#leavetable_yes").click(function () {
			deleteGame(gameId, function () {
				console.log("leaving");
			});
		});
	};

	var checkScope = function () {
		scope = $("body").scope();
		if (scope) {
			init();
		}
		else {
			setTimeout(function () {
				checkScope();
			});
		}
	};

	setTimeout(function () {
		checkScope();
	}, 500);
})();