mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-31 15:09:32 +00:00
get the pets working for the avatar box, with consistent names (need
to manually apply with model.set for now)
This commit is contained in:
parent
c8c7d76efd
commit
65b7f432a9
5 changed files with 43 additions and 38 deletions
|
|
@ -1,4 +1,4 @@
|
|||
.Pet-Wolf-Zombie, .Pet-Wolf-White, .Pet-Wolf-Veteran, .Pet-Wolf-Skeleton, .Pet-Wolf-Shade, .Pet-Wolf-Red, .Pet-Wolf-Golden, .Pet-Wolf-Desert, .Pet-Wolf-CottonCandyPink, .Pet-Wolf-CottonCandyBlue, .Pet-TigerCub-Zombie, .Pet-TigerCub-White, .Pet-TigerCub-Skeleton, .Pet-TigerCub-Shade, .Pet-TigerCub-Red, .Pet-TigerCub-Golden, .Pet-TigerCub-Desert, .Pet-TigerCub-CottonCandyPink, .Pet-TigerCub-CottonCandyBlue, .Pet-TigerCub-Base, .Pet-PolarBearCub-Base, .Pet-PandaCub-Zombie, .Pet-PandaCub-White, .Pet-PandaCub-Skeleton, .Pet-PandaCub-Shade, .Pet-PandaCub-Red, .Pet-PandaCub-Golden, .Pet-PandaCub-Desert, .Pet-PandaCub-CottonCandyPink, .Pet-PandaCub-CottonCandyBlue, .Pet-PandaCub-Base, .Pet-LionCub-Zombie, .Pet-LionCub-White, .Pet-LionCub-Skeleton, .Pet-LionCub-Shade, .Pet-LionCub-Red, .Pet-LionCub-Golden, .Pet-LionCub-Desert, .Pet-LionCub-CottonCandyPink, .Pet-LionCub-CottonCandyBlue, .Pet-LionCub-Base, .Pet-Fox-Zombie, .Pet-Fox-White, .Pet-Fox-Skeleton, .Pet-Fox-Shade, .Pet-Fox-Red, .Pet-Fox-Golden, .Pet-Fox-Desert, .Pet-Fox-CottonCandyPink, .Pet-Fox-CottonCandyBlue, .Pet-Fox-Base, .Pet-FlyingPig-Zombie, .Pet-FlyingPig-White, .Pet-FlyingPig-Skeleton, .Pet-FlyingPig-Shade, .Pet-FlyingPig-Red, .Pet-FlyingPig-Golden, .Pet-FlyingPig-Desert, .Pet-FlyingPig-CottonCandyPink, .Pet-FlyingPig-CottonCandyBlue, .Pet-FlyingPig-Base, .Pet-Dragon-Zombie, .Pet-Dragon-White, .Pet-Dragon-Skeleton, .Pet-Dragon-Shade, .Pet-Dragon-Red, .Pet-Dragon-Golden, .Pet-Dragon-Desert, .Pet-Dragon-CottonCandyPink, .Pet-Dragon-CottonCandyBlue, .Pet-Dragon-Base, .Pet-Cactus-SugarCube, .Pet-Cactus-Strawberry, .Pet-Cactus-Rotten, .Pet-Cactus-Licorice, .Pet-Cactus-Golden, .Pet-Cactus-Cream, .Pet-Cactus-CottonCandyPink, .Pet-Cactus-CottonCandyBlue, .Pet-Cactus-Chocolate, .Pet-Cactus-Base, .Pet-BearCub-Zombie, .Pet-BearCub-White, .Pet-BearCub-Skeleton, .Pet-BearCub-Shade, .Pet-BearCub-Red, .Pet-BearCub-Golden, .Pet-BearCub-Desert, .Pet-BearCub-CottonCandyPink, .Pet-BearCub-CottonCandyBlue, .Pet-BearCub-Base {background: url(pet_sprites.png) no-repeat}
|
||||
.Pet-Wolf-Zombie, .Pet-Wolf-White, .Pet-Wolf-Veteran, .Pet-Wolf-Skeleton, .Pet-Wolf-Shade, .Pet-Wolf-Red, .Pet-Wolf-Golden, .Pet-Wolf-Desert, .Pet-Wolf-CottonCandyPink, .Pet-Wolf-CottonCandyBlue, .Pet-TigerCub-Zombie, .Pet-TigerCub-White, .Pet-TigerCub-Skeleton, .Pet-TigerCub-Shade, .Pet-TigerCub-Red, .Pet-TigerCub-Golden, .Pet-TigerCub-Desert, .Pet-TigerCub-CottonCandyPink, .Pet-TigerCub-CottonCandyBlue, .Pet-TigerCub-Base, .Pet-PolarBearCub-Base, .Pet-PandaCub-Zombie, .Pet-PandaCub-White, .Pet-PandaCub-Skeleton, .Pet-PandaCub-Shade, .Pet-PandaCub-Red, .Pet-PandaCub-Golden, .Pet-PandaCub-Desert, .Pet-PandaCub-CottonCandyPink, .Pet-PandaCub-CottonCandyBlue, .Pet-PandaCub-Base, .Pet-LionCub-Zombie, .Pet-LionCub-White, .Pet-LionCub-Skeleton, .Pet-LionCub-Shade, .Pet-LionCub-Red, .Pet-LionCub-Golden, .Pet-LionCub-Desert, .Pet-LionCub-CottonCandyPink, .Pet-LionCub-CottonCandyBlue, .Pet-LionCub-Base, .Pet-Fox-Zombie, .Pet-Fox-White, .Pet-Fox-Skeleton, .Pet-Fox-Shade, .Pet-Fox-Red, .Pet-Fox-Golden, .Pet-Fox-Desert, .Pet-Fox-CottonCandyPink, .Pet-Fox-CottonCandyBlue, .Pet-Fox-Base, .Pet-FlyingPig-Zombie, .Pet-FlyingPig-White, .Pet-FlyingPig-Skeleton, .Pet-FlyingPig-Shade, .Pet-FlyingPig-Red, .Pet-FlyingPig-Golden, .Pet-FlyingPig-Desert, .Pet-FlyingPig-CottonCandyPink, .Pet-FlyingPig-CottonCandyBlue, .Pet-FlyingPig-Base, .Pet-Dragon-Zombie, .Pet-Dragon-White, .Pet-Dragon-Skeleton, .Pet-Dragon-Shade, .Pet-Dragon-Red, .Pet-Dragon-Golden, .Pet-Dragon-Desert, .Pet-Dragon-CottonCandyPink, .Pet-Dragon-CottonCandyBlue, .Pet-Dragon-Base, .Pet-Cactus-SugarCube, .Pet-Cactus-Strawberry, .Pet-Cactus-Rotten, .Pet-Cactus-Licorice, .Pet-Cactus-Golden, .Pet-Cactus-Cream, .Pet-Cactus-CottonCandyPink, .Pet-Cactus-CottonCandyBlue, .Pet-Cactus-Chocolate, .Pet-Cactus-Base, .Pet-BearCub-Zombie, .Pet-BearCub-White, .Pet-BearCub-Skeleton, .Pet-BearCub-Shade, .Pet-BearCub-Red, .Pet-BearCub-Golden, .Pet-BearCub-Desert, .Pet-BearCub-CottonCandyPink, .Pet-BearCub-CottonCandyBlue, .Pet-BearCub-Base {background: url("/img/sprites/pet_sprites.png") no-repeat}
|
||||
.Pet-Wolf-Zombie {background-position: 0 0; width: 81px; height: 99px}
|
||||
.Pet-Wolf-White {background-position: -81px 0; width: 81px; height: 99px}
|
||||
.Pet-Wolf-Veteran {background-position: -162px 0; width: 81px; height: 99px}
|
||||
|
|
|
|||
|
|
@ -38,29 +38,29 @@ items = module.exports.items =
|
|||
reroll: {type: 'reroll', text: "Re-Roll", classes: 'reroll', notes: "Resets your tasks. When you're struggling and everything's red, use for a clean slate.", value:0 }
|
||||
|
||||
pets: [
|
||||
{text: 'Wolf', classes: 'Wolf', value: 3}
|
||||
{text: 'Tiger Cub', classes: 'TigerCub', value: 3}
|
||||
#{text: 'Polar Bear Cub', classes: 'PolarBearCub', value: 3} #commented out because there are no polarbear modifiers yet, special drop?
|
||||
{text: 'Panda Cub', classes: 'PandaCub', value: 3}
|
||||
{text: 'Lion Cub', classes: 'LionCub', value: 3}
|
||||
{text: 'Fox', classes: 'Fox', value: 3}
|
||||
{text: 'Flying Pig', classes: 'FlyingPig', value: 3}
|
||||
{text: 'Dragon', classes: 'Dragon', value: 3}
|
||||
{text: 'Cactus', classes: 'Cactus', value: 3}
|
||||
{text: 'Bear Cub', classes: 'BearCub', value: 3}
|
||||
{text: 'Wolf', name: 'Wolf', value: 3}
|
||||
{text: 'Tiger Cub', name: 'TigerCub', value: 3}
|
||||
#{text: 'Polar Bear Cub', name: 'PolarBearCub', value: 3} #commented out because there are no polarbear modifiers yet, special drop?
|
||||
{text: 'Panda Cub', name: 'PandaCub', value: 3}
|
||||
{text: 'Lion Cub', id: 'LionCub', value: 3}
|
||||
{text: 'Fox', name: 'Fox', value: 3}
|
||||
{text: 'Flying Pig', name: 'FlyingPig', value: 3}
|
||||
{text: 'Dragon', name: 'Dragon', value: 3}
|
||||
{text: 'Cactus', name: 'Cactus', value: 3}
|
||||
{text: 'Bear Cub', name: 'BearCub', value: 3}
|
||||
]
|
||||
|
||||
food: [
|
||||
{text: 'Zombie', classes: 'Zombie', notes: 'Turns your animal into a Zombie.', value: 3}
|
||||
{text: 'White', classes: 'White', notes: 'Turns your animal into a White.', value: 3}
|
||||
{text: 'Veteran', classes: 'Veteran', notes: 'Turns your animal into a Veteran.', value: 3}
|
||||
{text: 'Skeleton', classes: 'Skeleton', notes: 'Turns your animal into a Skeleton.', value: 3}
|
||||
{text: 'Shade', classes: 'Shade', notes: 'Turns your animal into a Shade.', value: 3}
|
||||
{text: 'Red', classes: 'Red', notes: 'Turns your animal into a Red.', value: 3}
|
||||
{text: 'Golden', classes: 'Golden', notes: 'Turns your animal into a Golden.', value: 3}
|
||||
{text: 'Desert', classes: 'Desert', notes: 'Turns your animal into a Desert.', value: 3}
|
||||
{text: 'CottonCandyPink', classes: 'CottonCandyPink', notes: 'Turns your animal into a CottonCandyPink.', value: 3}
|
||||
{text: 'CottonCandyBlue', classes: 'CottonCandyBlue', notes: 'Turns your animal into a CottonCandyBlue.', value: 3}
|
||||
{text: 'Zombie', name: 'Zombie', notes: 'Turns your animal into a Zombie.', value: 3}
|
||||
{text: 'White', name: 'White', notes: 'Turns your animal into a White.', value: 3}
|
||||
{text: 'Veteran', name: 'Veteran', notes: 'Turns your animal into a Veteran.', value: 3}
|
||||
{text: 'Skeleton', name: 'Skeleton', notes: 'Turns your animal into a Skeleton.', value: 3}
|
||||
{text: 'Shade', name: 'Shade', notes: 'Turns your animal into a Shade.', value: 3}
|
||||
{text: 'Red', name: 'Red', notes: 'Turns your animal into a Red.', value: 3}
|
||||
{text: 'Golden', name: 'Golden', notes: 'Turns your animal into a Golden.', value: 3}
|
||||
{text: 'Desert', name: 'Desert', notes: 'Turns your animal into a Desert.', value: 3}
|
||||
{text: 'CottonCandyPink', name: 'CottonCandyPink', notes: 'Turns your animal into a CottonCandyPink.', value: 3}
|
||||
{text: 'CottonCandyBlue', name: 'CottonCandyBlue', notes: 'Turns your animal into a CottonCandyBlue.', value: 3}
|
||||
]
|
||||
|
||||
# add "type" to each item, so we can reference that as "weapon" or "armor" in the html
|
||||
|
|
@ -147,22 +147,6 @@ module.exports.app = (appExports, model) ->
|
|||
hp = 50 if hp > 50
|
||||
user.set 'stats.hp', hp
|
||||
|
||||
appExports.selectPet = (e, el) ->
|
||||
name = $(el).attr('data-pet')
|
||||
pet = _.find items.pets, (p) -> p.name == name
|
||||
debugger
|
||||
if user.get "items.pets.#{name}"
|
||||
user.set 'items.pet', pet
|
||||
else
|
||||
tokens = user.get('balance')*4
|
||||
if tokens > pet.value
|
||||
r = confirm("Buy this pet with #{pet.value} of your #{tokens} tokens?");
|
||||
if r
|
||||
user.set "items.pets.#{name}", true
|
||||
user.set 'items.pet', pet
|
||||
user.set 'balance', (tokens-pet.value)/4
|
||||
else
|
||||
$('#more-tokens-modal').modal('show')
|
||||
|
||||
appExports.activateRewardsTab = ->
|
||||
model.set '_view.activeTabRewards', true
|
||||
|
|
|
|||
|
|
@ -17,3 +17,21 @@ module.exports.app = (appExports, model) ->
|
|||
|
||||
# do drops enabled stuff
|
||||
$('#dropsEnabled-modal').show()
|
||||
|
||||
|
||||
appExports.selectPet = (e, el) ->
|
||||
name = $(el).attr('data-pet')
|
||||
pet = _.findWhere pets, {name:name}
|
||||
ownsThisPet = user.get('items.pets').indexOf(name)
|
||||
if ownsThisPet != -1
|
||||
user.set 'items.currentPet', pet
|
||||
else
|
||||
tokens = user.get('balance')*4
|
||||
if tokens > pet.value
|
||||
r = confirm("Buy this pet with #{pet.value} of your #{tokens} tokens?");
|
||||
if r
|
||||
user.push "items.pets", name
|
||||
user.set 'items.currentPet', pet
|
||||
user.set 'balance', (tokens - pet.value)/4
|
||||
else
|
||||
$('#more-tokens-modal').modal('show')
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
@import "./customizer.styl";
|
||||
@import "./items.styl";
|
||||
@import "./alerts.styl";
|
||||
@import "../../public/img/sprites/pet_sprites.css";
|
||||
|
||||
@import "../../public/vendor/bootstrap-datepicker/css/datepicker.css";
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,10 @@
|
|||
|
||||
<avatar:>
|
||||
<div class="avatar {{#if @main}}main-avatar{{/}} {{#if @party}}party-avatar{{/}}" data-toggle='modal' data-target='#avatar-modal' data-uid="{@profile.id}" x-bind="click:profileChangeActive">
|
||||
{#unless @minimal}{#if @profile.items.pet}<img src='img/sprites/{@profile.items.pet.icon}' />{/}{/}
|
||||
<div class='character-sprites'>
|
||||
{#unless @minimal}{#if @profile.items.currentPet}
|
||||
<span class="Pet-{_user.items.currentPet.name}-{_user.items.currentPet.modifier}" ></span>
|
||||
{/}{/}
|
||||
{#with @profile.preferences as :p}
|
||||
<span class='{:p.gender}_skin_{:p.skin}'></span>
|
||||
<span class='{:p.gender}_hair_{:p.hair}'></span>
|
||||
|
|
|
|||
Loading…
Reference in a new issue