WIP(greeting-cards): Working send + modals

This commit is contained in:
Sabe Jones 2015-08-13 15:43:51 -05:00
parent b2100c2c54
commit f57e3e69a1
4 changed files with 69 additions and 45 deletions

View file

@ -112,22 +112,23 @@
"achievementStressbeastText": "Helped defeat the Abominable Stressbeast during the 2015 Winter Wonderland Event!",
"checkOutProgress": "Check out my progress in Habitica!",
"cardReceived": "Received a card!",
"cardReceivedFrom": "<%= cardType %> from <%= userName %>",
"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!",
"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!",
"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

@ -41,11 +41,11 @@
"seasonalItems": "Seasonal Items",
"auldAcquaintance": "Auld Acquaintance",
"auldAcquaintanceText": "Happy New Year! Sent or received <%= cards %> New Year's cards.",
"nye0": "Happy New Year! May you slay many a bad Habit.",
"nye1": "Happy New Year! May you reap many Rewards.",
"nye2": "Happy New Year! May you earn many a Perfect Day.",
"nye3": "Happy New Year! May your To-Do list stay short and sweet.",
"nye4": "Happy New Year! May you not get attacked by a raging Hippogriff.",
"nye0": "\"Happy New Year! May you slay many a bad Habit.\"",
"nye1": "\"Happy New Year! May you reap many Rewards.\"",
"nye2": "\"Happy New Year! May you earn many a Perfect Day.\"",
"nye3": "\"Happy New Year! May your To-Do list stay short and sweet.\"",
"nye4": "\"Happy New Year! May you not get attacked by a raging Hippogriff.\"",
"holidayCard": "Received a holiday card!",
"mightyBunnySet": "Mighty Bunny (Warrior)",
"magicMouseSet": "Magic Mouse (Mage)",

View file

@ -955,28 +955,66 @@ api.spells =
target.markModified? 'items.special.valentineReceived'
user.stats.gp -= 10
greeting:
text: t('greetingCard')
mana: 0
value: 10
immediateUse: true
silent: true
target: 'user'
notes: t('greetingCardNotes')
cast: (user, target) ->
if user == target
user.achievements.greeting ?= 0
user.achievements.greeting++
else
_.each [user,target], (t)->
t.achievements.greeting ?= 0
t.achievements.greeting++
if !target.items.special.greetingReceived
target.items.special.greetingReceived = []
target.items.special.greetingReceived.push user.profile.name
target.markModified? 'items.special.greetingReceived'
user.stats.gp -= 10
thankyou:
text: t('thankyouCard')
mana: 0
value: 10
immediateUse: true
silent: true
target: 'user'
notes: t('thankyouCardNotes')
cast: (user, target) ->
if user == target
user.achievements.thankyou ?= 0
user.achievements.thankyou++
else
_.each [user,target], (t)->
t.achievements.thankyou ?= 0
t.achievements.thankyou++
if !target.items.special.thankyouReceived
target.items.special.thankyouReceived = []
target.items.special.thankyouReceived.push user.profile.name
target.markModified? 'items.special.thankyouReceived'
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

View file

@ -61,14 +61,6 @@
+specialItem('shinySeed')
+specialItem('seafoam')
div(ng-if='user.items.special.valentineReceived[0]')
button.customize-option(class='inventory_special_valentine',
popover="Valentine's Day Card from {{User.user.items.special.valentineReceived[0]}}",
popover-trigger='mouseenter', popover-placement='right',
popover-append-to-body='true',
ng-click='openCardsModal("valentine", 4)')
.badge.badge-info.stack-count {{user.items.special.valentineReceived.length}}
div(ng-if='user.purchased.plan.customerId || user.purchased.plan.mysteryItems.length')
button.customize-option(class='inventory_present inventory_present_{{moment().format("MM")}}',
popover=env.t('subscriberItemText'), popover-trigger='mouseenter',
@ -83,20 +75,13 @@
ng-click="$state.go('options.inventory.timetravelers')")
.badge.badge-info.stack-count {{user.purchased.plan.consecutive.trinkets}}
div(ng-if='user.items.special.nyeReceived[0]')
button.customize-option(class='inventory_special_nye',
popover="New Year's Card from {{User.user.items.special.nyeReceived[0]}}",
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=env.t('cardReceivedFrom', {cardType:'{{::Content.spells.special[type.key].text()}}', userName: '{{User.user.items.special[received][0]}}'}),
popover-trigger='mouseenter', popover-placement='right',
popover-append-to-body='true',
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)')
ng-click='openCardsModal(type.key, type.messageOptions)')
.badge.badge-info.stack-count {{user.items.special[received].length}}
.col-md-6.border-left
h2=env.t('market')
@ -217,11 +202,11 @@
span.shop_gold
div(ng-repeat='type in Content.cardTypes')
button.customize-option(class='inventory_special_{{::type.key}}',
popover='{{::type.notes()}}',
popover-title='{{::type.text()}}',
popover='{{::Content.spells.special[type.key].notes()}}',
popover-title='{{::Content.spells.special[type.key].text()}}',
popover-trigger='mouseenter', popover-placement='right',
popover-append-to-body='true',
ng-click='castStart(Content.spells.special.card,type.key)')
ng-click='castStart(Content.spells.special[type.key])')
p
| {{Content.spells.special.card.value}}
| {{Content.spells.special[type.key].value}}
span(class='shop_gold')