fix exports

This commit is contained in:
Matteo Pagliazzi
2019-10-01 17:53:48 +02:00
parent 4faa06f37d
commit cca5b8492b
144 changed files with 271 additions and 315 deletions

View File

@@ -41,7 +41,7 @@ import axios from 'axios';
import Avatar from '../avatar';
import { mapState } from '@/libs/store';
import percent from '@/../../common/script/libs/percent';
import {maxHealth} from '@/../../common/script/index';
import {MAX_HEALTH as maxHealth} from '@/../../common/script/constants';
import revive from '@/../../common/script/ops/revive';
export default {

View File

@@ -21,7 +21,7 @@
<script>
import { mapState } from '@/libs/store';
import eggs from '@/../../common/script/content/eggs';
import * as eggs from '@/../../common/script/content/eggs';
export default {
data () {

View File

@@ -116,7 +116,7 @@
<script>
import Avatar from '../avatar';
import { mapState } from '@/libs/store';
import {maxHealth} from '@/../../common/script/index';
import {MAX_HEALTH as maxHealth} from '@/../../common/script/constants';
import styleHelper from '@/mixins/styleHelper';
import twitter from '@/assets/svg/twitter.svg';
import facebook from '@/assets/svg/facebook.svg';

View File

@@ -53,7 +53,7 @@ b-modal#login-incentives(:title="data.message", size='md', :hide-footer="true")
<script>
import { mapState } from '@/libs/store';
import Avatar from '../avatar';
import {loginIncentives} from '@/../../common/script/content/index';
import content from '@/../../common/script/content/index';
export default {
components: {
@@ -62,7 +62,7 @@ export default {
props: ['data'],
data () {
return {
loginIncentives,
loginIncentives: content.loginIncentives,
};
},
computed: {

View File

@@ -59,7 +59,7 @@
import Avatar from '../avatar';
import { mapState } from '@/libs/store';
import percent from '@/../../common/script/libs/percent';
import {maxHealth} from '@/../../common/script/index';
import {MAX_HEALTH as maxHealth} from '@/../../common/script/constants';
export default {
components: {

View File

@@ -23,12 +23,12 @@
</style>
<script>
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import questDialogDrops from '@/components/shops/quests/questDialogDrops';
import { mapState } from '@/libs/store';
import percent from '@/../../common/script/libs/percent';
import { maxHealth } from '@/../../common/script/index';
import {MAX_HEALTH as maxHealth} from '@/../../common/script/constants';
export default {
components: {

View File

@@ -45,10 +45,10 @@
</template>
<script>
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import { mapState } from '@/libs/store';
import percent from '@/../../common/script/libs/percent';
import {maxHealth} from '@/../../common/script/index';
import {MAX_HEALTH as maxHealth} from '@/../../common/script/constants';
export default {
data () {

View File

@@ -709,7 +709,7 @@ import map from 'lodash/map';
import { mapState } from '@/libs/store';
import avatar from './avatar';
import usernameForm from './settings/usernameForm';
import { getBackgroundShopSets } from '@/../../common/script/libs/shops';
import shops from '@/../../common/script/libs/shops';
import guide from '@/mixins/guide';
import notifications from '@/mixins/notifications';
import toggleSwitch from '@/components/ui/toggleSwitch';
@@ -754,7 +754,7 @@ export default {
this.$root.$on('buyModal::boughtItem', this.backgroundPurchased);
},
data () {
let backgroundShopSets = getBackgroundShopSets();
let backgroundShopSets = shops.getBackgroundShopSets();
return {
loading: false,

View File

@@ -135,7 +135,7 @@
<script>
import { mapState, mapGetters } from '@/libs/store';
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import copyIcon from '@/assets/svg/copy.svg';
import greyBadgeIcon from '@/assets/svg/grey-badge.svg';

View File

@@ -163,27 +163,27 @@ sidebar-section(:title="$t('questDetailsTitle')")
span {
margin-top: .3em;
font-size: 14px;
font-weight: bold;
font-size: 14px;
font-weight: bold;
}
.accept, .reject {
padding: .2em 1em;
font-size: 12px;
height: 24px;
border-radius: 2px;
border-radius: 2px;
box-shadow: 0 2px 2px 0 rgba(26, 24, 29, 0.16), 0 1px 4px 0 rgba(26, 24, 29, 0.12);
}
.accept {
background-color: #24cc8f;
margin-left: 4em;
background-color: #24cc8f;
margin-left: 4em;
margin-right: .5em;
}
.reject {
border-radius: 2px;
background-color: #f74e52;
border-radius: 2px;
background-color: #f74e52;
}
}
</style>
@@ -191,7 +191,7 @@ sidebar-section(:title="$t('questDetailsTitle')")
<script>
import { mapState } from '@/libs/store';
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import percent from '@/../../common/script/libs/percent';
import sidebarSection from '../sidebarSection';

View File

@@ -108,7 +108,7 @@
import { mapState } from '@/libs/store';
import * as Analytics from '@/libs/analytics';
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import copyIcon from '@/assets/svg/copy.svg';
import greyBadgeIcon from '@/assets/svg/grey-badge.svg';

View File

@@ -458,7 +458,7 @@ import tierMod from '@/assets/svg/tier-mod.svg';
import tierNPC from '@/assets/svg/tier-npc.svg';
import tierStaff from '@/assets/svg/tier-staff.svg';
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import staffList from '../../libs/staffList';
export default {

View File

@@ -111,9 +111,9 @@ import each from 'lodash/each';
import markdownDirective from '@/directives/markdown';
import styleHelper from '@/mixins/styleHelper';
import { mapState } from '@/libs/store';
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import { mountInfo, petInfo } from '@/../../common/script/content/stable';
import { food, hatchingPotions, special } from '@/../../common/script/content';
import content from '@/../../common/script/content';
import gear from '@/../../common/script/content/gear';
import notifications from '@/mixins/notifications';
import userLink from '../userLink';
@@ -133,9 +133,9 @@ export default {
quests,
mountInfo,
petInfo,
food,
hatchingPotions,
special,
food: content.food,
hatchingPotions: content.hatchingPotions,
special: content.special,
gear,
expandItems: false,
expandAuth: false,

View File

@@ -22,7 +22,7 @@ base-notification(
<script>
import BaseNotification from './base';
import { mapState } from '@/libs/store';
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import questInfo from '@/components/shops/quests/questInfo';
export default {

View File

@@ -134,7 +134,7 @@ base-notification(
</style>
<script>
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import { mapState } from '@/libs/store';
import BaseNotification from './base';

View File

@@ -72,7 +72,7 @@ menu-dropdown.item-notifications(:right="true", @toggled="handleOpenStatusChange
<script>
import { mapState, mapActions } from '@/libs/store';
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import notificationsIcon from '@/assets/svg/notifications.svg';
import MenuDropdown from '../ui/customMenuDropdown';
import MessageCount from './messageCount';

View File

@@ -61,7 +61,7 @@
import { mapState } from '@/libs/store';
import ShopItem from '../shopItem';
import count from '@/../../common/script/count';
import { beastCount, mountMasterProgress } from '@/../../common/script/count';
import notifications from '@/mixins/notifications';
@@ -147,10 +147,10 @@ export default {
computed: {
...mapState({user: 'user.data'}),
userHasAllPets () {
return count.beastCount(this.user.items.pets) === 90;
return beastCount(this.user.items.pets) === 90;
},
userHasAllMounts () {
return count.mountMasterProgress(this.user.items.mounts) === 90;
return mountMasterProgress(this.user.items.mounts) === 90;
},
},
methods: {

View File

@@ -177,7 +177,7 @@ import Drawer from '@/components/ui/drawer';
import MouseMoveDirective from '@/directives/mouseposition.directive';
import mana from '@/assets/svg/mana.svg';
import quests from '@/../../common/script/content/quests';
import * as quests from '@/../../common/script/content/quests';
import { CONSTANTS, setLocalSetting, getLocalSetting } from '@/libs/userlocalManager';
export default {

View File

@@ -250,4 +250,4 @@ each(achievementsData, (value, key) => {
value.key = key;
});
module.exports = achievementsData;
export default achievementsData;

View File

@@ -1,6 +1,6 @@
import prefill from '../prefill.js';
module.exports = prefill({
export default prefill({
0: {},
1: {},
2: {},

View File

@@ -1,7 +1,7 @@
import prefill from '../prefill.js';
import sets from '../sets.js';
module.exports = prefill({
export default prefill({
0: {},
1: {},
2: {price: 2, set: sets.baseHair1},

View File

@@ -1,7 +1,7 @@
import sets from '../sets.js';
import prefill from '../prefill.js';
module.exports = prefill({
export default prefill({
0: {},
1: {price: 2, set: sets.facialHair},
2: {price: 2, set: sets.facialHair},

View File

@@ -1,7 +1,7 @@
import sets from '../sets.js';
import prefill from '../prefill.js';
module.exports = prefill({
export default prefill({
white: {},
brown: {},
blond: {},

View File

@@ -1,6 +1,6 @@
import prefill from '../prefill.js';
module.exports = prefill({
export default prefill({
0: {},
1: {},
2: {},

View File

@@ -5,7 +5,7 @@ import color from './color.js';
import flower from './flower.js';
import mustache from './mustache.js';
module.exports = {
export default {
color,
base,
bangs,

View File

@@ -1,7 +1,7 @@
import sets from '../sets.js';
import prefill from '../prefill.js';
module.exports = prefill({
export default prefill({
0: {},
1: {price: 2, set: sets.facialHair},
2: {price: 2, set: sets.facialHair},

View File

@@ -1,7 +1,7 @@
import prefill from '../prefill.js';
import sets from '../sets.js';
module.exports = prefill({
export default prefill({
0: {},
1: {price: 2, set: sets.topHair},
2: {price: 2, set: sets.topHair},

View File

@@ -31,4 +31,4 @@ let appearances = {
background: reorderedBgs,
};
module.exports = appearances;
export default appearances;

View File

@@ -1,6 +1,6 @@
import forOwn from 'lodash/forOwn';
module.exports = function prefillAppearances (obj) {
export default function prefillAppearances (obj) {
forOwn(obj, function prefillAppearance (value, key) {
value.key = key;
if (!value.price) {
@@ -8,4 +8,4 @@ module.exports = function prefillAppearances (obj) {
}
});
return obj;
};
}

View File

@@ -1,7 +1,7 @@
import t from '../translation';
import prefill from './prefill.js';
module.exports = prefill({
export default prefill({
baseHair1: {setPrice: 5, text: t('hairSet1')},
baseHair2: {setPrice: 5, text: t('hairSet2')},
baseHair3: {setPrice: 5, text: t('hairSet3')},

View File

@@ -1,7 +1,7 @@
import sets from './sets.js';
import prefill from './prefill.js';
module.exports = prefill({
export default prefill({
black: {},
blue: {},
green: {},

View File

@@ -1,6 +1,6 @@
import prefill from './prefill.js';
module.exports = prefill({
export default prefill({
slim: {},
broad: {},
});

View File

@@ -1,7 +1,7 @@
import prefill from './prefill.js';
import sets from './sets.js';
module.exports = prefill({
export default prefill({
/* eslint-disable quote-props */
'ddc994': {},
'f5a76e': {},

View File

@@ -408,7 +408,7 @@ applyEggDefaults(quests, {
let all = assign({}, drops, quests);
module.exports = {
export {
drops,
quests,
all,

View File

@@ -25,4 +25,4 @@ for (let i = 0; i <= NUMBER_OF_QUESTIONS; i++) {
faq.questions.push(question);
}
module.exports = faq;
export default faq;

View File

@@ -22,4 +22,4 @@ let armor = {
armoire: armoireArmor,
};
module.exports = armor;
export default armor;

View File

@@ -9,5 +9,5 @@ let back = {
special: specialBack,
};
module.exports = back;
export default back;

View File

@@ -11,4 +11,4 @@ let body = {
armoire: armoireBody,
};
module.exports = body;
export default body;

View File

@@ -11,4 +11,4 @@ let eyewear = {
armoire: armoireEyewear,
};
module.exports = eyewear;
export default eyewear;

View File

@@ -11,5 +11,5 @@ let headAccessory = {
armoire: armoireHeadAccessory,
};
module.exports = headAccessory;
export default headAccessory;

View File

@@ -22,4 +22,4 @@ let head = {
armoire: armoireHead,
};
module.exports = head;
export default head;

View File

@@ -81,7 +81,7 @@ each(GEAR_TYPES, (type) => {
});
});
module.exports = {
export default {
tree: gear,
flat,
};

View File

@@ -1713,7 +1713,7 @@ let weapon = {
},
};
let armoireSet = {
export {
armor,
body,
eyewear,
@@ -1722,5 +1722,3 @@ let armoireSet = {
shield,
weapon,
};
module.exports = armoireSet;

View File

@@ -66,7 +66,7 @@ let weapon = {
},
};
let baseSet = {
export {
armor,
back,
body,
@@ -76,5 +76,3 @@ let baseSet = {
shield,
weapon,
};
module.exports = baseSet;

View File

@@ -148,11 +148,9 @@ let weapon = {
},
};
let healerSet = {
export {
armor,
head,
shield,
weapon,
};
module.exports = healerSet;

View File

@@ -942,7 +942,7 @@ let weapon = {
},
};
let mysterySet = {
export {
armor,
back,
body,
@@ -952,5 +952,3 @@ let mysterySet = {
shield,
weapon,
};
module.exports = mysterySet;

View File

@@ -160,11 +160,9 @@ let shield = {
},
};
let rogueSet = {
export {
armor,
head,
shield,
weapon,
};
module.exports = rogueSet;

View File

@@ -2,10 +2,10 @@ import {
EVENTS,
} from '../../../constants';
import { ownsItem } from '../../gear-helper';
import backerGear from './special-backer';
import contributorGear from './special-contributor';
import takeThisGear from './special-takeThis';
import wonderconGear from './special-wondercon';
import * as backerGear from './special-backer';
import * as contributorGear from './special-contributor';
import * as takeThisGear from './special-takeThis';
import * as wonderconGear from './special-wondercon';
import t from '../../../translation';
const CURRENT_SEASON = 'fall';
@@ -5368,7 +5368,7 @@ let weapon = {
},
};
let specialSet = {
export {
armor,
back,
body,
@@ -5378,5 +5378,3 @@ let specialSet = {
shield,
weapon,
};
module.exports = specialSet;

View File

@@ -79,7 +79,7 @@ let weaponSpecial3 = {
canOwn: isBackerOfLevel(300, 'weapon_special_3'),
};
let backerSet = {
export {
armorSpecial0,
armorSpecial2,
headSpecial0,
@@ -89,5 +89,3 @@ let backerSet = {
weaponSpecial2,
weaponSpecial3,
};
module.exports = backerSet;

View File

@@ -68,12 +68,10 @@ let weaponSpecialCritical = {
},
};
let contributorSet = {
export {
armorSpecial1,
headSpecial1,
shieldSpecial1,
weaponSpecial1,
weaponSpecialCritical,
};
module.exports = contributorSet;

View File

@@ -60,7 +60,7 @@ let weaponSpecialTakeThis = {
str: 5,
};
let takeThisSet = {
export {
armorSpecialTakeThis,
backSpecialTakeThis,
bodySpecialTakeThis,
@@ -68,5 +68,3 @@ let takeThisSet = {
shieldSpecialTakeThis,
weaponSpecialTakeThis,
};
module.exports = takeThisSet;

View File

@@ -49,7 +49,7 @@ let eyewearSpecialWonderconBlack = {
mystery: 'wondercon',
};
let wonderconSet = {
export {
backSpecialWonderconRed,
backSpecialWonderconBlack,
bodySpecialWonderconRed,
@@ -58,5 +58,3 @@ let wonderconSet = {
eyewearSpecialWonderconRed,
eyewearSpecialWonderconBlack,
};
module.exports = wonderconSet;

View File

@@ -145,11 +145,9 @@ let weapon = {
},
};
let warriorSet = {
export {
armor,
head,
shield,
weapon,
};
module.exports = warriorSet;

View File

@@ -131,11 +131,9 @@ let weapon = {
},
};
let wizardSet = {
export {
armor,
head,
shield,
weapon,
};
module.exports = wizardSet;

View File

@@ -26,4 +26,4 @@ let shield = {
armoire: armoireShield,
};
module.exports = shield;
export default shield;

View File

@@ -64,4 +64,4 @@ for (let key in weapon) {
}
}
module.exports = weapon;
export default weapon;

View File

@@ -281,7 +281,7 @@ each(wacky, (pot, key) => {
let all = assign({}, drops, premium, wacky);
module.exports = {
export {
drops,
premium,
wacky,

View File

@@ -12,13 +12,13 @@ import {
ANIMAL_COLOR_ACHIEVEMENTS,
} from './constants';
let api = module.exports;
const api = {};
import achievements from './achievements';
import eggs from './eggs';
import hatchingPotions from './hatching-potions';
import stable from './stable';
import * as eggs from './eggs';
import * as hatchingPotions from './hatching-potions';
import * as stable from './stable';
import gear from './gear';
import {
quests,
@@ -912,3 +912,5 @@ api.userDefaultsMobile = {
api.faq = faq;
api.loginIncentives = loginIncentives(api);
export default api;

View File

@@ -3,7 +3,7 @@ import { MAX_INCENTIVES } from '../constants';
// NOTE do not import this file alone but only access it through common.content
// so that it's already compiled
module.exports = function getLoginIncentives (api) {
export default function getLoginIncentives (api) {
let loginIncentives = {
1: {
rewardKey: ['armor_special_bardRobes'],
@@ -665,4 +665,4 @@ module.exports = function getLoginIncentives (api) {
});
return loginIncentives;
};
}

View File

@@ -303,4 +303,4 @@ each(mysterySets, (value, key) => {
value.class = `shop_set_mystery_${key}`;
});
module.exports = mysterySets;
export default mysterySets;

View File

@@ -3531,7 +3531,7 @@ let questsByLevel = sortBy(quests, (quest) => {
return quest.lvl || 0;
});
module.exports = {
export {
quests,
questsByLevel,
userCanOwnQuestCategories,

View File

@@ -677,4 +677,4 @@ each(spells, (spellClass) => {
});
});
module.exports = spells;
export default spells;

View File

@@ -141,7 +141,7 @@ each(specialMounts, (translationString, key) => {
};
});
module.exports = {
export {
dropPets,
premiumPets,
questPets,

View File

@@ -54,4 +54,4 @@ each(subscriptionBlocks, function createKeys (b, k) {
return b.key = k;
});
module.exports = subscriptionBlocks;
export default subscriptionBlocks;

View File

@@ -31,7 +31,7 @@ let timeTravelerStore = (user) => {
}, {});
};
module.exports = {
export default {
timeTravelerStore,
mystery,
};

View File

@@ -1,6 +1,6 @@
import i18n from '../i18n';
module.exports = function translator (string, vars = { a: 'a' }) {
export default function translator (string, vars = { a: 'a' }) {
function func (lang) {
return i18n.t(string, vars, lang);
}
@@ -8,4 +8,4 @@ module.exports = function translator (string, vars = { a: 'a' }) {
func.i18nLangFunc = true; // Trick to recognize this type of function
return func;
};
}

View File

@@ -6,7 +6,7 @@ import content from './content/index';
const DROP_ANIMALS = keys(content.pets);
function beastMasterProgress (pets = {}) {
export function beastMasterProgress (pets = {}) {
let count = 0;
each(DROP_ANIMALS, (animal) => {
@@ -17,7 +17,7 @@ function beastMasterProgress (pets = {}) {
return count;
}
function beastCount (pets = {}) {
export function beastCount (pets = {}) {
let count = 0;
each(DROP_ANIMALS, (animal) => {
@@ -27,7 +27,7 @@ function beastCount (pets = {}) {
return count;
}
function dropPetsCurrentlyOwned (pets = {}) {
export function dropPetsCurrentlyOwned (pets = {}) {
let count = 0;
each(DROP_ANIMALS, (animal) => {
@@ -38,7 +38,7 @@ function dropPetsCurrentlyOwned (pets = {}) {
return count;
}
function mountMasterProgress (mounts = {}) {
export function mountMasterProgress (mounts = {}) {
let count = 0;
each(DROP_ANIMALS, (animal) => {
@@ -49,7 +49,7 @@ function mountMasterProgress (mounts = {}) {
return count;
}
function remainingGearInSet (userGear = {}, set) {
export function remainingGearInSet (userGear = {}, set) {
let gear = filter(content.gear.flat, (item) => {
let setMatches = item.klass === set;
let hasItem = userGear[item.key];
@@ -62,7 +62,7 @@ function remainingGearInSet (userGear = {}, set) {
return count;
}
function questsOfCategory (userQuests = {}, category) {
export function questsOfCategory (userQuests = {}, category) {
let quests = filter(content.quests, (quest) => {
let categoryMatches = quest.category === category;
let hasQuest = userQuests[quest.key];
@@ -74,12 +74,3 @@ function questsOfCategory (userQuests = {}, category) {
return count;
}
module.exports = {
beastMasterProgress,
beastCount,
dropPetsCurrentlyOwned,
mountMasterProgress,
remainingGearInSet,
questsOfCategory,
};

View File

@@ -75,8 +75,8 @@ function getStatToAllocate (user) {
}
}
module.exports = function autoAllocate (user) {
export default function autoAllocate (user) {
let statToIncrease = getStatToAllocate(user);
return user.stats[statToIncrease]++;
};
}

View File

@@ -10,4 +10,4 @@ function crit (user, stat = 'str', chance = 0.03) {
}
}
module.exports = { crit };
export default { crit };

View File

@@ -1,7 +1,7 @@
import content from '../content/index';
import i18n from '../i18n';
module.exports = function handleTwoHanded (user, item, type = 'equipped', req = {}) {
export default function handleTwoHanded (user, item, type = 'equipped', req = {}) {
let currentShield = content.gear.flat[user.items.gear[type].shield];
let currentWeapon = content.gear.flat[user.items.gear[type].weapon];
@@ -20,4 +20,4 @@ module.exports = function handleTwoHanded (user, item, type = 'equipped', req =
}
return message;
};
}

View File

@@ -6,7 +6,7 @@ import autoAllocate from './autoAllocate';
import updateStats from './updateStats';
import ultimateGear from './ultimateGear';
module.exports = {
export default {
handleTwoHanded,
predictableRandom,
crit,

View File

@@ -5,7 +5,7 @@ import isNumber from 'lodash/isNumber';
// Because the same op needs to be performed on the client and the server (critical hits, item drops, etc),
// we need things to be "random", but technically predictable so that they don't go out-of-sync
module.exports = function predictableRandom (user, seed) {
export default function predictableRandom (user, seed) {
if (!seed || seed === Math.PI) {
let stats = user.stats.toObject ? user.stats.toObject() : user.stats;
// These items are not part of the stat object but exists on the server (see controllers/user#getUser)
@@ -23,4 +23,4 @@ module.exports = function predictableRandom (user, seed) {
let x = Math.sin(seed++) * 10000;
return x - Math.floor(x);
};
}

View File

@@ -25,7 +25,7 @@ function trueRandom () {
return Math.random();
}
module.exports = function randomDrop (user, options, req = {}, analytics) {
export default function randomDrop (user, options, req = {}, analytics) {
let acceptableDrops;
let drop;
let dropMultiplier;
@@ -133,4 +133,4 @@ module.exports = function randomDrop (user, options, req = {}, analytics) {
user.items.lastDrop.date = Number(new Date());
user.items.lastDrop.count++;
}
};
}

View File

@@ -1,7 +1,7 @@
import each from 'lodash/each';
import content from '../content/index';
module.exports = function resetGear (user) {
export default function resetGear (user) {
let gear = user.items.gear;
each(['equipped', 'costume'], function resetUserGear (type) {
@@ -24,4 +24,4 @@ module.exports = function resetGear (user) {
if (user.markModified) user.markModified('items.gear.owned');
user.preferences.costume = false;
};
}

View File

@@ -3,7 +3,7 @@ import lodashFind from 'lodash/find';
import reduce from 'lodash/reduce';
import includes from 'lodash/includes';
module.exports = function ultimateGear (user) {
export default function ultimateGear (user) {
let owned = user.items.gear.owned.toObject ? user.items.gear.owned.toObject() : user.items.gear.owned;
content.classes.forEach((klass) => {
@@ -35,4 +35,4 @@ module.exports = function ultimateGear (user) {
}
return;
};
}

View File

@@ -6,7 +6,7 @@ import {
import { toNextLevel } from '../statHelpers';
import autoAllocate from './autoAllocate';
module.exports = function updateStats (user, stats, req = {}, analytics) {
export default function updateStats (user, stats, req = {}, analytics) {
let allocatedStatPoints;
let totalStatPoints;
let experienceToNextLevel;
@@ -111,4 +111,4 @@ module.exports = function updateStats (user, stats, req = {}, analytics) {
if (user.addNotification) user.addNotification('REBIRTH_ENABLED');
user.flags.rebirthEnabled = true;
}
};
}

View File

@@ -2,7 +2,7 @@ import isString from 'lodash/isString';
import clone from 'lodash/clone';
import template from 'lodash/template';
let i18n = {
const i18n = {
strings: null,
translations: {},
t, // eslint-disable-line no-use-before-define
@@ -62,4 +62,4 @@ function t (stringName) {
}
}
module.exports = i18n;
export default i18n;

View File

@@ -1,6 +1,6 @@
// When using a common module from the website or the server NEVER import the module directly
// but access it through `api` (the main common) module, otherwise you would require the non transpiled version of the file in production.
let api = module.exports = {};
const api = {};
import content from './content/index';
api.content = content;
@@ -101,7 +101,7 @@ api.appliedTags = appliedTags;
import pickDeep from './libs/pickDeep';
api.pickDeep = pickDeep;
import count from './count';
import * as count from './count';
api.count = count;
import statsComputed from './libs/statsComputed';
@@ -164,7 +164,7 @@ import blockUser from './ops/blockUser';
import reroll from './ops/reroll';
import reset from './ops/reset';
import markPmsRead from './ops/markPMSRead';
import pinnedGearUtils from './ops/pinnedGearUtils';
import * as pinnedGearUtils from './ops/pinnedGearUtils';
api.ops = {
scoreTask,
@@ -194,3 +194,5 @@ api.ops = {
markPmsRead,
pinnedGearUtils,
};
export default api;

View File

@@ -328,4 +328,4 @@ achievs.getAchievementsForProfile = function getAchievementsForProfile (user, la
achievs.getContribText = contribText;
module.exports = achievs;
export default achievs;

View File

@@ -4,11 +4,11 @@ Are there tags applied?
// TODO move to client
module.exports = function appliedTags (userTags, taskTags = []) {
export default function appliedTags (userTags, taskTags = []) {
let arr = userTags.filter(tag => {
return taskTags.indexOf(tag.id) !== -1;
}).map(tag => {
return tag.name;
});
return arr.join(', ');
};
}

View File

@@ -2,4 +2,4 @@ import get from 'lodash/get';
// TODO remove completely, only used in client
module.exports = get;
export default get;

View File

@@ -2,4 +2,4 @@ import set from 'lodash/set';
// TODO remove completely, only used in client
module.exports = set;
export default set;

View File

@@ -1,6 +1,6 @@
// Babel 6 doesn't support extending native class (Error, Array, ...)
// This function makes it possible to extend native classes with the same results as Babel 5
module.exports = function extendableBuiltin (klass) {
export default function extendableBuiltin (klass) {
function ExtendableBuiltin () {
klass.apply(this, arguments);
}
@@ -8,4 +8,4 @@ module.exports = function extendableBuiltin (klass) {
Object.setPrototypeOf(ExtendableBuiltin, klass);
return ExtendableBuiltin;
};
}

View File

@@ -1,7 +1,7 @@
import content from '../content/index';
import get from 'lodash/get';
module.exports = function getItemByPathAndType (type, path) {
export default function getItemByPathAndType (type, path) {
let item = get(content, path);
if (type === 'timeTravelersStable') {
@@ -14,4 +14,4 @@ module.exports = function getItemByPathAndType (type, path) {
}
return item;
};
}

View File

@@ -1,7 +1,7 @@
import i18n from '../i18n';
import content from '../content/index';
import { BadRequest } from './errors';
import count from '../count';
import * as count from '../count';
import isPinned from './isPinned';
import isFreeRebirth from './isFreeRebirth';
@@ -46,7 +46,7 @@ function getDefaultGearProps (item, language) {
};
}
module.exports = function getItemInfo (user, type, item, officialPinnedItems, language = 'en') {
export default function getItemInfo (user, type, item, officialPinnedItems, language = 'en') {
if (officialPinnedItems === undefined) {
officialPinnedItems = getOfficialPinnedItems(user);
}
@@ -124,7 +124,7 @@ module.exports = function getItemInfo (user, type, item, officialPinnedItems, la
};
break;
case 'quests': // eslint-disable-line no-case-declarations
const locked = lockQuest(item, user);
const locked = lockQuest(item, user); // eslint-disable-line no-case-declarations
itemInfo = {
key: item.key,
@@ -351,4 +351,4 @@ module.exports = function getItemInfo (user, type, item, officialPinnedItems, la
}
return itemInfo;
};
}

View File

@@ -6,7 +6,7 @@ const officialPinnedItems = content.officialPinnedItems;
let flatGearArray = toArray(content.gear.flat);
module.exports = function getOfficialPinnedItems (user) {
export default function getOfficialPinnedItems (user) {
let officialItemsArray = [...officialPinnedItems];
if (SeasonalShopConfig.pinnedSets && Boolean(user) && user.stats.class) {
@@ -25,4 +25,4 @@ module.exports = function getOfficialPinnedItems (user) {
}
return officialItemsArray;
};
}

View File

@@ -1,9 +1,9 @@
// TODO move to client
module.exports = function gold (num) {
export default function gold (num) {
if (num) {
return Math.floor(num);
} else {
return '0';
}
};
}

View File

@@ -1,8 +1,8 @@
// Check if user has Class system enabled
module.exports = function hasClass (member) {
export default function hasClass (member) {
return (
member.stats.lvl >= 10 &&
!member.preferences.disableClasses &&
member.flags.classSelected
);
};
}

View File

@@ -32,7 +32,7 @@ function sortInAppRewards (user, items) {
return orderedItems;
}
module.exports = function getPinnedItems (user) {
export default function getPinnedItems (user) {
checkPinnedAreasForNullEntries(user);
let officialPinnedItems = getOfficialPinnedItems(user);
@@ -55,4 +55,4 @@ module.exports = function getPinnedItems (user) {
let orderedItems = sortInAppRewards(user, items);
return orderedItems;
};
}

View File

@@ -1,7 +1,7 @@
import moment from 'moment';
import { MAX_LEVEL } from '../constants';
module.exports = function isFreeRebirth (user) {
export default function isFreeRebirth (user) {
let daysFromLastFreeRebirth = user.flags.lastFreeRebirth;
if (daysFromLastFreeRebirth) {
@@ -11,4 +11,4 @@ module.exports = function isFreeRebirth (user) {
}
return user.stats.lvl >= MAX_LEVEL && daysFromLastFreeRebirth > 45;
};
}

View File

@@ -1,5 +1,4 @@
module.exports = function isPinned (user, item, checkOfficialPinnedItems /* getOfficialPinnedItems */) {
export default function isPinned (user, item, checkOfficialPinnedItems /* getOfficialPinnedItems */) {
if (user === null)
return false;
@@ -11,4 +10,4 @@ module.exports = function isPinned (user, item, checkOfficialPinnedItems /* getO
return true;
return isItemPinned;
};
}

View File

@@ -7,8 +7,8 @@ are any tags active?
// TODO move to client
module.exports = function noTags (tags) {
export default function noTags (tags) {
return isEmpty(tags) || isEmpty(filter(tags, (t) => {
return t;
}));
};
}

View File

@@ -1,6 +1,6 @@
// TODO move to client
module.exports = function percent (x, y, dir) {
export default function percent (x, y, dir) {
let roundFn;
switch (dir) {
case 'up':
@@ -16,4 +16,4 @@ module.exports = function percent (x, y, dir) {
x = 1;
}
return Math.max(0, roundFn(x / y * 100));
};
}

View File

@@ -5,11 +5,11 @@ import each from 'lodash/each';
import set from 'lodash/set';
import get from 'lodash/get';
module.exports = function pickDeep (obj, properties) {
export default function pickDeep (obj, properties) {
if (!Array.isArray(properties)) throw new Error('"properties" must be an array');
let result = {};
each(properties, (prop) => set(result, prop, get(obj, prop)));
return result;
};
}

View File

@@ -1,4 +1,4 @@
module.exports = {
export default {
convRate: 20,
convCap: 25,
};

View File

@@ -3,10 +3,10 @@ import filter from 'lodash/filter';
// TODO used only in v2
module.exports = function preenTodos (tasks) {
export default function preenTodos (tasks) {
return filter(tasks, (t) => {
return !t.completed || t.challenge && t.challenge.id || moment(t.dateCompleted).isAfter(moment().subtract({
days: 3,
}));
});
};
}

View File

@@ -1,13 +1,13 @@
import values from 'lodash/values';
import keys from 'lodash/keys';
function trueRandom () {
export function trueRandom () {
return Math.random();
}
// Get a random property from an object
// returns random property (the value)
module.exports = function randomVal (obj, options = {}) {
export default function randomVal (obj, options = {}) {
let array = options.key ? keys(obj) : values(obj);
let random = options.predictableRandom || trueRandom();
@@ -16,6 +16,4 @@ module.exports = function randomVal (obj, options = {}) {
let randomIndex = Math.floor(random * array.length);
return array[randomIndex];
};
module.exports.trueRandom = trueRandom;
}

View File

@@ -9,7 +9,7 @@ import uuid from './uuid';
no problem. To maintain sorting, we use these helper functions:
*/
module.exports = function refPush (reflist, item) {
export default function refPush (reflist, item) {
item.sort = isEmpty(reflist) ? 0 : maxBy(values(reflist), 'sort').sort + 1;
if (!(item.id && !reflist[item.id])) {
@@ -19,4 +19,4 @@ module.exports = function refPush (reflist, item) {
reflist[item.id] = item;
return reflist[item.id];
};
}

View File

@@ -1,6 +1,6 @@
import { SEASONAL_SETS } from '../content/constants';
module.exports = {
export default {
opened: true,
currentSeason: 'Fall',

View File

@@ -539,4 +539,4 @@ shops.getBackgroundShopSets = function getBackgroundShopSets (language) {
return sets;
};
module.exports = shops;
export default shops;

Some files were not shown because too many files have changed in this diff Show More