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;
|
||||
}
|
||||
|
||||
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;
|
||||
})
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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: [
|
||||
|
@ -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"
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user