classes: very simple "buffs applied" icon next to level, add chat message

for party / member casts (@wc8 @sabrecat)
This commit is contained in:
Tyler Renelle
2013-12-17 18:19:27 -07:00
parent 03c4a04ff5
commit d03a996946
5 changed files with 37 additions and 22 deletions

View File

@@ -58,7 +58,8 @@ habitrpg.controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http', 'Not
$scope.addLevelsAndGold = function(){ $scope.addLevelsAndGold = function(){
User.set({ User.set({
'stats.exp': User.user.stats.exp + 10000, '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
}); });
} }
}]) }])

View File

@@ -18,6 +18,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
$rootScope.User = User; $rootScope.User = User;
$rootScope.user = user; $rootScope.user = user;
$rootScope.moment = window.moment; $rootScope.moment = window.moment;
$rootScope.moment = window._;
$rootScope.settings = User.settings; $rootScope.settings = User.settings;
$rootScope.Shared = window.habitrpgShared; $rootScope.Shared = window.habitrpgShared;
$rootScope.Content = window.habitrpgShared.content; $rootScope.Content = window.habitrpgShared.content;

View File

@@ -320,16 +320,41 @@ api.cast = function(req, res) {
break; break;
case 'party': case 'party':
case 'user':
async.waterfall([ async.waterfall([
function(cb){ function(cb){
Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members').exec(cb); Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members').exec(cb);
}, },
function(group, cb) { function(group, cb) {
if (!group) group = {members:[user]}; // Solo player? let's just create a faux group for simpler code
spell.cast(user, group.members); var g = group ? group : {members:[user]};
var series = _.transform(group.members, function(m,v,k){ var series = [], found;
m[k] = function(cb2){v.save(cb2);} 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); async.series(series, cb);
}, },
function(whatever, cb){ function(whatever, cb){
@@ -337,21 +362,6 @@ api.cast = function(req, res) {
} }
], done); ], done);
break; 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;
} }
} }

View File

@@ -41,4 +41,7 @@ figure.herobox(ng-click='spell ? castEnd(profile, "user", $event) : clickMember(
// FIXME handle @minimal, this might have to be a directive // FIXME handle @minimal, this might have to be a directive
span.current-pet(class='Pet-{{profile.items.currentPet}}', ng-show='profile.items.currentPet && !minimal') span.current-pet(class='Pet-{{profile.items.currentPet}}', ng-show='profile.items.currentPet && !minimal')
.avatar-level(ng-class='userLevelStyle(profile,"label")') .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}} | Lvl {{profile.stats.lvl}}