mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-05-20 12:48:43 +00:00
feat(valentine): valentine event
This commit is contained in:
parent
8ba12ef392
commit
fd6eb8724e
8 changed files with 72 additions and 6 deletions
|
|
@ -26,6 +26,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||
$rootScope.Shared = Shared;
|
||||
$rootScope.Content = Content;
|
||||
$rootScope.env = window.env;
|
||||
$rootScope.Math = Math;
|
||||
|
||||
// Angular UI Router
|
||||
$rootScope.$state = $state;
|
||||
|
|
@ -198,6 +199,11 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||
*/
|
||||
$scope.castStart = function(spell) {
|
||||
if (User.user.stats.mp < spell.mana) return Notification.text(window.env.t('notEnoughMana'));
|
||||
|
||||
// Temporary for valentine's day, remove after event
|
||||
if (spell.key == 'valentine' && User.user.stats.gp < spell.value)
|
||||
return Notification.text('Not enough gold.');
|
||||
|
||||
$rootScope.applyingAction = true;
|
||||
$scope.spell = spell;
|
||||
if (spell.target == 'self') {
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ api.cast = function(req, res, next) {
|
|||
case 'user':
|
||||
async.waterfall([
|
||||
function(cb){
|
||||
Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members', 'profile.name stats achievements').exec(cb);
|
||||
Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members', 'profile.name stats achievements items.special').exec(cb);
|
||||
},
|
||||
function(group, cb) {
|
||||
// Solo player? let's just create a faux group for simpler code
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ var UserSchema = new Schema({
|
|||
rebirths: Number,
|
||||
rebirthLevel: Number,
|
||||
perfect: Number,
|
||||
habitBirthday: Boolean
|
||||
habitBirthday: Boolean,
|
||||
valentine: Number
|
||||
},
|
||||
auth: {
|
||||
facebook: Schema.Types.Mixed,
|
||||
|
|
@ -136,7 +137,9 @@ var UserSchema = new Schema({
|
|||
},
|
||||
|
||||
special:{
|
||||
snowball: {type: Number, 'default': 0}
|
||||
snowball: {type: Number, 'default': 0},
|
||||
valentine: Number,
|
||||
valentineReceived: Array // array of strings, by sender name
|
||||
},
|
||||
|
||||
// -------------- Animals -------------------
|
||||
|
|
|
|||
|
|
@ -68,6 +68,12 @@ script(type='text/ng-template', id='partials/options.inventory.drops.html')
|
|||
button.customize-option(popover='{{Content.special.snowball.notes}}', popover-title='{{Content.special.snowball.text}}', popover-trigger='mouseenter', popover-placement='right', ng-click='castStart(Content.special.snowball)', class='inventory_special_snowball')
|
||||
.badge.badge-info.stack-count {{user.items.special.snowball}}
|
||||
|
||||
li.customize-menu(ng-if='user.items.special.valentineReceived[0]')
|
||||
menu.pets-menu(label=env.t('valentineCard'))
|
||||
div
|
||||
button.customize-option(popover="Valentine's Day Card from {{User.user.items.special.valentineReceived[0]}}", popover-trigger='mouseenter', popover-placement='right', ng-click='openModal("valentine")', class='inventory_special_valentine')
|
||||
.badge.badge-info.stack-count {{user.items.special.valentineReceived.length}}
|
||||
|
||||
li.customize-menu(ng-if='user.purchased.plan.customerId')
|
||||
menu.pets-menu(label=env.t('subscriberItem'))
|
||||
div
|
||||
|
|
|
|||
|
|
@ -8,4 +8,5 @@ include ./settings
|
|||
include ./drops
|
||||
include ./classes
|
||||
include ./quests
|
||||
include ./rebirth
|
||||
include ./rebirth
|
||||
include ./limited
|
||||
30
views/shared/modals/limited.jade
Normal file
30
views/shared/modals/limited.jade
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//Valentine
|
||||
script(id='modals/valentine.html', type='text/ng-template')
|
||||
.modal-header
|
||||
h4
|
||||
.inventory_special_valentine.pull-right
|
||||
=env.t('valentineCard')
|
||||
.modal-body
|
||||
.bg-info(style='padding:10px')
|
||||
p To: {{user.profile.name}}, From: {{user.items.special.valentineReceived[0]}}
|
||||
hr
|
||||
div(ng-switch='Math.floor(Math.random()*3)')
|
||||
ul.list-unstyled(ng-switch-when='0')
|
||||
li "Roses are red
|
||||
li My Dailies are blue
|
||||
li I'm happy that I'm
|
||||
li In a Party with you!"
|
||||
ul.list-unstyled(ng-switch-when='1')
|
||||
li "Roses are red
|
||||
li Violets are nice
|
||||
li Let's get together
|
||||
li And fight against Vice!"
|
||||
ul.list-unstyled(ng-switch-default)
|
||||
li "Roses are red
|
||||
li This poem style is old
|
||||
li I hope that you like this
|
||||
li Cuz it cost ten gold."
|
||||
p
|
||||
small For enduring such a saccharine poem, you both receive the "Adoring Friends" badge!
|
||||
.modal-footer
|
||||
button.btn.btn-default(ng-click='user.ops.readValentine({});$close()')=env.t('ok')
|
||||
|
|
@ -133,3 +133,9 @@ div(ng-if='profile.achievements.habitBirthday')
|
|||
=env.t('habitBirthdayText')
|
||||
hr
|
||||
|
||||
div(ng-if='profile.achievements.valentine')
|
||||
.achievement.achievement-valentine
|
||||
h5=env.t('adoringFriends')
|
||||
small
|
||||
=env.t('adoringFriendsText', {cards: "{{profile.achievements.valentine}}"})
|
||||
hr
|
||||
|
|
|
|||
|
|
@ -58,8 +58,9 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
span(bo-class='{"shop_{{item.key}} shop-sprite item-img": true}')
|
||||
p.task-text {{item.text}}
|
||||
|
||||
// Winter Event
|
||||
ul.items.rewards(ng-if='main && list.type=="reward" && (user.items.special.snowball>0 || user.stats.buffs.snowball)')
|
||||
// Events
|
||||
ul.items.rewards(ng-if='main && list.type=="reward"')
|
||||
|
||||
li.task.reward-item(ng-if='user.items.special.snowball>0',popover-trigger='mouseenter', popover-placement='top', popover='{{Content.spells.special.snowball.notes}}')
|
||||
.task-meta-controls
|
||||
span.task-notes
|
||||
|
|
@ -71,6 +72,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
span.shop_snowball(style='display:inline-block;vertical-align:top;')
|
||||
// main content
|
||||
p.task-text {{Content.spells.special.snowball.text}}
|
||||
|
||||
li.task.reward-item(ng-if='user.stats.buffs.snowball',popover-trigger='mouseenter', popover-placement='top', popover='{{Content.spells.special.salt.notes}}')
|
||||
.task-meta-controls
|
||||
span.task-notes
|
||||
|
|
@ -84,6 +86,18 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||
span.shop_salt.shop-sprite.item-img
|
||||
p.task-text {{Content.spells.special.salt.text}}
|
||||
|
||||
li.task.reward-item(popover-trigger='mouseenter', popover-placement='top', popover='{{Content.spells.special.valentine.notes}}')
|
||||
.task-meta-controls
|
||||
span.task-notes
|
||||
span.glyphicon.glyphicon-comment
|
||||
//left-hand size commands
|
||||
.task-controls
|
||||
a.money.btn-buy.item-btn(ng-click='castStart(Content.spells.special.valentine)')
|
||||
span.reward-cost {{Content.spells.special.valentine.value}}
|
||||
span.shop_gold
|
||||
span.inventory_special_valentine.shop-sprite.item-img
|
||||
p.task-text {{Content.spells.special.valentine.text}}
|
||||
|
||||
// Spells
|
||||
ul.items(ng-if='main && list.type=="reward" && user.stats.class && !user.preferences.disableClasses')
|
||||
li.task.reward-item(ng-repeat='(k,spell) in Content.spells[user.stats.class]', ng-if='user.stats.lvl >= spell.lvl',popover-trigger='mouseenter', popover-placement='top', popover='{{spell.notes}}')
|
||||
|
|
|
|||
Loading…
Reference in a new issue