fleethub-core 1.8.9 → 1.8.10

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.
@@ -8,7 +8,7 @@ export function set_panic_hook(): void;
8
8
  * @returns {ShipConditions}
9
9
  */
10
10
  export function parse_ship_conditions(value: ShipConditions): ShipConditions;
11
- export type Role = "Main" | "Escort";
11
+ export type Side = "Player" | "Enemy";
12
12
 
13
13
  export interface ShipPosition {
14
14
  org_type?: OrgType;
@@ -86,43 +86,94 @@ export interface FormationCombatModifiersDef {
86
86
  evasion_mod?: number;
87
87
  }
88
88
 
89
- export type TorpedoAttackType = null;
89
+ export type CompiledEvaler = string;
90
90
 
91
- export type NightPhaseAttackType =
92
- | { t: "Night"; c: NightAttackType }
93
- | { t: "Asw"; c: AswAttackType };
91
+ export interface OrgState {
92
+ id?: string;
93
+ f1?: FleetState;
94
+ f2?: FleetState;
95
+ f3?: FleetState;
96
+ f4?: FleetState;
97
+ a1?: AirSquadronState;
98
+ a2?: AirSquadronState;
99
+ a3?: AirSquadronState;
100
+ hq_level?: number;
101
+ org_type?: OrgType;
102
+ sortie?: FleetKey;
103
+ route_sup?: FleetKey;
104
+ boss_sup?: FleetKey;
105
+ }
94
106
 
95
- export type DayPhaseAttackType =
96
- | { t: "Shelling"; c: ShellingType }
97
- | { t: "Asw"; c: AswAttackType };
107
+ export interface AirSquadronState extends GearVecState, SlotSizeVecState {
108
+ id?: string;
109
+ mode?: AirSquadronMode;
110
+ }
98
111
 
99
- export type AttackType =
100
- | { t: "Asw"; c: AswAttackType }
101
- | { t: "Shelling"; c: ShellingType }
102
- | { t: "Night"; c: NightAttackType }
103
- | { t: "Torpedo" }
104
- | { t: "SupportShelling"; c: SupportShellingType };
112
+ export type AirSquadronMode = "Sortie" | "AirDefense";
105
113
 
106
- export type SupportShellingType = ShellingType;
114
+ export interface FleetState {
115
+ id?: string;
116
+ len?: number;
117
+ s1?: ShipState;
118
+ s2?: ShipState;
119
+ s3?: ShipState;
120
+ s4?: ShipState;
121
+ s5?: ShipState;
122
+ s6?: ShipState;
123
+ s7?: ShipState;
124
+ }
107
125
 
108
- export type NightAttackType = "Normal" | "Swordfish" | "Carrier";
126
+ export interface ShipState extends GearVecState, SlotSizeVecState {
127
+ id?: string;
128
+ ship_id: number;
129
+ level?: number;
130
+ current_hp?: number;
131
+ morale?: number;
132
+ ammo?: number;
133
+ fuel?: number;
134
+ max_hp_mod?: number;
135
+ firepower_mod?: number;
136
+ torpedo_mod?: number;
137
+ armor_mod?: number;
138
+ anti_air_mod?: number;
139
+ evasion_mod?: number;
140
+ asw_mod?: number;
141
+ los_mod?: number;
142
+ luck_mod?: number;
143
+ day_gunfit_accuracy?: number;
144
+ night_gunfit_accuracy?: number;
145
+ custom_power_mods?: CustomPowerModifiers;
146
+ }
109
147
 
110
- export type ShellingType = "Normal" | "Carrier";
148
+ export interface SlotSizeVecState {
149
+ ss1?: number;
150
+ ss2?: number;
151
+ ss3?: number;
152
+ ss4?: number;
153
+ ss5?: number;
154
+ }
111
155
 
112
- export type AswAttackType = "DepthCharge" | "Aircraft";
156
+ export interface GearVecState {
157
+ g1?: GearState;
158
+ g2?: GearState;
159
+ g3?: GearState;
160
+ g4?: GearState;
161
+ g5?: GearState;
162
+ gx?: GearState;
163
+ }
113
164
 
114
- export type AirStateRank = "Rank0" | "Rank1" | "Rank2" | "Rank3";
165
+ export interface GearState {
166
+ id?: string;
167
+ gear_id: number;
168
+ exp?: number;
169
+ stars?: number;
170
+ }
115
171
 
116
- export type AirState =
117
- | "AirSupremacy"
118
- | "AirSuperiority"
119
- | "AirParity"
120
- | "AirDenial"
121
- | "AirIncapability";
172
+ export type SpeedGroup = "A" | "B1" | "B2" | "C";
122
173
 
123
- export type CompiledEvaler = string;
174
+ export type SlotSizeVec = (number | null)[];
124
175
 
125
- export type SpeedGroup = "A" | "B1" | "B2" | "C";
176
+ export type Role = "Main" | "Escort";
126
177
 
127
178
  export interface ActionReport<T> {
128
179
  data: Record<string, AttackReport<T>>;
@@ -130,8 +181,6 @@ export interface ActionReport<T> {
130
181
  is_active: boolean;
131
182
  }
132
183
 
133
- export type GearTypeIdArray = [number, number, number, number, number];
134
-
135
184
  export type ShipType =
136
185
  | "Unknown"
137
186
  | "DE"
@@ -167,8 +216,6 @@ export type ShipCategory =
167
216
  | "Submarine"
168
217
  | "AuxiliaryShip";
169
218
 
170
- export type MoraleState = "Sparkle" | "Normal" | "Orange" | "Red";
171
-
172
219
  export type NightCutinLike = NightCutin | FleetCutin;
173
220
 
174
221
  export type DayCutinLike = DayCutin | FleetCutin;
@@ -253,18 +300,14 @@ export interface FleetCutinAttackReport<T> extends AttackReport<T> {
253
300
  power_mod: number;
254
301
  }
255
302
 
256
- export type SpecialEnemyType =
257
- | "None"
258
- | "SoftSkinned"
259
- | "Pillbox"
260
- | "IsolatedIsland"
261
- | "SupplyDepot"
262
- | "HarbourSummerPrincess"
263
- | "PtImp"
264
- | "BattleshipSummerPrincess"
265
- | "HeavyCruiserSummerPrincess";
303
+ export interface MoveShipPayload {
304
+ current: [string, string, ShipKey];
305
+ target: [string | null, string, ShipKey];
306
+ }
266
307
 
267
- export type ContactRank = "Rank1" | "Rank2" | "Rank3";
308
+ export type GearTypeIdArray = [number, number, number, number, number];
309
+
310
+ export type MoraleState = "Sparkle" | "Normal" | "Orange" | "Red";
268
311
 
269
312
  export type AirWaveType = "Jet" | "LandBase" | "Carrier";
270
313
 
@@ -280,6 +323,21 @@ export interface SimulatorResultItem {
280
323
  damage_state_map: Record<DamageState, number>;
281
324
  }
282
325
 
326
+ export type SpecialEnemyType =
327
+ | "None"
328
+ | "SoftSkinned"
329
+ | "Pillbox"
330
+ | "IsolatedIsland"
331
+ | "SupplyDepot"
332
+ | "HarbourSummerPrincess"
333
+ | "PtImp"
334
+ | "BattleshipSummerPrincess"
335
+ | "HeavyCruiserSummerPrincess";
336
+
337
+ export type ShipKey = "s1" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7";
338
+
339
+ export type ContactRank = "Rank1" | "Rank2" | "Rank3";
340
+
283
341
  export type GearCategory =
284
342
  | "Fighter"
285
343
  | "Bomber"
@@ -358,6 +416,40 @@ export type GearType =
358
416
 
359
417
  export type DamageState = "Normal" | "Shouha" | "Chuuha" | "Taiha" | "Sunk";
360
418
 
419
+ export type TorpedoAttackType = null;
420
+
421
+ export type NightPhaseAttackType =
422
+ | { t: "Night"; c: NightAttackType }
423
+ | { t: "Asw"; c: AswAttackType };
424
+
425
+ export type DayPhaseAttackType =
426
+ | { t: "Shelling"; c: ShellingType }
427
+ | { t: "Asw"; c: AswAttackType };
428
+
429
+ export type AttackType =
430
+ | { t: "Asw"; c: AswAttackType }
431
+ | { t: "Shelling"; c: ShellingType }
432
+ | { t: "Night"; c: NightAttackType }
433
+ | { t: "Torpedo" }
434
+ | { t: "SupportShelling"; c: SupportShellingType };
435
+
436
+ export type SupportShellingType = ShellingType;
437
+
438
+ export type NightAttackType = "Normal" | "Swordfish" | "Carrier";
439
+
440
+ export type ShellingType = "Normal" | "Carrier";
441
+
442
+ export type AswAttackType = "DepthCharge" | "Aircraft";
443
+
444
+ export type AirStateRank = "Rank0" | "Rank1" | "Rank2" | "Rank3";
445
+
446
+ export type AirState =
447
+ | "AirSupremacy"
448
+ | "AirSuperiority"
449
+ | "AirParity"
450
+ | "AirDenial"
451
+ | "AirIncapability";
452
+
361
453
  export type FhResult<T> = { Ok: T } | { Err: string };
362
454
 
363
455
  export interface MasterData extends MasterBattleDefinitions {
@@ -437,33 +529,10 @@ export interface GearInput {
437
529
 
438
530
  export type GearVecInput = GearInput[];
439
531
 
440
- export type Side = "Player" | "Enemy";
441
-
442
532
  export interface ShipConditions extends ShipPosition {
443
533
  formation?: Formation;
444
534
  }
445
535
 
446
- export type OrgType =
447
- | "Single"
448
- | "CarrierTaskForce"
449
- | "SurfaceTaskForce"
450
- | "TransportEscort"
451
- | "EnemySingle"
452
- | "EnemyCombined";
453
-
454
- export interface SupportShellingSimulatorParams {
455
- attacker_formation?: Formation;
456
- target_formation?: Formation;
457
- engagement: Engagement;
458
- }
459
-
460
- export interface ShipAnalyzerConfig {
461
- air_state?: AirState;
462
- engagement?: Engagement;
463
- left?: AttackAnalyzerShipConfig;
464
- right?: AttackAnalyzerShipConfig;
465
- }
466
-
467
536
  export type ShipAttr =
468
537
  | "Unknown"
469
538
  | "Abyssal"
@@ -480,6 +549,14 @@ export type ShipAttr =
480
549
  | "BattleshipSummerPrincess"
481
550
  | "HeavyCruiserSummerPrincess";
482
551
 
552
+ export type OrgType =
553
+ | "Single"
554
+ | "CarrierTaskForce"
555
+ | "SurfaceTaskForce"
556
+ | "TransportEscort"
557
+ | "EnemySingle"
558
+ | "EnemyCombined";
559
+
483
560
  export type GearAttr =
484
561
  | "Unknown"
485
562
  | "Abyssal"
@@ -512,6 +589,21 @@ export type GearAttr =
512
589
  | "SemiNightPlane"
513
590
  | "HighAltitudeInterceptor";
514
591
 
592
+ export type FleetKey = "f1" | "f2" | "f3" | "f4";
593
+
594
+ export interface SupportShellingSimulatorParams {
595
+ attacker_formation?: Formation;
596
+ target_formation?: Formation;
597
+ engagement: Engagement;
598
+ }
599
+
600
+ export interface ShipAnalyzerConfig {
601
+ air_state?: AirState;
602
+ engagement?: Engagement;
603
+ left?: AttackAnalyzerShipConfig;
604
+ right?: AttackAnalyzerShipConfig;
605
+ }
606
+
515
607
  export interface CompAntiAirAnalysis {
516
608
  fleet_adjusted_anti_air: number;
517
609
  ships: AntiAirReport[];
@@ -569,28 +661,6 @@ export interface ShellingStyle {
569
661
  hits: number;
570
662
  }
571
663
 
572
- export interface CustomPowerModifiers {
573
- precap_mod?: AttackPowerModifier;
574
- postcap_mod?: AttackPowerModifier;
575
- basic_power_mod?: AttackPowerModifier;
576
- }
577
-
578
- export interface SpecialEnemyModifiers {
579
- precap_general_mod: AttackPowerModifier;
580
- stype_mod: AttackPowerModifier;
581
- landing_craft_synergy_mod: AttackPowerModifier;
582
- toku_daihatsu_tank_mod: AttackPowerModifier;
583
- m4a1dd_mod: AttackPowerModifier;
584
- honi_mod: AttackPowerModifier;
585
- postcap_general_mod: AttackPowerModifier;
586
- pt_mod: AttackPowerModifier;
587
- }
588
-
589
- export interface AttackPowerModifier {
590
- a?: number;
591
- b?: number;
592
- }
593
-
594
664
  export interface AttackPower {
595
665
  precap: number;
596
666
  is_capped: boolean;
@@ -686,6 +756,28 @@ export type SingleFormation =
686
756
  | "LineAbreast"
687
757
  | "Vanguard";
688
758
 
759
+ export interface CustomPowerModifiers {
760
+ precap_mod?: AttackPowerModifier;
761
+ postcap_mod?: AttackPowerModifier;
762
+ basic_power_mod?: AttackPowerModifier;
763
+ }
764
+
765
+ export interface SpecialEnemyModifiers {
766
+ precap_general_mod: AttackPowerModifier;
767
+ stype_mod: AttackPowerModifier;
768
+ landing_craft_synergy_mod: AttackPowerModifier;
769
+ toku_daihatsu_tank_mod: AttackPowerModifier;
770
+ m4a1dd_mod: AttackPowerModifier;
771
+ honi_mod: AttackPowerModifier;
772
+ postcap_general_mod: AttackPowerModifier;
773
+ pt_mod: AttackPowerModifier;
774
+ }
775
+
776
+ export interface AttackPowerModifier {
777
+ a?: number;
778
+ b?: number;
779
+ }
780
+
689
781
  export interface MasterBattleDefinitions {
690
782
  formation: NestedFormationDef[];
691
783
  anti_air_cutin: AntiAirCutinDef[];
@@ -844,104 +936,6 @@ export interface CompAnalysis {
844
936
  anti_air: CompAntiAirAnalysis;
845
937
  }
846
938
 
847
- export interface AttackReport<T> {
848
- style: T;
849
- proc_rate: number | null;
850
- attack_power: AttackPower | null;
851
- attack_power_params: AttackPowerParams | null;
852
- hits: number;
853
- hit_rate: HitRate | null;
854
- hit_rate_params: HitRateParams | null;
855
- damage: DamageReport | null;
856
- }
857
-
858
- export type ShipStateMap = Record<ShipKey, ShipState>;
859
-
860
- export type ShipKey = "s1" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7";
861
-
862
- export interface OrgState {
863
- id?: string;
864
- f1?: FleetState;
865
- f2?: FleetState;
866
- f3?: FleetState;
867
- f4?: FleetState;
868
- a1?: AirSquadronState;
869
- a2?: AirSquadronState;
870
- a3?: AirSquadronState;
871
- hq_level?: number;
872
- org_type?: OrgType;
873
- sortie?: string;
874
- route_sup?: string;
875
- boss_sup?: string;
876
- }
877
-
878
- export interface AirSquadronState extends GearVecState, SlotSizeVecState {
879
- id?: string;
880
- mode?: AirSquadronMode;
881
- }
882
-
883
- export type AirSquadronMode = "Sortie" | "AirDefense";
884
-
885
- export interface FleetState {
886
- id?: string;
887
- len?: number;
888
- s1?: ShipState;
889
- s2?: ShipState;
890
- s3?: ShipState;
891
- s4?: ShipState;
892
- s5?: ShipState;
893
- s6?: ShipState;
894
- s7?: ShipState;
895
- }
896
-
897
- export interface ShipState extends GearVecState, SlotSizeVecState {
898
- id?: string;
899
- ship_id: number;
900
- level?: number;
901
- current_hp?: number;
902
- morale?: number;
903
- ammo?: number;
904
- fuel?: number;
905
- max_hp_mod?: number;
906
- firepower_mod?: number;
907
- torpedo_mod?: number;
908
- armor_mod?: number;
909
- anti_air_mod?: number;
910
- evasion_mod?: number;
911
- asw_mod?: number;
912
- los_mod?: number;
913
- luck_mod?: number;
914
- day_gunfit_accuracy?: number;
915
- night_gunfit_accuracy?: number;
916
- custom_power_mods?: CustomPowerModifiers;
917
- }
918
-
919
- export interface SlotSizeVecState {
920
- ss1?: number;
921
- ss2?: number;
922
- ss3?: number;
923
- ss4?: number;
924
- ss5?: number;
925
- }
926
-
927
- export interface GearVecState {
928
- g1?: GearState;
929
- g2?: GearState;
930
- g3?: GearState;
931
- g4?: GearState;
932
- g5?: GearState;
933
- gx?: GearState;
934
- }
935
-
936
- export interface GearState {
937
- id?: string;
938
- gear_id: number;
939
- exp?: number;
940
- stars?: number;
941
- }
942
-
943
- export type SlotSizeVec = (number | null)[];
944
-
945
939
  export interface NightFleetConditions {
946
940
  night_contact_rank?: ContactRank | null;
947
941
  starshell_index?: number | null;
@@ -989,6 +983,17 @@ export interface MasterGear {
989
983
  fleet_anti_air_resist?: number;
990
984
  }
991
985
 
986
+ export interface AttackReport<T> {
987
+ style: T;
988
+ proc_rate: number | null;
989
+ attack_power: AttackPower | null;
990
+ attack_power_params: AttackPowerParams | null;
991
+ hits: number;
992
+ hit_rate: HitRate | null;
993
+ hit_rate_params: HitRateParams | null;
994
+ damage: DamageReport | null;
995
+ }
996
+
992
997
  /**
993
998
  */
994
999
  export class AirSquadron {
@@ -1118,16 +1123,16 @@ export class Comp {
1118
1123
  get_fleet_id(ft: FleetType): string | undefined;
1119
1124
  /**
1120
1125
  * @param {FleetType} ft
1121
- * @param {string} key
1126
+ * @param {ShipKey} key
1122
1127
  * @returns {Ship | undefined}
1123
1128
  */
1124
- get_ship_with_clone(ft: FleetType, key: string): Ship | undefined;
1129
+ get_ship_with_clone(ft: FleetType, key: ShipKey): Ship | undefined;
1125
1130
  /**
1126
1131
  * @param {FleetType} ft
1127
- * @param {string} key
1132
+ * @param {ShipKey} key
1128
1133
  * @returns {string | undefined}
1129
1134
  */
1130
- get_ship_entity_id(ft: FleetType, key: string): string | undefined;
1135
+ get_ship_entity_id(ft: FleetType, key: ShipKey): string | undefined;
1131
1136
  /**
1132
1137
  * @param {string} id
1133
1138
  * @returns {Ship | undefined}
@@ -1170,6 +1175,11 @@ export class Comp {
1170
1175
  * @returns {ShipConditions}
1171
1176
  */
1172
1177
  get_ship_conditions(ship: Ship, formation?: Formation): ShipConditions;
1178
+ /**
1179
+ * @param {FleetType} fleet_type
1180
+ * @returns {number | undefined}
1181
+ */
1182
+ fleet_los_mod(fleet_type: FleetType): number | undefined;
1173
1183
  /**
1174
1184
  */
1175
1185
  boss_sup?: Fleet;
@@ -1303,10 +1313,10 @@ export class Fleet {
1303
1313
  */
1304
1314
  count_ships(): number;
1305
1315
  /**
1306
- * @param {string} key
1316
+ * @param {ShipKey} key
1307
1317
  * @returns {Ship | undefined}
1308
1318
  */
1309
- get_ship(key: string): Ship | undefined;
1319
+ get_ship(key: ShipKey): Ship | undefined;
1310
1320
  /**
1311
1321
  * @param {AirWaveType} air_type
1312
1322
  * @returns {number | undefined}
@@ -1563,11 +1573,26 @@ export class Gear {
1563
1573
  export class Org {
1564
1574
  free(): void;
1565
1575
  /**
1566
- * @param {Role} role
1567
- * @param {string} key
1568
1576
  * @returns {string | undefined}
1569
1577
  */
1570
- get_ship_entity_id(role: Role, key: string): string | undefined;
1578
+ first_ship_id(): string | undefined;
1579
+ /**
1580
+ * @param {FleetKey} fleet_key
1581
+ * @param {ShipKey} ship_key
1582
+ * @returns {number | undefined}
1583
+ */
1584
+ get_ship_mid(fleet_key: FleetKey, ship_key: ShipKey): number | undefined;
1585
+ /**
1586
+ * @param {FleetKey} fleet_key
1587
+ * @param {ShipKey} ship_key
1588
+ * @returns {string | undefined}
1589
+ */
1590
+ get_ship_eid(fleet_key: FleetKey, ship_key: ShipKey): string | undefined;
1591
+ /**
1592
+ * @param {FleetKey} key
1593
+ * @returns {string}
1594
+ */
1595
+ get_fleet_id(key: FleetKey): string;
1571
1596
  /**
1572
1597
  * @returns {(string)[]}
1573
1598
  */
@@ -1581,24 +1606,35 @@ export class Org {
1581
1606
  */
1582
1607
  escort_ship_ids(): Uint16Array;
1583
1608
  /**
1584
- * @param {string} key
1609
+ * @param {FleetKey} key
1585
1610
  * @returns {Fleet}
1586
1611
  */
1587
- clone_fleet(key: string): Fleet;
1612
+ clone_fleet(key: FleetKey): Fleet;
1613
+ /**
1614
+ * @param {FleetKey} fleet_key
1615
+ * @param {ShipKey} ship_key
1616
+ * @returns {Ship | undefined}
1617
+ */
1618
+ clone_ship(fleet_key: FleetKey, ship_key: ShipKey): Ship | undefined;
1588
1619
  /**
1589
1620
  * @param {string} id
1590
1621
  * @returns {Ship | undefined}
1591
1622
  */
1592
1623
  get_ship_by_id(id: string): Ship | undefined;
1624
+ /**
1625
+ * @param {FleetKey} key
1626
+ * @returns {(string)[]}
1627
+ */
1628
+ ship_keys(key: FleetKey): string[];
1593
1629
  /**
1594
1630
  * @returns {Comp}
1595
1631
  */
1596
1632
  create_comp(): Comp;
1597
1633
  /**
1598
- * @param {string} key
1634
+ * @param {FleetKey} key
1599
1635
  * @returns {Comp}
1600
1636
  */
1601
- create_comp_by_key(key: string): Comp;
1637
+ create_comp_by_key(key: FleetKey): Comp;
1602
1638
  /**
1603
1639
  * @param {string} key
1604
1640
  * @returns {AirSquadron}
@@ -1642,9 +1678,25 @@ export class Org {
1642
1678
  * @returns {number}
1643
1679
  */
1644
1680
  high_altitude_interception_power(): number;
1681
+ /**
1682
+ * @param {string} id
1683
+ * @param {number} x
1684
+ * @param {number} y
1685
+ * @returns {MoveShipPayload | undefined}
1686
+ */
1687
+ create_move_ship_payload(
1688
+ id: string,
1689
+ x: number,
1690
+ y: number
1691
+ ): MoveShipPayload | undefined;
1692
+ /**
1693
+ * @param {FleetKey} key
1694
+ * @returns {FleetType | undefined}
1695
+ */
1696
+ get_fleet_type(key: FleetKey): FleetType | undefined;
1645
1697
  /**
1646
1698
  */
1647
- boss_sup?: string;
1699
+ readonly boss_sup: FleetKey | undefined;
1648
1700
  /**
1649
1701
  */
1650
1702
  readonly hash: bigint;
@@ -1659,10 +1711,10 @@ export class Org {
1659
1711
  readonly org_type: OrgType;
1660
1712
  /**
1661
1713
  */
1662
- route_sup?: string;
1714
+ readonly route_sup: FleetKey | undefined;
1663
1715
  /**
1664
1716
  */
1665
- sortie: string;
1717
+ readonly sortie: FleetKey;
1666
1718
  }
1667
1719
  /**
1668
1720
  */