Merged in develop

This commit is contained in:
Keith Holliday
2017-05-20 19:24:25 -06:00
467 changed files with 29480 additions and 26851 deletions
@@ -102,6 +102,11 @@ let basicAchievs = {
titleKey: 'royallyLoyal',
textKey: 'royallyLoyalText',
},
joinedGuild: {
icon: 'achievement-guild',
titleKey: 'joinedGuild',
textKey: 'joinedGuildText',
},
};
Object.assign(achievementsData, basicAchievs);
@@ -56,6 +56,7 @@ export const ITEM_LIST = {
quests: { localeKey: 'quest', isEquipment: false },
food: { localeKey: 'foodText', isEquipment: false },
Saddle: { localeKey: 'foodSaddleText', isEquipment: false },
bundles: { localeKey: 'discountBundle', isEquipment: false },
};
export const USER_CAN_OWN_QUEST_CATEGORIES = [
@@ -3,7 +3,7 @@ import defaults from 'lodash/defaults';
import each from 'lodash/each';
import t from './translation';
const CURRENT_SEASON = 'May';
const CURRENT_SEASON = 'none';
let drops = {
Base: {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -179,6 +179,7 @@ function _getBasicAchievements (user, language) {
_addSimple(result, user, {path: 'partyUp', language});
_addSimple(result, user, {path: 'partyOn', language});
_addSimple(result, user, {path: 'joinedGuild', language});
_addSimple(result, user, {path: 'royallyLoyal', language});
_addSimpleWithMasterCount(result, user, {path: 'beastMaster', language});
+73
View File
@@ -114,6 +114,79 @@ shops.getMarketCategories = function getMarket (user, language) {
shops.getQuestShopCategories = function getQuestShopCategories (user, language) {
let categories = [];
/*
* ---------------------------------------------------------------
* Quest Bundles
* ---------------------------------------------------------------
*
* These appear in the Content index.js as follows:
* {
* bundleName: {
* key: 'bundleName',
* text: t('bundleNameText'),
* notes: t('bundleNameNotes'),
* bundleKeys: [
* 'quest1',
* 'quest2',
* 'quest3',
* ],
* canBuy () {
* return true when bundle is available for purchase;
* },
* type: 'quests',
* value: 7,
* },
* secondBundleName: {
* ...
* },
* }
*
* After filtering and mapping, the Shop will produce:
*
* [
* {
* identifier: 'bundle',
* text: 'i18ned string for bundles category',
* items: [
* {
* key: 'bundleName',
* text: 'i18ned string for bundle title',
* notes: 'i18ned string for bundle description',
* value: 7,
* currency: 'gems',
* class: 'quest_bundle_bundleName',
* purchaseType: 'bundles',
* },
* { second bundle },
* ],
* },
* { main quest category 1 },
* ...
* ]
*
*/
let bundleCategory = {
identifier: 'bundle',
text: i18n.t('questBundles', language),
};
bundleCategory.items = sortBy(values(content.bundles)
.filter(bundle => bundle.type === 'quests' && bundle.canBuy())
.map(bundle => {
return {
key: bundle.key,
text: bundle.text(language),
notes: bundle.notes(language),
value: bundle.value,
currency: 'gems',
class: `quest_bundle_${bundle.key}`,
purchaseType: 'bundles',
};
}));
categories.push(bundleCategory);
each(content.userCanOwnQuestCategories, type => {
let category = {
identifier: type,
+10 -2
View File
@@ -46,12 +46,20 @@ module.exports = function equip (user, req = {}) {
let item = content.gear.flat[key];
if (user.items.gear[type][item.type] === key) {
user.items.gear[type][item.type] = `${item.type}_base_0`;
user.items.gear[type] = Object.assign(
{},
user.items.gear[type].toObject ? user.items.gear[type].toObject() : user.items.gear[type],
{[item.type]: `${item.type}_base_0`}
);
message = i18n.t('messageUnEquipped', {
itemText: item.text(req.language),
}, req.language);
} else {
user.items.gear[type][item.type] = item.key;
user.items.gear[type] = Object.assign(
{},
user.items.gear[type].toObject ? user.items.gear[type].toObject() : user.items.gear[type],
{[item.type]: item.key}
);
message = handleTwoHanded(user, item, type, req);
}
break;
+10 -1
View File
@@ -2,6 +2,7 @@ import content from '../content/index';
import i18n from '../i18n';
import get from 'lodash/get';
import pick from 'lodash/pick';
import forEach from 'lodash/forEach';
import splitWhitespace from '../libs/splitWhitespace';
import planGemLimits from '../libs/planGemLimits';
import {
@@ -62,7 +63,7 @@ module.exports = function purchase (user, req = {}, analytics) {
];
}
let acceptedTypes = ['eggs', 'hatchingPotions', 'food', 'quests', 'gear'];
let acceptedTypes = ['eggs', 'hatchingPotions', 'food', 'quests', 'gear', 'bundles'];
if (acceptedTypes.indexOf(type) === -1) {
throw new NotFound(i18n.t('notAccteptedType', req.language));
}
@@ -101,6 +102,14 @@ module.exports = function purchase (user, req = {}, analytics) {
if (type === 'gear') {
user.items.gear.owned[key] = true;
} else if (type === 'bundles') {
let subType = item.type;
forEach(item.bundleKeys, function addBundledItems (bundledKey) {
if (!user.items[subType][bundledKey] || user.items[subType][key] < 0) {
user.items[subType][bundledKey] = 0;
}
user.items[subType][bundledKey]++;
});
} else {
if (!user.items[type][key] || user.items[type][key] < 0) {
user.items[type][key] = 0;