afnm-types 0.6.51 → 0.6.52

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/buff.d.ts CHANGED
@@ -9,7 +9,7 @@ interface BaseTechniqueCondition {
9
9
  /**
10
10
  * When true, triggered effects (triggeredBuffEffects) on this buff will still
11
11
  * run even when this condition fails. The condition still blocks normal
12
- * onTechniqueEffects and onRoundEffects.
12
+ * beforeTechniqueEffects, afterTechniqueEffects, and onRoundEffects.
13
13
  */
14
14
  allowTriggers?: boolean;
15
15
  }
@@ -84,8 +84,10 @@ export interface Buff {
84
84
  noneType?: string;
85
85
  secondaryType?: TechniqueElement | 'origin';
86
86
  enhancement?: number;
87
- onTechniqueEffects: BuffEffect[];
88
- onRoundEffects: BuffEffect[];
87
+ beforeTechniqueEffects?: BuffEffect[];
88
+ afterTechniqueEffects?: BuffEffect[];
89
+ onStackGainEffects?: BuffEffect[];
90
+ onRoundEffects?: BuffEffect[];
89
91
  onRoundStartEffects?: BuffEffect[];
90
92
  onCombatStartEffects?: BuffEffect[];
91
93
  interceptBuffEffects?: {
@@ -131,7 +133,6 @@ export interface Buff {
131
133
  effects?: BuffEffect[];
132
134
  }[];
133
135
  priority?: number;
134
- afterTechnique?: boolean;
135
136
  combatImage?: BuffCombatImage;
136
137
  maxStacks?: number;
137
138
  upgradeKey?: string;
@@ -1,7 +1,7 @@
1
1
  import { BreakthroughState } from './breakthrough';
2
2
  import { PhysicalStatistic } from './stat';
3
3
  import { KnownTechnique } from './technique';
4
- import { StoredStance, StoredStyle } from './entity';
4
+ import { StoredStance, StoredStyle, AutoUseLoadout } from './entity';
5
5
  import { TechniqueElement } from './element';
6
6
  import { ItemDesc } from './item';
7
7
  /**
@@ -97,9 +97,11 @@ export interface NormalizedBuildSubmission {
97
97
  offensive?: string;
98
98
  aggressive?: string;
99
99
  };
100
- /** Optional combat modifiers chosen by the submitter applied symmetrically to both sides. */
100
+ /** Optional combat modifiers chosen by the submitter, applied symmetrically to both sides. */
101
101
  combatModifiers?: ChallengeModifiers;
102
- /** Manifested figment (lifeform companion) at time of submission added as a party member during challenge fights. */
102
+ /** Active auto-use item loadout at time of submission, applied as conditional pills during challenge fights. */
103
+ currentAutoUseLoadout?: AutoUseLoadout;
104
+ /** Manifested figment (lifeform companion) at time of submission, added as a party member during challenge fights. */
103
105
  lifeform?: {
104
106
  primarySpecies: string;
105
107
  secondarySpecies: string;
@@ -882,6 +882,28 @@ function extractFromFile(filePath) {
882
882
  }
883
883
  }
884
884
  }
885
+ // Find shorthand property assignments where the variable name IS the property name
886
+ // e.g., `const description = 'text'; const item = { description }` (shorthand for description: description)
887
+ if (typescript_1.default.isShorthandPropertyAssignment(node)) {
888
+ const propName = node.name.text;
889
+ if ((0, config_js_1.isTranslatableProperty)(propName)) {
890
+ // Resolve the variable name to its string value
891
+ const resolved = (0, resolvers_js_1.resolveImportedString)(filePath, propName) || (0, resolvers_js_1.tryResolveExpression)(filePath, propName);
892
+ if (resolved && resolved.trim().length > 0 && !(0, config_js_1.isCamelCase)(resolved)) {
893
+ const { parentName, objectType, nestedPath } = getParentObjectInfo(node, filePath);
894
+ const contextField = nestedPath ? `${nestedPath}/${propName}` : propName;
895
+ results.push({
896
+ text: resolved,
897
+ file: filePath,
898
+ line: (0, template_processor_js_1.getLineNumber)(sourceFile, node.getStart()),
899
+ context: `data-${contextField}-resolved`,
900
+ original: propName,
901
+ parentId: parentName,
902
+ objectType,
903
+ });
904
+ }
905
+ }
906
+ }
885
907
  // Find array literals
886
908
  // Skip DIRECT exported arrays - they're handled by extractFromToNameMaps with proper context
887
909
  // e.g., export const combatSpeeds = ["Manual", ...] - skip
@@ -32,6 +32,7 @@ export type GameButtonFC = React.ForwardRefRenderFunction<HTMLButtonElement, But
32
32
  export type GameIconButtonFC = React.ForwardRefRenderFunction<HTMLButtonElement, IconButtonProps & {
33
33
  hoverSfx?: SoundEffectName;
34
34
  clickSfx?: SoundEffectName;
35
+ tooltip?: ReactNode;
35
36
  }>;
36
37
  export type GameCloseButtonFC = React.ForwardRefRenderFunction<HTMLButtonElement, Omit<IconButtonProps & {
37
38
  hoverSfx?: SoundEffectName;
package/dist/element.js CHANGED
@@ -32,7 +32,7 @@ export const elementToColour = {
32
32
  celestial: 'radial-gradient(white 30%, black)',
33
33
  cloud: 'radial-gradient(teal 50%, black)',
34
34
  blossom: 'radial-gradient(#d654b9 50%, black)',
35
- none: 'radial-gradient(rgb(14, 14, 14) 50%, black)',
35
+ none: 'radial-gradient(rgb(53, 53, 53) 50%, black 85%)',
36
36
  };
37
37
  export const elementToColourRaw = {
38
38
  weapon: 'steelblue',
package/dist/entity.d.ts CHANGED
@@ -62,7 +62,10 @@ export interface PlayerEntity {
62
62
  clothing: ItemDesc | undefined;
63
63
  talismans: (ItemDesc | undefined)[];
64
64
  artefacts: (ItemDesc | undefined)[];
65
- autoUseItems?: (string | undefined)[];
65
+ /** @deprecated legacy only, do not use in new code */
66
+ autoUseItems?: (AutoUseItem | string | undefined)[];
67
+ currentAutoUseLoadout?: AutoUseLoadout;
68
+ storedAutoUseLoadouts?: AutoUseLoadout[];
66
69
  quickAccess?: (string | undefined)[];
67
70
  cauldron: ItemDesc | undefined;
68
71
  flame: ItemDesc | undefined;
@@ -329,7 +332,7 @@ export interface CombatEntity {
329
332
  partyId?: string;
330
333
  /** When true, critchance is forced to 0 for this entity (used in training ground) */
331
334
  noCrit?: boolean;
332
- /** Cached hash for getVariablesFromEntity cleared whenever stats or buffs mutate */
335
+ /** Cached hash for getVariablesFromEntity. Cleared whenever stats or buffs mutate. */
333
336
  _cachedHash?: string;
334
337
  }
335
338
  export type StanceRule = SingleStance | RandomStance;
@@ -358,13 +361,31 @@ export interface ConditionalCycle {
358
361
  }>;
359
362
  operator: 'AND' | 'OR';
360
363
  }
364
+ export interface AutoUseCondition {
365
+ condition: string;
366
+ check: '<' | '==' | '>' | '!=';
367
+ value: number;
368
+ }
369
+ export interface AutoUseItem {
370
+ item?: string;
371
+ conditions?: AutoUseCondition[];
372
+ maxCount?: number;
373
+ }
374
+ export interface AutoUseLoadout {
375
+ id: string;
376
+ name: string;
377
+ autoName?: boolean;
378
+ slots: AutoUseItem[];
379
+ }
361
380
  export interface StoredStyle {
362
381
  name: string;
363
382
  id: string;
364
383
  autoName?: boolean;
365
384
  stances: StoredStance[];
366
385
  conditionalCycles?: ConditionalCycle[];
367
- autoUseItems?: (string | undefined)[];
386
+ /** @deprecated legacy only, do not use in new code */
387
+ autoUseItems?: (AutoUseItem | string | undefined)[];
388
+ autoUseLoadoutId?: string;
368
389
  }
369
390
  export type StoredRule = OpenerStoredRule | RotationStoredRule | ConditionalStoredRule | ConditionalRotationStoredRule;
370
391
  export interface OpenerStoredRule {
@@ -15,4 +15,4 @@
15
15
  * };
16
16
  * }
17
17
  */
18
- export declare const GAME_VERSION = "0.6.51";
18
+ export declare const GAME_VERSION = "0.6.52";
@@ -15,4 +15,4 @@
15
15
  * };
16
16
  * }
17
17
  */
18
- export const GAME_VERSION = "0.6.51";
18
+ export const GAME_VERSION = "0.6.52";
package/dist/mod.d.ts CHANGED
@@ -44,6 +44,7 @@ import type { Sex } from './entity';
44
44
  import type { DamageType } from './DamageType';
45
45
  import { AvatarEffectShader } from './avatarEffects';
46
46
  import type { Translatable, TranslatableString } from '../types/translatable';
47
+ import type { SaveFileInfo } from './electron';
47
48
  /**
48
49
  * Sprite images for a custom player character.
49
50
  * All images should be strings (either mod:// URLs for mod assets, or data: URLs).
@@ -302,6 +303,35 @@ export interface ModReduxAPI {
302
303
  * console.log('Completion after:', preview.progressState?.completion);
303
304
  */
304
305
  previewCraftingTechnique: (technique: CraftingTechnique, state: CraftingState) => CraftingState;
306
+ /**
307
+ * Save the current game state to a character-scoped backup file. The save is
308
+ * written to the character's backup folder with the given filename. Throws an
309
+ * error if no save is currently loaded or if the save operation fails.
310
+ * @param filename - Name of the save file (e.g. 'quicksave-001.json')
311
+ * @example
312
+ * makeSave('quicksave-001.json'); // Save to character-backup/quicksave-001.json
313
+ * makeSave('backup-myprogress.json');
314
+ */
315
+ makeSave: (filename: string) => Promise<void>;
316
+ /**
317
+ * Load game state from a character-scoped backup file. The current game state
318
+ * will be replaced by the loaded save. Throws an error if the file cannot be
319
+ * read or parsed.
320
+ * @param filename - Name of the save file to load (must exist in character backup folder)
321
+ * @example
322
+ * loadSave('quicksave-001.json'); // Load from character-backup/quicksave-001.json
323
+ * loadSave('backup-myprogress.json');
324
+ */
325
+ loadSave: (filename: string) => Promise<void>;
326
+ /**
327
+ * List all backup save files available for the current character. Throws if
328
+ * no save is currently loaded or if the operation fails.
329
+ * @returns Array of save file metadata
330
+ * @example
331
+ * const saves = listSaves();
332
+ * saves.forEach(s => console.log(s.name, new Date(s.lastModified)));
333
+ */
334
+ listSaves: () => Promise<SaveFileInfo[]>;
305
335
  };
306
336
  components: {
307
337
  GameDialog: GameDialogFC;
@@ -480,6 +510,17 @@ export interface ModAPI {
480
510
  * @param reputation - (Optional) Required reputation tier
481
511
  */
482
512
  addItemToGuild: (item: Item, stacks: number, guild: string, rank: number, valueModifier?: number, reputation?: ReputationTier) => void;
513
+ /**
514
+ * Add an item to the sect favour exchange shop.
515
+ * @param item - Item to add
516
+ * @param stacks - Number of stacks available
517
+ * @param realm - Required realm tier to purchase
518
+ * @param valueModifier - (Optional) Price multiplier (default 1.0)
519
+ * @param reputation - (Optional) Required reputation tier
520
+ * @example
521
+ * addToSectShop(myItem, 3, 'qiCondensation');
522
+ */
523
+ addToSectShop: (item: Item, stacks: number, realm: Realm, valueModifier?: number, reputation?: ReputationTier) => void;
483
524
  /**
484
525
  * Add a crafting recipe to the sect recipe library.
485
526
  * @param item - Recipe item configuration
@@ -1638,7 +1679,7 @@ export interface ModAPI {
1638
1679
  * @param defenderProtection - Defender's protection stat
1639
1680
  * @returns Final damage value
1640
1681
  */
1641
- calculateDamage: (attackPower: number, defenderDefense: number, defenderDr: number, defenderDefenseFactor: number, maxReduction: number, defenderVulnerability: number, realm: Realm, realmProgress: RealmProgress, defenderProtection: number) => number;
1682
+ calculateDamage: (attackPower: number, defenderDefense: number, defenderDr: number, defenderDefenseFactor: number, maxReduction: number, defenderVulnerability: number, realm: Realm, realmProgress: RealmProgress, defenderProtection: number, cultivatorResistance: number) => number;
1642
1683
  /**
1643
1684
  * Format a number for display (e.g. 1000 -> "1,000").
1644
1685
  * @param number - Number to format
@@ -2098,15 +2139,15 @@ export interface ModAPI {
2098
2139
  }) => void;
2099
2140
  /**
2100
2141
  * Hook fired after every Redux state update. Receives the action type, the
2101
- * state before the action was applied, and the state after. Return a modified
2102
- * copy of `stateAfter` to override what is stored, or return `stateAfter`
2103
- * unchanged to leave the update as-is.
2142
+ * state before the action was applied, the state after, and a readonly copy of
2143
+ * the action payload. Return a modified copy of `stateAfter` to override what
2144
+ * is stored, or return `stateAfter` unchanged to leave the update as-is.
2104
2145
  *
2105
2146
  * This is called inside the reducer — keep the implementation fast and avoid
2106
2147
  * side-effects. Thrown exceptions are caught and logged.
2107
2148
  *
2108
2149
  * @example
2109
- * modAPI.hooks.onReduxAction((actionType, before, after) => {
2150
+ * modAPI.hooks.onReduxAction((actionType, before, after, payload) => {
2110
2151
  * if (actionType === 'inventory/addItem') {
2111
2152
  * // double every item added in hard mode
2112
2153
  * if (after.gameData.flags?.hard_mode) {
@@ -2116,7 +2157,34 @@ export interface ModAPI {
2116
2157
  * return after;
2117
2158
  * });
2118
2159
  */
2119
- onReduxAction: (interceptor: (actionType: string, stateBefore: RootState, stateAfter: RootState) => RootState) => void;
2160
+ onReduxAction: (interceptor: (actionType: string, stateBefore: RootState, stateAfter: RootState, payload: Readonly<unknown>) => RootState) => void;
2161
+ /**
2162
+ * Hook fired before a Redux action is passed to the reducer. Allows
2163
+ * intercepting and modifying the action payload, or dropping the action
2164
+ * entirely.
2165
+ *
2166
+ * Return a modified payload to replace the original (any non-null value,
2167
+ * including `undefined`, replaces the current payload), or return `null` to
2168
+ * drop the action (the reducer will not be called and the state will remain
2169
+ * unchanged). When multiple interceptors are chained, each one receives the
2170
+ * payload returned by the previous one.
2171
+ *
2172
+ * This is called before the reducer — keep the implementation fast and avoid
2173
+ * side-effects. Thrown exceptions are caught and logged.
2174
+ *
2175
+ * @example
2176
+ * modAPI.hooks.onReduxActionPayload((actionType, payload) => {
2177
+ * if (actionType === 'inventory/removeItem') {
2178
+ * const p = payload as { name: string; stacks: number };
2179
+ * // prevent blueprint removal by zeroing the stack count
2180
+ * if (modAPI.gameData.items[p.name]?.kind === 'blueprint') {
2181
+ * return { ...p, stacks: 0 };
2182
+ * }
2183
+ * }
2184
+ * return payload;
2185
+ * });
2186
+ */
2187
+ onReduxActionPayload: (interceptor: (actionType: string, payload: unknown) => unknown | null) => void;
2120
2188
  };
2121
2189
  /**
2122
2190
  * Inject UI into a named slot (dialog title or screen name).
package/dist/stat.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { TechniqueElement } from './element';
3
3
  export declare const physicalStatistics: readonly ["eyes", "meridians", "dantian", "muscles", "digestion", "flesh"];
4
4
  export declare const socialStatistics: readonly ["age", "lifespan", "charisma", "battlesense", "craftskill", "artefactslots", "talismanslots", "condenseEfficiency", "pillsPerRound"];
5
5
  export declare const craftingStatistics: readonly ["maxpool", "pool", "maxtoxicity", "toxicity", "resistance", "itemEffectiveness", "control", "intensity", "critchance", "critmultiplier", "pillsPerRound", "poolCostPercentage", "stabilityCostPercentage", "successChanceBonus", "poolCostFlat"];
6
- export declare const combatStatistics: readonly ["maxhp", "hp", "maxbarrier", "barrier", "maxtoxicity", "toxicity", "resistance", "pillsPerRound", "itemEffectiveness", "power", "artefactpower", "critchance", "defense", "protection", "dr", "barrierMitigation", "lifesteal", "critmultiplier", "vulnerability", "weakness", "fistBoost", "blossomBoost", "weaponBoost", "cloudBoost", "bloodBoost", "celestialBoost", "fistAffinity", "blossomAffinity", "weaponAffinity", "cloudAffinity", "bloodAffinity", "celestialAffinity", "noneAffinity", "qiDroplets", "fistDisabled", "bloodDisabled", "blossomDisabled", "cloudDisabled", "celestialDisabled", "weaponDisabled", "noneDisabled", "pillsDisabled", "dropletsDisabled", "fistResistance", "blossomResistance", "weaponResistance", "cloudResistance", "bloodResistance", "celestialResistance", "damageBoost", "healingBoost", "barrierBoost", "overheal", "barrierBleed", "formationPartRecovery", "overcrit"];
6
+ export declare const combatStatistics: readonly ["maxhp", "hp", "maxbarrier", "barrier", "maxtoxicity", "toxicity", "resistance", "pillsPerRound", "itemEffectiveness", "power", "artefactpower", "critchance", "defense", "protection", "dr", "barrierMitigation", "lifesteal", "critmultiplier", "vulnerability", "weakness", "fistBoost", "blossomBoost", "weaponBoost", "cloudBoost", "bloodBoost", "celestialBoost", "fistAffinity", "blossomAffinity", "weaponAffinity", "cloudAffinity", "bloodAffinity", "celestialAffinity", "noneAffinity", "qiDroplets", "fistDisabled", "bloodDisabled", "blossomDisabled", "cloudDisabled", "celestialDisabled", "weaponDisabled", "noneDisabled", "pillsDisabled", "dropletsDisabled", "fistResistance", "blossomResistance", "weaponResistance", "cloudResistance", "bloodResistance", "celestialResistance", "damageBoost", "healingBoost", "barrierBoost", "overheal", "barrierBleed", "formationPartRecovery", "overcrit", "cultivatorResistance"];
7
7
  export type PhysicalStatistic = (typeof physicalStatistics)[number];
8
8
  export type SocialStatistic = (typeof socialStatistics)[number];
9
9
  export type CraftingStatistic = (typeof craftingStatistics)[number];
package/dist/stat.js CHANGED
@@ -91,6 +91,7 @@ export const combatStatistics = [
91
91
  'barrierBleed',
92
92
  'formationPartRecovery',
93
93
  'overcrit',
94
+ 'cultivatorResistance',
94
95
  ];
95
96
  export const baseStatNumber = 10;
96
97
  export const expectedHpPerFlesh = 1000;
@@ -115,7 +116,7 @@ export const combatStatToName = {
115
116
  power: 'Power',
116
117
  artefactpower: 'Artefact Power',
117
118
  critchance: 'Crit Chance',
118
- defense: 'Defense',
119
+ defense: 'Armour',
119
120
  protection: 'Protection',
120
121
  dr: 'Damage Resistance',
121
122
  barrierMitigation: 'Barrier Effectiveness',
@@ -161,6 +162,7 @@ export const combatStatToName = {
161
162
  barrierBleed: 'Barrier Bleed',
162
163
  formationPartRecovery: 'Formation Part Recovery',
163
164
  overcrit: 'Overcrit',
165
+ cultivatorResistance: 'Cultivator Resistance',
164
166
  };
165
167
  export const combatStatToDescription = {
166
168
  maxhp: 'The amount of damage you can take before you are unable to continue.',
@@ -219,6 +221,7 @@ export const combatStatToDescription = {
219
221
  barrierBleed: '',
220
222
  formationPartRecovery: '',
221
223
  overcrit: '',
224
+ cultivatorResistance: '',
222
225
  };
223
226
  // Uncommon stats that need auxiliary tooltips when they appear on buffs
224
227
  // These descriptions only show as aux tooltips in buff tooltips, not in the stats dialog
@@ -69,6 +69,7 @@ interface BaseTechniqueEffect {
69
69
  condition?: TechniqueCondition;
70
70
  triggerKey?: string;
71
71
  isAdditionalTooltip?: boolean;
72
+ cantUpgrade?: boolean;
72
73
  }
73
74
  interface BuffSelfTechniqueEffect extends BaseTechniqueEffect {
74
75
  kind: 'buffSelf';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "afnm-types",
3
- "version": "0.6.51",
3
+ "version": "0.6.52",
4
4
  "description": "Type definitions for Ascend From Nine Mountains",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",