unlock pets feature

This commit is contained in:
Tyler Renelle 2013-02-11 01:55:45 -05:00
parent ec86c98e6b
commit 8d920a7ea1
3 changed files with 87 additions and 63 deletions

View file

@ -182,6 +182,21 @@ module.exports.app = (appExports, model) ->
content: html
$('ul.items').popover 'show'
user.on 'set', 'flags.petsEnabled', (captures, args) ->
return unless captures == true
html = """
<img src='/img/BrowserQuest/habitrpg_mods/wolf_border.png' style='width:30px;height:30px;float:left;padding-right:5px' />
You have unlocked Pets! You can now buy buy pets with tokens (note, you replenish tokens with real-life money - so chose your pets wisely!)
<a href='#' onClick="$('#rewardsTabs').popover('hide');return false;">[Close]</a>
"""
$('#rewardsTabs').popover
title: "Pets Unlocked"
placement: 'left'
trigger: 'manual'
html: true
content: html
$('#rewardsTabs').popover 'show'
###
update store
###

View file

@ -96,6 +96,9 @@ updateStats = (newStats, batch) ->
if !obj.flags.partyEnabled and obj.stats.lvl >= 3
batch.set 'flags.partyEnabled', true
obj.flags.partyEnabled = true
if !obj.flags.petsEnabled and obj.stats.lvl >= 4
batch.set 'flags.petsEnabled', true
obj.flags.petsEnabled = true
if newStats.gp?
#FIXME what was I doing here? I can't remember, gp isn't defined

View file

@ -364,76 +364,65 @@ do a find for the string after "→"
</div>
<app:newTask type=reward><input value={_newReward} type="text" name=new-task placeholder="New Reward"/></app:newTask>
<div class='tabbable tabs-below'>
{#if _user.flags.petsEnabled}
<div class='tabbable tabs-below'>
<div class="tab-content">
<div class="tab-pane active" id="rewards-tab">
<!-- Content -->
<ul class='rewards'>
{#each _rewardList as :task}<app:task />{/}
</ul>
<div class="tab-content">
<div class="tab-pane active" id="rewards-tab">
<app:rewardsTab />
</div>
<div class="tab-pane" id="pets-tab">
{#with _view.items.pets as :pets}
<div class="row-fluid">
{#with :pets[0]}<app:pet />{/}
{#with :pets[1]}<app:pet />{/}
{#with :pets[2]}<app:pet />{/}
{#with :pets[3]}<app:pet />{/}
</div>
<div class="row-fluid">
{#with :pets[4]}<app:pet />{/}
{#with :pets[5]}<app:pet />{/}
{#with :pets[6]}<app:pet />{/}
{#with :pets[7]}<app:pet />{/}
</div>
<div class="row-fluid">
{#with :pets[8]}<app:pet />{/}
{#with :pets[9]}<app:pet />{/}
{#with :pets[10]}<app:pet />{/}
{#with :pets[11]}<app:pet />{/}
</div>
<div class="row-fluid">
{#with :pets[12]}<app:pet />{/}
{#with :pets[13]}<app:pet />{/}
{#with :pets[14]}<app:pet />{/}
{#with :pets[15]}<app:pet />{/}
</div>
<div class="row-fluid">
{#with :pets[16]}<app:pet />{/}
</div>
{#if _user.flags.itemsEnabled}
<ul class='items'>
{#with _view.items.weapon as :item}<app:item />{/}
{#with _view.items.armor as :item}<app:item />{/}
{#with _view.items.head as :item}<app:item />{/}
{#with _view.items.shield as :item}<app:item />{/}
{#with _view.items.potion as :item}<app:item />{/}
{#with _view.items.reroll as :item}<app:item reroll=true />{/}
</ul>
{/}
{/}
</div>
<!--<div class="tab-pane" id="mounts-tab">...</div>-->
</div>
<div class="tab-pane" id="pets-tab">
{#with _view.items.pets as :pets}
<div class="row-fluid">
{#with :pets[0]}<app:pet />{/}
{#with :pets[1]}<app:pet />{/}
{#with :pets[2]}<app:pet />{/}
{#with :pets[3]}<app:pet />{/}
</div>
<div class="row-fluid">
{#with :pets[4]}<app:pet />{/}
{#with :pets[5]}<app:pet />{/}
{#with :pets[6]}<app:pet />{/}
{#with :pets[7]}<app:pet />{/}
</div>
<div class="row-fluid">
{#with :pets[8]}<app:pet />{/}
{#with :pets[9]}<app:pet />{/}
{#with :pets[10]}<app:pet />{/}
{#with :pets[11]}<app:pet />{/}
</div>
<div class="row-fluid">
{#with :pets[12]}<app:pet />{/}
{#with :pets[13]}<app:pet />{/}
{#with :pets[14]}<app:pet />{/}
{#with :pets[15]}<app:pet />{/}
</div>
<div class="row-fluid">
{#with :pets[16]}<app:pet />{/}
</div>
{/}
</div>
<div class="tab-pane" id="mounts-tab">...</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="#pets-tab" id='pets-tab' data-toggle="tab" x-bind='click:activatePetsTab'>Pets</a></li>
<!--<li><a href="#mounts-tab" data-toggle="tab">Mounts</a></li>-->
</ul>
</div>
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#rewards-tab" data-toggle="tab" x-bind="click:activateRewardsTab">Rewards</a></li>
<li><a href="#pets-tab" data-toggle="tab" x-bind='click:activatePetsTab'>Pets</a></li>
<li><a href="#mounts-tab" data-toggle="tab">Mounts</a></li>
</ul>
</div>
{else}
<app:rewardsTab />
{/}
</div>
@ -481,6 +470,23 @@ do a find for the string after "→"
</div>
</footer>
<rewardsTab:>
<ul class='rewards'>
{#each _rewardList as :task}<app:task />{/}
</ul>
{#if _user.flags.itemsEnabled}
<ul class='items'>
{#with _view.items.weapon as :item}<app:item />{/}
{#with _view.items.armor as :item}<app:item />{/}
{#with _view.items.head as :item}<app:item />{/}
{#with _view.items.shield as :item}<app:item />{/}
{#with _view.items.potion as :item}<app:item />{/}
{#with _view.items.reroll as :item}<app:item reroll=true />{/}
</ul>
{/}
<pet:>
<div class="span3 shop-pet" rel=tooltip title="{.text} - {.value} Tokens">
<div style='position:relative'>