From 7697b6f4a29bf2999ea9e3ca65033dfbb6240ca7 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sun, 20 Sep 2015 07:35:03 -0500 Subject: [PATCH] Split food out into separate files --- common/script/src/content/food/base.js | 58 +++++ common/script/src/content/food/birthday.js | 58 +++++ common/script/src/content/food/fall.js | 58 +++++ common/script/src/content/food/index.js | 236 +-------------------- common/script/src/content/food/saddle.js | 13 ++ 5 files changed, 198 insertions(+), 225 deletions(-) create mode 100644 common/script/src/content/food/base.js create mode 100644 common/script/src/content/food/birthday.js create mode 100644 common/script/src/content/food/fall.js create mode 100644 common/script/src/content/food/saddle.js diff --git a/common/script/src/content/food/base.js b/common/script/src/content/food/base.js new file mode 100644 index 0000000000..a8b1d89fd8 --- /dev/null +++ b/common/script/src/content/food/base.js @@ -0,0 +1,58 @@ +import {each, defaults} from 'lodash'; +import t from '../helpers/translator'; + +const CAN_BUY = true; +const CAN_DROP = true; + +let baseFood = { + Meat: { + target: 'Base', + article: '', + }, + Milk: { + target: 'White', + article: '', + }, + Potatoe: { + target: 'Desert', + article: 'a ', + }, + Strawberry: { + target: 'Red', + article: 'a ', + }, + Chocolate: { + target: 'Shade', + article: '', + }, + Fish: { + target: 'Skeleton', + article: 'a ', + }, + RottenMeat: { + target: 'Zombie', + article: '', + }, + CottonCandyPink: { + target: 'CottonCandyPink', + article: '', + }, + CottonCandyBlue: { + target: 'CottonCandyBlue', + article: '', + }, + Honey: { + target: 'Golden', + article: '', + }, +}; + +each(baseFood, (food, name) => { + defaults(food, { + canBuy: CAN_BUY, + canDrop: CAN_DROP, + text: t(`food${name}`), + }); +}); + +export default baseFood; diff --git a/common/script/src/content/food/birthday.js b/common/script/src/content/food/birthday.js new file mode 100644 index 0000000000..3ac6f363be --- /dev/null +++ b/common/script/src/content/food/birthday.js @@ -0,0 +1,58 @@ +import {each, defaults} from 'lodash'; +import t from '../helpers/translator'; + +const CAN_BUY = false; +const CAN_DROP = false; + +let cake = { + Cake_Skeleton: { + target: 'Skeleton', + article: '', + }, + Cake_Base: { + target: 'Base', + article: '', + }, + Cake_CottonCandyBlue: { + target: 'CottonCandyBlue', + article: '', + }, + Cake_CottonCandyPink: { + target: 'CottonCandyPink', + article: '', + }, + Cake_Shade: { + target: 'Shade', + article: '', + }, + Cake_White: { + target: 'White', + article: '', + }, + Cake_Golden: { + target: 'Golden', + article: '', + }, + Cake_Zombie: { + target: 'Zombie', + article: '', + }, + Cake_Desert: { + target: 'Desert', + article: '', + }, + Cake_Red: { + target: 'Red', + article: '', + }, +}; + +each(cake, (food, name) => { + defaults(food, { + canBuy: CAN_BUY, + canDrop: CAN_DROP, + text: t(`food${name}`), + }); +}); + +export default cake; diff --git a/common/script/src/content/food/fall.js b/common/script/src/content/food/fall.js new file mode 100644 index 0000000000..a0b99d6a2d --- /dev/null +++ b/common/script/src/content/food/fall.js @@ -0,0 +1,58 @@ +import {each, defaults} from 'lodash'; +import t from '../helpers/translator'; + +const CAN_BUY = false; +const CAN_DROP = false; + +let candy = { + Candy_Skeleton: { + target: 'Skeleton', + article: '', + }, + Candy_Base: { + target: 'Base', + article: '', + }, + Candy_CottonCandyBlue: { + target: 'CottonCandyBlue', + article: '', + }, + Candy_CottonCandyPink: { + target: 'CottonCandyPink', + article: '', + }, + Candy_Shade: { + target: 'Shade', + article: '', + }, + Candy_White: { + target: 'White', + article: '', + }, + Candy_Golden: { + target: 'Golden', + article: '', + }, + Candy_Zombie: { + target: 'Zombie', + article: '', + }, + Candy_Desert: { + target: 'Desert', + article: '', + }, + Candy_Red: { + target: 'Red', + article: '', + } +}; + +each(candy, (food, name) => { + defaults(food, { + canBuy: CAN_BUY, + canDrop: CAN_DROP, + text: t(`food${name}`), + }); +}); + +export default candy; diff --git a/common/script/src/content/food/index.js b/common/script/src/content/food/index.js index caab3e44aa..e80d064761 100644 --- a/common/script/src/content/food/index.js +++ b/common/script/src/content/food/index.js @@ -1,233 +1,19 @@ -import {each, defaults} from 'lodash'; +import {each, defaults, assign} from 'lodash'; import t from '../helpers/translator'; -let allFood = { - // Base - Meat: { - canBuy: true, - canDrop: true, - text: t('foodMeat'), - target: 'Base', - article: '' - }, - Milk: { - canBuy: true, - canDrop: true, - text: t('foodMilk'), - target: 'White', - article: '' - }, - Potatoe: { - canBuy: true, - canDrop: true, - text: t('foodPotatoe'), - target: 'Desert', - article: 'a ' - }, - Strawberry: { - canBuy: true, - canDrop: true, - text: t('foodStrawberry'), - target: 'Red', - article: 'a ' - }, - Chocolate: { - canBuy: true, - canDrop: true, - text: t('foodChocolate'), - target: 'Shade', - article: '' - }, - Fish: { - canBuy: true, - canDrop: true, - text: t('foodFish'), - target: 'Skeleton', - article: 'a ' - }, - RottenMeat: { - canBuy: true, - canDrop: true, - text: t('foodRottenMeat'), - target: 'Zombie', - article: '' - }, - CottonCandyPink: { - canBuy: true, - canDrop: true, - text: t('foodCottonCandyPink'), - target: 'CottonCandyPink', - article: '' - }, - CottonCandyBlue: { - canBuy: true, - canDrop: true, - text: t('foodCottonCandyBlue'), - target: 'CottonCandyBlue', - article: '' - }, - Honey: { - canBuy: true, - canDrop: true, - text: t('foodHoney'), - target: 'Golden', - article: '' - }, +import baseFood from './base'; +import saddle from './saddle'; +import cake from './birthday'; +import candy from './fall'; - Saddle: { - canBuy: true, - canDrop: false, - text: t('foodSaddleText'), - value: 5, - notes: t('foodSaddleNotes') - }, +let allFood = {}; - // Cake - Cake_Skeleton: { - canBuy: false, - canDrop: false, - text: t('foodCakeSkeleton'), - target: 'Skeleton', - article: '' - }, - Cake_Base: { - canBuy: false, - canDrop: false, - text: t('foodCakeBase'), - target: 'Base', - article: '' - }, - Cake_CottonCandyBlue: { - canBuy: false, - canDrop: false, - text: t('foodCakeCottonCandyBlue'), - target: 'CottonCandyBlue', - article: '' - }, - Cake_CottonCandyPink: { - canBuy: false, - canDrop: false, - text: t('foodCakeCottonCandyPink'), - target: 'CottonCandyPink', - article: '' - }, - Cake_Shade: { - canBuy: false, - canDrop: false, - text: t('foodCakeShade'), - target: 'Shade', - article: '' - }, - Cake_White: { - canBuy: false, - canDrop: false, - text: t('foodCakeWhite'), - target: 'White', - article: '' - }, - Cake_Golden: { - canBuy: false, - canDrop: false, - text: t('foodCakeGolden'), - target: 'Golden', - article: '' - }, - Cake_Zombie: { - canBuy: false, - canDrop: false, - text: t('foodCakeZombie'), - target: 'Zombie', - article: '' - }, - Cake_Desert: { - canBuy: false, - canDrop: false, - text: t('foodCakeDesert'), - target: 'Desert', - article: '' - }, - Cake_Red: { - canBuy: false, - canDrop: false, - text: t('foodCakeRed'), - target: 'Red', - article: '' - }, +assign(allFood, baseFood); +assign(allFood, saddle); +assign(allFood, cake); +assign(allFood, candy); - // Fall - Candy_Skeleton: { - canBuy: false, - canDrop: false, - text: t('foodCandySkeleton'), - target: 'Skeleton', - article: '' - }, - Candy_Base: { - canBuy: false, - canDrop: false, - text: t('foodCandyBase'), - target: 'Base', - article: '' - }, - Candy_CottonCandyBlue: { - canBuy: false, - canDrop: false, - text: t('foodCandyCottonCandyBlue'), - target: 'CottonCandyBlue', - article: '' - }, - Candy_CottonCandyPink: { - canBuy: false, - canDrop: false, - text: t('foodCandyCottonCandyPink'), - target: 'CottonCandyPink', - article: '' - }, - Candy_Shade: { - canBuy: false, - canDrop: false, - text: t('foodCandyShade'), - target: 'Shade', - article: '' - }, - Candy_White: { - canBuy: false, - canDrop: false, - text: t('foodCandyWhite'), - target: 'White', - article: '' - }, - Candy_Golden: { - canBuy: false, - canDrop: false, - text: t('foodCandyGolden'), - target: 'Golden', - article: '' - }, - Candy_Zombie: { - canBuy: false, - canDrop: false, - text: t('foodCandyZombie'), - target: 'Zombie', - article: '' - }, - Candy_Desert: { - canBuy: false, - canDrop: false, - text: t('foodCandyDesert'), - target: 'Desert', - article: '' - }, - Candy_Red: { - canBuy: false, - canDrop: false, - text: t('foodCandyRed'), - target: 'Red', - article: '' - } -}; - -each(allFood, function(food, key) { +each(allFood, (food, key) => { defaults(food, { value: 1, key: key, diff --git a/common/script/src/content/food/saddle.js b/common/script/src/content/food/saddle.js new file mode 100644 index 0000000000..2354a95236 --- /dev/null +++ b/common/script/src/content/food/saddle.js @@ -0,0 +1,13 @@ +import t from '../helpers/translator'; + +let saddle = { + Saddle: { + canBuy: true, + canDrop: false, + text: t('foodSaddleText'), + value: 5, + notes: t('foodSaddleNotes'), + }, +}; + +export default saddle;