diff --git a/src/app/pets.coffee b/src/app/pets.coffee index c4589d15c2..ab298e7ce6 100644 --- a/src/app/pets.coffee +++ b/src/app/pets.coffee @@ -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' diff --git a/views/app/avatar.html b/views/app/avatar.html index bbdbc61f1c..42d64a8300 100644 --- a/views/app/avatar.html +++ b/views/app/avatar.html @@ -8,6 +8,7 @@ {#if _user.flags.dropsEnabled}
  • Inventory
  • Stable
  • +
  • Market
  • {/if} @@ -26,6 +27,9 @@
    +
    + +
    {/} {else} @@ -212,3 +216,53 @@ + + + +
    +

    Welcome to the market!

    + Dying to get that particular pet you're after, but don't want to wait for it to drop? Buy it here! +

    Eggs

    + {#with _view.items.pets as :egg} + + + {#with :egg[0]}{/} + {#with :egg[1]}{/} + {#with :egg[2]}{/} + {#with :egg[3]}{/} + + + {#with :egg[4]}{/} + {#with :egg[5]}{/} + {#with :egg[6]}{/} + {#with :egg[7]}{/} + + + {#with :egg[8]}{/} + +
    + {/} +

    Hatching Powder

    + {#with _view.items.food as :food} + + + {#with :food[0]}{/} + {#with :food[1]}{/} + {#with :food[2]}{/} + {#with :food[3]}{/} + + + {#with :food[4]}{/} + {#with :food[5]}{/} + {#with :food[6]}{/} + {#with :food[7]}{/} + + + {#with :food[8]}{/} + {#with :food[9]}{/} + +
    + {/} +
    + + diff --git a/views/app/pets.html b/views/app/pets.html index 4b1784cef3..18c984979e 100644 --- a/views/app/pets.html +++ b/views/app/pets.html @@ -23,9 +23,15 @@ -
    {.text}
    +
    + {.text} + + +
    + {.text} +
    diff --git a/views/app/rewards.html b/views/app/rewards.html index 29ce0efc7e..81e54faca7 100644 --- a/views/app/rewards.html +++ b/views/app/rewards.html @@ -21,53 +21,7 @@ {/}

    Rewards

    - - - {#if equal(_user.flags.dropsEnabled,true)} -
    -
    -
    - -
    - - -
    -

    Welcome to the market

    - {#with _view.items.food as :food} - - - {#with :food[0]}{/} - {#with :food[1]}{/} - {#with :food[2]}{/} - {#with :food[3]}{/} - - - {#with :food[4]}{/} - {#with :food[5]}{/} - {#with :food[6]}{/} - {#with :food[7]}{/} - - - {#with :food[8]}{/} - {#with :food[9]}{/} - -
    - {/} -
    - -
    - - -
    - - - {else} - {/}