mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 00:09:41 +00:00
refactor(avatar): DRY out paperdolls
This commit is contained in:
parent
be87f69cd4
commit
120550666d
3 changed files with 25 additions and 53 deletions
|
|
@ -1,3 +1,5 @@
|
|||
include generated_avatar
|
||||
|
||||
mixin avatar(opts)
|
||||
.character-sprites
|
||||
.addthis_native_toolbox(ng-if='::profile._id==user._id',
|
||||
|
|
@ -16,7 +18,7 @@ mixin avatar(opts)
|
|||
// Show avatar only if not currently affected by visual buff
|
||||
- var buffs = '!profile.stats.buffs'
|
||||
span(ng-if='#{buffs}.snowball && #{buffs}.spookDust && #{buffs}.shinySeed && #{buffs}.seafoam')
|
||||
include generated_avatar
|
||||
+generatedAvatar
|
||||
|
||||
// Mount Head
|
||||
if !opts.minimal
|
||||
|
|
|
|||
|
|
@ -4,39 +4,24 @@ mixin costumeSetting(type, options)
|
|||
- var equipped = (options.prefix || '') + 'profile.items.gear.equipped.' + type + (options.suffix || '')
|
||||
span(ng-class="profile.preferences.costume ? #{costume} : #{equipped}")
|
||||
|
||||
// Back accessory
|
||||
+costumeSetting('back')
|
||||
|
||||
span(ng-class="profile.preferences.sleep ? 'skin_' + profile.preferences.skin + '_sleep' : 'skin_' + profile.preferences.skin")
|
||||
|
||||
// Shirt
|
||||
span(class='{{profile.preferences.size}}_shirt_{{profile.preferences.shirt}}')
|
||||
|
||||
// Armor
|
||||
+costumeSetting('armor', {prefix: "profile.preferences.size + '_' + "})
|
||||
|
||||
// Cape collar
|
||||
+costumeSetting('back', {suffix: " + '_collar'"})
|
||||
|
||||
// Body
|
||||
+costumeSetting('body')
|
||||
|
||||
// Empty outline of head
|
||||
span(class='head_0')
|
||||
|
||||
// Hair
|
||||
- var hairTypes = ['base', 'bangs', 'mustache', 'beard']
|
||||
each type in hairTypes
|
||||
span(class='hair_#{type}_{{profile.preferences.hair.#{type}}}_{{profile.preferences.hair.color}}')
|
||||
|
||||
// Head
|
||||
+costumeSetting('eyewear')
|
||||
+costumeSetting('head')
|
||||
+costumeSetting('headAccessory')
|
||||
|
||||
// Flower
|
||||
span(class='hair_flower_{{profile.preferences.hair.flower}}')
|
||||
|
||||
// Items held in hands
|
||||
+costumeSetting('shield')
|
||||
+costumeSetting('weapon')
|
||||
mixin generatedAvatar(options)
|
||||
- options = options || {}
|
||||
+costumeSetting('back')
|
||||
if options.sleep
|
||||
span(ng-class="'skin_' + profile.preferences.skin + '_sleep'")
|
||||
else
|
||||
span(ng-class="profile.preferences.sleep ? 'skin_' + profile.preferences.skin + '_sleep' : 'skin_' + profile.preferences.skin")
|
||||
span(class='{{profile.preferences.size}}_shirt_{{profile.preferences.shirt}}')
|
||||
+costumeSetting('armor', {prefix: "profile.preferences.size + '_' + "})
|
||||
+costumeSetting('back', {suffix: " + '_collar'"})
|
||||
+costumeSetting('body')
|
||||
span(class='head_0')
|
||||
- var hairTypes = ['base', 'bangs', 'mustache', 'beard']
|
||||
each type in hairTypes
|
||||
span(class='hair_#{type}_{{profile.preferences.hair.#{type}}}_{{profile.preferences.hair.color}}')
|
||||
+costumeSetting('eyewear')
|
||||
+costumeSetting('head')
|
||||
+costumeSetting('headAccessory')
|
||||
span(class='hair_flower_{{profile.preferences.hair.flower}}')
|
||||
+costumeSetting('shield')
|
||||
+costumeSetting('weapon')
|
||||
|
|
|
|||
|
|
@ -15,22 +15,7 @@ script(type='text/ng-template', id='modals/death.html')
|
|||
| {{Math.ceil(user.stats.hp)}} / {{::Shared.maxHealth}}
|
||||
figure.herobox.text-center
|
||||
.character-sprites
|
||||
+costumeSetting('back')
|
||||
span(ng-class="'skin_' + profile.preferences.skin + '_sleep'")
|
||||
span(class='{{profile.preferences.size}}_shirt_{{profile.preferences.shirt}}')
|
||||
+costumeSetting('armor', {prefix: "profile.preferences.size + '_' + "})
|
||||
+costumeSetting('back', {suffix: " + '_collar'"})
|
||||
+costumeSetting('body')
|
||||
span(class='head_0')
|
||||
- var hairTypes = ['base', 'bangs', 'mustache', 'beard']
|
||||
each type in hairTypes
|
||||
span(class='hair_#{type}_{{profile.preferences.hair.#{type}}}_{{profile.preferences.hair.color}}')
|
||||
+costumeSetting('eyewear')
|
||||
+costumeSetting('head')
|
||||
+costumeSetting('headAccessory')
|
||||
span(class='hair_flower_{{profile.preferences.hair.flower}}')
|
||||
+costumeSetting('shield')
|
||||
+costumeSetting('weapon')
|
||||
+generatedAvatar({sleep:true})
|
||||
span(class='knockout')
|
||||
.col-md-6
|
||||
h4(style='margin-top:1.5em')=env.t('dontDespair')
|
||||
|
|
|
|||
Loading…
Reference in a new issue