feat(tour): add the other tour entries @lemoness

This commit is contained in:
Tyler Renelle 2015-03-19 15:03:43 -06:00
parent 5198050cd2
commit 1e8265a9f1
4 changed files with 85 additions and 12 deletions

View file

@ -45,5 +45,13 @@
"tourGP": "Buy the Training Sword with the gold you just earned!",
"tourAvatar": "Now your avatar has the Training Sword. Click on your avatar to customize it!",
"tourScrollDown": "Be sure to scroll all the way down to see all the options! Click on your avatar again to return to the tasks page.",
"tourMuchMore": "When you're done with tasks, you can form a Party with friends, chat in the shared-interest Guilds, join Challenges, and more!"
"tourMuchMore": "When you're done with tasks, you can form a Party with friends, chat in the shared-interest Guilds, join Challenges, and more!",
"tourStatsPage": "This is your Stats page! Earn achievements by completing the listed tasks.",
"tourTavernPage": "Welcome to the Tavern, an all-ages chatroom! You can freeze your account in case of illness or travel by clicking 'Rest in the Inn.' Come say hi!",
"tourPartyPage": "Your Party will help you stay accountable. Invite friends to unlock a Quest Scroll!",
"tourGuildsPage": "Guilds are social groups with common themes. Search for the subjects that interest you! We recommend the Newbies Guild.",
"tourChallengesPage": "Joining a Challenge will add tasks to your account. Compete against other users to win gem prizes!",
"tourMarketPage": "Starting at Level 4, eggs and hatching potions drop randomly when you complete tasks. They appear here - use them to hatch pets! You can also buy items from the Market."
}

View file

@ -1,3 +1,10 @@
//db.users.update({'flags.showTour':{$ne:false}},{$set:{'flags.tour.intro':0}},{multi:1})
//db.users.update({'flags.showTour':false},{$set:{'flags.tour.intro':-1}},{multi:1})
db.users.update({},{$set:{'flags.tour.intro':-1}},{multi:1})
db.users.update({},{$set:{
'flags.tour.intro':-2,
//'flags.tour.classes':-2,
'flags.tour.stats':-2,
'flags.tour.tavern':-2,
'flags.tour.party':-2,
'flags.tour.guilds':-2,
'flags.tour.challenges':-2,
'flags.tour.market':-2
}},{multi:1})

View file

@ -109,8 +109,51 @@ function($rootScope, User, $timeout, $state) {
final: true
}
]
]
],
stats: [[
{
orphan: true,
content: window.env.t('tourStatsPage'),
final: true
}
]],
tavern: [[
{
orphan: true,
content: window.env.t('tourTavernPage'),
final: true
}
]],
party: [[
{
orphan: true,
content: window.env.t('tourPartyPage'),
final: true
}
]],
guilds: [[
{
orphan: true,
content: window.env.t('tourGuildsPage'),
final: true
}
]],
challenges: [[
{
orphan: true,
content: window.env.t('tourChallengesPage'),
final: true
}
]],
market: [[
{
orphan: true,
content: window.env.t('tourMarketPage'),
final: true
}
]]
}
_.each(chapters, function(chapter, k){
_(chapter).flatten().each(function(step) {
step.content = "<div><div class='" + (env.worldDmg.guide ? "npc_justin_broken" : "npc_justin") + " float-left'></div>" + step.content + "</div>";
@ -124,8 +167,8 @@ function($rootScope, User, $timeout, $state) {
}
}
step.onHide = function(){
if (step.final) { // -1 indicates complete
var ups={};ups['flags.tour.'+k] = -1;
if (step.final) { // -2 indicates complete
var ups={};ups['flags.tour.'+k] = -2;
User.set(ups);
}
}
@ -162,7 +205,7 @@ function($rootScope, User, $timeout, $state) {
var goto = function(chapter, page, force) {
var curr = User.user.flags.tour[chapter];
if ((page != curr+1 || curr > page) && !force) return;
if (page != curr+1 && !force) return;
var updates = {};updates['flags.tour.'+chapter] = page;
User.set(updates);
var chap = tour[chapter], opts = chap._options;
@ -191,7 +234,15 @@ function($rootScope, User, $timeout, $state) {
var alreadyShown = function(before, after) { return !(!before && after === true) };
//$rootScope.$watch('user.flags.dropsEnabled', _.flow(alreadyShown, function(already) { //FIXME requires lodash@~3.2.0
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
if (toState.name == 'options.profile.avatar') goto('intro', 5);
switch (toState.name) {
case 'options.profile.avatar': return goto('intro', 5);
case 'options.profile.stats': return goto('stats', 0);
case 'options.social.tavern': return goto('tavern', 0);
case 'options.social.party': return goto('party', 0);
case 'options.social.guilds': return goto('guilds', 0);
case 'options.social.challenges':return goto('challenges', 0);
case 'options.inventory.drops': return goto('market', 0);
}
})
$rootScope.$watch('user.flags.dropsEnabled', function(after, before) {
if (alreadyShown(before,after)) return;
@ -207,7 +258,7 @@ function($rootScope, User, $timeout, $state) {
$(document).on("keyup.tour-intro", function(e) {
if (e.which == 27) {
return User.set({'flags.tour.intro':-1});
return User.set({'flags.tour.intro':-2});
}
})

View file

@ -120,8 +120,15 @@ var UserSchema = new Schema({
customizationsNotification: {type: Boolean, 'default': false},
showTour: {type: Boolean, 'default': true},
tour: {
intro: {type: Number, 'default': 0},
classes: {type: Number, 'default': 0}
// -1 indicates "uninitiated", -2 means "complete", any other number is the current tour step (0-index)
intro: {type: Number, 'default': 0},
classes: {type: Number, 'default': -1},
stats: {type: Number, 'default': -1},
tavern: {type: Number, 'default': -1},
party: {type: Number, 'default': -1},
guilds: {type: Number, 'default': -1},
challenges: {type: Number, 'default': -1},
market: {type: Number, 'default': -1}
},
dropsEnabled: {type: Boolean, 'default': false},
itemsEnabled: {type: Boolean, 'default': false},