mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-31 15:09:32 +00:00
pets: add eggs to market, move from rewards tab to avatar modal
This commit is contained in:
parent
8f993ba6d4
commit
64e421d529
4 changed files with 72 additions and 47 deletions
|
|
@ -83,3 +83,14 @@ module.exports.app = (appExports, model) ->
|
|||
user.set 'balance', (tokens - newFood.value) / 4
|
||||
else
|
||||
$('#more-tokens-modal').modal 'show'
|
||||
|
||||
appExports.buyEgg = (e, el) ->
|
||||
name = $(el).attr 'data-egg'
|
||||
newEgg = _.findWhere pets, name: name
|
||||
tokens = user.get('balance') * 4
|
||||
if tokens > newEgg.value
|
||||
if confirm "Buy this egg with #{newEgg.value} of your #{tokens} tokens?"
|
||||
user.push 'items.eggs', newEgg
|
||||
user.set 'balance', (tokens - newEgg.value) / 4
|
||||
else
|
||||
$('#more-tokens-modal').modal 'show'
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
{#if _user.flags.dropsEnabled}
|
||||
<li><a data-toggle='tab' href="#profileInventory">Inventory</a></li>
|
||||
<li><a data-toggle='tab' href="#profileStable">Stable</a></li>
|
||||
<li><a data-toggle='tab' href="#profileMarket">Market</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
|
|
@ -26,6 +27,9 @@
|
|||
<div class="tab-pane" id="profileStable">
|
||||
<app:pets:stable />
|
||||
</div>
|
||||
<div class='tab-pane' id='profileMarket'>
|
||||
<app:avatar:market />
|
||||
</div>
|
||||
</div>
|
||||
{/}
|
||||
{else}
|
||||
|
|
@ -212,3 +216,53 @@
|
|||
<!-- we'll have other inventory here later too, like enchantments, quest scrolls, etc -->
|
||||
<app:pets:inventory/>
|
||||
|
||||
<market:>
|
||||
|
||||
<!-- pets pane -->
|
||||
<div class="tab-pane pet-grid" id="market-tab">
|
||||
<h4>Welcome to the market!</h4>
|
||||
<small>Dying to get that particular pet you're after, but don't want to wait for it to drop? Buy it here!</small>
|
||||
<h4>Eggs</h4>
|
||||
{#with _view.items.pets as :egg}
|
||||
<table>
|
||||
<tr>
|
||||
{#with :egg[0]}<app:pets:egg />{/}
|
||||
{#with :egg[1]}<app:pets:egg />{/}
|
||||
{#with :egg[2]}<app:pets:egg />{/}
|
||||
{#with :egg[3]}<app:pets:egg />{/}
|
||||
</tr>
|
||||
<tr>
|
||||
{#with :egg[4]}<app:pets:egg />{/}
|
||||
{#with :egg[5]}<app:pets:egg />{/}
|
||||
{#with :egg[6]}<app:pets:egg />{/}
|
||||
{#with :egg[7]}<app:pets:egg />{/}
|
||||
</tr>
|
||||
<tr>
|
||||
{#with :egg[8]}<app:pets:egg />{/}
|
||||
</tr>
|
||||
</table>
|
||||
{/}
|
||||
<h4>Hatching Powder</h4>
|
||||
{#with _view.items.food as :food}
|
||||
<table>
|
||||
<tr>
|
||||
{#with :food[0]}<app:pets:food />{/}
|
||||
{#with :food[1]}<app:pets:food />{/}
|
||||
{#with :food[2]}<app:pets:food />{/}
|
||||
{#with :food[3]}<app:pets:food />{/}
|
||||
</tr>
|
||||
<tr>
|
||||
{#with :food[4]}<app:pets:food />{/}
|
||||
{#with :food[5]}<app:pets:food />{/}
|
||||
{#with :food[6]}<app:pets:food />{/}
|
||||
{#with :food[7]}<app:pets:food />{/}
|
||||
</tr>
|
||||
<tr>
|
||||
{#with :food[8]}<app:pets:food />{/}
|
||||
{#with :food[9]}<app:pets:food />{/}
|
||||
</tr>
|
||||
</table>
|
||||
{/}
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,15 @@
|
|||
|
||||
<food:>
|
||||
<td class="active-food">
|
||||
<div rel=tooltip class="{.name}" title="{.text} - {.value} Tokens" x-bind="click:buyFood" data-food='{.name}'>{.text}</div>
|
||||
<div rel=tooltip class="Pet_Food_{.name}" title="{.text} - {.value} Tokens" x-bind="click:buyFood" data-food='{.name}'></div>
|
||||
{.text}
|
||||
</td>
|
||||
|
||||
<egg:>
|
||||
<td class="active-egg">
|
||||
<div rel=tooltip class="Pet_Egg_{.name}" title="{.text} - {.value} Tokens" x-bind="click:buyEgg" data-egg='{.name}'></div>
|
||||
{.text}
|
||||
</td>
|
||||
|
||||
<inventory:>
|
||||
<div class='row-fluid'>
|
||||
|
|
|
|||
|
|
@ -21,53 +21,7 @@
|
|||
{/}
|
||||
</span>
|
||||
<h2 class="task-column_title">Rewards</h2>
|
||||
|
||||
<!-- if pets are enabled, make tabs -->
|
||||
{#if equal(_user.flags.dropsEnabled,true)}
|
||||
<div class='tabbable tabs-below'>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="rewards-tab">
|
||||
<app:rewardsTab />
|
||||
</div>
|
||||
|
||||
<!-- pets pane -->
|
||||
<div class="tab-pane pet-grid" id="market-tab">
|
||||
<h4>Welcome to the market</h4>
|
||||
{#with _view.items.food as :food}
|
||||
<table>
|
||||
<tr>
|
||||
{#with :food[0]}<app:pets:food />{/}
|
||||
{#with :food[1]}<app:pets:food />{/}
|
||||
{#with :food[2]}<app:pets:food />{/}
|
||||
{#with :food[3]}<app:pets:food />{/}
|
||||
</tr>
|
||||
<tr>
|
||||
{#with :food[4]}<app:pets:food />{/}
|
||||
{#with :food[5]}<app:pets:food />{/}
|
||||
{#with :food[6]}<app:pets:food />{/}
|
||||
{#with :food[7]}<app:pets:food />{/}
|
||||
</tr>
|
||||
<tr>
|
||||
{#with :food[8]}<app:pets:food />{/}
|
||||
{#with :food[9]}<app:pets:food />{/}
|
||||
</tr>
|
||||
</table>
|
||||
{/}
|
||||
</div>
|
||||
<!--<div class="tab-pane" id="mounts-tab">...</div>-->
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs" id="rewardsTabs">
|
||||
<li class="active"><a href="#rewards-tab" data-toggle="tab" x-bind="click:activateRewardsTab">Rewards</a></li>
|
||||
<li><a href="#market-tab" data-target='#market-tab' data-toggle="tab" x-bind='click:activatePetsTab'>Market</a></li>
|
||||
<!--<li><a href="#mounts-tab" data-toggle="tab">Mounts</a></li>-->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- if pets are disabled, just do rewards tab -->
|
||||
{else}
|
||||
<app:rewards:rewardsTab />
|
||||
{/}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue