wc3maptranslator 4.0.1 → 4.0.3
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/src/AngleConverter.d.ts +3 -0
- package/dist/src/AngleConverter.d.ts.map +1 -0
- package/dist/src/AngleConverter.js +12 -0
- package/dist/src/AngleConverter.js.map +1 -0
- package/dist/src/CommonInterfaces.d.ts +17 -0
- package/dist/src/CommonInterfaces.d.ts.map +1 -0
- package/dist/src/CommonInterfaces.js +3 -0
- package/dist/src/CommonInterfaces.js.map +1 -0
- package/dist/src/HexBuffer.d.ts +15 -0
- package/dist/src/HexBuffer.d.ts.map +1 -0
- package/{lib/HexBuffer.ts → dist/src/HexBuffer.js} +32 -42
- package/dist/src/HexBuffer.js.map +1 -0
- package/dist/src/W3Buffer.d.ts +14 -0
- package/dist/src/W3Buffer.d.ts.map +1 -0
- package/{lib/W3Buffer.ts → dist/src/W3Buffer.js} +25 -31
- package/dist/src/W3Buffer.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/{index.js → dist/src/index.js} +1 -1
- package/dist/src/index.js.map +1 -0
- package/dist/src/translators/CamerasTranslator.d.ts +23 -0
- package/dist/src/translators/CamerasTranslator.d.ts.map +1 -0
- package/{lib/translators/CamerasTranslator.ts → dist/src/translators/CamerasTranslator.js} +14 -39
- package/dist/src/translators/CamerasTranslator.js.map +1 -0
- package/dist/src/translators/DoodadsTranslator.d.ts +23 -0
- package/dist/src/translators/DoodadsTranslator.d.ts.map +1 -0
- package/{lib/translators/DoodadsTranslator.ts → dist/src/translators/DoodadsTranslator.js} +33 -65
- package/dist/src/translators/DoodadsTranslator.js.map +1 -0
- package/dist/src/translators/ImportsTranslator.d.ts +16 -0
- package/dist/src/translators/ImportsTranslator.d.ts.map +1 -0
- package/{lib/translators/ImportsTranslator.ts → dist/src/translators/ImportsTranslator.js} +21 -37
- package/dist/src/translators/ImportsTranslator.js.map +1 -0
- package/dist/src/translators/InfoTranslator.d.ts +124 -0
- package/dist/src/translators/InfoTranslator.d.ts.map +1 -0
- package/{lib/translators/InfoTranslator.ts → dist/src/translators/InfoTranslator.js} +108 -270
- package/dist/src/translators/InfoTranslator.js.map +1 -0
- package/dist/src/translators/ObjectsTranslator.d.ts +23 -0
- package/dist/src/translators/ObjectsTranslator.d.ts.map +1 -0
- package/{lib/translators/ObjectsTranslator.ts → dist/src/translators/ObjectsTranslator.js} +91 -125
- package/dist/src/translators/ObjectsTranslator.js.map +1 -0
- package/dist/src/translators/RegionsTranslator.d.ts +22 -0
- package/dist/src/translators/RegionsTranslator.d.ts.map +1 -0
- package/{lib/translators/RegionsTranslator.ts → dist/src/translators/RegionsTranslator.js} +18 -45
- package/dist/src/translators/RegionsTranslator.js.map +1 -0
- package/dist/src/translators/SoundsTranslator.d.ts +35 -0
- package/dist/src/translators/SoundsTranslator.d.ts.map +1 -0
- package/{lib/translators/SoundsTranslator.ts → dist/src/translators/SoundsTranslator.js} +30 -84
- package/dist/src/translators/SoundsTranslator.js.map +1 -0
- package/dist/src/translators/StringsTranslator.d.ts +7 -0
- package/dist/src/translators/StringsTranslator.d.ts.map +1 -0
- package/{lib/translators/StringsTranslator.ts → dist/src/translators/StringsTranslator.js} +12 -17
- package/dist/src/translators/StringsTranslator.js.map +1 -0
- package/dist/src/translators/TerrainTranslator.d.ts +33 -0
- package/dist/src/translators/TerrainTranslator.d.ts.map +1 -0
- package/{lib/translators/TerrainTranslator.ts → dist/src/translators/TerrainTranslator.js} +29 -84
- package/dist/src/translators/TerrainTranslator.js.map +1 -0
- package/dist/src/translators/UnitsTranslator.d.ts +40 -0
- package/dist/src/translators/UnitsTranslator.d.ts.map +1 -0
- package/{lib/translators/UnitsTranslator.ts → dist/src/translators/UnitsTranslator.js} +33 -95
- package/dist/src/translators/UnitsTranslator.js.map +1 -0
- package/{lib/translators/index.ts → dist/src/translators/index.d.ts} +1 -0
- package/dist/src/translators/index.d.ts.map +1 -0
- package/dist/src/translators/index.js +23 -0
- package/dist/src/translators/index.js.map +1 -0
- package/package.json +5 -4
- package/.codeclimate.yml +0 -12
- package/.editorconfig +0 -8
- package/.eslintignore +0 -5
- package/.eslintrc +0 -55
- package/.github/workflows/codeql-analysis.yml +0 -54
- package/.nycrc +0 -18
- package/.travis.yml +0 -23
- package/CHANGELOG.md +0 -78
- package/index.ts +0 -14
- package/lib/AngleConverter.ts +0 -7
- package/lib/CommonInterfaces.ts +0 -22
- package/test/.mocharc.json +0 -4
- package/test/AngleConverterTest.ts +0 -18
- package/test/HexBufferTest.ts +0 -170
- package/test/TranslatorReversion.ts +0 -218
- package/test/W3BufferTest.ts +0 -50
- package/test/data/cameras.json +0 -16
- package/test/data/doodads.json +0 -2730
- package/test/data/imports.json +0 -386
- package/test/data/info.json +0 -250
- package/test/data/obj-abilities.json +0 -4892
- package/test/data/obj-buffs.json +0 -38
- package/test/data/obj-destructables.json +0 -31
- package/test/data/obj-doodads.json +0 -38
- package/test/data/obj-items.json +0 -31
- package/test/data/obj-units.json +0 -40
- package/test/data/obj-upgrades.json +0 -38
- package/test/data/regions.json +0 -206
- package/test/data/sounds.json +0 -50
- package/test/data/strings.json +0 -115
- package/test/data/terrain.json +0 -1
- package/test/data/units.json +0 -452
- package/test/data/war3map.doo +0 -0
- package/test/data/war3map.imp +0 -0
- package/test/data/war3map.j +0 -3442
- package/test/data/war3map.shd +0 -0
- package/test/data/war3map.w3a +0 -0
- package/test/data/war3map.w3b +0 -0
- package/test/data/war3map.w3c +0 -0
- package/test/data/war3map.w3d +0 -0
- package/test/data/war3map.w3e +0 -0
- package/test/data/war3map.w3h +0 -0
- package/test/data/war3map.w3i +0 -0
- package/test/data/war3map.w3q +0 -0
- package/test/data/war3map.w3r +0 -0
- package/test/data/war3map.w3s +0 -0
- package/test/data/war3map.w3t +0 -0
- package/test/data/war3map.w3u +0 -0
- package/test/data/war3map.wts +0 -631
- package/test/data/war3mapUnits.doo +0 -0
- package/tsconfig.json +0 -25
- package/tslint.json +0 -47
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { WarResult, JsonResult, angle } from '../CommonInterfaces';
|
|
3
|
+
interface Unit {
|
|
4
|
+
type: string;
|
|
5
|
+
variation: number;
|
|
6
|
+
position: number[];
|
|
7
|
+
rotation: angle;
|
|
8
|
+
scale: number[];
|
|
9
|
+
hero: Hero;
|
|
10
|
+
inventory: Inventory[];
|
|
11
|
+
abilities: Abilities[];
|
|
12
|
+
player: number;
|
|
13
|
+
hitpoints: number;
|
|
14
|
+
mana: number;
|
|
15
|
+
gold: number;
|
|
16
|
+
targetAcquisition: number;
|
|
17
|
+
color: number;
|
|
18
|
+
id: number;
|
|
19
|
+
}
|
|
20
|
+
interface Hero {
|
|
21
|
+
level: number;
|
|
22
|
+
str: number;
|
|
23
|
+
agi: number;
|
|
24
|
+
int: number;
|
|
25
|
+
}
|
|
26
|
+
interface Inventory {
|
|
27
|
+
slot: number;
|
|
28
|
+
type: string;
|
|
29
|
+
}
|
|
30
|
+
interface Abilities {
|
|
31
|
+
ability: string;
|
|
32
|
+
active: boolean;
|
|
33
|
+
level: number;
|
|
34
|
+
}
|
|
35
|
+
export declare abstract class UnitsTranslator {
|
|
36
|
+
static jsonToWar(unitsJson: Unit[]): WarResult;
|
|
37
|
+
static warToJson(buffer: Buffer): JsonResult<Unit[]>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=UnitsTranslator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnitsTranslator.d.ts","sourceRoot":"","sources":["../../../src/translators/UnitsTranslator.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAElE,UAAU,IAAI;IACV,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACd;AAED,UAAU,IAAI;IACV,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACf;AAED,UAAU,SAAS;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,SAAS;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,8BAAsB,eAAe;WAEnB,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,GAAG,SAAS;WA8FvC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;CA4H9D"}
|
|
@@ -1,48 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
rotation: angle;
|
|
10
|
-
scale: number[];
|
|
11
|
-
hero: Hero;
|
|
12
|
-
inventory: Inventory[];
|
|
13
|
-
abilities: Abilities[];
|
|
14
|
-
player: number;
|
|
15
|
-
hitpoints: number;
|
|
16
|
-
mana: number;
|
|
17
|
-
gold: number;
|
|
18
|
-
targetAcquisition: number; // (-1 = normal, -2 = camp),
|
|
19
|
-
color: number;
|
|
20
|
-
id: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface Hero {
|
|
24
|
-
level: number;
|
|
25
|
-
str: number;
|
|
26
|
-
agi: number;
|
|
27
|
-
int: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface Inventory {
|
|
31
|
-
slot: number; // the int is 0-based, but json format wants 1-6
|
|
32
|
-
type: string; // Item ID
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface Abilities {
|
|
36
|
-
ability: string; // Ability ID
|
|
37
|
-
active: boolean; // autocast active? 0=no, 1=active
|
|
38
|
-
level: number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export abstract class UnitsTranslator {
|
|
42
|
-
|
|
43
|
-
public static jsonToWar(unitsJson: Unit[]): WarResult {
|
|
44
|
-
const outBufferToWar = new HexBuffer();
|
|
45
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnitsTranslator = void 0;
|
|
4
|
+
const HexBuffer_1 = require("../HexBuffer");
|
|
5
|
+
const W3Buffer_1 = require("../W3Buffer");
|
|
6
|
+
class UnitsTranslator {
|
|
7
|
+
static jsonToWar(unitsJson) {
|
|
8
|
+
const outBufferToWar = new HexBuffer_1.HexBuffer();
|
|
46
9
|
/*
|
|
47
10
|
* Header
|
|
48
11
|
*/
|
|
@@ -50,7 +13,6 @@ export abstract class UnitsTranslator {
|
|
|
50
13
|
outBufferToWar.addInt(8);
|
|
51
14
|
outBufferToWar.addInt(11);
|
|
52
15
|
outBufferToWar.addInt(unitsJson.length); // number of units
|
|
53
|
-
|
|
54
16
|
/*
|
|
55
17
|
* Body
|
|
56
18
|
*/
|
|
@@ -61,23 +23,19 @@ export abstract class UnitsTranslator {
|
|
|
61
23
|
outBufferToWar.addFloat(unit.position[1]); // position y
|
|
62
24
|
outBufferToWar.addFloat(unit.position[2]); // position z
|
|
63
25
|
outBufferToWar.addFloat(unit.rotation || 0); // rotation angle
|
|
64
|
-
|
|
65
|
-
|
|
26
|
+
if (!unit.scale)
|
|
27
|
+
unit.scale = [1, 1, 1];
|
|
66
28
|
outBufferToWar.addFloat(unit.scale[0] || 1); // scale x
|
|
67
29
|
outBufferToWar.addFloat(unit.scale[1] || 1); // scale y
|
|
68
30
|
outBufferToWar.addFloat(unit.scale[2] || 1); // scale z
|
|
69
|
-
|
|
70
31
|
// Unit flags
|
|
71
32
|
outBufferToWar.addByte(0); // UNSUPPORTED: flags
|
|
72
|
-
|
|
73
33
|
outBufferToWar.addInt(0); // unknown
|
|
74
|
-
|
|
75
34
|
outBufferToWar.addInt(unit.player); // player #
|
|
76
35
|
outBufferToWar.addByte(0); // (byte unknown - 0)
|
|
77
36
|
outBufferToWar.addByte(0); // (byte unknown - 0)
|
|
78
37
|
outBufferToWar.addInt(unit.hitpoints); // hitpoints
|
|
79
38
|
outBufferToWar.addInt(unit.mana || 0); // mana
|
|
80
|
-
|
|
81
39
|
// if(unit.droppedItemSets.length === 0) { // needs to be -1 if no item sets
|
|
82
40
|
outBufferToWar.addInt(-1);
|
|
83
41
|
// }
|
|
@@ -86,65 +44,57 @@ export abstract class UnitsTranslator {
|
|
|
86
44
|
// }
|
|
87
45
|
// UNSUPPORTED: dropped items
|
|
88
46
|
outBufferToWar.addInt(0); // dropped item sets
|
|
89
|
-
|
|
90
47
|
// Gold amount
|
|
91
48
|
// Required if unit is a gold mine
|
|
92
49
|
// Optional (set to zero) if unit is not a gold mine
|
|
93
50
|
outBufferToWar.addInt(unit.gold);
|
|
94
51
|
// outBufferToWar.addInt(unit.type === 'ngol' ? unit.gold : 0);
|
|
95
|
-
|
|
96
52
|
outBufferToWar.addFloat(unit.targetAcquisition || 0); // target acquisition
|
|
97
|
-
|
|
98
53
|
// Unit hero attributes
|
|
99
54
|
// Can be left unspecified, but values can never be below 1
|
|
100
|
-
if (!unit.hero)
|
|
55
|
+
if (!unit.hero)
|
|
56
|
+
unit.hero = { level: 1, str: 1, agi: 1, int: 1 };
|
|
101
57
|
outBufferToWar.addInt(unit.hero.level);
|
|
102
58
|
outBufferToWar.addInt(unit.hero.str);
|
|
103
59
|
outBufferToWar.addInt(unit.hero.agi);
|
|
104
60
|
outBufferToWar.addInt(unit.hero.int);
|
|
105
|
-
|
|
106
61
|
// Inventory - - -
|
|
107
|
-
if (!unit.inventory)
|
|
62
|
+
if (!unit.inventory)
|
|
63
|
+
unit.inventory = [];
|
|
108
64
|
outBufferToWar.addInt(unit.inventory.length); // # items in inventory
|
|
109
65
|
unit.inventory.forEach((item) => {
|
|
110
66
|
outBufferToWar.addInt(item.slot - 1); // zero-index item slot
|
|
111
67
|
outBufferToWar.addChars(item.type);
|
|
112
68
|
});
|
|
113
|
-
|
|
114
69
|
// Modified abilities - - -
|
|
115
|
-
if (!unit.abilities)
|
|
70
|
+
if (!unit.abilities)
|
|
71
|
+
unit.abilities = [];
|
|
116
72
|
outBufferToWar.addInt(unit.abilities.length); // # modified abilities
|
|
117
73
|
unit.abilities.forEach((ability) => {
|
|
118
74
|
outBufferToWar.addChars(ability.ability); // ability string
|
|
119
75
|
outBufferToWar.addInt(+ability.active); // 0 = not active, 1 = active
|
|
120
76
|
outBufferToWar.addInt(ability.level);
|
|
121
77
|
});
|
|
122
|
-
|
|
123
78
|
outBufferToWar.addInt(0);
|
|
124
79
|
outBufferToWar.addInt(1);
|
|
125
|
-
|
|
126
80
|
outBufferToWar.addInt(unit.color || unit.player); // custom color, defaults to owning player
|
|
127
81
|
outBufferToWar.addInt(0); // outBuffer.addInt(unit.waygate); // UNSUPPORTED - waygate
|
|
128
82
|
outBufferToWar.addInt(unit.id); // id
|
|
129
83
|
});
|
|
130
|
-
|
|
131
84
|
return {
|
|
132
85
|
errors: [],
|
|
133
86
|
buffer: outBufferToWar.getBuffer()
|
|
134
87
|
};
|
|
135
88
|
}
|
|
136
|
-
|
|
137
|
-
public static warToJson(buffer: Buffer): JsonResult<Unit[]> {
|
|
89
|
+
static warToJson(buffer) {
|
|
138
90
|
const result = [];
|
|
139
|
-
const outBufferToJSON = new W3Buffer(buffer);
|
|
140
|
-
|
|
91
|
+
const outBufferToJSON = new W3Buffer_1.W3Buffer(buffer);
|
|
141
92
|
const fileId = outBufferToJSON.readChars(4), // W3do for doodad file
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
93
|
+
fileVersion = outBufferToJSON.readInt(), // File version = 7
|
|
94
|
+
subVersion = outBufferToJSON.readInt(), // 0B 00 00 00
|
|
95
|
+
numUnits = outBufferToJSON.readInt(); // # of units
|
|
146
96
|
for (let i = 0; i < numUnits; i++) {
|
|
147
|
-
const unit
|
|
97
|
+
const unit = {
|
|
148
98
|
type: '',
|
|
149
99
|
variation: -1,
|
|
150
100
|
position: [0, 0, 0],
|
|
@@ -161,28 +111,20 @@ export abstract class UnitsTranslator {
|
|
|
161
111
|
color: -1,
|
|
162
112
|
id: -1
|
|
163
113
|
};
|
|
164
|
-
|
|
165
114
|
unit.type = outBufferToJSON.readChars(4); // (iDNR = random item, uDNR = random unit)
|
|
166
115
|
unit.variation = outBufferToJSON.readInt();
|
|
167
116
|
unit.position = [outBufferToJSON.readFloat(), outBufferToJSON.readFloat(), outBufferToJSON.readFloat()]; // X Y Z coords
|
|
168
117
|
unit.rotation = outBufferToJSON.readFloat();
|
|
169
118
|
unit.scale = [outBufferToJSON.readFloat(), outBufferToJSON.readFloat(), outBufferToJSON.readFloat()]; // X Y Z scaling
|
|
170
|
-
|
|
171
119
|
// UNSUPPORTED: flags
|
|
172
120
|
const flags = outBufferToJSON.readByte();
|
|
173
|
-
|
|
174
121
|
outBufferToJSON.readInt(); // Unknown
|
|
175
|
-
|
|
176
122
|
unit.player = outBufferToJSON.readInt(); // (player1 = 0, 16=neutral passive); note: wc3 patch now has 24 max players
|
|
177
|
-
|
|
178
123
|
outBufferToJSON.readByte(); // unknown
|
|
179
124
|
outBufferToJSON.readByte(); // unknown
|
|
180
|
-
|
|
181
125
|
unit.hitpoints = outBufferToJSON.readInt(); // -1 = use default
|
|
182
126
|
unit.mana = outBufferToJSON.readInt(); // -1 = use default, 0 = unit doesn't have mana
|
|
183
|
-
|
|
184
|
-
const droppedItemSetPtr = outBufferToJSON.readInt(),
|
|
185
|
-
numDroppedItemSets = outBufferToJSON.readInt();
|
|
127
|
+
const droppedItemSetPtr = outBufferToJSON.readInt(), numDroppedItemSets = outBufferToJSON.readInt();
|
|
186
128
|
for (let j = 0; j < numDroppedItemSets; j++) {
|
|
187
129
|
const numDroppableItems = outBufferToJSON.readInt();
|
|
188
130
|
for (let k = 0; k < numDroppableItems; k++) {
|
|
@@ -190,34 +132,29 @@ export abstract class UnitsTranslator {
|
|
|
190
132
|
outBufferToJSON.readInt(); // % chance to drop
|
|
191
133
|
}
|
|
192
134
|
}
|
|
193
|
-
|
|
194
135
|
unit.gold = outBufferToJSON.readInt();
|
|
195
136
|
unit.targetAcquisition = outBufferToJSON.readFloat(); // (-1 = normal, -2 = camp)
|
|
196
|
-
|
|
197
137
|
unit.hero = {
|
|
198
|
-
level: outBufferToJSON.readInt(),
|
|
138
|
+
level: outBufferToJSON.readInt(),
|
|
199
139
|
str: outBufferToJSON.readInt(),
|
|
200
140
|
agi: outBufferToJSON.readInt(),
|
|
201
141
|
int: outBufferToJSON.readInt()
|
|
202
142
|
};
|
|
203
|
-
|
|
204
143
|
const numItemsInventory = outBufferToJSON.readInt();
|
|
205
144
|
for (let j = 0; j < numItemsInventory; j++) {
|
|
206
145
|
unit.inventory.push({
|
|
207
|
-
slot: outBufferToJSON.readInt() + 1,
|
|
146
|
+
slot: outBufferToJSON.readInt() + 1,
|
|
208
147
|
type: outBufferToJSON.readChars(4) // Item ID
|
|
209
148
|
});
|
|
210
149
|
}
|
|
211
|
-
|
|
212
150
|
const numModifiedAbil = outBufferToJSON.readInt();
|
|
213
151
|
for (let j = 0; j < numModifiedAbil; j++) {
|
|
214
152
|
unit.abilities.push({
|
|
215
|
-
ability: outBufferToJSON.readChars(4),
|
|
216
|
-
active: !!outBufferToJSON.readInt(),
|
|
153
|
+
ability: outBufferToJSON.readChars(4),
|
|
154
|
+
active: !!outBufferToJSON.readInt(),
|
|
217
155
|
level: outBufferToJSON.readInt()
|
|
218
156
|
});
|
|
219
157
|
}
|
|
220
|
-
|
|
221
158
|
const randFlag = outBufferToJSON.readInt(); // random unit/item flag "r" (for uDNR units and iDNR items)
|
|
222
159
|
if (randFlag === 0) {
|
|
223
160
|
// 0 = Any neutral passive building/item, in this case we have
|
|
@@ -228,14 +165,16 @@ export abstract class UnitsTranslator {
|
|
|
228
165
|
outBufferToJSON.readByte();
|
|
229
166
|
outBufferToJSON.readByte();
|
|
230
167
|
outBufferToJSON.readByte();
|
|
231
|
-
}
|
|
168
|
+
}
|
|
169
|
+
else if (randFlag === 1) {
|
|
232
170
|
// 1 = random unit from random group (defined in the w3i), in this case we have
|
|
233
171
|
// int: unit group number (which group from the global table)
|
|
234
172
|
// int: position number (which column of this group)
|
|
235
173
|
// the column should of course have the item flag set (in the w3i) if this is a random item
|
|
236
174
|
outBufferToJSON.readInt();
|
|
237
175
|
outBufferToJSON.readInt();
|
|
238
|
-
}
|
|
176
|
+
}
|
|
177
|
+
else if (randFlag === 2) {
|
|
239
178
|
// 2 = random unit from custom table, in this case we have
|
|
240
179
|
// int: number "n" of different available units
|
|
241
180
|
// then we have n times a random unit structure
|
|
@@ -245,17 +184,16 @@ export abstract class UnitsTranslator {
|
|
|
245
184
|
outBufferToJSON.readInt(); // % chance
|
|
246
185
|
}
|
|
247
186
|
}
|
|
248
|
-
|
|
249
187
|
unit.color = outBufferToJSON.readInt();
|
|
250
188
|
outBufferToJSON.readInt(); // UNSUPPORTED: waygate (-1 = deactivated, else its the creation number of the target rect as in war3map.w3r)
|
|
251
189
|
unit.id = outBufferToJSON.readInt();
|
|
252
|
-
|
|
253
190
|
result.push(unit);
|
|
254
191
|
}
|
|
255
|
-
|
|
256
192
|
return {
|
|
257
193
|
errors: [],
|
|
258
194
|
json: result
|
|
259
195
|
};
|
|
260
196
|
}
|
|
261
197
|
}
|
|
198
|
+
exports.UnitsTranslator = UnitsTranslator;
|
|
199
|
+
//# sourceMappingURL=UnitsTranslator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnitsTranslator.js","sourceRoot":"","sources":["../../../src/translators/UnitsTranslator.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,0CAAuC;AAuCvC,MAAsB,eAAe;IAE1B,MAAM,CAAC,SAAS,CAAC,SAAiB;QACrC,MAAM,cAAc,GAAG,IAAI,qBAAS,EAAE,CAAC;QAEvC;;WAEG;QACH,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzB,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1B,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB;QAE3D;;WAEG;QACH,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO;YAC3C,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY;YACxD,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;YACxD,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;YACxD,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;YACxD,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,iBAAiB;Y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E,CAAC;gBACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,CAAC,EAAE,EAAE;oBACxC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU;oBACxC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC,WAAW;iBACzC;aACJ;YAED,IAAI,CAAC,KAAK,GAAG,eAAe,CAAC,OAAO,EAAE,CAAC;YACvC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC,6GAA6G;YACxI,IAAI,CAAC,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,CAAC;YAEpC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACrB;QAED,OAAO;YACH,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,MAAM;SACf,CAAC;IACN,CAAC;CACJ;AA5ND,0CA4NC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/translators/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./CamerasTranslator"), exports);
|
|
14
|
+
__exportStar(require("./DoodadsTranslator"), exports);
|
|
15
|
+
__exportStar(require("./ImportsTranslator"), exports);
|
|
16
|
+
__exportStar(require("./InfoTranslator"), exports);
|
|
17
|
+
__exportStar(require("./RegionsTranslator"), exports);
|
|
18
|
+
__exportStar(require("./SoundsTranslator"), exports);
|
|
19
|
+
__exportStar(require("./StringsTranslator"), exports);
|
|
20
|
+
__exportStar(require("./TerrainTranslator"), exports);
|
|
21
|
+
__exportStar(require("./UnitsTranslator"), exports);
|
|
22
|
+
__exportStar(require("./ObjectsTranslator"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/translators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,mDAAiC;AACjC,sDAAoC;AACpC,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,oDAAkC;AAClC,sDAAoC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wc3maptranslator",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Module to translate between `war3map` and `json` formats for WarCraft III .w3x maps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wc3",
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
"json",
|
|
14
14
|
"w3x"
|
|
15
15
|
],
|
|
16
|
-
"main": "index.js",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"files": ["dist/**"],
|
|
17
19
|
"scripts": {
|
|
18
20
|
"build": "tsc --build",
|
|
19
21
|
"lint": "tslint --project .",
|
|
20
|
-
"postinstall": "npm run build",
|
|
21
22
|
"test": "npm run build && mocha",
|
|
22
23
|
"test-nyc": "npm run build && nyc mocha",
|
|
23
24
|
"test-travis": "npm run build && ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --include-all-sources true --root ./lib -- -R spec ./test/*.js"
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
},
|
|
46
47
|
"homepage": "https://github.com/ChiefOfGxBxL/WC3MapTranslator#readme",
|
|
47
48
|
"dependencies": {
|
|
49
|
+
"ieee754": "^1.2.1",
|
|
48
50
|
"intn": "^1.0.0",
|
|
49
51
|
"round-to": "^5.0.0"
|
|
50
52
|
},
|
|
@@ -57,7 +59,6 @@
|
|
|
57
59
|
"coveralls": "^3.1.0",
|
|
58
60
|
"diff-buf": "^1.0.1",
|
|
59
61
|
"fs-extra": "^9.1.0",
|
|
60
|
-
"ieee754": "^1.2.1",
|
|
61
62
|
"istanbul": "^0.4.5",
|
|
62
63
|
"mocha": "^8.3.0",
|
|
63
64
|
"nyc": "^15.1.0",
|
package/.codeclimate.yml
DELETED
package/.editorconfig
DELETED
package/.eslintignore
DELETED
package/.eslintrc
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"node": true
|
|
4
|
-
},
|
|
5
|
-
"parserOptions": {
|
|
6
|
-
"ecmaVersion": 6,
|
|
7
|
-
"sourceType": "module"
|
|
8
|
-
},
|
|
9
|
-
"rules": {
|
|
10
|
-
"no-cond-assign": [2,"always"],
|
|
11
|
-
"no-console": 2,
|
|
12
|
-
"no-constant-condition": 2,
|
|
13
|
-
"no-control-regex": 2,
|
|
14
|
-
"no-debugger": 2,
|
|
15
|
-
"no-dupe-args": 2,
|
|
16
|
-
"no-dupe-keys": 2,
|
|
17
|
-
"no-duplicate-case": 2,
|
|
18
|
-
"no-empty-character-class": 2,
|
|
19
|
-
"no-empty": 2,
|
|
20
|
-
"no-ex-assign": 2,
|
|
21
|
-
"no-extra-boolean-cast": 1,
|
|
22
|
-
"no-extra-parens": [1,"all"],
|
|
23
|
-
"no-extra-semi": 1,
|
|
24
|
-
"no-func-assign": 2,
|
|
25
|
-
"no-irregular-whitespace": 1,
|
|
26
|
-
"no-sparse-arrays": 2,
|
|
27
|
-
"use-isnan": 2,
|
|
28
|
-
"valid-typeof": 2,
|
|
29
|
-
"no-alert": 2,
|
|
30
|
-
"no-caller": 2,
|
|
31
|
-
"no-labels": 2,
|
|
32
|
-
"no-octal": 2,
|
|
33
|
-
"no-redeclare": 2,
|
|
34
|
-
"no-script-url": 2,
|
|
35
|
-
"no-warning-comments": [2,{"terms":["TODO","FIXME"],"location":"anywhere"}],
|
|
36
|
-
"wrap-iife": [2,"any"],
|
|
37
|
-
"strict": [2,"never"],
|
|
38
|
-
"no-delete-var": 2,
|
|
39
|
-
"callback-return": 2,
|
|
40
|
-
"no-path-concat": 2,
|
|
41
|
-
"brace-style": [2,"stroustrup",{"allowSingleLine":true}],
|
|
42
|
-
"comma-spacing": [2,{"after":true}],
|
|
43
|
-
"eol-last": 2,
|
|
44
|
-
"id-length": [2,{"min":2,"max":26,"exceptions":["b","i","j","k","x","y"]}],
|
|
45
|
-
"indent": [2,4],
|
|
46
|
-
"no-underscore-dangle": 2,
|
|
47
|
-
"object-curly-spacing": [2,"always",{"arraysInObjects":true,"objectsInObjects":true}],
|
|
48
|
-
"one-var": 1,
|
|
49
|
-
"quotes": [2,"single","avoid-escape"],
|
|
50
|
-
"semi": [2,"always"],
|
|
51
|
-
"space-before-blocks": [2,"always"],
|
|
52
|
-
"arrow-parens": [2,"always"],
|
|
53
|
-
"no-var": 1
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
name: "Code scanning - action"
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [master, ]
|
|
6
|
-
pull_request:
|
|
7
|
-
# The branches below must be a subset of the branches above
|
|
8
|
-
branches: [master]
|
|
9
|
-
schedule:
|
|
10
|
-
- cron: '0 22 * * 5'
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
CodeQL-Build:
|
|
14
|
-
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- name: Checkout repository
|
|
19
|
-
uses: actions/checkout@v2
|
|
20
|
-
with:
|
|
21
|
-
# We must fetch at least the immediate parents so that if this is
|
|
22
|
-
# a pull request then we can checkout the head.
|
|
23
|
-
fetch-depth: 2
|
|
24
|
-
|
|
25
|
-
# If this run was triggered by a pull request event, then checkout
|
|
26
|
-
# the head of the pull request instead of the merge commit.
|
|
27
|
-
- run: git checkout HEAD^2
|
|
28
|
-
if: ${{ github.event_name == 'pull_request' }}
|
|
29
|
-
|
|
30
|
-
# Initializes the CodeQL tools for scanning.
|
|
31
|
-
- name: Initialize CodeQL
|
|
32
|
-
uses: github/codeql-action/init@v1
|
|
33
|
-
# Override language selection by uncommenting this and choosing your languages
|
|
34
|
-
# with:
|
|
35
|
-
# languages: go, javascript, csharp, python, cpp, java
|
|
36
|
-
|
|
37
|
-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
38
|
-
# If this step fails, then you should remove it and run the build manually (see below)
|
|
39
|
-
- name: Autobuild
|
|
40
|
-
uses: github/codeql-action/autobuild@v1
|
|
41
|
-
|
|
42
|
-
# ℹ️ Command-line programs to run using the OS shell.
|
|
43
|
-
# 📚 https://git.io/JvXDl
|
|
44
|
-
|
|
45
|
-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
46
|
-
# and modify them (or add more) to build your code if your project
|
|
47
|
-
# uses a compiled language
|
|
48
|
-
|
|
49
|
-
#- run: |
|
|
50
|
-
# make bootstrap
|
|
51
|
-
# make release
|
|
52
|
-
|
|
53
|
-
- name: Perform CodeQL Analysis
|
|
54
|
-
uses: github/codeql-action/analyze@v1
|
package/.nycrc
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@istanbuljs/nyc-config-typescript",
|
|
3
|
-
"check-coverage": true,
|
|
4
|
-
"per-file": true,
|
|
5
|
-
"extension": [
|
|
6
|
-
".ts",
|
|
7
|
-
".tsx"
|
|
8
|
-
],
|
|
9
|
-
"exclude": [
|
|
10
|
-
"**/*.d.ts",
|
|
11
|
-
"**/coverage/**"
|
|
12
|
-
],
|
|
13
|
-
"reporter": [
|
|
14
|
-
"lcov",
|
|
15
|
-
"text-summary"
|
|
16
|
-
],
|
|
17
|
-
"all": true
|
|
18
|
-
}
|
package/.travis.yml
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Modeled after: https://travis-ci.org/microsoft/TypeScript/jobs/625136191/config
|
|
2
|
-
|
|
3
|
-
language: node_js
|
|
4
|
-
|
|
5
|
-
node_js:
|
|
6
|
-
- "14"
|
|
7
|
-
|
|
8
|
-
branches:
|
|
9
|
-
only:
|
|
10
|
-
- master
|
|
11
|
-
|
|
12
|
-
install:
|
|
13
|
-
- npm uninstall typescript --no-save
|
|
14
|
-
- npm install
|
|
15
|
-
|
|
16
|
-
cache:
|
|
17
|
-
directories:
|
|
18
|
-
- node_modules
|
|
19
|
-
|
|
20
|
-
script: "npm run-script test-travis"
|
|
21
|
-
|
|
22
|
-
# Send coverage data to Coveralls
|
|
23
|
-
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
|