fleethub-core 1.3.1 → 1.4.0

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.
@@ -1,40 +1,14 @@
1
+ import { createEquipmentBonuses } from 'equipment-bonus';
1
2
  import * as wasm from './fleethub_core_bg.wasm';
2
3
 
3
- const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
4
-
5
- let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
6
-
7
- cachedTextDecoder.decode();
8
-
9
- let cachegetUint8Memory0 = null;
10
- function getUint8Memory0() {
11
- if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
12
- cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
13
- }
14
- return cachegetUint8Memory0;
15
- }
16
-
17
- function getStringFromWasm0(ptr, len) {
18
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
19
- }
20
-
21
4
  const heap = new Array(32).fill(undefined);
22
5
 
23
6
  heap.push(undefined, null, true, false);
24
7
 
25
- let heap_next = heap.length;
26
-
27
- function addHeapObject(obj) {
28
- if (heap_next === heap.length) heap.push(heap.length + 1);
29
- const idx = heap_next;
30
- heap_next = heap[idx];
31
-
32
- heap[idx] = obj;
33
- return idx;
34
- }
35
-
36
8
  function getObject(idx) { return heap[idx]; }
37
9
 
10
+ let heap_next = heap.length;
11
+
38
12
  function dropObject(idx) {
39
13
  if (idx < 36) return;
40
14
  heap[idx] = heap_next;
@@ -49,6 +23,14 @@ function takeObject(idx) {
49
23
 
50
24
  let WASM_VECTOR_LEN = 0;
51
25
 
26
+ let cachegetUint8Memory0 = null;
27
+ function getUint8Memory0() {
28
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
29
+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
30
+ }
31
+ return cachegetUint8Memory0;
32
+ }
33
+
52
34
  const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
53
35
 
54
36
  let cachedTextEncoder = new lTextEncoder('utf-8');
@@ -112,71 +94,29 @@ function getInt32Memory0() {
112
94
  return cachegetInt32Memory0;
113
95
  }
114
96
 
115
- function debugString(val) {
116
- // primitive types
117
- const type = typeof val;
118
- if (type == 'number' || type == 'boolean' || val == null) {
119
- return `${val}`;
120
- }
121
- if (type == 'string') {
122
- return `"${val}"`;
123
- }
124
- if (type == 'symbol') {
125
- const description = val.description;
126
- if (description == null) {
127
- return 'Symbol';
128
- } else {
129
- return `Symbol(${description})`;
130
- }
131
- }
132
- if (type == 'function') {
133
- const name = val.name;
134
- if (typeof name == 'string' && name.length > 0) {
135
- return `Function(${name})`;
136
- } else {
137
- return 'Function';
138
- }
139
- }
140
- // objects
141
- if (Array.isArray(val)) {
142
- const length = val.length;
143
- let debug = '[';
144
- if (length > 0) {
145
- debug += debugString(val[0]);
146
- }
147
- for(let i = 1; i < length; i++) {
148
- debug += ', ' + debugString(val[i]);
149
- }
150
- debug += ']';
151
- return debug;
152
- }
153
- // Test for built-in
154
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
155
- let className;
156
- if (builtInMatches.length > 1) {
157
- className = builtInMatches[1];
158
- } else {
159
- // Failed to match the standard '[object ClassName]'
160
- return toString.call(val);
161
- }
162
- if (className == 'Object') {
163
- // we're a user defined class or Object
164
- // JSON.stringify avoids problems with cycles, and is generally much
165
- // easier than looping through ownProperties of `val`.
166
- try {
167
- return 'Object(' + JSON.stringify(val) + ')';
168
- } catch (_) {
169
- return 'Object';
170
- }
171
- }
172
- // errors
173
- if (val instanceof Error) {
174
- return `${val.name}: ${val.message}\n${val.stack}`;
175
- }
176
- // TODO we could test for more things here, like `Set`s and `Map`s.
177
- return className;
97
+ const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
98
+
99
+ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
100
+
101
+ cachedTextDecoder.decode();
102
+
103
+ function getStringFromWasm0(ptr, len) {
104
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
178
105
  }
179
106
 
107
+ function addHeapObject(obj) {
108
+ if (heap_next === heap.length) heap.push(heap.length + 1);
109
+ const idx = heap_next;
110
+ heap_next = heap[idx];
111
+
112
+ heap[idx] = obj;
113
+ return idx;
114
+ }
115
+
116
+ const u32CvtShim = new Uint32Array(2);
117
+
118
+ const uint64CvtShim = new BigUint64Array(u32CvtShim.buffer);
119
+
180
120
  function _assertClass(instance, klass) {
181
121
  if (!(instance instanceof klass)) {
182
122
  throw new Error(`expected instance of ${klass.name}`);
@@ -184,10 +124,6 @@ function _assertClass(instance, klass) {
184
124
  return instance.ptr;
185
125
  }
186
126
 
187
- function isLikeNone(x) {
188
- return x === undefined || x === null;
189
- }
190
-
191
127
  let cachegetFloat64Memory0 = null;
192
128
  function getFloat64Memory0() {
193
129
  if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
@@ -196,9 +132,9 @@ function getFloat64Memory0() {
196
132
  return cachegetFloat64Memory0;
197
133
  }
198
134
 
199
- const u32CvtShim = new Uint32Array(2);
200
-
201
- const uint64CvtShim = new BigUint64Array(u32CvtShim.buffer);
135
+ function isLikeNone(x) {
136
+ return x === undefined || x === null;
137
+ }
202
138
 
203
139
  let cachegetUint32Memory0 = null;
204
140
  function getUint32Memory0() {
@@ -229,56 +165,12 @@ function getUint16Memory0() {
229
165
  function getArrayU16FromWasm0(ptr, len) {
230
166
  return getUint16Memory0().subarray(ptr / 2, ptr / 2 + len);
231
167
  }
232
- /**
233
- * @param {Gear} gear
234
- * @returns {boolean}
235
- */
236
- export function air_squadron_can_equip(gear) {
237
- _assertClass(gear, Gear);
238
- const ret = wasm.air_squadron_can_equip(gear.ptr);
239
- return ret !== 0;
240
- }
241
-
242
- /**
243
- * @param {OrgType} org_type
244
- * @returns {boolean}
245
- */
246
- export function org_type_is_single(org_type) {
247
- const ret = wasm.org_type_is_single(addHeapObject(org_type));
248
- return ret !== 0;
249
- }
250
168
 
251
- /**
252
- * @param {OrgType} org_type
253
- * @returns {Formation}
254
- */
255
- export function org_type_default_formation(org_type) {
256
- const ret = wasm.org_type_default_formation(addHeapObject(org_type));
257
- return takeObject(ret);
258
- }
259
-
260
- /**
261
- * @param {OrgType} org_type
262
- * @returns {boolean}
263
- */
264
- export function org_type_is_player(org_type) {
265
- const ret = wasm.org_type_is_player(addHeapObject(org_type));
266
- return ret !== 0;
267
- }
268
-
269
- /**
270
- * @param {OrgType} org_type
271
- * @returns {Side}
272
- */
273
- export function org_type_side(org_type) {
274
- const ret = wasm.org_type_side(addHeapObject(org_type));
275
- return takeObject(ret);
276
- }
277
-
278
- /**
279
- */
280
- export function set_panic_hook() {
281
- wasm.set_panic_hook();
169
+ function passArray16ToWasm0(arg, malloc) {
170
+ const ptr = malloc(arg.length * 2);
171
+ getUint16Memory0().set(arg, ptr / 2);
172
+ WASM_VECTOR_LEN = arg.length;
173
+ return ptr;
282
174
  }
283
175
 
284
176
  function getArrayU8FromWasm0(ptr, len) {
@@ -291,12 +183,10 @@ function passArray8ToWasm0(arg, malloc) {
291
183
  WASM_VECTOR_LEN = arg.length;
292
184
  return ptr;
293
185
  }
294
-
295
- function passArray16ToWasm0(arg, malloc) {
296
- const ptr = malloc(arg.length * 2);
297
- getUint16Memory0().set(arg, ptr / 2);
298
- WASM_VECTOR_LEN = arg.length;
299
- return ptr;
186
+ /**
187
+ */
188
+ export function set_panic_hook() {
189
+ wasm.set_panic_hook();
300
190
  }
301
191
 
302
192
  function handleError(f, args) {
@@ -400,15 +290,6 @@ export class AirSquadron {
400
290
  return ret === 0 ? undefined : Gear.__wrap(ret);
401
291
  }
402
292
  /**
403
- * @param {Gear} gear
404
- * @returns {boolean}
405
- */
406
- can_equip(gear) {
407
- _assertClass(gear, Gear);
408
- const ret = wasm.airsquadron_can_equip(this.ptr, gear.ptr);
409
- return ret !== 0;
410
- }
411
- /**
412
293
  * @param {number} index
413
294
  * @returns {number}
414
295
  */
@@ -496,14 +377,14 @@ export class Analyzer {
496
377
  /**
497
378
  * @param {Comp} comp
498
379
  * @param {Formation} formation
499
- * @param {number} adjusted_anti_air_resist
380
+ * @param {number} ship_anti_air_resist
500
381
  * @param {number} fleet_anti_air_resist
501
382
  * @param {number | undefined} aaci
502
383
  * @returns {CompAntiAirInfo}
503
384
  */
504
- analyze_anti_air(comp, formation, adjusted_anti_air_resist, fleet_anti_air_resist, aaci) {
385
+ analyze_anti_air(comp, formation, ship_anti_air_resist, fleet_anti_air_resist, aaci) {
505
386
  _assertClass(comp, Comp);
506
- const ret = wasm.analyzer_analyze_anti_air(this.ptr, comp.ptr, addHeapObject(formation), adjusted_anti_air_resist, fleet_anti_air_resist, isLikeNone(aaci) ? 0xFFFFFF : aaci);
387
+ const ret = wasm.analyzer_analyze_anti_air(this.ptr, comp.ptr, addHeapObject(formation), ship_anti_air_resist, fleet_anti_air_resist, isLikeNone(aaci) ? 0xFFFFFF : aaci);
507
388
  return takeObject(ret);
508
389
  }
509
390
  /**
@@ -782,12 +663,12 @@ export class Comp {
782
663
  return takeObject(ret);
783
664
  }
784
665
  /**
785
- * 艦隊対空値
666
+ * 艦隊防空値
786
667
  * @param {number} formation_mod
787
668
  * @returns {number}
788
669
  */
789
- fleet_anti_air(formation_mod) {
790
- const ret = wasm.comp_fleet_anti_air(this.ptr, formation_mod);
670
+ adjusted_anti_air(formation_mod) {
671
+ const ret = wasm.comp_adjusted_anti_air(this.ptr, formation_mod);
791
672
  return ret;
792
673
  }
793
674
  /**
@@ -867,13 +748,12 @@ export class FhCore {
867
748
  wasm.__wbg_fhcore_free(ptr);
868
749
  }
869
750
  /**
870
- * @param {any} js_master
871
- * @param {Function} js_fn
751
+ * @param {MasterData} js_master
872
752
  */
873
- constructor(js_master, js_fn) {
753
+ constructor(js_master) {
874
754
  try {
875
755
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
876
- wasm.fhcore_new(retptr, addHeapObject(js_master), addHeapObject(js_fn));
756
+ wasm.fhcore_new(retptr, addHeapObject(js_master));
877
757
  var r0 = getInt32Memory0()[retptr / 4 + 0];
878
758
  var r1 = getInt32Memory0()[retptr / 4 + 1];
879
759
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -934,6 +814,13 @@ export class FhCore {
934
814
  return ret === 0 ? undefined : Ship.__wrap(ret);
935
815
  }
936
816
  /**
817
+ * @returns {Ship[]}
818
+ */
819
+ create_all_ships() {
820
+ const ret = wasm.fhcore_create_all_ships(this.ptr);
821
+ return takeObject(ret);
822
+ }
823
+ /**
937
824
  * @param {Uint16Array} main
938
825
  * @param {Uint16Array | undefined} escort
939
826
  * @returns {Comp}
@@ -1653,15 +1540,15 @@ export class Gear {
1653
1540
  }
1654
1541
  /**
1655
1542
  */
1656
- get adjusted_anti_air_resistance() {
1657
- const ret = wasm.__wbg_get_gear_adjusted_anti_air_resistance(this.ptr);
1543
+ get ship_anti_air_resistance() {
1544
+ const ret = wasm.__wbg_get_gear_ship_anti_air_resistance(this.ptr);
1658
1545
  return ret;
1659
1546
  }
1660
1547
  /**
1661
1548
  * @param {number} arg0
1662
1549
  */
1663
- set adjusted_anti_air_resistance(arg0) {
1664
- wasm.__wbg_set_gear_adjusted_anti_air_resistance(this.ptr, arg0);
1550
+ set ship_anti_air_resistance(arg0) {
1551
+ wasm.__wbg_set_gear_ship_anti_air_resistance(this.ptr, arg0);
1665
1552
  }
1666
1553
  /**
1667
1554
  */
@@ -1750,7 +1637,7 @@ export class Gear {
1750
1637
  * @returns {boolean}
1751
1638
  */
1752
1639
  has_proficiency() {
1753
- const ret = wasm.gear_has_proficiency(this.ptr);
1640
+ const ret = wasm.gear_can_be_deployed_to_land_base(this.ptr);
1754
1641
  return ret !== 0;
1755
1642
  }
1756
1643
  /**
@@ -1786,15 +1673,15 @@ export class Gear {
1786
1673
  /**
1787
1674
  * @returns {number}
1788
1675
  */
1789
- fleet_anti_air() {
1790
- const ret = wasm.gear_fleet_anti_air(this.ptr);
1676
+ fleet_anti_air_mod() {
1677
+ const ret = wasm.gear_fleet_anti_air_mod(this.ptr);
1791
1678
  return ret;
1792
1679
  }
1793
1680
  /**
1794
1681
  * @returns {number}
1795
1682
  */
1796
- adjusted_anti_air() {
1797
- const ret = wasm.gear_adjusted_anti_air(this.ptr);
1683
+ ship_anti_air_mod() {
1684
+ const ret = wasm.gear_ship_anti_air_mod(this.ptr);
1798
1685
  return ret;
1799
1686
  }
1800
1687
  /**
@@ -1872,6 +1759,13 @@ export class Gear {
1872
1759
  const ret = wasm.gear_expedition_bonus(this.ptr);
1873
1760
  return ret;
1874
1761
  }
1762
+ /**
1763
+ * @returns {boolean}
1764
+ */
1765
+ can_be_deployed_to_land_base() {
1766
+ const ret = wasm.gear_can_be_deployed_to_land_base(this.ptr);
1767
+ return ret !== 0;
1768
+ }
1875
1769
  }
1876
1770
 
1877
1771
  const IBonusesFinalization = new FinalizationRegistry(ptr => wasm.__wbg_ibonuses_free(ptr));
@@ -2048,15 +1942,15 @@ export class IBonuses {
2048
1942
  }
2049
1943
  /**
2050
1944
  */
2051
- get adjusted_anti_air() {
2052
- const ret = wasm.__wbg_get_ibonuses_adjusted_anti_air(this.ptr);
1945
+ get ship_anti_air() {
1946
+ const ret = wasm.__wbg_get_ibonuses_ship_anti_air(this.ptr);
2053
1947
  return ret;
2054
1948
  }
2055
1949
  /**
2056
1950
  * @param {number} arg0
2057
1951
  */
2058
- set adjusted_anti_air(arg0) {
2059
- wasm.__wbg_set_ibonuses_adjusted_anti_air(this.ptr, arg0);
1952
+ set ship_anti_air(arg0) {
1953
+ wasm.__wbg_set_ibonuses_ship_anti_air(this.ptr, arg0);
2060
1954
  }
2061
1955
  /**
2062
1956
  */
@@ -3144,6 +3038,13 @@ export class Ship {
3144
3038
  return ret;
3145
3039
  }
3146
3040
  /**
3041
+ * @returns {number}
3042
+ */
3043
+ get torpedo_accuracy_mod() {
3044
+ const ret = wasm.ship_torpedo_accuracy_mod(this.ptr);
3045
+ return ret;
3046
+ }
3047
+ /**
3147
3048
  * @returns {boolean}
3148
3049
  */
3149
3050
  is_installation() {
@@ -3212,8 +3113,8 @@ export class Ship {
3212
3113
  /**
3213
3114
  * @returns {number}
3214
3115
  */
3215
- fleet_anti_air() {
3216
- const ret = wasm.ship_fleet_anti_air(this.ptr);
3116
+ fleet_anti_air_mod() {
3117
+ const ret = wasm.ship_fleet_anti_air_mod(this.ptr);
3217
3118
  return ret;
3218
3119
  }
3219
3120
  /**
@@ -3321,8 +3222,8 @@ export class Ship {
3321
3222
  }
3322
3223
  }
3323
3224
 
3324
- export function __wbindgen_string_new(arg0, arg1) {
3325
- const ret = getStringFromWasm0(arg0, arg1);
3225
+ export function __wbg_ship_new(arg0) {
3226
+ const ret = Ship.__wrap(arg0);
3326
3227
  return addHeapObject(ret);
3327
3228
  };
3328
3229
 
@@ -3330,6 +3231,11 @@ export function __wbindgen_object_drop_ref(arg0) {
3330
3231
  takeObject(arg0);
3331
3232
  };
3332
3233
 
3234
+ export function __wbg_createEquipmentBonuses_273b5cec732de9f9(arg0, arg1) {
3235
+ const ret = createEquipmentBonuses(takeObject(arg0), takeObject(arg1));
3236
+ return addHeapObject(ret);
3237
+ };
3238
+
3333
3239
  export function __wbindgen_json_serialize(arg0, arg1) {
3334
3240
  const obj = getObject(arg1);
3335
3241
  const ret = JSON.stringify(obj === undefined ? null : obj);
@@ -3339,13 +3245,14 @@ export function __wbindgen_json_serialize(arg0, arg1) {
3339
3245
  getInt32Memory0()[arg0 / 4 + 0] = ptr0;
3340
3246
  };
3341
3247
 
3342
- export function __wbindgen_json_parse(arg0, arg1) {
3343
- const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
3248
+ export function __wbindgen_string_new(arg0, arg1) {
3249
+ const ret = getStringFromWasm0(arg0, arg1);
3344
3250
  return addHeapObject(ret);
3345
3251
  };
3346
3252
 
3347
- export function __wbg_error_8ff19d586a987aef(arg0) {
3348
- console.error(getObject(arg0));
3253
+ export function __wbindgen_json_parse(arg0, arg1) {
3254
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
3255
+ return addHeapObject(ret);
3349
3256
  };
3350
3257
 
3351
3258
  export function __wbg_new_693216e109162396() {
@@ -3423,6 +3330,11 @@ export function __wbg_msCrypto_d07655bf62361f21(arg0) {
3423
3330
  return addHeapObject(ret);
3424
3331
  };
3425
3332
 
3333
+ export function __wbg_new_94fb1279cf6afea5() {
3334
+ const ret = new Array();
3335
+ return addHeapObject(ret);
3336
+ };
3337
+
3426
3338
  export function __wbg_newnoargs_e23b458e372830de(arg0, arg1) {
3427
3339
  const ret = new Function(getStringFromWasm0(arg0, arg1));
3428
3340
  return addHeapObject(ret);
@@ -3438,10 +3350,10 @@ export function __wbindgen_object_clone_ref(arg0) {
3438
3350
  return addHeapObject(ret);
3439
3351
  };
3440
3352
 
3441
- export function __wbg_call_a19d3173f3e1d3c5() { return handleError(function (arg0, arg1, arg2, arg3) {
3442
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
3443
- return addHeapObject(ret);
3444
- }, arguments) };
3353
+ export function __wbg_push_40c6a90f1805aa90(arg0, arg1) {
3354
+ const ret = getObject(arg0).push(getObject(arg1));
3355
+ return ret;
3356
+ };
3445
3357
 
3446
3358
  export function __wbg_self_99737b4dcdf6f0d8() { return handleError(function () {
3447
3359
  const ret = self.self;
@@ -3497,14 +3409,6 @@ export function __wbg_subarray_da527dbd24eafb6b(arg0, arg1, arg2) {
3497
3409
  return addHeapObject(ret);
3498
3410
  };
3499
3411
 
3500
- export function __wbindgen_debug_string(arg0, arg1) {
3501
- const ret = debugString(getObject(arg1));
3502
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3503
- const len0 = WASM_VECTOR_LEN;
3504
- getInt32Memory0()[arg0 / 4 + 1] = len0;
3505
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
3506
- };
3507
-
3508
3412
  export function __wbindgen_throw(arg0, arg1) {
3509
3413
  throw new Error(getStringFromWasm0(arg0, arg1));
3510
3414
  };
Binary file