diff --git a/common/script/content/index.coffee b/common/script/content/index.coffee index 0b33567d4c..db9664815a 100644 --- a/common/script/content/index.coffee +++ b/common/script/content/index.coffee @@ -1598,167 +1598,7 @@ api.questsByLevel = _.sortBy api.quests, (quest) -> quest.lvl || 0 -api.backgrounds = - backgrounds062014: - beach: - text: t('backgroundBeachText') - notes: t('backgroundBeachNotes') - fairy_ring: - text: t('backgroundFairyRingText') - notes: t('backgroundFairyRingNotes') - forest: - text: t('backgroundForestText') - notes: t('backgroundForestNotes') - backgrounds072014: - open_waters: - text: t('backgroundOpenWatersText') - notes: t('backgroundOpenWatersNotes') - coral_reef: - text: t('backgroundCoralReefText') - notes: t('backgroundCoralReefNotes') - seafarer_ship: - text: t('backgroundSeafarerShipText') - notes: t('backgroundSeafarerShipNotes') - backgrounds082014: - volcano: - text: t('backgroundVolcanoText') - notes: t('backgroundVolcanoNotes') - clouds: - text: t('backgroundCloudsText') - notes: t('backgroundCloudsNotes') - dusty_canyons: - text: t('backgroundDustyCanyonsText') - notes: t('backgroundDustyCanyonsNotes') - backgrounds092014: - thunderstorm: - text: t('backgroundThunderstormText') - notes: t('backgroundThunderstormNotes') - autumn_forest: - text: t('backgroundAutumnForestText') - notes: t('backgroundAutumnForestNotes') - harvest_fields: - text: t('backgroundHarvestFieldsText') - notes: t('backgroundHarvestFieldsNotes') - backgrounds102014: - graveyard: - text: t('backgroundGraveyardText') - notes: t('backgroundGraveyardNotes') - haunted_house: - text: t('backgroundHauntedHouseText') - notes: t('backgroundHauntedHouseNotes') - pumpkin_patch: - text: t('backgroundPumpkinPatchText') - notes: t('backgroundPumpkinPatchNotes') - backgrounds112014: - harvest_feast: - text: t('backgroundHarvestFeastText') - notes: t('backgroundHarvestFeastNotes') - sunset_meadow: - text: t('backgroundSunsetMeadowText') - notes: t('backgroundSunsetMeadowNotes') - starry_skies: - text: t('backgroundStarrySkiesText') - notes: t('backgroundStarrySkiesNotes') - backgrounds122014: - iceberg: - text: t('backgroundIcebergText') - notes: t('backgroundIcebergNotes') - twinkly_lights: - text: t('backgroundTwinklyLightsText') - notes: t('backgroundTwinklyLightsNotes') - south_pole: - text: t('backgroundSouthPoleText') - notes: t('backgroundSouthPoleNotes') - backgrounds012015: - ice_cave: - text: t('backgroundIceCaveText') - notes: t('backgroundIceCaveNotes') - frigid_peak: - text: t('backgroundFrigidPeakText') - notes: t('backgroundFrigidPeakNotes') - snowy_pines: - text: t('backgroundSnowyPinesText') - notes: t('backgroundSnowyPinesNotes') - backgrounds022015: - blacksmithy: - text: t('backgroundBlacksmithyText') - notes: t('backgroundBlacksmithyNotes') - crystal_cave: - text: t('backgroundCrystalCaveText') - notes: t('backgroundCrystalCaveNotes') - distant_castle: - text: t('backgroundDistantCastleText') - notes: t('backgroundDistantCastleNotes') - backgrounds032015: - spring_rain: - text: t('backgroundSpringRainText') - notes: t('backgroundSpringRainNotes') - stained_glass: - text: t('backgroundStainedGlassText') - notes: t('backgroundStainedGlassNotes') - rolling_hills: - text: t('backgroundRollingHillsText') - notes: t('backgroundRollingHillsNotes') - backgrounds042015: - cherry_trees: - text: t('backgroundCherryTreesText') - notes: t('backgroundCherryTreesNotes') - floral_meadow: - text: t('backgroundFloralMeadowText') - notes: t('backgroundFloralMeadowNotes') - gumdrop_land: - text: t('backgroundGumdropLandText') - notes: t('backgroundGumdropLandNotes') - backgrounds052015: - marble_temple: - text: t('backgroundMarbleTempleText') - notes: t('backgroundMarbleTempleNotes') - mountain_lake: - text: t('backgroundMountainLakeText') - notes: t('backgroundMountainLakeNotes') - pagodas: - text: t('backgroundPagodasText') - notes: t('backgroundPagodasNotes') - backgrounds062015: - drifting_raft: - text: t('backgroundDriftingRaftText') - notes: t('backgroundDriftingRaftNotes') - shimmery_bubbles: - text: t('backgroundShimmeryBubblesText') - notes: t('backgroundShimmeryBubblesNotes') - island_waterfalls: - text: t('backgroundIslandWaterfallsText') - notes: t('backgroundIslandWaterfallsNotes') - backgrounds072015: - dilatory_ruins: - text: t('backgroundDilatoryRuinsText') - notes: t('backgroundDilatoryRuinsNotes') - giant_wave: - text: t('backgroundGiantWaveText') - notes: t('backgroundGiantWaveNotes') - sunken_ship: - text: t('backgroundSunkenShipText') - notes: t('backgroundSunkenShipNotes') - backgrounds082015: - pyramids: - text: t('backgroundPyramidsText') - notes: t('backgroundPyramidsNotes') - sunset_savannah: - text: t('backgroundSunsetSavannahText') - notes: t('backgroundSunsetSavannahNotes') - twinkly_party_lights: - text: t('backgroundTwinklyPartyLightsText') - notes: t('backgroundTwinklyPartyLightsNotes') - backgrounds092015: - market: - text: t('backgroundMarketText') - notes: t('backgroundMarketNotes') - stable: - text: t('backgroundStableText') - notes: t('backgroundStableNotes') - tavern: - text: t('backgroundTavernText') - notes: t('backgroundTavernNotes') +api.backgrounds = require('../../dist/scripts/content/backgrounds') api.subscriptionBlocks = require('../../dist/scripts/content/subscription-blocks') diff --git a/common/script/src/content/backgrounds.js b/common/script/src/content/backgrounds.js new file mode 100644 index 0000000000..7cbdbffd39 --- /dev/null +++ b/common/script/src/content/backgrounds.js @@ -0,0 +1,41 @@ +import {each} from 'lodash'; +import camelCase from 'lodash.camelCase'; +import capitalize from 'lodash.capitalize'; +import t from './helpers/translator'; + +let sets = { + '062014': ['beach', 'fairy_ring', 'forest'], + '072014': ['open_waters', 'coral_reef', 'seafarer_ship'], + '082014': ['volcano', 'clouds', 'dusty_canyons'], + '092014': ['thunderstorm', 'autumn_forest', 'harvest_fields'], + '102014': ['graveyard', 'haunted_house', 'pumpkin_patch'], + '112014': ['harvest_feast', 'sunset_meadow', 'starry_skies'], + '122014': ['iceberg', 'twinkly_lights', 'south_pole'], + '012015': ['ice_cave', 'frigid_peak', 'snowy_pines'], + '022015': ['blacksmithy', 'crystal_cave', 'distant_castle'], + '032015': ['spring_rain', 'stained_glass', 'rolling_hills'], + '042015': ['cherry_trees', 'floral_meadow', 'gumdrop_land'], + '052015': ['marble_temple', 'mountain_lake', 'pagodas'], + '062015': ['drifting_raft', 'shimmery_bubbles', 'island_waterfalls'], + '072015': ['dilatory_ruins', 'giant_wave', 'sunken_ship'], + '082015': ['pyramids', 'sunset_savannah', 'twinkly_party_lights'], + '092015': ['market', 'stable', 'tavern'], +}; + +let backgrounds = { }; + +each(sets, (names, set) => { + let setName = `backgrounds${set}`; + backgrounds[setName] = {}; + + each(names, (name) => { + let capitalCamelName = capitalize(camelCase(name)); + + backgrounds[setName][name] = { + text: t(`background${capitalCamelName}Text`), + notes: t(`background${capitalCamelName}Notes`), + }; + }); +}); + +export default backgrounds; diff --git a/package.json b/package.json index e915aefc26..d328b62072 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,8 @@ "jade": "~1.11.0", "js2xmlparser": "~0.1.2", "lodash": "~2.4.1", + "lodash.camelcase": "^3.0.1", + "lodash.capitalize": "^3.0.0", "loggly": "~1.0.8", "marked": "^0.3.5", "merge-stream": "^1.0.0",