From 60c622f1c17ec598554edfdc4e74a6d2f8cb3087 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Sun, 22 Dec 2013 08:32:39 -0600 Subject: [PATCH 1/4] Initial commit: unlock notification, new modals --- public/js/services/guideServices.js | 5 +++- src/models/user.js | 6 +++-- views/shared/modals/index.jade | 3 ++- views/shared/modals/rebirth.jade | 38 +++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 views/shared/modals/rebirth.jade diff --git a/public/js/services/guideServices.js b/public/js/services/guideServices.js index 3535086828..d90db16475 100644 --- a/public/js/services/guideServices.js +++ b/public/js/services/guideServices.js @@ -139,7 +139,10 @@ angular.module('guideServices', []). } }); - + $rootScope.$watch('user.flags.rebirthEnabled', function(after, before) { + if (alreadyShown(before, after)) return; + $rootScope.modals.rebirthEnabled = true; + }); /** diff --git a/src/models/user.js b/src/models/user.js index 6fdd789e55..d47530cfec 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -45,7 +45,8 @@ var UserSchema = new Schema({ veteran: Boolean, snowball: Number, streak: Number, - challenges: Array + challenges: Array, + rebirth: Array }, auth: { facebook: Schema.Types.Mixed, @@ -94,7 +95,8 @@ var UserSchema = new Schema({ partyEnabled: Boolean, // FIXME do we need this? contributor: Boolean, classSelected: {type: Boolean, 'default': false}, - mathUpdates: Boolean + mathUpdates: Boolean, + rebirthEnabled: {type: Boolean, 'default': false} }, history: { exp: Array, // [{date: Date, value: Number}], // big peformance issues if these are defined diff --git a/views/shared/modals/index.jade b/views/shared/modals/index.jade index 339424984e..d8b098ac8a 100644 --- a/views/shared/modals/index.jade +++ b/views/shared/modals/index.jade @@ -7,4 +7,5 @@ include ./buy-gems include ./members include ./settings include ./pets -include ./classes \ No newline at end of file +include ./classes +include ./rebirth diff --git a/views/shared/modals/rebirth.jade b/views/shared/modals/rebirth.jade new file mode 100644 index 0000000000..1a65ec1a6b --- /dev/null +++ b/views/shared/modals/rebirth.jade @@ -0,0 +1,38 @@ +// Created by Sabe on 12/22/13. + +div(modal='modals.rebirthEnabled') + .modal-header + h3 Rebirth: New Adventure Available! + .modal-body + p + span. + You've unlocked Rebirth! This special Market item allows you to begin a new game at level 1 while keeping your tasks, achievements, pets, and more. Use it to breathe new life into HabitRPG if you feel you've achieved it all, or to experience new features with the fresh eyes of a beginning character! + .modal-footer + button.btn.btn-default.cancel(ng-click='modals.rebirthEnabled = false') Close + +div(modal='modals.rebirth') + .modal-header + h3 Rebirth: Begin a New Adventure + .modal-body + include ../gems + p. + Rebirth sets your game to a starting state, as if you'd created a new account, but keeps your most hard-earned or paid-for items intact. When you are reborn: + ul + li You become a Level 1 Warrior with full Health but no Experience. You may choose a new class at Level 10 as normal. + li You lose all Gold and all purchased equipment. + li Your tasks are reset to neutral (yellow color), but their history remains. + li Your Dailies' streaks are reset to 0. + li You keep your Achievements, your Gems, your backer and contributor tiers, and any purchased avatar customizations, such as hair styles. + li You keep whatever Challenges, Guilds, and Party you are a member of. + li You keep your Pets and Mounts, though you will not be able to access them until you unlock the Stable again. + li You earn an Achievement for beginning a new adventure! + p. + Consider using this feature if you would like to replay the early game with Habit's newest features, or if your motivation drops when you've attained all the best gear! + .modal-footer + button.btn.btn-large.cancel(ng-click='modals.rebirth = false') Never mind + span(ng-if='user.balance < 1') + a.btn.btn-success.btn-large(ng-click="modals.buyGems = true") Buy More Gems + span.gem-cost Not enough Gems + span(ng-if='user.balance >= 1', ng-controller='SettingsCtrl') + a.btn.btn-danger.btn-large(ng-click='rebirth()') Be Reborn + span.gem-cost 8 Gems From cc3632b6115f17831a249aa2ec721fbc98af2061 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Tue, 24 Dec 2013 09:57:04 -0600 Subject: [PATCH 2/4] Add Orb of Rebirth to shop, image to modals, tweak modal text --- views/options/inventory/inventory.jade | 5 +++++ views/shared/modals/rebirth.jade | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/views/options/inventory/inventory.jade b/views/options/inventory/inventory.jade index 0e2e0143b2..fb7cc9fc77 100644 --- a/views/options/inventory/inventory.jade +++ b/views/options/inventory/inventory.jade @@ -122,3 +122,8 @@ script(type='text/ng-template', id='partials/options.inventory.drops.html') p | {{Content.spells.special.snowball.value}} span.Pet_Currency_Gem1x.inline-gems + div(ng-show='user.flags.rebirthEnabled') + button.customize-option(popover='Begin a new character at Level 1 while retaining achievements, collectibles, and tasks with history.', popover-title='Orb of Rebirth', popover-trigger='mouseenter', popover-placement='left', ng-click='modals.rebirth = true', class='rebirth_orb') + p + | 8 + span.Pet_Currency_Gem1x.inline-gems diff --git a/views/shared/modals/rebirth.jade b/views/shared/modals/rebirth.jade index 1a65ec1a6b..a975f957ff 100644 --- a/views/shared/modals/rebirth.jade +++ b/views/shared/modals/rebirth.jade @@ -4,6 +4,7 @@ div(modal='modals.rebirthEnabled') .modal-header h3 Rebirth: New Adventure Available! .modal-body + .rebirth_orb.pull-left(style='margin-right: 5px') p span. You've unlocked Rebirth! This special Market item allows you to begin a new game at level 1 while keeping your tasks, achievements, pets, and more. Use it to breathe new life into HabitRPG if you feel you've achieved it all, or to experience new features with the fresh eyes of a beginning character! @@ -15,9 +16,10 @@ div(modal='modals.rebirth') h3 Rebirth: Begin a New Adventure .modal-body include ../gems - p. - Rebirth sets your game to a starting state, as if you'd created a new account, but keeps your most hard-earned or paid-for items intact. When you are reborn: - ul + .rebirth_orb.pull-left(style='margin-right: 5px') + p Rebirth sets your game to a starting state, as if you'd created a new account, but keeps your most hard-earned or paid-for items intact. + br + .unordered li You become a Level 1 Warrior with full Health but no Experience. You may choose a new class at Level 10 as normal. li You lose all Gold and all purchased equipment. li Your tasks are reset to neutral (yellow color), but their history remains. @@ -26,8 +28,8 @@ div(modal='modals.rebirth') li You keep whatever Challenges, Guilds, and Party you are a member of. li You keep your Pets and Mounts, though you will not be able to access them until you unlock the Stable again. li You earn an Achievement for beginning a new adventure! - p. - Consider using this feature if you would like to replay the early game with Habit's newest features, or if your motivation drops when you've attained all the best gear! + br + p Use this feature to replay the early game with Habit's newest features, or to bring back the motivation of equipment Rewards when you have it all! .modal-footer button.btn.btn-large.cancel(ng-click='modals.rebirth = false') Never mind span(ng-if='user.balance < 1') From 3b94b18bb6acb19a5146e0982a2ad47083684ae6 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Tue, 24 Dec 2013 18:09:32 -0600 Subject: [PATCH 3/4] Implement Rebirth in controllers and API, revise modal per @wc8 feedback --- public/js/controllers/settingsCtrl.js | 6 ++++++ src/routes/apiv2.js | 3 ++- views/shared/modals/rebirth.jade | 29 ++++++++++++++++----------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/public/js/controllers/settingsCtrl.js b/public/js/controllers/settingsCtrl.js index 0efd6504c1..8ad6419a14 100644 --- a/public/js/controllers/settingsCtrl.js +++ b/public/js/controllers/settingsCtrl.js @@ -59,6 +59,12 @@ habitrpg.controller('SettingsCtrl', $rootScope.$state.go('tasks'); } + $scope.rebirth = function(){ + User.user.ops.rebirth({}); + $rootScope.modals.rebirth = false; + $rootScope.$state.go('tasks'); + } + $scope.changePassword = function(changePass){ if (!changePass.oldPassword || !changePass.newPassword || !changePass.confirmNewPassword) { return alert("Please fill out all fields"); diff --git a/src/routes/apiv2.js b/src/routes/apiv2.js index b80c092c3a..8c7ca55742 100644 --- a/src/routes/apiv2.js +++ b/src/routes/apiv2.js @@ -62,7 +62,8 @@ router['delete']('/user', auth.auth, user['delete']); router.post('/user/revive', auth.auth, cron, user.revive); // Shared.ops router.post('/user/reroll', auth.auth, cron, user.reroll); // Shared.ops router.post('/user/reset', auth.auth, user.reset); // Shared.ops -router.post('/user/sleep', auth.auth, cron, user.sleep); //Shared.opss +router.post('/user/sleep', auth.auth, cron, user.sleep); //Shared.ops +router.post('/user/rebirth', auth.auth, cron, user.rebirth); //Shared.ops router.post('/user/class/change', auth.auth, cron, user.changeClass); //Shared.ops | query={class} router.post('/user/class/allocate', auth.auth, cron, user.allocate); //Shared.ops | query={stat} diff --git a/views/shared/modals/rebirth.jade b/views/shared/modals/rebirth.jade index a975f957ff..0139276afd 100644 --- a/views/shared/modals/rebirth.jade +++ b/views/shared/modals/rebirth.jade @@ -17,24 +17,29 @@ div(modal='modals.rebirth') .modal-body include ../gems .rebirth_orb.pull-left(style='margin-right: 5px') - p Rebirth sets your game to a starting state, as if you'd created a new account, but keeps your most hard-earned or paid-for items intact. + p Rebirth starts your character over from Level 1, as if you had created a new account. br + p Your adventure begins anew with a clean slate: .unordered - li You become a Level 1 Warrior with full Health but no Experience. You may choose a new class at Level 10 as normal. - li You lose all Gold and all purchased equipment. - li Your tasks are reset to neutral (yellow color), but their history remains. - li Your Dailies' streaks are reset to 0. - li You keep your Achievements, your Gems, your backer and contributor tiers, and any purchased avatar customizations, such as hair styles. - li You keep whatever Challenges, Guilds, and Party you are a member of. - li You keep your Pets and Mounts, though you will not be able to access them until you unlock the Stable again. - li You earn an Achievement for beginning a new adventure! + li You return to full Health. + li You have no Experience, Gold, or equipment. + li Your Habits, Dailies, and To-Dos reset to yellow, and streaks reset. + li You have the starting class of Warrior until you earn a new class. br - p Use this feature to replay the early game with Habit's newest features, or to bring back the motivation of equipment Rewards when you have it all! + p Your new character inherits a few things from their predecessor: + .unordered + li Tasks, history, and settings remain. + li Challenge, Guild, and Party memberships remain. + li Gems, backer tiers, and contributor levels remain. + li Items obtained from Gems or drops (such as pets and mounts) remain, though you cannot access them until you unlock them again. + br + .achievement-sun.pull-left(style='margin-right: 5px') + p You also earn an Achievement for beginning a new adventure! .modal-footer button.btn.btn-large.cancel(ng-click='modals.rebirth = false') Never mind - span(ng-if='user.balance < 1') + span(ng-if='user.balance < 2') a.btn.btn-success.btn-large(ng-click="modals.buyGems = true") Buy More Gems span.gem-cost Not enough Gems - span(ng-if='user.balance >= 1', ng-controller='SettingsCtrl') + span(ng-if='user.balance >= 2', ng-controller='SettingsCtrl') a.btn.btn-danger.btn-large(ng-click='rebirth()') Be Reborn span.gem-cost 8 Gems From f38b8e41af1f792f55b1e923a0f5ba49de44a0b3 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Wed, 25 Dec 2013 17:56:55 -0600 Subject: [PATCH 4/4] Final commit for Rebirth feature! Implement achievement and prestige icon --- public/js/controllers/notificationCtrl.js | 5 +++++ src/models/user.js | 3 ++- views/shared/header/avatar.jade | 1 + views/shared/modals/achievements.jade | 18 +++++++++++++----- views/shared/profiles/achievements.jade | 9 ++++++++- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/public/js/controllers/notificationCtrl.js b/public/js/controllers/notificationCtrl.js index 03d418ffd0..f0e2da347c 100644 --- a/public/js/controllers/notificationCtrl.js +++ b/public/js/controllers/notificationCtrl.js @@ -61,6 +61,11 @@ habitrpg.controller('NotificationCtrl', $rootScope.modals.achievements.beastMaster = true; }, true); + $rootScope.$watch('user.achievements.rebirths', function(after, before){ + if(after === before) return; + $rootScope.modals.achievements.rebirth = true; + }); + /*_.each(['weapon', 'head', 'chest', 'shield'], function(watched){ $rootScope.$watch('user.items.' + watched, function(before, after){ if (after == before) return; diff --git a/src/models/user.js b/src/models/user.js index d47530cfec..a43f0292cc 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -46,7 +46,8 @@ var UserSchema = new Schema({ snowball: Number, streak: Number, challenges: Array, - rebirth: Array + rebirths: Number, + rebirthLevel: Number }, auth: { facebook: Schema.Types.Mixed, diff --git a/views/shared/header/avatar.jade b/views/shared/header/avatar.jade index fd9ed71529..eb90fa239a 100644 --- a/views/shared/header/avatar.jade +++ b/views/shared/header/avatar.jade @@ -46,3 +46,4 @@ figure.herobox(ng-click='spell ? castEnd(profile, "user", $event) : clickMember( .avatar-level(ng-class='userLevelStyle(profile,"label")') i.icon-circle-arrow-up.icon-white(ng-show='profile.stats.buffs.str || profile.stats.buffs.per || profile.stats.buffs.con || profile.stats.buffs.int || profile.stats.buffs.stealth', tooltip='Buffed', style='margin-right:5px;') | Lvl {{profile.stats.lvl}} + i.icon-plus-sign.icon-white(ng-show='profile.achievements.rebirths', tooltip='Reborn, max level {{profile.achievements.rebirthLevel}}', style='margin-left:5px') diff --git a/views/shared/modals/achievements.jade b/views/shared/modals/achievements.jade index a30a15d2bd..ef14be21bf 100644 --- a/views/shared/modals/achievements.jade +++ b/views/shared/modals/achievements.jade @@ -7,7 +7,7 @@ div(modal='modals.achievements.streak') .achievement.achievement-thermometer | You have stacked your "Streaker" Achievement! Every 21 days of streak, you gain 1 achievement point here. .modal-footer - button.btn.btn-default.cancel(ng-click='modals.achievements.streak = false') Ok + button.btn.btn-default.cancel(ng-click='modals.achievements.streak = false') OK // Max Gear div(modal='modals.achievements.ultimateGear') @@ -17,7 +17,7 @@ div(modal='modals.achievements.ultimateGear') .achievement.achievement-armor | You have earned the "Ultimate Gear" Achievement for upgrading to the maximum gear set! .modal-footer - button.btn.btn-default.cancel(ng-click='modals.achievements.ultimateGear = false') Ok + button.btn.btn-default.cancel(ng-click='modals.achievements.ultimateGear = false') OK // Beast Master div(modal='modals.achievements.beastMaster') @@ -28,7 +28,7 @@ div(modal='modals.achievements.beastMaster') .achievement.achievement-rat | You have earned the "Beast Master" Achievement for collecting all the pets! .modal-footer - button.btn.btn-default.cancel(ng-click='modals.achievements.beastMaster = false') Ok + button.btn.btn-default.cancel(ng-click='modals.achievements.beastMaster = false') OK // Contributor div(modal='user.flags.contributor') @@ -40,7 +40,15 @@ div(modal='user.flags.contributor') {{user.profile.name}}, you awesome person! You're now a level {{user.contributor.level}} contributor for helping HabitRPG. See what prizes you've earned for your contribution! .modal-footer - button.btn.btn-default.cancel(ng-click='set({"flags.contributor":false})') Ok - + button.btn.btn-default.cancel(ng-click='set({"flags.contributor":false})') OK +//Rebirth +div(modal='modals.achievements.rebirth') + .modal-header + h3 Achievement! + .modal-body + .achievement.achievement-sun + | You've begun a new adventure! This is Rebirth {{user.achievements.rebirths}} for you, and the highest Level you've attained is {{user.achievements.rebirthLevel}}. To stack this Achievement, begin your next new adventure when you've reached an even higher Level! + .modal-footer + button.btn.btn-default.cancel(ng-click='modals.achievements.rebirth = false') OK diff --git a/views/shared/profiles/achievements.jade b/views/shared/profiles/achievements.jade index fefd37bf82..f95a284d61 100644 --- a/views/shared/profiles/achievements.jade +++ b/views/shared/profiles/achievements.jade @@ -3,7 +3,6 @@ //
//
//
- //
//
//
//
@@ -57,6 +56,14 @@ small Has found all 90 pets (insanely difficult, give this user props!) hr + div(ng-if='profile.achievements.rebirths') + .achievement.achievement-sun + h5(ng-if='profile.achievements.rebirths == 1') Began a New Adventure + h5(ng-if='profile.achievements.rebirths > 1') Began {{profile.achievements.rebirths}} New Adventures + small. + Used an Orb of Rebirth to start over after attaining Level {{profile.achievements.rebirthLevel}}. + hr + div(ng-if='profile.achievements.helpedHabit') .achievement.achievement-tree h5 Helped Habit Grow