Skip to content

Instantly share code, notes, and snippets.

@dsibilly
Last active August 29, 2015 14:06
Show Gist options
  • Save dsibilly/cc437301cb75f59f39e7 to your computer and use it in GitHub Desktop.
Save dsibilly/cc437301cb75f59f39e7 to your computer and use it in GitHub Desktop.
Automatically redeem known codes for Bungie's Destiny
/**
* destinyCodes.js
* Automatically redeem known codes for Bungie's Destiny
* Duane Sibilly <duane@sibilly.com>
*
* USAGE: Login to your account on bungie.net, and navigate to the code
* redemption page at http://www.bungie.net/en/User/coderedemption. Open your
* browser's JavaScript console (Chrome: Ctrl-Shift-J), and paste the contents
* of this file into the console. Hit enter. You can safely ignore the alert
* message that pops up for any codes you've already redeemed.
*/
/*jslint browser: true, passfail: false, white: true, indent: 4, maxlen: 80 */
// Closure ensures we only get the variables we want.
(function (bungieNetPlatform, Globals) {
'use strict';
var codes = [
// Grimoire cards
'YKA-RJG-MH9', // Warlock
'3DA-P4X-F6A', // Hunter
'MVD-4N3-NKH', // Titan
'TCN-HCD-TGY', // Rixis
'HDX-ALM-V4K', // Old Russia
'473-MXR-3X9', // Hive
'JMR-LFN-4A3', // Moon
'HC3-H44-DKC', // Gjallarhorn
'69P-KRM-JJA', // Duke
'69P-VCH-337', // The Tower
'69R-CKD-X7L', // The Hive
'69R-DDD-FCP', // Valley of the Kings, Mars
'69R-F99-AXG', // The Fallen
'69R-VL7-J6A', // Red Death
'69X-DJN-74V', // The Cabal
'6A7-7NP-3X7', // The Devastated Coast, Venus
'6A9-DTG-YGN', // Vex Minotaur
// Emblems
'X4C-FGX-MX3', // Note of Conquest
'A7L-FYC-44X', // Flames of Forgotten Truth
'X9F-GMA-H6D', // The Unimagined Plane
'N3L-XN6-PXF', // The Reflective Proof
'7F9-767-F74', // Sign of the Finite
'FJ9-LAM-67F', // Binding Focus
'JD7-4CM-HJG', // Illusion of Light
'JDT-NLC-JKM', // Ab Aeterno
'JNX-DMH-XLA', // Field of Light
'7CP-94V-LFP', // Lone Focus, Jagged Edge
// Shaders
'7MM-VPD-MHP', // Double Banshee
'RXC-9XJ-4MH' // Orakel
],
// Colorful logging for the console: green for success, red for failures
log = function (code, color, message) {
console.log('%c' + code + ': %c' + message, 'font-weight:bold; color:' + color, 'color:' + color);
};
codes.forEach(function (code) { // For every code...
// ...submit the code via Bungie's own method...
bungieNetPlatform.tokensService.ClaimAndApplyOnToken(code, Globals.BungieMembershipType.None, function () {
// Code was successfully redeemed
log(code, 'green', 'Code applied successfully');
}, function (response) {
// Code redemption failed for some reason
log(code, 'red', response.errorStatus + ': ' + response.errorMessage.slice(0, 50));
});
});
}(bungieNetPlatform, Globals));
// Minified version of destinyCodes.js, courtesy of YUI Compressor
(function(d,b){var a=["YKA-RJG-MH9","3DA-P4X-F6A","MVD-4N3-NKH","TCN-HCD-TGY","HDX-ALM-V4K","473-MXR-3X9","JMR-LFN-4A3","HC3-H44-DKC","69P-KRM-JJA","69P-VCH-337","69R-CKD-X7L","69R-DDD-FCP","69R-F99-AXG","69R-VL7-J6A","69X-DJN-74V","6A7-7NP-3X7","6A9-DTG-YGN","X4C-FGX-MX3","A7L-FYC-44X","X9F-GMA-H6D","N3L-XN6-PXF","7F9-767-F74","FJ9-LAM-67F","JD7-4CM-HJG","JDT-NLC-JKM","JNX-DMH-XLA","7CP-94V-LFP","7MM-VPD-MHP","RXC-9XJ-4MH"],c=function(g,e,f){console.log("%c"+g+": %c"+f,"font-weight:bold; color:"+e,"color:"+e)};a.forEach(function(e){d.tokensService.ClaimAndApplyOnToken(e,b.BungieMembershipType.None,function(){c(e,"green","Code applied successfully")},function(f){c(e,"red",f.errorStatus+": "+f.errorMessage.slice(0,50))})})}(bungieNetPlatform,Globals));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment