mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
feat(Armoire): Improved counter
The popover counter of remaining Equipment in the Armoire now counts down immediately instead of requiring a browser refresh. A modal announces when the last item has been found. Also includes several fixes to the Ultimate Gear migration.
This commit is contained in:
@@ -3,8 +3,9 @@
|
|||||||
"potionNotes": "Recover 15 Health (Instant Use)",
|
"potionNotes": "Recover 15 Health (Instant Use)",
|
||||||
|
|
||||||
"armoireText": "Enchanted Armoire",
|
"armoireText": "Enchanted Armoire",
|
||||||
"armoireNotesFull": "Open the Armoire to randomly receive special equipment, Experience, or food!",
|
"armoireNotesFull": "Open the Armoire to randomly receive special Equipment, Experience, or food! Equipment pieces remaining: ",
|
||||||
"armoireNotesEmpty": "The Enchanted Armoire will have new Equipment every month. Until then, keep clicking for Experience and Food!",
|
"armoireLastItem": "You've found the last piece of rare Equipment in the Enchanted Armoire.",
|
||||||
|
"armoireNotesEmpty": "The Armoire will have new Equipment every month. Until then, keep clicking for Experience and Food!",
|
||||||
|
|
||||||
"dropEggWolfText": "Wolf",
|
"dropEggWolfText": "Wolf",
|
||||||
"dropEggWolfAdjective": "loyal",
|
"dropEggWolfAdjective": "loyal",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
"messageDropEgg": "You've found a <%= dropText %> Egg! <%= dropNotes %>",
|
"messageDropEgg": "You've found a <%= dropText %> Egg! <%= dropNotes %>",
|
||||||
"messageDropPotion": "You've found a <%= dropText %> Hatching Potion! <%= dropNotes %>",
|
"messageDropPotion": "You've found a <%= dropText %> Hatching Potion! <%= dropNotes %>",
|
||||||
"messageFoundQuest": "You've found the quest \"<%= questText %>\"!",
|
"messageFoundQuest": "You've found the quest \"<%= questText %>\"!",
|
||||||
"armoireEquipment": "<%= image %> You found a piece of rare Equipment in the Armoire: <%= dropText %>! Awesome! There are <%= count %> pieces left.",
|
"armoireEquipment": "<%= image %> You found a piece of rare Equipment in the Armoire: <%= dropText %>! Awesome!",
|
||||||
"armoireFood": "<%= image %> You rummage in the Armoire and find <%= dropArticle %><%= dropText %>. What's that doing in here?",
|
"armoireFood": "<%= image %> You rummage in the Armoire and find <%= dropArticle %><%= dropText %>. What's that doing in here?",
|
||||||
"armoireExp": "You wrestle with the Armoire and gain Experience. Take that!"
|
"armoireExp": "You wrestle with the Armoire and gain Experience. Take that!"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -363,8 +363,8 @@ api.countTriad = (pets) ->
|
|||||||
count3
|
count3
|
||||||
|
|
||||||
api.countArmoire = (gear) ->
|
api.countArmoire = (gear) ->
|
||||||
count4 = _.size(_.filter(content.gear.flat, ((i)->i.klass is 'armoire' and !gear[i.key])))
|
count = _.size(_.filter(content.gear.flat, ((i)->i.klass is 'armoire' and !gear[i.key])))
|
||||||
count4
|
count
|
||||||
|
|
||||||
###
|
###
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
@@ -856,7 +856,8 @@ api.wrap = (user, main=true) ->
|
|||||||
drop = user.fns.randomVal(eligibleEquipment)
|
drop = user.fns.randomVal(eligibleEquipment)
|
||||||
user.items.gear.owned[drop.key] = true
|
user.items.gear.owned[drop.key] = true
|
||||||
user.flags.armoireOpened = true
|
user.flags.armoireOpened = true
|
||||||
message = i18n.t('armoireEquipment', {image: '<span class="shop_'+drop.key+' pull-left"></span>', dropText: drop.text(req.language), count: api.countArmoire(user.items.gear.owned)}, req.language)
|
message = i18n.t('armoireEquipment', {image: '<span class="shop_'+drop.key+' pull-left"></span>', dropText: drop.text(req.language)}, req.language)
|
||||||
|
if api.countArmoire(user.items.gear.owned) is 0 then user.flags.armoireEmpty = true
|
||||||
else if (!_.isEmpty(eligibleEquipment) and armoireResult < .85) or armoireResult < .6
|
else if (!_.isEmpty(eligibleEquipment) and armoireResult < .85) or armoireResult < .6
|
||||||
drop = user.fns.randomVal _.where(content.food, {canDrop:true})
|
drop = user.fns.randomVal _.where(content.food, {canDrop:true})
|
||||||
user.items.food[drop.key] ?= 0
|
user.items.food[drop.key] ?= 0
|
||||||
|
|||||||
@@ -17,48 +17,36 @@ var _ = require('lodash');
|
|||||||
|
|
||||||
var dbUsers = mongo.db(dbserver + '/habitrpg?auto_reconnect').collection('users');
|
var dbUsers = mongo.db(dbserver + '/habitrpg?auto_reconnect').collection('users');
|
||||||
|
|
||||||
var query = {
|
var fields = {
|
||||||
'items.gear.owned.weapon_wizard_6':true,
|
'achievements.ultimateGearSets':1
|
||||||
'items.gear.owned.armor_wizard_5':true,
|
|
||||||
'items.gear.owned.head_wizard_5':true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var fields = {
|
var query = {
|
||||||
'achievements.ultimateGearSets.wizard':true
|
'items.gear.owned.weapon_wizard_6': {$exists: true},
|
||||||
|
'items.gear.owned.armor_wizard_5': {$exists: true},
|
||||||
|
'items.gear.owned.head_wizard_5': {$exists: true}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* var query = {
|
/* var query = {
|
||||||
'items.gear.owned.weapon_warrior_6':true,
|
'items.gear.owned.weapon_warrior_6': {$exists: true},
|
||||||
'items.gear.owned.armor_warrior_5':true,
|
'items.gear.owned.armor_warrior_5': {$exists: true},
|
||||||
'items.gear.owned.head_warrior_5':true,
|
'items.gear.owned.head_warrior_5': {$exists: true},
|
||||||
'items.gear.owned.shield_warrior_5':true
|
'items.gear.owned.shield_warrior_5': {$exists: true}
|
||||||
};
|
|
||||||
|
|
||||||
var fields = {
|
|
||||||
'achievements.ultimateGearSets.warrior':true
|
|
||||||
}; */
|
}; */
|
||||||
|
|
||||||
/* var query = {
|
/* var query = {
|
||||||
'items.gear.owned.weapon_healer_6':true,
|
'items.gear.owned.weapon_healer_6': {$exists: true},
|
||||||
'items.gear.owned.armor_healer_5':true,
|
'items.gear.owned.armor_healer_5': {$exists: true},
|
||||||
'items.gear.owned.head_healer_5':true,
|
'items.gear.owned.head_healer_5': {$exists: true},
|
||||||
'items.gear.owned.shield_healer_5':true
|
'items.gear.owned.shield_healer_5': {$exists: true}
|
||||||
};
|
}; */
|
||||||
|
|
||||||
var fields = {
|
|
||||||
'achievements.ultimateGearSets.healer':true
|
|
||||||
}; */
|
|
||||||
|
|
||||||
/* var query = {
|
/* var query = {
|
||||||
'items.gear.owned.weapon_rogue_6':true,
|
'items.gear.owned.weapon_rogue_6': {$exists: true},
|
||||||
'items.gear.owned.armor_rogue_5':true,
|
'items.gear.owned.armor_rogue_5': {$exists: true},
|
||||||
'items.gear.owned.head_rogue_5':true,
|
'items.gear.owned.head_rogue_5': {$exists: true},
|
||||||
'items.gear.owned.shield_rogue_6':true
|
'items.gear.owned.shield_rogue_6': {$exists: true}
|
||||||
};
|
}; */
|
||||||
|
|
||||||
var fields = {
|
|
||||||
'achievements.ultimateGearSets.rogue':true
|
|
||||||
}; */
|
|
||||||
|
|
||||||
console.warn('Updating users...');
|
console.warn('Updating users...');
|
||||||
var progressCount = 1000;
|
var progressCount = 1000;
|
||||||
@@ -71,7 +59,7 @@ dbUsers.findEach(query, fields, {batchSize:250}, function(err, user) {
|
|||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
var set = {'migration':migrationName, 'achievements.ultimateGearSets':{'wizard':true} }; // Change per class
|
var set = {'migration':migrationName, 'achievements.ultimateGearSets.wizard':true}; // Change per class
|
||||||
dbUsers.update({_id:user._id}, {$set:set});
|
dbUsers.update({_id:user._id}, {$set:set});
|
||||||
|
|
||||||
if (count%progressCount == 0) console.warn(count + ' ' + user._id);
|
if (count%progressCount == 0) console.warn(count + ' ' + user._id);
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ habitrpg.controller('NotificationCtrl',
|
|||||||
$rootScope.openModal('achievements/ultimateGear');
|
$rootScope.openModal('achievements/ultimateGear');
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
|
$rootScope.$watch('user.flags.armoireEmpty', function(after,before){
|
||||||
|
if (before == undefined || after == before || after == false) return;
|
||||||
|
$rootScope.openModal('armoireEmpty');
|
||||||
|
});
|
||||||
|
|
||||||
$rootScope.$watch('user.achievements.rebirths', function(after, before){
|
$rootScope.$watch('user.achievements.rebirths', function(after, before){
|
||||||
if(after === before) return;
|
if(after === before) return;
|
||||||
$rootScope.openModal('achievements/rebirth');
|
$rootScope.openModal('achievements/rebirth');
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||||||
$rootScope.Groups = Groups;
|
$rootScope.Groups = Groups;
|
||||||
$rootScope.toJson = angular.toJson;
|
$rootScope.toJson = angular.toJson;
|
||||||
$rootScope.Payments = Payments;
|
$rootScope.Payments = Payments;
|
||||||
$rootScope.armoireCount = Shared.countArmoire(User.user.items.gear.owned);
|
|
||||||
|
|
||||||
// Angular UI Router
|
// Angular UI Router
|
||||||
$rootScope.$state = $state;
|
$rootScope.$state = $state;
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||||||
function($scope, $rootScope, $location, User, Notification, $http, ApiUrl, $timeout, Shared, Guide) {
|
function($scope, $rootScope, $location, User, Notification, $http, ApiUrl, $timeout, Shared, Guide) {
|
||||||
$scope.obj = User.user; // used for task-lists
|
$scope.obj = User.user; // used for task-lists
|
||||||
$scope.user = User.user;
|
$scope.user = User.user;
|
||||||
|
$scope.armoireCount = function(gear) {
|
||||||
|
return Shared.countArmoire(gear);
|
||||||
|
};
|
||||||
|
|
||||||
$scope.score = function(task, direction) {
|
$scope.score = function(task, direction) {
|
||||||
switch (task.type) {
|
switch (task.type) {
|
||||||
|
|||||||
@@ -159,7 +159,8 @@ var UserSchema = new Schema({
|
|||||||
cronCount: {type:Number, 'default':0},
|
cronCount: {type:Number, 'default':0},
|
||||||
welcomed: {type: Boolean, 'default': false},
|
welcomed: {type: Boolean, 'default': false},
|
||||||
armoireEnabled: {type: Boolean, 'default': false},
|
armoireEnabled: {type: Boolean, 'default': false},
|
||||||
armoireOpened: {type: Boolean, 'default': false}
|
armoireOpened: {type: Boolean, 'default': false},
|
||||||
|
armoireEmpty: {type: Boolean, 'default': false}
|
||||||
},
|
},
|
||||||
history: {
|
history: {
|
||||||
exp: Array, // [{date: Date, value: Number}], // big peformance issues if these are defined
|
exp: Array, // [{date: Date, value: Number}], // big peformance issues if these are defined
|
||||||
|
|||||||
@@ -51,3 +51,14 @@ script(type='text/ng-template', id='modals/pet-key.html')
|
|||||||
span(ng-if='!user.achievements.triadBingo')
|
span(ng-if='!user.achievements.triadBingo')
|
||||||
| : 6
|
| : 6
|
||||||
span.Pet_Currency_Gem1x.inline-gems
|
span.Pet_Currency_Gem1x.inline-gems
|
||||||
|
|
||||||
|
script(type='text/ng-template', id='modals/armoireEmpty.html')
|
||||||
|
.modal-header
|
||||||
|
.shop_armoire.pull-right
|
||||||
|
h4=env.t('armoireText')
|
||||||
|
.modal-body
|
||||||
|
p=env.t('armoireLastItem')
|
||||||
|
br
|
||||||
|
p=env.t('armoireNotesEmpty')
|
||||||
|
.modal-footer
|
||||||
|
button.btn.btn-default(ng-click='$close()')=env.t('close')
|
||||||
@@ -126,7 +126,7 @@ script(id='templates/habitrpg-tasks.html', type="text/ng-template")
|
|||||||
|
|
||||||
// Static Rewards
|
// Static Rewards
|
||||||
ul.items.rewards(ng-if='main && list.type=="reward"')
|
ul.items.rewards(ng-if='main && list.type=="reward"')
|
||||||
li.task.reward-item(ng-repeat='item in itemStore',popover-trigger='mouseenter', popover-placement='top', popover='{{item.key == "armoire" && armoireCount > 0 ? env.t("armoireNotesFull") : item.notes()}}')
|
li.task.reward-item(ng-repeat='item in itemStore',popover-trigger='mouseenter', popover-placement='top', popover='{{item.key == "armoire" && !user.flags.armoireEmpty ? env.t("armoireNotesFull") + armoireCount(user.items.gear.owned) : item.notes()}}')
|
||||||
// right-hand side control buttons
|
// right-hand side control buttons
|
||||||
.task-meta-controls
|
.task-meta-controls
|
||||||
span.task-notes
|
span.task-notes
|
||||||
|
|||||||
Reference in New Issue
Block a user