uesp-eso-build-wrapper 0.2.0 → 0.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.
Files changed (52) hide show
  1. package/README.md +77 -123
  2. package/README.pt-BR.md +122 -0
  3. package/dist/lib/eso-engine/calculator.d.ts +33 -22
  4. package/dist/lib/eso-engine/calculator.d.ts.map +1 -1
  5. package/dist/lib/eso-engine/calculator.js +283 -219
  6. package/dist/lib/eso-engine/calculator.js.map +1 -1
  7. package/dist/lib/eso-engine/debug.d.ts +63 -0
  8. package/dist/lib/eso-engine/debug.d.ts.map +1 -0
  9. package/dist/lib/eso-engine/debug.js +98 -0
  10. package/dist/lib/eso-engine/debug.js.map +1 -0
  11. package/dist/lib/eso-engine/engine-globals.d.ts +171 -0
  12. package/dist/lib/eso-engine/engine-globals.d.ts.map +1 -0
  13. package/dist/lib/eso-engine/engine-globals.js +24 -0
  14. package/dist/lib/eso-engine/engine-globals.js.map +1 -0
  15. package/dist/lib/eso-engine/env-setup.d.ts +15 -15
  16. package/dist/lib/eso-engine/env-setup.d.ts.map +1 -1
  17. package/dist/lib/eso-engine/env-setup.js +42 -58
  18. package/dist/lib/eso-engine/env-setup.js.map +1 -1
  19. package/dist/lib/eso-engine/index.d.ts +29 -23
  20. package/dist/lib/eso-engine/index.d.ts.map +1 -1
  21. package/dist/lib/eso-engine/index.js +33 -85
  22. package/dist/lib/eso-engine/index.js.map +1 -1
  23. package/dist/lib/eso-engine/input-stats.d.ts.map +1 -1
  24. package/dist/lib/eso-engine/input-stats.js +450 -129
  25. package/dist/lib/eso-engine/input-stats.js.map +1 -1
  26. package/dist/lib/eso-engine/loader.d.ts +15 -15
  27. package/dist/lib/eso-engine/loader.d.ts.map +1 -1
  28. package/dist/lib/eso-engine/loader.js +98 -130
  29. package/dist/lib/eso-engine/loader.js.map +1 -1
  30. package/dist/lib/eso-engine/types.d.ts +133 -90
  31. package/dist/lib/eso-engine/types.d.ts.map +1 -1
  32. package/dist/lib/eso-engine/types.js +2 -3
  33. package/dist/lib/eso-engine/types.js.map +1 -1
  34. package/dist/lib/uesp-data/extract.d.ts +29 -0
  35. package/dist/lib/uesp-data/extract.d.ts.map +1 -0
  36. package/dist/lib/uesp-data/extract.js +304 -0
  37. package/dist/lib/uesp-data/extract.js.map +1 -0
  38. package/dist/lib/uesp-data/index.d.ts +14 -0
  39. package/dist/lib/uesp-data/index.d.ts.map +1 -0
  40. package/dist/lib/uesp-data/index.js +11 -0
  41. package/dist/lib/uesp-data/index.js.map +1 -0
  42. package/dist/lib/uesp-data/mariadb-dump.d.ts +32 -0
  43. package/dist/lib/uesp-data/mariadb-dump.d.ts.map +1 -0
  44. package/dist/lib/uesp-data/mariadb-dump.js +222 -0
  45. package/dist/lib/uesp-data/mariadb-dump.js.map +1 -0
  46. package/dist/lib/uesp-data/seed.d.ts +43 -0
  47. package/dist/lib/uesp-data/seed.d.ts.map +1 -0
  48. package/dist/lib/uesp-data/seed.js +413 -0
  49. package/dist/lib/uesp-data/seed.js.map +1 -0
  50. package/package.json +29 -12
  51. package/vendor/uesp-esochardata/resources/esoEditBuild.js +3 -3
  52. package/dist/browser-stub.js +0 -1
package/README.md CHANGED
@@ -1,18 +1,53 @@
1
1
  # uesp-eso-build-wrapper
2
2
 
3
3
  [![CI](https://github.com/srtomy/uesp-eso-build-wrapper/actions/workflows/ci.yml/badge.svg)](https://github.com/srtomy/uesp-eso-build-wrapper/actions/workflows/ci.yml)
4
+ [![codecov](https://codecov.io/gh/srtomy/uesp-eso-build-wrapper/graph/badge.svg)](https://codecov.io/gh/srtomy/uesp-eso-build-wrapper)
5
+ [![npm](https://img.shields.io/npm/v/uesp-eso-build-wrapper.svg)](https://www.npmjs.com/package/uesp-eso-build-wrapper)
6
+ [![Docs](https://img.shields.io/badge/docs-online-2564eb)](https://srtomy.github.io/uesp-eso-build-wrapper/)
7
+ [![Bundlephobia](https://img.shields.io/bundlephobia/minzip/uesp-eso-build-wrapper)](https://bundlephobia.com/package/uesp-eso-build-wrapper)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
9
+ [![Node >=24](https://img.shields.io/badge/node-%3E%3D24-brightgreen)](https://nodejs.org/en/download/)
10
+
11
+ > **Leia em [Português (BR)](README.pt-BR.md).**
4
12
 
5
13
  A Node.js/TypeScript wrapper around the [UESP ESO Build Editor](https://github.com/uesp/uesp-esochardata) math engine.
6
14
 
7
- Calculate Elder Scrolls Online **Computed Character Statistics** — Health, Magicka, Stamina, mitigation, crit chance, regeneration, and 200+ more — using UESP's own formulas. No formula reimplementation. No database.
15
+ Calculate Elder Scrolls Online **Computed Character Statistics** — Health, Magicka, Stamina, mitigation, crit chance, regeneration, and 200+ more — using UESP's own formulas. No formula reimplementation.
16
+
17
+ ## What is this?
18
+
19
+ This is **not an HTTP client for UESP**. It runs the vendored UESP build calculation engine **locally, inside your Node.js process**, and exposes the results through a typed API:
20
+
21
+ ```text
22
+ Application
23
+
24
+ uesp-eso-build-wrapper (TypeScript API)
25
+
26
+ Node.js compatibility layer (browser-like globals + minimal DOM)
27
+
28
+ UESP esoEditBuild.js (executed in-process via vm.runInThisContext)
29
+
30
+ UESP calculation functions → ComputedStats
31
+ ```
32
+
33
+ You inject the inputs, UESP's own code computes every stat, you read back one typed object.
34
+
35
+ ## Why this library?
36
+
37
+ - **Reference accuracy** — same `esoEditBuild.js` engine that powers [esobuilds.uesp.net](https://esobuilds.uesp.net), kept up to date by UESP every patch.
38
+ - **No formula reimplementation** — the wrapper contains zero ESO math. When a stat looks wrong after a patch, the fix is always in the game *data* fed to the engine, never in wrapper code. That is what keeps it correct across patches.
39
+ - **Local and synchronous** — `calculateBuild()` performs no network requests. The engine runs in-process; game data and items are supplied by your application (file, database, generated data).
40
+ - **Accepts UESP item data directly** — gear in the [`exportJson.php?table=minedItem`](https://esolog.uesp.net) format plugs straight into `BuildInput.items`.
41
+ - **TypeScript-native** — typed inputs/outputs, TSDoc-documented [API Reference](https://srtomy.github.io/uesp-eso-build-wrapper/api/), plus runtime catalog functions (`listAvailableBuffs`, `listRacialPassives`, …) to discover valid names.
8
42
 
9
- ## Features
43
+ ## Key properties
10
44
 
11
- - **100% UESP formulas** — same engine powering [esobuilds.uesp.net](https://esobuilds.uesp.net)
12
- - **221 computed stats** — all `Computed Character Statistics` from the build editor
13
- - **Zero runtime dependencies** pure Node.js
14
- - **Full TypeScript types** typed inputs and outputs
15
- - **Singleton loader**loads the engine once per process, fast on subsequent calls
45
+ - Runs the vendored UESP calculation engine locally (`vendor/uesp-esochardata`)
46
+ - **No network required for build calculations** — see [Does it require an internet connection?](https://srtomy.github.io/uesp-eso-build-wrapper/architecture#does-it-require-an-internet-connection)
47
+ - Does not reimplement ESO stat formulas
48
+ - Synchronous API; engine initializes once per process (singleton, subsequent calls are no-ops)
49
+ - Zero runtime dependenciespure Node.js
50
+ - 221 computed stats per build
16
51
 
17
52
  ## Installation
18
53
 
@@ -22,11 +57,18 @@ npm install uesp-eso-build-wrapper
22
57
 
23
58
  ## Quick Start
24
59
 
60
+ Game data is not bundled in the npm package — you supply it via `initEsoEngineFromData` (see [Getting Started](https://srtomy.github.io/uesp-eso-build-wrapper/getting-started)).
61
+
25
62
  ```ts
26
- import { initEsoEngine, calculateBuild } from 'uesp-eso-build-wrapper';
63
+ import fs from 'fs';
64
+ import { initEsoEngineFromData, calculateBuild } from 'uesp-eso-build-wrapper';
65
+ import type { UespInitData } from 'uesp-eso-build-wrapper';
66
+
67
+ const initData = JSON.parse(
68
+ fs.readFileSync('uesp-game-data.json', 'utf-8'),
69
+ ) as UespInitData;
27
70
 
28
- // Initialize once resolves bundled vendor files automatically
29
- initEsoEngine();
71
+ initEsoEngineFromData({ initData }); // once per process
30
72
 
31
73
  const stats = calculateBuild({
32
74
  character: {
@@ -37,133 +79,45 @@ const stats = calculateBuild({
37
79
  },
38
80
  });
39
81
 
40
- console.log(stats.Health); // 16000
41
- console.log(stats.Magicka); // 19104
42
- console.log(stats.MagickaRegen); // 514
43
- console.log(stats.SpellDamage); // 1000
82
+ console.log(stats.Health); // 16000
83
+ console.log(stats.Magicka); // 19104
84
+ console.log(stats.SpellDamage); // 1000
44
85
  ```
45
86
 
46
- ## With Equipped Items
87
+ ## How it works
47
88
 
48
- Items are passed directly as returned by the [UESP public item API](https://esolog.uesp.net/exportJson.php?table=minedItem&id=70&level=50&quality=5).
49
-
50
- ```ts
51
- // 1. Fetch item data from UESP API
52
- const res = await fetch(
53
- 'https://esolog.uesp.net/exportJson.php?table=minedItem&id=70&level=50&quality=5',
54
- );
55
- const data = await res.json();
56
- const item = data.minedItem[0]; // pick the variant you want
57
-
58
- // 2. Pass it directly — no mapping needed
59
- const stats = calculateBuild({
60
- character: {
61
- race: 'Nord',
62
- class: 'Dragonknight',
63
- level: 50,
64
- attributes: { health: 64, magicka: 0, stamina: 0 },
65
- },
66
- items: {
67
- Chest: item,
68
- },
69
- });
70
-
71
- console.log(stats.Health); // includes item enchant + set bonus
72
- ```
89
+ 1. `initEsoEngineFromData({ initData })` prepares browser-like globals, seeds the engine with your game data, and executes the vendored UESP scripts via `vm.runInThisContext` — once per process.
90
+ 2. `calculateBuild(input)` writes your build into the engine state, runs the engine's own `UpdateEsoComputedStatsList_Real()`, and reads results from `g_EsoComputedStats` into a typed `ComputedStats` object.
73
91
 
74
- ## API
92
+ Details: [Architecture](https://srtomy.github.io/uesp-eso-build-wrapper/architecture) · [Getting Started](https://srtomy.github.io/uesp-eso-build-wrapper/getting-started) · [Reading the Output](https://srtomy.github.io/uesp-eso-build-wrapper/output).
75
93
 
76
- ### `initEsoEngine(resourcesPath?, initDataPath?)`
94
+ ## Documentation
77
95
 
78
- Initializes the UESP math engine. **Must be called once** before `calculateBuild()`.
96
+ Full documentation is available in **English** and **Português (BR)** at
97
+ [**srtomy.github.io/uesp-eso-build-wrapper**](https://srtomy.github.io/uesp-eso-build-wrapper/):
79
98
 
80
- Safe to call multiple times — only executes on the first call.
99
+ | Section | Description |
100
+ | --- | --- |
101
+ | [Introduction](https://srtomy.github.io/uesp-eso-build-wrapper/) | What it is, why it exists, key properties |
102
+ | [Architecture](https://srtomy.github.io/uesp-eso-build-wrapper/architecture) | Local engine, network policy, data flow |
103
+ | [Getting Started](https://srtomy.github.io/uesp-eso-build-wrapper/getting-started) | Install, game data, first calculation |
104
+ | [Guides](https://srtomy.github.io/uesp-eso-build-wrapper/guides/character) | Character, items, Champion Points, buffs, skills |
105
+ | [Reading the Output](https://srtomy.github.io/uesp-eso-build-wrapper/output) | All 221 computed stats, `debugBuild()` |
106
+ | [API Reference](https://srtomy.github.io/uesp-eso-build-wrapper/api/) | Generated from source TSDoc |
107
+ | [Troubleshooting](https://srtomy.github.io/uesp-eso-build-wrapper/troubleshooting) | Common integration issues (Next.js/serverless, wrong stats...) |
108
+ | [Contributing](https://srtomy.github.io/uesp-eso-build-wrapper/contributing) | Dev setup, tests, updating after an ESO patch |
81
109
 
82
- | Param | Type | Default | Description |
83
- | --------------- | -------- | -------------- | ------------------------------------------------ |
84
- | `resourcesPath` | `string` | bundled vendor | Path to `esoEditBuild.js` and `esobuilddata.js` |
85
- | `initDataPath` | `string` | bundled vendor | Path to `uesp-init-data.json` with game formulas |
110
+ ## Limitations
86
111
 
87
- ### `calculateBuild(input: BuildInput): ComputedStats`
88
-
89
- Runs the UESP engine and returns the computed stats.
90
-
91
- #### `BuildInput`
92
-
93
- ```ts
94
- interface BuildInput {
95
- character: {
96
- race: string; // "High Elf" | "Nord" | "Breton" | "Khajiit" | ...
97
- class: string; // "Sorcerer" | "Dragonknight" | "Nightblade" | ...
98
- level: number; // 1–50
99
- attributes: {
100
- health: number; // attribute points (max 64 total)
101
- magicka: number;
102
- stamina: number;
103
- };
104
- mundusStone?: string; // "The Thief" | "The Apprentice" | ...
105
- cyrodiil?: boolean; // Battle Spirit (PvP)
106
- vampireStage?: number; // 0–4
107
- werewolfStage?: number; // 0 or 1
108
- championPoints?: number; // 0–3600
109
- rulesVersion?: string; // "Live" (default) | "PTS"
110
- };
111
- items?: Partial<Record<EquipSlot, UespItemApiData>>;
112
- }
113
- ```
114
-
115
- #### `EquipSlot`
116
-
117
- ```
118
- Head | Shoulders | Chest | Hands | Legs | Waist | Feet |
119
- Neck | Ring1 | Ring2 |
120
- MainHand1 | OffHand1 | MainHand2 | OffHand2 |
121
- Poison1 | Poison2 | Food | Potion
122
- ```
123
-
124
- #### `ComputedStats`
125
-
126
- Key stats returned (see [`types.ts`](src/lib/eso-engine/types.ts) for full list):
127
-
128
- | Property | Description |
129
- | ------------------------------------------------------ | ----------------------------------------- |
130
- | `Health` / `Magicka` / `Stamina` | Maximum resource pools |
131
- | `HealthRegen` / `MagickaRegen` / `StaminaRegen` | Out-of-combat regeneration |
132
- | `WeaponDamage` / `SpellDamage` | Base damage |
133
- | `WeaponCrit` / `SpellCrit` | Critical chance |
134
- | `PhysicalResist` / `SpellResist` / `CritResist` | Resistances |
135
- | `PhysicalPenetration` / `SpellPenetration` | Armor penetration |
136
- | `DefensePhysicalMitigation` / `DefenseSpellMitigation` | Effective mitigation % |
137
- | `HealingDone` / `HealingTaken` | Healing modifiers |
138
- | `RunSpeed` / `SprintSpeed` | Movement speed |
139
- | `raw` | All 221 stats as `Record<string, number>` |
140
-
141
- > All stat IDs match `g_EsoComputedStats` from the UESP engine (version 49+).
142
-
143
- ## Updating Formulas After a New ESO Patch
144
-
145
- When ZeniMax releases a new patch or DLC, the formulas may change. To update:
146
-
147
- ```bash
148
- # 1. Update the UESP submodule
149
- cd vendor/uesp-esochardata
150
- git fetch upstream && git merge upstream/master
151
- cd ../..
152
-
153
- # 2. Re-extract the formulas from the UESP website
154
- # Open https://esobuilds.uesp.net in a browser
155
- # Run vendor/uesp-data/browser-extract.js in DevTools Console
156
- # Save the result to vendor/uesp-data/uesp-init-data.json
157
-
158
- # 3. Run tests to verify
159
- npm test
160
- ```
112
+ - Behavior follows the vendored UESP engine version — updating ESO patch support means updating the vendored scripts + game data and running the tests.
113
+ - The engine was written for browsers around global state; the wrapper adapts it to Node.js (singleton init, synchronous calls). No concurrency guarantees beyond what the engine itself provides — see [Troubleshooting](https://srtomy.github.io/uesp-eso-build-wrapper/troubleshooting).
114
+ - Requires Node.js >= 24. Bundlers/serverless need explicit `vendor/**` inclusion (documented in Troubleshooting).
161
115
 
162
116
  ## License
163
117
 
164
118
  MIT © srtomy
165
119
 
166
- This package bundles files from [uesp/uesp-esochardata](https://github.com/uesp/uesp-esochardata) (MIT).
120
+ This package bundles files from [uesp/uesp-esochardata](https://github.com/uesp/uesp-esochardata) (MIT).
167
121
  See [THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES) for details.
168
122
 
169
123
  Elder Scrolls Online is a trademark of ZeniMax Media Inc. This project is not affiliated with or endorsed by ZeniMax Media Inc.
@@ -0,0 +1,122 @@
1
+ # uesp-eso-build-wrapper
2
+
3
+ [![CI](https://github.com/srtomy/uesp-eso-build-wrapper/actions/workflows/ci.yml/badge.svg)](https://github.com/srtomy/uesp-eso-build-wrapper/actions/workflows/ci.yml)
4
+ [![codecov](https://codecov.io/gh/srtomy/uesp-eso-build-wrapper/graph/badge.svg)](https://codecov.io/gh/srtomy/uesp-eso-build-wrapper)
5
+ [![npm](https://img.shields.io/npm/v/uesp-eso-build-wrapper.svg)](https://www.npmjs.com/package/uesp-eso-build-wrapper)
6
+ [![Docs](https://img.shields.io/badge/docs-online-2564eb)](https://srtomy.github.io/uesp-eso-build-wrapper/pt/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+ [![Node >=24](https://img.shields.io/badge/node-%3E%3D24-brightgreen)](https://nodejs.org/en/download/)
9
+
10
+ > **Read in [English](README.md).**
11
+
12
+ Um wrapper Node.js/TypeScript em torno do motor de cálculo do [UESP ESO Build Editor](https://github.com/uesp/uesp-esochardata).
13
+
14
+ Calcule as **Computed Character Statistics** de Elder Scrolls Online — Health, Magicka, Stamina, mitigação, chance de crítico, regeneração e mais de 200 — usando as fórmulas da própria UESP. Sem reimplementar nenhuma fórmula.
15
+
16
+ ## O que é?
17
+
18
+ Isto **não é um cliente HTTP da UESP**. A biblioteca executa o motor de cálculo da UESP **localmente, dentro do seu processo Node.js**, e expõe os resultados numa API tipada:
19
+
20
+ ```text
21
+ Aplicação
22
+
23
+ uesp-eso-build-wrapper (API TypeScript)
24
+
25
+ Camada de compatibilidade Node.js (globals de browser + DOM mínimo)
26
+
27
+ UESP esoEditBuild.js (executado in-process via vm.runInThisContext)
28
+
29
+ Funções de cálculo UESP → ComputedStats
30
+ ```
31
+
32
+ Você injeta os inputs, o próprio código da UESP calcula cada stat, você lê de volta um objeto tipado.
33
+
34
+ ## Por que esta biblioteca?
35
+
36
+ - **Precisão de referência** — o mesmo motor `esoEditBuild.js` do [esobuilds.uesp.net](https://esobuilds.uesp.net), mantido pela UESP e atualizado a cada patch.
37
+ - **Sem reimplementar fórmulas** — o wrapper contém zero matemática de ESO. Quando um stat parece errado depois de um patch, a correção está sempre nos *dados* do jogo alimentados ao motor, nunca no código do wrapper. É isso que mantém a precisão entre patches.
38
+ - **Local e síncrono** — `calculateBuild()` não faz nenhuma requisição de rede. O motor roda in-process; os dados do jogo e os itens são fornecidos pela sua aplicação (arquivo, banco de dados, dados gerados).
39
+ - **Aceita item data da UESP diretamente** — equipamentos no formato [`exportJson.php?table=minedItem`](https://esolog.uesp.net) plugam direto em `BuildInput.items`.
40
+ - **Nativo TypeScript** — inputs/outputs tipados, [API Reference](https://srtomy.github.io/uesp-eso-build-wrapper/api/) documentada com TSDoc, além de funções de catálogo em runtime (`listAvailableBuffs`, `listRacialPassives`, …) para descobrir nomes válidos.
41
+
42
+ ## Propriedades principais
43
+
44
+ - Executa o motor de cálculo UESP vendored localmente (`vendor/uesp-esochardata`)
45
+ - **Sem rede para calcular builds** — ver [Precisa de internet?](https://srtomy.github.io/uesp-eso-build-wrapper/pt/architecture#precisa-de-conexao-com-a-internet)
46
+ - Não reimplementa as fórmulas de stats do ESO
47
+ - API síncrona; o motor inicializa uma vez por processo (singleton, chamadas seguintes são no-op)
48
+ - Zero dependências de runtime — Node.js puro
49
+ - 221 computed stats por build
50
+
51
+ ## Instalação
52
+
53
+ ```bash
54
+ npm install uesp-eso-build-wrapper
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ Os game data não vêm no pacote npm — você os fornece via `initEsoEngineFromData` (ver [Primeiros Passos](https://srtomy.github.io/uesp-eso-build-wrapper/pt/getting-started)).
60
+
61
+ ```ts
62
+ import fs from 'fs';
63
+ import { initEsoEngineFromData, calculateBuild } from 'uesp-eso-build-wrapper';
64
+ import type { UespInitData } from 'uesp-eso-build-wrapper';
65
+
66
+ const initData = JSON.parse(
67
+ fs.readFileSync('uesp-game-data.json', 'utf-8'),
68
+ ) as UespInitData;
69
+
70
+ initEsoEngineFromData({ initData }); // uma vez por processo
71
+
72
+ const stats = calculateBuild({
73
+ character: {
74
+ race: 'High Elf',
75
+ class: 'Sorcerer',
76
+ level: 50,
77
+ attributes: { health: 0, magicka: 64, stamina: 0 },
78
+ },
79
+ });
80
+
81
+ console.log(stats.Health); // 16000
82
+ console.log(stats.Magicka); // 19104
83
+ console.log(stats.SpellDamage); // 1000
84
+ ```
85
+
86
+ ## Como funciona
87
+
88
+ 1. `initEsoEngineFromData({ initData })` prepara globals de browser, semeia o motor com seus game data e executa os scripts vendored da UESP via `vm.runInThisContext` — uma vez por processo.
89
+ 2. `calculateBuild(input)` escreve sua build no estado do motor, roda o próprio `UpdateEsoComputedStatsList_Real()` do motor e lê os resultados de `g_EsoComputedStats` num objeto tipado `ComputedStats`.
90
+
91
+ Detalhes: [Arquitetura](https://srtomy.github.io/uesp-eso-build-wrapper/pt/architecture) · [Primeiros Passos](https://srtomy.github.io/uesp-eso-build-wrapper/pt/getting-started) · [Lendo o Resultado](https://srtomy.github.io/uesp-eso-build-wrapper/pt/output).
92
+
93
+ ## Documentação
94
+
95
+ Documentação completa em **Português (BR)** e **English** em
96
+ [**srtomy.github.io/uesp-eso-build-wrapper**](https://srtomy.github.io/uesp-eso-build-wrapper/pt/):
97
+
98
+ | Seção | Descrição |
99
+ | --- | --- |
100
+ | [Introdução](https://srtomy.github.io/uesp-eso-build-wrapper/pt/) | O que é, por que existe, propriedades principais |
101
+ | [Arquitetura](https://srtomy.github.io/uesp-eso-build-wrapper/pt/architecture) | Motor local, política de rede, fluxo de dados |
102
+ | [Primeiros Passos](https://srtomy.github.io/uesp-eso-build-wrapper/pt/getting-started) | Instalação, game data, primeiro cálculo |
103
+ | [Guias](https://srtomy.github.io/uesp-eso-build-wrapper/pt/guides/character) | Personagem, itens, Champion Points, buffs, skills |
104
+ | [Lendo o Resultado](https://srtomy.github.io/uesp-eso-build-wrapper/pt/output) | Os 221 computed stats, `debugBuild()` |
105
+ | [API Reference](https://srtomy.github.io/uesp-eso-build-wrapper/api/) | Gerada a partir do TSDoc (em inglês) |
106
+ | [Solução de Problemas](https://srtomy.github.io/uesp-eso-build-wrapper/pt/troubleshooting) | Problemas comuns (Next.js/serverless, stats errados...) |
107
+ | [Contribuindo](https://srtomy.github.io/uesp-eso-build-wrapper/pt/contributing) | Setup dev, testes, atualização após patch do ESO |
108
+
109
+ ## Limitações
110
+
111
+ - O comportamento segue a versão vendored do motor UESP — suportar um patch novo do ESO significa atualizar os scripts vendored + game data e rodar os testes.
112
+ - O motor foi escrito para browsers em torno de estado global; o wrapper adapta isso para Node.js (init singleton, chamadas síncronas). Sem garantias de concorrência além das que o próprio motor oferece — ver [Solução de Problemas](https://srtomy.github.io/uesp-eso-build-wrapper/pt/troubleshooting).
113
+ - Requer Node.js >= 24. Bundlers/serverless precisam incluir `vendor/**` explicitamente (documentado em Solução de Problemas).
114
+
115
+ ## Licença
116
+
117
+ MIT © srtomy
118
+
119
+ Este pacote inclui arquivos de [uesp/uesp-esochardata](https://github.com/uesp/uesp-esochardata) (MIT).
120
+ Ver [THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES) para detalhes.
121
+
122
+ Elder Scrolls Online é marca registrada de ZeniMax Media Inc. Este projeto não é afiliado nem endossado pela ZeniMax Media Inc.
@@ -1,38 +1,49 @@
1
1
  /**
2
- * Motor de cálculo de builds do ESO.
2
+ * ESO build calculation engine.
3
3
  *
4
- * Implementa a ideia central da arquitetura:
4
+ * Implements the core architecture idea:
5
5
  *
6
- * 1. Injetar dados do personagem nos elementos mock do DOM
7
- * (jQuery vai ler via $("#esotbRace").val(), etc.)
6
+ * 1. Inject character data into the mock DOM elements
7
+ * (jQuery will read via $("#esotbRace").val(), etc.)
8
8
  *
9
- * 2. Injetar dados dos itens DIRETAMENTE em g_EsoBuildItemData[slot]
10
- * — sem precisar mockar jQuery para cada campo de item.
11
- * Os campos vêm exatamente no formato da API pública da UESP:
9
+ * 2. Inject item data DIRECTLY into g_EsoBuildItemData[slot]
10
+ * — no need to mock jQuery for each item field.
11
+ * Fields come exactly in the UESP public API format:
12
12
  * GET https://esolog.uesp.net/exportJson.php?table=minedItem&id=<id>&level=<lv>&quality=<q>
13
13
  *
14
- * 3. Chamar UpdateEsoComputedStatsList_Real(null, true)
15
- * — o parâmetro `noUpdate=true` faz o motor calcular tudo mas pular
16
- * as atualizações de DOM (DisplayEsoAllComputedStats, UpdateReadOnlyStats, etc.)
14
+ * 3. Call UpdateEsoComputedStatsList_Real(null, true)
15
+ * — the `noUpdate=true` parameter makes the engine compute everything but skip
16
+ * the DOM updates (DisplayEsoAllComputedStats, UpdateReadOnlyStats, etc.)
17
17
  *
18
- * 4. Ler os resultados de g_EsoComputedStats[statId].value
18
+ * 4. Read the results from g_EsoComputedStats[statId].value
19
19
  */
20
- import type { BuffInfo, BuildInput, ComputedStats, PassiveSkillInfo, ToggleSkillInfo } from './types';
20
+ import type { BuffInfo, BuildInput, ComputedStats, PassiveSkillInfo, ToggleSkillInfo } from './types.js';
21
+ export declare function cacheStatObjects(): void;
21
22
  /**
22
- * Calcula os Computed Character Statistics para a build fornecida.
23
+ * Calculates the Computed Character Statistics for the given build.
24
+ *
25
+ * Each call starts from a clean engine state (previous items, buffs, CP nodes
26
+ * and skill bars are reset), so builds never bleed into each other.
27
+ *
28
+ * @param input - The build to calculate: character sheet, items, champion
29
+ * point nodes, buffs, toggle skills, skill bars and passives.
30
+ * @returns All computed stats — named keys (Health, Magicka, SpellDamage, ...)
31
+ * plus `raw` with the full 221-stat `g_EsoComputedStats` record.
32
+ * @throws If the engine has not been initialized with
33
+ * `initEsoEngineFromData()` first.
23
34
  *
24
35
  * @example
25
36
  * ```ts
26
- * import { calculateBuild } from './src/lib/eso-engine';
37
+ * import { calculateBuild } from 'uesp-eso-build-wrapper';
27
38
  *
28
39
  * const stats = calculateBuild({
29
40
  * character: { race: 'High Elf', class: 'Sorcerer', level: 50,
30
41
  * attributes: { health: 0, magicka: 64, stamina: 0 } },
31
42
  * items: {
32
- * Chest: chestItemFromUespApi, // objeto retornado por esolog.uesp.net/exportJson.php
43
+ * Chest: chestItemFromUespApi, // object returned by esolog.uesp.net/exportJson.php
33
44
  * },
34
45
  * });
35
- * console.log(stats.MaxMagicka, stats.SpellDamage);
46
+ * console.log(stats.Magicka, stats.SpellDamage);
36
47
  * ```
37
48
  */
38
49
  export declare function calculateBuild(input: BuildInput): ComputedStats;
@@ -42,7 +53,7 @@ export declare function calculateBuild(input: BuildInput): ComputedStats;
42
53
  * Each entry maps to one row in the UESP buff tab. Pass `entry.name` to
43
54
  * `BuildInput.activeBuffs` to enable that buff in a calculation.
44
55
  *
45
- * Must be called after `initEsoEngine()`.
56
+ * Must be called after `initEsoEngineFromData()`.
46
57
  *
47
58
  * @param group - Optional filter. Ex: "Major", "Minor", "Set", "Target",
48
59
  * "Skill", "Potion", "Poison", "Cyrodiil", "Other".
@@ -54,7 +65,7 @@ export declare function listAvailableBuffs(group?: string): BuffInfo[];
54
65
  * Each passive may appear in multiple ranks (rank 1, 2, 3).
55
66
  * Pass the abilityId of the desired rank to BuildInput.passiveSkills.
56
67
  *
57
- * Must be called after initEsoEngine().
68
+ * Must be called after initEsoEngineFromData().
58
69
  *
59
70
  * @param race - Race name as passed to BuildInput.character.race.
60
71
  * Ex: "High Elf", "Nord", "Khajiit"
@@ -65,7 +76,7 @@ export declare function listRacialPassives(race: string): PassiveSkillInfo[];
65
76
  * Each passive may appear in multiple ranks (rank 1, 2, 3).
66
77
  * Pass the abilityId of the desired rank to BuildInput.passiveSkills.
67
78
  *
68
- * Must be called after initEsoEngine().
79
+ * Must be called after initEsoEngineFromData().
69
80
  *
70
81
  * @param className - Class name as passed to BuildInput.character.class.
71
82
  * Ex: "Sorcerer", "Nightblade", "Dragonknight"
@@ -76,7 +87,7 @@ export declare function listClassPassives(className: string): PassiveSkillInfo[]
76
87
  * Each passive may appear in multiple ranks (rank 1, 2, 3).
77
88
  * Pass the abilityId of the desired rank to BuildInput.passiveSkills.
78
89
  *
79
- * Must be called after initEsoEngine().
90
+ * Must be called after initEsoEngineFromData().
80
91
  *
81
92
  * @param skillLine - Skill line name as it appears in g_SkillsData.
82
93
  * Use listAvailableSkillLines() to discover valid names.
@@ -89,7 +100,7 @@ export declare function listPassivesBySkillLine(skillLine: string): PassiveSkill
89
100
  * Returns all skill line names that have passive skills available.
90
101
  * Use the returned names with listPassivesBySkillLine().
91
102
  *
92
- * Must be called after initEsoEngine().
103
+ * Must be called after initEsoEngineFromData().
93
104
  */
94
105
  export declare function listAvailableSkillLines(): string[];
95
106
  /**
@@ -100,7 +111,7 @@ export declare function listAvailableSkillLines(): string[];
100
111
  * Toggle skills backed by a passive (isPassive=true) need the associated skill
101
112
  * in passiveSkills/skillBars for the engine to process the description match.
102
113
  *
103
- * Must be called after initEsoEngine().
114
+ * Must be called after initEsoEngineFromData().
104
115
  */
105
116
  export declare function listAvailableToggleSkills(): ToggleSkillInfo[];
106
117
  //# sourceMappingURL=calculator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calculator.d.ts","sourceRoot":"","sources":["../../../src/lib/eso-engine/calculator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EAEV,aAAa,EAEb,gBAAgB,EAEhB,eAAe,EAEhB,MAAM,SAAS,CAAC;AAqCjB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CAgc/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,EAAE,CA6B7D;AA2BD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAKnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAKvE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAK7E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CASlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,IAAI,eAAe,EAAE,CA6B7D"}
1
+ {"version":3,"file":"calculator.d.ts","sourceRoot":"","sources":["../../../src/lib/eso-engine/calculator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EAEV,aAAa,EAEb,gBAAgB,EAEhB,eAAe,EAEhB,MAAM,YAAY,CAAC;AAMpB,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,aAAa,CA6f/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,EAAE,CA6B7D;AA2BD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAKnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAKvE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAK7E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CASlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,IAAI,eAAe,EAAE,CA6B7D"}