azeroth-shell 0.1.2 → 0.3.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 (80) hide show
  1. package/README.md +362 -85
  2. package/bin/azsh.mjs +35 -19
  3. package/package.json +12 -1
  4. package/src/autopilot/plan.ts +8 -11
  5. package/src/autopilot/view.ts +12 -11
  6. package/src/cli/combatLogFormat.ts +22 -0
  7. package/src/cli/gzLoader.mjs +47 -6
  8. package/src/cli/hdArt.mjs +81 -0
  9. package/src/cli/iconArt.mjs +145 -0
  10. package/src/cli/iconGrid.mjs +100 -0
  11. package/src/cli/modelArt.mjs +298 -0
  12. package/src/cli/oocPrep.mjs +32 -0
  13. package/src/cli/paperdoll.mjs +76 -0
  14. package/src/cli/perfCheck.mjs +56 -0
  15. package/src/cli/repl.mjs +48 -7
  16. package/src/cli/rotationText.mjs +6 -6
  17. package/src/cli/sixel.mjs +319 -0
  18. package/src/cli/term.mjs +106 -12
  19. package/src/cli/text.mjs +21 -3
  20. package/src/cli/tui.mjs +262 -102
  21. package/src/cli/tuiAutopilot.mjs +356 -0
  22. package/src/cli/tuiBags.mjs +37 -4
  23. package/src/cli/tuiBg.mjs +370 -41
  24. package/src/cli/tuiCheck.mjs +633 -37
  25. package/src/cli/tuiCity.mjs +146 -41
  26. package/src/cli/tuiCompanionKit.mjs +6 -6
  27. package/src/cli/tuiCompanions.mjs +211 -41
  28. package/src/cli/tuiCreate.mjs +230 -0
  29. package/src/cli/tuiDungeon.mjs +57 -21
  30. package/src/cli/tuiFight.mjs +467 -88
  31. package/src/cli/tuiFightPanes.mjs +42 -14
  32. package/src/cli/tuiFloor.mjs +21 -9
  33. package/src/cli/tuiGear.mjs +17 -14
  34. package/src/cli/tuiLoot.mjs +6 -6
  35. package/src/cli/tuiMap.mjs +214 -0
  36. package/src/cli/tuiPaperdoll.mjs +108 -0
  37. package/src/cli/tuiPartyStage.mjs +206 -0
  38. package/src/cli/tuiPet.mjs +16 -8
  39. package/src/cli/tuiProfessions.mjs +27 -25
  40. package/src/cli/tuiRotationCond.mjs +390 -0
  41. package/src/cli/tuiSaves.mjs +24 -1
  42. package/src/cli/tuiSearch.mjs +79 -27
  43. package/src/cli/tuiSettings.mjs +3 -4
  44. package/src/cli/tuiStage.mjs +360 -0
  45. package/src/cli/tuiTalentTree.mjs +124 -0
  46. package/src/cli/tuiTalents.mjs +3 -4
  47. package/src/cli/tuiViews.mjs +633 -172
  48. package/src/cli/tuiWiki.mjs +2 -3
  49. package/src/cli/tuiWorld.mjs +90 -7
  50. package/src/data/gear-art.bin.br +0 -0
  51. package/src/data/hd-art.json +114 -0
  52. package/src/data/icon-art.bin.gz +0 -0
  53. package/src/data/model-art-worn.bin.br +0 -0
  54. package/src/data/model-art.bin.gz +0 -0
  55. package/src/data/rotations/pve/paladin/retribution.json +2 -2
  56. package/src/data/tables/creatures.json.gz +0 -0
  57. package/src/data/world-map-sixel.bin.br +0 -0
  58. package/src/data/world-map.bin.gz +0 -0
  59. package/src/domain/bg/match.ts +85 -24
  60. package/src/domain/bg/strategies.ts +144 -29
  61. package/src/domain/bg/types.ts +2 -0
  62. package/src/domain/bg/wsg.ts +35 -20
  63. package/src/domain/character/character.ts +6 -0
  64. package/src/domain/pet/pet.ts +31 -0
  65. package/src/domain/quests/doQuest.ts +24 -6
  66. package/src/domain/rotation/build.ts +3031 -3031
  67. package/src/domain/rotation/classes/paladin.ts +16 -11
  68. package/src/domain/rotation/evaluate.ts +3 -0
  69. package/src/engine/combat/applySpell.ts +20 -9
  70. package/src/engine/combat/applySpellLate.ts +16 -12
  71. package/src/engine/combat/areaAura.ts +284 -283
  72. package/src/engine/combat/fighterFactory.ts +1 -1
  73. package/src/engine/combat/pickAction.ts +3494 -3449
  74. package/src/engine/combat/procsDamage.ts +31 -1
  75. package/src/engine/combat/sessionChase.ts +19 -2
  76. package/src/engine/combat/sessionMotionKit.ts +40 -2
  77. package/src/engine/game/loadReconcile.ts +21 -1
  78. package/src/engine/game/pets.ts +33 -1
  79. package/src/engine/game/types.ts +4 -0
  80. package/src/quests/quests.ts +60 -0
package/README.md CHANGED
@@ -1,29 +1,56 @@
1
1
  # azsh
2
2
 
3
- Azeroth shell. A WoW Classic 1.12 text RPG that runs in the terminal, built on
4
- CMaNGOS Classic data. The engine comes from another project of mine that is not released; this is its
5
- terminal front end. No graphics, no browser, no build step.
3
+ Azeroth shell. A WoW Classic 1.12 text RPG that runs in the terminal, built on CMaNGOS Classic
4
+ data. The engine comes from another project of mine that is not released; this is its terminal
5
+ front end. No graphics, no browser, no build step.
6
6
 
7
- ```
8
- npx azeroth-shell # run it straight from npm
7
+ > Personal, non-commercial fan project. World of Warcraft names, models, textures, icons and data are
8
+ > trademarks and copyrights of Blizzard Entertainment or its licensors. Classic-DB is part of the
9
+ > CMaNGOS Project; neither it nor this project is affiliated with or endorsed by Blizzard.
10
+
11
+ ![A live fight: a level 1 mage against a kobold on the stage, the rotation casting, the combat log streaming below](media/fight.gif)
12
+
13
+ - [Install](#install)
14
+ - [Keys](#keys)
15
+ - [Playing](#playing): [character](#new-character) · [world and autopilot](#world-and-the-autopilot) ·
16
+ [fights](#fights) · [rotation](#rotation) · [gear](#character-and-bags) · [vendors, trainers, talents](#vendors-trainers-talents) ·
17
+ [professions](#professions) · [companions](#companions) · [dungeons](#dungeons) · [city services](#city-services)
18
+ - [Art and terminals](#art-and-terminals)
19
+ - [Line mode and saves](#line-mode-and-saves)
20
+ - [Where it comes from](#where-it-comes-from)
21
+ - [Development](#development)
22
+
23
+ ## Install
24
+
25
+ ```sh
26
+ npx azeroth-shell # run it straight from npm
9
27
  npm install -g azeroth-shell # or install it once, then:
10
- azeroth-shell # pick a character or roll one (azsh for short)
28
+ azeroth-shell # or just azsh
29
+ azeroth-shell --art # optional: fetch the full-size art (179 MB) now instead of when asked
11
30
  ```
12
31
 
32
+ The package is the whole game. The one extra download is the full-size art, which only terminals
33
+ that draw sixel images use. It never comes down on its own: on such a terminal azsh asks first,
34
+ showing the size and the folder, or you fetch it with `--art` (that also works through
35
+ `npx azeroth-shell --art`). It comes from this repo's `art-1` GitHub release, and every file is
36
+ checked against the sha256 in `src/data/hd-art.json` before it is used. You don't need to know
37
+ beforehand whether your terminal draws sixel, because azsh checks that itself.
38
+
13
39
  From a checkout: `npm install -g .` or `node bin/azsh.mjs`.
14
40
 
15
41
  Needs Node 22.18 or newer (it strips TypeScript types natively). No dependencies. The tree is
16
- about 29 MB: 15 MB of gzipped game data and 13 MB of engine source.
42
+ about 41 MB: 15 MB of gzipped game data, 12 MB of model art (creatures, and every item on every
43
+ body) and 13 MB of engine source.
17
44
 
18
- ## Playing
45
+ ## Keys
19
46
 
20
- In a terminal `azsh` opens the windowed game: a header with your pools and gold, eleven tabs, a
21
- cursor-driven list with a detail pane beside it, and a scrolling log underneath. Nothing scrolls
22
- off the top; every screen redraws in place.
47
+ `azsh` opens the windowed game: a header with your pools and gold, eleven tabs, a cursor-driven
48
+ list with a detail pane beside it, and a scrolling log underneath. Nothing scrolls off the top;
49
+ every screen redraws in place.
23
50
 
24
51
  | Key | Does |
25
52
  | --- | --- |
26
- | `1`-`9` `0`, `Tab`, `Left` `Right` | World, Quests, Bags, Gear, Spells, Rotation, Talents, Travel, Professions, Companions; Character is the last tab (`Tab`/`Left`) |
53
+ | `1`-`9` `0`, `Tab`, `Left` `Right` | World, Quests, Bags, Character, Spells, Rotation, Talents, Travel, Professions, Companions; Settings is the last tab (`Tab`/`Left`) |
27
54
  | `Up` `Down` `j` `k` | move the cursor; the right pane describes the row |
28
55
  | `Enter` | act on the row: fight, open a quest, talk to a vendor or trainer, equip, cast, travel |
29
56
  | `Esc` | close the window on top; on a tab, back to World |
@@ -33,107 +60,357 @@ off the top; every screen redraws in place.
33
60
  | `:` | the command line: every verb of the line game (`:rest 120`, `:auto 50 farm kobold`, `:help`) |
34
61
  | `?` | the key list |
35
62
 
63
+ Each screen below has its own keys; they are listed with it.
64
+
65
+ ![The tabs, one after another: Quests, Bags, Gear, Spells, Rotation, Travel, Professions, Companions, Character](media/tabs.gif)
66
+
67
+ ## Playing
68
+
69
+ ### New character
70
+
71
+ **New character** is one form: Race, Class, Gender, Name, then the body's own looks (skin, face,
72
+ hair style and colour, facial hair; horns and tusks where the race has them). The hero stands
73
+ beside the form in the starting gear as you change them, and under the form a card says what the
74
+ race and the class are and what a level 1 starts with: pools, attributes, racials, spells and gear.
75
+
76
+ | Key | Does |
77
+ | --- | --- |
78
+ | `Left` `Right` | change the row under the cursor |
79
+ | `Enter` on Race or Class | open the list with each choice drawn |
80
+ | `Enter` on Name | type a name |
81
+ | `n` | roll a name from the world's name pool |
82
+ | `r` | roll a look |
83
+ | `Esc` | back to the character list |
84
+
85
+ **Random character** rolls a world bot instead, at its own level, geared and named.
86
+
87
+ ![The create form: races and classes cycled with the hero redrawn each time, a name typed, a look rolled, Create](media/create.gif)
88
+
89
+ ### World and the autopilot
90
+
36
91
  **World** lists the quests on offer (`!` when you can take one, `?` when one is ready to hand in),
37
92
  the people here, the exits and every creature you can hunt, coloured by level like the client.
38
- `Enter` on a creature starts a live fight; `f` resolves it instantly; `a` starts the autopilot.
93
+
94
+ | Key | Does |
95
+ | --- | --- |
96
+ | `Enter` on a creature | start a live fight |
97
+ | `f` | resolve the fight instantly |
98
+ | `a` | start the autopilot |
99
+
39
100
  The autopilot accepts quests, picks targets, rests and hands in on its own, one planner step every
40
- third of a second, and every fight it picks plays out live on screen with the same frames and
41
- combat log as a fight you started yourself. Between fights it keeps its own panel (your frame and
42
- what it is doing) instead of flashing back to the tabs; `1`-`9` looks at a tab, `w` goes back to
43
- watching. `Esc` stops it; `Esc` during one of its fights runs away and stops it.
101
+ third of a second. Every fight it picks plays out live on screen with the same frames and combat
102
+ log as a fight you started yourself. Between fights it keeps its own panel (your frame and what it
103
+ is doing) instead of flashing back to the tabs.
104
+
105
+ | Key while the autopilot runs | Does |
106
+ | --- | --- |
107
+ | `1`-`9` | look at a tab |
108
+ | `w` | back to watching; in a fight, take the keys so `1`-`0` press the action bar (`w` or `Esc` hands them back) |
109
+ | `Esc` | stop it; during one of its fights, run away and stop it |
110
+
111
+ ![The autopilot: the pre-flight card, then the run panel saying what it is doing, with its fights played live inside it](media/autopilot.gif)
44
112
 
45
- **Fights** run on the engine's real-time session, ticking every 100 ms: unit frames with health,
46
- power, a fixed cast slot and auras that hold their place. Your rotation plays by default; press a
47
- number to fire that ability over it, `a` to take full control (the numbered ability bar shows in
48
- manual play), `Space` to pause, `+`/`-` to run the fight faster or slower, `Esc` to run away. The 1.12 combat log streams into the log pane.
113
+ ### Fights
114
+
115
+ Fights run on the engine's real-time session, ticking every 100 ms, on a stage: your sprite down
116
+ the left, the foe down the right (its size says its rank). Each has a plate under its feet (name,
117
+ level, class or rank, health, power), its cast or crowd control under that and its aura icons under
118
+ that. The foe stands at its real distance (the engine keeps positions in yards): a melee foe closes
119
+ in, a caster stays at range.
120
+
121
+ Hits rise from the chest, an auto-attack swing lunges the sprite, and a missile (a Fireball, an
122
+ arrow; never a strike) crosses the gap as a glyph. Your cast bar sits centred under the floor and
123
+ the keyed ability bar closes the scene; its slots never move, a cooldown or the cast in progress is
124
+ all they say, and the slot of a spell just used flashes. The 1.12 combat log streams into the log pane.
125
+
126
+ A party fight (companions along, a dungeon pull) is the same stage with every body small: the
127
+ party down the left (you in your gear, the companions in theirs, the pets a size under), the pack
128
+ down the right, and a narrow plate under each sprite with its role letter and name, its health as
129
+ a percent, its power, and under that its cast bar, crowd control or "dead". Each column stands by
130
+ its real distance to the other side, from the far edge to the lane at melee contact, and the
131
+ closing goes to whoever walked it: the healer hangs back, a mage walks into range, the tank runs
132
+ in, and a mob that runs onto the healer crosses the lane while the healer stays put. The sprites
133
+ take the widest box the terminal affords and shrink with the crowd; past the smallest the floor
134
+ counts who is out of frame. Terminals under 90 columns keep the list of unit frames.
135
+
136
+ Your rotation plays by default.
137
+
138
+ | Key | Does |
139
+ | --- | --- |
140
+ | `1`-`0` | fire that ability over the rotation |
141
+ | `a` | take full control |
142
+ | `Space` | pause |
143
+ | `+` `-` | run the fight faster or slower |
144
+ | `t` | (party fight) pause and give a companion an order: attack a target, cast an ability, hold ground |
145
+ | `p` | (dungeon) pull the next trash pack in too |
146
+ | `Esc` | run away |
147
+
148
+ ### Rotation
49
149
 
50
150
  **Rotation** is what auto-play casts for you: the same rule list the web editor edits, phase by
51
151
  phase, every rule as a sentence. Rules are read top to bottom each tick and the first one whose
52
- conditions hold fires. `Enter` on a rule opens its menu (turn on or off, change when it fires,
53
- move, delete); `Enter` on `+ Add a rule` picks a spell or combat item; the Settings rows at the
54
- bottom pick a spec or rebuild the recommended list. `K`/`J`, `a`, `c`, `d`, `s`, `r` still work as
55
- shortcuts.
152
+ conditions hold fires.
153
+
154
+ | Key | Does |
155
+ | --- | --- |
156
+ | `Enter` on a rule | its menu: turn on or off, change when it fires, move, delete |
157
+ | `Enter` on `+ Add a rule` | pick a spell or combat item |
158
+ | Settings rows (bottom) | pick a spec or rebuild the recommended list |
159
+ | `K` `J` | move the rule up or down |
160
+ | `a`, `c`, `d` | add a rule, edit the condition, delete |
161
+ | `s`, `r` | pick a spec, rebuild the recommended list |
162
+ | `w` | whose rotation: yours or a companion's |
163
+ | `p` | rotation profiles: select, add, rename, delete |
164
+ | `D` | target dummy: run the rotation against a dummy |
165
+ | `A` | autopilot settings |
166
+
167
+ ### Character and Bags
168
+
169
+ **Character** shows every slot with what you wear, and your health, power, experience, money,
170
+ attributes and combat ratings under the item tooltip; `s` opens the rest (weapon skills,
171
+ professions, auras, home, pet, honor, reputation). `Enter` on a slot lists everything in your bags (and
172
+ in the bank, in a bank town) that fits it, with the stat, armor and damage difference in the detail
173
+ pane; `Enter` there puts it on. The engine's equipment helper scores your bags against what you
174
+ wear: upgrades are listed at the top of the tab and marked `▲` in Bags. From 160 columns the tab is
175
+ a character sheet: you in your gear in the middle, the worn pieces' icons down both sides, Shift+arrows
176
+ walking the slots.
56
177
 
57
- **Vendors** open in a buy list with prices, stock and why a line is unavailable; `Tab` flips to
58
- selling your bags, `j` sells greys, `r` repairs; a reagent your party crafts with is flagged.
59
- **Trainers** show what you can learn now and what is coming up at which level. **Talents** spend
60
- and refund points per tree.
178
+ ![The Character tab as a sheet: a level 60 shaman in raid gear, the slots' icons on both sides, the cursor walking them](media/gear.gif)
179
+
180
+ | Key | Does |
181
+ | --- | --- |
182
+ | `Enter` on a slot | list what fits, then `Enter` to equip |
183
+ | `s` | your stats, skills, auras, pet, honor and reputation |
184
+ | `u` (Character or Bags) | put on every upgrade at once |
185
+ | `x` | take a piece off |
186
+ | `b` (Bags) | open the bank, in a bank town |
187
+ | `g` (Bags) | open Send goods (see [Professions](#professions)) |
188
+
189
+ ### Vendors, trainers, talents
190
+
191
+ **Vendors** open in a buy list with prices, stock and why a line is unavailable. A reagent your
192
+ party crafts with is flagged.
193
+
194
+ | Key | Does |
195
+ | --- | --- |
196
+ | `Tab` | flip to selling your bags |
197
+ | `j` | sell greys |
198
+ | `r` | repair |
199
+
200
+ **Trainers** show what you can learn now and what is coming up at which level.
201
+ **Talents** spend and refund points per tree. From 160 columns the tab draws the three trees side by
202
+ side as icon grids with their prerequisite arrows, Shift+arrows walking the tiers.
203
+
204
+ ![The Talents tab: Elemental, Enhancement and Restoration drawn as the client's trees, a talent's text in the pane beside them](media/talents.gif)
205
+
206
+ ### Professions
61
207
 
62
208
  **Professions** lists your trade skills and your companions', the profession trainers in the zone
63
209
  and any Plans or Patterns in your bags. `Enter` on a profession opens its recipe book, coloured by
64
- difficulty (orange always raises the skill, gray never): `Enter` makes one, `A` makes all you can,
65
- `N` asks how many, `h` shows only what you can make, `/` searches, and `c` hands the book to a
66
- companion who knows the craft (they craft from the whole party's bags and banks). Short vendor
67
- reagents such as thread, vials and flux are bought from your purse as you craft, the cost shown on
68
- the row. Enchanting opens a bench instead: formulas apply to your gear or a party member's, and
69
- green-or-better bag items can be disenchanted. Mining, Herbalism, Skinning and Fishing list the
70
- zone's nodes (also on the World tab) with `Enter` to gather. *Everything the party can make* is one
71
- book across every crafter. `g` here, in Bags or in Companions opens **Send goods**: trade goods go
72
- to the companions whose recipes use them and upgrades go on whoever gains, after you review it.
210
+ difficulty (orange always raises the skill, gray never). Short vendor reagents such as thread,
211
+ vials and flux are bought from your purse as you craft, the cost shown on the row.
212
+
213
+ | Key in a recipe book | Does |
214
+ | --- | --- |
215
+ | `Enter` | make one |
216
+ | `A` | make all you can |
217
+ | `N` | ask how many |
218
+ | `h` | show only what you can make |
219
+ | `/` | search |
220
+ | `c` | hand the book to a companion who knows the craft (they craft from the whole party's bags and banks) |
221
+
222
+ ![The Professions tab, then an Engineering recipe book: every recipe with its icon, coloured by difficulty, what is missing in red](media/professions.gif)
223
+
224
+ - **Enchanting** opens a bench instead: formulas apply to your gear or a party member's, and
225
+ green-or-better bag items can be disenchanted.
226
+ - **Mining, Herbalism, Skinning and Fishing** list the zone's nodes (also on the World tab) with
227
+ `Enter` to gather.
228
+ - **Everything the party can make** is one book across every crafter.
229
+ - **Send goods** (`g` here, in Bags or in Companions): trade goods go to the companions whose
230
+ recipes use them and upgrades go on whoever gains, after you review it.
231
+
232
+ ### Companions
73
233
 
74
234
  **Companions** shows your party (up to four) and bench. At an inn, *Hire a companion* lists the
75
- adventurers for hire with their gear and price. Each companion's page sets their role, seats or
76
- benches them, gears them (`Enter` on a slot picks from their bags and yours), gives and takes
77
- items, teaches them a profession and opens their recipe book or sends them on a gathering trip
78
- that pays out while you play. The *Fights* row (`m`, or `:squad solo|elites|party`) says who comes along:
79
- Solo, companions only against elites, or the whole party on every pull. That rule covers live fights, `f`,
80
- `:fight` and the autopilot; party frames show each companion's role, target and cast, and `t` in a fight
81
- pauses it to give one of them an order (attack a target, cast an ability, hold ground).
235
+ adventurers for hire with their gear and price.
236
+
237
+ Each companion's page sets their role, seats or benches them, gears them (`Enter` on a slot picks
238
+ from their bags and yours), gives and takes items, teaches them a profession and opens their recipe
239
+ book, or sends them on a gathering trip that pays out while you play.
240
+
241
+ The *Fights* row (`m`, or `:squad solo|elites|party`) says who comes along: Solo, companions only
242
+ against elites, or the whole party on every pull. That rule covers live fights, `f`, `:fight` and
243
+ the autopilot. Party frames show each companion's role, target and cast, and `t` in a fight pauses
244
+ it to give one of them an order.
245
+
246
+ ### Dungeons
82
247
 
83
248
  **Dungeons** sit under *Dungeons* on the World tab of the zone that holds their door (and on the
84
- Travel tab), with any held run or raid lockout on the row. `Enter` opens the card before the door: route
85
- (Bosses or Full), party or raid, who walks in (`f` fills from every companion you own to what the
86
- instance wants), the 10/20/40-man raid group, the paladins' Blessings, and food and water for everyone
87
- short of it. Inside, the run window lists the rooms in route order with their stops (`B` boss, `T` trash,
88
- `R` rare), the doors, levers and chests nearest each stop, and the NPCs with quests. `Enter` on an
89
- open stop pulls it live with the party (`p` in the fight pulls the next trash pack in too), on a gate
90
- uses it, on a chest opens it. Locked stops say what opens them. `z` rests and eats between pulls,
91
- `F` runs every remaining stop without watching and ends on a run report (damage, healing, loot, wipes),
92
- `P` opens the Blessings board, `L` leaves (a 5-man is held for 30 minutes) and `R` resets.
93
-
94
- **Gear** shows every slot with what you wear. `Enter` on a slot lists everything in your bags
95
- (and in the bank, in a bank town) that fits it, with the stat, armor and damage difference in
96
- the detail pane; `Enter` there puts it on. The engine's equipment helper scores your bags
97
- against what you wear: upgrades are listed at the top of the tab and marked `▲` in Bags, and
98
- `u` (on either tab) puts on every upgrade at once. `x` takes a piece off.
99
-
100
- **City services** appear under *Services* on the World tab, above the people: the **Bank**
101
- in the six capitals and the goblin banker towns (`b` in Bags opens it too; `Tab` flips between
102
- depositing and withdrawing, `n` moves part of a stack, `+` buys a bank bag slot, `B` slots a
103
- bag), the **Auction House** in the capitals (`Tab` cycles browse, sell and your own auctions;
104
- `Enter` buys out, `b` bids, `s` searches by name; selling asks quantity, bid, buyout and
105
- duration), and the **Mailbox** by every inn, where sales, refunds and overflow loot arrive
106
- (`Enter` takes a letter's money and items, `A` empties the box, `d` deletes). `:bank`, `:ah`
107
- and `:mail` open them from the command line.
249
+ Travel tab), with any held run or raid lockout on the row. `Enter` opens the card before the door:
250
+ route (Bosses or Full), party or raid, who walks in (`f` fills from every companion you own to what
251
+ the instance wants), the 10/20/40-man raid group, the paladins' Blessings, and food and water for
252
+ everyone short of it.
253
+
254
+ Inside, the run window lists the rooms in route order with their stops (`B` boss, `T` trash,
255
+ `R` rare), the doors, levers and chests nearest each stop, and the NPCs with quests. Locked stops
256
+ say what opens them.
257
+
258
+ | Key | Does |
259
+ | --- | --- |
260
+ | `Enter` on an open stop | pull it live with the party (`p` in the fight pulls the next trash pack in too) |
261
+ | `Enter` on a gate / chest | use it / open it |
262
+ | `z` | rest and eat between pulls |
263
+ | `F` | run every remaining stop without watching; ends on a run report (damage, healing, loot, wipes) |
264
+ | `P` | open the Blessings board |
265
+ | `L` | leave (a 5-man is held for 30 minutes) |
266
+ | `R` | reset |
267
+
268
+ ### City services
269
+
270
+ **City services** appear under *Services* on the World tab, above the people. `:bank`, `:ah` and
271
+ `:mail` open them from the command line.
272
+
273
+ **Bank**, in the six capitals and the goblin banker towns (`b` in Bags opens it too):
274
+
275
+ | Key | Does |
276
+ | --- | --- |
277
+ | `Tab` | flip between depositing and withdrawing |
278
+ | `n` | move part of a stack |
279
+ | `+` | buy a bank bag slot |
280
+ | `B` | slot a bag |
281
+
282
+ **Auction House**, in the capitals:
283
+
284
+ | Key | Does |
285
+ | --- | --- |
286
+ | `Tab` | cycle browse, sell and your own auctions |
287
+ | `Enter` | buy out |
288
+ | `b` | bid |
289
+ | `s` | search by name |
290
+
291
+ Selling asks quantity, bid, buyout and duration.
292
+
293
+ **Mailbox**, by every inn, where sales, refunds and overflow loot arrive:
294
+
295
+ | Key | Does |
296
+ | --- | --- |
297
+ | `Enter` | take a letter's money and items |
298
+ | `A` | empty the box |
299
+ | `d` | delete |
300
+
301
+ ## Art and terminals
302
+
303
+ The colours are plain ANSI, so your terminal's theme sets the palette. For a CRT look turn on the
304
+ terminal's own retro effect (Windows Terminal: `"experimental.retroTerminalEffect": true` on the
305
+ profile; cool-retro-term elsewhere).
306
+
307
+ At 90 columns or wider the creature you face is drawn beside the fight frames and under its detail
308
+ on the World tab. Your own character, in the gear you wear, stands on the Character tab and its stats page, on the
309
+ character picker, at creation and (from 130 columns) on the other side of the fight, and a
310
+ companion's page shows them the same way. It is truecolour half-block art baked from the game's
311
+ models; a terminal without 24-bit colour shows it in the nearest colours it has.
312
+
313
+ A terminal that draws sixel images (Windows Terminal 1.22+, WezTerm, foot, iTerm2; VS Code with
314
+ `terminal.integrated.enableImages`) can draw every creature, every character in their gear and every
315
+ icon in real pixels instead. azsh asks the terminal at start.
316
+
317
+ The Travel tab has the world map under whatever you point at: both continents, a gold pin where you
318
+ stand, a cyan one on the zone under the cursor and the planned route dotted between them, legs by
319
+ sea and air included; on the road the pin walks its leg. It is the same terrain map the browser game
320
+ pans around, as half-block cells or, on a sixel terminal, as pixels. Both of its packs are small enough
321
+ to ship, so the map needs no download. The pane is short on a short terminal, and so is the map:
322
+ give the window forty rows or more and it grows into them.
323
+
324
+ The full-size art for that is not in the npm package: it is about 179 MB, too much to ship to every
325
+ terminal that cannot draw it. When azsh finds a sixel terminal without it, it offers to download it
326
+ from the project's GitHub release into `~/.azsh/art/`. Each file is checked against a sha256 the
327
+ package carries. Answer "Not now" and it asks again next run; "Never ask" stops the prompt. `azsh --art` fetches it
328
+ from the shell without starting the game. Until the
329
+ art is there, the half-block art stays.
330
+
331
+ | Command | Does |
332
+ | --- | --- |
333
+ | `:art` | say whether this terminal draws sixel and whether the full-size art is here |
334
+ | `:art download` | fetch the full-size art now (progress on the hint row, the screen redraws when done) |
335
+
336
+ ![The same hero on the create screen: half-block art on the left, sixel on the right](media/art-compare.png)
337
+
338
+ | Variable | Does |
339
+ | --- | --- |
340
+ | `AZSH_SIXEL=0` | keep the half-block art |
341
+ | `AZSH_SIXEL=1` | turn sixel on for a terminal that does not say |
342
+ | `AZSH_ART_DIR` | read the full-size art from (and download it to) this folder instead |
343
+ | `AZSH_HOME` | move the save folder (default `~/.azsh`) |
344
+
345
+ ## Line mode and saves
108
346
 
109
347
  Piped input, or `azsh --repl`, gives the line game instead: type `help` for its commands.
110
- `azsh --tui` forces the windowed game even without a terminal, which is how it is driven through pipes
111
- in tests. Keys are decoded from the raw byte stream, so a lone `Esc` acts at once.
348
+ `azsh --tui` forces the windowed game even without a terminal, which is how it is driven through
349
+ pipes in tests. Keys are decoded from the raw byte stream, so a lone `Esc` acts at once.
112
350
 
113
351
  Saves live in `~/.azsh/saves/`, one JSON file per character. `AZSH_HOME` moves that folder.
114
352
 
115
353
  ## Where it comes from
116
354
 
117
- The engine, rules, world, quests, autopilot and data are taken as-is from a larger, unreleased project
118
- of mine that runs the same game with a graphical front end. The data is the CMaNGOS Classic world
119
- database plus a DBC bake, every table gzipped on disk (`src/cli/gzLoader.mjs` serves the static
120
- imports). What is new here is the terminal front end in `src/cli/`: `tui.mjs` (frame, input, dialogs),
121
- `tuiViews.mjs` (tabs), `tuiProfessions.mjs` and `tuiCompanions.mjs` (crafting, companions),
122
- `tuiFight.mjs` (live fight, autopilot) and `repl.mjs` (line game and the shared verb table). A few
123
- small UI modules (combat log wording, rotation sentences, dungeon floor scripts) are ported from the
124
- same project.
355
+ The engine, rules, world, quests, autopilot and data are taken as-is from a larger, unreleased
356
+ project of mine that runs the same game with a graphical front end. The data is the CMaNGOS Classic
357
+ world database plus a DBC bake, every table gzipped on disk (`src/cli/gzLoader.mjs` serves the
358
+ static imports). Everything the player reads traces to a CMaNGOS row or a 1.12 client string.
359
+ Nothing here is invented.
125
360
 
126
- Everything the player reads traces to a CMaNGOS row or a 1.12 client string. Nothing here is
127
- invented.
361
+ What is new here is the terminal front end in `src/cli/`:
128
362
 
129
- ## Checks
363
+ | Module | Holds |
364
+ | --- | --- |
365
+ | `tui.mjs` | frame, input, dialogs |
366
+ | `tuiViews.mjs` | tabs |
367
+ | `tuiProfessions.mjs`, `tuiCompanions.mjs` | crafting, companions |
368
+ | `tuiFight.mjs` | live fight, autopilot |
369
+ | `repl.mjs` | line game and the shared verb table |
130
370
 
131
- ```
371
+ A few small UI modules (combat log wording, rotation sentences, dungeon floor scripts) are ported
372
+ from the same project.
373
+
374
+ The art is Blizzard's too. The icons are the 1.12 client's own icon textures; the creature sprites
375
+ and the geared character bodies are renders of the client's models. The packs in `src/data` are
376
+ small half-block reductions of them, and the full-size packs a sixel terminal downloads (the
377
+ `art-*` GitHub releases) are the same pictures at their native size. They are here for a
378
+ non-commercial fan project, nothing is sold or will be, and they come down on request.
379
+
380
+ What is not ported, and why, is the "Not porting" list in `PORT-PLAN.md`.
381
+
382
+ ## Development
383
+
384
+ Checks:
385
+
386
+ ```sh
132
387
  npm run check # boot the store, fight ten kobolds, save and reload
133
- npm run check:tui # drive the windowed game headlessly: tabs, quest, vendor, trainer, gear, bank, auction house, live fight, autopilot, crafting, hiring, send goods
388
+ npm run check:tui # drive the windowed game headlessly: tabs, quest, vendor, trainer, gear, bank,
389
+ # auction house, live fight, autopilot, crafting, hiring, send goods
134
390
  npm run check:pipe # the real terminal path through pipes: raw key bytes in, ANSI frames out, Esc, paging, quit
135
391
  npm run check:all # all three; add --frames to check:tui to print every screen
392
+ npm run check:perf # timings, not pass/fail: module import, boot stages, heap, a repaint on every tab, a fight tick by tick
393
+ ```
394
+
395
+ Data and art bakes:
396
+
397
+ ```sh
136
398
  npm run data:pack # gzip the bake after a data refresh; data:unpack reverses it
399
+ npm run art:bake # rebuild src/data/model-art.bin.gz from phonecraft's creature renders (needs ffmpeg)
400
+ npm run art:gear # rebuild src/data/gear-art.bin.gz from phonecraft's paperdoll bake (needs Python with Pillow)
401
+ npm run art:icons # rebuild src/data/icon-art.bin.gz from phonecraft's spell and item icons (needs ffmpeg)
402
+ npm run art:map # rebuild the Travel tab's world map, src/data/world-map.bin.gz and world-map-sixel.bin.br,
403
+ # from phonecraft's combined Azeroth terrain map (needs ffmpeg)
404
+ npm run art:hd # rebuild the full-size art sixel draws: model-art-hd.bin.br, icon-art-hd.bin.br and
405
+ # gear-art-hd/<body>.bin.br (needs ffmpeg, and Python with Pillow for the gear)
137
406
  ```
138
407
 
139
- What is not ported, and why, is the "Not porting" list in `PORT-PLAN.md`.
408
+ The pictures in this file are played, not drawn: `scripts/demo-record.mjs` runs the game on pipes with
409
+ a scripted player and logs every byte it writes with the time, and `scripts/demo-render.py` replays
410
+ the log through a small terminal emulator (cells, colours, sixel) and hands the frames to ffmpeg.
411
+
412
+ ```sh
413
+ node scripts/demo-record.mjs new media/rec/new.jsonl --cols 160 --rows 48 # scenes: new, bot, art
414
+ python scripts/demo-render.py media/rec/new.jsonl --marks # the clips in a recording
415
+ python scripts/demo-render.py media/rec/new.jsonl --clip fight --gif media/fight.gif [--mp4 media/fight.mp4]
416
+ ```
package/bin/azsh.mjs CHANGED
@@ -1,19 +1,35 @@
1
- #!/usr/bin/env node
2
- // azsh: Azeroth shell. Node 22.18+ strips TypeScript types natively, so the engine loads as-is.
3
- // A terminal gets the windowed game; piped input (or --repl) gets the line game.
4
- const [major, minor] = process.versions.node.split('.').map(Number);
5
- if (major < 22 || (major === 22 && minor < 18)) {
6
- console.error(`azsh needs Node 22.18 or newer (found ${process.versions.node}).`);
7
- process.exit(1);
8
- }
9
- await import('../src/cli/register.mjs');
10
- const argv = process.argv.slice(2);
11
- const wantRepl = argv.includes('--repl') || (!argv.includes('--tui') && (!process.stdin.isTTY || !process.stdout.isTTY));
12
- if (wantRepl) {
13
- const { main } = await import('../src/cli/repl.mjs');
14
- await main(argv.filter((a) => a !== '--repl' && a !== '--tui'));
15
- } else {
16
- const { runTui } = await import('../src/cli/tui.mjs');
17
- await runTui({ argv });
18
- process.exit(0); // the save is written before the screen closes; a piped stdin would otherwise hold the loop open
19
- }
1
+ #!/usr/bin/env node
2
+ // azsh: Azeroth shell. Node 22.18+ strips TypeScript types natively, so the engine loads as-is.
3
+ // A terminal gets the windowed game; piped input (or --repl) gets the line game.
4
+ const [major, minor] = process.versions.node.split('.').map(Number);
5
+ if (major < 22 || (major === 22 && minor < 18)) {
6
+ console.error(`azsh needs Node 22.18 or newer (found ${process.versions.node}).`);
7
+ process.exit(1);
8
+ }
9
+ const argv = process.argv.slice(2);
10
+ if (argv.includes('--art')) {
11
+ // Fetch the full-size art up front instead of waiting for the in-game offer; says what and from where first.
12
+ const { hdManifest, missingHdBytes, downloadHdArt, downloadDir } = await import('../src/cli/hdArt.mjs');
13
+ const m = hdManifest(), bytes = missingHdBytes();
14
+ if (!m) { console.error('This build has no art manifest.'); process.exit(1); }
15
+ if (!bytes) { console.log(`The full-size art is all here (${downloadDir()}).`); process.exit(0); }
16
+ console.log(`Fetching ${Math.round(bytes / 1e6)} MB of full-size art (${m.files.length} files, sha256-checked)\n from ${m.base}\n into ${downloadDir()}`);
17
+ const res = await downloadHdArt((done, total) => {
18
+ if (process.stdout.isTTY) process.stdout.write(`\r ${Math.round(done / 1e6)} of ${Math.round(total / 1e6)} MB`);
19
+ });
20
+ if (process.stdout.isTTY) process.stdout.write('\n');
21
+ console.log(res.ok ? 'Done. A sixel terminal now draws creatures, characters and icons in real pixels.' : `Stopped: ${res.reason}`);
22
+ process.exit(res.ok ? 0 : 1);
23
+ }
24
+ await import('../src/cli/register.mjs');
25
+ const wantRepl = argv.includes('--repl') || (!argv.includes('--tui') && (!process.stdin.isTTY || !process.stdout.isTTY));
26
+ if (wantRepl) {
27
+ const { main } = await import('../src/cli/repl.mjs');
28
+ await main(argv.filter((a) => a !== '--repl' && a !== '--tui'));
29
+ } else {
30
+ // Loading the engine takes a moment (longer on the first run, which fills the stripped-JS cache); say so.
31
+ process.stdout.write('azsh: loading...\n');
32
+ const { runTui } = await import('../src/cli/tui.mjs');
33
+ await runTui({ argv });
34
+ process.exit(0); // the save is written before the screen closes; a piped stdin would otherwise hold the loop open
35
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azeroth-shell",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Azeroth shell. A WoW Classic 1.12 text RPG for the terminal, built on CMaNGOS data.",
6
6
  "keywords": [
@@ -28,6 +28,10 @@
28
28
  "files": [
29
29
  "bin/",
30
30
  "src/",
31
+ "!src/data/*-hd.bin.br",
32
+ "!src/data/gear-art-hd/",
33
+ "!src/data/*.only.bin.br",
34
+ "!src/data/gear-art-hd.only/",
31
35
  "docs/"
32
36
  ],
33
37
  "engines": {
@@ -39,9 +43,16 @@
39
43
  "check": "node --import ./src/cli/register.mjs src/cli/bootCheck.mjs",
40
44
  "data:pack": "node scripts/pack-data.mjs",
41
45
  "data:unpack": "node scripts/pack-data.mjs --unpack",
46
+ "art:bake": "node scripts/bake-model-art.mjs && node scripts/bake-model-art.mjs --worn",
47
+ "art:gear": "python scripts/bake-gear-art.py",
48
+ "art:icons": "node scripts/bake-icon-art.mjs",
49
+ "art:map": "node scripts/bake-world-map.mjs && node scripts/bake-world-map.mjs --sixel",
50
+ "art:hd": "node scripts/bake-model-art.mjs --hd && node scripts/bake-icon-art.mjs --hd && python scripts/bake-gear-art.py --hd",
51
+ "art:publish": "node scripts/publish-hd-art.mjs",
42
52
  "build:exe": "node scripts/build-exe.mjs",
43
53
  "check:tui": "node --import ./src/cli/register.mjs src/cli/tuiCheck.mjs",
44
54
  "check:pipe": "node scripts/tui-pipe-check.mjs",
55
+ "check:perf": "node --import ./src/cli/register.mjs src/cli/perfCheck.mjs",
45
56
  "check:all": "npm run check && npm run check:tui && npm run check:pipe"
46
57
  }
47
58
  }
@@ -46,6 +46,8 @@ import {
46
46
  prereqMet,
47
47
  dropperNoiseFloorFor,
48
48
  compareQuestDroppers,
49
+ pickQuestDropper,
50
+ dropperPickSalt,
49
51
  } from '../quests/quests.ts';
50
52
  import { ownedInventory } from '../domain/items/keyring.ts';
51
53
  import { mailboxAsInventory } from '../domain/economy/mail.ts';
@@ -1502,17 +1504,12 @@ function planStepCore(
1502
1504
  });
1503
1505
  if (candidates.length > 0) {
1504
1506
  // Kill objectives first, then a normal dropper over an elite, then closer, then highest drop.
1505
- const target = candidates.reduce((a, b) => {
1506
- const aKill = killNeed.has(a.entry);
1507
- const bKill = killNeed.has(b.entry);
1508
- if (aKill !== bKill) return aKill ? a : b;
1509
- const cmp = compareQuestDroppers(
1510
- { level: a.level, chance: itemChance.get(a.entry) ?? 0, rank: a.rank ?? 0 },
1511
- { level: b.level, chance: itemChance.get(b.entry) ?? 0, rank: b.rank ?? 0 },
1512
- state.char.level,
1513
- );
1514
- return cmp <= 0 ? a : b;
1515
- });
1507
+ // One of the near-equal pool, rotated per fight — not the same template every pull.
1508
+ const kills = candidates.filter((h) => killNeed.has(h.entry));
1509
+ const ranked = (kills.length > 0 ? kills : candidates)
1510
+ .map((h) => ({ h, level: h.level, chance: itemChance.get(h.entry) ?? 0, rank: h.rank ?? 0 }))
1511
+ .sort((a, b) => compareQuestDroppers(a, b, state.char.level) || a.h.entry - b.h.entry);
1512
+ const target = pickQuestDropper(ranked, state.char.level, dropperPickSalt(state))!.h;
1516
1513
  questFight = { creatureEntry: target.entry, questEntry: local.entry };
1517
1514
  }
1518
1515
  }