forked from M-Labs/web2019
Disable warnings and resources for standalone->spare cards
Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
parent
a9e24c6202
commit
2673f81526
|
@ -64,9 +64,9 @@ export function CountResources(data, index) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function FillResources(data) {
|
export function FillResources(data, disabled) {
|
||||||
return data.map((element, index) => {
|
return data.map((element, index) => {
|
||||||
element.counted_resources = CountResources(data, index);
|
element.counted_resources = disabled ? [] : CountResources(data, index);
|
||||||
return element;
|
return element;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,8 +343,9 @@ const useCart = ((set, get) => ({
|
||||||
if (crate_id === crate.id) {
|
if (crate_id === crate.id) {
|
||||||
//console.log("--- CHECK ALERTS ---")
|
//console.log("--- CHECK ALERTS ---")
|
||||||
let itemsCopy = Array.from(crate.items);
|
let itemsCopy = Array.from(crate.items);
|
||||||
itemsCopy = FillResources(itemsCopy);
|
const disabled = !!get().crateParams(crate.crate_mode).warnings_disabled;
|
||||||
itemsCopy = TriggerWarnings(itemsCopy);
|
itemsCopy = FillResources(itemsCopy, disabled);
|
||||||
|
itemsCopy = TriggerWarnings(itemsCopy, disabled);
|
||||||
const [crate_warnings, occupied] = TriggerCrateWarnings(crate);
|
const [crate_warnings, occupied] = TriggerCrateWarnings(crate);
|
||||||
return {
|
return {
|
||||||
...crate,
|
...crate,
|
||||||
|
|
|
@ -97,10 +97,10 @@ const Types = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TriggerWarnings(data) {
|
export function TriggerWarnings(data, disabled) {
|
||||||
return data.map((element, index) => {
|
return data.map((element, index) => {
|
||||||
if (!element.warnings) return element;
|
if (!element.warnings) return element;
|
||||||
element.show_warnings = element.warnings
|
element.show_warnings = disabled ? [] :element.warnings
|
||||||
.map((warning, _) => {
|
.map((warning, _) => {
|
||||||
if (!!Types[warning])
|
if (!!Types[warning])
|
||||||
return Types[warning].trigger(data, index, element.counted_resources) ? {trigger: undefined, name: warning, ...Types[warning]} : null;
|
return Types[warning].trigger(data, index, element.counted_resources) ? {trigger: undefined, name: warning, ...Types[warning]} : null;
|
||||||
|
|
|
@ -28,9 +28,10 @@ const shop_data = {
|
||||||
},
|
},
|
||||||
no_crate: {
|
no_crate: {
|
||||||
id: 'no_crate',
|
id: 'no_crate',
|
||||||
name: 'Standalone cards',
|
name: 'Spare cards',
|
||||||
price: 0,
|
price: 0,
|
||||||
hp: -1
|
hp: -1,
|
||||||
|
warnings_disabled: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
crateModeOrder: [
|
crateModeOrder: [
|
||||||
|
|
|
@ -21,11 +21,11 @@ module.exports = {
|
||||||
debug: false,
|
debug: false,
|
||||||
directives: {
|
directives: {
|
||||||
render_count: false,
|
render_count: false,
|
||||||
options_log: true
|
options_log: false
|
||||||
},
|
},
|
||||||
params: {
|
params: {
|
||||||
ENV: process.env.NODE_ENV,
|
ENV: process.env.NODE_ENV,
|
||||||
disable_card_highlight: true
|
disable_card_highlight: false
|
||||||
},
|
},
|
||||||
verbose: false,
|
verbose: false,
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ module.exports = {
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.tsx', '.ts', '.js', '.jsx'],
|
extensions: ['.tsx', '.ts', '.js', '.jsx'],
|
||||||
},
|
},
|
||||||
//devtool: "inline-source-map",
|
devtool: "inline-source-map",
|
||||||
//mode: "development"
|
mode: "development"
|
||||||
devtool: false,
|
//devtool: false,
|
||||||
mode: "production"
|
//mode: "production"
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue