rewrite2: avatar working. need to revisit avatar:avater, make sure I got everything

This commit is contained in:
Tyler Renelle
2013-08-25 00:44:05 -04:00
parent 3c45220e1f
commit 176a5a3583
41 changed files with 143 additions and 2285 deletions
+3 -3
View File
@@ -58,21 +58,21 @@ borderDarken = 20%
// alert icons
.icon-gold
background: url("img/coin_single_gold.png") no-repeat
background: url("/img/coin_single_gold.png") no-repeat
background-position: center center
background-size: 18px
width: 14px
height: 14px
.icon-silver
background: url("img/coin_single_silver.png") no-repeat
background: url("/img/coin_single_silver.png") no-repeat
background-position: center center
background-size: 18px
width: 14px
height: 14px
.icon-death
background: url("img/sprites/dead.png") no-repeat
background: url("/img/sprites/dead.png") no-repeat
background-position: center center
background-size: 14px
width: 14px
+1 -1
View File
@@ -36,7 +36,7 @@
.f_skin_asian,
.f_skin_black,
.f_skin_white
background: url("img/sprites/female_sprites.png") no-repeat
background: url("/img/sprites/female_sprites.png") no-repeat
.f_weapon_6 {background-position: 0 0; width: 90px; height: 90px}
.f_weapon_5 {background-position: -90px 0; width: 90px; height: 90px}
+1 -1
View File
@@ -31,7 +31,7 @@
.m_skin_asian,
.m_skin_black,
.m_skin_white
background: url("img/sprites/male_sprites.png") no-repeat
background: url("/img/sprites/male_sprites.png") no-repeat
.m_weapon_6 {background-position: 0 0; width: 90px; height: 90px}
.m_weapon_5 {background-position: -90px 0; width: 90px; height: 90px}
-304
View File
@@ -1,304 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var amazonAffiliate, googleAnalytics, googleCharts, growlNotification, initStickyHeader, loadJavaScripts, moment, setupGrowlNotifications, setupSortable, setupTooltips, setupTour, _;
_ = require('lodash');
moment = require('moment');
/*
Loads JavaScript files from public/vendor/*
Use require() to min / concatinate for faster page load
*/
loadJavaScripts = function(model) {
/*
Internal Scripts
*/
require("../vendor/jquery-ui-1.10.2/jquery-1.9.1.js");
require("../vendor/jquery.cookie.min.js");
require("../vendor/bootstrap/js/bootstrap.min.js");
require("../vendor/jquery.bootstrap-growl.min.js");
require("../vendor/datepicker/js/bootstrap-datepicker");
require("../vendor/bootstrap-tour/bootstrap-tour");
if (!(model.get('_mobileDevice') === true)) {
require("../vendor/jquery-ui-1.10.2/ui/jquery.ui.core.js");
require("../vendor/jquery-ui-1.10.2/ui/jquery.ui.widget.js");
require("../vendor/jquery-ui-1.10.2/ui/jquery.ui.mouse.js");
require("../vendor/jquery-ui-1.10.2/ui/jquery.ui.sortable.js");
return require("../vendor/sticky");
}
};
/*
Setup jQuery UI Sortable
*/
setupSortable = function(model) {
if (!(model.get('_mobileDevice') === true)) {
return ['habit', 'daily', 'todo', 'reward'].forEach(function(type) {
return $("ul." + type + "s").sortable({
dropOnEmpty: false,
cursor: "move",
items: "li",
scroll: true,
axis: 'y',
update: function(e, ui) {
var domId, id, item, to;
item = ui.item[0];
domId = item.id;
id = item.getAttribute('data-id');
to = $("ul." + type + "s").children().index(item);
return model.at("_" + type + "List").pass({
ignore: domId
}).move({
id: id
}, to);
}
});
});
}
};
setupTooltips = module.exports.setupTooltips = function() {
$('[rel=tooltip]').tooltip();
$('[rel=popover]').popover();
$('.popover-auto-show').popover('show');
return $('.priority-multiplier-help').popover({
title: "How difficult is this task?",
trigger: "hover",
content: "This multiplies its point value. Use sparingly, rely instead on our organic value-adjustment algorithms. But some tasks are grossly more valuable (Write Thesis vs Floss Teeth). Click for more info."
});
};
setupTour = function(model) {
var tour, tourSteps;
tourSteps = [
{
element: ".main-herobox",
title: "Welcome to HabitRPG",
content: "Welcome to HabitRPG, a habit-tracker which treats your goals like a Role Playing Game."
}, {
element: "#bars",
title: "Achieve goals and level up",
content: "As you accomplish goals, you level up. If you fail your goals, you lose hit points. Lose all your HP and you die."
}, {
element: "ul.habits",
title: "Habits",
content: "Habits are goals that you constantly track.",
placement: "bottom"
}, {
element: "ul.dailys",
title: "Dailies",
content: "Dailies are goals that you want to complete once a day.",
placement: "bottom"
}, {
element: "ul.todos",
title: "Todos",
content: "Todos are one-off goals which need to be completed eventually.",
placement: "bottom"
}, {
element: "ul.rewards",
title: "Rewards",
content: "As you complete goals, you earn gold to buy rewards. Buy them liberally - rewards are integral in forming good habits.",
placement: "bottom"
}, {
element: "ul.habits li:first-child",
title: "Hover over comments",
content: "Different task-types have special properties. Hover over each task's comment for more information. When you're ready to get started, delete the existing tasks and add your own.",
placement: "right"
}
];
$('.main-herobox').popover('destroy');
tour = new Tour();
tourSteps.forEach(function(step) {
return tour.addStep(_.defaults(step, {
html: true
}));
});
if (isNaN(tour._current)) {
tour._current = 0;
}
return tour.start();
};
initStickyHeader = function(model) {
return $('.header-wrap').sticky({
topSpacing: 0
});
};
growlNotification = module.exports.growlNotification = function(html, type) {
return $.bootstrapGrowl(html, {
ele: '#notification-area',
type: type,
top_offset: 20,
align: 'right',
width: 250,
delay: 3000,
allow_dismiss: true,
stackup_spacing: 10
});
};
/*
Sets up "+1 Exp", "Level Up", etc notifications
*/
setupGrowlNotifications = function(model) {
var showCoins, statsNotification, user;
if (typeof jQuery === "undefined" || jQuery === null) {
return;
}
user = model.at('_user');
statsNotification = function(html, type) {
if (user.get('stats.lvl') === 0) {
return;
}
return growlNotification(html, type);
};
user.on('set', 'stats.hp', function(captures, args) {
var num, rounded;
num = captures - args;
rounded = Math.abs(num.toFixed(1));
if (num < 0) {
return statsNotification("<i class='icon-heart'></i> - " + rounded + " HP", 'hp');
} else if (num > 0) {
return statsNotification("<i class='icon-heart'></i> + " + rounded + " HP", 'hp');
}
});
user.on('set', 'stats.exp', function(captures, args, isLocal, silent) {
var num, rounded;
if (silent == null) {
silent = false;
}
num = captures - args;
rounded = Math.abs(num.toFixed(1));
if (num < 0 && num > -50) {
return statsNotification("<i class='icon-star'></i> - " + rounded + " XP", 'xp');
} else if (num > 0) {
return statsNotification("<i class='icon-star'></i> + " + rounded + " XP", 'xp');
}
});
/*
Show "+ 5 {gold_coin} 3 {silver_coin}"
*/
showCoins = function(money) {
var absolute, gold, silver;
absolute = Math.abs(money);
gold = Math.floor(absolute);
silver = Math.floor((absolute - gold) * 100);
if (gold && silver > 0) {
return "" + gold + " <i class='icon-gold'></i> " + silver + " <i class='icon-silver'></i>";
} else if (gold > 0) {
return "" + gold + " <i class='icon-gold'></i>";
} else if (silver > 0) {
return "" + silver + " <i class='icon-silver'></i>";
}
};
user.on('set', 'stats.gp', function(captures, args) {
var bonus, money, sign;
money = captures - args;
if (!money) {
return;
}
sign = money < 0 ? '-' : '+';
statsNotification("" + sign + " " + (showCoins(money)), 'gp');
bonus = model.get('_streakBonus');
if ((money > 0) && !!bonus) {
if (bonus < 0.01) {
bonus = 0.01;
}
statsNotification("+ " + (showCoins(bonus)) + " Streak Bonus!");
return model.del('_streakBonus');
}
});
user.on('set', 'items.*', function(item, after, before) {
if ((item === 'armor' || item === 'weapon' || item === 'shield' || item === 'head') && parseInt(after) < parseInt(before)) {
if (item === 'head') {
item = 'helm';
}
return statsNotification("<i class='icon-death'></i> Respawn!", "death");
}
});
return user.on('set', 'stats.lvl', function(captures, args) {
if (captures > args) {
return statsNotification('<i class="icon-chevron-up"></i> Level Up!', 'lvl');
}
});
};
module.exports.resetDom = function(model) {
window.DERBY.app.dom.clear();
return window.DERBY.app.view.render(model, window.DERBY.app.view._lastRender.ns, window.DERBY.app.view._lastRender.context);
};
googleAnalytics = function(model) {
if (model.flags.nodeEnv === 'production') {
window._gaq = [["_setAccount", "UA-33510635-1"], ["_setDomainName", "habitrpg.com"], ["_trackPageview"]];
return $.getScript(("https:" === document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js");
}
};
amazonAffiliate = function(model) {
if (model.get('_loggedIn') && (model.get('_user.flags.ads') !== 'hide')) {
return $.getScript('//wms.assoc-amazon.com/20070822/US/js/link-enhancer-common.js?tag=ha0d2-20').fail(function() {
return $('body').append('<img src="//wms.assoc-amazon.com/20070822/US/img/noscript.gif?tag=ha0d2-20" alt="" />');
});
}
};
googleCharts = function() {
return $.getScript("//www.google.com/jsapi", function() {
return google.load("visualization", "1", {
packages: ["corechart"],
callback: function() {}
});
});
};
module.exports.app = function(appExports, model, app) {
loadJavaScripts(model);
if (!model.get('_mobileDevice')) {
setupGrowlNotifications(model);
}
return app.on('render', function(ctx) {
if (!model.get('_mobileDevice')) {
setupTooltips(model);
initStickyHeader(model);
setupSortable(model);
setupTour(model);
}
$('.datepicker').datepicker({
autoclose: true,
todayBtn: true
}).on('changeDate', function(ev) {
return model.at(ev.target).set('date', moment(ev.date).format('MM/DD/YYYY'));
});
/*
External Scripts
JS files not needed right away (google charts) or entirely optional (analytics)
Each file getsload asyncronously via $.getScript, so it doesn't bog page-load
These need to be handled in app.on('render'), see https://groups.google.com/forum/?fromgroups=#!topic/derbyjs/x8FwdTLEuXo
*/
$.getScript('//checkout.stripe.com/v2/checkout.js');
if (!(model.get('_mobileDevice') === true)) {
$.getScript("//s7.addthis.com/js/250/addthis_widget.js#pubid=lefnire");
googleCharts();
}
googleAnalytics(model);
return amazonAffiliate(model);
});
};
}).call(this);
/*
//@ sourceMappingURL=browser.map
*/
File diff suppressed because one or more lines are too long
-148
View File
@@ -1,148 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var helpers, _;
_ = require('lodash');
helpers = require('habitrpg-shared/script/helpers');
module.exports.app = function(appExports, model) {
var browser, challengeDiscard, user;
browser = require('./browser');
user = model.at('_user');
$('#profile-challenges-tab-link').on('show', function(e) {
return _.each(model.get('groups'), function(g) {
return _.each(g.challenges, function(chal) {
return _.each(['habit', 'daily', 'todo'], function(type) {
return _.each(chal["" + type + "s"], function(task) {
return _.each(chal.users, function(member) {
var chart, data, history, options, _ref, _ref1;
if ((history = member != null ? (_ref = member["" + type + "s"]) != null ? (_ref1 = _ref[task.id]) != null ? _ref1.history : void 0 : void 0 : void 0) && !!history) {
data = google.visualization.arrayToDataTable(_.map(history, function(h) {
return [h.date, h.value];
}));
options = {
backgroundColor: {
fill: 'transparent'
},
width: 150,
height: 50,
chartArea: {
width: '80%',
height: '80%'
},
axisTitlePosition: 'none',
legend: {
position: 'bottom'
},
hAxis: {
gridlines: {
color: 'transparent'
}
},
vAxis: {
gridlines: {
color: 'transparent'
}
}
};
chart = new google.visualization.LineChart($(".challenge-" + chal.id + "-member-" + member.id + "-history-" + task.id)[0]);
return chart.draw(data, options);
}
});
});
});
});
});
});
appExports.challengeCreate = function(e, el) {
var gid, type, _ref;
_ref = [$(el).attr('data-type'), $(el).attr('data-gid')], type = _ref[0], gid = _ref[1];
return model.set('_challenge.new', {
name: '',
habits: [],
dailys: [],
todos: [],
rewards: [],
id: model.id(),
uid: user.get('id'),
user: helpers.username(model.get('_user.auth'), model.get('_user.profile.name')),
group: {
type: type,
id: gid
},
timestamp: +(new Date)
});
};
appExports.challengeSave = function() {
var gid;
gid = model.get('_challenge.new.group.id');
return model.unshift("groups." + gid + ".challenges", model.get('_challenge.new'), function() {
browser.growlNotification('Challenge Created', 'success');
return challengeDiscard();
});
};
appExports.toggleChallengeEdit = function(e, el) {
var path;
path = "_editing.challenges." + ($(el).attr('data-id'));
return model.set(path, !model.get(path));
};
appExports.challengeDiscard = challengeDiscard = function() {
return model.del('_challenge.new');
};
appExports.challengeSubscribe = function(e) {
var chal, tags, userChallenges;
chal = e.get();
tags = user.get('tags');
if (!(tags && _.find(tags, {
id: chal.id
}))) {
model.push('_user.tags', {
id: chal.id,
name: chal.name,
challenge: true
});
}
tags = {};
tags[chal.id] = true;
userChallenges = user.get('challenges');
if (!(userChallenges && (userChallenges.indexOf(chal.id) !== -1))) {
user.unshift('challenges', chal.id);
}
return _.each(['habit', 'daily', 'todo', 'reward'], function(type) {
return _.each(chal["" + type + "s"], function(task) {
task.tags = tags;
task.challenge = chal.id;
task.group = {
id: chal.group.id,
type: chal.group.type
};
model.push("_" + type + "List", task);
return true;
});
});
};
return appExports.challengeUnsubscribe = function(e) {
var chal, i, _ref;
chal = e.get();
i = (_ref = user.get('challenges')) != null ? _ref.indexOf(chal.id) : void 0;
if ((i != null) && i !== -1) {
user.remove("challenges." + i);
}
return _.each(['habit', 'daily', 'todo', 'reward'], function(type) {
return _.each(chal["" + type + "s"], function(task) {
model.remove("_" + type + "List", _.findIndex(model.get("_" + type + "List", {
id: task.id
})));
model.del("_user.tasks." + task.id);
return true;
});
});
};
};
}).call(this);
/*
//@ sourceMappingURL=challenges.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "challenges.js",
"sourceRoot": "",
"sources": [
"challenges.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA,IAAA;;CAAA,CAAA,CAAI,IAAA,CAAA;;CAAJ,CACA,CAAU,IAAV,yBAAU;;CADV,CAGA,CAAA,EAAqB,CAAf,CAAQ,EAAQ,CAAD;CACnB,OAAA,uBAAA;CAAA,EAAU,CAAV,GAAA,IAAU;CAAV,CACO,CAAA,CAAP,CAAY,EAAL;CADP,CAGA,CAA6C,CAA7C,EAAA,GAA8C,qBAA9C;CACG,CAA2B,CAArB,CAAP,CAAY,GAAL,CAAsB,IAA7B;CACG,CAAoB,CAAA,CAArB,KAAsB,CAAtB,KAAA;CACG,CAAe,CAAiB,CAAjC,EAAO,CAAA,EAA2B,QAAlC;CACG,CAAW,CAAE,CAAd,KAA0B,UAA1B;CACG,CAAkB,CAAA,CAAnB,CAAA,CAAmB,GAAC,YAApB;CACE,mBAAA,sBAAA;AAA2D,CAA3D,GAAG,CAAwC,CAAxC,CAAC,SAAJ;CACE,CAA4D,CAArD,CAAP,EAAa,CAAgC,EAAgB,IAAlC,GAApB,EAAP;CAAmE,CAAO,EAAR,CAAA,sBAAA;CAArB,kBAAe;CAA5D,EAEE,IADF,WAAA;CACE,CAAiB,aAAjB,KAAA;CAAiB,CAAO,EAAL,SAAF,SAAE;sBAAnB;CAAA,CACO,CADP,EACA,eAAA;CADA,CAEQ,IAAR,cAAA;CAFA,CAGW,OAAX,WAAA;CAAW,CAAO,GAAP,iBAAA;CAAA,CAAsB,GAAtB,CAAc,gBAAA;sBAHzB;CAAA,CAImB,IAJnB,WAIA,GAAA;CAJA,CAKQ,IAAR,cAAA;CAAQ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AAkC,CAAY,CAA9C,KAAkC;CAAlC,EAAyB,CAArB,EAAJ,EAAA,KAAa;QAFb;CAGC,CAAgB,CAA4B,CAA7C,EAAO,CAAA,CAAA,CAAuC,IAA9C;CACG,CAAW,CAAE,CAAd,KAA0B,MAA1B;CACE,CAA6B,CAAf,CAAA,CAAT,CAAL,GAA6B,CAA7B;CAAkE,CAAC,EAAO,QAAP;CAAtC,WAAY;CAAzC,CACA,CAAA,CAA4B,CAAvB,KAAL,IAAW;CAFY,gBAGvB;CAHF,QAAyB;CAD3B,MAA6C;CA3E5B,IAuEe;CA1EpC,EAGqB;CAHrB"
}
+2
View File
@@ -2,12 +2,14 @@
# Make user and settings available for everyone through root scope.
habitrpg.controller "RootCtrl", ($scope, $rootScope, $location, User) ->
$rootScope.modals = {}
$rootScope.User = User
$rootScope.user = User.user
$rootScope.settings = User.settings
# FIXME this is dangerous, organize helpers.coffee better, so we can group them by which controller needs them,
# and then simply _.defaults($scope, Helpers.user) kinda thing
_.defaults $rootScope, window.habitrpgShared.algos
_.defaults $rootScope, window.habitrpgShared.helpers
$rootScope.authenticated = ->
User.settings.auth.apiId isnt ""
+1 -2
View File
@@ -5,7 +5,6 @@ The authentication controller (login & facebook)
###
habitrpg.controller "AuthCtrl", ($scope, $rootScope, Facebook, LocalAuth, User, $http, $location, API_URL) ->
$scope.useUUID = false
debugger
$scope.toggleUUID = ->
if showedFacebookMessage is false
alert "Until we add Facebook, use your UUID and API Token to log in (found at https://habitrpg.com > Options > Settings)."
@@ -45,7 +44,7 @@ habitrpg.controller "AuthCtrl", ($scope, $rootScope, Facebook, LocalAuth, User,
$http.post(API_URL + "/api/v1/user/auth/local", data)
.success((data, status, headers, config) ->
runAuth data.id, data.token
$scope.showing = false
$rootScope.modals.login = false
).error (data, status, headers, config) ->
if status is 0
alert "Server not currently reachable, try again later"
@@ -0,0 +1,37 @@
"use strict"
habitrpg.controller "UserAvatarCtrl", ($scope, $location, filterFilter, User) ->
$scope.profile = User.user
$scope.changeHair = (color) ->
User.user.preferences.hair = color
User.log
op: "set"
data:
"preferences.hair": color
$scope.changeSkin = (color) ->
User.user.preferences.skin = color
User.log
op: "set"
data:
"preferences.skin": color
$scope.changeSex = (gender) ->
User.user.preferences.gender = gender
User.log
op: "set"
data:
"preferences.gender": gender
$scope.changeArmor = (armor) ->
User.user.preferences.armorSet = armor
User.log
op: "set"
data:
"preferences.armorSet": armor
$scope.hideUserAvatar = ->
$(".userAvatar").hide()
-33
View File
@@ -1,33 +0,0 @@
'use strict';
habitrpg.controller('userAvatarCtrl',
['$scope', '$location', 'filterFilter', 'User',
function($scope, $location, filterFilter, User) {
$scope.user = User.user;
$scope.changeHair = function(color) {
User.user.preferences.hair = color;
User.log({op:"set",data:{"preferences.hair":color}})
}
$scope.changeSkin = function(color) {
User.user.preferences.skin = color
User.log({op:"set",data:{"preferences.skin":color}})
}
$scope.changeSex = function(gender) {
User.user.preferences.gender = gender
User.log({op:"set",data:{"preferences.gender":gender}})
}
$scope.changeArmor = function(armor) {
User.user.preferences.armorSet = armor
User.log({op:"set",data:{"preferences.armorSet":armor}})
}
$scope.hideUserAvatar = function() {
$('.userAvatar').hide()
}
}
]);
-34
View File
@@ -1,34 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var algos, moment;
moment = require('moment');
algos = require('habitrpg-shared/script/algos');
module.exports.app = function(appExports, model) {
var user;
user = model.at('_user');
appExports.emulateNextDay = function() {
var yesterday;
yesterday = +moment().subtract('days', 1).toDate();
user.set('lastCron', yesterday);
return window.location.reload();
};
appExports.emulateTenDays = function() {
var yesterday;
yesterday = +moment().subtract('days', 10).toDate();
user.set('lastCron', yesterday);
return window.location.reload();
};
return appExports.cheat = function() {
user.incr('stats.exp', algos.tnl(user.get('stats.lvl')));
return user.incr('stats.gp', 1000);
};
};
}).call(this);
/*
//@ sourceMappingURL=debug.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "debug.js",
"sourceRoot": "",
"sources": [
"debug.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA,OAAA;;CAAA,CAAA,CAAS,GAAT,CAAS,CAAA;;CAAT,CACA,CAAQ,EAAR,EAAQ,uBAAA;;CADR,CAGA,CAAA,EAAqB,CAAf,CAAQ,EAAQ,CAAD;CACnB,GAAA,IAAA;CAAA,CAAO,CAAA,CAAP,CAAY,EAAL;CAAP,EAE4B,CAA5B,KAA4B,CAAlB,IAAV;CACE,QAAA,CAAA;AAAa,CAAb,CAAuC,CAA3B,GAAZ,EAAa,CAAb;CAAA,CACqB,CAArB,CAAI,EAAJ,GAAA,CAAA;CACO,KAAD,EAAS,KAAf;CALF,IAE4B;CAF5B,EAO4B,CAA5B,KAA4B,CAAlB,IAAV;CACE,QAAA,CAAA;AAAa,CAAb,CAAuC,CAA3B,GAAZ,EAAa,CAAb;CAAA,CACqB,CAArB,CAAI,EAAJ,GAAA,CAAA;CACO,KAAD,EAAS,KAAf;CAVF,IAO4B;CAKjB,EAAQ,EAAnB,IAAmB,CAAT,CAAV;CACE,CAAuB,CAAA,CAAnB,CAAwB,CAA5B,KAAA;CACK,CAAiB,EAAlB,MAAJ,GAAA;CAfiB,IAaA;CAhBrB,EAGqB;CAHrB"
}
-55
View File
@@ -1,55 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var _;
_ = require('lodash');
module.exports.app = function(appExports, model) {
var user;
user = model.at('_user');
appExports.toggleFilterByTag = function(e, el) {
var path, tagId;
tagId = $(el).attr('data-tag-id');
path = 'filters.' + tagId;
return user.set(path, !(user.get(path)));
};
appExports.filtersNewTag = function() {
user.setNull('tags', []);
user.push('tags', {
id: model.id(),
name: model.get("_newTag")
});
return model.set('_newTag', '');
};
appExports.toggleEditingTags = function() {
return model.set('_editingTags', !model.get('_editingTags'));
};
appExports.clearFilters = function() {
return user.set('filters', {});
};
return appExports.filtersDeleteTag = function(e, el) {
var tag, tagId, tags;
tags = user.get('tags');
tag = e.at("_user.tags." + $(el).attr('data-index'));
tagId = tag.get('id');
if (!tagId) {
user.set('tags', _.filter(tags, (function(t) {
return t != null ? t.id : void 0;
})));
user.set('filters', {});
return;
}
model.del("_user.filters." + tagId);
tag.remove();
return _.each(user.get("tasks"), function(task) {
user.del("tasks." + task.id + ".tags." + tagId);
return true;
});
};
};
}).call(this);
/*
//@ sourceMappingURL=filters.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "filters.js",
"sourceRoot": "",
"sources": [
"filters.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA;;CAAA,CAAA,CAAI,IAAA,CAAA;;CAAJ,CAEA,CAAA,EAAqB,CAAf,CAAQ,EAAQ,CAAD;CACnB,GAAA,IAAA;CAAA,CAAO,CAAA,CAAP,CAAY,EAAL;CAAP,CAEmC,CAAJ,CAA/B,KAAgC,CAAtB,OAAV;CACE,SAAA,CAAA;CAAA,CAAQ,CAAA,CAAA,CAAR,CAAA,OAAQ;CAAR,EACO,CAAP,CADA,CACA,IAAO;AACS,CAAX,CAAU,CAAf,CAAI,SAAJ;CALF,IAE+B;CAF/B,EAO2B,CAA3B,KAA2B,CAAjB,GAAV;CACE,CAAqB,EAAjB,EAAJ,CAAA;CAAA,CACkB,EAAd,EAAJ;CAAkB,CAAC,GAAS,GAAT;CAAD,CAAuB,CAAA,CAAN,CAAW,GAAX,CAAM;CADzC,OACA;CACM,CAAe,CAArB,EAAK,IAAL,IAAA;CAVF,IAO2B;CAP3B,EAY+B,CAA/B,KAA+B,CAArB,OAAV;AAC6B,CAArB,CAAoB,CAA1B,EAAK,QAAL,CAAA;CAbF,IAY+B;CAZ/B,EAe0B,CAA1B,KAA0B,CAAhB,EAAV;CACO,CAAe,CAApB,CAAI,KAAJ,IAAA;CAhBF,IAe0B;CAGf,CAAuB,CAAJ,MAAC,CAArB,CAAV,KAAA;CACE,SAAA,MAAA;CAAA,EAAO,CAAP,EAAA;CAAA,CACM,CAAN,CAA2B,EAA3B,MAA2B,CAAhB;CADX,EAEQ,CAAA,CAAR,CAAA;AAGO,CAAP,GAAA,CAAA,CAAA;CACE,CAAiB,CAAjB,CAAI,EAAJ,EAAA,CAAmC;CAAM,EAAD;CAAP,QAAC;CAAlC,CACoB,CAApB,CAAI,IAAJ,CAAA;CACA,aAAA;QARF;CAAA,EAUA,EAAK,CAAL,UAAW;CAVX,EAWG,GAAH;CAGC,CAAyB,CAAnB,CAAP,GAAO,EAAoB,IAA3B;CAAoC,CAAU,CAAV,CAAI,CAAJ,GAAA;CAAV,cAAqD;CAA/E,MAA0B;CAlCT,IAmBW;CArBhC,EAEqB;CAFrB"
}
-280
View File
@@ -1,280 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var helpers, _,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
_ = require('lodash');
helpers = require('habitrpg-shared/script/helpers');
module.exports.app = function(appExports, model, app) {
var browser, joinGroup, user, _currentTime;
browser = require('./browser');
_currentTime = model.at('_currentTime');
_currentTime.setNull(+(new Date));
setInterval((function() {
return _currentTime.set(+(new Date));
}), 60000);
user = model.at('_user');
appExports.groupCreate = function(e, el) {
var newGroup, type;
type = $(el).attr('data-type');
newGroup = {
name: model.get("_new.group.name"),
description: model.get("_new.group.description"),
leader: user.get('id'),
members: [user.get('id')],
type: type
};
if (type === 'party') {
return model.add('groups', newGroup, function() {
return location.reload();
});
}
if (!(user.get('balance') >= 1)) {
return $('#more-gems-modal').modal('show');
}
if (confirm("Create Guild for 4 Gems?")) {
if (type === 'guild') {
newGroup.privacy = model.get("_new.group.privacy") || 'public';
}
newGroup.balance = 1;
return model.add('groups', newGroup, function() {
return user.incr('balance', -1, function() {
return location.reload();
});
});
}
};
appExports.toggleGroupEdit = function(e, el) {
var path;
path = "_editing.groups." + ($(el).attr('data-gid'));
return model.set(path, !model.get(path));
};
appExports.toggleLeaderMessageEdit = function(e, el) {
var path;
path = "_editing.leaderMessage." + ($(el).attr('data-gid'));
return model.set(path, !model.get(path));
};
appExports.groupAddWebsite = function(e, el) {
var test;
test = e.get();
e.at().unshift('websites', model.get('_newGroupWebsite'));
return model.del('_newGroupWebsite');
};
appExports.groupInvite = function(e, el) {
var uid;
uid = model.get('_groupInvitee').replace(/[\s"]/g, '');
model.set('_groupInvitee', '');
if (_.isEmpty(uid)) {
return;
}
return model.query('users').publicInfo([uid]).fetch(function(err, profiles) {
var profile;
if (err) {
throw err;
}
profile = profiles.at(0).get();
if (!profile) {
return model.set("_groupError", "User with id " + uid + " not found.");
}
return model.query('groups').withMember(uid).fetch(function(err, g) {
var gid, group, groupError, groups, invite, name, type, _ref, _ref1;
if (err) {
throw err;
}
group = e.get();
groups = g.get();
type = group.type, name = group.name;
gid = group.id;
groupError = function(msg) {
return model.set("_groupError", msg);
};
invite = function() {
$.bootstrapGrowl("Invitation Sent.");
switch (type) {
case 'guild':
return model.push("users." + uid + ".invitations.guilds", {
id: gid,
name: name
}, function() {
return location.reload();
});
case 'party':
return model.set("users." + uid + ".invitations.party", {
id: gid,
name: name
}, function() {
return location.reload();
});
}
};
switch (type) {
case 'guild':
if (((_ref = profile.invitations) != null ? _ref.guilds : void 0) && _.find(profile.invitations.guilds, {
id: gid
})) {
return groupError("User already invited to that group");
} else if (__indexOf.call(group.members, uid) >= 0) {
return groupError("User already in that group");
} else {
return invite();
}
break;
case 'party':
if ((_ref1 = profile.invitations) != null ? _ref1.party : void 0) {
return groupError("User already pending invitation.");
} else if (_.find(groups, {
type: 'party'
})) {
return groupError("User already in a party.");
} else {
return invite();
}
}
});
});
};
joinGroup = function(gid) {
return model.push("groups." + gid + ".members", user.get('id'), function() {
return location.reload();
});
};
appExports.joinGroup = function(e, el) {
return joinGroup(e.get('id'));
};
appExports.acceptInvitation = function(e, el) {
var gid;
gid = e.get('id');
if ($(el).attr('data-type') === 'party') {
return user.set('invitations.party', null, function() {
return joinGroup(gid);
});
} else {
return e.at().remove(function() {
return joinGroup(gid);
});
}
};
appExports.rejectInvitation = function(e, el) {
var clear;
clear = function() {
return browser.resetDom(model);
};
if (e.at().path().indexOf('party') !== -1) {
return model.del(e.at().path(), clear);
} else {
return e.at().remove(clear);
}
};
appExports.groupLeave = function(e, el) {
var group, index, uid;
if (confirm("Leave this group, are you sure?") === true) {
uid = user.get('id');
group = model.at("groups." + ($(el).attr('data-id')));
index = group.get('members').indexOf(uid);
if (index !== -1) {
return group.remove('members', index, 1, function() {
var updated;
updated = group.get();
if (_.isEmpty(updated.members) && (updated.type === 'party')) {
return group.del(function() {
return location.reload();
});
} else if (updated.leader === uid) {
return group.set("leader", updated.members[0], function() {
return location.reload();
});
} else {
return location.reload();
}
});
}
}
};
/*
Chat Functionality
*/
model.on('unshift', '_party.chat', function() {
return $('.chat-message').tooltip();
});
model.on('unshift', '_habitrpg.chat', function() {
return $('.chat-message').tooltip();
});
appExports.sendChat = function(e, el) {
var chat, group, members, message, messages, text, type, uniqMembers;
text = model.get('_chatMessage');
if (!/\S/.test(text)) {
return;
}
group = e.at();
members = group.get('members');
uniqMembers = _.uniq(members);
if (!_.isEqual(uniqMembers, members)) {
group.set('members', uniqMembers);
}
chat = group.at('chat');
model.set('_chatMessage', '');
message = {
id: model.id(),
uuid: user.get('id'),
contributor: user.get('backer.contributor'),
npc: user.get('backer.npc'),
text: text,
user: helpers.username(model.get('_user.auth'), model.get('_user.profile.name')),
timestamp: +(new Date)
};
messages = chat.get() || [];
messages.unshift(message);
messages.splice(200);
chat.set(messages);
type = $(el).attr('data-type');
if (group.get('type') === 'party') {
return model.set('_user.party.lastMessageSeen', chat.get()[0].id);
}
};
appExports.chatKeyup = function(e, el, next) {
if (e.keyCode !== 13) {
return next();
}
return appExports.sendChat(e, el);
};
appExports.deleteChatMessage = function(e) {
if (confirm("Delete chat message?") === true) {
return e.at().remove();
}
};
app.on('render', function(ctx) {
return $('#party-tab-link').on('shown', function(e) {
var messages;
messages = model.get('_party.chat');
if (!((messages != null ? messages.length : void 0) > 0)) {
return false;
}
return model.set('_user.party.lastMessageSeen', messages[0].id);
});
});
appExports.gotoPartyChat = function() {
return model.set('_gamePane', true, function() {
return $('#party-tab-link').tab('show');
});
};
return appExports.assignGroupLeader = function(e, el) {
var newLeader;
newLeader = model.get('_new.groupLeader');
if (newLeader && (confirm("Assign new leader, you sure?") === true)) {
if (newLeader) {
return e.at().set('leader', newLeader, function() {
return browser.resetDom(model);
});
}
}
};
};
}).call(this);
/*
//@ sourceMappingURL=groups.map
*/
File diff suppressed because one or more lines are too long
-25
View File
@@ -1,25 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var i18n;
i18n = require('derby-i18n');
i18n.plurals.add('he', function(n) {
return n;
});
i18n.plurals.add('bg', function(n) {
return n;
});
i18n.plurals.add('nl', function(n) {
return n;
});
module.exports = i18n;
}).call(this);
/*
//@ sourceMappingURL=i18n.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "i18n.js",
"sourceRoot": "",
"sources": [
"i18n.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,GAAA,EAAA;;CAAA,CAAA,CAAO,CAAP,GAAO,KAAA;;CAAP,CAEA,CAAA,CAAI,GAAQ,EAAY;CAAD,UAAO;CAA9B,EAAuB;;CAFvB,CAGA,CAAA,CAAI,GAAQ,EAAY;CAAD,UAAO;CAA9B,EAAuB;;CAHvB,CAIA,CAAA,CAAI,GAAQ,EAAY;CAAD,UAAO;CAA9B,EAAuB;;CAJvB,CAMA,CAAiB,CANjB,EAMM,CAAN;CANA"
}
-184
View File
@@ -1,184 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var algos, app, async, derby, get, i18n, misc, ready, view, _;
derby = require('derby');
derby.use(require('derby-ui-boot'), {
styles: []
});
derby.use(require('../'));
derby.use(require('derby-auth/components'));
app = derby.createApp(module);
get = app.get, view = app.view, ready = app.ready;
i18n = require('./i18n');
i18n.localize(app, {
availableLocales: ['en', 'he', 'bg', 'nl'],
defaultLocale: 'en',
urlScheme: false,
checkHeader: true
});
misc = require('./misc');
misc.viewHelpers(view);
_ = require('lodash');
algos = require('habitrpg-shared/script/algos');
async = require('async');
get('/', function(page, model, params, next) {
var uuid, _ref, _ref1;
if (((_ref = page.params) != null ? (_ref1 = _ref.query) != null ? _ref1.play : void 0 : void 0) != null) {
return page.redirect('/');
}
/*
Subscribe to the user, the users's party (meta info like party name, member ids, etc), and the party's members. 3 subscriptions.
*/
uuid = model.get('_userId') || model.session.userId;
return async.waterfall([
function(cb) {
var myGroupsQuery, publicGroupsQuery;
publicGroupsQuery = model.query('groups').publicGroups();
myGroupsQuery = model.query('groups').withMember(uuid);
return model.fetch(publicGroupsQuery, myGroupsQuery, cb);
}, function(publicGroups, groups, cb) {
var groupsInfo, groupsObj, guildsQ, membersQ, partyQ;
model.set('_publicGroups', _.sortBy(publicGroups.get(), function(g) {
return -_.size(g.members);
}));
groupsObj = groups.get();
if (_.isEmpty(groupsObj)) {
return cb(true);
}
groupsInfo = _.reduce(groupsObj, (function(m, g) {
if (g.type === 'guild') {
m.guildIds.push(g.id);
} else {
m.partyId = g.id;
}
m.members = m.members.concat(g.members);
return m;
}), {
guildIds: [],
partyId: null,
members: []
});
membersQ = model.query('users').publicInfo(groupsInfo.members);
partyQ = model.query('groups').withIds(groupsInfo.partyId);
guildsQ = model.query('groups').withIds(groupsInfo.guildIds);
return model.fetch(membersQ, partyQ, guildsQ, cb);
}
], function(err, members, party, guilds) {
var mObj;
if (err && err !== true) {
return next(err);
}
if (members) {
mObj = members.get();
model.set("_members", _.object(_.pluck(mObj, 'id'), mObj));
model.set("_membersArray", mObj);
}
if (party) {
model.ref('_party', party);
}
if (guilds) {
model.ref('_guilds', guilds);
}
return model.subscribe("users." + uuid, 'groups.habitrpg', function(err, user, tavern) {
if (err) {
return next(err);
}
model.ref('_user', user);
model.ref('_habitRPG', tavern);
if (!user.get()) {
console.error("User not found - this shouldn't be happening!");
return page.redirect('/logout');
}
require('./items').server(model);
_.each(['habit', 'daily', 'todo', 'reward'], function(type) {
model.refList("_" + type + "List", "_user.tasks", "_user." + type + "Ids");
return true;
});
return page.render();
});
});
});
ready(function(model) {
var browser, tz, user;
user = model.at('_user');
misc.fixCorruptUser(model);
browser = require('./browser');
require('./tasks').app(exports, model);
require('./items').app(exports, model);
require('./groups').app(exports, model, app);
require('./profile').app(exports, model);
require('./pets').app(exports, model);
require('../server/private').app(exports, model);
if (model.flags.nodeEnv !== 'production') {
require('./debug').app(exports, model);
}
browser.app(exports, model, app);
require('./unlock').app(exports, model);
require('./filters').app(exports, model);
require('./challenges').app(exports, model);
exports.removeAt = function(e, el) {
var confirmMessage;
if ((confirmMessage = $(el).attr('data-confirm')) != null) {
if (confirm(confirmMessage) !== true) {
return;
}
}
e.at().remove();
if ($(el).attr('data-refresh')) {
return browser.resetDom(model);
}
};
tz = user.get("preferences.timezoneOffset");
if (!(tz && tz === (new Date()).getTimezoneOffset())) {
user.set('preferences.timezoneOffset', (new Date()).getTimezoneOffset());
}
/*
Cron
*/
return misc.batchTxn(model, function(uObj, paths) {
_.each(['habit', 'daily', 'todo', 'reward'], function(type) {
uObj["" + type + "s"] = _.where(uObj.tasks, {
type: type
});
return true;
});
algos.cron(uObj, {
paths: paths
});
if (_.isEmpty(paths) || (paths['lastCron'] && _.size(paths) === 1)) {
return;
}
if (paths['stats.hp']) {
delete paths['stats.hp'];
return setTimeout(function() {
browser.resetDom(model);
return user.set('stats.hp', uObj.stats.hp);
}, 750);
}
}, {
cron: true
});
});
}).call(this);
/*
//@ sourceMappingURL=index.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "index.js",
"sourceRoot": "",
"sources": [
"index.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA,mDAAA;;CAAA,CAAA,CAAQ,EAAR,EAAQ;;CAAR,CAGA,CAAA,EAAK,EAAK,QAAA;CAA0B,CAAS,EAAR,EAAA;CAHrC,GAGA;;CAHA,CAIA,CAAA,EAAK,EAAK,GAAA;;CAJV,CAKA,CAAA,EAAK,EAAK,gBAAA;;CALV,CAQA,CA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B;CAAuC,CAAC,EAAD,MAAC;CAAxC,SAAmB;CAA7B,cAA0D;CAApG,MAA0C;CAA1C,CACiB,EAAjB,CAAK,CAAL;CAAiB,CAAC,GAAD,GAAC;CADlB,OACA;CAGA,GAAU,CAAA,CAAV,CAAU,GAA2B;CAArC,aAAA;QAJA;CAMA,GAAG,CAAM,CAAT,IAAS;AACP,CAAA,IAAa,CAAb,EAAA,EAAa;CACF,EAAA,MAAA,CAAX,KAAA;CACE,IAAA,EAAO,CAAP,EAAA;CACK,CAAgB,CAArB,CAAI,CAA2B,KAA/B,OAAA;CAFF,CAGE,CAHF,MAAW;QAVM;CAArB,CAcC,GAdoB;CAcpB,CAAM,EAAL,EAAA;CA7CE,KA+BJ;CA/BF,EAAM;CArGN"
}
-64
View File
@@ -1,64 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var items, updateStore, _;
items = require('habitrpg-shared/script/items');
_ = require('lodash');
updateStore = function(model) {
var nextItems;
nextItems = items.updateStore(model.get('_user'));
return _.each(nextItems, function(v, k) {
model.set("_items.next." + k, v);
return true;
});
};
/*
server exports
*/
module.exports.server = function(model) {
model.set('_items', items.items);
return updateStore(model);
};
/*
app exports
*/
module.exports.app = function(appExports, model) {
var misc;
misc = require('./misc');
model.on("set", "_user.items.*", function() {
return updateStore(model);
});
appExports.buyItem = function(e, el) {
return misc.batchTxn(model, function(uObj, paths) {
var ret;
ret = items.buyItem(uObj, $(el).attr('data-type'), {
paths: paths
});
if (ret === false) {
return alert("Not enough GP");
}
});
};
appExports.activateRewardsTab = function() {
model.set('_activeTabRewards', true);
return model.set('_activeTabPets', false);
};
return appExports.activatePetsTab = function() {
model.set('_activeTabPets', true);
return model.set('_activeTabRewards', false);
};
};
}).call(this);
/*
//@ sourceMappingURL=items.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "items.js",
"sourceRoot": "",
"sources": [
"items.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA,eAAA;;CAAA,C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
// Generated by CoffeeScript 1.6.3
(function() {
var algos, batchTxn, helpers, indexedPath, items, taskInChallenge, _;
_ = require('lodash');
algos = require('habitrpg-shared/script/algos');
items = require('habitrpg-shared/script/items').items;
helpers = require('habitrpg-shared/script/helpers');
module.exports.batchTxn = batchTxn = function(model, cb, options) {
var batch, paths, ret, setOps, uObj, user;
if (options == null) {
options = {};
}
_.defaults(options, {
user: model.at("_user"),
cron: false,
done: function() {}
});
user = options.user;
uObj = helpers.hydrate(user.get());
batch = {
set: function(k, v) {
helpers.dotSet(k, v, uObj);
return paths[k] = true;
},
get: function(k) {
return helpers.dotGet(k, uObj);
}
};
paths = {};
model._dontPersist = true;
ret = cb(uObj, paths, batch);
_.each(paths, function(v, k) {
user.pass({
cron: options.cron
}).set(k, batch.get(k));
return true;
});
model._dontPersist = false;
if (!_.isEmpty(paths)) {
setOps = _.reduce(paths, (function(m, v, k) {
m[k] = batch.get(k);
return m;
}), {});
user.set("update__", setOps, options.done);
} else {
options.done();
}
return ret;
};
/*
We can't always use refLists, but we often still need to get a positional path by id: eg, users.1234.tasks.5678.value
For arrays (which use indexes, not id-paths), here's a helper function so we can run indexedPath('users',:user.id,'tasks',:task.id,'value)
*/
indexedPath = function() {
var _this = this;
return _.reduce(arguments, function(m, v) {
if (!m) {
return v;
}
if (_.isString(v)) {
return "" + m + "." + v;
}
return ("" + m + ".") + _.findIndex(_this.model.get(m), v);
}, '');
};
taskInChallenge = function(task) {
if (!(task != null ? task.challenge : void 0)) {
return void 0;
}
return this.model.at(indexedPath.call(this, "groups." + task.group.id + ".challenges", {
id: task.challenge
}, "" + task.type + "s", {
id: task.id
}));
};
/*
algos.score wrapper for habitrpg-helpers to work in Derby. We need to do model.set() instead of simply setting the
object properties, and it's very difficult to diff the two objects and find dot-separated paths to set. So we to first
clone our user object (if we don't do that, it screws with model.on() listeners, ping Tyler for an explaination),
perform the updates while tracking paths, then all the values at those paths
*/
module.exports.score = function(model, taskId, direction, allowUndo) {
var delta, drop;
if (allowUndo == null) {
allowUndo = false;
}
drop = void 0;
delta = batchTxn(model, function(uObj, paths) {
var chal, chalTask, chalUser, cu, previousUndo, tObj, tObjBefore, timeoutId, _ref, _ref1, _ref2, _ref3, _ref4;
tObj = uObj.tasks[taskId];
if (allowUndo) {
tObjBefore = _.cloneDeep(tObj);
if ((_ref = tObjBefore.type) === 'daily' || _ref === 'todo') {
tObjBefore.completed = !tObjBefore.completed;
}
previousUndo = model.get('_undo');
if (previousUndo != null ? previousUndo.timeoutId : void 0) {
clearTimeout(previousUndo.timeoutId);
}
timeoutId = setTimeout((function() {
return model.del('_undo');
}), 20000);
model.set('_undo', {
stats: _.cloneDeep(uObj.stats),
task: tObjBefore,
timeoutId: timeoutId
});
}
delta = algos.score(uObj, tObj, direction, {
paths: paths
});
if ((_ref1 = uObj._tmp) != null ? _ref1.streakBonus : void 0) {
model.set('_streakBonus', uObj._tmp.streakBonus);
}
drop = (_ref2 = uObj._tmp) != null ? _ref2.drop : void 0;
if ((chalTask = taskInChallenge.call({
model: model
}, tObj)) && (chalTask != null ? chalTask.get() : void 0)) {
model._dontPersist = false;
chalTask.incr("value", delta);
chal = model.at(indexedPath.call({
model: model
}, "groups." + tObj.group.id + ".challenges", {
id: tObj.challenge
}));
chalUser = function() {
return indexedPath.call({
model: model
}, chal.path(), 'users', {
id: uObj.id
});
};
cu = model.at(chalUser());
if (!(cu != null ? cu.get() : void 0)) {
chal.push("users", {
id: uObj.id,
name: helpers.username(uObj.auth, (_ref3 = uObj.profile) != null ? _ref3.name : void 0)
});
cu = model.at(chalUser());
} else {
cu.set('name', helpers.username(uObj.auth, (_ref4 = uObj.profile) != null ? _ref4.name : void 0));
}
cu.set("" + tObj.type + "s." + tObj.id, {
value: tObj.value,
history: tObj.history
});
return model._dontPersist = true;
}
}, {
done: function() {
if (drop && (typeof $ !== "undefined" && $ !== null)) {
model.set('_drop', drop);
return $('#item-dropped-modal').modal('show');
}
}
});
return delta;
};
/*
Cleanup task-corruption (null tasks, rogue/invisible tasks, etc)
Obviously none of this should be happening, but we'll stop-gap until we can find & fix
Gotta love refLists! see https://github.com/lefnire/habitrpg/issues/803 & https://github.com/lefnire/habitrpg/issues/6343
*/
module.exports.fixCorruptUser = function(model) {
var resetDom, tasks, user;
user = model.at('_user');
tasks = user.get('tasks');
_.each(tasks, function(task, key) {
if (!(((task != null ? task.id : void 0) != null) && ((task != null ? task.type : void 0) != null))) {
user.del("tasks." + key);
delete tasks[key];
}
return true;
});
resetDom = false;
batchTxn(model, function(uObj, paths, batch) {
var uniqInvites, uniqPets, _ref;
uniqPets = _.uniq(uObj.items.pets);
if (!_.isEqual(uniqPets, uObj.items.pets)) {
batch.set('items.pets', uniqPets);
}
if ((_ref = uObj.invitations) != null ? _ref.guilds : void 0) {
uniqInvites = _.uniq(uObj.invitations.guilds);
if (!_.isEqual(uniqInvites, uObj.invitations.guilds)) {
batch.set('invitations.guilds', uniqInvites);
}
}
['habit', 'daily', 'todo', 'reward'].forEach(function(type) {
var idList, preened, taskIds, union;
idList = uObj["" + type + "Ids"];
taskIds = _.pluck(_.where(tasks, {
type: type
}), 'id');
union = _.union(idList, taskIds);
preened = _.filter(union, function(id) {
return id && _.contains(taskIds, id);
});
if (!_.isEqual(idList, preened)) {
batch.set("" + type + "Ids", preened);
console.error(uObj.id + ("'s " + type + "s were corrupt."));
}
return true;
});
return resetDom = !_.isEmpty(paths);
});
if (resetDom) {
return require('./browser').resetDom(model);
}
};
module.exports.viewHelpers = function(view) {
view.fn("percent", function(x, y) {
if (x === 0) {
x = 1;
}
return Math.round(x / y * 100);
});
view.fn('indexOf', function(str1, str2) {
if (!(str1 && str2)) {
return false;
}
return str1.indexOf(str2) !== -1;
});
view.fn("round", Math.round);
view.fn("floor", Math.floor);
view.fn("ceil", Math.ceil);
view.fn("lt", function(a, b) {
return a < b;
});
view.fn('gt', function(a, b) {
return a > b;
});
view.fn("mod", function(a, b) {
return parseInt(a) % parseInt(b) === 0;
});
view.fn("notEqual", function(a, b) {
return a !== b;
});
view.fn("and", function() {
return _.reduce(arguments, function(cumm, curr) {
return cumm && curr;
});
});
view.fn("or", function() {
return _.reduce(arguments, function(cumm, curr) {
return cumm || curr;
});
});
view.fn("truarr", function(num) {
return num - 1;
});
view.fn('count', function(arr) {
return (arr != null ? arr.length : void 0) || 0;
});
view.fn('int', {
get: function(num) {
return num;
},
set: function(num) {
return [parseInt(num)];
}
});
view.fn('indexedPath', indexedPath);
view.fn("encodeiCalLink", helpers.encodeiCalLink);
view.fn("gems", function(balance) {
return balance * 4;
});
view.fn("username", helpers.username);
view.fn("tnl", algos.tnl);
view.fn('equipped', helpers.equipped);
view.fn("gold", helpers.gold);
view.fn("silver", helpers.silver);
view.fn('userStr', helpers.userStr);
view.fn('totalStr', helpers.totalStr);
view.fn('userDef', helpers.userDef);
view.fn('totalDef', helpers.totalDef);
view.fn('itemText', helpers.itemText);
view.fn('itemStat', helpers.itemStat);
view.fn('ownsPet', helpers.ownsPet);
view.fn('taskClasses', helpers.taskClasses);
view.fn('friendlyTimestamp', helpers.friendlyTimestamp);
view.fn('newChatMessages', helpers.newChatMessages);
view.fn('relativeDate', helpers.relativeDate);
view.fn('noTags', helpers.noTags);
view.fn('appliedTags', helpers.appliedTags);
view.fn('taskInChallenge', function(task) {
var _ref;
return (_ref = taskInChallenge.call(this, task)) != null ? _ref.get() : void 0;
});
view.fn('taskAttrFromChallenge', function(task, attr) {
var _ref;
return (_ref = taskInChallenge.call(this, task)) != null ? _ref.get(attr) : void 0;
});
view.fn('brokenChallengeLink', function(task) {
var _ref;
return (task != null ? task.challenge : void 0) && !((_ref = taskInChallenge.call(this, task)) != null ? _ref.get() : void 0);
});
return view.fn('challengeMemberScore', function(member, tType, tid) {
var _ref, _ref1;
return Math.round((_ref = member["" + tType + "s"]) != null ? (_ref1 = _ref[tid]) != null ? _ref1.value : void 0 : void 0);
});
};
}).call(this);
/*
//@ sourceMappingURL=misc.map
*/
File diff suppressed because one or more lines are too long
-103
View File
@@ -1,103 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var hatchingPotions, pets, randomVal, _, _ref;
_ = require('lodash');
randomVal = require('habitrpg-shared/script/helpers').randomVal;
_ref = require('habitrpg-shared/script/items').items, pets = _ref.pets, hatchingPotions = _ref.hatchingPotions;
/*
app exports
*/
module.exports.app = function(appExports, model) {
var user;
user = model.at('_user');
appExports.chooseEgg = function(e, el) {
return model.ref('_hatchEgg', e.at());
};
appExports.hatchEgg = function(e, el) {
var egg, eggIdx, eggs, hatchingPotionIdx, hatchingPotionName, myHatchingPotion, myPets;
hatchingPotionName = $(el).children('select').val();
myHatchingPotion = user.get('items.hatchingPotions');
egg = model.get('_hatchEgg');
eggs = user.get('items.eggs');
myPets = user.get('items.pets');
hatchingPotionIdx = myHatchingPotion.indexOf(hatchingPotionName);
eggIdx = eggs.indexOf(egg);
if (hatchingPotionIdx === -1) {
return alert("You don't own that hatching potion yet, complete more tasks!");
}
if (eggIdx === -1) {
return alert("You don't own that egg yet, complete more tasks!");
}
if (myPets && myPets.indexOf("" + egg.name + "-" + hatchingPotionName) !== -1) {
return alert("You already have that pet, hatch a different combo.");
}
user.push('items.pets', egg.name + '-' + hatchingPotionName, function() {
eggs.splice(eggIdx, 1);
myHatchingPotion.splice(hatchingPotionIdx, 1);
user.set('items.eggs', eggs);
return user.set('items.hatchingPotions', myHatchingPotion);
});
return alert('Your egg hatched! Visit your stable to equip your pet.');
};
appExports.choosePet = function(e, el, next) {
var modifier, name, pet, petStr, _ref1;
petStr = $(el).attr('data-pet');
if (user.get('items.pets').indexOf(petStr) === -1) {
return next();
}
if (user.get('items.currentPet.str') === petStr) {
return user.set('items.currentPet', {});
}
_ref1 = petStr.split('-'), name = _ref1[0], modifier = _ref1[1];
pet = _.find(pets, {
name: name
});
pet.modifier = modifier;
pet.str = petStr;
return user.set('items.currentPet', pet);
};
appExports.buyHatchingPotion = function(e, el) {
var gems, name, newHatchingPotion;
name = $(el).attr('data-hatchingPotion');
newHatchingPotion = _.find(hatchingPotions, {
name: name
});
gems = user.get('balance') * 4;
if (gems >= newHatchingPotion.value) {
if (confirm("Buy this hatching potion with " + newHatchingPotion.value + " of your " + gems + " Gems?")) {
user.push('items.hatchingPotions', newHatchingPotion.name);
return user.set('balance', (gems - newHatchingPotion.value) / 4);
}
} else {
return $('#more-gems-modal').modal('show');
}
};
return appExports.buyEgg = function(e, el) {
var gems, name, newEgg;
name = $(el).attr('data-egg');
newEgg = _.find(pets, {
name: name
});
gems = user.get('balance') * 4;
if (gems >= newEgg.value) {
if (confirm("Buy this egg with " + newEgg.value + " of your " + gems + " Gems?")) {
user.push('items.eggs', newEgg);
return user.set('balance', (gems - newEgg.value) / 4);
}
} else {
return $('#more-gems-modal').modal('show');
}
};
};
}).call(this);
/*
//@ sourceMappingURL=pets.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "pets.js",
"sourceRoot": "",
"sources": [
"pets.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA,mCAAA;;CAAA,CAAA,CAAI,IAAA,CAAA;;CAAJ,CACE,CAAc,IAAA,EADhB,uBACgB;;CADhB,CAEA,EAAA,CAAA,EAA4B,QAF5B,eAE4B;;CAE5B;;;CAJA;;CAAA,CAOA,CAAA,EAAqB,CAAf,CAAQ,EAAQ,CAAD;CACnB,GAAA,IAAA;CAAA,CAAO,CAAA,CAAP,CAAY,EAAL;CAAP,CAE2B,CAAJ,CAAvB,KAAA,CAAU;CACF,CAAiB,CAAvB,EAAK,MAAL,EAAA;CAHF,IAEuB;CAFvB,CAK0B,CAAJ,CAAtB,IAAA,CAAuB,CAAb;CACR,SAAA,wEAAA;CAAA,CAAqB,CAAA,GAArB,EAAqB,UAArB;CAAA,EACmB,CAAI,EAAvB,UAAA,OAAmB;CADnB,EAEA,EAAW,CAAX,KAAM;CAFN,EAGO,CAAP,EAAA,MAAO;CAHP,EAIS,CAAI,EAAb,MAAS;CAJT,EAMoB,GAApB,CAAoB,SAAgB,CAApC,CAAoB;CANpB,E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WAA4B;CAC1B,EAA2C,CAAxC,CAAS,EAAT,CAAH,GAAY,MAAgD,eAAhD;CACV,CAAmC,EAA/B,MAAJ,OAAoD,MAApD;CACK,CAAe,CAApB,CAAI,CAAgB,IAApB,QAAA;UAHJ;MAAA,EAAA;CAKE,IAAA,CAAA,SAAA,GAAA;QAT2B;CA5C/B,IA4C+B;CAWpB,CAAa,CAAJ,GAApB,GAAqB,CAAX,CAAV;CACE,SAAA,QAAA;CAAA,CAAO,CAAA,CAAP,EAAA,IAAO;CAAP,CACsB,CAAb,CAAA,EAAT;CAAsB,CAAO,EAAN,IAAA;CADvB,OACS;CADT,EAEO,CAAP,EAAA,GAAO;CACP,GAAG,CAAH,CAAA;CACE,EAA+B,CAA5B,CAAS,CAAyB,CAAlC,CAAH,GAAY,SAAA;CACV,CAAwB,EAApB,EAAJ,IAAA,EAAA;CACK,CAAe,CAApB,CAAI,CAAgB,CAAc,GAAlC,QAAA;UAHJ;MAAA,EAAA;CAKE,IAAA,CAAA,SAAA,GAAA;QATgB;CAxDD,IAwDC;CA/DtB,EAOqB;CAPrB"
}
-135
View File
@@ -1,135 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var algos, browser, helpers, items, misc, _;
helpers = require('habitrpg-shared/script/helpers');
algos = require('habitrpg-shared/script/algos');
browser = require('./browser');
items = require('./items');
misc = require('./misc');
_ = require('lodash');
module.exports.app = function(appExports, model) {
var toggleGamePane, user;
user = model.at('_user');
appExports.revive = function() {
var paths, uObj, _ref;
_ref = [user.get(), {}], uObj = _ref[0], paths = _ref[1];
algos.revive(uObj, {
paths: paths
});
return _.each(paths, (function(v, k) {
return user.set(k, helpers.dotGet(k, uObj));
}));
};
appExports.reset = function(e, el) {
misc.batchTxn(model, function(uObj, paths, batch) {
batch.set('tasks', {});
['habit', 'daily', 'todo', 'reward'].forEach(function(type) {
return batch.set("" + type + "Ids", []);
});
_.each({
hp: 50,
lvl: 1,
gp: 0,
exp: 0
}, function(v, k) {
return batch.set("stats." + k, v);
});
return _.each({
armor: 0,
weapon: 0,
head: 0,
shield: 0
}, function(v, k) {
return batch.set("items." + k, v);
});
});
return browser.resetDom(model);
};
appExports.closeNewStuff = function(e, el) {
return user.set('flags.newStuff', 'hide');
};
appExports.customizeGender = function(e, el) {
return user.set('preferences.gender', $(el).attr('data-value'));
};
appExports.customizeHair = function(e, el) {
return user.set('preferences.hair', $(el).attr('data-value'));
};
appExports.customizeSkin = function(e, el) {
return user.set('preferences.skin', $(el).attr('data-value'));
};
appExports.customizeArmorSet = function(e, el) {
return user.set('preferences.armorSet', $(el).attr('data-value'));
};
appExports.restoreSave = function() {
return misc.batchTxn(model, function(uObj, paths, batch) {
return $('#restore-form input').each(function() {
var path, val, _ref;
_ref = [$(this).attr('data-for'), parseInt($(this).val() || 1)], path = _ref[0], val = _ref[1];
return batch.set(path, val);
});
});
};
appExports.toggleHeader = function(e, el) {
return user.set('preferences.hideHeader', !user.get('preferences.hideHeader'));
};
appExports.deleteAccount = function(e, el) {
return model.del("users." + (user.get('id')), function() {
return location.href = "/logout";
});
};
appExports.profileAddWebsite = function(e, el) {
var newWebsite;
newWebsite = model.get('_newProfileWebsite');
if (/^(\s)*$/.test(newWebsite)) {
return;
}
user.unshift('profile.websites', newWebsite);
return model.set('_newProfileWebsite', '');
};
appExports.profileEdit = function(e, el) {
return model.set('_profileEditing', true);
};
appExports.profileSave = function(e, el) {
return model.set('_profileEditing', false);
};
appExports.profileRemoveWebsite = function(e, el) {
var i, sites;
sites = user.get('profile.websites');
i = sites.indexOf($(el).attr('data-website'));
sites.splice(i, 1);
return user.set('profile.websites', sites);
};
toggleGamePane = function() {
return model.set('_gamePane', !model.get('_gamePane'), function() {
return browser.setupTooltips();
});
};
appExports.clickAvatar = function(e, el) {
var uid;
uid = $(el).attr('data-uid');
if (uid === model.get('_userId')) {
return toggleGamePane();
} else {
return $("#avatar-modal-" + uid).modal('show');
}
};
appExports.toggleGamePane = function() {
return toggleGamePane();
};
return appExports.toggleResting = function() {
return model.set('_user.flags.rest', !model.get('_user.flags.rest'));
};
};
}).call(this);
/*
//@ sourceMappingURL=profile.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "profile.js",
"sourceRoot": "",
"sources": [
"profile.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA,iCAAA;;CAAA,CAAA,CAAU,IAAV,yBAAU;;CAAV,CACA,CAAQ,EAAR,EAAQ,uBAAA;;CADR,CAEA,CAAU,IAAV,IAAU;;CAFV,CAGA,CAAQ,EAAR,EAAQ,EAAA;;CAHR,CAIA,CAAO,CAAP,GAAO,CAAA;;CAJP,CAKA,CAAI,IAAA,CAAA;;CALJ,CAOA,CAAA,EAAqB,CAAf,CAAQ,EAAQ,CAAD;CACnB,OAAA,YAAA;CAAA,CAAO,CAAA,CAAP,CAAY,EAAL;CAAP,EAEoB,CAApB,EAAA,GAAoB,CAAV;CACR,SAAA,OAAA;CAAA,CAA6B,CAAZ,CAAI,EAArB,CAAgB;CAAhB,CACmB,EAAnB,CAAK,CAAL;CAAmB,CAAC,GAAD,GAAC;CADpB,OACA;CACC,CAAa,CAAC,CAAf,CAAA,IAAgB,IAAhB;CAA6B,CAAO,CAAZ,CAAI,EAAQ,CAAO,QAAnB;CAAV,MAAC;CALjB,IAEoB;CAFpB,CAOuB,CAAJ,CAAnB,CAAA,IAAoB,CAAV;CACR,CAAqB,CAAA,CAAjB,CAAJ,CAAA,EAAA,CAAsB;CACpB,CAAmB,CAAnB,EAAK,EAAL,CAAA;CAAA,CACU,CAAmC,CAAA,EAA7C,CAAA,CAAA,CAA8C;CAAe,CAAI,CAAV,CAAU,CAAL,YAAL;CAAvD,QAA6C;CAD7C,GAEA,IAAA;CAAO,CAAC,QAAA;CAAD,CAAY,CAAJ,OAAA;CAAR,CAAe,QAAA;CAAf,CAAyB,CAAJ,OAAA;CAAQ,CAAA,CAAA,MAAC,CAArC;CAAmD,CAAiB,CAAvB,EAAK,GAAM,SAAX;CAA7C,QAAoC;C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AqE4B,CAA5B,KAA4B,CAAlB,IAAV;CAA+B,YAAA,CAAA;CArE/B,IAqE4B;CAEjB,EAAgB,MAAA,CAAjB,CAAV,EAAA;AACiC,CAAzB,CAAwB,CAA9B,EAAK,QAAL,KAAA;CAzEiB,IAwEQ;CA/E7B,EAOqB;CAPrB"
}
-222
View File
@@ -1,222 +0,0 @@
// Generated by CoffeeScript 1.6.3
(function() {
var algos, helpers, misc, moment, _;
algos = require('habitrpg-shared/script/algos');
helpers = require('habitrpg-shared/script/helpers');
_ = require('lodash');
moment = require('moment');
misc = require('./misc');
/*
Make scoring functionality available to the app
*/
module.exports.app = function(appExports, model) {
var user;
user = model.at('_user');
appExports.addTask = function(e, el) {
var newModel, newTask, text, type;
type = $(el).attr('data-task-type');
newModel = model.at('_new' + type.charAt(0).toUpperCase() + type.slice(1));
text = newModel.get();
if (/^(\s)*$/.test(text) || text === void 0) {
return;
}
newTask = {
id: model.id(),
type: type,
text: text,
notes: '',
value: 0
};
newTask.tags = _.reduce(user.get('filters'), (function(memo, v, k) {
if (v) {
memo[k] = v;
}
return memo;
}), {});
switch (type) {
case 'habit':
newTask = _.defaults({
up: true,
down: true
}, newTask);
break;
case 'reward':
newTask = _.defaults({
value: 20
}, newTask);
break;
case 'daily':
newTask = _.defaults({
repeat: {
su: true,
m: true,
t: true,
w: true,
th: true,
f: true,
s: true
},
completed: false
}, newTask);
break;
case 'todo':
newTask = _.defaults({
completed: false
}, newTask);
}
e.at().unshift(newTask);
return newModel.set('');
};
appExports.del = function(e) {
if (confirm("Are you sure you want to delete this task?") !== true) {
return;
}
$('[rel=tooltip]').tooltip('hide');
user.del("tasks." + (e.get('id')));
return e.at().remove();
};
appExports.clearCompleted = function(e, el) {
var completedIds, todoIds;
completedIds = _.pluck(_.where(model.get('_todoList'), {
completed: true
}), 'id');
todoIds = user.get('todoIds');
_.each(completedIds, function(id) {
user.del("tasks." + id);
return true;
});
return user.set('todoIds', _.difference(todoIds, completedIds));
};
appExports.toggleDay = function(e, el) {
var task;
task = model.at(e.target);
if (/active/.test($(el).attr('class'))) {
return task.set('repeat.' + $(el).attr('data-day'), false);
} else {
return task.set('repeat.' + $(el).attr('data-day'), true);
}
};
appExports.toggleTaskEdit = function(e, el) {
var chartPath, editPath, id, _ref;
id = e.get('id');
_ref = ["_tasks.editing." + id, "_page.charts." + id], editPath = _ref[0], chartPath = _ref[1];
model.set(editPath, !(model.get(editPath)));
return model.set(chartPath, false);
};
appExports.toggleChart = function(e, el) {
var chart, data, history, historyPath, id, matrix, options, togglePath, _ref, _ref1, _ref2, _ref3;
id = $(el).attr('data-id');
_ref = ['', ''], historyPath = _ref[0], togglePath = _ref[1];
switch (id) {
case 'exp':
_ref1 = ['_page.charts.exp', '_user.history.exp'], togglePath = _ref1[0], historyPath = _ref1[1];
break;
case 'todos':
_ref2 = ['_page.charts.todos', '_user.history.todos'], togglePath = _ref2[0], historyPath = _ref2[1];
break;
default:
_ref3 = ["_page.charts." + id, "_user.tasks." + id + ".history"], togglePath = _ref3[0], historyPath = _ref3[1];
model.set("_tasks.editing." + id, false);
}
history = model.get(historyPath);
model.set(togglePath, !(model.get(togglePath)));
matrix = [['Date', 'Score']];
_.each(history, function(obj) {
return matrix.push([moment(obj.date).format('MM/DD/YY'), obj.value]);
});
data = google.visualization.arrayToDataTable(matrix);
options = {
title: 'History',
backgroundColor: {
fill: 'transparent'
}
};
chart = new google.visualization.LineChart($("." + id + "-chart")[0]);
return chart.draw(data, options);
};
appExports.todosShowRemaining = function() {
return model.set('_showCompleted', false);
};
appExports.todosShowCompleted = function() {
return model.set('_showCompleted', true);
};
/*
Call scoring functions for habits & rewards (todos & dailies handled below)
*/
appExports.score = function(e, el) {
var direction, id;
id = $(el).parents('li').attr('data-id');
direction = $(el).attr('data-direction');
return misc.score(model, id, direction, true);
};
/*
This is how we handle appExports.score for todos & dailies. Due to Derby's special handling of `checked={:task.completd}`,
the above function doesn't work so we need a listener here
*/
user.on('set', 'tasks.*.completed', function(i, completed, previous, isLocal, passed) {
var direction;
if (!isLocal || (passed != null ? passed.cron : void 0)) {
return;
}
direction = completed ? 'up' : 'down';
return misc.score(model, i, direction, true);
});
/*
Undo
*/
appExports.undo = function() {
var taskPath, undo;
undo = model.get('_undo');
if (undo != null ? undo.timeoutId : void 0) {
clearTimeout(undo.timeoutId);
}
model.del('_undo');
_.each(undo.stats, function(val, key) {
user.set("stats." + key, val);
return true;
});
taskPath = "tasks." + undo.task.id;
return _.each(undo.task, function(val, key) {
if (key === 'id' || key === 'type') {
return true;
}
if (key === 'completed') {
user.pass({
cron: true
}).set("" + taskPath + ".completed", val);
} else {
user.set("" + taskPath + "." + key, val);
}
return true;
});
};
appExports.tasksToggleAdvanced = function(e, el) {
return $(el).next('.advanced-option').toggleClass('visuallyhidden');
};
appExports.tasksSaveAndClose = function() {
$('[rel=tooltip]').tooltip();
return $('[rel=popover]').popover();
};
return appExports.tasksSetPriority = function(e, el) {
var dataId;
dataId = $(el).parent('[data-id]').attr('data-id');
return model.at(e.target).set('priority', $(el).attr('data-priority'));
};
};
}).call(this);
/*
//@ sourceMappingURL=tasks.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "tasks.js",
"sourceRoot": "",
"sources": [
"tasks.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA,yBAAA;;CAAA,CAAA,CAAQ,EAAR,EAAQ,uBAAA;;CAAR,CACA,CAAU,IAAV,yBAAU;;CADV,CAEA,CAAI,IAAA,CAAA;;CAFJ,CAGA,CAAS,GAAT,CAAS,CAAA;;CAHT,CAIA,CAAO,CAAP,GAAO,CAAA;;CAGP;;;CAPA;;CAAA,CAUA,CAAA,EAAqB,CAAf,CAAQ,EAAQ,CAAD;CACnB,GAAA,IAAA;CAAA,CAAO,CAAA,CAAP,CAAY,EAAL;CAAP,CAEyB,CAAJ,CAArB,GAAA,EAAsB,CAAZ;CACR,SAAA,mBAAA;CAAA,CAAO,CAAA,CAAP,EAAA,UAAO;CAAP,CACW,CAAA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.6.3
(function() {
var hatchingPotions, pets, randomVal, _, _ref;
_ = require('lodash');
randomVal = require('habitrpg-shared/script/helpers').randomVal;
_ref = require('habitrpg-shared/script/items').items, pets = _ref.pets, hatchingPotions = _ref.hatchingPotions;
/*
Listeners to enabled flags, set notifications to the user when they've unlocked features
*/
module.exports.app = function(appExports, model) {
var alreadyShown, showPopover, user;
user = model.at('_user');
alreadyShown = function(before, after) {
return !(!before && after === true);
};
showPopover = function(selector, title, html, placement) {
if (placement == null) {
placement = 'bottom';
}
$(selector).popover('destroy');
html += " <a href='#' onClick=\"$('" + selector + "').popover('hide');return false;\">[Close]</a>";
return $(selector).popover({
title: title,
placement: placement,
trigger: 'manual',
html: true,
content: html
}).popover('show');
};
user.on('set', 'flags.customizationsNotification', function(after, before) {
var html;
if (alreadyShown(before, after)) {
return;
}
$('.main-herobox').popover('destroy');
html = "Click your avatar to customize your appearance.";
return showPopover('.main-herobox', 'Customize Your Avatar', html, 'bottom');
});
user.on('set', 'flags.itemsEnabled', function(after, before) {
var html;
if (alreadyShown(before, after)) {
return;
}
html = "<img src='/vendor/BrowserQuest/client/img/1/chest.png' />\nCongratulations, you have unlocked the Item Store! You can now buy weapons, armor, potions, etc. Read each item's comment for more information.";
return showPopover('div.rewards', 'Item Store Unlocked', html, 'left');
});
user.on('set', 'flags.petsEnabled', function(after, before) {
var html;
if (alreadyShown(before, after)) {
return;
}
html = "<img src='/img/sprites/wolf_border.png' style='width:30px;height:30px;float:left;padding-right:5px' />\nYou have unlocked Pets! You can now buy pets with Gems (note, you replenish Gems with real-life money - so chose your pets wisely!)";
return showPopover('#rewardsTabs', 'Pets Unlocked', html, 'left');
});
user.on('set', 'flags.partyEnabled', function(after, before) {
var html;
if (user.get('party.current') || alreadyShown(before, after)) {
return;
}
html = "Be social, join a party and play Habit with your friends! You'll be better at your habits with accountability partners. Click User -> Options -> Party, and follow the instructions. LFG anyone?";
return showPopover('.user-menu', 'Party System', html, 'bottom');
});
user.on('set', 'flags.dropsEnabled', function(after, before) {
var dontPersist, egg;
if (alreadyShown(before, after)) {
return;
}
egg = randomVal(pets);
dontPersist = model._dontPersist;
model._dontPersist = false;
user.push('items.eggs', egg);
model._dontPersist = dontPersist;
return $('#drops-enabled-modal').modal('show');
});
user.on('push', 'items.pets', function(after, before) {
var dontPersist;
if (user.get('achievements.beastMaster')) {
return;
}
if (before >= 90) {
dontPersist = model._dontPersist;
model._dontPersist = false;
user.set('achievements.beastMaster', true, (function() {
return model._dontPersist = dontPersist;
}));
return $('#beastmaster-achievement-modal').modal('show');
}
});
user.on('set', 'items.*', function(after, before) {
var dontPersist, items;
if (user.get('achievements.ultimateGear')) {
return;
}
items = user.get('items');
if (parseInt(items.weapon) >= 6 && parseInt(items.armor) >= 5 && parseInt(items.head) >= 5 && parseInt(items.shield) >= 5) {
dontPersist = model._dontPersist;
model._dontPersist = false;
user.set('achievements.ultimateGear', true, (function() {
return model._dontPersist = dontPersist;
}));
return $('#max-gear-achievement-modal').modal('show');
}
});
return user.on('set', 'tasks.*.streak', function(id, after, before) {
var dontPersist;
if (after > 0) {
if ((after % 21) === 0) {
dontPersist = model._dontPersist;
model._dontPersist = false;
user.incr('achievements.streak', 1, (function() {
return model._dontPersist = dontPersist;
}));
return $('#streak-achievement-modal').modal('show');
} else if ((before - after === 1) && (before % 21 === 0)) {
dontPersist = model._dontPersist;
model._dontPersist = false;
return user.incr('achievements.streak', -1, (function() {
return model._dontPersist = dontPersist;
}));
}
}
});
};
}).call(this);
/*
//@ sourceMappingURL=unlock.map
*/
-10
View File
@@ -1,10 +0,0 @@
{
"version": 3,
"file": "unlock.js",
"sourceRoot": "",
"sources": [
"unlock.coffee"
],
"names": [],
"mappings": ";AAAA;CAAA,KAAA,mCAAA;;CAAA,CAAA,CAAI,IAAA,CAAA;;CAAJ,CACE,CAAc,IAAA,EADhB,uBACgB;;CADhB,CAEA,EAAA,CAAA,EAA4B,QAF5B,eAE4B;;CAE5B;;;CAJA;;CAAA,CAQA,CAAA,EAAqB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OAAL,KAAA;CAAH,QAAC;CAC7C,IAAA,CAAA,SAAA,cAAA;QANsB;CAA1B,IAA0B;CAQrB,CAAL,CAAiC,CAA7B,CAAJ,CAAiC,GAAC,EAAlC,KAAA;CACE,SAAA,CAAA;CAAA,EAAW,CAAR,CAAA,CAAH;CAGE,CAAG,CAAS,CAAT,CAAC,GAAJ;CACE,EAAe,EAAK,KAApB,CAAA,CAAA;CAAA,EAAwD,EAAhB,KAAL,EAAA;CAAnC,CACiC,CAAI,CAAjC,KAAiC,CAArC,WAAA;CAA8C,EAAe,EAAhB,OAAL,OAAA;CAAJ,UAAC;CACrC,IAAA,CAAA,WAAA,UAAA;CAGO,CAA0B,CAAjB,CAAV,CAAC,CANT,IAAA;CAOE,EAAe,EAAK,KAApB,CAAA,CAAA;CAAA,EAAwD,EAAhB,KAAL,EAAA;AACD,CAA7B,CAA4B,CAAK,CAAlC,KAAkC,QAAtC,IAAA;CAA+C,EAAe,EAAhB,OAAL,OAAA;CAAJ,UAAC;UAX1C;QAD+B;CAAjC,IAAiC;CAlFnC,EAQqB;CARrB"
}
+13
View File
@@ -0,0 +1,13 @@
figure.herobox(data-name='{{username(profile.auth, profile.profile.name)}}', data-level='{{profile.stats.lvl}}', data-checkpet='{hasPet: profile.items.pet}', data-checkuser='{isUser: profile.id == user.id}', data-uid='{{profile.id}}', x-bind='click:clickAvatar', rel='popover', data-placement='bottom', data-trigger='hover', data-html='true', data-content="<div ng-show='profile.id == user.id'> <div class='progress progress-danger' style='height:5px;'> <div class='bar' style='height: 5px; width: {{percent(profile.stats.hp, 50)}}%;'></div> </div> <div class='progress progress-warning' style='height:5px;'> <div class='bar' style='height: 5px; width: {{percent(profile.stats.exp, tnl(profile.stats.lvl))}}%;'></div> </div> <div>Level: {{profile.stats.lvl}}</div> <div>GP: {{profile.stats.gp | number:0}}</div> <div>{{count(profile.items.pets)}} / 90 Pets Found</div> </div>")
.character-sprites
span(ng-class='{zzz:profile.flags.rest}')
span(class='{{profile.preferences.gender}}_skin_{{profile.preferences.skin}}')
span(class='{{profile.preferences.gender}}_hair_{{profile.preferences.hair}}')
span(class='{{equipped("armor", profile.items.armor, profile.preferences, profile.backer.tier)}}')
span(class='{{equipped("head", profile.items.head, profile.preferences, profile.backer.tier)}}', ng-show='profile.preferences.showHelm')
span(class='{{profile.preferences.gender}}_head_0', ng-hide='profile.preferences.showHelm')
span(class='{{equipped("shield",profile.items.shield,profile.preferences,profile.backer.tier)}}')
span(class='{{equipped("weapon",profile.items.weapon,profile.preferences,profile.backer.tier)}}')
// FIXME handle @minimal, this might have to be a directive
span.current-pet(class='Pet-{{profile.items.currentPet.name}}-{{profile.items.currentPet.modifier}}', ng-show='profile.items.currentPet && !minimal')
.avatar-level Lvl {{profile.stats.lvl}}
+35
View File
@@ -0,0 +1,35 @@
// @TODO ui:connectionAlert
.header-wrap
a.label.undo-button(x-bind='click:undo', ng-show='_undo') Undo
include ./menu
header.site-header(ng-class='{hidden: user.preferences.hideHeader}', role='banner', data-partysize='{{party.members.length>1 ? truarr(party.members.length) : 0}}')
// avatar
.herobox-wrap.main-herobox(ng-controller='UserAvatarCtrl')
include ./avatar
//app:avatar:avatar(profile='{{user}}', main='true')
// stat bars
.hero-stats
.meter.health(title='Health')
.bar(style='width: {{percent(user.stats.hp, 50)}}%;')
span.meter-text
i.icon-heart {{user.stats.hp | number:0}} / 50
.meter.experience(title='Experience')
.bar(style='width: {{percent(user.stats.exp,tnl(user.stats.lvl))}}%;')
span.meter-text
i.icon-star {{user.stats.exp | number:0}} / {{tnl(user.stats.lvl)}}
// FIXME doesn't look great here, but the "Experience" CSS title rollover covers it where it was before
span(ng-show='user.history.exp')
a(x-bind='click:toggleChart', data-id='exp', rel='tooltip', title='Progress')
i.icon-signal
// party
// I have an idea to use this loop for the user's herobox/avatar as well
NOTE TO SELF: Ask Tyler if some kind of inter-leaving is possible
where we can put ONE of the results of this loop BEFORE the progress bars, and the rest after
.herobox-wrap(ng-repeat='memberId in _party.members', ng-class='{hidden: memberId == userId}')
app:avatar:avatar(ng-hide='memberId == userId', profile='{{_members[memberId]}}', party='true')
// Would be way cleaner as a Derby template `data-content="<app:groups:member-stats profile={{:member}} />"`, but it was just printing HTML as text
//
I've re-implemented the rollover using the actual `herobox`/avatar template and data-attributes.
This Derby template idea would have been really handy but this is pretty versatile, and keeps it all in the avatar section
app:alerts:hiding-bailey
+18
View File
@@ -0,0 +1,18 @@
.user-menu
button.task-action-btn.tile.solid(ng-hide='authenticated()', style='cursor: pointer;', ng-click="modals.login = true") Login / Register
ul.nav.site-nav(ng-show='authenticated()')
li.flyout
h1.task-action-btn.tile.solid.user-reporter {{username(user.auth, user.profile.name)}}
ul.flyout-content.nav.stacked
li
a.task-action-btn.tile.solid(x-bind='click:toggleGamePane')
span(ng-show='_gamePane') Tasks
span(ng-hide='_gamePane') Options
li
a.task-action-btn.tile.solid(href='/logout') Logout
// party invitation notification
a(ng-show='user.party.invitation', style='cursor: pointer;', x-bind='click:gotoPartyChat')
i.icon-user
// party chat notification
a(ng-show='newChatMessages(_party.chat,user.party.lastMessageSeen)', style='cursor: pointer;', x-bind='click:gotoPartyChat')
i.icon-comment(rel='tooltip', title='New Party Messages')
+3 -7
View File
@@ -2,13 +2,9 @@ extends layout
block content
div(ng-app="habitrpg", ng-controller="RootCtrl")
// -------- Header --------
ui:connectionAlert
include ./shared/login
.header-wrap
a.label.undo-button(x-bind='click:undo', ng-show='_undo') Undo
| app:settings:menu
include ./shared/header
include ./modals/login
include ./header/header
span(ng-class='{hidden: _gamePane}')
| app:filters:filters
@@ -1,6 +1,5 @@
div(ng-controller='AuthCtrl')
button.btn(ng-click='showing = true') Login / Register
div(modal='showing', close='')
div(modal='modals.login', close='')
.modal-header
h3 Login / Register
.modal-body
@@ -25,6 +24,6 @@ div(ng-controller='AuthCtrl')
| derby-auth:register
.modal-footer
button.btn.btn-warning.cancel(ng-click='showing = false') Cancel
button.btn.btn-warning.cancel(ng-click='modals.login = false') Cancel
-32
View File
@@ -112,35 +112,3 @@
</@footer>
</app:modals:modal>
{{/}}
<menu:>
<div class="user-menu">
{{#unless _loggedIn}}
<button class="task-action-btn tile solid" style='cursor:pointer' data-target="#login-modal" data-toggle="modal">Login / Register</button>
{{else}}
<ul class="nav site-nav">
<li class="flyout">
<h1 class="task-action-btn tile solid user-reporter">{{username(_user.auth, _user.profile.name)}}</h1>
<ul class="flyout-content nav stacked">
<li>
<a class="task-action-btn tile solid" x-bind='click:toggleGamePane'>
{#if _gamePane}Tasks{else}Options{/}
</a>
</li>
<li><a class="task-action-btn tile solid" href="/logout">Logout</a></li>
</ul>
</li>
</ul>
{{/}}
<!-- party invitation notification -->
{#if _user.party.invitation}
<a style='cursor:pointer;' x-bind="click:gotoPartyChat"><i class='icon-user'></i></a>
{/}
<!-- party chat notification -->
{#if newChatMessages(_party.chat,_user.party.lastMessageSeen)}
<a style='cursor:pointer;' x-bind="click:gotoPartyChat"><i class='icon-comment' rel='tooltip' title='New Party Messages'></i></a>
{/}
</div>
-30
View File
@@ -1,30 +0,0 @@
header.site-header(ng-class='{hidden: user.preferences.hideHeader}', role='banner', data-partysize='{{party.members.length>1 ? truarr(party.members.length) : 0}}')
{{user.auth.local.username}}
// avatar
.herobox-wrap.main-herobox
app:avatar:avatar(profile='{{user}}', main='true')
// stat bars
.hero-stats
.meter.health(title='Health')
.bar(style='width: {{percent(user.stats.hp, 50)}}%;')
span.meter-text
i.icon-heart {{user.stats.hp | number:0}} / 50
.meter.experience(title='Experience')
.bar(style='width: {{percent(user.stats.exp,tnl(user.stats.lvl))}}%;')
span.meter-text
i.icon-star {{user.stats.exp | number:0}} / {{tnl(user.stats.lvl)}}
// FIXME doesn't look great here, but the "Experience" CSS title rollover covers it where it was before
span(ng-show='user.history.exp')
a(x-bind='click:toggleChart', data-id='exp', rel='tooltip', title='Progress')
i.icon-signal
// party
// I have an idea to use this loop for the user's herobox/avatar as well
NOTE TO SELF: Ask Tyler if some kind of inter-leaving is possible
where we can put ONE of the results of this loop BEFORE the progress bars, and the rest after
.herobox-wrap(ng-repeat='memberId in _party.members', ng-class='{hidden: memberId == userId}')
app:avatar:avatar(ng-hide='memberId == userId', profile='{{_members[memberId]}}', party='true')
// Would be way cleaner as a Derby template `data-content="<app:groups:member-stats profile={{:member}} />"`, but it was just printing HTML as text
//
I've re-implemented the rollover using the actual `herobox`/avatar template and data-attributes.
This Derby template idea would have been really handy but this is pretty versatile, and keeps it all in the avatar section
app:alerts:hiding-bailey
+27 -31
View File
@@ -10,43 +10,39 @@
<avatar:>
<figure class="herobox"
data-name="{username(@profile.auth, @profile.profile.name)}"
data-level="{@profile.stats.lvl}"
data-checkpet="{#if @profile.items.pet}hasPet{/}"
data-checkuser="{{#if @main}}isUser{{/}}"
data-uid="{{@profile.id}}" x-bind="click:clickAvatar"
rel="popover" data-placement="bottom" data-trigger="hover" data-html="true" data-content="{{#unless @main}}
<div>
data-name="{{username(profile.auth, profile.profile.name)}}"
data-level="{{profile.stats.lvl}}"
data-checkpet="{{profile.items.pet ? hasPet}}"
data-checkuser="{{profile.id == user.id ? isUser}}"
data-uid="{{profile.id}}" x-bind="click:clickAvatar"
rel="popover" data-placement="bottom" data-trigger="hover" data-html="true" data-content="
<div ng-show='profile.id == user.id'>
<div class='progress progress-danger' style='height:5px;'>
<div class='bar' style='height: 5px; width: {percent(@profile.stats.hp, 50)}%;'></div>
<div class='bar' style='height: 5px; width: {{percent(profile.stats.hp, 50)}}%;'></div>
</div>
<div class='progress progress-warning' style='height:5px;'>
<div class='bar' style='height: 5px; width: {percent(@profile.stats.exp, tnl(@profile.stats.lvl))}%;'></div>
<div class='bar' style='height: 5px; width: {{percent(profile.stats.exp, tnl(profile.stats.lvl))}}%;'></div>
</div>
<div>Level: {@profile.stats.lvl}</div>
<div>GP: {floor(@profile.stats.gp)}</div>
<div>{count(@profile.items.pets)} / 90 Pets Found</div>
</div>
{{/}}">
<div>Level: {{profile.stats.lvl}}</div>
<div>GP: {{profile.stats.gp | number:0)}}</div>
<div>{{count(profile.items.pets)}} / 90 Pets Found</div>
</div>">
<div class='character-sprites'>
{#with @profile.preferences as :p}
<span class='{#if @profile.flags.rest}zzz{/}'></span>
<span class='{:p.gender}_skin_{:p.skin}'></span>
<span class='{:p.gender}_hair_{:p.hair}'></span>
<span class="{equipped('armor', @profile.items.armor, @profile.preferences, @profile.backer.tier)}"></span>
{#if :p.showHelm}
<span class="{equipped('head', @profile.items.head, @profile.preferences, @profile.backer.tier)}"></span>
{else}
<span class="{:p.gender}_head_0"></span>
{/}
<span class="{equipped('shield', @profile.items.shield, @profile.preferences, @profile.backer.tier)}"></span>
<span class="{equipped('weapon', @profile.items.weapon, @profile.preferences, @profile.backer.tier)}"></span>
{/}
{#if and(@profile.items.currentPet, not(@minimal))}
<span class="Pet-{@profile.items.currentPet.name}-{@profile.items.currentPet.modifier} current-pet" ></span>
{/}
<span class='{zzz: profile.flags.rest}'></span>
<span class='{{profile.preferences.gender}}_skin_{{profile.preferences.skin}}'></span>
<span class='{{profile.preferences.gender}}_hair_{{profile.preferences.hair}}'></span>
<span class="{{equipped('armor', profile.items.armor, profile.preferences, profile.backer.tier)}}"></span>
<span ng-show='profile.preferences.showHelm' class="{{equipped('head', profile.items.head, profile.preferences, profile.backer.tier)}}"></span>
<span ng-hide='profile.preferences.showHelm' class="{{profile.preferences.gender}}_head_0"></span>
<span class="{{equipped('shield', profile.items.shield, profile.preferences, profile.backer.tier)}}"></span>
<span class="{{equipped('weapon', profile.items.weapon, profile.preferences, profile.backer.tier)}}"></span>
<!-- FIXME handle @minimal, this might have to be a directive -->
<span ng-show='profile.items.currentPet && !minimal' class="Pet-{{profile.items.currentPet.name}}-{{profile.items.currentPet.modifier}} current-pet" ></span>
</div>
<div class='avatar-level'>Lvl {@profile.stats.lvl}</div>
<div class='avatar-level'>Lvl {{profile.stats.lvl}}</div>
</figure>
<profile-stats:>