afnm-types 0.6.52-v2 → 0.6.53

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 +1,2 @@
1
1
  export type GameScreen = 'location' | 'recipe' | 'mission' | 'craftingHall' | 'manual' | 'cultivation' | 'map' | 'healer' | 'market' | 'favour' | 'herbField' | 'mine' | 'recipeLibrary' | 'requestBoard' | 'compendium' | 'library' | 'altar' | 'research' | 'reforge' | 'pillarGrid' | 'fallenStar' | 'trainingGround' | 'tenThousandFlames' | 'lifeScreen' | 'soulShardDelve' | 'enchantmentShop' | 'challengeBoard';
2
+ export type ScreenType = GameScreen | 'newgame' | 'combat' | 'crafting' | 'dualCultivation' | 'event' | 'auction' | 'mysticalRegion' | 'tournament' | 'house' | 'guild' | 'stoneCutting' | 'fallenStar' | 'soulShardDelve';
@@ -326,7 +326,7 @@ async function main() {
326
326
  console.log(`Template-ready strings : ${templateStrings.length}`);
327
327
  // Generate hierarchical template
328
328
  console.log('\nGenerating translation template...');
329
- const template = (0, reporters_js_1.generateHierarchicalTemplate)(templateStrings);
329
+ const template = (0, reporters_js_1.generateHierarchicalTemplate)(templateStrings, undefined, undefined, false);
330
330
  const sortedTemplate = deepSortObject(template);
331
331
  const stringCount = countHierarchicalStrings(sortedTemplate);
332
332
  console.log(` ${stringCount} unique translatable entries found.`);
@@ -243,7 +243,7 @@ function findMinimalUniquePaths(paths) {
243
243
  * - If different texts have same simple field -> use minimal unique path prefix
244
244
  * - If text is unique for its simple field -> just use simple field
245
245
  */
246
- function generateHierarchicalTemplate(allStrings, techniqueTooltipsData, textsRequiringContext) {
246
+ function generateHierarchicalTemplate(allStrings, techniqueTooltipsData, textsRequiringContext, includeRootPatterns = true) {
247
247
  const template = {};
248
248
  const intermediate = new Map();
249
249
  // Helper to add entry to intermediate structure
@@ -637,37 +637,39 @@ function generateHierarchicalTemplate(allStrings, techniqueTooltipsData, textsRe
637
637
  }
638
638
  }
639
639
  }
640
- // Add hardcoded patterns to a special category
641
- if (!template['_patterns']) {
642
- template['_patterns'] = {};
643
- }
644
- if (!template['_patterns']['hardcoded']) {
645
- template['_patterns']['hardcoded'] = {};
646
- }
647
- // Add stack-related strings
648
- template['_patterns']['hardcoded']['[word] stack'] = '';
649
- template['_patterns']['hardcoded']['[word] stacks'] = '';
650
- // Add dynamic template patterns
651
- for (const tmpl of config_js_1.HARDCODED_TEMPLATE_PATTERNS) {
652
- template['_patterns']['hardcoded'][`[template] ${tmpl}`] = '';
653
- }
654
- // Add condition words
655
- if (!template['_patterns']['conditions']) {
656
- template['_patterns']['conditions'] = {};
657
- }
658
- for (const word of config_js_1.CONDITION_WORDS) {
659
- template['_patterns']['conditions'][`[word] ${word}`] = '';
660
- }
661
- // Add condition template strings from describeTechniqueCondition.ts and describeCraftingTechniqueCondition.ts
662
- for (const tmpl of config_js_1.CONDITION_TEMPLATES) {
663
- template['_patterns']['conditions'][`[condition] ${tmpl}`] = '';
664
- }
665
- // Add requirement strings
666
- if (!template['_patterns']['requirements']) {
667
- template['_patterns']['requirements'] = {};
668
- }
669
- for (const reqStr of config_js_1.REQUIREMENT_STRINGS) {
670
- template['_patterns']['requirements'][`[requirement] ${reqStr}`] = '';
640
+ // Add hardcoded patterns to a special category (only when extracting for the game, not for mods)
641
+ if (includeRootPatterns) {
642
+ if (!template['_patterns']) {
643
+ template['_patterns'] = {};
644
+ }
645
+ if (!template['_patterns']['hardcoded']) {
646
+ template['_patterns']['hardcoded'] = {};
647
+ }
648
+ // Add stack-related strings
649
+ template['_patterns']['hardcoded']['[word] stack'] = '';
650
+ template['_patterns']['hardcoded']['[word] stacks'] = '';
651
+ // Add dynamic template patterns
652
+ for (const tmpl of config_js_1.HARDCODED_TEMPLATE_PATTERNS) {
653
+ template['_patterns']['hardcoded'][`[template] ${tmpl}`] = '';
654
+ }
655
+ // Add condition words
656
+ if (!template['_patterns']['conditions']) {
657
+ template['_patterns']['conditions'] = {};
658
+ }
659
+ for (const word of config_js_1.CONDITION_WORDS) {
660
+ template['_patterns']['conditions'][`[word] ${word}`] = '';
661
+ }
662
+ // Add condition template strings from describeTechniqueCondition.ts and describeCraftingTechniqueCondition.ts
663
+ for (const tmpl of config_js_1.CONDITION_TEMPLATES) {
664
+ template['_patterns']['conditions'][`[condition] ${tmpl}`] = '';
665
+ }
666
+ // Add requirement strings
667
+ if (!template['_patterns']['requirements']) {
668
+ template['_patterns']['requirements'] = {};
669
+ }
670
+ for (const reqStr of config_js_1.REQUIREMENT_STRINGS) {
671
+ template['_patterns']['requirements'][`[requirement] ${reqStr}`] = '';
672
+ }
671
673
  }
672
674
  return template;
673
675
  }
@@ -1,5 +1,5 @@
1
1
  import type { Breakpoint, ButtonProps, IconButtonProps } from '@mui/material';
2
- import type { ReactNode, PropsWithChildren } from 'react';
2
+ import type { ReactNode, PropsWithChildren, ReactElement } from 'react';
3
3
  import type { SoundEffectName } from './audio';
4
4
  import type { ScreenEffectType } from './ScreenEffectType';
5
5
  import type React from 'react';
@@ -55,4 +55,22 @@ export interface BackgroundImageProps {
55
55
  }
56
56
  export type BackgroundImageFC = React.FC<BackgroundImageProps>;
57
57
  export type MemoBackgroundImageFC = React.NamedExoticComponent<BackgroundImageProps>;
58
+ export interface GameTooltipProps {
59
+ provider: () => ReactNode;
60
+ children: ReactElement;
61
+ flipped?: boolean;
62
+ disabled?: boolean;
63
+ minimal?: boolean;
64
+ }
65
+ export interface GameTooltipBoxProps {
66
+ isSecondary?: boolean;
67
+ isAux?: boolean;
68
+ removeWidthLimit?: boolean;
69
+ }
70
+ export interface TooltipLineProps {
71
+ children?: React.ReactNode;
72
+ }
73
+ export type GameTooltipFC = React.FC<GameTooltipProps>;
74
+ export type GameTooltipBoxFC = React.FC<PropsWithChildren<GameTooltipBoxProps>>;
75
+ export type TooltipLineFC = React.ComponentType<TooltipLineProps>;
58
76
  export {};
@@ -27,7 +27,7 @@ export interface HarmonyData {
27
27
  inscribedPatterns?: InscribedPatternsData;
28
28
  resonance?: ResonanceData;
29
29
  recommendedTechniqueTypes: CraftingTechniqueType[];
30
- additionalData?: any;
30
+ additionalData?: unknown;
31
31
  }
32
32
  export interface CraftingEffectTracking {
33
33
  icon: string;
@@ -1,10 +1,10 @@
1
1
  import type { Translatable } from './translatable';
2
- declare const intimateStats: readonly ["satisfaction", "energy", "painThreshold"];
3
- export type IntimateStat = (typeof intimateStats)[number];
4
- declare const intimateResources: readonly ["pain", "harmony", "excitement", "rhythm"];
5
- export type IntimateResource = (typeof intimateResources)[number];
6
- declare const intimateTechniqueTypes: readonly ["rough", "tender", "passionate"];
7
- export type IntimateTechniqueType = (typeof intimateTechniqueTypes)[number];
2
+ declare const _intimateStats: readonly ["satisfaction", "energy", "painThreshold"];
3
+ export type IntimateStat = (typeof _intimateStats)[number];
4
+ declare const _intimateResources: readonly ["pain", "harmony", "excitement", "rhythm"];
5
+ export type IntimateResource = (typeof _intimateResources)[number];
6
+ declare const _intimateTechniqueTypes: readonly ["rough", "tender", "passionate"];
7
+ export type IntimateTechniqueType = (typeof _intimateTechniqueTypes)[number];
8
8
  export declare const intimateTechniqueTypeToName: Record<IntimateTechniqueType, string>;
9
9
  export declare const intimateResourceToName: Record<IntimateResource, string>;
10
10
  export declare const dualCultivationCompletionStateToName: Record<string, string>;
@@ -1,6 +1,6 @@
1
- const intimateStats = ['satisfaction', 'energy', 'painThreshold'];
2
- const intimateResources = ['pain', 'harmony', 'excitement', 'rhythm'];
3
- const intimateTechniqueTypes = ['rough', 'tender', 'passionate'];
1
+ const _intimateStats = ['satisfaction', 'energy', 'painThreshold'];
2
+ const _intimateResources = ['pain', 'harmony', 'excitement', 'rhythm'];
3
+ const _intimateTechniqueTypes = ['rough', 'tender', 'passionate'];
4
4
  export const intimateTechniqueTypeToName = {
5
5
  rough: 'Rough',
6
6
  tender: 'Tender',
package/dist/entity.js CHANGED
@@ -1,4 +1,11 @@
1
- export const entityTypes = ['Player', 'Lifeform', 'Enemy', 'PlayerParty', 'EnemyParty', 'System'];
1
+ export const entityTypes = [
2
+ 'Player',
3
+ 'Lifeform',
4
+ 'Enemy',
5
+ 'PlayerParty',
6
+ 'EnemyParty',
7
+ 'System',
8
+ ];
2
9
  export const sexes = ['male', 'female'];
3
10
  export const sexToName = {
4
11
  male: 'Male',
@@ -15,4 +15,4 @@
15
15
  * };
16
16
  * }
17
17
  */
18
- export declare const GAME_VERSION = "0.6.52";
18
+ export declare const GAME_VERSION = "0.6.53";
@@ -15,4 +15,4 @@
15
15
  * };
16
16
  * }
17
17
  */
18
- export const GAME_VERSION = "0.6.52";
18
+ export const GAME_VERSION = "0.6.53";
package/dist/mod.d.ts CHANGED
@@ -6,6 +6,8 @@ import type { AuctionItemDef, AuctionItem } from './auction';
6
6
  import type { Background } from './background';
7
7
  import type { Breakthrough } from './breakthrough';
8
8
  import type { Buff } from './buff';
9
+ import type { BreakthroughState } from './breakthrough';
10
+ import type { CharactersState } from './reduxState';
9
11
  import type { CalendarEvent } from './calendar';
10
12
  import type { Character } from './character';
11
13
  import type { CraftingTechnique, CraftingRecipeStats } from './craftingTechnique';
@@ -35,7 +37,7 @@ import type { ItemKind } from './item';
35
37
  import type { SoundEffectName } from './audio';
36
38
  import type { ScreenEffectType } from './ScreenEffectType';
37
39
  import type { RootState } from './reduxState';
38
- import type { GameDialogFC, GameButtonExoticFC, GameIconButtonExoticFC, MemoBackgroundImageFC } from './components';
40
+ import type { GameDialogFC, GameButtonExoticFC, GameIconButtonExoticFC, MemoBackgroundImageFC, GameTooltipFC, GameTooltipBoxFC, TooltipLineFC } from './components';
39
41
  import type { PuppetType } from './trainingGround';
40
42
  import type { TechniqueElement } from './element';
41
43
  import type { AlternativeStart } from './alternativeStart';
@@ -43,8 +45,10 @@ import type { Tutorial } from './tutorial';
43
45
  import type { Sex } from './entity';
44
46
  import type { DamageType } from './DamageType';
45
47
  import { AvatarEffectShader } from './avatarEffects';
46
- import type { Translatable, TranslatableString } from '../types/translatable';
48
+ import type { Translatable, TranslatableString } from './translatable';
47
49
  import type { SaveFileInfo } from './electron';
50
+ import type { KeybindingDefinition } from './keybindings';
51
+ import { ScreenType } from './GameScreen';
48
52
  /**
49
53
  * Sprite images for a custom player character.
50
54
  * All images should be strings (either mod:// URLs for mod assets, or data: URLs).
@@ -163,7 +167,7 @@ export interface ModReduxAPI {
163
167
  * @example
164
168
  * setModData('myMod', 'customNPC_affinity', { npcId: 'elder_li', value: 75 });
165
169
  */
166
- setModData: (modName: string, key: string, data: any) => void;
170
+ setModData: (modName: string, key: string, data: unknown) => void;
167
171
  /**
168
172
  * Move player to a different location on the world map.
169
173
  * @param location - Location key from the locations data
@@ -310,6 +314,14 @@ export interface ModReduxAPI {
310
314
  GameIconButton: GameIconButtonExoticFC;
311
315
  BackgroundImage: MemoBackgroundImageFC;
312
316
  PlayerComponent: React.FC;
317
+ GameTooltip: GameTooltipFC;
318
+ GameTooltipBox: GameTooltipBoxFC;
319
+ TooltipLine: TooltipLineFC;
320
+ };
321
+ utils: {
322
+ parseTooltipLine: (tooltip: string) => React.ReactNode;
323
+ expandTooltipTemplate: (template: string, templateValues: Map<string, string>, addPeriod?: boolean) => string;
324
+ expandTooltipTags: (template: string) => string;
313
325
  };
314
326
  }
315
327
  export type ModScreenFC = React.FC<{
@@ -1033,6 +1045,22 @@ export interface ModAPI {
1033
1045
  * const highScore = flags['myMod_highScore'] ?? 0;
1034
1046
  */
1035
1047
  getGlobalFlags: () => Record<string, number>;
1048
+ /**
1049
+ * Register a custom keybinding for your mod.
1050
+ * Once registered, the keybinding is permanent for the session (mods cannot be unloaded without restarting the game).
1051
+ * Users can rebind registered keybindings in the game settings Controls tab.
1052
+ * @param definition - The keybinding definition including action name, category, display name, and default key
1053
+ * @example
1054
+ * registerKeybinding({
1055
+ * action: 'myMod.specialAction',
1056
+ * category: 'general',
1057
+ * displayName: 'Special Action',
1058
+ * description: 'Performs a special action',
1059
+ * defaultKey: 'F',
1060
+ * allowRebind: true,
1061
+ * });
1062
+ */
1063
+ registerKeybinding: (definition: KeybindingDefinition) => void;
1036
1064
  };
1037
1065
  utils: {
1038
1066
  /**
@@ -1941,8 +1969,74 @@ export interface ModAPI {
1941
1969
  * @returns Array of backup file metadata
1942
1970
  */
1943
1971
  listSaves: () => Promise<SaveFileInfo[]>;
1972
+ /**
1973
+ * Display a toast notification on the screen.
1974
+ * @param message - The text message or ReactNode to display
1975
+ * @param timeout - Optional timeout in milliseconds (default 3000ms)
1976
+ * @param style - Optional toast style: 'info' (default), 'success', 'warning', 'error'
1977
+ * @param customStyle - Optional custom styling { bg?, border?, color? }
1978
+ * @example
1979
+ * showToast('Item added to inventory');
1980
+ * showToast('Quest completed!', 5000);
1981
+ * showToast('Warning message', 3000, 'warning');
1982
+ * showToast('Error!', 5000, 'error');
1983
+ * showToast(<div><button>Click me</button></div>, 5000, 'info', { bg: '#ff0000', color: '#ffffff' });
1984
+ */
1985
+ showToast: (message: React.ReactNode, timeout?: number, style?: 'info' | 'success' | 'warning' | 'error', customStyle?: {
1986
+ bg?: string;
1987
+ border?: string;
1988
+ color?: string;
1989
+ }) => void;
1990
+ /**
1991
+ * Determine the current screen/game state from the Redux root state.
1992
+ * @param rootState - The Redux root state
1993
+ * @returns The current screen type identifier
1994
+ * @example
1995
+ * const screen = determineCurrentScreen(store.getState());
1996
+ */
1997
+ determineCurrentScreen: (rootState: RootState) => ScreenType;
1944
1998
  };
1945
1999
  hooks: {
2000
+ /**
2001
+ * Hook into player combat entity creation to modify stats.
2002
+ * @param interceptor - Function to modify combat entity
2003
+ * @example
2004
+ * onCreatePlayerCombatEntity((player, combatEntity, breakthrough, flags) => {
2005
+ * if (flags.enhanced_powers) {
2006
+ * combatEntity.stats.power *= 1.2;
2007
+ * }
2008
+ * return combatEntity;
2009
+ * });
2010
+ */
2011
+ onCreatePlayerCombatEntity: (interceptor: (player: PlayerEntity, combatEntity: CombatEntity, breakthrough: BreakthroughState, gameFlags: Record<string, number>) => CombatEntity) => void;
2012
+ /**
2013
+ * Hook into player crafting entity creation to modify stats.
2014
+ * @param interceptor - Function to modify crafting entity
2015
+ * @example
2016
+ * onCreatePlayerCraftingEntity((player, craftingEntity, breakthrough, characters, flags) => {
2017
+ * if (flags.master_craftsman) {
2018
+ * craftingEntity.stats.control *= 1.2;
2019
+ * }
2020
+ * return craftingEntity;
2021
+ * });
2022
+ */
2023
+ onCreatePlayerCraftingEntity: (interceptor: (player: PlayerEntity, craftingEntity: CraftingEntity, breakthrough: BreakthroughState, characters: CharactersState | undefined, gameFlags: Record<string, number>) => CraftingEntity) => void;
2024
+ /**
2025
+ * Hook called before crafting begins to modify recipe, recipe stats, or player.
2026
+ * @param interceptor - Function returning modified recipe/stats/player or undefined
2027
+ * @example
2028
+ * onBeforeCraft((player, recipe, recipeStats, flags) => {
2029
+ * if (flags.sharp_tools && recipeStats.difficulty > 100) {
2030
+ * return { recipeStats: { ...recipeStats, difficulty: recipeStats.difficulty * 0.9 } };
2031
+ * }
2032
+ * return undefined;
2033
+ * });
2034
+ */
2035
+ onBeforeCraft: (interceptor: (player: CraftingEntity, recipe: RecipeItem, recipeStats: CraftingRecipeStats, gameFlags: Record<string, number>) => {
2036
+ recipe?: RecipeItem;
2037
+ recipeStats?: CraftingRecipeStats;
2038
+ player?: CraftingEntity;
2039
+ } | undefined) => void;
1946
2040
  /**
1947
2041
  * Hook into enemy combat entity creation to modify stats.
1948
2042
  * @param interceptor - Function to modify combat entity
@@ -62,6 +62,7 @@ export interface InventoryState {
62
62
  recipes: RecipeState[];
63
63
  money: number;
64
64
  favour: number;
65
+ favoritedItems?: string[];
65
66
  }
66
67
  export interface StanceTracking {
67
68
  techniques: string[];
@@ -275,7 +276,7 @@ export interface HouseState {
275
276
  }
276
277
  export interface ModSliceProps {
277
278
  activeMods: string[];
278
- data: Record<string, Record<string, any>>;
279
+ data: Record<string, Record<string, unknown>>;
279
280
  }
280
281
  export interface DualCultivationState {
281
282
  partner?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afnm-types",
3
- "version": "0.6.52-v2",
3
+ "version": "0.6.53",
4
4
  "description": "Type definitions for Ascend From Nine Mountains",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",