s2cfgtojson 7.0.1 → 7.0.2
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/Struct.mts +9 -2
- package/Struct.test.mts +12 -1
- package/package.json +1 -1
package/Struct.mts
CHANGED
|
@@ -24,6 +24,7 @@ export interface DefaultEntries {
|
|
|
24
24
|
rawName?: string;
|
|
25
25
|
refkey?: string | number;
|
|
26
26
|
refurl?: string;
|
|
27
|
+
removenode?: boolean;
|
|
27
28
|
useAsterisk?: boolean;
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -293,8 +294,13 @@ export class Struct {
|
|
|
293
294
|
equalsOrColon = value instanceof Struct ? ":" : "=";
|
|
294
295
|
spaceOrNoSpace = value === "" ? "" : " ";
|
|
295
296
|
}
|
|
296
|
-
|
|
297
|
-
|
|
297
|
+
const renderedValue =
|
|
298
|
+
value instanceof Struct && value.__internal__.removenode
|
|
299
|
+
? REMOVE_NODE
|
|
300
|
+
: value;
|
|
301
|
+
return pad(
|
|
302
|
+
`${keyOrIndex}${equalsOrColon}${spaceOrNoSpace}${renderedValue}`,
|
|
303
|
+
);
|
|
298
304
|
})
|
|
299
305
|
.join("\n");
|
|
300
306
|
text += "\nstruct.end";
|
|
@@ -315,6 +321,7 @@ export class Refs implements DefaultEntries {
|
|
|
315
321
|
isArray?: boolean;
|
|
316
322
|
isRoot?: boolean;
|
|
317
323
|
useAsterisk?: boolean;
|
|
324
|
+
removenode?: boolean;
|
|
318
325
|
|
|
319
326
|
constructor(ref?: string | Refs) {
|
|
320
327
|
if (typeof ref === "string") {
|
package/Struct.test.mts
CHANGED
|
@@ -50,6 +50,11 @@ class BuyLimitations extends Struct {
|
|
|
50
50
|
});
|
|
51
51
|
"0" = "EItemType::Weapon";
|
|
52
52
|
"1" = "EItemType::Armor";
|
|
53
|
+
"2" = new Struct({
|
|
54
|
+
__internal__: {
|
|
55
|
+
removenode: true,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
describe("Struct", () => {
|
|
@@ -69,6 +74,7 @@ struct.end`,
|
|
|
69
74
|
BuyLimitations : struct.begin
|
|
70
75
|
[0] = EItemType::Weapon
|
|
71
76
|
[1] = EItemType::Armor
|
|
77
|
+
[2] : removenode
|
|
72
78
|
struct.end
|
|
73
79
|
struct.end
|
|
74
80
|
struct.end
|
|
@@ -270,7 +276,7 @@ struct.end`;
|
|
|
270
276
|
"EItemType::Artifact",
|
|
271
277
|
undefined,
|
|
272
278
|
);
|
|
273
|
-
expect(a.TradeGenerators[0].BuyLimitations[
|
|
279
|
+
expect(a.TradeGenerators[0].BuyLimitations[3]).toBe(
|
|
274
280
|
"EItemType::Artifact",
|
|
275
281
|
);
|
|
276
282
|
});
|
|
@@ -352,6 +358,11 @@ struct.end`;
|
|
|
352
358
|
__internal__: { rawName: "BuyLimitations", isArray: true },
|
|
353
359
|
"0": "EItemType::Weapon",
|
|
354
360
|
"1": "EItemType::Armor",
|
|
361
|
+
"2": {
|
|
362
|
+
__internal__: {
|
|
363
|
+
removenode: true,
|
|
364
|
+
},
|
|
365
|
+
},
|
|
355
366
|
},
|
|
356
367
|
},
|
|
357
368
|
},
|