mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
feat(tutorial): GP and EXP awards
This commit is contained in:
@@ -189,9 +189,7 @@ function($rootScope, User, $timeout, $state, Analytics) {
|
|||||||
$(step.element).popover('destroy'); // destroy existing hover popovers so we can add our own
|
$(step.element).popover('destroy'); // destroy existing hover popovers so we can add our own
|
||||||
step.onShow = function(){
|
step.onShow = function(){
|
||||||
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':false});
|
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'tutorial','eventLabel':k+'-web','eventValue':i+1,'complete':false});
|
||||||
// step.path doesn't work in Angular do to async ui-router. Our custom solution:
|
|
||||||
if (step.state && !$state.is(step.state)) {
|
if (step.state && !$state.is(step.state)) {
|
||||||
// $state.go() returns a promise, necessary for async tour steps; however, that's not working here - have to use timeout instead :/
|
|
||||||
$state.go(step.state);
|
$state.go(step.state);
|
||||||
return $timeout(function(){});
|
return $timeout(function(){});
|
||||||
}
|
}
|
||||||
@@ -228,7 +226,6 @@ function($rootScope, User, $timeout, $state, Analytics) {
|
|||||||
'<h3 class="popover-title"></h3>' +
|
'<h3 class="popover-title"></h3>' +
|
||||||
'<div class="popover-content"></div>' +
|
'<div class="popover-content"></div>' +
|
||||||
'<div class="popover-navigation"> ' +
|
'<div class="popover-navigation"> ' +
|
||||||
//'<button class="btn btn-sm btn-default" data-role="end" style="float:none;">' + (step.final ? 'Finish Tour' : 'Hide') + '</button>' +
|
|
||||||
(showCounter ? '<span style="float:right;">'+ (i+1 +' of '+ _.flatten(chapters[k]).length) +'</span>' : '')+ // counter
|
(showCounter ? '<span style="float:right;">'+ (i+1 +' of '+ _.flatten(chapters[k]).length) +'</span>' : '')+ // counter
|
||||||
'<div class="btn-group">' +
|
'<div class="btn-group">' +
|
||||||
(step.hideNavigation ? '' : '<button class="btn btn-sm btn-default" data-role="prev">« Previous</button>') +
|
(step.hideNavigation ? '' : '<button class="btn btn-sm btn-default" data-role="prev">« Previous</button>') +
|
||||||
@@ -240,14 +237,10 @@ function($rootScope, User, $timeout, $state, Analytics) {
|
|||||||
'</div>';
|
'</div>';
|
||||||
},
|
},
|
||||||
storage: false
|
storage: false
|
||||||
//onEnd: function(){
|
|
||||||
// User.set({'flags.showTour': false});
|
|
||||||
//}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var goto = function(chapter, page, force) {
|
var goto = function(chapter, page, force) {
|
||||||
//return; // TODO temporarily remove old tutorial system while experimenting with leslie's new gettup
|
|
||||||
if (chapter == 'intro') User.set({'flags.welcomed': true});
|
if (chapter == 'intro') User.set({'flags.welcomed': true});
|
||||||
var curr = User.user.flags.tour[chapter];
|
var curr = User.user.flags.tour[chapter];
|
||||||
if (page != curr+1 && !force) return;
|
if (page != curr+1 && !force) return;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ angular.module("habitrpg").factory("Notification",
|
|||||||
|
|
||||||
function exp(val) {
|
function exp(val) {
|
||||||
if (val < -50) return; // don't show when they level up (resetting their exp)
|
if (val < -50) return; // don't show when they level up (resetting their exp)
|
||||||
_notify(_sign(val) + " " + _round(val) + " " + window.env.t('xp'), 'xp', 'glyphicon glyphicon-star');
|
_notify(_sign(val) + " " + _round(val) + " " + window.env.t('experience'), 'xp', 'glyphicon glyphicon-star');
|
||||||
}
|
}
|
||||||
|
|
||||||
function error(error){
|
function error(error){
|
||||||
@@ -64,7 +64,7 @@ angular.module("habitrpg").factory("Notification",
|
|||||||
|
|
||||||
function hp(val) {
|
function hp(val) {
|
||||||
// don't show notifications if user dead
|
// don't show notifications if user dead
|
||||||
_notify(_sign(val) + " " + _round(val) + " " + window.env.t('hp'), 'hp', 'glyphicon glyphicon-heart');
|
_notify(_sign(val) + " " + _round(val) + " " + window.env.t('health'), 'hp', 'glyphicon glyphicon-heart');
|
||||||
}
|
}
|
||||||
|
|
||||||
function lvl(){
|
function lvl(){
|
||||||
@@ -79,7 +79,7 @@ angular.module("habitrpg").factory("Notification",
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mp(val) {
|
function mp(val) {
|
||||||
_notify(_sign(val) + " " + _round(val) + " " + window.env.t('mp'), 'mp', 'glyphicon glyphicon-fire');
|
_notify(_sign(val) + " " + _round(val) + " " + window.env.t('mana'), 'mp', 'glyphicon glyphicon-fire');
|
||||||
}
|
}
|
||||||
|
|
||||||
function streak(val) {
|
function streak(val) {
|
||||||
|
|||||||
Reference in New Issue
Block a user