Advertisement
Guest User

Untitled

a guest
Jul 6th, 2016
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. var fs = require("fs"),
  2. Steam = require("steam"),
  3. SteamID = require("steamid"),
  4. IntervalInt = null,
  5. readlineSync = require("readline-sync"),
  6. Protos = require("./protos/protos.js"),
  7. CountCommends = 0,
  8. Long = require("long"),
  9. process = require("process"),
  10. steamID = readlineSync.question("SteamID64 do rekomendacji: ");
  11.  
  12. var ClientHello = 4006,
  13. ClientWelcome = 4004;
  14.  
  15. var accounts = [];
  16.  
  17. var arrayAccountsTxt = fs.readFileSync("accounts.txt").toString().split("\n");
  18. for (i in arrayAccountsTxt) {
  19. var accInfo = arrayAccountsTxt[i].toString().trim().split(":");
  20. var username = accInfo[0];
  21. var password = accInfo[1];
  22. accounts[i] = [];
  23. accounts[i].push({
  24. username: username,
  25. password: password
  26. });
  27. }
  28.  
  29. function loginAndCommend(steamID) {
  30. if ((steamID == "") || !(steamID.indexOf("765") > -1) || (steamID.length < 17)) {
  31. console.log("Niepoprawny SteamID!");
  32. process.exit();
  33. }
  34. if (accounts[0]) {
  35. var account = accounts[0][0];
  36. var account_name = account.username;
  37. var password = account.password;
  38. Client = new Steam.SteamClient();
  39. User = new Steam.SteamUser(Client);
  40. GC = new Steam.SteamGameCoordinator(Client, 730);
  41. Friends = new Steam.SteamFriends(Client);
  42.  
  43. Client.connect();
  44.  
  45. Client.on("connected", function() {
  46. User.logOn({
  47. account_name: account_name,
  48. password: password
  49. });
  50. });
  51.  
  52. Client.on("logOnResponse", function(res) {
  53. if (res.eresult !== Steam.EResult.OK) {
  54. if (res.eresult == Steam.EResult.ServiceUnavailable) {
  55. console.log("\n[STEAM - " + account_name + "] Logowanie nieudane - Steam nie dziala!");
  56. console.log(res);
  57. Client.disconnect();
  58. process.exit();
  59. } else {
  60. console.log("\n[STEAM CLIENT - " + account_name + "] Logowanie nieudane!");
  61. console.log(res);
  62. Client.disconnect();
  63. accounts.splice(0, 1);
  64. loginAndCommend(steamID);
  65. }
  66. } else {
  67. console.log("\n[STEAM - " + account_name + "] Zalogowano!");
  68.  
  69. Friends.setPersonaState(Steam.EPersonaState.Offline);
  70.  
  71. User.gamesPlayed({
  72. games_played: [{
  73. game_id: 730
  74. }]
  75. });
  76.  
  77. if (GC) {
  78. IntervalInt = setInterval(function() {
  79. GC.send({
  80. msg: ClientHello,
  81. proto: {}
  82. }, new Protos.CMsgClientHello({}).toBuffer());
  83. }, 2000);
  84. } else {
  85. console.log("[GC - " + account_name + "] Nie zainicjowano!");
  86. Client.disconnect();
  87. accounts.splice(0, 1);
  88. loginAndCommend(steamID);
  89. }
  90. }
  91. });
  92.  
  93. Client.on("error", function(err) {
  94. console.log("[STEAM - " + account_name + "] " + err);
  95. console.log("[STEAM - " + account_name + "] Konto jest w grze!");
  96. Client.disconnect();
  97. accounts.splice(0, 1);
  98. loginAndCommend(steamID);
  99. });
  100.  
  101. GC.on("message", function(header, buffer, callback) {
  102. switch (header.msg) {
  103. case ClientWelcome:
  104. clearInterval(IntervalInt);
  105. sendCommend(GC, Client, account_name, steamID);
  106. break;
  107. case Protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello:
  108. break;
  109. default:
  110. console.log(header);
  111. break;
  112. }
  113. });
  114. } else {
  115. console.log("\n\n" + CountCommends + " rekomendacji pomyslnie wyslanych!");
  116. Client.disconnect();
  117. }
  118. }
  119.  
  120. function sendCommend(GC, Client, account_name) {
  121. console.log("[GC - " + account_name + "] Proba wyslania rekomendacji !");
  122. var account_id = new SteamID(steamID).accountid;
  123.  
  124. var commend_payload = new Protos.PlayerCommendationInfo({
  125. cmdFriendly: 1,
  126. cmdTeaching: 2,
  127. cmdLeader: 4
  128. });
  129.  
  130. var commendProto = new Protos.CMsgGCCStrike15_v2_ClientCommendPlayer({
  131. accountId: account_id,
  132. matchId: 8,
  133. tokens: 10,
  134. commendation: commend_payload
  135. }).toBuffer();
  136.  
  137. GC.send({
  138. msg: Protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientCommendPlayer,
  139. proto: {}
  140. }, commendProto);
  141. console.log("[GC - " + account_name + "] Rekomendacja wyslana!");
  142. Client.disconnect();
  143. accounts.splice(0, 1);
  144. CountCommends++;
  145. loginAndCommend(steamID);
  146. }
  147.  
  148. process.on('uncaughtException', function (err) {
  149. });
  150.  
  151. loginAndCommend(steamID);
  152. console.log("Wlaczanie bota do rekomendacji...\nAutorzy: AskWrite - ReportBot, kapiS- przerobienie na CommendBota");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement