Generate new browser code

This commit is contained in:
Cole Gleason 2014-01-09 13:22:50 -06:00
parent c4e7e13ee1
commit c967c1c21d

View file

@ -27,7 +27,8 @@ process.nextTick = (function () {
if (canPost) { if (canPost) {
var queue = []; var queue = [];
window.addEventListener('message', function (ev) { window.addEventListener('message', function (ev) {
if (ev.source === window && ev.data === 'process-tick') { var source = ev.source;
if ((source === window || source === null) && ev.data === 'process-tick') {
ev.stopPropagation(); ev.stopPropagation();
if (queue.length > 0) { if (queue.length > 0) {
var fn = queue.shift(); var fn = queue.shift();
@ -63,7 +64,7 @@ process.chdir = function (dir) {
}; };
},{}],3:[function(require,module,exports){ },{}],3:[function(require,module,exports){
var global=self;/** var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/**
* @license * @license
* Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/> * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
* Build: `lodash modern -o ./dist/lodash.js` * Build: `lodash modern -o ./dist/lodash.js`
@ -9397,6 +9398,7 @@ var global=self;/**
value: 150, value: 150,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 70; return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 70;
}) })
}, },
@ -9410,6 +9412,7 @@ var global=self;/**
value: 170, value: 170,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.contributor) != null ? _ref.level : void 0) >= 4; return +((_ref = u.contributor) != null ? _ref.level : void 0) >= 4;
}) })
}, },
@ -9421,6 +9424,7 @@ var global=self;/**
value: 200, value: 200,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 300; return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 300;
}) })
}, },
@ -9433,6 +9437,7 @@ var global=self;/**
value: 200, value: 200,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 300; return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 300;
}) })
}, },
@ -9628,6 +9633,7 @@ var global=self;/**
value: 150, value: 150,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 45; return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 45;
}) })
}, },
@ -9641,6 +9647,7 @@ var global=self;/**
value: 170, value: 170,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.contributor) != null ? _ref.level : void 0) >= 2; return +((_ref = u.contributor) != null ? _ref.level : void 0) >= 2;
}) })
}, },
@ -9652,6 +9659,7 @@ var global=self;/**
value: 200, value: 200,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 300; return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 300;
}) })
}, },
@ -9845,6 +9853,7 @@ var global=self;/**
value: 150, value: 150,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 45; return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 45;
}) })
}, },
@ -9858,6 +9867,7 @@ var global=self;/**
value: 170, value: 170,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.contributor) != null ? _ref.level : void 0) >= 3; return +((_ref = u.contributor) != null ? _ref.level : void 0) >= 3;
}) })
}, },
@ -9869,6 +9879,7 @@ var global=self;/**
value: 200, value: 200,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 300; return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 300;
}) })
}, },
@ -10048,6 +10059,7 @@ var global=self;/**
value: 150, value: 150,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 45; return +((_ref = u.backer) != null ? _ref.tier : void 0) >= 45;
}) })
}, },
@ -10061,6 +10073,7 @@ var global=self;/**
value: 170, value: 170,
canOwn: (function(u) { canOwn: (function(u) {
var _ref; var _ref;
return +((_ref = u.contributor) != null ? _ref.level : void 0) >= 5; return +((_ref = u.contributor) != null ? _ref.level : void 0) >= 5;
}) })
}, },
@ -10113,6 +10126,7 @@ var global=self;/**
return _.each(['base', 'warrior', 'rogue', 'healer', 'wizard', 'special'], function(klass) { return _.each(['base', 'warrior', 'rogue', 'healer', 'wizard', 'special'], function(klass) {
return _.each(gear[type][klass], function(item, i) { return _.each(gear[type][klass], function(item, i) {
var key, _canOwn; var key, _canOwn;
key = "" + type + "_" + klass + "_" + i; key = "" + type + "_" + klass + "_" + i;
_.defaults(item, { _.defaults(item, {
type: type, type: type,
@ -10191,6 +10205,7 @@ var global=self;/**
notes: 'With a crack, flames burst from your staff, scorching a task. You deal high damage to the task, and gain additional experience (more experience for greens).', notes: 'With a crack, flames burst from your staff, scorching a task. You deal high damage to the task, and gain additional experience (more experience for greens).',
cast: function(user, target) { cast: function(user, target) {
var bonus; var bonus;
bonus = user._statsComputed.int * user.fns.crit('per'); bonus = user._statsComputed.int * user.fns.crit('per');
target.value += diminishingReturns(bonus * .02, 4); target.value += diminishingReturns(bonus * .02, 4);
bonus *= Math.ceil((target.value < 0 ? 1 : target.value + 1) * .075); bonus *= Math.ceil((target.value < 0 ? 1 : target.value + 1) * .075);
@ -10209,6 +10224,7 @@ var global=self;/**
cast: function(user, target) { cast: function(user, target) {
return _.each(target, function(member) { return _.each(target, function(member) {
var bonus; var bonus;
bonus = Math.ceil(user._statsComputed.int * .1); bonus = Math.ceil(user._statsComputed.int * .1);
if (bonus > 25) { if (bonus > 25) {
bonus = 25; bonus = 25;
@ -10225,8 +10241,9 @@ var global=self;/**
notes: "The ground below your party's tasks cracks and shakes with extreme intensity, slowing them down and opening them up to more attacks. Your party gains a buff to experience.", notes: "The ground below your party's tasks cracks and shakes with extreme intensity, slowing them down and opening them up to more attacks. Your party gains a buff to experience.",
cast: function(user, target) { cast: function(user, target) {
return _.each(target, function(member) { return _.each(target, function(member) {
var _base; var _base, _ref;
if ((_base = member.stats.buffs).int == null) {
if ((_ref = (_base = member.stats.buffs).int) == null) {
_base.int = 0; _base.int = 0;
} }
return member.stats.buffs.int += Math.ceil(user._statsComputed.int * .05); return member.stats.buffs.int += Math.ceil(user._statsComputed.int * .05);
@ -10265,8 +10282,9 @@ var global=self;/**
target: 'self', target: 'self',
notes: "You take a moment to relax your body and enter a defensive stance to ready yourself for the tasks' next onslaught. Reduces damage from dailies at the end of the day.", notes: "You take a moment to relax your body and enter a defensive stance to ready yourself for the tasks' next onslaught. Reduces damage from dailies at the end of the day.",
cast: function(user, target) { cast: function(user, target) {
var _base; var _base, _ref;
if ((_base = user.stats.buffs).con == null) {
if ((_ref = (_base = user.stats.buffs).con) == null) {
_base.con = 0; _base.con = 0;
} }
return user.stats.buffs.con += Math.ceil(user._statsComputed.con * .05); return user.stats.buffs.con += Math.ceil(user._statsComputed.con * .05);
@ -10280,8 +10298,9 @@ var global=self;/**
notes: "Your presence emboldens the party. Their newfound courage gives them a boost of strength. Party members gain a buff to their STR.", notes: "Your presence emboldens the party. Their newfound courage gives them a boost of strength. Party members gain a buff to their STR.",
cast: function(user, target) { cast: function(user, target) {
return _.each(target, function(member) { return _.each(target, function(member) {
var _base; var _base, _ref;
if ((_base = member.stats.buffs).str == null) {
if ((_ref = (_base = member.stats.buffs).str) == null) {
_base.str = 0; _base.str = 0;
} }
return member.stats.buffs.str += Math.ceil(user._statsComputed.str * .05); return member.stats.buffs.str += Math.ceil(user._statsComputed.str * .05);
@ -10296,8 +10315,9 @@ var global=self;/**
notes: "Your gaze strikes fear into the hearts of your party's enemies. The party gains a moderate boost to defense.", notes: "Your gaze strikes fear into the hearts of your party's enemies. The party gains a moderate boost to defense.",
cast: function(user, target) { cast: function(user, target) {
return _.each(target, function(member) { return _.each(target, function(member) {
var _base; var _base, _ref;
if ((_base = member.stats.buffs).con == null) {
if ((_ref = (_base = member.stats.buffs).con) == null) {
_base.con = 0; _base.con = 0;
} }
return member.stats.buffs.con += Math.ceil(user._statsComputed.con * .03); return member.stats.buffs.con += Math.ceil(user._statsComputed.con * .03);
@ -10324,6 +10344,7 @@ var global=self;/**
notes: "Without a sound, you sweep behind a task and stab it in the back. You deal higher damage to the task, with a higher chance of a critical hit.", notes: "Without a sound, you sweep behind a task and stab it in the back. You deal higher damage to the task, with a higher chance of a critical hit.",
cast: function(user, target) { cast: function(user, target) {
var bonus, _crit; var bonus, _crit;
_crit = user.fns.crit('per', .3); _crit = user.fns.crit('per', .3);
target.value += _crit * .03; target.value += _crit * .03;
bonus = (target.value < 0 ? 1 : target.value + 1) * _crit; bonus = (target.value < 0 ? 1 : target.value + 1) * _crit;
@ -10339,8 +10360,9 @@ var global=self;/**
notes: "You share your thievery tools with the party to aid them in 'acquiring' more gold. The party's gold bonus for tasks and chance of drops is buffed for a day.", notes: "You share your thievery tools with the party to aid them in 'acquiring' more gold. The party's gold bonus for tasks and chance of drops is buffed for a day.",
cast: function(user, target) { cast: function(user, target) {
return _.each(target, function(member) { return _.each(target, function(member) {
var _base; var _base, _ref;
if ((_base = member.stats.buffs).per == null) {
if ((_ref = (_base = member.stats.buffs).per) == null) {
_base.per = 0; _base.per = 0;
} }
return member.stats.buffs.per += Math.ceil(user._statsComputed.per * .03); return member.stats.buffs.per += Math.ceil(user._statsComputed.per * .03);
@ -10354,8 +10376,9 @@ var global=self;/**
target: 'self', target: 'self',
notes: "You duck into the shadows, pulling up your hood. Many dailies won't find you this night; fewer yet the higher your Perception.", notes: "You duck into the shadows, pulling up your hood. Many dailies won't find you this night; fewer yet the higher your Perception.",
cast: function(user, target) { cast: function(user, target) {
var _base; var _base, _ref;
if ((_base = user.stats.buffs).stealth == null) {
if ((_ref = (_base = user.stats.buffs).stealth) == null) {
_base.stealth = 0; _base.stealth = 0;
} }
return user.stats.buffs.stealth += Math.ceil(user._statsComputed.per * .03); return user.stats.buffs.stealth += Math.ceil(user._statsComputed.per * .03);
@ -10399,8 +10422,9 @@ var global=self;/**
notes: "A magical aura surrounds your party members, protecting them from damage. Your party members gain a buff to their defense.", notes: "A magical aura surrounds your party members, protecting them from damage. Your party members gain a buff to their defense.",
cast: function(user, target) { cast: function(user, target) {
return _.each(target, function(member) { return _.each(target, function(member) {
var _base; var _base, _ref;
if ((_base = member.stats.buffs).con == null) {
if ((_ref = (_base = member.stats.buffs).con) == null) {
_base.con = 0; _base.con = 0;
} }
return member.stats.buffs.con += Math.ceil(user._statsComputed.con * .15); return member.stats.buffs.con += Math.ceil(user._statsComputed.con * .15);
@ -10431,9 +10455,10 @@ var global=self;/**
target: 'user', target: 'user',
notes: "Throw a snowball at a party member, what could possibly go wrong? Lasts until member's new day.", notes: "Throw a snowball at a party member, what could possibly go wrong? Lasts until member's new day.",
cast: function(user, target) { cast: function(user, target) {
var _base; var _base, _ref;
target.stats.buffs.snowball = true; target.stats.buffs.snowball = true;
if ((_base = target.achievements).snowball == null) { if ((_ref = (_base = target.achievements).snowball) == null) {
_base.snowball = 0; _base.snowball = 0;
} }
target.achievements.snowball++; target.achievements.snowball++;
@ -10457,6 +10482,7 @@ var global=self;/**
_.each(api.spells, function(spellClass) { _.each(api.spells, function(spellClass) {
return _.each(spellClass, function(spell, key) { return _.each(spellClass, function(spell, key) {
var _cast; var _cast;
spell.key = key; spell.key = key;
_cast = spell.cast; _cast = spell.cast;
return spell.cast = function(user, target) { return spell.cast = function(user, target) {
@ -10837,6 +10863,7 @@ var process=require("__browserify_process");(function() {
sanitizeOptions = function(o) { sanitizeOptions = function(o) {
var dayStart, now, timezoneOffset, _ref; var dayStart, now, timezoneOffset, _ref;
dayStart = !_.isNaN(+o.dayStart) && (0 <= (_ref = +o.dayStart) && _ref <= 24) ? +o.dayStart : 0; dayStart = !_.isNaN(+o.dayStart) && (0 <= (_ref = +o.dayStart) && _ref <= 24) ? +o.dayStart : 0;
timezoneOffset = o.timezoneOffset ? +o.timezoneOffset : +moment().zone(); timezoneOffset = o.timezoneOffset ? +o.timezoneOffset : +moment().zone();
now = o.now ? moment(o.now).zone(timezoneOffset) : moment(+(new Date)).zone(timezoneOffset); now = o.now ? moment(o.now).zone(timezoneOffset) : moment(+(new Date)).zone(timezoneOffset);
@ -10849,6 +10876,7 @@ var process=require("__browserify_process");(function() {
api.startOfWeek = api.startOfWeek = function(options) { api.startOfWeek = api.startOfWeek = function(options) {
var o; var o;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -10858,6 +10886,7 @@ var process=require("__browserify_process");(function() {
api.startOfDay = function(options) { api.startOfDay = function(options) {
var o; var o;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -10882,6 +10911,7 @@ var process=require("__browserify_process");(function() {
api.daysSince = function(yesterday, options) { api.daysSince = function(yesterday, options) {
var o; var o;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -10898,6 +10928,7 @@ var process=require("__browserify_process");(function() {
api.shouldDo = function(day, repeat, options) { api.shouldDo = function(day, repeat, options) {
var o, selected, yesterday; var o, selected, yesterday;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -10963,12 +10994,14 @@ var process=require("__browserify_process");(function() {
preenHistory = function(history) { preenHistory = function(history) {
var newHistory, preen, thisMonth; var newHistory, preen, thisMonth;
history = _.filter(history, function(h) { history = _.filter(history, function(h) {
return !!h; return !!h;
}); });
newHistory = []; newHistory = [];
preen = function(amount, groupBy) { preen = function(amount, groupBy) {
var groups; var groups;
groups = _.chain(history).groupBy(function(h) { groups = _.chain(history).groupBy(function(h) {
return moment(h.date).format(groupBy); return moment(h.date).format(groupBy);
}).sortBy(function(h, k) { }).sortBy(function(h, k) {
@ -11002,12 +11035,14 @@ var process=require("__browserify_process");(function() {
api.updateStore = function(user) { api.updateStore = function(user) {
var changes; var changes;
if (!user) { if (!user) {
return; return;
} }
changes = []; changes = [];
_.each(['weapon', 'armor', 'shield', 'head'], function(type) { _.each(['weapon', 'armor', 'shield', 'head'], function(type) {
var found; var found;
found = _.find(content.gear.tree[type][user.stats["class"]], function(item) { found = _.find(content.gear.tree[type][user.stats["class"]], function(item) {
return !user.items.gear.owned[item.key]; return !user.items.gear.owned[item.key];
}); });
@ -11057,6 +11092,7 @@ var process=require("__browserify_process");(function() {
api.uuid = function() { api.uuid = function() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
var r, v; var r, v;
r = Math.random() * 16 | 0; r = Math.random() * 16 | 0;
v = (c === "x" ? r : r & 0x3 | 0x8); v = (c === "x" ? r : r & 0x3 | 0x8);
return v.toString(16); return v.toString(16);
@ -11076,7 +11112,8 @@ var process=require("__browserify_process");(function() {
api.taskDefaults = function(task) { api.taskDefaults = function(task) {
var defaults, _ref, _ref1, _ref2; var defaults, _ref, _ref1, _ref2, _ref3;
if (task == null) { if (task == null) {
task = {}; task = {};
} }
@ -11124,7 +11161,7 @@ var process=require("__browserify_process");(function() {
}); });
} }
task._id = task.id; task._id = task.id;
if (task.value == null) { if ((_ref3 = task.value) == null) {
task.value = task.type === 'reward' ? 10 : 0; task.value = task.type === 'reward' ? 10 : 0;
} }
if (!_.isNumber(task.priority)) { if (!_.isNumber(task.priority)) {
@ -11159,6 +11196,7 @@ var process=require("__browserify_process");(function() {
api.encodeiCalLink = function(uid, apiToken) { api.encodeiCalLink = function(uid, apiToken) {
var loc, _ref; var loc, _ref;
loc = (typeof window !== "undefined" && window !== null ? window.location.host : void 0) || (typeof process !== "undefined" && process !== null ? (_ref = process.env) != null ? _ref.BASE_URL : void 0 : void 0) || ''; loc = (typeof window !== "undefined" && window !== null ? window.location.host : void 0) || (typeof process !== "undefined" && process !== null ? (_ref = process.env) != null ? _ref.BASE_URL : void 0 : void 0) || '';
return encodeURIComponent("http://" + loc + "/v1/users/" + uid + "/calendar.ics?apiToken=" + apiToken); return encodeURIComponent("http://" + loc + "/v1/users/" + uid + "/calendar.ics?apiToken=" + apiToken);
}; };
@ -11196,6 +11234,7 @@ var process=require("__browserify_process");(function() {
api.taskClasses = function(task, filters, dayStart, lastCron, showCompleted, main) { api.taskClasses = function(task, filters, dayStart, lastCron, showCompleted, main) {
var classes, completed, enabled, filter, repeat, type, value, _ref; var classes, completed, enabled, filter, repeat, type, value, _ref;
if (filters == null) { if (filters == null) {
filters = []; filters = [];
} }
@ -11297,6 +11336,7 @@ var process=require("__browserify_process");(function() {
api.appliedTags = function(userTags, taskTags) { api.appliedTags = function(userTags, taskTags) {
var arr; var arr;
arr = []; arr = [];
_.each(userTags, function(t) { _.each(userTags, function(t) {
if (t == null) { if (t == null) {
@ -11311,6 +11351,7 @@ var process=require("__browserify_process");(function() {
api.countPets = function(originalCount, pets) { api.countPets = function(originalCount, pets) {
var count, pet; var count, pet;
count = originalCount != null ? originalCount : _.size(pets); count = originalCount != null ? originalCount : _.size(pets);
for (pet in content.specialPets) { for (pet in content.specialPets) {
if (pets[pet]) { if (pets[pet]) {
@ -11381,6 +11422,7 @@ var process=require("__browserify_process");(function() {
}, },
revive: function(req, cb) { revive: function(req, cb) {
var item, lostItem, lostStat; var item, lostItem, lostStat;
_.merge(user.stats, { _.merge(user.stats, {
hp: 50, hp: 50,
exp: 0, exp: 0,
@ -11423,6 +11465,7 @@ var process=require("__browserify_process");(function() {
}, },
reset: function(req, cb) { reset: function(req, cb) {
var gear; var gear;
user.habits = []; user.habits = [];
user.dailys = []; user.dailys = [];
user.todos = []; user.todos = [];
@ -11465,6 +11508,7 @@ var process=require("__browserify_process");(function() {
}, },
rebirth: function(req, cb) { rebirth: function(req, cb) {
var flags, gear, lvl, stats; var flags, gear, lvl, stats;
if (user.balance < 2) { if (user.balance < 2) {
return typeof cb === "function" ? cb({ return typeof cb === "function" ? cb({
code: 401, code: 401,
@ -11542,6 +11586,7 @@ var process=require("__browserify_process");(function() {
clearCompleted: function(req, cb) { clearCompleted: function(req, cb) {
_.remove(user.todos, function(t) { _.remove(user.todos, function(t) {
var _ref; var _ref;
return t.completed && !((_ref = t.challenge) != null ? _ref.id : void 0); return t.completed && !((_ref = t.challenge) != null ? _ref.id : void 0);
}); });
if (typeof user.markModified === "function") { if (typeof user.markModified === "function") {
@ -11551,6 +11596,7 @@ var process=require("__browserify_process");(function() {
}, },
sortTask: function(req, cb) { sortTask: function(req, cb) {
var from, id, task, tasks, to, _ref; var from, id, task, tasks, to, _ref;
id = req.params.id; id = req.params.id;
_ref = req.query, to = _ref.to, from = _ref.from; _ref = req.query, to = _ref.to, from = _ref.from;
task = user.tasks[id]; task = user.tasks[id];
@ -11569,6 +11615,7 @@ var process=require("__browserify_process");(function() {
}, },
updateTask: function(req, cb) { updateTask: function(req, cb) {
var task, _ref; var task, _ref;
if (!(task = user.tasks[(_ref = req.params) != null ? _ref.id : void 0])) { if (!(task = user.tasks[(_ref = req.params) != null ? _ref.id : void 0])) {
return typeof cb === "function" ? cb("Task not found") : void 0; return typeof cb === "function" ? cb("Task not found") : void 0;
} }
@ -11583,6 +11630,7 @@ var process=require("__browserify_process");(function() {
}, },
deleteTask: function(req, cb) { deleteTask: function(req, cb) {
var i, task, _ref; var i, task, _ref;
task = user.tasks[(_ref = req.params) != null ? _ref.id : void 0]; task = user.tasks[(_ref = req.params) != null ? _ref.id : void 0];
if (!task) { if (!task) {
return typeof cb === "function" ? cb({ return typeof cb === "function" ? cb({
@ -11598,6 +11646,7 @@ var process=require("__browserify_process");(function() {
}, },
addTask: function(req, cb) { addTask: function(req, cb) {
var task; var task;
task = api.taskDefaults(req.body); task = api.taskDefaults(req.body);
user["" + task.type + "s"].unshift(task); user["" + task.type + "s"].unshift(task);
if (user.preferences.newTaskEdit) { if (user.preferences.newTaskEdit) {
@ -11609,7 +11658,9 @@ var process=require("__browserify_process");(function() {
return task; return task;
}, },
addTag: function(req, cb) { addTag: function(req, cb) {
if (user.tags == null) { var _ref;
if ((_ref = user.tags) == null) {
user.tags = []; user.tags = [];
} }
user.tags.push({ user.tags.push({
@ -11620,6 +11671,7 @@ var process=require("__browserify_process");(function() {
}, },
updateTag: function(req, cb) { updateTag: function(req, cb) {
var i, tid; var i, tid;
tid = req.params.id; tid = req.params.id;
i = _.findIndex(user.tags, { i = _.findIndex(user.tags, {
id: tid id: tid
@ -11632,6 +11684,7 @@ var process=require("__browserify_process");(function() {
}, },
deleteTag: function(req, cb) { deleteTag: function(req, cb) {
var i, tag, tid; var i, tag, tid;
tid = req.params.id; tid = req.params.id;
i = _.findIndex(user.tags, { i = _.findIndex(user.tags, {
id: tid id: tid
@ -11652,6 +11705,7 @@ var process=require("__browserify_process");(function() {
}, },
feed: function(req, cb) { feed: function(req, cb) {
var egg, evolve, food, message, pet, potion, userPets, _ref, _ref1, _ref2; var egg, evolve, food, message, pet, potion, userPets, _ref, _ref1, _ref2;
_ref = req.params, pet = _ref.pet, food = _ref.food; _ref = req.params, pet = _ref.pet, food = _ref.food;
food = content.food[food]; food = content.food[food];
_ref1 = pet.split('-'), egg = _ref1[0], potion = _ref1[1]; _ref1 = pet.split('-'), egg = _ref1[0], potion = _ref1[1];
@ -11711,6 +11765,7 @@ var process=require("__browserify_process");(function() {
}, },
purchase: function(req, cb) { purchase: function(req, cb) {
var item, key, type, _ref; var item, key, type, _ref;
_ref = req.params, type = _ref.type, key = _ref.key; _ref = req.params, type = _ref.type, key = _ref.key;
if (type !== 'eggs' && type !== 'hatchingPotions' && type !== 'food' && type !== 'quests' && type !== 'special') { if (type !== 'eggs' && type !== 'hatchingPotions' && type !== 'food' && type !== 'quests' && type !== 'special') {
return typeof cb === "function" ? cb({ return typeof cb === "function" ? cb({
@ -11734,6 +11789,7 @@ var process=require("__browserify_process");(function() {
}, },
buy: function(req, cb) { buy: function(req, cb) {
var item, key, message, _ref; var item, key, message, _ref;
key = req.params.key; key = req.params.key;
item = key === 'potion' ? content.potion : content.gear.flat[key]; item = key === 'potion' ? content.potion : content.gear.flat[key];
if (!item) { if (!item) {
@ -11772,6 +11828,7 @@ var process=require("__browserify_process");(function() {
}, },
sell: function(req, cb) { sell: function(req, cb) {
var key, type, _ref; var key, type, _ref;
_ref = req.params, key = _ref.key, type = _ref.type; _ref = req.params, key = _ref.key, type = _ref.type;
if (type !== 'eggs' && type !== 'hatchingPotions' && type !== 'food') { if (type !== 'eggs' && type !== 'hatchingPotions' && type !== 'food') {
return typeof cb === "function" ? cb({ return typeof cb === "function" ? cb({
@ -11791,6 +11848,7 @@ var process=require("__browserify_process");(function() {
}, },
equip: function(req, cb) { equip: function(req, cb) {
var item, key, message, type, _ref; var item, key, message, type, _ref;
_ref = [req.params.type || 'equipped', req.params.key], type = _ref[0], key = _ref[1]; _ref = [req.params.type || 'equipped', req.params.key], type = _ref[0], key = _ref[1];
switch (type) { switch (type) {
case 'mount': case 'mount':
@ -11812,6 +11870,7 @@ var process=require("__browserify_process");(function() {
}, },
hatch: function(req, cb) { hatch: function(req, cb) {
var egg, hatchingPotion, pet, _ref; var egg, hatchingPotion, pet, _ref;
_ref = req.params, egg = _ref.egg, hatchingPotion = _ref.hatchingPotion; _ref = req.params, egg = _ref.egg, hatchingPotion = _ref.hatchingPotion;
if (!(egg && hatchingPotion)) { if (!(egg && hatchingPotion)) {
return typeof cb === "function" ? cb({ return typeof cb === "function" ? cb({
@ -11839,6 +11898,7 @@ var process=require("__browserify_process");(function() {
}, },
unlock: function(req, cb) { unlock: function(req, cb) {
var alreadyOwns, cost, fullSet, k, path, split, v; var alreadyOwns, cost, fullSet, k, path, split, v;
path = req.query.path; path = req.query.path;
fullSet = ~path.indexOf(","); fullSet = ~path.indexOf(",");
cost = fullSet ? 1.25 : 0.5; cost = fullSet ? 1.25 : 0.5;
@ -11872,12 +11932,14 @@ var process=require("__browserify_process");(function() {
}, },
changeClass: function(req, cb) { changeClass: function(req, cb) {
var klass, _ref; var klass, _ref;
klass = (_ref = req.query) != null ? _ref["class"] : void 0; klass = (_ref = req.query) != null ? _ref["class"] : void 0;
if (klass === 'warrior' || klass === 'rogue' || klass === 'wizard' || klass === 'healer') { if (klass === 'warrior' || klass === 'rogue' || klass === 'wizard' || klass === 'healer') {
user.stats["class"] = klass; user.stats["class"] = klass;
user.flags.classSelected = true; user.flags.classSelected = true;
_.each(["weapon", "armor", "shield", "head"], function(type) { _.each(["weapon", "armor", "shield", "head"], function(type) {
var foundKey; var foundKey;
foundKey = false; foundKey = false;
_.findLast(user.items.gear.owned, function(v, k) { _.findLast(user.items.gear.owned, function(v, k) {
if (~k.indexOf(type + "_" + klass) && v === true) { if (~k.indexOf(type + "_" + klass) && v === true) {
@ -11925,6 +11987,7 @@ var process=require("__browserify_process");(function() {
}, },
allocate: function(req, cb) { allocate: function(req, cb) {
var stat; var stat;
stat = req.query.stat || 'str'; stat = req.query.stat || 'str';
if (user.stats.points > 0) { if (user.stats.points > 0) {
user.stats[stat]++; user.stats[stat]++;
@ -11936,7 +11999,8 @@ var process=require("__browserify_process");(function() {
return typeof cb === "function" ? cb(null, _.pick(user, $w('stats'))) : void 0; return typeof cb === "function" ? cb(null, _.pick(user, $w('stats'))) : void 0;
}, },
score: function(req, cb) { score: function(req, cb) {
var addPoints, calculateDelta, delta, direction, id, mpDelta, num, options, stats, subtractPoints, task, th, _ref, _ref1, _ref2; var addPoints, calculateDelta, delta, direction, id, mpDelta, multiplier, num, options, stats, subtractPoints, task, th, _ref, _ref1, _ref2, _ref3;
_ref = req.params, id = _ref.id, direction = _ref.direction; _ref = req.params, id = _ref.id, direction = _ref.direction;
task = user.tasks[id]; task = user.tasks[id];
options = req.query || {}; options = req.query || {};
@ -11952,7 +12016,7 @@ var process=require("__browserify_process");(function() {
}; };
task.value = +task.value; task.value = +task.value;
task.streak = ~~task.streak; task.streak = ~~task.streak;
if (task.priority == null) { if ((_ref1 = task.priority) == null) {
task.priority = 1; task.priority = 1;
} }
if (task.value > stats.gp && task.type === 'reward') { if (task.value > stats.gp && task.type === 'reward') {
@ -11961,10 +12025,11 @@ var process=require("__browserify_process");(function() {
delta = 0; delta = 0;
calculateDelta = function() { calculateDelta = function() {
return _.times(options.times, function() { return _.times(options.times, function() {
var adjustAmt, currVal, nextDelta, _ref1, _ref2; var adjustAmt, currVal, nextDelta, _ref2, _ref3;
currVal = task.value < -47.27 ? -47.27 : task.value > 21.27 ? 21.27 : task.value; currVal = task.value < -47.27 ? -47.27 : task.value > 21.27 ? 21.27 : task.value;
nextDelta = Math.pow(0.9747, currVal) * (direction === 'down' ? -1 : 1); nextDelta = Math.pow(0.9747, currVal) * (direction === 'down' ? -1 : 1);
if (((_ref1 = task.checklist) != null ? _ref1.length : void 0) > 0) { if (((_ref2 = task.checklist) != null ? _ref2.length : void 0) > 0) {
if (direction === 'down' && task.type === 'daily' && options.cron) { if (direction === 'down' && task.type === 'daily' && options.cron) {
nextDelta *= 1 - _.reduce(task.checklist, (function(m, i) { nextDelta *= 1 - _.reduce(task.checklist, (function(m, i) {
return m + (i.completed ? 1 : 0); return m + (i.completed ? 1 : 0);
@ -11982,7 +12047,7 @@ var process=require("__browserify_process");(function() {
if (direction === 'up' && task.type !== 'reward' && !(task.type === 'habit' && !task.down)) { if (direction === 'up' && task.type !== 'reward' && !(task.type === 'habit' && !task.down)) {
adjustAmt = nextDelta * (1 + user._statsComputed.str * .004); adjustAmt = nextDelta * (1 + user._statsComputed.str * .004);
user.party.quest.progress.up = user.party.quest.progress.up || 0; user.party.quest.progress.up = user.party.quest.progress.up || 0;
if ((_ref2 = task.type) === 'daily' || _ref2 === 'todo') { if ((_ref3 = task.type) === 'daily' || _ref3 === 'todo') {
user.party.quest.progress.up += adjustAmt; user.party.quest.progress.up += adjustAmt;
} }
} }
@ -11993,6 +12058,7 @@ var process=require("__browserify_process");(function() {
}; };
addPoints = function() { addPoints = function() {
var afterStreak, gpMod, intBonus, perBonus, streakBonus, _crit; var afterStreak, gpMod, intBonus, perBonus, streakBonus, _crit;
_crit = user.fns.crit(); _crit = user.fns.crit();
if (_crit > 1) { if (_crit > 1) {
user._tmp.crit = _crit; user._tmp.crit = _crit;
@ -12005,6 +12071,7 @@ var process=require("__browserify_process");(function() {
}; };
subtractPoints = function() { subtractPoints = function() {
var conBonus, hpMod; var conBonus, hpMod;
conBonus = 1 - (user._statsComputed.con / 250); conBonus = 1 - (user._statsComputed.con / 250);
if (conBonus < .1) { if (conBonus < .1) {
conBonus = 0.1; conBonus = 0.1;
@ -12020,7 +12087,7 @@ var process=require("__browserify_process");(function() {
} else { } else {
subtractPoints(); subtractPoints();
} }
th = (task.history != null ? task.history : task.history = []); th = ((_ref2 = task.history) != null ? _ref2 : task.history = []);
if (th[th.length - 1] && moment(th[th.length - 1].date).isSame(new Date, 'day')) { if (th[th.length - 1] && moment(th[th.length - 1].date).isSame(new Date, 'day')) {
th[th.length - 1].value = task.value; th[th.length - 1].value = task.value;
} else { } else {
@ -12064,7 +12131,8 @@ var process=require("__browserify_process");(function() {
} else { } else {
calculateDelta(); calculateDelta();
addPoints(); addPoints();
mpDelta = _.max([1 + (((_ref1 = task.checklist) != null ? _ref1.length : void 0) || 0), .01 * user._statsComputed.maxMP * (1 + (((_ref2 = task.checklist) != null ? _ref2.length : void 0) || 0))]); multiplier = ((_ref3 = task.checklist) != null ? _ref3.length : void 0) || 1;
mpDelta = _.max([multiplier, .01 * user._statsComputed.maxMP * multiplier]);
if (direction === 'down') { if (direction === 'down') {
mpDelta *= -1; mpDelta *= -1;
} }
@ -12105,6 +12173,7 @@ var process=require("__browserify_process");(function() {
user.fns = { user.fns = {
getItem: function(type) { getItem: function(type) {
var item; var item;
item = content.gear.flat[user.items.gear.equipped[type]]; item = content.gear.flat[user.items.gear.equipped[type]];
if (!item) { if (!item) {
return content.gear.flat["" + type + "_base_0"]; return content.gear.flat["" + type + "_base_0"];
@ -12113,6 +12182,7 @@ var process=require("__browserify_process");(function() {
}, },
handleTwoHanded: function(item, type) { handleTwoHanded: function(item, type) {
var message, weapon, _ref; var message, weapon, _ref;
if (type == null) { if (type == null) {
type = 'equipped'; type = 'equipped';
} }
@ -12133,6 +12203,7 @@ var process=require("__browserify_process");(function() {
predictableRandom: function(seed) { predictableRandom: function(seed) {
var x; var x;
if (!seed || seed === Math.PI) { if (!seed || seed === Math.PI) {
seed = _.reduce(user.stats, (function(m, v) { seed = _.reduce(user.stats, (function(m, v) {
if (_.isNumber(v)) { if (_.isNumber(v)) {
@ -12166,6 +12237,7 @@ var process=require("__browserify_process");(function() {
randomVal: function(obj, options) { randomVal: function(obj, options) {
var count, key, result, val; var count, key, result, val;
result = void 0; result = void 0;
count = 0; count = 0;
for (key in obj) { for (key in obj) {
@ -12186,22 +12258,27 @@ var process=require("__browserify_process");(function() {
dotSet: function(path, val) { dotSet: function(path, val) {
var arr, var arr,
_this = this; _this = this;
arr = path.split('.'); arr = path.split('.');
return _.reduce(arr, function(curr, next, index) { return _.reduce(arr, function(curr, next, index) {
var _ref;
if ((arr.length - 1) === index) { if ((arr.length - 1) === index) {
curr[next] = val; curr[next] = val;
} }
return curr[next] != null ? curr[next] : curr[next] = {}; return (_ref = curr[next]) != null ? _ref : curr[next] = {};
}, user); }, user);
}, },
dotGet: function(path) { dotGet: function(path) {
var _this = this; var _this = this;
return _.reduce(path.split('.'), (function(curr, next) { return _.reduce(path.split('.'), (function(curr, next) {
return curr != null ? curr[next] : void 0; return curr != null ? curr[next] : void 0;
}), user); }), user);
}, },
randomDrop: function(modifiers) { randomDrop: function(modifiers) {
var acceptableDrops, bonus, chance, drop, dropK, quest, rarity, task, _base, _base1, _base2, _name, _name1, _name2, _ref, _ref1; var acceptableDrops, bonus, chance, drop, dropK, quest, rarity, task, _base, _base1, _base2, _name, _name1, _name2, _ref, _ref1, _ref2, _ref3, _ref4;
task = modifiers.task; task = modifiers.task;
bonus = Math.abs(task.value) * task.priority + (task.streak || 0) + (user._statsComputed.per * .5); bonus = Math.abs(task.value) * task.priority + (task.streak || 0) + (user._statsComputed.per * .5);
bonus /= 100; bonus /= 100;
@ -12227,7 +12304,7 @@ var process=require("__browserify_process");(function() {
rarity = user.fns.predictableRandom(user.stats.gp); rarity = user.fns.predictableRandom(user.stats.gp);
if (rarity > .6) { if (rarity > .6) {
drop = user.fns.randomVal(_.omit(content.food, 'Saddle')); drop = user.fns.randomVal(_.omit(content.food, 'Saddle'));
if ((_base = user.items.food)[_name = drop.key] == null) { if ((_ref2 = (_base = user.items.food)[_name = drop.key]) == null) {
_base[_name] = 0; _base[_name] = 0;
} }
user.items.food[drop.key] += 1; user.items.food[drop.key] += 1;
@ -12235,7 +12312,7 @@ var process=require("__browserify_process");(function() {
drop.dialog = "You've found " + drop.article + drop.text + "! " + drop.notes; drop.dialog = "You've found " + drop.article + drop.text + "! " + drop.notes;
} else if (rarity > .3) { } else if (rarity > .3) {
drop = user.fns.randomVal(content.eggs); drop = user.fns.randomVal(content.eggs);
if ((_base1 = user.items.eggs)[_name1 = drop.key] == null) { if ((_ref3 = (_base1 = user.items.eggs)[_name1 = drop.key]) == null) {
_base1[_name1] = 0; _base1[_name1] = 0;
} }
user.items.eggs[drop.key]++; user.items.eggs[drop.key]++;
@ -12246,7 +12323,7 @@ var process=require("__browserify_process");(function() {
drop = user.fns.randomVal(_.pick(content.hatchingPotions, (function(v, k) { drop = user.fns.randomVal(_.pick(content.hatchingPotions, (function(v, k) {
return __indexOf.call(acceptableDrops, k) >= 0; return __indexOf.call(acceptableDrops, k) >= 0;
}))); })));
if ((_base2 = user.items.hatchingPotions)[_name2 = drop.key] == null) { if ((_ref4 = (_base2 = user.items.hatchingPotions)[_name2 = drop.key]) == null) {
_base2[_name2] = 0; _base2[_name2] = 0;
} }
user.items.hatchingPotions[drop.key]++; user.items.hatchingPotions[drop.key]++;
@ -12267,6 +12344,7 @@ var process=require("__browserify_process");(function() {
autoAllocate: function() { autoAllocate: function() {
return user.stats[(function() { return user.stats[(function() {
var diff, ideal, preference, stats, suggested; var diff, ideal, preference, stats, suggested;
switch (user.preferences.allocationMode) { switch (user.preferences.allocationMode) {
case "flat": case "flat":
stats = _.pick(user.stats, $w('con str per int')); stats = _.pick(user.stats, $w('con str per int'));
@ -12311,7 +12389,8 @@ var process=require("__browserify_process");(function() {
})()]++; })()]++;
}, },
updateStats: function(stats) { updateStats: function(stats) {
var tnl; var tnl, _ref;
if (stats.hp <= 0) { if (stats.hp <= 0) {
return user.stats.hp = 0; return user.stats.hp = 0;
} }
@ -12342,7 +12421,7 @@ var process=require("__browserify_process");(function() {
} }
} }
user.stats.exp = stats.exp; user.stats.exp = stats.exp;
if (user.flags == null) { if ((_ref = user.flags) == null) {
user.flags = {}; user.flags = {};
} }
if (!user.flags.customizationsNotification && (user.stats.exp > 10 || user.stats.lvl > 1)) { if (!user.flags.customizationsNotification && (user.stats.exp > 10 || user.stats.lvl > 1)) {
@ -12384,7 +12463,8 @@ var process=require("__browserify_process");(function() {
*/ */
cron: function(options) { cron: function(options) {
var daysMissed, expTally, lvl, now, progress, todoTally, _base, _base1, _base2, _progress; var daysMissed, expTally, lvl, now, progress, todoTally, _base, _base1, _base2, _progress, _ref, _ref1, _ref2, _ref3;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -12416,11 +12496,12 @@ var process=require("__browserify_process");(function() {
return; return;
} }
todoTally = 0; todoTally = 0;
if ((_base = user.party.quest.progress).down == null) { if ((_ref = (_base = user.party.quest.progress).down) == null) {
_base.down = 0; _base.down = 0;
} }
user.todos.concat(user.dailys).forEach(function(task) { user.todos.concat(user.dailys).forEach(function(task) {
var absVal, completed, delta, id, repeat, scheduleMisses, type; var absVal, completed, delta, id, repeat, scheduleMisses, type, _ref1;
if (!task) { if (!task) {
return; return;
} }
@ -12434,6 +12515,7 @@ var process=require("__browserify_process");(function() {
scheduleMisses = 0; scheduleMisses = 0;
_.times(daysMissed, function(n) { _.times(daysMissed, function(n) {
var thatDay; var thatDay;
thatDay = moment(now).subtract('days', n + 1); thatDay = moment(now).subtract('days', n + 1);
if (api.shouldDo(thatDay, repeat, user.preferences)) { if (api.shouldDo(thatDay, repeat, user.preferences)) {
return scheduleMisses++; return scheduleMisses++;
@ -12458,7 +12540,7 @@ var process=require("__browserify_process");(function() {
} }
switch (type) { switch (type) {
case 'daily': case 'daily':
(task.history != null ? task.history : task.history = []).push({ ((_ref1 = task.history) != null ? _ref1 : task.history = []).push({
date: +(new Date), date: +(new Date),
value: task.value value: task.value
}); });
@ -12481,7 +12563,7 @@ var process=require("__browserify_process");(function() {
} }
} }
}); });
((_base1 = (user.history != null ? user.history : user.history = {})).todos != null ? (_base1 = (user.history != null ? user.history : user.history = {})).todos : _base1.todos = []).push({ ((_ref1 = (_base1 = ((_ref2 = user.history) != null ? _ref2 : user.history = {})).todos) != null ? _ref1 : _base1.todos = []).push({
date: now, date: now,
value: todoTally value: todoTally
}); });
@ -12491,7 +12573,7 @@ var process=require("__browserify_process");(function() {
lvl++; lvl++;
expTally += api.tnl(lvl); expTally += api.tnl(lvl);
} }
((_base2 = user.history).exp != null ? (_base2 = user.history).exp : _base2.exp = []).push({ ((_ref3 = (_base2 = user.history).exp) != null ? _ref3 : _base2.exp = []).push({
date: now, date: now,
value: expTally value: expTally
}); });
@ -12527,6 +12609,7 @@ var process=require("__browserify_process");(function() {
} }
_.each(user.habits.concat(user.dailys), function(task) { _.each(user.habits.concat(user.dailys), function(task) {
var _ref; var _ref;
if (((_ref = task.history) != null ? _ref.length : void 0) > minHistLen) { if (((_ref = task.history) != null ? _ref.length : void 0) > minHistLen) {
task.history = preenHistory(task.history); task.history = preenHistory(task.history);
} }
@ -12548,9 +12631,11 @@ var process=require("__browserify_process");(function() {
get: function() { get: function() {
var computed, var computed,
_this = this; _this = this;
computed = _.reduce(['per', 'con', 'str', 'int'], function(m, stat) { computed = _.reduce(['per', 'con', 'str', 'int'], function(m, stat) {
m[stat] = _.reduce($w('stats stats.buffs items.gear.equipped.weapon items.gear.equipped.armor items.gear.equipped.head items.gear.equipped.shield'), function(m2, path) { m[stat] = _.reduce($w('stats stats.buffs items.gear.equipped.weapon items.gear.equipped.armor items.gear.equipped.head items.gear.equipped.shield'), function(m2, path) {
var item, val; var item, val;
val = user.fns.dotGet(path); val = user.fns.dotGet(path);
return m2 + (~path.indexOf('items.gear') ? (item = content.gear.flat[val], (+(item != null ? item[stat] : void 0) || 0) * ((item != null ? item.klass : void 0) === user.stats["class"] ? 1.5 : 1)) : +val[stat] || 0); return m2 + (~path.indexOf('items.gear') ? (item = content.gear.flat[val], (+(item != null ? item[stat] : void 0) || 0) * ((item != null ? item.klass : void 0) === user.stats["class"] ? 1.5 : 1)) : +val[stat] || 0);
}, 0); }, 0);
@ -12564,6 +12649,7 @@ var process=require("__browserify_process");(function() {
return Object.defineProperty(user, 'tasks', { return Object.defineProperty(user, 'tasks', {
get: function() { get: function() {
var tasks; var tasks;
tasks = user.habits.concat(user.dailys).concat(user.todos).concat(user.rewards); tasks = user.habits.concat(user.dailys).concat(user.todos).concat(user.rewards);
return _.object(_.pluck(tasks, "id"), tasks); return _.object(_.pluck(tasks, "id"), tasks);
} }