From 6693e9fca94d0dafc69a2138d0ebb1fdc7c77788 Mon Sep 17 00:00:00 2001 From: Alys Date: Mon, 7 Nov 2016 07:33:19 +1000 Subject: [PATCH] replace candy food with normal food and enhance canBuy / canDrop code (#8194) * change food to normal; add variables to choose type of food; add canBuy, canDrop to cake * reinstate ability to control canBuy and canDrop separately --- test/common/ops/purchase.js | 2 +- website/common/script/content/index.js | 128 +++++++++++++++++-------- 2 files changed, 89 insertions(+), 41 deletions(-) diff --git a/test/common/ops/purchase.js b/test/common/ops/purchase.js index 51c1db2594..4df2bdeda7 100644 --- a/test/common/ops/purchase.js +++ b/test/common/ops/purchase.js @@ -11,7 +11,7 @@ import { } from '../../helpers/common.helper'; describe('shared.ops.purchase', () => { - const SEASONAL_FOOD = 'Candy_Base'; + const SEASONAL_FOOD = 'Meat'; let user; let goldPoints = 40; let gemsBought = 40; diff --git a/website/common/script/content/index.js b/website/common/script/content/index.js index 68ede6a9a8..f6816b9355 100644 --- a/website/common/script/content/index.js +++ b/website/common/script/content/index.js @@ -163,96 +163,104 @@ api.premiumMounts = stable.premiumMounts; api.specialMounts = stable.specialMounts; api.mountInfo = stable.mountInfo; +// For seasonal events, change these booleans: +let canBuyNormalFood = true; +let canDropNormalFood = true; +let canBuyCandyFood = false; +let canDropCandyFood = false; +let canBuyCakeFood = false; +let canDropCakeFood = false; + api.food = { Meat: { text: t('foodMeat'), target: 'Base', article: '', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, Milk: { text: t('foodMilk'), target: 'White', article: '', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, Potatoe: { text: t('foodPotatoe'), target: 'Desert', article: 'a ', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, Strawberry: { text: t('foodStrawberry'), target: 'Red', article: 'a ', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, Chocolate: { text: t('foodChocolate'), target: 'Shade', article: '', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, Fish: { text: t('foodFish'), target: 'Skeleton', article: 'a ', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, RottenMeat: { text: t('foodRottenMeat'), target: 'Zombie', article: '', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, CottonCandyPink: { text: t('foodCottonCandyPink'), target: 'CottonCandyPink', article: '', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, CottonCandyBlue: { text: t('foodCottonCandyBlue'), target: 'CottonCandyBlue', article: '', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, Honey: { text: t('foodHoney'), target: 'Golden', article: '', canBuy: (function() { - return false; + return canBuyNormalFood; }), - canDrop: false, + canDrop: canDropNormalFood, }, Saddle: { canBuy: (function() { @@ -266,141 +274,181 @@ api.food = { text: t('foodCakeSkeleton'), target: 'Skeleton', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Cake_Base: { text: t('foodCakeBase'), target: 'Base', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Cake_CottonCandyBlue: { text: t('foodCakeCottonCandyBlue'), target: 'CottonCandyBlue', article: '', + canBuy: (function() { + return canBuyCandyFood; + }), + canDrop: canDropCakeFood, }, Cake_CottonCandyPink: { text: t('foodCakeCottonCandyPink'), target: 'CottonCandyPink', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Cake_Shade: { text: t('foodCakeShade'), target: 'Shade', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Cake_White: { text: t('foodCakeWhite'), target: 'White', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Cake_Golden: { text: t('foodCakeGolden'), target: 'Golden', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Cake_Zombie: { text: t('foodCakeZombie'), target: 'Zombie', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Cake_Desert: { text: t('foodCakeDesert'), target: 'Desert', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Cake_Red: { text: t('foodCakeRed'), target: 'Red', article: '', + canBuy: (function() { + return canBuyCakeFood; + }), + canDrop: canDropCakeFood, }, Candy_Skeleton: { text: t('foodCandySkeleton'), target: 'Skeleton', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_Base: { text: t('foodCandyBase'), target: 'Base', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_CottonCandyBlue: { text: t('foodCandyCottonCandyBlue'), target: 'CottonCandyBlue', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_CottonCandyPink: { text: t('foodCandyCottonCandyPink'), target: 'CottonCandyPink', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_Shade: { text: t('foodCandyShade'), target: 'Shade', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_White: { text: t('foodCandyWhite'), target: 'White', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_Golden: { text: t('foodCandyGolden'), target: 'Golden', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_Zombie: { text: t('foodCandyZombie'), target: 'Zombie', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_Desert: { text: t('foodCandyDesert'), target: 'Desert', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, }, Candy_Red: { text: t('foodCandyRed'), target: 'Red', article: '', canBuy: (function() { - return true; + return canBuyCandyFood; }), - canDrop: true, + canDrop: canDropCandyFood, } };