[#1977] APIv2 WIP - start of a framework where operations are shared

between client & server. If the op is called on the client, it updates
the user & then POSTs to the server with op of the same name. If called
on server, it updates the user and user.save()s
This commit is contained in:
Tyler Renelle
2013-12-11 09:30:39 -07:00
parent 842f0de838
commit ee1cd3c05d
39 changed files with 313 additions and 569 deletions
+3 -3
View File
@@ -11,15 +11,15 @@
// stat bars
.hero-stats
.meter.health(title='Health')
.bar(style='width: {{percent(user.stats.hp, 50)}}%;')
.bar(style='width: {{Shared.percent(user.stats.hp, 50)}}%;')
span.meter-text
i.icon-heart
| {{user.stats.hp | number:0}} / 50
.meter.experience(title='Experience')
.bar(style='width: {{percent(user.stats.exp,tnl(user.stats.lvl))}}%;')
.bar(style='width: {{Shared.percent(user.stats.exp,Shared.tnl(user.stats.lvl))}}%;')
span.meter-text
i.icon-star
| {{user.stats.exp | number:0}} / {{tnl(user.stats.lvl) | number:0}}
| {{user.stats.exp | number:0}} / {{Shared.tnl(user.stats.lvl) | number:0}}
// FIXME doesn't look great here, but the "Experience" CSS title rollover covers it where it was before
span(ng-show='user.history.exp')
a(ng-click='toggleChart("exp")', tooltip='Progress')
+1 -1
View File
@@ -40,7 +40,7 @@ div(modal='user.flags.contributor')
{{user.profile.name}}, you awesome person! You're now a level {{user.contributor.level}} contributor for helping HabitRPG. See <a href='http://habitrpg.wikia.com/wiki/Contributor_Rewards' target='_blank'>what prizes you've earned for your contribution!</a>
.modal-footer
button.btn.btn-default.cancel(ng-click='set("flags.contributor",false)') Ok
button.btn.btn-default.cancel(ng-click='set("{flags.contributor":false})') Ok
+1 -1
View File
@@ -66,4 +66,4 @@
span(class='weapon_healer_6')
.modal-footer
button.btn.btn-default.cancel(ng-click='rerollSubmit()') Select
button.btn.btn-default.cancel(ng-click='selectedClass && changeClass(selectedClass)') Select
+1 -1
View File
@@ -9,7 +9,7 @@ div(modal='user.stats.hp <= 0', options='{backdrop:true, keyboard:false, backdro
.row-fluid
.span4
p
a.btn.btn-danger.btn-large.notification-action(ng-click='User.revive()') Continue
a.btn.btn-danger.btn-large.notification-action(ng-click='user.ops.revive({})') Continue
.span8
p
| You've lost a Level, all your Gold, and a random piece of Equipment. Arise, Habiteer, and try again! Curb those negative Habits, be vigilant in completion of Dailies, and hold death at arm's length with a Health Potion if you falter!
+1 -1
View File
@@ -10,7 +10,7 @@ div(modal='modals.dropsEnabled')
p
span.item-drop-icon(class='Pet_Egg_Wolf', style='margin-left: 0px')
span.
You've unlocked the Drop System! Now when you complete tasks, you have a small chance of finding an item. You just found a <strong>{{Items.eggs.Wolf.text}}</strong> Egg! {{Items.eggs.Wolf.notes}}
You've unlocked the Drop System! Now when you complete tasks, you have a small chance of finding an item. You just found a <strong>{{Content.eggs.Wolf.text}}</strong> Egg! {{Content.eggs.Wolf.notes}}
br
p.
<span class='Pet_Currency_Gem item-drop-icon'></span> If you've got your eye on a pet, but can't wait any longer for it to drop, use Gems in <strong>Options > Inventory</strong> to buy one!
+1 -1
View File
@@ -23,7 +23,7 @@ p
| : {{profile.stats.lvl}}
p
strong Experience
| : {{profile.stats.exp | number:0}} / {{tnl(profile.stats.lvl)}}
| : {{profile.stats.exp | number:0}} / {{Shared.tnl(profile.stats.lvl)}}
p
strong Strength
| :&nbsp;
+3 -3
View File
@@ -18,10 +18,10 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
// Gold & Gems
span.option-box.pull-right.wallet(bo-if='main && list.type=="reward"')
.money
| {{gold(user.stats.gp)}}
| {{Shared.gold(user.stats.gp)}}
span.shop_gold(tooltip='Gold')
.money
| {{silver(user.stats.gp)}}
| {{Shared.silver(user.stats.gp)}}
span.shop_silver(tooltip='Silver')
// Header
@@ -62,7 +62,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
// Spells
ul.items(ng-if='main && list.type=="reward" && user.stats.class')
li.task.reward-item(ng-repeat='(k,spell) in Items.spells[user.stats.class]', ng-show='user.stats.lvl >= spell.lvl')
li.task.reward-item(ng-repeat='(k,spell) in Content.spells[user.stats.class]', ng-show='user.stats.lvl >= spell.lvl')
.task-meta-controls
span.task-notes(popover-trigger='mouseenter', popover-placement='left', popover='{{spell.notes}}', popover-title='{{spell.text}}')
i.icon-comment
+8 -8
View File
@@ -1,4 +1,4 @@
li(bindonce='list', ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}', ng-click='spell && castEnd(task, "task", $event)', ng-class='{"cast-target":spell}')
li(bindonce='list', ng-repeat='task in obj[list.type+"s"]', class='task {{Shared.taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main)}}', ng-click='spell && castEnd(task, "task", $event)', ng-class='{"cast-target":spell}')
// right-hand side control buttons
.task-meta-controls
@@ -118,13 +118,13 @@ li(bindonce='list', ng-repeat='task in obj[list.type+"s"]', class='task {{taskCl
legend.option-title Repeat
.task-controls.tile-group.repeat-days(bindonce)
// note, does not use data-toggle="buttons-checkbox" - it would interfere with our own click binding
button.task-action-btn.tile(ng-class='{active: task.repeat.su}', type='button', ng-click='task.challenge.id || (task.repeat.su = !task.repeat.su)' bo-text='moment.weekdaysMin(0)')
button.task-action-btn.tile(ng-class='{active: task.repeat.m}', type='button', ng-click='task.challenge.id || (task.repeat.m = !task.repeat.m)' bo-text='moment.weekdaysMin(1)')
button.task-action-btn.tile(ng-class='{active: task.repeat.t}', type='button', ng-click='task.challenge.id || (task.repeat.t = !task.repeat.t)' bo-text='moment.weekdaysMin(2)')
button.task-action-btn.tile(ng-class='{active: task.repeat.w}', type='button', ng-click='task.challenge.id || (task.repeat.w = !task.repeat.w)' bo-text='moment.weekdaysMin(3)')
button.task-action-btn.tile(ng-class='{active: task.repeat.th}', type='button', ng-click='task.challenge.id || (task.repeat.th = !task.repeat.th)' bo-text='moment.weekdaysMin(4)')
button.task-action-btn.tile(ng-class='{active: task.repeat.f}', type='button', ng-click='task.challenge.id || (task.repeat.f= !task.repeat.f)' bo-text='moment.weekdaysMin(5)')
button.task-action-btn.tile(ng-class='{active: task.repeat.s}', type='button', ng-click='task.challenge.id || (task.repeat.s = !task.repeat.s)' bo-text='moment.weekdaysMin(6)')
button.task-action-btn.tile(ng-class='{active: task.repeat.su}', type='button', ng-click='task.challenge.id || (task.repeat.su = !task.repeat.su)', bo-text='moment.weekdaysMin(0)')
button.task-action-btn.tile(ng-class='{active: task.repeat.m}', type='button', ng-click='task.challenge.id || (task.repeat.m = !task.repeat.m)', bo-text='moment.weekdaysMin(1)')
button.task-action-btn.tile(ng-class='{active: task.repeat.t}', type='button', ng-click='task.challenge.id || (task.repeat.t = !task.repeat.t)', bo-text='moment.weekdaysMin(2)')
button.task-action-btn.tile(ng-class='{active: task.repeat.w}', type='button', ng-click='task.challenge.id || (task.repeat.w = !task.repeat.w)', bo-text='moment.weekdaysMin(3)')
button.task-action-btn.tile(ng-class='{active: task.repeat.th}', type='button', ng-click='task.challenge.id || (task.repeat.th = !task.repeat.th)', bo-text='moment.weekdaysMin(4)')
button.task-action-btn.tile(ng-class='{active: task.repeat.f}', type='button', ng-click='task.challenge.id || (task.repeat.f= !task.repeat.f)', bo-text='moment.weekdaysMin(5)')
button.task-action-btn.tile(ng-class='{active: task.repeat.s}', type='button', ng-click='task.challenge.id || (task.repeat.s = !task.repeat.s)', bo-text='moment.weekdaysMin(6)')
// if Reward, pricing
fieldset.option-group.option-short(ng-if='task.type=="reward" && !task.challenge.id')