import { IProductionToolRequest } from '@src/Tools/Production/IProductionToolRequest' ; import { Data } from '@src/Data/Data' ; export class ProductionRequestSchemaConverter { private static converters : ( ( schema : IProductionToolRequest ) => IProductionToolRequest ) [ ] = [ ( schema ) => { schema . input = [ ] ; return schema ; } , ( schema ) => { if ( schema . resourceMax . Desc_LiquidOil_C === 7500 ) { schema . resourceMax . Desc_LiquidOil_C = Data . resourceAmounts . Desc_LiquidOil_C ; } schema . resourceWeight = Data . resourceWeights ; schema . sinkableResources = [ ] ; return schema ; } , ] ; public static convert ( schema ) { let version = 0 ; if ( schema . version ) { version = schema . version ; } for ( ; version < this . converters . length ; version ++ ) { schema = this . converters [ version ] ( schema ) ; schema . version = version + 1 ; } return schema ; } }