mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
add popovr customizations notification
This commit is contained in:
@@ -12,7 +12,9 @@ db.users.find().forEach(function(user){
|
|||||||
'preferences.hair': 'blond',
|
'preferences.hair': 'blond',
|
||||||
|
|
||||||
'items.head': user.items.armor,
|
'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});
|
db.users.update({_id:user._id}, {$set:updates});
|
||||||
|
|||||||
@@ -70,6 +70,19 @@ module.exports.app = (appExports, model) ->
|
|||||||
appExports.customizeArmorSet = (e, el) ->
|
appExports.customizeArmorSet = (e, el) ->
|
||||||
user.set 'preferences.armorSet', $(el).attr('data-value')
|
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 =
|
userSchema =
|
||||||
# _id
|
# _id
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ module.exports.app = (appExports, model) ->
|
|||||||
|
|
||||||
user.on 'set', 'flags.itemsEnabled', (captures, args) ->
|
user.on 'set', 'flags.itemsEnabled', (captures, args) ->
|
||||||
return unless captures == true
|
return unless captures == true
|
||||||
console.log "IH"
|
|
||||||
html = """
|
html = """
|
||||||
<div class='item-store-popover'>
|
<div class='item-store-popover'>
|
||||||
<img src='/img/BrowserQuest/chest.png' />
|
<img src='/img/BrowserQuest/chest.png' />
|
||||||
|
|||||||
@@ -82,6 +82,13 @@ updateStats = (newStats, batch) ->
|
|||||||
newStats.exp -= tnl
|
newStats.exp -= tnl
|
||||||
obj.stats.lvl++
|
obj.stats.lvl++
|
||||||
obj.stats.hp = 50
|
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
|
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
|
# Set to object, then also send to browser right away to get model.on() subscription notification
|
||||||
batch.set 'flags.itemsEnabled', true
|
batch.set 'flags.itemsEnabled', true
|
||||||
@@ -89,7 +96,6 @@ updateStats = (newStats, batch) ->
|
|||||||
if !obj.flags.partyEnabled and obj.stats.lvl >= 3
|
if !obj.flags.partyEnabled and obj.stats.lvl >= 3
|
||||||
batch.set 'flags.partyEnabled', true
|
batch.set 'flags.partyEnabled', true
|
||||||
obj.flags.partyEnabled = true
|
obj.flags.partyEnabled = true
|
||||||
obj.stats.exp = newStats.exp
|
|
||||||
|
|
||||||
if newStats.gp?
|
if newStats.gp?
|
||||||
#FIXME what was I doing here? I can't remember, gp isn't defined
|
#FIXME what was I doing here? I can't remember, gp isn't defined
|
||||||
|
|||||||
Reference in New Issue
Block a user