Merge branch 'develop'

This commit is contained in:
Tyler Renelle
2013-03-28 00:52:22 -07:00
159 changed files with 973 additions and 232 deletions
+92
View File
@@ -0,0 +1,92 @@
/**
* Migrate old pets to new system
*/
// mongo habitrpg ./node_modules/underscore/underscore.js ./migrations/20130326_migrate_pets.js
var mapping = {
bearcub: {name:'BearCub', modifier: 'Base'},
cactus: {name:'Cactus', modifier:'Base'},
dragon: {name:'Dragon', modifier:'Base'},
flyingpig: {name:'FlyingPig', modifier:'Base'},
fox: {name:'Fox', modifier:'Base'},
lioncub: {name:'LionCub', modifier:'Base'},
pandacub: {name:'PandaCub', modifier:'Base'},
tigercub: {name:'TigerCub', modifier:'Base'},
wolfBorder: {name:'Wolf', modifier:'Base'},
wolfDesert: {name:'Wolf', modifier:'Desert'},
wolfGolden: {name:'Wolf', modifier:'Golden'},
wolfRed: {name:'Wolf', modifier:'Red'},
wolfShade: {name:'Wolf', modifier:'Shade'},
wolfSkeleton: {name:'Wolf', modifier:'Skeleton'},
wolfVeteran: {name:'Wolf', modifier:'Veteran'},
wolfWhite: {name:'Wolf', modifier:'White'},
wolfZombie: {name:'Wolf', modifier:'Zombie'}
}
/**
== Old Style ==
pet: Object
icon: "Pet-Wolf-White.png"
index: 14
name: "wolfWhite"
text: "White Wolf"
value: 3
pets: Object
bearcub: true
cactus: true
== New Style ==
currentPet: Object
modifier: "Red"
name: "Wolf"
notes: "Find some Hatching Powder to sprinkle on this egg, and one day it will hatch into a loyal pet."
str: "Wolf-Red"
text: "Wolf"
value: 3
pets: Array
0: "PandaCub-Base"
1: "Wolf-Base"
*/
db.users.find().forEach(function(user){
if (!user.items || (!user.items.pets && !user.items.pet)) return;
// migrate items.pet to items.currentPet
if (!!user.items.pet) {
var mapped = mapping[user.items.pet.name];
delete user.items.pet;
user.items.currentPet = {
modifier: mapped.modifier,
name: mapped.name,
str: mapped.name + "-" + mapped.modifier,
text: '' // FIXME?
}
}
// migrate items.pets
if (!!user.items.pets) {
var newPets = [];
_.each(user.items.pets, function(val, key){
if (_.isNumber(key)) {
newPets.push(val)
//FIXME why is this happening? seems the user gets migrated already...
//throw "Error: User appears already migrated, this shouldn't be happening!"
} else {
newPets.push(mapping[key].name + "-" + mapping[key].modifier);
}
});
user.items.pets = newPets;
}
try {
db.users.update(
{_id:user._id},
{$set:
{ 'items' : user.items }
}
);
} catch(e) {
print(e);
}
})
+109
View File
@@ -0,0 +1,109 @@
/**
* Applies backer tokens & items (this file will be updated periodically
*/
// mongo habitrpg ./node_modules/underscore/underscore.js migrations/20130327_apply_tokens.js
var mapping = [
{ // $1
tokens: 0,
users: []
},
{ // $5
tokens: 20,
users: ['9']
},
{ // $10
tokens: 50,
users: []
},
{ // $15
tokens: 100,
users: []
},
{ // $30
tokens: 150,
users: []
},
{ // $45
tokens: 170,
users: []
},
{ // $60
tokens: 200,
users: []
},
{ // $70
tokens: 240,
users: []
},
{ // $80
tokens: 240,
users: []
},
{ // $90
tokens: 280,
users: []
},
{ // $300
tokens: 500,
users: []
},
{ // $800
tokens: 500,
users: []
}
];
db.users.find().forEach(function(user){
_.each(mapping, function(tier){
if(
(!user.backer || !user.backer.tokensApplied) &&
(
_.contains(tier.users, user._id) ||
!!user.local && (
_.contains(tier.users, user.local.username) ||
_.contains(tier.users, user.local.email)
)
)
) {
try {
db.users.update(
{_id:user._id},
{
$set: { 'backer.tokensApplied': true, 'flags.ads': 'hide' },
$inc: { balance: (tier.tokens/4) }
}
);
} catch(e) {
print(e);
}
}
})
})
// This doesn't work, but shows the idea we're after better than the above
/*
_.each(mapping, function(tier){
db.users.update(
{
$or: [
{ _id: { $in: tier.users } },
{ 'auth.local.username': { $in: tier.users } },
{ 'auth.local.email': { $in: tier.users } }
],
'backer.tokensApplied': { $exists: false }
},
{
$set: { 'backer.tokensApplied': true, 'flags.ads': 'hide' },
$inc: { balance: (tier.tokens/4) }
},
{ multi: true}
)
})
*/
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

+13 -11
View File
@@ -1,11 +1,13 @@
Mount_Head_Lion, Mount_Body_Lion, Mount_Head_PolarBear, Mount_Body_PolarBear, Mount_Head_Panda, Mount_Body_Panda, Mount_Head_Tiger, Mount_Body_Tiger, Mount_Head_Bear, Mount_Body_Bear {background: url(Mount-SpriteSheet.png) no-repeat}
Mount_Head_Lion {background-position: 0 0; width: 105px; height: 123px}
Mount_Body_Lion {background-position: -105 0; width: 105px; height: 123px}
Mount_Head_PolarBear {background-position: -210 0; width: 105px; height: 123px}
Mount_Body_PolarBear {background-position: -315 0; width: 105px; height: 123px}
Mount_Head_Panda {background-position: -420 0; width: 105px; height: 123px}
Mount_Body_Panda {background-position: -525 0; width: 105px; height: 123px}
Mount_Head_Tiger {background-position: -630 0; width: 105px; height: 123px}
Mount_Body_Tiger {background-position: -735 0; width: 105px; height: 123px}
Mount_Head_Bear {background-position: -840 0; width: 105px; height: 123px}
Mount_Body_Bear {background-position: -945 0; width: 105px; height: 123px}
.Mount_Head_Lion, .Mount_Body_Lion, .Mount_Head_PolarBear, .Mount_Body_PolarBear, .Mount_Head_Panda, .Mount_Body_Panda, .Mount_Head_Tiger, .Mount_Body_Tiger, .Mount_Head_Bear, .Mount_Body_Bear, .Mount_Head_EtherealLion, .Mount_Body_EtherealLion {background: url(Mount-SpriteSheet.png) no-repeat}
.Mount_Head_Lion {background-position: 0 0; width: 105px; height: 123px}
.Mount_Body_Lion {background-position: -105 0; width: 105px; height: 123px}
.Mount_Head_PolarBear {background-position: -210 0; width: 105px; height: 123px}
.Mount_Body_PolarBear {background-position: -315 0; width: 105px; height: 123px}
.Mount_Head_Panda {background-position: -420 0; width: 105px; height: 123px}
.Mount_Body_Panda {background-position: -525 0; width: 105px; height: 123px}
.Mount_Head_Tiger {background-position: -630 0; width: 105px; height: 123px}
.Mount_Body_Tiger {background-position: -735 0; width: 105px; height: 123px}
.Mount_Head_Bear {background-position: -840 0; width: 105px; height: 123px}
.Mount_Body_Bear {background-position: -945 0; width: 105px; height: 123px}
.Mount_Head_EtherealLion {background-position: -1050 0; width: 105px; height: 123px}
.Mount_Body_EtherealLion {background-position: -1155 0; width: 105px; height: 123px}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

+22 -10
View File
@@ -1,10 +1,22 @@
Pet_Egg_Wolf, Pet_Egg_Tiger, Pet_Egg_PolarBear, Pet_Egg_Panda, Pet_Egg_Lion, Pet_Egg_FlyingPig, Pet_Egg_Drake, Pet_Egg_Cactus, Pet_Egg_Bear {background: url(Egg_Sprite_Sheet.png) no-repeat}
Pet_Egg_Wolf {background-position: 0 0; width: 48px; height: 51px}
Pet_Egg_Tiger {background-position: 0 -51; width: 48px; height: 51px}
Pet_Egg_PolarBear{background-position: 0 -102; width: 48px; height: 51px}
Pet_Egg_Panda {background-position: 0 -153; width: 48px; height: 51px}
Pet_Egg_Lion {background-position: 0 -204; width: 48px; height: 51px}
Pet_Egg_FlyingPig {background-position: 0 -255; width: 48px; height: 51px}
Pet_Egg_Drake {background-position: 0 -306; width: 48px; height: 51px}
Pet_Egg_Cactus {background-position: 0 -357; width: 48px; height: 51px}
Pet_Egg_Bear {background-position: 0 -408; width: 48px; height: 51px}
.Pet_Egg_Wolf, .Pet_Egg_TigerCub, .Pet_Egg_PolarBear, .Pet_Egg_PandaCub, .Pet_Egg_LionCub, .Pet_Egg_Fox, .Pet_Egg_FlyingPig, .Pet_Egg_Dragon, .Pet_Egg_Cactus, .Pet_Egg_BearCub, .Pet_HatchingPotion_Base, .Pet_HatchingPotion_White, .Pet_HatchingPotion_Desert, .Pet_HatchingPotion_Red, .Pet_HatchingPotion_Shade, .Pet_HatchingPotion_Skeleton, .Pet_HatchingPotion_Zombie, .Pet_HatchingPotion_CottonCandyPink, .Pet_HatchingPotion_CottonCandyBlue, .Pet_HatchingPotion_Golden {background: url("/img/sprites/Egg_Sprite_Sheet.png") no-repeat}
.Pet_Egg_Wolf {background-position: 0px 0px; width: 48px; height: 51px}
.Pet_Egg_TigerCub {background-position: 0px -51px; width: 48px; height: 51px}
.Pet_Egg_PolarBear {background-position: 0px -102px; width: 48px; height: 51px}
.Pet_Egg_PandaCub {background-position: 0px -153px; width: 48px; height: 51px}
.Pet_Egg_LionCub {background-position: 0px -204px; width: 48px; height: 51px}
.Pet_Egg_Fox {background-position: 0px -255px; width: 48px; height: 51px}
.Pet_Egg_FlyingPig {background-position: 0px -306px; width: 48px; height: 51px}
.Pet_Egg_Dragon {background-position: 0px -357px; width: 48px; height: 51px}
.Pet_Egg_Cactus {background-position: 0px -408px; width: 48px; height: 51px}
.Pet_Egg_BearCub {background-position: 0px -459px; width: 48px; height: 51px}
.Pet_HatchingPotion_Base {background-position: -48px -0px; width: 48px; height: 51px}
.Pet_HatchingPotion_White {background-position: -48px -51px; width: 48px; height: 51px}
.Pet_HatchingPotion_Desert {background-position: -48px -102px; width: 48px; height: 51px}
.Pet_HatchingPotion_Red {background-position: -48px -153px; width: 48px; height: 51px}
.Pet_HatchingPotion_Shade {background-position: -48px -204px; width: 48px; height: 51px}
.Pet_HatchingPotion_Skeleton {background-position: -48px -255px; width: 48px; height: 51px}
.Pet_HatchingPotion_Zombie {background-position: -48px -306px; width: 48px; height: 51px}
.Pet_HatchingPotion_CottonCandyPink {background-position: -48px -357px; width: 48px; height: 51px}
.Pet_HatchingPotion_CottonCandyBlue {background-position: -48px -408px; width: 48px; height: 51px}
.Pet_HatchingPotion_Golden {background-position: -48px -459px; width: 48px; height: 54px} /* This sprite was a bit taller than everything else, will affect the math of anything inserted below it */
Binary file not shown.

Before

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Some files were not shown because too many files have changed in this diff Show More