feat(valentine): valentine event
This commit is contained in:
Vendored
+547
-535
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+32
-1
@@ -10522,6 +10522,30 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ?
|
||||
user.stats.buffs.snowball = false;
|
||||
return user.stats.gp -= 5;
|
||||
}
|
||||
},
|
||||
valentine: {
|
||||
text: "Valentine Card",
|
||||
mana: 0,
|
||||
value: 10,
|
||||
target: 'user',
|
||||
notes: "Send a valentines card to a friend.",
|
||||
cast: function(user, target) {
|
||||
var _base, _ref;
|
||||
|
||||
_.each([user, target], function(t) {
|
||||
var _base, _ref;
|
||||
|
||||
if ((_ref = (_base = t.achievements).valentine) == null) {
|
||||
_base.valentine = 0;
|
||||
}
|
||||
return t.achievements.valentine++;
|
||||
});
|
||||
((_ref = (_base = target.items.special).valentineReceived) != null ? _ref : _base.valentineReceived = []).push(user.profile.name);
|
||||
if (typeof target.markModified === "function") {
|
||||
target.markModified('items.special.valentineReceived');
|
||||
}
|
||||
return user.stats.gp -= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -10811,7 +10835,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ?
|
||||
Saddle: {
|
||||
text: 'Saddle',
|
||||
value: 5,
|
||||
notes: 'Instantly raises your pet into a mount.'
|
||||
notes: 'Instantly raises one of your pets into a mount.'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12336,6 +12360,13 @@ var process=require("__browserify_process");(function() {
|
||||
}
|
||||
return typeof cb === "function" ? cb(null, _.pick(user, $w('stats'))) : void 0;
|
||||
},
|
||||
readValentine: function(req, cb) {
|
||||
user.items.special.valentineReceived.shift();
|
||||
if (typeof user.markModified === "function") {
|
||||
user.markModified('items.special.valentineReceived');
|
||||
}
|
||||
return typeof cb === "function" ? cb(null, 'items.special') : void 0;
|
||||
},
|
||||
score: function(req, cb) {
|
||||
var addPoints, calculateDelta, delta, direction, id, mpDelta, multiplier, num, options, stats, subtractPoints, task, th, _ref, _ref1, _ref2;
|
||||
|
||||
|
||||
Vendored
+547
-535
File diff suppressed because it is too large
Load Diff
Vendored
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 481 KiB After Width: | Height: | Size: 479 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
@@ -3,6 +3,9 @@
|
||||
"winterColors": "Winter Colors",
|
||||
"annoyingFriends": "Annoying Friends",
|
||||
"annoyingFriendsText": "Got snowballed <%= snowballs %> times by party members.",
|
||||
"valentineCard": "Valentine's Day Card",
|
||||
"adoringFriends": "Adoring Friends",
|
||||
"adoringFriendsText": "Aww, you and your friend must really care about each other! Sent or received <%= cards %> Valentine's Day cards.",
|
||||
"limited31Jan": "Available for purchase until January 31st (but permanently in your options if purchased).",
|
||||
"polarBear": "Polar Bear",
|
||||
"turkey": "Turkey",
|
||||
|
||||
@@ -468,6 +468,20 @@ api.spells =
|
||||
user.stats.buffs.snowball = false
|
||||
user.stats.gp -= 5
|
||||
|
||||
valentine:
|
||||
text: "Valentine Card"
|
||||
mana: 0
|
||||
value: 10
|
||||
target: 'user'
|
||||
notes: "Send a valentines card to a friend."
|
||||
cast: (user, target) ->
|
||||
_.each [user,target], (t)->
|
||||
t.achievements.valentine ?= 0
|
||||
t.achievements.valentine++
|
||||
(target.items.special.valentineReceived ?= []).push user.profile.name
|
||||
target.markModified? 'items.special.valentineReceived'
|
||||
user.stats.gp -= 10
|
||||
|
||||
# Intercept all spells to reduce user.stats.mp after casting the spell
|
||||
_.each api.spells, (spellClass) ->
|
||||
_.each spellClass, (spell, key) ->
|
||||
|
||||
@@ -612,6 +612,7 @@ api.wrap = (user, main=true) ->
|
||||
# buy is for gear, purchase is for gem-purchaseables (i know, I know...)
|
||||
buy: (req, cb) ->
|
||||
{key} = req.params
|
||||
|
||||
item = if key is 'potion' then content.potion else content.gear.flat[key]
|
||||
return cb?({code:404, message:"Item '#{key} not found (see https://github.com/HabitRPG/habitrpg-shared/blob/develop/script/content.coffee)"}) unless item
|
||||
return cb?({code:401, message:'Not enough gold.'}) if user.stats.gp < item.value
|
||||
@@ -738,6 +739,11 @@ api.wrap = (user, main=true) ->
|
||||
user.stats.mp++ if stat is 'int' #increase their MP along with their max MP
|
||||
cb? null, _.pick(user,$w 'stats')
|
||||
|
||||
readValentine: (req,cb) ->
|
||||
user.items.special.valentineReceived.shift()
|
||||
user.markModified? 'items.special.valentineReceived'
|
||||
cb? null, 'items.special'
|
||||
|
||||
# ------
|
||||
# Score
|
||||
# ------
|
||||
|
||||
Reference in New Issue
Block a user