1
0
Fork 0

Disable warnings and resources for standalone->spare cards

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2024-01-02 17:35:09 +08:00
parent a9e24c6202
commit 2673f81526
5 changed files with 16 additions and 14 deletions

View File

@ -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;
})
}

View File

@ -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,

View File

@ -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;

View File

@ -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: [

View File

@ -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"
};