WIP(greeting-cards): Abandon spell refactor

This commit is contained in:
Sabe Jones 2015-08-13 14:31:34 -05:00
parent 3c8424a83e
commit b2100c2c54
23 changed files with 2903 additions and 2806 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 240 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 91 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 KiB

After

Width:  |  Height:  |  Size: 543 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 KiB

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -110,5 +110,24 @@
"dateFormat": "Date Format",
"achievementStressbeast": "Savior of Stoïkalm",
"achievementStressbeastText": "Helped defeat the Abominable Stressbeast during the 2015 Winter Wonderland Event!",
"checkOutProgress": "Check out my progress in Habitica!"
"checkOutProgress": "Check out my progress in Habitica!",
"cardReceived": "Received a card!",
"greetingCard": "Greeting Card",
"greetingCardExplanation": "You both receive the Cheery Chum achievement!",
"greetingCardNotes": "Send a greeting card to a party member.",
"greeting0": "Hi there!",
"greeting1": "Just saying hello :)",
"greeting2": "`waves frantically`",
"greeting3": "Hey you!",
"cheeryChum": "Cheery Chum",
"cheeryChumText": "Hey! Hi! Hello! Sent or received <%= cards %> greeting cards.",
"thankyouCard": "Thank You Card",
"thankyouCardExplanation": "You both receive the Greatly Grateful achievement!",
"thankyouCardNotes": "Send a thank you card to a party member.",
"thankyou0": "Thank you very much!",
"thankyou1": "Thank you, thank you, thank you!",
"thankyou2": "Sending you a thousand thanks.",
"thankyou3": "I'm very grateful - thank you!",
"greatlyGrateful": "Greatly Grateful",
"greatlyGratefulText": "Thanks for being thankful! Sent or received <%= cards %> thank you cards."
}

View file

@ -955,6 +955,30 @@ api.spells =
target.markModified? 'items.special.valentineReceived'
user.stats.gp -= 10
api.cardTypes =
greeting:
key: 'greeting'
text: t('greetingCard')
notes: t('greetingCardNotes')
messageOptions: 4
yearRound: true
nye:
key: 'nye'
text: t('nyeCard')
notes: t('nyeCardNotes')
messageOptions: 5
thankyou:
key: 'thankyou'
text: t('thankyouCard')
notes: t('thankyouCardNotes')
messageOptions: 4
yearRound: true
valentine:
key: 'valentine'
text: t('valentineCard')
notes: t('valentineCardNotes')
messageOptions: 4
# Intercept all spells to reduce user.stats.mp after casting the spell
_.each api.spells, (spellClass) ->
_.each spellClass, (spell, key) ->

View file

@ -1171,7 +1171,8 @@ api.wrap = (user, main=true) ->
readCard: (cardType, cb) ->
user.items.special["#{cardType}Received"].shift()
user.markModified? "items.special.#{cardType}Received"
cb? null, 'items.special'
user.flags.cardReceived = false
cb? null, 'items.special flags.cardReceived'
openMysteryItem: (req,cb,analytics) ->
item = user.purchased.plan?.mysteryItems?.shift()

View file

@ -13,12 +13,14 @@ angular.module('habitrpg')
$scope._expandedMenu = ($scope._expandedMenu == menu) ? null : menu;
};
function selectNotificationValue(mysteryValue, invitationValue, unallocatedValue, messageValue, noneValue) {
function selectNotificationValue(mysteryValue, invitationValue, cardValue, unallocatedValue, messageValue, noneValue) {
var user = $scope.user;
if (user.purchased && user.purchased.plan && user.purchased.plan.mysteryItems && user.purchased.plan.mysteryItems.length) {
return mysteryValue;
} else if ((user.invitations.party && user.invitations.party.id) || (user.invitations.guilds && user.invitations.guilds.length > 0)) {
return invitationValue;
} else if (user.flags.cardReceived) {
return cardValue;
} else if (user.flags.classSelected && !(user.preferences && user.preferences.disableClasses) && user.stats.points) {
return unallocatedValue;
} else if (!(_.isEmpty(user.newMessages))) {
@ -26,14 +28,19 @@ angular.module('habitrpg')
} else {
return noneValue;
}
};
}
$scope.clearMessages = Chat.seenMessage;
$scope.clearCards = function() {
$scope.user.flags.cardReceived = false;
};
$scope.iconClasses = function() {
return selectNotificationValue(
'glyphicon-gift',
'glyphicon-user',
'glyphicon-envelope',
'glyphicon-plus-sign',
'glyphicon-comment',
'glyphicon-comment inactive'

View file

@ -55,7 +55,9 @@ var UserSchema = new Schema({
valentine: Number,
costumeContest: Boolean,
nye: Number,
habiticaDays: Number
habiticaDays: Number,
greeting: Number,
thankyou: Number
},
auth: {
blocked: Boolean,
@ -160,7 +162,8 @@ var UserSchema = new Schema({
welcomed: {type: Boolean, 'default': false},
armoireEnabled: {type: Boolean, 'default': false},
armoireOpened: {type: Boolean, 'default': false},
armoireEmpty: {type: Boolean, 'default': false}
armoireEmpty: {type: Boolean, 'default': false},
cardReceived: {type: Boolean, 'default': false}
},
history: {
exp: Array, // [{date: Date, value: Number}], // big peformance issues if these are defined
@ -210,7 +213,11 @@ var UserSchema = new Schema({
valentine: Number,
valentineReceived: Array, // array of strings, by sender name
nye: Number,
nyeReceived: Array
nyeReceived: Array,
greeting: Number,
greetingReceived: Array,
thankyou: Number,
thankyouReceived: Array
},
// -------------- Animals -------------------
@ -350,7 +357,7 @@ var UserSchema = new Schema({
profile: {
blurb: String,
imageUrl: String,
name: String,
name: String
},
stats: {
hp: {type: Number, 'default': shared.maxHealth},

View file

@ -16,7 +16,6 @@
popover-trigger='mouseenter', popover-placement='right',
ng-click='chooseEgg(egg)')
.badge.badge-info.stack-count {{points}}
//-p {{Content.eggs[egg].text()}}
li.customize-menu
menu.hatchingPotion-menu(label=(env.t('hatchingPotions') + ' ({{potCount}})'))
@ -92,6 +91,13 @@
ng-click='openCardsModal("nye", 5)')
.badge.badge-info.stack-count {{user.items.special.nyeReceived.length}}
div(ng-repeat='type in Content.cardTypes', ng-init='received=type.key+"Received"', ng-show='user.items.special[{{received}}][0]')
button.customize-option(class='inventory_special_{{::type.key}}',
popover="bleh",
popover-trigger='mouseenter', popover-placement='right',
popover-append-to-body='true',
ng-click='openCardsModal("{{::type.key}}", type.messageOptions)')
.col-md-6.border-left
h2=env.t('market')
.npc_alex_container
@ -209,13 +215,13 @@
p
| 20&nbsp;
span.shop_gold
// div
button.customize-option(class='inventory_special_valentine',
popover='{{::Content.spells.special.valentine.notes()}}',
popover-title='{{::Content.spells.special.valentine.text()}}',
div(ng-repeat='type in Content.cardTypes')
button.customize-option(class='inventory_special_{{::type.key}}',
popover='{{::type.notes()}}',
popover-title='{{::type.text()}}',
popover-trigger='mouseenter', popover-placement='right',
popover-append-to-body='true',
ng-click='castStart(Content.spells.special.valentine)')
ng-click='castStart(Content.spells.special.card,type.key)')
p
| {{Content.spells.special.valentine.value}}
| {{Content.spells.special.card.value}}
span(class='shop_gold')

View file

@ -166,8 +166,6 @@ nav.toolbar(ng-controller='MenuCtrl')
a(target="_blank" href='http://habitrpg.wikia.com/wiki/Contributing_to_HabitRPG')=env.t('contributeToHRPG')
li
a(target="_blank" href='http://habitrpg.wikia.com/wiki/FAQ')=env.t('FAQ')
//-li(ng-controller='SettingsCtrl')
a(ng-click='showTour()', popover-placement='right', popover-trigger='mouseenter', popover=env.t('restartTour'))= env.t('showTour')
ul.toolbar-subscribe(ng-if='!user.purchased.plan.customerId')
li.toolbar-subscribe-button
button.highlight(ui-sref='options.settings.subscription',popover-trigger='mouseenter',popover-placement='bottom',popover-title=env.t('subscriptions'),popover=env.t('subDescription'),popover-append-to-body='true')=env.t('subscribe')
@ -188,6 +186,12 @@ nav.toolbar(ng-controller='MenuCtrl')
a(ui-sref='options.social.party', ng-click='expandMenu(null)')
span.glyphicon.glyphicon-user
span=env.t('invitedTo', {name: '{{user.invitations.party.name}}'})
li(ng-if='user.flags.cardReceived')
a(ng-click='$state.go("options.inventory.drops"); expandMenu(null)')
span.glyphicon.glyphicon-envelope
span=env.t('cardReceived')
a(ng-click='clearCards()', popover=env.t('clear'),popover-placement='right',popover-trigger='mouseenter',popover-append-to-body='true')
span.glyphicon.glyphicon-remove-circle
li(ng-repeat='guild in user.invitations.guilds')
a(ui-sref='options.social.guilds.public', ng-click='expandMenu(null)')
span.glyphicon.glyphicon-user
@ -202,14 +206,8 @@ nav.toolbar(ng-controller='MenuCtrl')
span {{v.name}}
a(ng-click='clearMessages(k)', popover=env.t('clear'),popover-placement='right',popover-trigger='mouseenter',popover-append-to-body='true')
span.glyphicon.glyphicon-remove-circle
// li(ng-if='user.items.special.valentineReceived[0] || user.items.special.nyeReceived[0]')
a(ng-click='$state.go("options.inventory.drops"); expandMenu(null)')
span.glyphicon.glyphicon-envelope
span=env.t('holidayCard')
ul.toolbar-controls
//-li
//-a(ng-click='') Clear all
li.toolbar-controls-button
a(ng-click='expandMenu(null)')=env.t('close')
li.toolbar-audio

View file

@ -205,13 +205,6 @@ div(ng-if='::profile.achievements.habitBirthdays')
=env.t('habitBirthdayPluralText', {number: "{{::profile.achievements.habitBirthdays}}"})
hr
div(ng-if='::profile.achievements.valentine')
.achievement.achievement-valentine
h5=env.t('adoringFriends')
small
=env.t('adoringFriendsText', {cards: "{{::profile.achievements.valentine}}"})
hr
div(ng-if='::profile.achievements.quests.dilatory')
.achievement.achievement-dilatory
h5=env.t('achievementDilatory')
@ -219,6 +212,13 @@ div(ng-if='::profile.achievements.quests.dilatory')
=env.t('achievementDilatoryText')
hr
div(ng-if='::profile.achievements.quests.stressbeast')
.achievement.achievement-stoikalm
h5=env.t('achievementStressbeast')
small
=env.t('achievementStressbeastText')
hr
div(ng-if='::profile.achievements.costumeContest')
.achievement.achievement-costumeContest
h5=env.t('costumeContest')
@ -226,6 +226,18 @@ div(ng-if='::profile.achievements.costumeContest')
=env.t('costumeContestText')
hr
div(ng-if='::profile.achievements.greeting')
.achievement.achievement-greeting
h5=env.t('cheeryChum')
small=env.t('cheeryChumText', {cards: "{{::profile.achievements.greeting}}"})
hr
div(ng-if='::profile.achievements.thankyou')
.achievement.achievement-thankyou
h5=env.t('greatlyGrateful')
small=env.t('greatlyGratefulText', {cards: "{{::profile.achievements.thankyou}}"})
hr
div(ng-if='::profile.achievements.nye')
.achievement.achievement-nye
h5=env.t('auldAcquaintance')
@ -233,9 +245,8 @@ div(ng-if='::profile.achievements.nye')
=env.t('auldAcquaintanceText', {cards: "{{::profile.achievements.nye}}"})
hr
div(ng-if='::profile.achievements.quests.stressbeast')
.achievement.achievement-stoikalm
h5=env.t('achievementStressbeast')
div(ng-if='::profile.achievements.valentine')
.achievement.achievement-valentine
h5=env.t('adoringFriends')
small
=env.t('achievementStressbeastText')
hr
=env.t('adoringFriendsText', {cards: "{{::profile.achievements.valentine}}"})