include appearance

mixin herobox(opts)
  - if (!opts) {opts = {minimal:false,main:false}}

  - var ngClick = 'spell ? castEnd(profile, "user", $event) : clickMember(profile._id)'

  - var klass = 'background_{{profile.preferences.background}} ' + opts.main + ' ? "isUser" : ""} ' + opts.minimal + ' ? "minimal" : ""}'

  - var hasPet = 'hasPet: (' + !opts.minimal + ' && profile.items.currentPet)'
  - var hasMount = 'hasMount: (' + !opts.minimal + ' && profile.items.currentMount)'
  - var noBackgroundImage = 'noBackgroundImage: !profile.preferences.background'
  - var castTarget = '"cast-target": applyingAction, isLeader: party.leader==profile._id'
  - var ngKlass = '{' + hasPet + ', ' + hasMount + ', ' + noBackgroundImage + ', ' + castTarget + '}'

  - var name = '{{profile.profile.name}}'
  - var buffs = 'profile.stats.buffs'

  - var rebirthLevel = '{{profile.achievements.rebirthLevel < 100 ? profile.achievements.rebirthLevel : "100+"}}'

  figure.herobox(ng-click=ngClick, data-name=name, class=klass, ng-class=ngKlass)

    .avatar-name(ng-class='userLevelStyle(profile)')=name

    +avatar(opts)

    .avatar-level(ng-class='userLevelStyle(profile)')
      span.glyphicon.glyphicon-circle-arrow-up(tooltip=env.t('buffed'), tooltip-append-to-body="true",
        ng-show='#{buffs}.str || #{buffs}.per || #{buffs}.con || #{buffs}.int || #{buffs}.stealth')
      span(tooltip=env.t('level'), tooltip-append-to-body="true") {{profile.stats.lvl}}
      span.glyphicon.glyphicon-plus-sign(ng-show='profile.achievements.rebirths',
        tooltip=env.t('reborn', {reLevel: rebirthLevel}), tooltip-append-to-body="true")
