From 2673f815269f1f1c872937962e973241954e3ba3 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Tue, 2 Jan 2024 17:35:09 +0800 Subject: [PATCH] Disable warnings and resources for standalone->spare cards Signed-off-by: Egor Savkin --- static/js/shop/count_resources.js | 4 ++-- static/js/shop/shop_store.js | 5 +++-- static/js/shop/warnings.js | 4 ++-- static/js/shop_data.js | 5 +++-- webpack.config.js | 12 ++++++------ 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/static/js/shop/count_resources.js b/static/js/shop/count_resources.js index c56eaef..c343f8c 100644 --- a/static/js/shop/count_resources.js +++ b/static/js/shop/count_resources.js @@ -64,9 +64,9 @@ export function CountResources(data, index) { return result; } -export function FillResources(data) { +export function FillResources(data, disabled) { return data.map((element, index) => { - element.counted_resources = CountResources(data, index); + element.counted_resources = disabled ? [] : CountResources(data, index); return element; }) } diff --git a/static/js/shop/shop_store.js b/static/js/shop/shop_store.js index 2b9d48d..08370aa 100644 --- a/static/js/shop/shop_store.js +++ b/static/js/shop/shop_store.js @@ -343,8 +343,9 @@ const useCart = ((set, get) => ({ if (crate_id === crate.id) { //console.log("--- CHECK ALERTS ---") let itemsCopy = Array.from(crate.items); - itemsCopy = FillResources(itemsCopy); - itemsCopy = TriggerWarnings(itemsCopy); + const disabled = !!get().crateParams(crate.crate_mode).warnings_disabled; + itemsCopy = FillResources(itemsCopy, disabled); + itemsCopy = TriggerWarnings(itemsCopy, disabled); const [crate_warnings, occupied] = TriggerCrateWarnings(crate); return { ...crate, diff --git a/static/js/shop/warnings.js b/static/js/shop/warnings.js index 4c71424..4ec7e74 100644 --- a/static/js/shop/warnings.js +++ b/static/js/shop/warnings.js @@ -97,10 +97,10 @@ const Types = { } } -export function TriggerWarnings(data) { +export function TriggerWarnings(data, disabled) { return data.map((element, index) => { if (!element.warnings) return element; - element.show_warnings = element.warnings + element.show_warnings = disabled ? [] :element.warnings .map((warning, _) => { if (!!Types[warning]) return Types[warning].trigger(data, index, element.counted_resources) ? {trigger: undefined, name: warning, ...Types[warning]} : null; diff --git a/static/js/shop_data.js b/static/js/shop_data.js index e1a96ae..3375987 100644 --- a/static/js/shop_data.js +++ b/static/js/shop_data.js @@ -28,9 +28,10 @@ const shop_data = { }, no_crate: { id: 'no_crate', - name: 'Standalone cards', + name: 'Spare cards', price: 0, - hp: -1 + hp: -1, + warnings_disabled: true } }, crateModeOrder: [ diff --git a/webpack.config.js b/webpack.config.js index 662f46e..550b70a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -21,11 +21,11 @@ module.exports = { debug: false, directives: { render_count: false, - options_log: true + options_log: false }, params: { ENV: process.env.NODE_ENV, - disable_card_highlight: true + disable_card_highlight: false }, verbose: false, } @@ -37,8 +37,8 @@ module.exports = { resolve: { extensions: ['.tsx', '.ts', '.js', '.jsx'], }, - //devtool: "inline-source-map", - //mode: "development" - devtool: false, - mode: "production" + devtool: "inline-source-map", + mode: "development" + //devtool: false, + //mode: "production" };