Skip to content

Commit

Permalink
bootstrap crop calendar for 25 (not ready yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsage committed Nov 20, 2024
1 parent 19837dc commit 3935cf1
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 291 deletions.
6 changes: 0 additions & 6 deletions lib/modCheckLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -1471,10 +1471,7 @@ class saveGameManager {
fileDate : thisStats.mtime,
fullName : thisFolder.name,
fullPath : path.join(this.#fullPath, thisFolder.name),
/* eslint-x-disable no-await-in-loop */
...JSON.parse(parseSaveGame(path.join(this.#fullPath, thisFolder.name))),
// ...await this.#processSave(path.join(this.#fullPath, thisFolder.name)),
/* eslint-x-enable no-await-in-loop */
}
} else if ( thisFolder.name === 'savegameBackup' ) {
this.#backPath = path.join(this.#fullPath, 'savegameBackup')
Expand All @@ -1501,10 +1498,7 @@ class saveGameManager {
fileDate : folderDateObj,
fullName : thisFolder.name,
fullPath : path.join(this.#backPath, thisFolder.name),
/* eslint-x-disable no-await-in-loop */
...JSON.parse(parseSaveGame(path.join(this.#backPath, thisFolder.name))),
// ...await this.#processSave(path.join(this.#backPath, thisFolder.name)),
/* eslint-x-enable no-await-in-loop */
})
} catch (err) {
this.#log.notice(`Invalid backup save folder : ${thisFolder.name} :: ${err}`)
Expand Down
3 changes: 2 additions & 1 deletion renderer/renderJS/detail_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ class windowState {
return clientMakeCropCalendar(
this.mod.modDesc.cropInfo,
this.mod.modDesc?.mapIsSouth || false,
this.mod.modDesc?.cropWeather || null
this.mod.modDesc?.cropWeather || null,
this.mod.gameVersion || 22
).then((html) => {
MA.byIdHTML('crop-table', html)
})
Expand Down
67 changes: 35 additions & 32 deletions renderer/renderJS/util/cropcal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,49 @@

/* global I18N */

//TODO: add 25 stuff
//TODO: convert to basegame l10n, and remove keys in standard translations
/* eslint-disable sort-keys */
const knownCrops = {
wheat : { name : 'croptype_wheat', icon : 'wheat' },
barley : { name : 'croptype_barley', icon : 'barley' },
canola : { name : 'croptype_canola', icon : 'canola' },
oat : { name : 'croptype_oat', icon : 'oat' },
sorghum : { name : 'croptype_sorghum', icon : 'sorghum' },
cotton : { name : 'croptype_cotton', icon : 'cotton' },
maize : { name : 'croptype_maize', icon : 'maize' },
sunflower : { name : 'croptype_sunflower', icon : 'sunflower' },
soybean : { name : 'croptype_soybean', icon : 'soybean' },
potato : { name : 'croptype_potato', icon : 'potato' },
sugarbeet : { name : 'croptype_sugarbeet', icon : 'sugarbeet' },
sugarcane : { name : 'croptype_sugarcane', icon : 'sugarcane' },
poplar : { name : 'croptype_poplar', icon : 'poplar' },
oilseedradish : { name : 'croptype_oilseedradish', icon : 'oilradish' },
grass : { name : 'croptype_grass', icon : 'grass' },
grape : { name : 'croptype_grape', icon : 'grape' },
olive : { name : 'croptype_olive', icon : 'olive' },
clover : { name : 'croptype_clover', icon : 'clover' },
alfalfa : { name : 'croptype_alfalfa', icon : 'alfalfa' },
onion : { name : 'croptype_onion', icon : 'onion' },
carrot : { name : 'croptype_carrot', icon : 'carrot' },
whitecabbage : { name : 'croptype_whitecabbage', icon : 'whitecabbage' },
redcabbage : { name : 'croptype_redcabbage', icon : 'redcabbage' },
rye : { name : 'croptype_rye', icon : 'rye' },
poppy : { name : 'croptype_poppy', icon : 'poppy' },
spelt : { name : 'croptype_spelt', icon : 'spelt' },
wheat : { name : '$l10n_filltype_wheat', icon : 'wheat' },
barley : { name : '$l10n_filltype_barley', icon : 'barley' },
canola : { name : '$l10n_filltype_canola', icon : 'canola' },
oat : { name : '$l10n_filltype_oat', icon : 'oat' },
sorghum : { name : '$l10n_filltype_sorghum', icon : 'sorghum' },
cotton : { name : '$l10n_filltype_cotton', icon : 'cotton' },
maize : { name : '$l10n_filltype_maize', icon : 'maize' },
sunflower : { name : '$l10n_filltype_sunflower', icon : 'sunflower' },
soybean : { name : '$l10n_filltype_soybean', icon : 'soybean' },
potato : { name : '$l10n_filltype_potato', icon : 'potato' },
sugarbeet : { name : '$l10n_filltype_sugarbeet', icon : 'sugarbeet' },
sugarcane : { name : '$l10n_filltype_sugarcane', icon : 'sugarcane' },
poplar : { name : '$l10n_filltype_poplar', icon : 'poplar' },
oilseedradish : { name : '$l10n_filltype_oilradish', icon : 'oilradish' },
grass : { name : '$l10n_filltype_grass', icon : 'grass' },
grape : { name : '$l10n_filltype_grape', icon : 'grape' },
olive : { name : '$l10n_filltype_olive', icon : 'olive' },
clover : { name : 'croptype_clover', icon : 'clover' },
alfalfa : { name : 'croptype_alfalfa', icon : 'alfalfa' },
onion : { name : '$l10n_filltype_onion', icon : 'onion' },
carrot : { name : '$l10n_filltype_carrot', icon : 'carrot' },
whitecabbage : { name : '$l10n_filltype_whitecabbage', icon : 'whitecabbage' },
redcabbage : { name : '$l10n_filltype_redcabbage', icon : 'redcabbage' },
rye : { name : 'croptype_rye', icon : 'rye' },
poppy : { name : 'croptype_poppy', icon : 'poppy' },
spelt : { name : 'croptype_spelt', icon : 'spelt' },
rice : { name : '$l10n_filltype_rice', icon : 'rice'},
ricelonggrain : { name : '$l10n_filltype_ricelonggrain', icon : 'ricelonggrain'},
greenbean : { name : '$l10n_filltype_greenbean', icon : 'greenbean'},
pea : { name : '$l10n_filltype_pea', icon : 'pea'},
spinach : { name : '$l10n_filltype_spinach', icon : 'spinach'},
}
/* eslint-enable sort-keys */

const nameMonth = ['mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec', 'jan', 'feb']

async function getCropInfo(name) {
async function getCropInfo(name, version) {
if ( ! Object.hasOwn(knownCrops, name) ) {
return `${name.slice(0, 1).toUpperCase()}${name.slice(1)}`
}
const theName = I18N.defer(knownCrops[name].name, false)
const theName = I18N.unwrap_base(knownCrops[name].name, version)
return `<fillType style="font-size: calc(1.35rem + .6vw)" name="${knownCrops[name].icon}"></fillType> ${theName}`
}

Expand All @@ -63,7 +66,7 @@ function orderLine(lineArray, isSouth) {

const c2f = (value) => Math.floor((value * 9/5) + 32)

async function clientMakeCropCalendar(theData, isSouth = false, weather = null) {
async function clientMakeCropCalendar(theData, isSouth = false, weather = null, version = 22) {
const tableLines = []
let evenRow = false

Expand Down Expand Up @@ -112,7 +115,7 @@ async function clientMakeCropCalendar(theData, isSouth = false, weather = null)
'pe-2'
],
// eslint-disable-next-line no-await-in-loop
await getCropInfo(crop.name),
await getCropInfo(crop.name, version),
false,
1,
2
Expand Down
21 changes: 0 additions & 21 deletions translations/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,10 @@
"cropmonth_oct" : "Oct",
"cropmonth_sep" : "Sep",
"croptype_alfalfa" : "Alfalfa",
"croptype_barley" : "Barley",
"croptype_canola" : "Canola",
"croptype_carrot" : "Carrot",
"croptype_clover" : "Clover",
"croptype_cotton" : "Cotton",
"croptype_grape" : "Grapes",
"croptype_grass" : "Grass",
"croptype_maize" : "Maize",
"croptype_oat" : "Oat",
"croptype_oilseedradish" : "油菜单雷德文",
"croptype_olive" : "Olives",
"croptype_onion" : "Onion",
"croptype_poplar" : "Poplar",
"croptype_poppy" : "Poppy",
"croptype_potato" : "Potato",
"croptype_redcabbage" : "红色客车",
"croptype_rye" : "Rye",
"croptype_sorghum" : "Sorghum",
"croptype_soybean" : "Soybean",
"croptype_spelt" : "Spelt",
"croptype_sugarbeet" : "Sugarbeet",
"croptype_sugarcane" : "糖冠军",
"croptype_sunflower" : "Sunflower",
"croptype_wheat" : "Wheat",
"croptype_whitecabbage" : "白色笼子",
"delete" : "是的,删除模组",
"destination" : "目标集合",
"destination_clear" : "目标文件不存在,可以继续",
Expand Down
21 changes: 0 additions & 21 deletions translations/cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,10 @@
"cropmonth_oct" : "Říjen",
"cropmonth_sep" : "Září",
"croptype_alfalfa" : "Vojtěška",
"croptype_barley" : "Ječmen",
"croptype_canola" : "Řepka",
"croptype_carrot" : "Mrkev",
"croptype_clover" : "Jetel",
"croptype_cotton" : "Bavlna",
"croptype_grape" : "Hroznové víno",
"croptype_grass" : "Tráva",
"croptype_maize" : "Kukuřice",
"croptype_oat" : "Oves",
"croptype_oilseedradish" : "Ředkev olejná",
"croptype_olive" : "Olivy",
"croptype_onion" : "Cibule",
"croptype_poplar" : "Topol",
"croptype_poppy" : "Poppy",
"croptype_potato" : "Brambory",
"croptype_redcabbage" : "Červené zelí",
"croptype_rye" : "Žito",
"croptype_sorghum" : "Čirok",
"croptype_soybean" : "Sójové boby",
"croptype_spelt" : "Špalda",
"croptype_sugarbeet" : "Cukrová řepa",
"croptype_sugarcane" : "Cukrová třtina",
"croptype_sunflower" : "Slunečnice",
"croptype_wheat" : "Pšenice",
"croptype_whitecabbage" : "Bílé zelí",
"delete" : "Ano, odstranit módy",
"destination" : "Cílová kolekce:",
"destination_clear" : "Cílový soubor neexistuje, je dobré jít",
Expand Down
21 changes: 0 additions & 21 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,10 @@
"cropmonth_oct" : "Okt",
"cropmonth_sep" : "Sep",
"croptype_alfalfa" : "Luzerne",
"croptype_barley" : "Gerste",
"croptype_canola" : "Raps",
"croptype_carrot" : "Karotte",
"croptype_clover" : "Klee",
"croptype_cotton" : "Baumwolle",
"croptype_grape" : "Trauben",
"croptype_grass" : "Gras",
"croptype_maize" : "Mais",
"croptype_oat" : "Hafer",
"croptype_oilseedradish" : "Ölrettich",
"croptype_olive" : "Oliven",
"croptype_onion" : "Zwiebel",
"croptype_poplar" : "Pappeln",
"croptype_poppy" : "Mohn",
"croptype_potato" : "Kartoffeln",
"croptype_redcabbage" : "Rotkohl",
"croptype_rye" : "Roggen",
"croptype_sorghum" : "Sorghum",
"croptype_soybean" : "Sojabohnen",
"croptype_spelt" : "Dinkel",
"croptype_sugarbeet" : "Zuckerrüben",
"croptype_sugarcane" : "Zuckerrohr",
"croptype_sunflower" : "Sonnenblume",
"croptype_wheat" : "Weizen",
"croptype_whitecabbage" : "Weißkohl",
"delete" : "Ja, Mod löschen",
"destination" : "Bestimmungsort:",
"destination_clear" : "Die Zieldatei existiert nicht, alles in Ordnung",
Expand Down
21 changes: 0 additions & 21 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,10 @@
"cropmonth_oct" : "Oct",
"cropmonth_sep" : "Sep",
"croptype_alfalfa" : "Alfalfa",
"croptype_barley" : "Barley",
"croptype_canola" : "Canola",
"croptype_carrot" : "Carrot",
"croptype_clover" : "Clover",
"croptype_cotton" : "Cotton",
"croptype_grape" : "Grapes",
"croptype_grass" : "Grass",
"croptype_maize" : "Maize",
"croptype_oat" : "Oat",
"croptype_oilseedradish" : "Oilseed Radish",
"croptype_olive" : "Olives",
"croptype_onion" : "Onion",
"croptype_poplar" : "Poplar",
"croptype_poppy" : "Poppy",
"croptype_potato" : "Potato",
"croptype_redcabbage" : "Red Cabbage",
"croptype_rye" : "Rye",
"croptype_sorghum" : "Sorghum",
"croptype_soybean" : "Soybean",
"croptype_spelt" : "Spelt",
"croptype_sugarbeet" : "Sugarbeet",
"croptype_sugarcane" : "Sugar Cane",
"croptype_sunflower" : "Sunflower",
"croptype_wheat" : "Wheat",
"croptype_whitecabbage" : "White Cabbage",
"delete" : "Yes, Delete Mods",
"destination" : "Destination Collection",
"destination_clear" : "Destination file does not exist, good to go",
Expand Down
21 changes: 0 additions & 21 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,10 @@
"cropmonth_oct" : "Oct",
"cropmonth_sep" : "Sept",
"croptype_alfalfa" : "Alfalfa",
"croptype_barley" : "Cebada",
"croptype_canola" : "Colza",
"croptype_carrot" : "Zanahoria",
"croptype_clover" : "Trébol",
"croptype_cotton" : "Algodón",
"croptype_grape" : "Uvas",
"croptype_grass" : "Hierba",
"croptype_maize" : "Maíz",
"croptype_oat" : "Avena",
"croptype_oilseedradish" : "Rabano Oleífero",
"croptype_olive" : "Aceitunas",
"croptype_onion" : "Cebolla",
"croptype_poplar" : "Álamo",
"croptype_poppy" : "Amapola",
"croptype_potato" : "Patata",
"croptype_redcabbage" : "Col Roja",
"croptype_rye" : "Centeno",
"croptype_sorghum" : "Sorgo",
"croptype_soybean" : "Habas De Soja",
"croptype_spelt" : "Espelta",
"croptype_sugarbeet" : "Remolacha Azucarera",
"croptype_sugarcane" : "Caña de Azúcar",
"croptype_sunflower" : "Girasol",
"croptype_wheat" : "Trigo",
"croptype_whitecabbage" : "Col Blanca",
"delete" : "Sí, eliminar el mod.",
"destination" : "Destino previsto:",
"destination_clear" : "El archivo de destino no existe, listo para funcionar",
Expand Down
21 changes: 0 additions & 21 deletions translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,10 @@
"cropmonth_oct" : "Oct",
"cropmonth_sep" : "Sep",
"croptype_alfalfa" : "Luzerne",
"croptype_barley" : "Orge",
"croptype_canola" : "Colza",
"croptype_carrot" : "Carotte",
"croptype_clover" : "Trèfle",
"croptype_cotton" : "Coton",
"croptype_grape" : "Raisin",
"croptype_grass" : "Herbe",
"croptype_maize" : "Maïs",
"croptype_oat" : "Avoine",
"croptype_oilseedradish" : "Radis oléagineux",
"croptype_olive" : "Olives",
"croptype_onion" : "Oignon",
"croptype_poplar" : "Peuplier",
"croptype_poppy" : "Coquelicot",
"croptype_potato" : "P. de terre",
"croptype_redcabbage" : "Chou rouge",
"croptype_rye" : "Seigle",
"croptype_sorghum" : "Sorgho",
"croptype_soybean" : "Soja",
"croptype_spelt" : "Épeautre",
"croptype_sugarbeet" : "B. sucrières",
"croptype_sugarcane" : "Canne à sucre",
"croptype_sunflower" : "Tournesols",
"croptype_wheat" : "Blé",
"croptype_whitecabbage" : "Chou blanc",
"delete" : "Oui, Delete Mod",
"destination" : "Destination prévue :",
"destination_clear" : "Le fichier de destination n'existe pas, c'est bon à prendre",
Expand Down
21 changes: 0 additions & 21 deletions translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,10 @@
"cropmonth_oct" : "Ottobre",
"cropmonth_sep" : "Settembre",
"croptype_alfalfa" : "Alfalfa",
"croptype_barley" : "Orzo",
"croptype_canola" : "Colza",
"croptype_carrot" : "Carote",
"croptype_clover" : "Trifoglio",
"croptype_cotton" : "Cotone",
"croptype_grape" : "Uva",
"croptype_grass" : "Erba",
"croptype_maize" : "Granturco",
"croptype_oat" : "Avena",
"croptype_oilseedradish" : "Olio ",
"croptype_olive" : "Olive",
"croptype_onion" : "Cipolle",
"croptype_poplar" : "Pioppo",
"croptype_poppy" : "Papavero",
"croptype_potato" : "Patate",
"croptype_redcabbage" : "Cavolo Rosso",
"croptype_rye" : "Segale",
"croptype_sorghum" : "Ceci",
"croptype_soybean" : "Soia",
"croptype_spelt" : "Farro",
"croptype_sugarbeet" : "Barbabietola",
"croptype_sugarcane" : "Canna da Zucchero",
"croptype_sunflower" : "Girasoli",
"croptype_wheat" : "Grano",
"croptype_whitecabbage" : "Cavolo Bianco",
"delete" : "Sì, Elimina Mods",
"destination" : "Collezione Di Destinazione",
"destination_clear" : "Il file di destinazione non esiste, vuoi andare avanti",
Expand Down
Loading

0 comments on commit 3935cf1

Please sign in to comment.