faelcolt

Steam - Community Pillar (2023)

Mar 30th, 2021 (edited)
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Subir de level na Steam (Pilar da Comunidade)
  2.  
  3. Abra a Steam no navegador, vá até a insígnia "Pilar da Comunidade", abra o console do navegador e cole este código e dê enter:
  4.  
  5. 'use strict';
  6.  
  7. (function() {
  8.   var pathMatch = window.location.pathname.match(/^\/((?:id|profiles)\/[^\/]+)\/badges\/(\d+)/);
  9.   if (window.location.hostname !== 'steamcommunity.com' || !pathMatch || pathMatch[2] != '2') {
  10.     window.location.href = 'https://steamcommunity.com/my/badges/2';
  11.     return;
  12.   }
  13.  
  14.   if (!g_steamID) {
  15.     alert('You are not logged in!');
  16.     return;
  17.   }
  18.  
  19.   var k_ExpectedTasksCount = 28;
  20.   var g_ProfilePath = pathMatch[1];
  21.   var g_SteamTasks = $J('.badge_task');
  22.  
  23.   if (g_SteamTasks.length != k_ExpectedTasksCount) {
  24.     console.error('Expected tasks ' + k_ExpectedTasksCount + ', but found ' + g_SteamTasks.length);
  25.     console.error('Stopped');
  26.     return;
  27.   }
  28.  
  29.   var g_TasksQueue = [];
  30.  
  31.   var bTaskBroadcast = isTaskAvailable(3);
  32.   var bTaskGameWishlist = isTaskAvailable(5);
  33.   var bTaskWorkshopRate = isTaskAvailable(11);
  34.   var bTaskWorkshopSubscribe = isTaskAvailable(12);
  35.   var bTaskWorkshop = bTaskWorkshopRate || bTaskWorkshopSubscribe;
  36.   var bTaskCommunityProfileRealName = isTaskAvailable(15);
  37.   var bTaskCommunityProfile = bTaskCommunityProfileRealName || isTaskAvailable(14) || isTaskAvailable(16);
  38.   var bTaskJoinGroup = isTaskAvailable(17);
  39.   var bTaskProfileComment = isTaskAvailable(18);
  40.   var bTaskFeedRateUp = isTaskAvailable(19);
  41.   var bTaskPostStatus = isTaskAvailable(20);
  42.   var bTaskSelectBadge = isTaskAvailable(23);
  43.   var bTaskDiscussionsSearch = isTaskAvailable(25);
  44.  
  45.   function isTaskAvailable(task_id) {
  46.     var task = g_SteamTasks.eq(task_id);
  47.     if (!task.length)
  48.       return false;
  49.  
  50.     return task.find('.quest_icon').attr('src').indexOf('_off') != -1;
  51.   }
  52.  
  53.   function DoTaskBroadcast(next) {
  54.     $J.get('//steamcommunity.com/apps/allcontenthome?appHubSubSection=13').done(function(data) {
  55.       // first available broadcast
  56.       var match = data.match(/watch\/(\d+)/);
  57.       if (!match) {
  58.         console.error('[DoTaskBroadcast] Fail! (2)');
  59.         return next();
  60.       }
  61.  
  62.       $J.get('//steamcommunity.com/broadcast/getbroadcastmpd/', {
  63.         steamid: match[1],
  64.         broadcastid: 0,
  65.         viewertoken: 0,
  66.         sessionid: g_sessionID
  67.       }).done(function(data) {
  68.         if (data.success !== 'ready') {
  69.           console.error('[DoTaskBroadcast] Fail! (4)');
  70.         } else {
  71.           console.log('[DoTaskBroadcast] OK!');
  72.         }
  73.       }).fail(function() {
  74.         console.error('[DoTaskBroadcast] Fail! (3)');
  75.       }).always(function() {
  76.         next();
  77.       });
  78.     }).fail(function() {
  79.       console.error('[DoTaskBroadcast] Fail! (1)');
  80.       next();
  81.     });
  82.   }
  83.  
  84.   function DoTaskGameWishlist(next) {
  85.     $J.post('//steamcommunity.com/actions/AddToWishlist', {
  86.       sessionid: g_sessionID,
  87.       appid: 60 // Ricochet
  88.     }).done(function(data) {
  89.       if (data.success) {
  90.         console.log('[DoTaskGameWishlist] OK!');
  91.       } else {
  92.         console.error('[DoTaskGameWishlist] Fail! (2)');
  93.       }
  94.     }).fail(function() {
  95.       console.error('[DoTaskGameWishlist] Fail! (1)');
  96.     }).always(function() {
  97.       next();
  98.     });
  99.   }
  100.  
  101.   function DoTaskWorkshop(next) {
  102.     $J.get('//steamcommunity.com/workshop/browse/', {
  103.       appid: 440,
  104.       browsesort: 'totaluniquesubscribers'
  105.     }).done(function(data) {
  106.       var matches = data.match(/sharedfile_(\d+)/g);
  107.       if (!matches) {
  108.         console.error('[DoTaskWorkshop] Fail! (2)');
  109.         return next();
  110.       }
  111.  
  112.       var file_id = matches[Math.floor(Math.random() * matches.length)].substr(11);
  113.       var isDone = false;
  114.  
  115.       if (bTaskWorkshopRate) {
  116.         console.log('[DoTaskWorkshop] Upvoting id#' + file_id);
  117.         $J.post('//steamcommunity.com/sharedfiles/voteup', {
  118.           id: file_id,
  119.           sessionid: g_sessionID
  120.         }).done(function(data) {
  121.           if (data.success == 1) {
  122.             console.log('[DoTaskWorkshop] Rate - OK!');
  123.           } else {
  124.             console.error('[DoTaskWorkshop] Rate - Fail! (4)');
  125.           }
  126.         }).fail(function() {
  127.           console.error('[DoTaskWorkshop] Rate - Fail! (3)');
  128.         }).always(function() {
  129.           if (!bTaskWorkshopSubscribe || isDone) {
  130.             return next();
  131.           }
  132.           isDone = true;
  133.         });
  134.       }
  135.  
  136.       if (bTaskWorkshopSubscribe) {
  137.         console.log('[DoTaskWorkshop] Subscribing id#' + file_id);
  138.         $J.post('//steamcommunity.com/sharedfiles/subscribe', {
  139.           id: file_id,
  140.           appid: 440,
  141.           sessionid: g_sessionID
  142.         }).done(function(data) {
  143.           if (data.success == 1) {
  144.             console.log('[DoTaskWorkshop] Subscribe - OK!');
  145.             $J.post('//steamcommunity.com/sharedfiles/unsubscribe', {
  146.               id: file_id,
  147.               appid: 440,
  148.               sessionid: g_sessionID
  149.             }).done(function(data) {
  150.               if (data.success == 1) {
  151.                 console.log('[DoTaskWorkshop] Unsubscribed');
  152.               }
  153.             });
  154.           } else {
  155.             console.error('[DoTaskWorkshop] Subscribe - Fail! (4)');
  156.           }
  157.         }).fail(function() {
  158.           console.error('[DoTaskWorkshop] Subscribe - Fail! (3)');
  159.         }).always(function() {
  160.           if (!bTaskWorkshopRate || isDone) {
  161.             return next();
  162.           }
  163.           isDone = true;
  164.         });
  165.       }
  166.     }).fail(function() {
  167.       console.error('[DoTaskWorkshop] Fail! (1)');
  168.       next();
  169.     });
  170.   }
  171.  
  172.   function DoTaskCommunityProfile(next) {
  173.     $J.get('//steamcommunity.com/' + g_ProfilePath + '/edit').done(function(data) {
  174.       var form = $J(data).find('form').eq(0);
  175.  
  176.       if (bTaskCommunityProfileRealName) {
  177.         form.find('#real_name').val('Bot' + Math.floor(Math.random() * 1e3));
  178.       }
  179.  
  180.       form.find('#summary').val('Hi, I am Bot!');
  181.       $J.post('//steamcommunity.com/' + g_ProfilePath + '/edit', form.serialize()).done(function(data) {
  182.         console.log('[DoTaskCommunityProfile] OK!');
  183.       }).fail(function() {
  184.         console.error('[DoTaskCommunityProfile] Fail! (2)');
  185.       }).always(function() {
  186.         next();
  187.       });
  188.     }).fail(function() {
  189.       console.error('[DoTaskCommunityProfile] Fail! (1)');
  190.       next();
  191.     });
  192.   }
  193.  
  194.   function DoTaskJoinGroup(next) {
  195.     $J.post('//steamcommunity.com/groups/tradingcards', {
  196.       action: 'join',
  197.       sessionID: g_sessionID
  198.     }).done(function() {
  199.       console.log('[DoTaskJoinGroup] OK!');
  200.     }).fail(function() {
  201.       console.error('[DoTaskJoinGroup] Fail!');
  202.     }).always(function() {
  203.       next();
  204.     });
  205.   }
  206.  
  207.   function DoTaskProfileComment(next) {
  208.     $J.post('//steamcommunity.com/comment/Profile/post/' + g_steamID + '/-1/', {
  209.       comment: ':steammocking:',
  210.       count: 0,
  211.       sessionid: g_sessionID
  212.     }).done(function(data) {
  213.       if (data.success) {
  214.         console.log('[DoTaskProfileComment] OK!');
  215.       } else {
  216.         console.error('[DoTaskProfileComment] Fail! (2)');
  217.       }
  218.     }).fail(function() {
  219.       console.error('[DoTaskProfileComment] Fail! (1)');
  220.     }).always(function() {
  221.       next();
  222.     });
  223.   }
  224.  
  225.   function DoTaskFeedRateUp(next) {
  226.     $J.post('//steamcommunity.com/actions/LogFriendActivityUpvote', {
  227.       sessionID: g_sessionID
  228.     }).done(function() {
  229.       console.log('[DoTaskFeedRateUp] OK!');
  230.     }).fail(function() {
  231.       console.error('[DoTaskFeedRateUp] Fail!');
  232.     }).always(function() {
  233.       next();
  234.     });
  235.   }
  236.  
  237.   function DoTaskPostStatus(next) {
  238.     $J.post('//steamcommunity.com/' + g_ProfilePath + '/ajaxpostuserstatus/', {
  239.       sessionid: g_sessionID,
  240.       status_text: 'Hello World!',
  241.       appid: 0
  242.     }).done(function(data) {
  243.       if (data.success && data.blotter_html) {
  244.         console.log('[DoTaskPostStatus] OK!');
  245.         var postid = data.blotter_html.match(/userstatus_(\d+)_/)[1];
  246.         $J.post('//steamcommunity.com/' + g_ProfilePath + '/ajaxdeleteuserstatus/', {
  247.           sessionid: g_sessionID,
  248.           postid: postid
  249.         }).done(function(data) {
  250.           if (data.success) {
  251.             console.log('[DoTaskPostStatus] Post removed');
  252.           }
  253.         });
  254.       } else {
  255.         console.error('[DoTaskPostStatus] Fail! (2)');
  256.       }
  257.     }).fail(function() {
  258.       console.error('[DoTaskPostStatus] Fail! (1)');
  259.     }).always(function() {
  260.       next();
  261.     });
  262.   }
  263.  
  264.   function DoTaskSelectBadge(next) {
  265.     $J.post('', { // current page `<profile>/badges/2`
  266.       action: 'setfavoritebadge',
  267.       sessionid: g_sessionID,
  268.       badgeid: 2 // Community Badge
  269.     }).done(function(data) {
  270.       if (data.indexOf('class="profile_fatalerror"') != -1) {
  271.         console.error('[DoTaskSelectBadge] Fail! (2)');
  272.       } else {
  273.         console.log('[DoTaskSelectBadge] OK!');
  274.       }
  275.     }).fail(function() {
  276.       console.error('[DoTaskSelectBadge] Fail! (1)');
  277.     }).always(function() {
  278.       next();
  279.     });
  280.   }
  281.  
  282.   function DoTaskDiscussionsSearch(next) {
  283.     $J.ajax({
  284.       // Really where? :(
  285.       url: '//steamcommunity.com/discussions/forum/search/?gidforum=882958665520871138&q=%57%68%65%72%65%20%69%73%20%48%61%6C%66%2D%4C%69%66%65%20%33%3F',
  286.       type: 'HEAD'
  287.     }).done(function() {
  288.       console.log('[DoTaskDiscussionsSearch] OK!');
  289.     }).fail(function() {
  290.       console.error('[DoTaskDiscussionsSearch] Fail!');
  291.     }).always(function() {
  292.       next();
  293.     });
  294.   }
  295.  
  296.   function DoNextTask() {
  297.     var Task = g_TasksQueue.shift();
  298.     if (Task) {
  299.       Task(DoNextTask);
  300.     } else {
  301.       console.log('Done! Refresh the page and see what happened')
  302.     }
  303.   };
  304.  
  305.  
  306.   if (bTaskBroadcast) {
  307.     g_TasksQueue.push(DoTaskBroadcast);
  308.     console.log('Added task `Broadcast`');
  309.   }
  310.   if (bTaskGameWishlist) {
  311.     g_TasksQueue.push(DoTaskGameWishlist);
  312.     console.log('Added task `GameWishlist`');
  313.   }
  314.   if (bTaskWorkshop) {
  315.     g_TasksQueue.push(DoTaskWorkshop);
  316.     console.log('Added task `Workshop`');
  317.   }
  318.   if (bTaskCommunityProfile) {
  319.     g_TasksQueue.push(DoTaskCommunityProfile);
  320.     console.log('Added task `CommunityProfile`');
  321.   }
  322.   if (bTaskJoinGroup) {
  323.     g_TasksQueue.push(DoTaskJoinGroup);
  324.     console.log('Added task `JoinGroup`');
  325.   }
  326.   if (bTaskProfileComment) {
  327.     g_TasksQueue.push(DoTaskProfileComment);
  328.     console.log('Added task `ProfileComment`');
  329.   }
  330.   if (bTaskFeedRateUp) {
  331.     g_TasksQueue.push(DoTaskFeedRateUp);
  332.     console.log('Added task `FeedRateUp`');
  333.   }
  334.   if (bTaskPostStatus) {
  335.     g_TasksQueue.push(DoTaskPostStatus);
  336.     console.log('Added task `PostStatus`');
  337.   }
  338.   if (bTaskDiscussionsSearch) {
  339.     g_TasksQueue.push(DoTaskDiscussionsSearch);
  340.     console.log('Added task `DiscussionsSearch`');
  341.   }
  342.   if (bTaskSelectBadge) {
  343.     g_TasksQueue.push(DoTaskSelectBadge);
  344.     console.log('Added task `SelectBadge`');
  345.   }
  346.  
  347.   if (!g_TasksQueue.length) {
  348.     console.log('Nothing to do. Great job! :)');
  349.     return;
  350.   }
  351.  
  352.   DoNextTask();
  353. })();
Advertisement
Add Comment
Please, Sign In to add comment