mounts: add support for rare mounts
This commit is contained in:
@@ -60,7 +60,7 @@ api.updateMember = function(req, res) {
|
||||
member.balance += (req.body.contributor.level - (member.contributor.level || 0))*.5 // +2 gems per tier
|
||||
}
|
||||
_.merge(member, _.pick(req.body, 'contributor'));
|
||||
if (member.contributor.level >= 6 && !member.items.pets['Dragon-Hydra']) member.items.pets['Dragon-Hydra'] = 5;
|
||||
if (member.contributor.level >= 6) member.items.pets['Dragon-Hydra'] = 5;
|
||||
member.save(cb);
|
||||
}
|
||||
], function(err, saved){
|
||||
|
||||
+26
-10
@@ -15,6 +15,12 @@ var Challenge = require('./challenge').model;
|
||||
// User Schema
|
||||
// -----------
|
||||
|
||||
var eggPotionMapping = _.transform(items.items.eggs, function(m, egg){
|
||||
_.defaults(m, _.transform(items.items.hatchingPotions, function(m2, pot){
|
||||
m2[egg.name + '-' + pot.name] = true;
|
||||
}));
|
||||
})
|
||||
|
||||
var UserSchema = new Schema({
|
||||
// ### UUID and API Token
|
||||
_id: {
|
||||
@@ -111,11 +117,17 @@ var UserSchema = new Schema({
|
||||
// 'PandaCub-Red': 10, // Number represents "Growth Points"
|
||||
// etc...
|
||||
// }
|
||||
pets: _.transform(items.items.eggs, function(m, egg){
|
||||
_.defaults(m, _.transform(items.items.hatchingPotions, function(m2, pot){
|
||||
m2[egg.name + '-' + pot.name] = Number;
|
||||
}));
|
||||
}),
|
||||
pets:
|
||||
_.defaults(
|
||||
// First transform to a 1D eggs/potions mapping
|
||||
_.transform(eggPotionMapping, function(m,v,k){ m[k] = Number; }),
|
||||
// Then add additional pets (backer, contributor)
|
||||
{
|
||||
'Wolf-Veteran': Number,
|
||||
'Wolf-Cerberus': Number,
|
||||
'Dragon-Hydra': Number
|
||||
}
|
||||
),
|
||||
currentPet: String, // Cactus-Desert
|
||||
|
||||
// eggs: {
|
||||
@@ -141,11 +153,15 @@ var UserSchema = new Schema({
|
||||
// 'PandaCub-Red': false,
|
||||
// etc...
|
||||
// }
|
||||
mounts: _.transform(items.items.eggs, function(m, egg){
|
||||
_.defaults(m, _.transform(items.items.hatchingPotions, function(m2, pot){
|
||||
m2[egg.name + '-' + pot.name] = Boolean;
|
||||
}));
|
||||
}),
|
||||
mounts: _.defaults(
|
||||
// First transform to a 1D eggs/potions mapping
|
||||
_.transform(eggPotionMapping, function(m,v,k){ m[k] = Boolean; }),
|
||||
// Then add additional pets (backer, contributor)
|
||||
{
|
||||
'LionCub-Ethereal': Boolean,
|
||||
'BearCub-Polar': Boolean
|
||||
}
|
||||
),
|
||||
currentMount: String,
|
||||
|
||||
lastDrop: {
|
||||
|
||||
@@ -25,10 +25,19 @@ script(type='text/ng-template', id='partials/options.inventory.stable.mounts.htm
|
||||
li.customize-menu(ng-repeat='egg in Items.eggs')
|
||||
menu
|
||||
div(ng-repeat='potion in Items.hatchingPotions', tooltip='{{potion.name}} {{egg.name}}', ng-init='mount = egg.name+"-"+potion.name')
|
||||
button(class="pet-button Pet-{{mount}}", ng-show='user.items.mounts[mount]', ng-class='{active: user.items.currentMount == mount}', ng-click='chooseMount(egg.name, potion.name)')
|
||||
button(class="pet-button Mount_Body_{{mount}}", ng-show='user.items.mounts[mount]', ng-class='{active: user.items.currentMount == mount}', ng-click='chooseMount(egg.name, potion.name)')
|
||||
div(class='Mount_Head_{{mount}}')
|
||||
button(class="pet-button pet-not-owned", ng-hide='user.items.mounts[mount]')
|
||||
img(src='/bower_components/habitrpg-shared/img/PixelPaw.png')
|
||||
|
||||
h4 Rare Mounts
|
||||
menu
|
||||
div
|
||||
button(ng-if='user.items.mounts["BearCub-Polar"]', class="pet-button Mount_Body_BearCub-Polar", ng-class='{active: user.items.currentMount == "BearCub-Polar")}', ng-click='chooseMount("BearCub", "Polar")', tooltip='Polar Bear')
|
||||
.Mount_Head_BearCub-Polar
|
||||
button(ng-if='user.items.mounts["LionCub-Ethereal"]', class="pet-button Mount_Body_LionCub-Ethereal", ng-class='{active: user.items.currentMount == "LionCub-Ethereal")}', ng-click='chooseMount("LionCub", "Ethereal")', tooltip='Ethereal Lion')
|
||||
.Mount_Head_LionCub-Ethereal
|
||||
|
||||
script(type='text/ng-template', id='partials/options.inventory.stable.pets.html')
|
||||
.stable
|
||||
.NPC-Matt
|
||||
|
||||
Reference in New Issue
Block a user