Skip to content

Instantly share code, notes, and snippets.

@retvil
Last active August 29, 2015 14:05
Show Gist options
  • Save retvil/d558b361e3a93ce8b422 to your computer and use it in GitHub Desktop.
Save retvil/d558b361e3a93ce8b422 to your computer and use it in GitHub Desktop.
[IOC] Free Steam (Add Modification)
(function()
{
if( location.href.match( /^https:\/\/store\.steampowered\.com\/account\/?$/ ) === null )
{
alert( 'Please run this on Steam\'s account page details: https://store.steampowered.com/account/' );
return;
}
var freePackages =
[
1092, // Dystopia Comp
1148, // Dystopia Beta
1534, // Smashball
17500, // Zombie Panic! Source
1870, // Pirates, Vikings and Knights II
25518, // Arma II: DayZ Mod
32938, // Just Cause 2: Multiplayer Mod
33841, // Estranged: Act I
33842, // Estranged: Act I Beta Package
34512, // Just Cause 2: Multiplayer Mod Beta Testing
35420, // Defence Alliance 2
360, // Half-Life Deathmatch: Source
4115, // Empires Mod
9008, // International Online Soccer
9014, // Half-Life 2: Capture the Flag 2.0
9018, // Science and Industry
9106, // Rock 24
9109, // Synergy
];
var ownedPackages = {};
jQuery( '.account_table a' ).each( function( i, el )
{
var match = el.href.match( /javascript:RemoveFreeLicense\( ([0-9]+), '/ );
if( match !== null )
{
ownedPackages[ +match[ 1 ] ] = true;
}
} );
var i = 0,
loaded = 0,
package = 0,
total = freePackages.length,
modal = ShowBlockingWaitDialog( 'Executing...', 'Please wait until all requests finish.' );
var ExecuteRequest = function( )
{
while( i < total && ownedPackages[ ( package = freePackages[ i ] ) ] )
{
i++;
loaded++;
}
jQuery.ajax(
{
type: 'POST',
dataType: 'text',
url: '//store.steampowered.com/checkout/addfreelicense',
data:
{
action: 'add_to_cart',
sessionid: g_sessionID,
subid: package
}
}
).always( function( )
{
loaded++;
modal.Dismiss();
if( loaded >= total )
{
ShowAlertDialog( 'GMF User All Modification Done!', 'Nod33Eset for ..::GAMEINATOR::..' );
}
else
{
modal = ShowBlockingWaitDialog( 'Executing...', 'Loaded ' + loaded + '/' + total + '. Ignore all Errors.' );
i++;
ExecuteRequest();
}
}
);
};
setTimeout( ExecuteRequest, 1500 );
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment