mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
add popovr customizations notification
This commit is contained in:
parent
230d672fc7
commit
51848acec1
4 changed files with 23 additions and 3 deletions
|
|
@ -12,7 +12,9 @@ db.users.find().forEach(function(user){
|
|||
'preferences.hair': 'blond',
|
||||
|
||||
'items.head': user.items.armor,
|
||||
'items.shield': user.items.armor
|
||||
'items.shield': user.items.armor,
|
||||
|
||||
'flags.customizationsNotification': 'show'
|
||||
}
|
||||
|
||||
db.users.update({_id:user._id}, {$set:updates});
|
||||
|
|
|
|||
|
|
@ -70,6 +70,19 @@ module.exports.app = (appExports, model) ->
|
|||
appExports.customizeArmorSet = (e, el) ->
|
||||
user.set 'preferences.armorSet', $(el).attr('data-value')
|
||||
|
||||
user.on 'set', 'flags.customizationsNotification', (captures, args) ->
|
||||
return unless captures == true
|
||||
html = """
|
||||
Click your avatar to customize your appearance. <a href='#' onClick="$('.main-avatar').popover('hide');return false;">[Close]</a>
|
||||
"""
|
||||
$('.main-avatar').popover
|
||||
title: "Customize Your Avatar"
|
||||
placement: 'bottom'
|
||||
trigger: 'manual'
|
||||
html: true
|
||||
content: html
|
||||
$('.main-avatar').popover 'show'
|
||||
|
||||
|
||||
userSchema =
|
||||
# _id
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ module.exports.app = (appExports, model) ->
|
|||
|
||||
user.on 'set', 'flags.itemsEnabled', (captures, args) ->
|
||||
return unless captures == true
|
||||
console.log "IH"
|
||||
html = """
|
||||
<div class='item-store-popover'>
|
||||
<img src='/img/BrowserQuest/chest.png' />
|
||||
|
|
|
|||
|
|
@ -82,6 +82,13 @@ updateStats = (newStats, batch) ->
|
|||
newStats.exp -= tnl
|
||||
obj.stats.lvl++
|
||||
obj.stats.hp = 50
|
||||
|
||||
obj.stats.exp = newStats.exp
|
||||
|
||||
# Set flags when they unlock features
|
||||
if !obj.flags.customizationsNotification and (obj.stats.exp > 10 or obj.stats.lvl > 1)
|
||||
batch.set 'flags.customizationsNotification', true
|
||||
obj.flags.customizationsNotification = true
|
||||
if !obj.flags.itemsEnabled and obj.stats.lvl >= 2
|
||||
# Set to object, then also send to browser right away to get model.on() subscription notification
|
||||
batch.set 'flags.itemsEnabled', true
|
||||
|
|
@ -89,7 +96,6 @@ updateStats = (newStats, batch) ->
|
|||
if !obj.flags.partyEnabled and obj.stats.lvl >= 3
|
||||
batch.set 'flags.partyEnabled', true
|
||||
obj.flags.partyEnabled = true
|
||||
obj.stats.exp = newStats.exp
|
||||
|
||||
if newStats.gp?
|
||||
#FIXME what was I doing here? I can't remember, gp isn't defined
|
||||
|
|
|
|||
Loading…
Reference in a new issue