From cc5a6de9cbe8045847684a39a5293565d4a72b50 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Fri, 27 Dec 2013 09:54:48 -0600 Subject: [PATCH 1/4] Initial commit: add allocationMode user preference and form for choosing it --- src/models/user.js | 1 + views/options/profile.jade | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/models/user.js b/src/models/user.js index 1c32342c1c..36c7c6f845 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -228,6 +228,7 @@ var UserSchema = new Schema({ timezoneOffset: Number, language: String, automaticAllocation: Boolean, + allocationMode: {type:String, enum: ['flat','classbased','taskbased'], 'default': 'flat'}, costume: Boolean, sleep: {type: Boolean, 'default': false}, stickyHeader: {type: Boolean, 'default': true}, diff --git a/views/options/profile.jade b/views/options/profile.jade index bbf97f5c93..b3cc6c6598 100644 --- a/views/options/profile.jade +++ b/views/options/profile.jade @@ -141,15 +141,28 @@ script(id='partials/options.profile.stats.html', type='text/ng-template') h4 | {{user.stats.class}}  a.btn.btn-danger.btn-mini(ng-click='changeClass(null)') - | Change & Re-Roll  + | Change Class, Refund Attribute Points  small 3 h6 Points: {{user.stats.points}} fieldset.auto-allocate label.checkbox input(type='checkbox', ng-model='user.preferences.automaticAllocation', ng-change='set({"preferences.automaticAllocation": user.preferences.automaticAllocation?true: false})') - | Automatic Allocation - i.icon-question-sign(popover-trigger='mouseenter', popover-placement='bottom', popover="When 'automatic' is checked, your points will be allocated to the stat representing your task focus (see Task > Edit). When unchecked, you'll have one point to allocate each level. The system makes a suggestion, but you can ignore the suggestion.") + | Automatic Allocation  + i.icon-question-sign(popover-trigger='mouseenter', popover-placement='right', popover="Places points into attributes according to your preferences, when you level up.") + form(ng-show='user.preferences.automaticAllocation') + label.radio + input(type='radio', name='allocationMode', value='flat', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "flat"})') + | Distribute attribute points evenly  + i.icon-question-sign(popover-trigger='mouseenter', popover-placement='right', popover="Assigns the same number of points to each attribute.") + label.radio + input(type='radio', name='allocationMode', value='classbased', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "classbased"})') + | Distribute attribute points based on Class  + i.icon-question-sign(popover-trigger='mouseenter', popover-placement='right', popover="Assigns more points to the attributes important to your Class.") + label.radio + input(type='radio', name='allocationMode', value='taskbased', ng-model='user.preferences.allocationMode', ng-change='set({"preferences.allocationMode": "taskbased"})') + | Distribute attribute points based on task activity  + i.icon-question-sign(popover-trigger='mouseenter', popover-placement='right', popover="Assigns points based on the Physical (STR), Mental (INT), Social (CON), and Other (PER) categories associated with the tasks you complete.") table.table.table-striped tr td From a854109fcdb9fbe28d17b99b229d11e45e8c8017 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Mon, 30 Dec 2013 07:33:17 -0600 Subject: [PATCH 2/4] Get attributes layout up-to-date with develop changes --- views/shared/profiles/stats.jade | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/views/shared/profiles/stats.jade b/views/shared/profiles/stats.jade index e6c25bd009..882b4aabb6 100644 --- a/views/shared/profiles/stats.jade +++ b/views/shared/profiles/stats.jade @@ -30,17 +30,22 @@ table.table.table-striped td strong {{v}}: {{profile._statsComputed[k]}} td - ul - li Level: {{(profile.stats.lvl - 1) / 2}}  - i.icon-question-sign(popover-title='Level Bonus', popover-trigger='mouseenter', popover-placement='right', popover="Each attribute gets a bonus equal to half your Level.") - li Equipment: {{Content.gear.flat[profile.items.gear.equipped.weapon][k] + Content.gear.flat[profile.items.gear.equipped.armor][k] + Content.gear.flat[profile.items.gear.equipped.head][k] + Content.gear.flat[profile.items.gear.equipped.shield][k] || 0}}  - i.icon-question-sign(popover-title='Equipment', popover-trigger='mouseenter', popover-placement='right', popover="Attribute bonuses provided by your equipped battle gear. See the Equipment tab under Inventory to select your battle gear.") - li Class Equip Bonus: {{profile._statsComputed[k] - profile.stats.buffs[k] - ((profile.stats.lvl - 1) / 2) - Content.gear.flat[profile.items.gear.equipped.weapon][k] - Content.gear.flat[profile.items.gear.equipped.armor][k] - Content.gear.flat[profile.items.gear.equipped.head][k] - Content.gear.flat[profile.items.gear.equipped.shield][k]}}  - i.icon-question-sign(popover-title='Class Equipment Bonus', popover-trigger='mouseenter', popover-placement='right', popover="Your class uses its own equipment more effectively than gear from other classes. Equipped gear from your current class gets a 50% boost to the attribute bonus it grants.") - li Allocated: {{profile.stats[k] || 0}}  - i.icon-question-sign(popover-title='Allocated Points', popover-trigger='mouseenter', popover-placement='right', popover="Attribute points you've earned and assigned. Assign points using the Character Build column.") - li Buffs: {{profile.stats.buffs[k] || 0}}  - i.icon-question-sign(popover-title='Buffs', popover-trigger='mouseenter', popover-placement='right', popover="Attribute bonuses provided by abilities you or your party members have used. The abilities you can use are found in the Rewards column on your Tasks page.") + ul(style='list-style-type:none') + li + i.icon-question-sign(popover-title='Level Bonus', popover-trigger='mouseenter', popover-placement='top', popover="Each attribute gets a bonus equal to half your Level.") + | Level: {{(profile.stats.lvl - 1) / 2}}  + li + i.icon-question-sign(popover-title='Equipment', popover-trigger='mouseenter', popover-placement='top', popover="Attribute bonuses provided by your equipped battle gear. See the Equipment tab under Inventory to select your battle gear.") + | Equipment: {{Content.gear.flat[profile.items.gear.equipped.weapon][k] + Content.gear.flat[profile.items.gear.equipped.armor][k] + Content.gear.flat[profile.items.gear.equipped.head][k] + Content.gear.flat[profile.items.gear.equipped.shield][k] || 0}}  + li + i.icon-question-sign(popover-title='Class Equipment Bonus', popover-trigger='mouseenter', popover-placement='top', popover="Your class uses its own equipment more effectively than gear from other classes. Equipped gear from your current class gets a 50% boost to the attribute bonus it grants.") + | Class Equip Bonus: {{profile._statsComputed[k] - profile.stats.buffs[k] - ((profile.stats.lvl - 1) / 2) - Content.gear.flat[profile.items.gear.equipped.weapon][k] - Content.gear.flat[profile.items.gear.equipped.armor][k] - Content.gear.flat[profile.items.gear.equipped.head][k] - Content.gear.flat[profile.items.gear.equipped.shield][k] - profile.stats[k]}}  + li + i.icon-question-sign(popover-title='Allocated Points', popover-trigger='mouseenter', popover-placement='top', popover="Attribute points you've earned and assigned. Assign points using the Character Build column.") + | Allocated: {{profile.stats[k] || 0}}  + li + i.icon-question-sign(popover-title='Buffs', popover-trigger='mouseenter', popover-placement='top', popover="Attribute bonuses provided by abilities you or your party members have used. The abilities you can use are found in the Rewards column on your Tasks page.") + | Buffs: {{profile.stats.buffs[k] || 0}}  tr(ng-if='profile.stats.buffs.stealth') td strong Stealth: {{profile.stats.buffs.stealth}}  From 9c5f1c21509b8f2c1e2950359a2d8c82d01a8d44 Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Mon, 30 Dec 2013 22:56:01 -0600 Subject: [PATCH 3/4] Add debug button to hand out levels one at a time --- public/js/controllers/footerCtrl.js | 5 +++++ views/shared/footer.jade | 2 ++ 2 files changed, 7 insertions(+) diff --git a/public/js/controllers/footerCtrl.js b/public/js/controllers/footerCtrl.js index df7990b651..6541f6f70f 100644 --- a/public/js/controllers/footerCtrl.js +++ b/public/js/controllers/footerCtrl.js @@ -62,4 +62,9 @@ habitrpg.controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http', 'Not 'stats.mp': User.user.stats.mp + 10000 }); } + $scope.addOneLevel = function(){ + User.set({ + 'stats.exp': User.user.stats.exp + (Math.round(((Math.pow(User.user.stats.lvl, 2) * 0.25) + (10 * User.user.stats.lvl) + 139.75) / 10) * 10) + }); + } }]) \ No newline at end of file diff --git a/views/shared/footer.jade b/views/shared/footer.jade index 224159f7d3..54770374ec 100644 --- a/views/shared/footer.jade +++ b/views/shared/footer.jade @@ -73,5 +73,7 @@ footer.footer(ng-controller='FooterCtrl') a.btn(ng-click='addTenGems()') +10 Gems li a.btn(ng-click='addLevelsAndGold()') +Exp +GP + li + a.btn(ng-click='addOneLevel()') +1 Level div(ng-init='deferredScripts()') From 8de5206f1bd328f00a83af7757b18e5076ff0bab Mon Sep 17 00:00:00 2001 From: Sabe Jones Date: Tue, 31 Dec 2013 09:04:02 -0600 Subject: [PATCH 4/4] Add attribute training to user model --- src/models/user.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/models/user.js b/src/models/user.js index 36c7c6f845..4638f8544b 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -255,12 +255,18 @@ var UserSchema = new Schema({ per: {type: Number, 'default': 0}, buffs: { str: {type: Number, 'default': 0}, - def: {type: Number, 'default': 0}, + int: {type: Number, 'default': 0}, per: {type: Number, 'default': 0}, con: {type: Number, 'default': 0}, stealth: {type: Number, 'default': 0}, streaks: {type: Boolean, 'default': false}, snowball: {type: Boolean, 'default': false} + }, + training: { + int: {type: Number, 'default': 0}, + per: {type: Number, 'default': 0}, + str: {type: Number, 'default': 0}, + con: {type: Number, 'default': 0} } }, tags: [