Advertisement
Guest User

Untitled

a guest
Aug 29th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Start() {
  2.     if (null !== global.con && global.con.connected) global.con.disconnect(), document.getElementById("connect").innerHTML = "Connect";
  3.     else {
  4.         var e = document.getElementById("email").value,
  5.             l = document.getElementById("password").value,
  6.             o = document.getElementById("worldid").value;
  7.         Log("Authenticating with EE"), PlayerIO.authenticate("everybody-edits-su9rn58o40itdbnw69plyw", "simpleUsers", {
  8.             email: e,
  9.             password: l
  10.         }, {}, function(e) {
  11.             e.multiplayer.useSecureConnections = !0, global.client = e, Log("Authenticated"), global.client.bigDB.load("config", "config", function(e) {
  12.                 global.client.multiplayer.listRooms("Everybodyedits" + e.version, null, 0, 0, function(l) {
  13.                     for (var t = !1, n = 0; n < l.length; n++) l[n].id == o && (t = !0);
  14.                     Log("Connecting"), t ? global.client.multiplayer.joinRoom(o, null, function(e) {
  15.                         global.con = e, Log("Connected"), global.con.addMessageCallback("*", OnMessage), global.con.send("init")
  16.                     }, CallbackError) : global.client.multiplayer.createJoinRoom(o, "Everybodyedits" + e.version, !0, null, null, function(e) {
  17.                         global.con = e, Log("Connected"), global.con.addMessageCallback("*", OnMessage), global.con.send("init")
  18.                     }, CallbackError)
  19.                 }, CallbackError)
  20.             }, CallbackError)
  21.         }, CallbackError)
  22.     }
  23. }
  24.  
  25. function Log(e) {
  26.     null == global.loghtml && (global.loghtml = document.getElementById("log")), global.loghtml.innerHTML += e + "\n", global.loghtml.scrollTop = global.loghtml.scrollHeight
  27. }
  28.  
  29. function DbgLog(e) {
  30.     console.log(e)
  31. }
  32.  
  33. function CallbackError(e) {
  34.     Log("Error: " + e.code + ": " + e.message)
  35. }
  36.  
  37. function TellSudoMasters(e) {
  38.     for (var l = 0; l < global.masters.length; l++) ! function(l) {
  39.         setTimeout(function() {
  40.             DbgLog("Telling sudomaster " + global.masters[l] + " -> " + e), global.con.send("say", "/pm " + global.masters[l] + " " + e)
  41.         }, 500 * l)
  42.     }(l)
  43. }
  44.  
  45. function TellRelayMasters(e) {
  46.     for (var l = 0; l < global.relaymasters.length; l++) ! function(l) {
  47.         setTimeout(function() {
  48.             global.con.send("say", "/pm " + global.relaymasters[l] + " " + e)
  49.         }, 500 * l)
  50.     }(l)
  51. }
  52.  
  53. function TellAllMasters(e) {
  54.     TellSudoMasters(e), setTimeout(function() {
  55.         TellRelayMasters(e)
  56.     }, 500 * (global.masters.length + 1))
  57. }
  58.  
  59. function setMasters() {
  60.     global.masters = document.getElementById("sudo-masters").value.split("\n"), global.relaymasters = document.getElementById("relay-masters").value.split("\n")
  61. }
  62.  
  63. function ParseCommands(e, l, o) {
  64.     "say" == o[0] ? global.con.send("say", e.substring(4)) : "pm" == o[0] ? global.con.send("say", "/pm " + o[1] + " " + e.substring(4 + o[1].length)) : "/say" == o[0] ? global.con.send("say", e.substring(5)) : "/pm" == o[0] ? global.con.send("say", "/pm " + o[1] + " " + e.substring(5 + o[1].length)) : global.con.send("say", "/pm " + l[1] + " Command not parsed.")
  65. }
  66.  
  67. function OnMessage(e) {
  68.     switch (e.type) {
  69.         case "init":
  70.             global.con.send("init2");
  71.             break;
  72.         case "init2":
  73.             0 == global.setupWithIACC && (null != document.getElementById("email").value && window.localStorage.setItem("email", btoa(document.getElementById("email").value)), null != document.getElementById("password").value && window.localStorage.setItem("password", btoa(document.getElementById("password").value))), document.getElementById("connect").innerHTML = "Disconnect", Log("EEProxy Joined");
  74.             break;
  75.         case "say":
  76.             break;
  77.         case "write":
  78.             DbgLog("Write");
  79.             var l = e.getString(1),
  80.                 o = e.getString(0).split(" "),
  81.                 t = l.split(" "); - 1 != global.masters.indexOf(o[1]) ? (Log("Sudo Master " + o[1] + " sent " + l), ParseCommands(l, o, t)) : -1 != global.relaymasters.indexOf(o[1]) ? (Log("Relay Master " + o[1] + " sent " + l), setTimeout(function() {
  82.                 TellSudoMasters(o[1] + " > " + l)
  83.             }, 500), ParseCommands(l, o, t)) : o[1].toLowerCase() != "SYSTEM".toLowerCase() || o[1].toLowerCase() != "WORLD".toLowerCase() || o[1].toLowerCase() != "MAGIC".toLowerCase() ? "you" != o[1].toLowerCase() && (Log("Generic PM from " + o[1] + " sent " + l), TellAllMasters(o[1] + " > " + l)) : Log("EE's Servers '" + o[1] + "' sent " + l);
  84.             break;
  85.         case "add":
  86.             global.players[e.getInt(0)] = e.getString(1);
  87.             break;
  88.         case "left":
  89.             delete global.players[e.getInt(0)]
  90.     }
  91. }
  92. PlayerIO.useSecureApiRequests = !0, window.onload = function() {
  93.     null !== window.localStorage.getItem("email") && (document.getElementById("email").value = atob(window.localStorage.getItem("email"))), null !== window.localStorage.getItem("password") && (document.getElementById("password").value = atob(window.localStorage.getItem("password"))), (null == window.localStorage.getItem("email") || null == window.localStorage.getItem("password")) && (global.setupWithIACC = !1, document.getElementById("feed").innerHTML += '<p><b>Hey!</b> You haven\'t used IACC for your account yet! You <a href="https://www.sirjosh3917.com/iacc.html/">should!</a> Your account details will automatically be remembered untill you get that setup.</p>')
  94. }, global = {
  95.     client: null,
  96.     con: null,
  97.     players: {},
  98.     masters: ["ninjasupeatsninja"],
  99.     relaymasters: [],
  100.     loghtml: null,
  101.     setupWithIACC: !0
  102. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement