Move stats to separate partials

This commit is contained in:
Blade Barringer 2015-07-18 15:57:25 -05:00
parent 9994b27f1e
commit 4cff85784d
5 changed files with 61 additions and 57 deletions

View file

@ -12,60 +12,7 @@ mixin statList(calculatedStat, popover, text, useOneTimeBinding)
=env.t(text)
=': {{' + binding + calculatedStat + '}}'
h4(class=mobile?'item item-divider':'')=env.t('stats')
table.table.table-striped
+basicRow('health', '{{::statCalc.hpDisplay(profile.stats.hp)}}')
+basicRow('mana', '{{statCalc.mpDisplay(profile)}}')(ng-if='profile.stats.lvl >= 10 && !profile.preferences.disableClasses')
+basicRow('gold', '{{::statCalc.goldDisplay(profile.stats.gp)}}')
+basicRow('level', '{{::profile.stats.lvl}}')
+basicRow('experience', '{{::statCalc.expDisplay(profile)}}')
unless mobile
h4.stats-equipment(class=mobile?'item item-divider':'',
ng-show='user.flags.itemsEnabled')=env.t('equipment')
table.table.table-striped(ng-show='user.flags.itemsEnabled')
tr(ng-repeat='(itemType,gear) in profile.items.gear.equipped',
ng-init='piece=Content.gear.flat[gear]', ng-show='piece')
td
strong {{piece.text()}}: 
span(ng-repeat='stat in ["str","con","per","int"]', ng-show='piece[stat]') {{piece[stat]}} {{stat.toUpperCase()}} 
h4(class=mobile?'item item-divider':'')=env.t('attributes')
table.table.table-striped
each statInfo, stat in { str: {title:"strength",popover:'strengthText'},int: {title:"intelligence",popover:'intText'},con: {title:"constitution",popover:'conText'},per: {title:"perception",popover:'perText'} }
tr
td
span.hint(popover-title=env.t(statInfo.title), popover-placement='right',
popover=env.t(statInfo.popover), popover-trigger='mouseenter')
strong=env.t(statInfo.title)
strong : {{profile._statsComputed.#{stat}}}
td: ul.list-unstyled
+statList('statCalc.levelBonus(profile.stats.lvl)', 'levelBonus', 'level', true)
+statList('statCalc.equipmentStatBonus("' + stat + '", profile.items.gear.equipped)', 'equipmentBonus', 'equipment', true)
+statList('statCalc.classBonus(profile, "' + stat + '")', 'classBonus', 'classEquipBonus')
+statList('profile.stats.' + stat, 'allocatedPoints', 'allocated')
+statList('profile.stats.buffs.' + stat, 'buffs', 'buffs', true)
tr(ng-if='profile.stats.buffs.stealth')
td(colspan='2')
strong.hint(popover-title=env.t('stealth'), popover-trigger='mouseenter',
popover-placement='right', popover=env.t('stealthNewDay'))
=env.t('stealth')
strong : {{profile.stats.buffs.stealth}} 
tr(ng-if='profile.stats.buffs.streaks')
td(colspan='2')
strong.hint(popover-title=env.t('streaksFrozen'), popover-trigger='mouseenter',
popover-placement='right', popover=env.t('streaksFrozenText'))
=env.t('streaksFrozen')
h4(class=mobile?'item item-divider':'',ng-if='user.flags.dropsEnabled')=env.t('pets')
table.table.table-striped(ng-if='user.flags.dropsEnabled')
+basicRow('petsFound','{{_.size(profile.items.pets)}}')
+basicRow('beastMasterProgress','{{profile.petCount}}/90')
h4(class=mobile?'item item-divider':'', ng-if='user.flags.dropsEnabled')=env.t('mounts')
table.table.table-striped(ng-if='user.flags.dropsEnabled')
+basicRow('mountsTamed','{{_.size(profile.items.mounts)}}')
+basicRow('mountMasterProgress','{{profile.mountCount}}/90')
include ./stats/basic-stats
include ./stats/equipment
include ./stats/attributes
include ./stats/pets-and-mounts

View file

@ -0,0 +1,29 @@
h4(class=mobile?'item item-divider':'')=env.t('attributes')
table.table.table-striped
each statInfo, stat in { str: {title:"strength",popover:'strengthText'},int: {title:"intelligence",popover:'intText'},con: {title:"constitution",popover:'conText'},per: {title:"perception",popover:'perText'} }
tr
td
span.hint(popover-title=env.t(statInfo.title), popover-placement='right',
popover=env.t(statInfo.popover), popover-trigger='mouseenter')
strong=env.t(statInfo.title)
strong : {{profile._statsComputed.#{stat}}}
td: ul.list-unstyled
+statList('statCalc.levelBonus(profile.stats.lvl)', 'levelBonus', 'level', true)
+statList('statCalc.equipmentStatBonus("' + stat + '", profile.items.gear.equipped)', 'equipmentBonus', 'equipment', true)
+statList('statCalc.classBonus(profile, "' + stat + '")', 'classBonus', 'classEquipBonus')
+statList('profile.stats.' + stat, 'allocatedPoints', 'allocated')
+statList('profile.stats.buffs.' + stat, 'buffs', 'buffs', true)
tr(ng-if='profile.stats.buffs.stealth')
td(colspan='2')
strong.hint(popover-title=env.t('stealth'), popover-trigger='mouseenter',
popover-placement='right', popover=env.t('stealthNewDay'))
=env.t('stealth')
strong : {{profile.stats.buffs.stealth}} 
tr(ng-if='profile.stats.buffs.streaks')
td(colspan='2')
strong.hint(popover-title=env.t('streaksFrozen'), popover-trigger='mouseenter',
popover-placement='right', popover=env.t('streaksFrozenText'))
=env.t('streaksFrozen')

View file

@ -0,0 +1,7 @@
h4(class=mobile?'item item-divider':'')=env.t('stats')
table.table.table-striped
+basicRow('health', '{{::statCalc.hpDisplay(profile.stats.hp)}}')
+basicRow('mana', '{{statCalc.mpDisplay(profile)}}')(ng-if='profile.stats.lvl >= 10 && !profile.preferences.disableClasses')
+basicRow('gold', '{{::statCalc.goldDisplay(profile.stats.gp)}}')
+basicRow('level', '{{::profile.stats.lvl}}')
+basicRow('experience', '{{::statCalc.expDisplay(profile)}}')

View file

@ -0,0 +1,9 @@
unless mobile
h4.stats-equipment(class=mobile?'item item-divider':'',
ng-show='user.flags.itemsEnabled')=env.t('equipment')
table.table.table-striped(ng-show='user.flags.itemsEnabled')
tr(ng-repeat='(itemType,gear) in profile.items.gear.equipped',
ng-init='piece=Content.gear.flat[gear]', ng-show='piece')
td
strong {{piece.text()}}: 
span(ng-repeat='stat in ["str","con","per","int"]', ng-show='piece[stat]') {{piece[stat]}} {{stat.toUpperCase()}} 

View file

@ -0,0 +1,12 @@
div(ng-if='user.flags.dropsEnabled')
h4(class=mobile?'item item-divider':'')=env.t('pets')
table.table.table-striped
+basicRow('petsFound','{{_.size(profile.items.pets)}}')
+basicRow('beastMasterProgress','{{profile.petCount}}/90')
h4(class=mobile?'item item-divider':'')=env.t('mounts')
table.table.table-striped
+basicRow('mountsTamed','{{_.size(profile.items.mounts)}}')
+basicRow('mountMasterProgress','{{profile.mountCount}}/90')