fleethub-core 1.8.1 → 1.8.4

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.
@@ -19,6 +19,23 @@ export interface ShipConditions extends ShipPosition {
19
19
  formation?: Formation;
20
20
  }
21
21
 
22
+ declare namespace OrgType {
23
+ export type Single = "Single";
24
+ export type CarrierTaskForce = "CarrierTaskForce";
25
+ export type SurfaceTaskForce = "SurfaceTaskForce";
26
+ export type TransportEscort = "TransportEscort";
27
+ export type EnemySingle = "EnemySingle";
28
+ export type EnemyCombined = "EnemyCombined";
29
+ }
30
+
31
+ export type OrgType =
32
+ | OrgType.Single
33
+ | OrgType.CarrierTaskForce
34
+ | OrgType.SurfaceTaskForce
35
+ | OrgType.TransportEscort
36
+ | OrgType.EnemySingle
37
+ | OrgType.EnemyCombined;
38
+
22
39
  export interface BattleDefinitions {
23
40
  formation: Record<Formation, NestedFormationDef>;
24
41
  anti_air_cutin: Record<number, AntiAirCutinDef>;
@@ -236,33 +253,11 @@ export interface SimulatorResult {
236
253
 
237
254
  export interface SimulatorResultItem {
238
255
  id: string;
239
- role: Role;
256
+ fleet_type: FleetType;
240
257
  index: number;
241
258
  damage_state_map: Record<DamageState, number>;
242
259
  }
243
260
 
244
- declare namespace DamageState {
245
- export type Normal = "Normal";
246
- export type Shouha = "Shouha";
247
- export type Chuuha = "Chuuha";
248
- export type Taiha = "Taiha";
249
- export type Sunk = "Sunk";
250
- }
251
-
252
- export type DamageState =
253
- | DamageState.Normal
254
- | DamageState.Shouha
255
- | DamageState.Chuuha
256
- | DamageState.Taiha
257
- | DamageState.Sunk;
258
-
259
- export interface ShipPosition {
260
- org_type?: OrgType;
261
- role?: Role;
262
- fleet_len?: number;
263
- index?: number;
264
- }
265
-
266
261
  declare namespace GearCategory {
267
262
  export type Fighter = "Fighter";
268
263
  export type Bomber = "Bomber";
@@ -417,18 +412,48 @@ export type GearType =
417
412
  | GearType.CbRecon2
418
413
  | GearType.SecondaryGun2;
419
414
 
420
- declare namespace FleetType {
421
- export type Main = "Main";
422
- export type Escort = "Escort";
423
- export type RouteSup = "RouteSup";
424
- export type BossSup = "BossSup";
415
+ declare namespace DamageState {
416
+ export type Normal = "Normal";
417
+ export type Shouha = "Shouha";
418
+ export type Chuuha = "Chuuha";
419
+ export type Taiha = "Taiha";
420
+ export type Sunk = "Sunk";
425
421
  }
426
422
 
427
- export type FleetType =
428
- | FleetType.Main
429
- | FleetType.Escort
430
- | FleetType.RouteSup
431
- | FleetType.BossSup;
423
+ export type DamageState =
424
+ | DamageState.Normal
425
+ | DamageState.Shouha
426
+ | DamageState.Chuuha
427
+ | DamageState.Taiha
428
+ | DamageState.Sunk;
429
+
430
+ declare namespace AirStateRank {
431
+ export type Rank0 = "Rank0";
432
+ export type Rank1 = "Rank1";
433
+ export type Rank2 = "Rank2";
434
+ export type Rank3 = "Rank3";
435
+ }
436
+
437
+ export type AirStateRank =
438
+ | AirStateRank.Rank0
439
+ | AirStateRank.Rank1
440
+ | AirStateRank.Rank2
441
+ | AirStateRank.Rank3;
442
+
443
+ declare namespace AirState {
444
+ export type AirSupremacy = "AirSupremacy";
445
+ export type AirSuperiority = "AirSuperiority";
446
+ export type AirParity = "AirParity";
447
+ export type AirDenial = "AirDenial";
448
+ export type AirIncapability = "AirIncapability";
449
+ }
450
+
451
+ export type AirState =
452
+ | AirState.AirSupremacy
453
+ | AirState.AirSuperiority
454
+ | AirState.AirParity
455
+ | AirState.AirDenial
456
+ | AirState.AirIncapability;
432
457
 
433
458
  export interface NodeAttackAnalyzerShipConfig extends NightFleetConditions {
434
459
  formation?: Formation;
@@ -446,6 +471,20 @@ export interface NodeAttackAnalysis {
446
471
  right: AttackAnalysis;
447
472
  }
448
473
 
474
+ declare namespace Role {
475
+ export type Main = "Main";
476
+ export type Escort = "Escort";
477
+ }
478
+
479
+ export type Role = Role.Main | Role.Escort;
480
+
481
+ export interface ShipPosition {
482
+ org_type?: OrgType;
483
+ fleet_type?: FleetType;
484
+ fleet_len?: number;
485
+ index?: number;
486
+ }
487
+
449
488
  export interface CompMeta {
450
489
  fleets: Record<FleetType, FleetMeta>;
451
490
  }
@@ -547,35 +586,8 @@ declare namespace AswAttackType {
547
586
 
548
587
  export type AswAttackType = AswAttackType.DepthCharge | AswAttackType.Aircraft;
549
588
 
550
- declare namespace AirStateRank {
551
- export type Rank0 = "Rank0";
552
- export type Rank1 = "Rank1";
553
- export type Rank2 = "Rank2";
554
- export type Rank3 = "Rank3";
555
- }
556
-
557
- export type AirStateRank =
558
- | AirStateRank.Rank0
559
- | AirStateRank.Rank1
560
- | AirStateRank.Rank2
561
- | AirStateRank.Rank3;
562
-
563
- declare namespace AirState {
564
- export type AirSupremacy = "AirSupremacy";
565
- export type AirSuperiority = "AirSuperiority";
566
- export type AirParity = "AirParity";
567
- export type AirDenial = "AirDenial";
568
- export type AirIncapability = "AirIncapability";
569
- }
570
-
571
- export type AirState =
572
- | AirState.AirSupremacy
573
- | AirState.AirSuperiority
574
- | AirState.AirParity
575
- | AirState.AirDenial
576
- | AirState.AirIncapability;
577
-
578
589
  export interface MasterData {
590
+ created_at: number;
579
591
  gears: MasterGear[];
580
592
  gear_attrs: MasterAttrRule<GearAttr>[];
581
593
  ships: MasterShip[];
@@ -601,107 +613,6 @@ export interface MasterAttrRule<T> {
601
613
  expr: string;
602
614
  }
603
615
 
604
- export interface AttackAnalyzerConfig {
605
- air_state?: AirState;
606
- engagement?: Engagement;
607
- attacker?: AttackAnalyzerShipConfig;
608
- target?: AttackAnalyzerShipConfig;
609
- }
610
-
611
- export interface AttackAnalyzerShipConfig
612
- extends ShipConditions,
613
- NightFleetConditions {
614
- fleet_los_mod?: number | null;
615
- }
616
-
617
- declare namespace ShipAttr {
618
- export type Unknown = "Unknown";
619
- export type Abyssal = "Abyssal";
620
- export type NightCarrier = "NightCarrier";
621
- export type Installation = "Installation";
622
- export type RoyalNavy = "RoyalNavy";
623
- export type Kai2 = "Kai2";
624
- export type TurbineSpeedBonus = "TurbineSpeedBonus";
625
- export type Pillbox = "Pillbox";
626
- export type IsolatedIsland = "IsolatedIsland";
627
- export type HarbourSummerPrincess = "HarbourSummerPrincess";
628
- export type SupplyDepot = "SupplyDepot";
629
- export type PtImp = "PtImp";
630
- export type BattleshipSummerPrincess = "BattleshipSummerPrincess";
631
- export type HeavyCruiserSummerPrincess = "HeavyCruiserSummerPrincess";
632
- }
633
-
634
- export type ShipAttr =
635
- | ShipAttr.Unknown
636
- | ShipAttr.Abyssal
637
- | ShipAttr.NightCarrier
638
- | ShipAttr.Installation
639
- | ShipAttr.RoyalNavy
640
- | ShipAttr.Kai2
641
- | ShipAttr.TurbineSpeedBonus
642
- | ShipAttr.Pillbox
643
- | ShipAttr.IsolatedIsland
644
- | ShipAttr.HarbourSummerPrincess
645
- | ShipAttr.SupplyDepot
646
- | ShipAttr.PtImp
647
- | ShipAttr.BattleshipSummerPrincess
648
- | ShipAttr.HeavyCruiserSummerPrincess;
649
-
650
- declare namespace OrgType {
651
- export type Single = "Single";
652
- export type CarrierTaskForce = "CarrierTaskForce";
653
- export type SurfaceTaskForce = "SurfaceTaskForce";
654
- export type TransportEscort = "TransportEscort";
655
- export type EnemySingle = "EnemySingle";
656
- export type EnemyCombined = "EnemyCombined";
657
- }
658
-
659
- export type OrgType =
660
- | OrgType.Single
661
- | OrgType.CarrierTaskForce
662
- | OrgType.SurfaceTaskForce
663
- | OrgType.TransportEscort
664
- | OrgType.EnemySingle
665
- | OrgType.EnemyCombined;
666
-
667
- export interface ShipEnvironment {
668
- org_type?: OrgType;
669
- role?: Role;
670
- index?: number;
671
- fleet_len?: number;
672
- formation?: Formation;
673
- fleet_los_mod?: number | null;
674
- night_conditions?: NightFleetConditions;
675
- }
676
-
677
- export interface NightFleetConditions {
678
- night_contact_rank?: ContactRank | null;
679
- starshell_index?: number | null;
680
- searchlight_index?: number | null;
681
- activates_large_searchlight?: boolean;
682
- }
683
-
684
- export interface NightConditions {
685
- player?: NightFleetConditions;
686
- enemy?: NightFleetConditions;
687
- }
688
-
689
- export interface BattleConditions {
690
- org_type: OrgType;
691
- role: Role;
692
- ship_index: number;
693
- fleet_len: number;
694
- formation: Formation;
695
- fleet_los_mod: number | null;
696
- night_conditions: NightFleetConditions;
697
- }
698
-
699
- export interface SupportShellingSimulatorParams {
700
- attacker_formation?: Formation;
701
- target_formation?: Formation;
702
- engagement: Engagement;
703
- }
704
-
705
616
  export interface EBonuses {
706
617
  firepower: number;
707
618
  torpedo: number;
@@ -742,12 +653,44 @@ export interface GearInput {
742
653
 
743
654
  export type GearVecInput = GearInput[];
744
655
 
745
- declare namespace Role {
746
- export type Main = "Main";
747
- export type Escort = "Escort";
656
+ declare namespace ShipAttr {
657
+ export type Unknown = "Unknown";
658
+ export type Abyssal = "Abyssal";
659
+ export type NightCarrier = "NightCarrier";
660
+ export type Installation = "Installation";
661
+ export type RoyalNavy = "RoyalNavy";
662
+ export type Kai2 = "Kai2";
663
+ export type TurbineSpeedBonus = "TurbineSpeedBonus";
664
+ export type Pillbox = "Pillbox";
665
+ export type IsolatedIsland = "IsolatedIsland";
666
+ export type HarbourSummerPrincess = "HarbourSummerPrincess";
667
+ export type SupplyDepot = "SupplyDepot";
668
+ export type PtImp = "PtImp";
669
+ export type BattleshipSummerPrincess = "BattleshipSummerPrincess";
670
+ export type HeavyCruiserSummerPrincess = "HeavyCruiserSummerPrincess";
748
671
  }
749
672
 
750
- export type Role = Role.Main | Role.Escort;
673
+ export type ShipAttr =
674
+ | ShipAttr.Unknown
675
+ | ShipAttr.Abyssal
676
+ | ShipAttr.NightCarrier
677
+ | ShipAttr.Installation
678
+ | ShipAttr.RoyalNavy
679
+ | ShipAttr.Kai2
680
+ | ShipAttr.TurbineSpeedBonus
681
+ | ShipAttr.Pillbox
682
+ | ShipAttr.IsolatedIsland
683
+ | ShipAttr.HarbourSummerPrincess
684
+ | ShipAttr.SupplyDepot
685
+ | ShipAttr.PtImp
686
+ | ShipAttr.BattleshipSummerPrincess
687
+ | ShipAttr.HeavyCruiserSummerPrincess;
688
+
689
+ export interface SupportShellingSimulatorParams {
690
+ attacker_formation?: Formation;
691
+ target_formation?: Formation;
692
+ engagement: Engagement;
693
+ }
751
694
 
752
695
  declare namespace GearAttr {
753
696
  export type Unknown = "Unknown";
@@ -929,6 +872,12 @@ export interface DamageReport {
929
872
  damage_state_density: Histogram<DamageState, number>;
930
873
  }
931
874
 
875
+ export interface AttackAnalyzerShipConfig
876
+ extends ShipConditions,
877
+ NightFleetConditions {
878
+ fleet_los_mod?: number | null;
879
+ }
880
+
932
881
  export interface CompAntiAirAnalysis {
933
882
  fleet_adjusted_anti_air: number;
934
883
  ships: AntiAirReport[];
@@ -988,6 +937,19 @@ export type SingleFormation =
988
937
  | SingleFormation.LineAbreast
989
938
  | SingleFormation.Vanguard;
990
939
 
940
+ declare namespace FleetType {
941
+ export type Main = "Main";
942
+ export type Escort = "Escort";
943
+ export type RouteSup = "RouteSup";
944
+ export type BossSup = "BossSup";
945
+ }
946
+
947
+ export type FleetType =
948
+ | FleetType.Main
949
+ | FleetType.Escort
950
+ | FleetType.RouteSup
951
+ | FleetType.BossSup;
952
+
991
953
  export interface CustomPowerModifiers {
992
954
  precap_mod?: AttackPowerModifier;
993
955
  postcap_mod?: AttackPowerModifier;
@@ -1127,6 +1089,28 @@ export interface AttackAnalysis {
1127
1089
  support_shelling: ActionReport<SupportShellingStyle>;
1128
1090
  }
1129
1091
 
1092
+ export interface NightFleetConditions {
1093
+ night_contact_rank?: ContactRank | null;
1094
+ starshell_index?: number | null;
1095
+ searchlight_index?: number | null;
1096
+ activates_large_searchlight?: boolean;
1097
+ }
1098
+
1099
+ export interface NightConditions {
1100
+ player?: NightFleetConditions;
1101
+ enemy?: NightFleetConditions;
1102
+ }
1103
+
1104
+ export interface BattleConditions {
1105
+ org_type: OrgType;
1106
+ role: Role;
1107
+ ship_index: number;
1108
+ fleet_len: number;
1109
+ formation: Formation;
1110
+ fleet_los_mod: number | null;
1111
+ night_conditions: NightFleetConditions;
1112
+ }
1113
+
1130
1114
  export interface MasterShip {
1131
1115
  ship_id: number;
1132
1116
  name: string;
@@ -1160,6 +1144,31 @@ export interface MasterShip {
1160
1144
 
1161
1145
  export type StatInterval = [number | null, number | null];
1162
1146
 
1147
+ export interface MasterGear {
1148
+ gear_id: number;
1149
+ name: string;
1150
+ types: GearTypeIdArray;
1151
+ special_type?: number;
1152
+ max_hp?: number;
1153
+ firepower?: number;
1154
+ armor?: number;
1155
+ torpedo?: number;
1156
+ anti_air?: number;
1157
+ speed?: number;
1158
+ bombing?: number;
1159
+ asw?: number;
1160
+ los?: number;
1161
+ luck?: number;
1162
+ accuracy?: number;
1163
+ evasion?: number;
1164
+ range?: number;
1165
+ radius?: number;
1166
+ cost?: number;
1167
+ improvable?: boolean;
1168
+ ship_anti_air_resist?: number;
1169
+ fleet_anti_air_resist?: number;
1170
+ }
1171
+
1163
1172
  export interface CompAnalyzerConfig {
1164
1173
  engagement: Engagement;
1165
1174
  formation: Formation;
@@ -1322,31 +1331,6 @@ export type SpeedGroup =
1322
1331
 
1323
1332
  export type SlotSizeVec = (number | null)[];
1324
1333
 
1325
- export interface MasterGear {
1326
- gear_id: number;
1327
- name: string;
1328
- types: GearTypeIdArray;
1329
- special_type?: number;
1330
- max_hp?: number;
1331
- firepower?: number;
1332
- armor?: number;
1333
- torpedo?: number;
1334
- anti_air?: number;
1335
- speed?: number;
1336
- bombing?: number;
1337
- asw?: number;
1338
- los?: number;
1339
- luck?: number;
1340
- accuracy?: number;
1341
- evasion?: number;
1342
- range?: number;
1343
- radius?: number;
1344
- cost?: number;
1345
- improvable?: boolean;
1346
- ship_anti_air_resist?: number;
1347
- fleet_anti_air_resist?: number;
1348
- }
1349
-
1350
1334
  export interface ActionReport<T> {
1351
1335
  data: Record<string, AttackReport<T>>;
1352
1336
  damage_state_density: Histogram<DamageState, number> | null;
@@ -1504,17 +1488,6 @@ export class AirSquadron {
1504
1488
  */
1505
1489
  export class Analyzer {
1506
1490
  free(): void;
1507
- /**
1508
- * @param {AttackAnalyzerConfig} config
1509
- * @param {Ship} attacker
1510
- * @param {Ship} target
1511
- * @returns {AttackAnalysis}
1512
- */
1513
- analyze_attack(
1514
- config: AttackAnalyzerConfig,
1515
- attacker: Ship,
1516
- target: Ship
1517
- ): AttackAnalysis;
1518
1491
  /**
1519
1492
  * @param {ShipAnalyzerConfig} config
1520
1493
  * @param {Ship} left
@@ -1522,7 +1495,7 @@ export class Analyzer {
1522
1495
  * @param {boolean} attacker_is_left
1523
1496
  * @returns {AttackAnalysis}
1524
1497
  */
1525
- analyze_attack_by_ship_analyzer(
1498
+ analyze_ship_attack(
1526
1499
  config: ShipAnalyzerConfig,
1527
1500
  left: Ship,
1528
1501
  right: Ship,
@@ -2028,7 +2001,7 @@ export class Gear {
2028
2001
  readonly ship_anti_air_resist: number;
2029
2002
  /**
2030
2003
  */
2031
- readonly special_type_id: number;
2004
+ readonly special_type: number;
2032
2005
  /**
2033
2006
  */
2034
2007
  readonly speed: number;
@@ -123,6 +123,21 @@ export function parse_ship_conditions(value) {
123
123
  return takeObject(ret);
124
124
  }
125
125
 
126
+ const u32CvtShim = new Uint32Array(2);
127
+
128
+ const uint64CvtShim = new BigUint64Array(u32CvtShim.buffer);
129
+
130
+ function getArrayU8FromWasm0(ptr, len) {
131
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
132
+ }
133
+
134
+ function passArray8ToWasm0(arg, malloc) {
135
+ const ptr = malloc(arg.length * 1);
136
+ getUint8Memory0().set(arg, ptr / 1);
137
+ WASM_VECTOR_LEN = arg.length;
138
+ return ptr;
139
+ }
140
+
126
141
  function _assertClass(instance, klass) {
127
142
  if (!(instance instanceof klass)) {
128
143
  throw new Error(`expected instance of ${klass.name}`);
@@ -130,10 +145,6 @@ function _assertClass(instance, klass) {
130
145
  return instance.ptr;
131
146
  }
132
147
 
133
- const u32CvtShim = new Uint32Array(2);
134
-
135
- const uint64CvtShim = new BigUint64Array(u32CvtShim.buffer);
136
-
137
148
  let cachedFloat64Memory0 = new Float64Array();
138
149
 
139
150
  function getFloat64Memory0() {
@@ -143,17 +154,6 @@ function getFloat64Memory0() {
143
154
  return cachedFloat64Memory0;
144
155
  }
145
156
 
146
- function getArrayU8FromWasm0(ptr, len) {
147
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
148
- }
149
-
150
- function passArray8ToWasm0(arg, malloc) {
151
- const ptr = malloc(arg.length * 1);
152
- getUint8Memory0().set(arg, ptr / 1);
153
- WASM_VECTOR_LEN = arg.length;
154
- return ptr;
155
- }
156
-
157
157
  function isLikeNone(x) {
158
158
  return x === undefined || x === null;
159
159
  }
@@ -391,28 +391,16 @@ export class Analyzer {
391
391
  wasm.__wbg_analyzer_free(ptr);
392
392
  }
393
393
  /**
394
- * @param {AttackAnalyzerConfig} config
395
- * @param {Ship} attacker
396
- * @param {Ship} target
397
- * @returns {AttackAnalysis}
398
- */
399
- analyze_attack(config, attacker, target) {
400
- _assertClass(attacker, Ship);
401
- _assertClass(target, Ship);
402
- const ret = wasm.analyzer_analyze_attack(this.ptr, addHeapObject(config), attacker.ptr, target.ptr);
403
- return takeObject(ret);
404
- }
405
- /**
406
394
  * @param {ShipAnalyzerConfig} config
407
395
  * @param {Ship} left
408
396
  * @param {Ship} right
409
397
  * @param {boolean} attacker_is_left
410
398
  * @returns {AttackAnalysis}
411
399
  */
412
- analyze_attack_by_ship_analyzer(config, left, right, attacker_is_left) {
400
+ analyze_ship_attack(config, left, right, attacker_is_left) {
413
401
  _assertClass(left, Ship);
414
402
  _assertClass(right, Ship);
415
- const ret = wasm.analyzer_analyze_attack_by_ship_analyzer(this.ptr, addHeapObject(config), left.ptr, right.ptr, attacker_is_left);
403
+ const ret = wasm.analyzer_analyze_ship_attack(this.ptr, addHeapObject(config), left.ptr, right.ptr, attacker_is_left);
416
404
  return takeObject(ret);
417
405
  }
418
406
  /**
@@ -1451,8 +1439,8 @@ export class Gear {
1451
1439
  /**
1452
1440
  * @returns {number}
1453
1441
  */
1454
- get special_type_id() {
1455
- const ret = wasm.gear_special_type_id(this.ptr);
1442
+ get special_type() {
1443
+ const ret = wasm.gear_special_type(this.ptr);
1456
1444
  return ret;
1457
1445
  }
1458
1446
  /**
@@ -3141,7 +3129,7 @@ export function __wbindgen_string_new(arg0, arg1) {
3141
3129
  return addHeapObject(ret);
3142
3130
  };
3143
3131
 
3144
- export function __wbg_createEquipmentBonuses_9882e093ee6c42fa(arg0, arg1) {
3132
+ export function __wbg_createEquipmentBonuses_662742ffd582ab7c(arg0, arg1) {
3145
3133
  const ret = createEquipmentBonuses(takeObject(arg0), takeObject(arg1));
3146
3134
  return addHeapObject(ret);
3147
3135
  };
Binary file