feat(backgrounds): add backgrounds feature

This commit is contained in:
Tyler Renelle 2014-06-09 13:32:37 -06:00
parent 7161462f2c
commit d95528a205
10 changed files with 3438 additions and 3363 deletions

File diff suppressed because one or more lines are too long

View file

@ -11779,6 +11779,39 @@ _.each(api.quests, function(v, key) {
});
});
api.backgrounds = {
beach: {
text: function() {
return "Beach";
},
notes: function() {
return " Lounge upon a warm beach.";
}
},
fairy_ring: {
text: function() {
return "Fairy Ring";
},
notes: function() {
return "Dance in a fairy ring.";
}
},
forest: {
text: function() {
return "Forest";
},
notes: function() {
return "Stroll through a summer forest.";
}
}
};
_.each(api.backgrounds, function(v, key) {
return _.defaults(v, {
key: key
});
});
repeat = {
m: true,
t: true,
@ -13070,7 +13103,7 @@ api.wrap = function(user, main) {
var alreadyOwns, cost, fullSet, k, path, split, v;
path = req.query.path;
fullSet = ~path.indexOf(",");
cost = fullSet ? 1.25 : 0.5;
cost = ~path.indexOf('background.') ? fullSet ? 3.75 : 1.75 : fullSet ? 1.25 : 0.5;
alreadyOwns = !fullSet && user.fns.dotGet("purchased." + path) === true;
if (user.balance < cost && !alreadyOwns) {
return typeof cb === "function" ? cb({
@ -13088,6 +13121,9 @@ api.wrap = function(user, main) {
split = path.split('.');
v = split.pop();
k = split.join('.');
if (k === 'background' && v === user.preferences.background) {
v = '';
}
user.fns.dotSet("preferences." + k, v);
return typeof cb === "function" ? cb(null, req) : void 0;
}

6733
dist/spritesmith.css vendored

File diff suppressed because it is too large Load diff

BIN
dist/spritesmith.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 618 KiB

After

Width:  |  Height:  |  Size: 631 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -17,7 +17,7 @@
"bodySize": "Size",
"bodySlim": "Slim",
"bodyBroad": "Broad",
"unlockSet5": "Unlock Set - 5",
"unlockSet": "Unlock Set - <%= cost %>",
"locked": "locked",
"shirts": "Shirts",
"specialShirts": "Special Shirts",
@ -118,8 +118,7 @@
"continue": "Continue",
"dieText": "You've lost a Level, all your Gold, and a random piece of Equipment. Arise, Habiteer, and try again! Curb those negative Habits, be vigilant in completion of Dailies, and hold death at arm's length with a Health Potion if you falter!",
"sureReset": "Are you sure? This will reset your character's class and allocated points (you'll get them all back to re-allocate), and costs 3 gems",
"purchaseFor5": "Purchase for 5 Gems?",
"purchaseFor2": "Purchase for 2 Gems?",
"purchaseFor": "Purchase for <%= cost %> Gems?",
"notEnoughMana": "Not enough mana.",
"invalidTarget": "Invalid target",
"youCast": "You cast <%= spell %>.",

View file

@ -872,10 +872,22 @@ api.quests =
gp: 80
exp: 800
_.each api.quests, (v,key) ->
_.defaults v, {key,canBuy:true}
api.backgrounds =
beach:
text: ->"Beach"
notes: ->" Lounge upon a warm beach."
fairy_ring:
text: ->"Fairy Ring"
notes: ->"Dance in a fairy ring."
forest:
text: ->"Forest"
notes: ->"Stroll through a summer forest."
_.each api.backgrounds, (v,key)->
_.defaults v,{key}
repeat = {m:true,t:true,w:true,th:true,f:true,s:true,su:true}
api.userDefaults =
habits: [

View file

@ -670,7 +670,13 @@ api.wrap = (user, main=true) ->
unlock: (req, cb, ga) ->
{path} = req.query
fullSet = ~path.indexOf(",")
cost = if fullSet then 1.25 else 0.5 # 5G per set, 2G per individual
cost =
# (Backgrounds) 15G per set, 7G per individual
if ~path.indexOf('background.') # FIXME, store prices of things in content.coffee instead of hard-coded here?
if fullSet then 3.75 else 1.75
# (Skin, hair, etc) 5G per set, 2G per individual
else
if fullSet then 1.25 else 0.5
alreadyOwns = !fullSet and user.fns.dotGet("purchased." + path) is true
return cb?({code:401, message: i18n.t('notEnoughGems', req.language)}) if user.balance < cost and !alreadyOwns
if fullSet
@ -679,6 +685,7 @@ api.wrap = (user, main=true) ->
else
if alreadyOwns
split = path.split('.');v=split.pop();k=split.join('.')
v='' if k is 'background' and v==user.preferences.background
user.fns.dotSet("preferences.#{k}",v)
return cb? null, req
user.fns.dotSet "purchased." + path, true