Merge branch 'develop' into sabrecat/party-page
Conflicts: common/dist/sprites/habitrpg-shared.css common/dist/sprites/spritesmith1.css common/dist/sprites/spritesmith1.png common/dist/sprites/spritesmith4.css common/dist/sprites/spritesmith4.png website/views/options/social/index.jade
This commit is contained in:
@@ -549,8 +549,23 @@ api.timeTravelerStore = (owned) ->
|
||||
---------------------------------------------------------------
|
||||
###
|
||||
|
||||
api.potion = type: 'potion', text: t('potionText'), notes: t('potionNotes'), value: 25, key: 'potion'
|
||||
api.armoire = type: 'armoire', text: t('armoireText'), notes: t('armoireNotesEmpty'), value: 100, key: 'armoire', canOwn: ((u)-> _.contains(u.achievements.ultimateGearSets, true))
|
||||
api.potion =
|
||||
type: 'potion',
|
||||
text: t('potionText'),
|
||||
notes: t('potionNotes'),
|
||||
value: 25,
|
||||
key: 'potion'
|
||||
|
||||
api.armoire =
|
||||
type: 'armoire',
|
||||
text: t('armoireText'),
|
||||
notes: ((user, count)->
|
||||
return t('armoireNotesEmpty')() if (user.flags.armoireEmpty)
|
||||
return t('armoireNotesFull')() + count
|
||||
),
|
||||
value: 100,
|
||||
key: 'armoire',
|
||||
canOwn: ((u)-> _.contains(u.achievements.ultimateGearSets, true))
|
||||
|
||||
###
|
||||
---------------------------------------------------------------
|
||||
@@ -928,6 +943,7 @@ api.spells =
|
||||
if !target.items.special.nyeReceived
|
||||
target.items.special.nyeReceived = []
|
||||
target.items.special.nyeReceived.push user.profile.name
|
||||
target.flags.cardReceived = true
|
||||
|
||||
target.markModified? 'items.special.nyeReceived'
|
||||
user.stats.gp -= 10
|
||||
@@ -951,10 +967,75 @@ api.spells =
|
||||
if !target.items.special.valentineReceived
|
||||
target.items.special.valentineReceived = []
|
||||
target.items.special.valentineReceived.push user.profile.name
|
||||
target.flags.cardReceived = true
|
||||
|
||||
target.markModified? 'items.special.valentineReceived'
|
||||
user.stats.gp -= 10
|
||||
|
||||
greeting:
|
||||
text: t('greetingCard')
|
||||
mana: 0
|
||||
value: 10
|
||||
immediateUse: true
|
||||
silent: true
|
||||
target: 'user'
|
||||
notes: t('greetingCardNotes')
|
||||
cast: (user, target) ->
|
||||
if user == target
|
||||
user.achievements.greeting ?= 0
|
||||
user.achievements.greeting++
|
||||
else
|
||||
_.each [user,target], (t)->
|
||||
t.achievements.greeting ?= 0
|
||||
t.achievements.greeting++
|
||||
if !target.items.special.greetingReceived
|
||||
target.items.special.greetingReceived = []
|
||||
target.items.special.greetingReceived.push user.profile.name
|
||||
target.flags.cardReceived = true
|
||||
|
||||
target.markModified? 'items.special.greetingReceived'
|
||||
user.stats.gp -= 10
|
||||
|
||||
thankyou:
|
||||
text: t('thankyouCard')
|
||||
mana: 0
|
||||
value: 10
|
||||
immediateUse: true
|
||||
silent: true
|
||||
target: 'user'
|
||||
notes: t('thankyouCardNotes')
|
||||
cast: (user, target) ->
|
||||
if user == target
|
||||
user.achievements.thankyou ?= 0
|
||||
user.achievements.thankyou++
|
||||
else
|
||||
_.each [user,target], (t)->
|
||||
t.achievements.thankyou ?= 0
|
||||
t.achievements.thankyou++
|
||||
if !target.items.special.thankyouReceived
|
||||
target.items.special.thankyouReceived = []
|
||||
target.items.special.thankyouReceived.push user.profile.name
|
||||
target.flags.cardReceived = true
|
||||
|
||||
target.markModified? 'items.special.thankyouReceived'
|
||||
user.stats.gp -= 10
|
||||
|
||||
api.cardTypes =
|
||||
greeting:
|
||||
key: 'greeting'
|
||||
messageOptions: 4
|
||||
yearRound: true
|
||||
nye:
|
||||
key: 'nye'
|
||||
messageOptions: 5
|
||||
thankyou:
|
||||
key: 'thankyou'
|
||||
messageOptions: 4
|
||||
yearRound: true
|
||||
valentine:
|
||||
key: 'valentine'
|
||||
messageOptions: 4
|
||||
|
||||
# Intercept all spells to reduce user.stats.mp after casting the spell
|
||||
_.each api.spells, (spellClass) ->
|
||||
_.each spellClass, (spell, key) ->
|
||||
@@ -1897,7 +1978,7 @@ api.quests =
|
||||
gp: 37
|
||||
exp: 275
|
||||
unlock: t('questWhaleUnlockText')
|
||||
|
||||
|
||||
dilatoryDistress1:
|
||||
text: t('questDilatoryDistress1Text')
|
||||
notes: t('questDilatoryDistress1Notes')
|
||||
@@ -2116,7 +2197,7 @@ api.backgrounds =
|
||||
text: t('backgroundSunkenShipText')
|
||||
notes: t('backgroundSunkenShipNotes')
|
||||
backgrounds082015:
|
||||
pyramids:
|
||||
pyramids:
|
||||
text: t('backgroundPyramidsText')
|
||||
notes: t('backgroundPyramidsNotes')
|
||||
sunset_savannah:
|
||||
|
||||
+16
-16
@@ -190,7 +190,6 @@ preenHistory = (history) ->
|
||||
Update the in-browser store with new gear. FIXME this was in user.fns, but it was causing strange issues there
|
||||
###
|
||||
sortOrder = _.reduce content.gearTypes,((m,v,k)->m[v]=k;m), {}
|
||||
#sortOrder.potion = _.size(sortOrder) #potion goes last #actually, _.sortBy puts anything else last, so this is unecessary
|
||||
api.updateStore = (user) ->
|
||||
return unless user
|
||||
changes= []
|
||||
@@ -202,8 +201,6 @@ api.updateStore = (user) ->
|
||||
# Add special items (contrib gear, backer gear, etc)
|
||||
changes = changes.concat _.filter content.gear.flat, (v) ->
|
||||
v.klass in ['special','mystery','armoire'] and !user.items.gear.owned[v.key] and v.canOwn?(user)
|
||||
changes.push content.potion
|
||||
if user.flags.armoireEnabled then changes.push content.armoire
|
||||
# Return sorted store (array)
|
||||
_.sortBy changes, (c)->sortOrder[c.type]
|
||||
|
||||
@@ -1168,10 +1165,12 @@ 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'
|
||||
readCard: (req, cb) ->
|
||||
{cardType} = req.params
|
||||
user.items.special["#{cardType}Received"].shift()
|
||||
user.markModified? "items.special.#{cardType}Received"
|
||||
user.flags.cardReceived = false
|
||||
cb? null, 'items.special flags.cardReceived'
|
||||
|
||||
openMysteryItem: (req,cb,analytics) ->
|
||||
item = user.purchased.plan?.mysteryItems?.shift()
|
||||
@@ -1191,11 +1190,6 @@ api.wrap = (user, main=true) ->
|
||||
(user._tmp?={}).drop = item if typeof window != 'undefined'
|
||||
cb? null, user.items.gear.owned
|
||||
|
||||
readNYE: (req,cb) ->
|
||||
user.items.special.nyeReceived.shift()
|
||||
user.markModified? 'items.special.nyeReceived'
|
||||
cb? null, 'items.special'
|
||||
|
||||
# ------
|
||||
# Score
|
||||
# ------
|
||||
@@ -1722,12 +1716,16 @@ api.wrap = (user, main=true) ->
|
||||
daily.completed = false
|
||||
return
|
||||
|
||||
multiDaysCountAsOneDay = true
|
||||
# If the user does not log in for two or more days, cron (mostly) acts as if it were only one day.
|
||||
# When site-wide difficulty settings are introduced, this can be a user preference option.
|
||||
|
||||
# Tally each task
|
||||
todoTally = 0
|
||||
user.todos.forEach (task) -> # make uncompleted todos redder
|
||||
return unless task
|
||||
{id, completed} = task
|
||||
delta = user.ops.score({params:{id:task.id, direction:'down'}, query:{times:(daysMissed), cron:true}})
|
||||
delta = user.ops.score({params:{id:task.id, direction:'down'}, query:{times:(multiDaysCountAsOneDay ? 1 : daysMissed), cron:true}})
|
||||
absVal = if (completed) then Math.abs(task.value) else task.value
|
||||
todoTally += absVal
|
||||
|
||||
@@ -1738,7 +1736,7 @@ api.wrap = (user, main=true) ->
|
||||
return unless task
|
||||
{id, completed} = task
|
||||
|
||||
# Deduct points for missed Daily tasks, but not for Todos (just increase todo's value)
|
||||
# Deduct points for missed Daily tasks
|
||||
EvadeTask = 0
|
||||
scheduleMisses = daysMissed
|
||||
if completed
|
||||
@@ -1746,13 +1744,15 @@ api.wrap = (user, main=true) ->
|
||||
else
|
||||
# dailys repeat, so need to calculate how many they've missed according to their own schedule
|
||||
scheduleMisses = 0
|
||||
_.times daysMissed, (n) ->
|
||||
for n in [0...daysMissed]
|
||||
thatDay = moment(now).subtract({days: n + 1})
|
||||
if api.shouldDo(thatDay.toDate(), task, user.preferences)
|
||||
scheduleMisses++
|
||||
if user.stats.buffs.stealth
|
||||
user.stats.buffs.stealth--
|
||||
EvadeTask++
|
||||
if multiDaysCountAsOneDay
|
||||
break
|
||||
|
||||
if scheduleMisses > EvadeTask
|
||||
perfect = false
|
||||
@@ -1762,7 +1762,7 @@ api.wrap = (user, main=true) ->
|
||||
dailyChecked += fractionChecked
|
||||
else
|
||||
dailyDueUnchecked += 1
|
||||
delta = user.ops.score({params:{id:task.id, direction:'down'}, query:{times:(scheduleMisses-EvadeTask), cron:true}})
|
||||
delta = user.ops.score({params:{id:task.id, direction:'down'}, query:{times:(multiDaysCountAsOneDay ? 1 : (scheduleMisses-EvadeTask)), cron:true}})
|
||||
|
||||
# Apply damage from a boss, less damage for Trivial priority (difficulty)
|
||||
user.party.quest.progress.down += delta * (if task.priority < 1 then task.priority else 1)
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
if(removeWatch)
|
||||
{
|
||||
doRemoveWatch();
|
||||
doRemoveWatch();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -144,9 +144,9 @@
|
||||
habitrpg.filter('markdown', function() {
|
||||
return function(input){
|
||||
var html = md.toHtml(input);
|
||||
|
||||
|
||||
html = html.replace(' href',' target="_self" href');
|
||||
|
||||
|
||||
return html;
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user