add 11th edition support

This commit is contained in:
NilsUeter
2026-06-23 18:45:14 +02:00
parent d5c1dda11a
commit 040536d18c
4 changed files with 1190 additions and 13 deletions
+1 -1
View File
@@ -822,7 +822,7 @@ const ModelStats = ({ modelStat, index, showName, abilities }) => {
wounds = "/"; wounds = "/";
} }
const hasInvul = checkAbilitiesForInvul(abilities, name); const hasInvul = modelStat.invulnerableSave || checkAbilitiesForInvul(abilities, name);
return ( return (
<div className="flex flex-col"> <div className="flex flex-col">
<div style={{ display: "flex", gap: "1.2rem" }}> <div style={{ display: "flex", gap: "1.2rem" }}>
+2 -1
View File
@@ -9,6 +9,7 @@ import { Roster } from "./9th/Roster";
import { Roster as Roster10th } from "./10th/Roster"; import { Roster as Roster10th } from "./10th/Roster";
import { useLocalStorage } from "./helpers/useLocalStorage"; import { useLocalStorage } from "./helpers/useLocalStorage";
import { parseJSON, stringifyJSON } from "./helpers/json"; import { parseJSON, stringifyJSON } from "./helpers/json";
import { Create40kRoster11th } from "./roster40k-11th";
const throttle = (func, limit) => { const throttle = (func, limit) => {
let lastFunc; let lastFunc;
@@ -170,7 +171,7 @@ function App() {
setError(""); setError("");
} }
} else if (gameType == "Warhammer 40,000 11th Edition") { } else if (gameType == "Warhammer 40,000 11th Edition") {
roster = Create40kRoster10th(doc, gameType); roster = Create40kRoster11th(doc, gameType);
if (roster && roster.forces.length > 0) { if (roster && roster.forces.length > 0) {
setRoster(roster); setRoster(roster);
setEdition(11); setEdition(11);
+18 -11
View File
@@ -101,6 +101,7 @@ export class Model extends BaseNotes {
attacks = ""; attacks = "";
leadership = 7; leadership = 7;
save = ""; save = "";
invulnerableSave = "";
rangedWeapons = []; rangedWeapons = [];
meleeWeapons = []; meleeWeapons = [];
@@ -870,37 +871,43 @@ function ParseModelStatsProfiles(profiles, unit, unitName) {
const charName = char.getAttribute("name"); const charName = char.getAttribute("name");
if (!charName) continue; if (!charName) continue;
if (char.textContent) { const charValue = char.textContent?.trim();
if (charValue) {
switch (charName) { switch (charName) {
case "M": case "M":
model.move = char.textContent; model.move = charValue;
break; break;
case "WS": case "WS":
model.ws = char.textContent; model.ws = charValue;
break; break;
case "BS": case "BS":
model.bs = char.textContent; model.bs = charValue;
break; break;
case "S": case "S":
model.str = +char.textContent; model.str = +charValue;
break; break;
case "T": case "T":
model.toughness = +char.textContent; model.toughness = +charValue;
break; break;
case "W": case "W":
model.wounds = +char.textContent; model.wounds = +charValue;
break; break;
case "A": case "A":
model.attacks = char.textContent; model.attacks = charValue;
break; break;
case "LD": case "LD":
model.leadership = char.textContent; model.leadership = charValue;
break; break;
case "SV": case "SV":
model.save = char.textContent; case "Sv":
model.save = charValue;
break;
case "InSv":
case "Invulnerable Save":
if (charValue !== "-") model.invulnerableSave = charValue;
break; break;
case "OC": case "OC":
model.oc = char.textContent; model.oc = charValue;
break; break;
} }
} }
File diff suppressed because it is too large Load Diff