mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 03:52:14 +00:00
unlock the party system at level 3, view.fn 'userName'
This commit is contained in:
parent
55a019df1c
commit
e8ac4dcf86
7 changed files with 39 additions and 14 deletions
|
|
@ -97,17 +97,33 @@ module.exports.setupGrowlNotifications = (model) ->
|
|||
|
||||
user.on 'set', 'items.itemsEnabled', (captures, args) ->
|
||||
return unless captures == true
|
||||
message = "Congratulations, you have unlocked the Item Store! You can now buy weapons, armor, potions, etc. Read each item's comment for more information."
|
||||
$('ul.items').popover
|
||||
title: content.items.unlockedMessage.title
|
||||
title: "Item Store Unlocked"
|
||||
placement: 'left'
|
||||
trigger: 'manual'
|
||||
html: true
|
||||
content: "<div class='item-store-popover'>
|
||||
<img src='/img/BrowserQuest/chest.png' />
|
||||
#{content.items.unlockedMessage.content} <a href='#' onClick=\"$('ul.items').popover('hide');return false;\">[Close]</a>
|
||||
#{message} <a href='#' onClick=\"$('ul.items').popover('hide');return false;\">[Close]</a>
|
||||
</div>"
|
||||
$('ul.items').popover 'show'
|
||||
|
||||
user.on 'set', 'flags.partyEnabled', (captures, args) ->
|
||||
return unless captures == true
|
||||
message = "Congratulations, you have unlocked the Party System! You can now group with your friends by adding their User Ids."
|
||||
$('#add-friend-button').popover
|
||||
title: "Pary System Unlocked"
|
||||
placement: 'bottom'
|
||||
trigger: 'manual'
|
||||
html: true
|
||||
content: "<div class='party-system-popover'>
|
||||
<img src='/img/BrowserQuest/favicon.png' />
|
||||
#{message} <a href='#' onClick=\"$('#add-friend-button').popover('hide');return false;\">[Close]</a>
|
||||
</div>"
|
||||
$('#add-friend-button').popover 'show'
|
||||
|
||||
|
||||
# Setup listeners which trigger notifications
|
||||
user.on 'set', 'stats.hp', (captures, args) ->
|
||||
num = captures - args
|
||||
|
|
|
|||
|
|
@ -55,9 +55,6 @@ module.exports =
|
|||
]
|
||||
|
||||
items:
|
||||
unlockedMessage:
|
||||
title: "Item Store Unlocked"
|
||||
content: "Congratulations, you have unlocked the Item Store! You can now buy weapons, armor, potions, etc. Read each item's comment for more information."
|
||||
#TODO: figure out how to calculate index & type without having to store it in the JSON
|
||||
weapon: [
|
||||
{type: 'weapon', index: 0, text: "Sword 1", icon: "item-sword1", notes:'Training weapon.', value:0}
|
||||
|
|
|
|||
|
|
@ -65,4 +65,12 @@ module.exports.viewHelpers = (view) ->
|
|||
str += '_' + armorSet
|
||||
return "#{str}.png"
|
||||
else
|
||||
return "armor#{armor}_m.png"
|
||||
return "armor#{armor}_m.png"
|
||||
|
||||
view.fn "userName", (auth) ->
|
||||
if auth?.facebook?.displayName?
|
||||
auth.facebook.displayName
|
||||
else if auth?.local?
|
||||
auth.local.username
|
||||
else
|
||||
'Anonymous'
|
||||
|
|
@ -69,6 +69,7 @@ get '/', (page, model, next) ->
|
|||
setupListReferences(model)
|
||||
setupModelFns(model)
|
||||
|
||||
# Subscribe to friends
|
||||
if !_.isEmpty(userObj.friends)
|
||||
model.subscribe model.query('users').friends(userObj.friends), (err, friends) ->
|
||||
model.ref '_friends', friends
|
||||
|
|
@ -307,10 +308,9 @@ ready (model) ->
|
|||
model.fetch query, (err, users) ->
|
||||
friend = users.get(0)
|
||||
if friend.id?
|
||||
#TODO ensure unique
|
||||
user.push('friends', friendId)
|
||||
$('#add-friend-modal').modal('hide')
|
||||
window.location.reload() #TODO break old subscript, setup new, then remove reload
|
||||
window.location.reload() #TODO break old subscription, setup new subscript, remove this reload
|
||||
model.set '_newFriend', ''
|
||||
else
|
||||
model.set "_view.addFriendError", "User with id #{friendId} not found."
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ module.exports.newUserObject = ->
|
|||
items: { itemsEnabled: false, armor: 0, weapon: 0 }
|
||||
notifications: { kickstarter: 'show' }
|
||||
preferences: { gender: 'm', armorSet: 'v1' }
|
||||
flags: { partyEnabled: false }
|
||||
friends: []
|
||||
tasks: {}
|
||||
habitIds: []
|
||||
|
|
|
|||
|
|
@ -96,8 +96,10 @@ updateStats = (newStats, update) ->
|
|||
newStats.exp -= tnl
|
||||
userSet 'stats.lvl', userObj.stats.lvl + 1, update
|
||||
userSet 'stats.hp', 50, update
|
||||
if !userObj.items?.itemsEnabled and newStats.exp >=15
|
||||
if !userObj.items?.itemsEnabled and newStats.lvl >= 2
|
||||
user.set 'items.itemsEnabled', true #bit of trouble using userSet here
|
||||
if !userObj.flags?.partyEnabled and newStats.lvl >= 3
|
||||
user.set 'flags.partyEnabled', true
|
||||
userSet 'stats.exp', newStats.exp, update
|
||||
|
||||
if newStats.money?
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@
|
|||
<div class='container-fluid'>
|
||||
|
||||
<div class='row-fluid'>
|
||||
<div id=character class='span4'>
|
||||
<div id=character class='{#if _user.flags.partyEnabled}span9{else}span4{/}'>
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
|
|
@ -190,17 +190,18 @@
|
|||
</td>
|
||||
|
||||
<!-- Party -->
|
||||
<!--if _user.flags.partyUnlocked-->
|
||||
{#each _friends as :friend}
|
||||
<td class="avatar friend-avatar">
|
||||
{#if _user.flags.partyEnabled}
|
||||
{#each _friends as :friend}
|
||||
<td class="avatar friend-avatar" rel="tooltip" title="{userName(:friend.auth)}" data-placement="bottom" >
|
||||
<div class='avatar-sprites'>
|
||||
<img class='weapon weapon-{:friend.items.weapon}' src="/img/BrowserQuest/habitrpg_mods/weapon{:friend.items.weapon}.png" />
|
||||
<img class='armor armor-{:friend.items.armor}' src="/img/BrowserQuest/habitrpg_mods/{currentArmor(:friend)}" />
|
||||
</div>
|
||||
<div id="lvl"><span class="badge badge-info">Lvl {:friend.stats.lvl}</span></div>
|
||||
</td>
|
||||
{/}
|
||||
<td><a class="btn" id="add-friend-button" data-target="#add-friend-modal" data-toggle="modal"><i class="icon-user"></i></a></td>
|
||||
{/}
|
||||
<td><a class="btn" data-target="#add-friend-modal" data-toggle="modal"><i class="icon-user"></i></a></td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue