Merge pull request #10 from lefnire/pets

Update my Pets Branch
This commit is contained in:
Shane Lister 2013-03-28 17:04:25 -07:00
commit 9ecb53747c
7 changed files with 93 additions and 28 deletions

View file

@ -55,10 +55,46 @@ var mapping = [
}
];
db.users.find().forEach(function(user){
_.each(mapping, function(tier){
if(
(!user.backer || !user.backer.tokensApplied) &&
(
_.contains(tier.users, user._id) ||
!!user.local && (
_.contains(tier.users, user.local.username) ||
_.contains(tier.users, user.local.email)
)
)
) {
try {
db.users.update(
{_id:user._id},
{
$set: { 'backer.tokensApplied': true, 'flags.ads': 'hide' },
$inc: { balance: (tier.tokens/4) }
}
);
} catch(e) {
print(e);
}
}
})
})
// This doesn't work, but shows the idea we're after better than the above
/*
_.each(mapping, function(tier){
db.users.update(
{
_id: { $in: tier.users },
$or: [
{ _id: { $in: tier.users } },
{ 'auth.local.username': { $in: tier.users } },
{ 'auth.local.email': { $in: tier.users } }
],
'backer.tokensApplied': { $exists: false }
},
@ -70,3 +106,4 @@ _.each(mapping, function(tier){
{ multi: true}
)
})
*/

View file

@ -19,21 +19,4 @@
.Pet_HatchingPotion_Zombie {background-position: -48px -306px; width: 48px; height: 51px}
.Pet_HatchingPotion_CottonCandyPink {background-position: -48px -357px; width: 48px; height: 51px}
.Pet_HatchingPotion_CottonCandyBlue {background-position: -48px -408px; width: 48px; height: 51px}
.Pet_HatchingPotion_Golden {background-position: -48px -459px; width: 48px; height: 54px} /* This sprite was a bit taller than everything else, will affect the math of anything inserted below it */
/* Temporary until we get the other hatching potions */
/* Commenting this out since it's no longer needed, feel free to completely remove -Shaners
.Pet_HatchingPotion_Zombie, .Pet_HatchingPotion_CottonCandyPink, .Pet_HatchingPotion_CottonCandyBlue, .Pet_HatchingPotion_Golden {background-position: -48px -0px; width: 48px; height: 51px}
.Pet_HatchingPotion_Zombie {
-webkit-filter: invert(1);
}
.Pet_HatchingPotion_CottonCandyPink {
-webkit-filter: hue-rotate(120deg);
}
.Pet_HatchingPotion_CottonCandyBlue {
-webkit-filter: saturate(3);
}
.Pet_HatchingPotion_Golden {
-webkit-filter: hue-rotate(220deg);
}
*/
.Pet_HatchingPotion_Golden {background-position: -48px -459px; width: 48px; height: 54px} /* This sprite was a bit taller than everything else, will affect the math of anything inserted below it */

View file

@ -51,7 +51,7 @@ items = module.exports.items =
]
hatchingPotions: [
{text: 'Common', name: 'Base', notes: "Hatches your pet in it's base form.", value: 1}
{text: 'Base', name: 'Base', notes: "Hatches your pet in it's base form.", value: 1}
{text: 'White', name: 'White', notes: 'Turns your animal into a White pet.', value: 2}
{text: 'Desert', name: 'Desert', notes: 'Turns your animal into a Desert pet.', value: 2}
{text: 'Red', name: 'Red', notes: 'Turns your animal into a Red pet.', value: 3}

View file

@ -20,12 +20,14 @@ module.exports.app = (appExports, model) ->
.error (err) ->
alert err.responseText
disableAds = if (model.get('_user.flags.ads') is 'hide') then '' else 'Disable Ads, '
StripeCheckout.open
key: model.get('_stripePubKey')
address: false
amount: 500
name: "Checkout"
description: "Purchase 20 Tokens."
description: "Buy 20 Tokens, #{disableAds}Support the Developers"
panelLabel: "Checkout"
token: token

View file

@ -32,12 +32,24 @@
<!-- Buy more tokens modal -->
<app:modals:modal modalId='more-tokens-modal' header="Out Of Tokens">
<app:rewards:userTokens/>
<p>You're out of tokens, which are used to buy pets and mounts.</p>
<p>Oops, out of tokens, which are used to buy special items! Habit is an open source project, and can use all the help it can get - buy more tokens to receive this pet, and consider it a donation to the contributors</p>
<@footer>
<a data-dismiss="modal" x-bind="click:showStripe" class="btn btn-success btn-large">Buy More Tokens</a><span class='token-cost'>Not enough tokens</span>
</@footer>
</app:modals:modal>
<app:modals:modal modalId="why-ads-modal" header="Why Ads?">
<p>
Habit an open source project, and can use all the help it can get - consider this a donation to the contributors. You also get 20 tokens from the purchase, which you can use to buy special items.
</p>
<p>
"Hey, I backed the Kickstarter!" - follow <a target="_blank" href="http://community.habitrpg.com/node/22">these instructions</a>.
</p>
<@footer>
<button data-dismiss="modal" class="btn btn-success">Ok</button>
</@footer>
</app:modals:modal>
<!-- $modal-template -->

View file

@ -23,14 +23,14 @@
<hatchingPotion:>
<td class="active-hatchingPotion" x-bind="click:buyHatchingPotion" data-hatchingPotion='{.name}'>
<div rel=tooltip class="Pet_HatchingPotion_{.name}" title="{.text} - {.value} Tokens"></div>
{.text}
<div class="Pet_HatchingPotion_{.name}"></div>
{.text}<br/><small>{.value} tokens<small>
</td>
<egg:>
<td class="active-egg" x-bind="click:buyEgg" data-egg='{.name}'>
<div rel=tooltip class="Pet_Egg_{.name}" title="{.text} - {.value} Tokens"></div>
{.text}
<div rel=tooltip class="Pet_Egg_{.name}"></div>
{.text}<br/><small>{.value} tokens<small>
</td>
<inventory:>

View file

@ -1,3 +1,24 @@
<ads:>
{{#if and( _loggedIn, notEqual(_user.flags.ads,'hide') )}}
<span class='pull-right'>
<a x-bind="click:showStripe" rel='tooltip' title='Remove Ads'><i class='icon-remove'></i></a><br/>
<a href="#" data-target="#why-ads-modal" data-toggle="modal" rel='tooltip' title='Why Ads?'><i class='icon-question-sign'></i></a>
</span>
<script type="text/javascript" x-no-minify>
<!--
google_ad_client = "ca-pub-3242350243827794";
/* Test */
google_ad_slot = "5883123375";
google_ad_width = 234;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="//pagead2.googlesyndication.com/pagead/show_ads.js" x-no-minify>
</script>
{{/}}
<taskLists:>
<!--helpTitle & helpContent moved to tour -->
@ -6,7 +27,11 @@
<div class="task-column habits">
<h2 class="task-column_title">{{t("Habits")}}</h2>
<app:tasks:newTask type="habit" inputValue="{_newHabit}" placeHolder="New Habit" />
<ul class="habits">{#each _habitList as :task}<app:tasks:task />{/}</ul>
<ul class="habits">
{#each _habitList as :task}<app:tasks:task />{/}
</ul>
<br/>
<app:tasks:ads />
</div>
</div>
@ -15,7 +40,11 @@
<div class="task-column dailys">
<h2 class="task-column_title">{{t("Daily")}}</h2>
<app:tasks:newTask type="daily" inputValue="{_newDaily}" placeHolder="New Daily" />
<ul class='dailys'>{#each _dailyList as :task}<app:tasks:task />{/}</ul>
<ul class='dailys'>
{#each _dailyList as :task}<app:tasks:task />{/}
</ul>
<br/>
<app:tasks:ads />
</div>
</div>
@ -42,6 +71,8 @@
<ul class='todos task-list'>
{#each _todoList as :task}<app:tasks:task />{/}
</ul>
<br/>
<app:tasks:ads />
<button class='task-action-btn tile spacious bright display-context-dependant show-for-completed' x-bind=click:clearCompleted>Clear Completed</button>