Move Content index file to js

This commit is contained in:
Blade Barringer
2015-09-25 12:09:43 -05:00
parent 8145d5a77c
commit 3d1bbaf6ef
5 changed files with 106 additions and 122 deletions

View File

@@ -1,114 +0,0 @@
api = module.exports
###
---------------------------------------------------------------
Gear (Weapons, Armor, Head, Shield)
Item definitions: {index, text, notes, value, str, def, int, per, classes, type}
---------------------------------------------------------------
###
classes = require('../../dist/scripts/content/classes')
events = require('../../dist/scripts/content/events')
api.mystery = require('../../dist/scripts/content/mystery-sets')
api.itemList = require('../../dist/scripts/content/item-list')
gear = require('../../dist/scripts/content/gear/index')
###
The gear is exported as a tree (defined above), and a flat list (eg, {weapon_healer_1: .., shield_special_0: ...}) since
they are needed in different forms at different points in the app
###
api.gear =
tree: gear.tree
flat: gear.flat
###
Time Traveler Store, mystery sets need their items mapped in
###
api.timeTravelerStore = require('../../dist/scripts/content/time-traveler-store')
###
---------------------------------------------------------------
Unique Rewards: Potion and Armoire
---------------------------------------------------------------
###
api.potion = require('../../dist/scripts/content/health-potion')
api.armoire = require('../../dist/scripts/content/armoire')
###
---------------------------------------------------------------
Classes
---------------------------------------------------------------
###
api.classes = classes
###
---------------------------------------------------------------
Gear Types
---------------------------------------------------------------
###
api.gearTypes = gear.gearTypes
api.spells = require('../../dist/scripts/content/spells/index')
api.cardTypes = require('../../dist/scripts/content/card-types')
api.special = api.spells.special
###
---------------------------------------------------------------
Drops
---------------------------------------------------------------
###
eggs = require('../../dist/scripts/content/eggs/index')
api.dropEggs = eggs.dropEggs
api.questEggs = eggs.questEggs
api.eggs = eggs.allEggs
pets_mounts = require('../../dist/scripts/content/pets-mounts/index')
api.specialPets = pets_mounts.specialPets
api.specialMounts = pets_mounts.specialMounts
api.timeTravelStable = require('../../dist/scripts/content/time-traveler-stable')
api.hatchingPotions = require('../../dist/scripts/content/hatching-potions')
api.pets = pets_mounts.dropPets
api.questPets = pets_mounts.questPets
api.mounts = pets_mounts.dropMounts
api.questMounts = pets_mounts.questMounts
api.food = require('../../dist/scripts/content/food/index')
quests = require('../../dist/scripts/content/quests/index')
api.userCanOwnQuestCategories = quests.canOwnCategories
api.quests = quests.allQuests
api.questsByLevel = quests.byLevel
api.backgrounds = require('../../dist/scripts/content/backgrounds')
api.subscriptionBlocks = require('../../dist/scripts/content/subscription-blocks')
api.userDefaults = require('../../dist/scripts/content/user-defaults')
api.faq = require('../../dist/scripts/content/faq')

View File

@@ -1,8 +1,7 @@
'use strict';
require('coffee-script');
var _ = require('lodash');
var content = require('./content/index.coffee');
var content = require('../dist/scripts/content/index');
var DROP_ANIMALS = _.keys(content.pets);

View File

@@ -1,6 +1,6 @@
moment = require('moment')
_ = require('lodash')
content = require('./content/index.coffee')
content = require('../dist/scripts/content/index')
i18n = require('./i18n.coffee')
api = module.exports = {}

View File

@@ -0,0 +1,100 @@
import classes from './classes';
import mysterySets from './mystery-sets';
import itemList from './item-list';
import {
tree as gearTree,
flat as gearFlat,
gearTypes,
} from './gear/index';
import timeTravelerStore from './time-traveler-store';
import potion from './health-potion';
import armoire from './armoire';
import spells from './spells/index';
import {special} from './spells/index';
import cardTypes from './card-types';
import {
dropEggs,
questEggs,
allEggs,
} from './eggs/index';
import {
dropPets,
questPets,
dropMounts,
questMounts,
specialPets,
specialMounts,
} from './pets-mounts/index';
import timeTravelStable from './time-traveler-stable';
import hatchingPotions from './hatching-potions';
import food from './food/index';
import {
all as allQuests,
canOwnCategories as userCanOwnQuestCategories,
byLevel as questsByLevel
} from './quests/index';
import backgrounds from './backgrounds';
import subscriptionBlocks from './subscription-blocks';
import userDefaults from './user-defaults';
import faq from './faq';
export default {
// Constants
classes: classes,
gearTypes: gearTypes,
mystery: mysterySets,
itemList: itemList,
userCanOwnQuestCategories: userCanOwnQuestCategories,
// Gear
gear: {
tree: gearTree,
flat: gearFlat
},
// Time Traveler Store
timeTravelerStore: timeTravelerStore,
timeTravelStable: timeTravelStable,
// Non-Gear Static Rewards
potion: potion,
armoire: armoire,
// Spells
spells: spells,
cardTypes: cardTypes,
special: special,
// Item Drops
hatchingPotions: hatchingPotions,
food: food,
// Eggs
dropEggs: dropEggs,
questEggs: questEggs,
eggs: allEggs,
// Pets And Mounts
pets: dropPets,
questPets: questPets,
mounts: dropMounts,
questMounts: questMounts,
specialPets: specialPets,
specialMounts: specialMounts,
// Quests
quests: allQuests,
questsByLevel: questsByLevel,
// Backgrounds
backgrounds: backgrounds,
// Subscription Blocks
subscriptionBlocks: subscriptionBlocks,
// Default User Tasks
userDefaults: userDefaults,
// Frequently Asked Questions
faq: faq,
};

View File

@@ -6,7 +6,6 @@ var _ = require('lodash');
require('coffee-script');
var shared = require('../../common/script/index.coffee');
var Content = require('../../common/script/content/index.coffee');
describe('user.fns.buy', function() {
var user;
@@ -63,8 +62,8 @@ describe('user.fns.buy', function() {
var fullArmoire = {}
_(Content.gearTypes).each(function(type) {
_(Content.gear.tree[type].armoire).each(function(gearObject, gearName) {
_(shared.content.gearTypes).each(function(type) {
_(shared.content.gear.tree[type].armoire).each(function(gearObject, gearName) {
armoireKey = gearObject.key;
fullArmoire[armoireKey] = true;
});
@@ -118,7 +117,7 @@ describe('user.fns.buy', function() {
});
it('gives food', function() {
var honey = Content.food.Honey;
var honey = shared.content.food.Honey;
user.fns.randomVal.returns(honey);
user.fns.predictableRandom.returns(YIELD_FOOD);
@@ -148,7 +147,7 @@ describe('user.fns.buy', function() {
context('gear awards', function() {
beforeEach(function() {
var shield = Content.gear.tree.shield.armoire.gladiatorShield;
var shield = shared.content.gear.tree.shield.armoire.gladiatorShield;
user.fns.randomVal.returns(shield);
});