ed-mcp 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +35 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28692,7 +28692,7 @@ async function canonical(p) {
|
|
|
28692
28692
|
}
|
|
28693
28693
|
|
|
28694
28694
|
// src/version.ts
|
|
28695
|
-
var VERSION = "0.3.
|
|
28695
|
+
var VERSION = "0.3.1";
|
|
28696
28696
|
|
|
28697
28697
|
// src/config.ts
|
|
28698
28698
|
var ConfigError = class extends Error {
|
|
@@ -29666,8 +29666,10 @@ var Catalog = class {
|
|
|
29666
29666
|
const same4 = m.trade_group ? this.d.materials.filter((x) => x.kind === m.kind && x.trade_group === m.trade_group).sort((a, b) => a.grade - b.grade) : [m];
|
|
29667
29667
|
return { ...m, same_group: same4, trade_rules: TRADE_RULES };
|
|
29668
29668
|
}
|
|
29669
|
-
/** Coriolis feature ranges, [min, max], for a blueprint id at a grade, or null. */
|
|
29670
|
-
blueprintFeatures(blueprintId2, grade) {
|
|
29669
|
+
/** Coriolis feature ranges, [min, max], for a blueprint id at a grade on a module group, or null. */
|
|
29670
|
+
blueprintFeatures(blueprintId2, grade, grp) {
|
|
29671
|
+
const own2 = this.d.groups.find((g) => g.id === grp)?.features?.[blueprintId2];
|
|
29672
|
+
if (own2) return own2[String(grade)] ?? null;
|
|
29671
29673
|
const b = this.d.blueprints.find((x) => x.id === blueprintId2);
|
|
29672
29674
|
return b?.features?.[String(grade)] ?? null;
|
|
29673
29675
|
}
|
|
@@ -29806,11 +29808,15 @@ function buildCatalog(raw, statics, opts = {}) {
|
|
|
29806
29808
|
const spJson = json2(raw.specials, "specials");
|
|
29807
29809
|
const modJson = json2(raw.modifications, "modifications");
|
|
29808
29810
|
const actJson = raw.actions === void 0 ? null : json2(raw.actions, "actions");
|
|
29809
|
-
const
|
|
29811
|
+
const warnings = [];
|
|
29812
|
+
const idOf = /* @__PURE__ */ new Map();
|
|
29813
|
+
const featuresOf = /* @__PURE__ */ new Map();
|
|
29814
|
+
const byId = /* @__PURE__ */ new Map();
|
|
29815
|
+
for (const [key, v] of Object.entries(bpJson)) {
|
|
29810
29816
|
const b = v;
|
|
29811
|
-
|
|
29812
|
-
id: b.fdname ??
|
|
29813
|
-
name: b.name ??
|
|
29817
|
+
const bp = {
|
|
29818
|
+
id: b.fdname ?? key,
|
|
29819
|
+
name: b.name ?? key,
|
|
29814
29820
|
modules: b.modulename ?? [],
|
|
29815
29821
|
grades: Object.fromEntries(
|
|
29816
29822
|
Object.entries(b.grades ?? {}).map(([g, x]) => [g, counts(x.components)])
|
|
@@ -29819,7 +29825,22 @@ function buildCatalog(raw, statics, opts = {}) {
|
|
|
29819
29825
|
Object.entries(b.grades ?? {}).map(([g, x]) => [g, ranges(x.features)])
|
|
29820
29826
|
)
|
|
29821
29827
|
};
|
|
29822
|
-
|
|
29828
|
+
idOf.set(key, bp.id);
|
|
29829
|
+
featuresOf.set(key, bp.features);
|
|
29830
|
+
const prev = byId.get(bp.id);
|
|
29831
|
+
if (!prev) {
|
|
29832
|
+
byId.set(bp.id, bp);
|
|
29833
|
+
continue;
|
|
29834
|
+
}
|
|
29835
|
+
if (JSON.stringify(prev.grades) !== JSON.stringify(bp.grades)) {
|
|
29836
|
+
warnings.push(
|
|
29837
|
+
`Blueprints with the name ${bp.id} cost different materials; using one of them.`
|
|
29838
|
+
);
|
|
29839
|
+
}
|
|
29840
|
+
const main2 = key === bp.id ? bp : prev;
|
|
29841
|
+
byId.set(bp.id, { ...main2, modules: [.../* @__PURE__ */ new Set([...prev.modules, ...bp.modules])] });
|
|
29842
|
+
}
|
|
29843
|
+
const blueprints = [...byId.values()];
|
|
29823
29844
|
const experimentals = Object.entries(spJson).map(([id, v]) => {
|
|
29824
29845
|
const s = v;
|
|
29825
29846
|
const edname = s.edname ?? id;
|
|
@@ -29833,12 +29854,12 @@ function buildCatalog(raw, statics, opts = {}) {
|
|
|
29833
29854
|
});
|
|
29834
29855
|
const groups = Object.entries(modJson).map(([id, v]) => {
|
|
29835
29856
|
const g = v;
|
|
29836
|
-
|
|
29857
|
+
const group = {
|
|
29837
29858
|
id,
|
|
29838
29859
|
names: statics.groups[id] ?? [],
|
|
29839
29860
|
blueprints: Object.fromEntries(
|
|
29840
|
-
Object.entries(g.blueprints ?? {}).map(([
|
|
29841
|
-
|
|
29861
|
+
Object.entries(g.blueprints ?? {}).map(([key, x]) => [
|
|
29862
|
+
idOf.get(key) ?? key,
|
|
29842
29863
|
Object.fromEntries(
|
|
29843
29864
|
Object.entries(x.grades ?? {}).map(([grade, y]) => [grade, y.engineers ?? []])
|
|
29844
29865
|
)
|
|
@@ -29846,6 +29867,8 @@ function buildCatalog(raw, statics, opts = {}) {
|
|
|
29846
29867
|
),
|
|
29847
29868
|
experimentals: g.specials ?? []
|
|
29848
29869
|
};
|
|
29870
|
+
const features = Object.keys(g.blueprints ?? {}).filter((key) => idOf.has(key) && idOf.get(key) !== key).map((key) => [idOf.get(key), featuresOf.get(key)]);
|
|
29871
|
+
return features.length ? { ...group, features: Object.fromEntries(features) } : group;
|
|
29849
29872
|
});
|
|
29850
29873
|
const materials = parseCsv(raw.materials).filter((r) => r.symbol && r.name && ["Raw", "Manufactured", "Encoded"].includes(r.type ?? "")).map((r) => ({
|
|
29851
29874
|
symbol: r.symbol,
|
|
@@ -29881,7 +29904,6 @@ function buildCatalog(raw, statics, opts = {}) {
|
|
|
29881
29904
|
outfitting,
|
|
29882
29905
|
engineers: statics.engineers
|
|
29883
29906
|
});
|
|
29884
|
-
const warnings = [];
|
|
29885
29907
|
if (!actJson)
|
|
29886
29908
|
warnings.push("No modifierActions.json: experimental effects have no fixed values.");
|
|
29887
29909
|
const known = new Set(materials.map((m) => normKey(m.name)));
|
|
@@ -41966,7 +41988,7 @@ function toJournalModifiers(module, modifiers) {
|
|
|
41966
41988
|
return out;
|
|
41967
41989
|
}
|
|
41968
41990
|
function bestRoll(blueprint, grade, module, catalog) {
|
|
41969
|
-
const features = catalog.blueprintFeatures(blueprint, grade);
|
|
41991
|
+
const features = catalog.blueprintFeatures(blueprint, grade, module.grp);
|
|
41970
41992
|
if (!features) {
|
|
41971
41993
|
throw new UserError(`Blueprint ${blueprint} has no grade ${grade}.`);
|
|
41972
41994
|
}
|