mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
classes: very simple "buffs applied" icon next to level, add chat message
for party / member casts (@wc8 @sabrecat)
This commit is contained in:
@@ -58,7 +58,8 @@ habitrpg.controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http', 'Not
|
||||
$scope.addLevelsAndGold = function(){
|
||||
User.set({
|
||||
'stats.exp': User.user.stats.exp + 10000,
|
||||
'stats.gp': User.user.stats.gp + 10000
|
||||
'stats.gp': User.user.stats.gp + 10000,
|
||||
'stats.mp': User.user.stats.mp + 10000
|
||||
});
|
||||
}
|
||||
}])
|
||||
@@ -18,6 +18,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
||||
$rootScope.User = User;
|
||||
$rootScope.user = user;
|
||||
$rootScope.moment = window.moment;
|
||||
$rootScope.moment = window._;
|
||||
$rootScope.settings = User.settings;
|
||||
$rootScope.Shared = window.habitrpgShared;
|
||||
$rootScope.Content = window.habitrpgShared.content;
|
||||
|
||||
@@ -320,16 +320,41 @@ api.cast = function(req, res) {
|
||||
break;
|
||||
|
||||
case 'party':
|
||||
case 'user':
|
||||
async.waterfall([
|
||||
function(cb){
|
||||
Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members').exec(cb);
|
||||
},
|
||||
function(group, cb) {
|
||||
if (!group) group = {members:[user]};
|
||||
spell.cast(user, group.members);
|
||||
var series = _.transform(group.members, function(m,v,k){
|
||||
m[k] = function(cb2){v.save(cb2);}
|
||||
});
|
||||
// Solo player? let's just create a faux group for simpler code
|
||||
var g = group ? group : {members:[user]};
|
||||
var series = [], found;
|
||||
if (type == 'party') {
|
||||
spell.cast(user, g.members);
|
||||
series = _.transform(g.members, function(m,v,k){
|
||||
m.push(function(cb2){v.save(cb2)});
|
||||
});
|
||||
} else {
|
||||
found = _.find(g.members, {_id: target._id})
|
||||
spell.cast(user, found);
|
||||
series.push(function(cb2){found.save(cb2)});
|
||||
}
|
||||
|
||||
if (group) {
|
||||
series.push(function(cb2){
|
||||
group.chat.unshift({
|
||||
id: shared.uuid(),
|
||||
uuid: user._id,
|
||||
contributor: user.contributor && user.contributor.toObject(),
|
||||
backer: user.backer && user.backer.toObject(),
|
||||
text: '`casts ' + spell.text + ' on ' + (type == 'user' ? found.profile.name : 'the party') + '`',
|
||||
user: '<'+user.profile.name+'>',
|
||||
timestamp: +new Date
|
||||
});
|
||||
group.save(cb2);
|
||||
})
|
||||
}
|
||||
|
||||
async.series(series, cb);
|
||||
},
|
||||
function(whatever, cb){
|
||||
@@ -337,21 +362,6 @@ api.cast = function(req, res) {
|
||||
}
|
||||
], done);
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
async.waterfall([
|
||||
function(cb) {
|
||||
User.findById(target._id, cb);
|
||||
},
|
||||
function(member, cb) {
|
||||
spell.cast(user, member);
|
||||
member.save(cb); // not parallel because target could be user, which causes race condition when saving
|
||||
},
|
||||
function(saved, num, cb) {
|
||||
user.save(cb);
|
||||
}
|
||||
], done);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,4 +41,7 @@ figure.herobox(ng-click='spell ? castEnd(profile, "user", $event) : clickMember(
|
||||
// FIXME handle @minimal, this might have to be a directive
|
||||
span.current-pet(class='Pet-{{profile.items.currentPet}}', ng-show='profile.items.currentPet && !minimal')
|
||||
.avatar-level(ng-class='userLevelStyle(profile,"label")')
|
||||
//- why isn't this working?
|
||||
//-i.icon-circle-arrow-up.icon-white(ng-hide='_.isEmpty(profile.stats.buffs)', tooltip='Buffed', style='margin-right:5px;')
|
||||
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}}
|
||||
|
||||
Reference in New Issue
Block a user