()
| 33 | |
| 34 | // MARK: Main logic |
| 35 | async getMod() { |
| 36 | this.locale = await window.i18n.lang() |
| 37 | this.i18nUnits = await window.settings.units() |
| 38 | |
| 39 | window.detail_IPC.getMod(this.modColUUID).then(async (thisResponse) => { |
| 40 | this.mod = thisResponse[0] |
| 41 | this.storeInfo = thisResponse[1] |
| 42 | |
| 43 | I18N.local_entries = this.storeInfo.l10n[this.locale] || this.storeInfo.l10n.en || {} |
| 44 | |
| 45 | const basicPromises = [ |
| 46 | this.do_step_table(), |
| 47 | this.do_step_keyBinds(), |
| 48 | this.do_step_problems(), |
| 49 | this.do_step_badges(), |
| 50 | this.do_step_crops(), |
| 51 | ] |
| 52 | |
| 53 | if ( this.mod.modDesc.mapImage !== null ) { |
| 54 | MA.byId('map_image_div').clsShow() |
| 55 | MA.byId('map_image').src = this.mod.modDesc.mapImage |
| 56 | } |
| 57 | |
| 58 | |
| 59 | MA.byIdHTML('storeitems', '') |
| 60 | MA.byId('store_div').clsShow(Object.keys(this.storeInfo.vehicles).length !== 0 || Object.keys(this.storeInfo.placeables).length !== 0) |
| 61 | |
| 62 | try { |
| 63 | for ( const storeItemFile of Object.keys(this.storeInfo.vehicles).sort() ) { |
| 64 | const thisItem = this.storeInfo.vehicles[storeItemFile] |
| 65 | const thisVehicle = new client_BuilderVehicle( |
| 66 | storeItemFile, |
| 67 | thisItem, |
| 68 | this.mod.fileDetail.shortName, |
| 69 | this.locale, |
| 70 | this.mod.gameVersion, |
| 71 | this.storeInfo.brands |
| 72 | ) |
| 73 | |
| 74 | thisVehicle.populateCombos(this.storeInfo) |
| 75 | |
| 76 | window.lookItemMap[thisVehicle.lookItemMap[0]] = thisVehicle.lookItemMap[1] |
| 77 | |
| 78 | MA.byIdAppend('storeitems', thisVehicle.HTML) |
| 79 | thisVehicle.doCharts(this.i18nUnits) |
| 80 | } |
| 81 | |
| 82 | for ( const storeItemFile of Object.keys(this.storeInfo.placeables).sort() ) { |
| 83 | const thisItem = this.storeInfo.placeables[storeItemFile] |
| 84 | const thisPlace = new client_BuilderPlace( |
| 85 | thisItem, |
| 86 | this.locale, |
| 87 | this.mod.gameVersion |
| 88 | ) |
| 89 | MA.byIdAppend('storeitems', thisPlace.HTML) |
| 90 | } |
| 91 | } finally { |
| 92 | Promise.allSettled(basicPromises).then((results) => { |
no test coverage detected