Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(verse): climb a military rank ladder with real uniforms and a hall of honour
rubenluetke10-beepc5ac29790aa4
diff --git a/docs/agent-society/level-system.md b/docs/agent-society/level-system.mdindex 76a4c648d6..6ac3110fd3 100644--- a/docs/agent-society/level-system.md+++ b/docs/agent-society/level-system.md@@ -65,73 +65,96 @@ level 50. Level 2 arrives after a handful of actions, level 10 after about aweek of ordinary use (~200 XP a day), level 50 after several months. Theserver sends the whole curve (`level_xp`), so the client never re-derives it.-## 4. Titles and rewards+## 4. Ranks and rewards-Titles change at bands: the person goes Newcomer → Apprentice (5) → Operator-(10) → Specialist (15) → Strategist (20) → Architect (25) → Commander (30) →-Visionary (40) → Legend (50); agents Rookie → … → Grandmaster; pets-Hatchling → … → Mythic.+Every subject climbs one military rank ladder; the rank is its title. A+promotion comes every two or three levels (`RANKS` in rules.py):-Rewards are cosmetic and fill four slots. Each reward names the level at which-each subject kind unlocks it (or never):+| Tier | Ranks (first level) | Insignia |+|---|---|---|+| Enlisted | Private (1, no insignia), Private Second Class (2), Private First Class (4), Specialist (6) | Gold chevrons on navy, worn on the upper sleeves |+| Non-commissioned officers | Corporal (8), Sergeant (10), Staff Sergeant (12), Sergeant First Class (14), Master Sergeant (16), First Sergeant (18), Sergeant Major (20), Command Sergeant Major (22), Sergeant Major of the Army (24) | Chevrons, rockers and their device (diamond, star, wreath, eagle), on the sleeves |+| Officers | Second Lieutenant (26), First Lieutenant (28), Captain (30), Major (32), Lieutenant Colonel (34), Colonel (36) | Gold and silver bars, oak leaves, the eagle, on navy shoulder boards |+| General officers | Brigadier General (38), Major General (41), Lieutenant General (44), General (47), General of the Army (50) | One to five silver stars on black boards edged in gold |++The insignia are vector art (`progression/insignia/rankArt.ts`): one set of+polygons drives the SVG icons, the Level Wall's canvas and the extruded 3D+pieces on figures and in the hall's cases.-| Slot | Rewards (person level) |+Rewards are real uniform pieces in three slots, each unlocking on a+promotion. The person wears them; agents keep the outfit their owner dressed+them in and earn decorations only; the pet wears its rank on its name plate.++| Slot | Pieces (person level · agent level) ||---|---|-| Frame (level chip and HUD ring) | bronze 3, silver 10, gold 20, diamond 50 |-| Trail (left while moving) | footprints 2, sparkle 5, comet 12, neon 20, rainbow 30, star dust 45 |-| Aura (on the floor) | glow 7, runes 15, storm 35, legend 50 |-| Gadget (on or around the figure) | drone 10, halo 18, crown 25, light wings 40 |+| Uniform | service shirt and tie 4, field jacket 10, green service uniform 20, blue dress uniform 26, blue mess dress 41 |+| Headwear | patrol cap 6, garrison cap 14, black beret 24, service cap 32 |+| Decoration | service ribbons 8 · 3, full ribbon rack 18 · 16, gold aiguillette 36 · 32, full-size medals 47 · 44 |++Trims follow the rank: officers' dress uniforms carry gold cuff braid,+non-commissioned officers and up a trouser stripe; the patrol cap carries+the sewn rank, the garrison cap and beret an officer's pin (a unit crest for+enlisted ranks), and the service cap's visor one row of gold oak leaves for+field-grade officers and two for generals.-The person chooses per slot for themself and their pet (automatic = the-latest unlock, none, or any unlocked piece; stored per browser profile).-Agents always wear their best unlocks.+The person chooses per slot (automatic = the finest unlock, own clothes, or+any unlocked piece; stored per browser profile). Agents always wear their+best unlocks.## 5. The level-up moment-- **In the world:** a column of light from the floor, two shockwave rings,- a fountain of sparks that rains back down and a rising "LEVEL n" tag, in- gold (person), teal (pet) or green (agent). The person's figure hops and- waves.-- **On screen:** person and pet get a banner — light rays and a flash, the- word stamps in, the old number rolls out and the new one in, then the new- title and each unlocked reward slide up one after another. Agents get a- quiet toast in the corner. Level-ups that happened while the map was closed- are told once per subject ("While you were away").+- **In the world:** a single gold ring runs out across the floor and a soft+ light fades under the figure, while a plate rises over its head with the+ new insignia — "Promoted · Sergeant" on a promotion, "Level 7" between+ two. The person's figure hops and waves.+- **On screen:** person and pet get the promotion card — midnight blue with a+ fine gold rule. On a promotion the old insignia stands, steps aside and+ dims while the new one is laid on piece by piece and catches the light;+ then the rank name, its grade and the rolling level number, the next+ promotion between two, and each unlocked uniform piece. Agents get a quiet+ toast in the corner. Level-ups that happened while the map was closed are+ told once per subject ("While you were away").- **Sound:** a synthesised fanfare (Web Audio, no files), a short chime for an- agent, a soft tick for "+XP"; switchable in the progress panel.+ agent, a soft tick for "+XP"; switchable in the Level Hall screen.- **Every gain:** a floating "+n XP" over whoever earned it; the HUD bar lightsthe gain first and fills a beat later.-Reduced motion keeps the information (banner, tag, toast) and drops the motion.+Reduced motion keeps the information (card, plate, toast) and drops the motion.## 6. Surfaces-- Level card under the floor title (click or `L` opens the Level Hall screen).-- Level chip on every name plate; the lead's chip shows the pet's level.-- **The Level Hall** on the agents floor (office-map.md §5f): the Level Wall,- the Upgrade Studio's stage, a pedestal per reward along the Level Road and the- level guide. Stepping on the stage opens the screen's Studio page, the guide- its Overview, a pedestal its reward on the Rewards page.+- Level card under the floor title: the rank insignia in a ring that fills+ with XP, the rank and the bar (click or `L` opens the Level Hall screen).+- A rank chip (insignia and level) on every name plate; the lead's chip shows+ the pet's.+- On the figures: enlisted insignia on both upper sleeves, officer and+ general insignia on shoulder boards, the decoration over the left breast+ pocket (the aiguillette from the right shoulder), the cap on the head.+- **The Level Hall** on the agents floor (office-map.md §5f): the rank wall,+ the studio dais, a display case per uniform piece along the runner and the+ service guide. Stepping on the dais opens the screen's Studio page, the+ guide its Overview, a case its piece on the promotion road.- **The Level Hall screen**, for the person or their pet (switch in the head):- - *Overview:* level, title, XP bar with what is missing, the next title, the- next three unlocks (each opens in the Studio to try on) and the quickest- repeatable ways to earn.- - *Studio:* the dressing room. A live 3D preview of the person's figure or- the pet on the hall's stage wearing the loadout; per slot "automatic",- "nothing" and every piece as a card with its rarity. An unlocked piece is- put on with one click; a locked piece is tried on in the preview, marked- "Try-on" with the level and XP it still needs. A trail makes the figure- walk a circle; the frame shows on a name plate.- - *Rewards:* the reward road from the first unlock to the cap with the- subject's position on it; the chosen step in the preview with its rarity,- unlock level, missing XP and "Put it on" once open.- - *How to level:* three steps (earn, level up, unlock), the cost of the next- levels from the server's curve, and every rule for the person, the pet and- agents, grouped.- - *Team:* every agent's level, best first.-- Rarity is a reading of the unlock level only (≤ 5 common, ≤ 15 rare, ≤ 30- epic, above legendary); it changes nothing in the rulebook.+ - *Overview:* rank, level, XP bar with what is missing, the next promotion,+ the next three uniform pieces (each opens in the Studio to try on) and the+ quickest repeatable ways to earn.+ - *Ranks:* the whole ladder as one chart, grouped by tier; ranks held in+ full colour, the current one framed, the ones ahead as silhouettes with+ the XP still missing.+ - *Studio:* the dressing room. A live 3D preview of the person's figure on+ the dais in the loadout and the insignia of their rank; per slot+ "automatic", "own clothes" and every piece as a card with the rank it+ comes with. An unlocked piece is put on with one click; a locked piece is+ tried on in the preview, marked "Try-on" with the level and XP it still+ needs. The pet's studio shows its rank.+ - *Promotions:* the road from the first promotion to the cap with the+ subject's position on it; the chosen step in the preview at that rank,+ with its insignia, grade, tier, piece, missing XP and "Put it on" once+ open.+ - *How to level:* three steps (earn, level up, get promoted), the cost of+ the next levels from the server's curve, and every rule for the person,+ the pet and agents, grouped.+ - *Team:* every agent's level and rank, best first.## 7. Contracts@@ -140,7 +163,8 @@ Reduced motion keeps the information (banner, tag, toast) and drops the motion.`title`, `unlocked`.- `SocietyResultPosted` is new: `WorldFeed` forwards a board RESULT (id,agent, status; never its text).-- `levelCatalog.ts` mirrors the ids (kinds, slots, rewards, titles, sources);+- `levelCatalog.ts` mirrors the ids (kinds, slots, rewards, ranks, sources) and+ each rank's grade and tier;`tests/unit/progression/test_frontend_parity.py` pins it and the threelocale files to the rulebook.- The ledger is `<data_dir>/progression.db`, opened on the first award, neverdiff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.mdindex 8a64e8e370..6c743a3dd0 100644--- a/docs/agent-society/office-map.md+++ b/docs/agent-society/office-map.md@@ -324,26 +324,33 @@ which follows like on the coding floor).where a game aims with it, and a touch pad on coarse pointers. Escape or Eleaves.-## 5f. Levels (2026-10-03)+## 5f. Levels (2026-10-03, ranks 2026-10-05)The person, their pet and every agent level up from real work: finishedJarvis turns, agent results, quests, missions, new agents, plus small meteredactions in the Verse (daily visit, floors, the office dog, arcade rounds, team-meetings, walks with the pet). A level card sits under the floor title, every-name plate wears a level chip, `L` opens the progress panel, and a level-up-plays a light column, shockwaves and sparks in the world plus a banner on-screen. Unlocked trails, auras, gadgets and frames are worn in the world.+meetings, walks with the pet). Levels climb a military rank ladder from+private to a five-star general. A level card sits under the floor title,+every name plate wears a rank chip, `L` opens the Level Hall screen, and a+promotion plays a gold ring and a rising insignia plate in the world plus the+promotion card on screen. Figures wear their insignia on the sleeves or+shoulder boards, and the person their unlocked uniform, cap and decorations.The whole contract lives in [level-system.md](level-system.md).-The Level Hall is the levels' own room on the agents floor, dressed as a-trophy hall in midnight stone and brass: the Level Wall (a live screen with the-person's level, title, XP bar and next reward) over the Upgrade Studio's round-stage in the north, the Level Road down the middle lined with a pedestal per-reward (lowest unlock in the south, highest by the stage; lit once unlocked, a-dark silhouette while locked, the next unlock under a pulsing gold beam; a-click opens it on the reward road), and the double-sided level guide at the-road's start. Its two checkpoints, the stage (`studio`) and the guide-(`levels`), open the Level Hall screen (level-system.md §6).+The Level Hall is the levels' own room on the agents floor, dressed as a hall+of honour: cream and charcoal marble underfoot, walnut and brass, a red+runner up the middle. The rank wall in the north holds all 24 insignia in a+walnut-framed velvet shadow box (held ranks struck in metal, the current one+framed in brass, the ones ahead as pewter silhouettes) above a brass plaque+with the person's rank, level, XP and next promotion; the studio dais stands+in front of it. Display cases line the runner, one per uniform piece (lowest+unlock in the south): a mannequin in the uniform with the person's own+insignia, a cap on a velvet head form, or the decoration on a slanted velvet+board — the same geometry the figures wear. Unlocked cases are lit, locked+ones stay dim behind smoked glass; a brass plaque names the piece and its+rank, and a click opens it on the promotion road. The framed service guide+stands at the runner's start. Its two checkpoints, the dais (`studio`) and the+guide (`levels`), open the Level Hall screen (level-system.md §6).## 6. Plandiff --git a/jarvis/progression/rules.py b/jarvis/progression/rules.pyindex cebf1f07f5..a98d5f082a 100644--- a/jarvis/progression/rules.py+++ b/jarvis/progression/rules.py@@ -16,9 +16,10 @@ system works with any single key and costs no tokens (AP-21).The level curve is front-loaded the way long-running progression usually is:level 2 arrives within the first few actions, level 10 after about a week of-ordinary use, level 50 after several months. Every level pays a cosmetic,-a frame or a new title band at a fixed milestone (:data:`REWARDS`,-:data:`TITLES`). ``docs/agent-society/level-system.md`` is the readable+ordinary use, level 50 after several months. Levels climb a military rank+ladder (:data:`RANKS`): a promotion every two or three levels, from private+to the five-star general at the cap, and promotions unlock real uniform+pieces (:data:`REWARDS`). ``docs/agent-society/level-system.md`` is the readableversion of this file; the parity test pins the frontend's copy of the ids."""@@ -142,10 +143,45 @@ RULES_BY_SOURCE: Final[dict[str, XpRule]] = {rule.source: rule for rule in RULESWORLD_ACTIONS: Final[frozenset[str]] = frozenset(r.source for r in RULES if r.trigger == "world")+# ------------------------------------------------------------------ ranks++#: The rank ladder every subject climbs, lowest first: (first level, rank id,+#: pay grade). The person, every agent and the pet share it, so a rank means+#: the same thing on every name plate. Enlisted grades come first, then the+#: commissioned grades up to the five-star general at the cap. The frontend+#: draws each rank's insignia and translates ``society.level.title.<id>``.+RANKS: Final[tuple[tuple[int, str, str], ...]] = (+ (1, "private", "E-1"),+ (2, "private_second_class", "E-2"),+ (4, "private_first_class", "E-3"),+ (6, "specialist", "E-4"),+ (8, "corporal", "E-4"),+ (10, "sergeant", "E-5"),+ (12, "staff_sergeant", "E-6"),+ (14, "sergeant_first_class", "E-7"),+ (16, "master_sergeant", "E-8"),+ (18, "first_sergeant", "E-8"),+ (20, "sergeant_major", "E-9"),+ (22, "command_sergeant_major", "E-9"),+ (24, "sergeant_major_of_the_army", "E-9"),+ (26, "second_lieutenant", "O-1"),+ (28, "first_lieutenant", "O-2"),+ (30, "captain", "O-3"),+ (32, "major", "O-4"),+ (34, "lieutenant_colonel", "O-5"),+ (36, "colonel", "O-6"),+ (38, "brigadier_general", "O-7"),+ (41, "major_general", "O-8"),+ (44, "lieutenant_general", "O-9"),+ (47, "general", "O-10"),+ (50, "general_of_the_army", "O-11"),+)++# ------------------------------------------------------------------ rewards-Slot = Literal["frame", "trail", "aura", "gadget"]-SLOTS: Final[tuple[Slot, ...]] = ("frame", "trail", "aura", "gadget")+Slot = Literal["uniform", "headwear", "decoration"]+SLOTS: Final[tuple[Slot, ...]] = ("uniform", "headwear", "decoration")@dataclass(frozen=True, slots=True)@@ -161,25 +197,23 @@ class Reward:return {"person": self.person, "agent": self.agent, "pet": self.pet}[kind]+#: Real uniform pieces, each unlocking on a promotion. Agents keep the outfit+#: their owner dressed them in, so they earn decorations only; the pet has no+#: body to dress and shows its rank on its name plate.REWARDS: Final[tuple[Reward, ...]] = (- Reward("frame_bronze", "frame", person=3, agent=3, pet=3),- Reward("frame_silver", "frame", person=10, agent=10, pet=10),- Reward("frame_gold", "frame", person=20, agent=20, pet=20),- Reward("frame_diamond", "frame", person=50, agent=40, pet=40),- Reward("trail_footprints", "trail", person=2, agent=None, pet=None),- Reward("trail_sparkle", "trail", person=5, agent=5, pet=2),- Reward("trail_comet", "trail", person=12, agent=15, pet=12),- Reward("trail_neon", "trail", person=20, agent=25, pet=None),- Reward("trail_rainbow", "trail", person=30, agent=35, pet=25),- Reward("trail_stardust", "trail", person=45, agent=None, pet=35),- Reward("aura_glow", "aura", person=7, agent=8, pet=5),- Reward("aura_runes", "aura", person=15, agent=18, pet=15),- Reward("aura_storm", "aura", person=35, agent=30, pet=None),- Reward("aura_legend", "aura", person=50, agent=50, pet=50),- Reward("gadget_drone", "gadget", person=10, agent=12, pet=None),- Reward("gadget_halo", "gadget", person=18, agent=20, pet=8),- Reward("gadget_crown", "gadget", person=25, agent=None, pet=20),- Reward("gadget_wings", "gadget", person=40, agent=45, pet=None),+ Reward("uniform_service_shirt", "uniform", person=4, agent=None, pet=None),+ Reward("uniform_field_jacket", "uniform", person=10, agent=None, pet=None),+ Reward("uniform_service_greens", "uniform", person=20, agent=None, pet=None),+ Reward("uniform_dress_blues", "uniform", person=26, agent=None, pet=None),+ Reward("uniform_mess_dress", "uniform", person=41, agent=None, pet=None),+ Reward("headwear_patrol_cap", "headwear", person=6, agent=None, pet=None),+ Reward("headwear_garrison_cap", "headwear", person=14, agent=None, pet=None),+ Reward("headwear_beret", "headwear", person=24, agent=None, pet=None),+ Reward("headwear_service_cap", "headwear", person=32, agent=None, pet=None),+ Reward("decoration_ribbon_bar", "decoration", person=8, agent=3, pet=None),+ Reward("decoration_ribbon_rack", "decoration", person=18, agent=16, pet=None),+ Reward("decoration_aiguillette", "decoration", person=36, agent=32, pet=None),+ Reward("decoration_medals", "decoration", person=47, agent=44, pet=None),)@@ -197,22 +231,15 @@ def rewards_between(kind: SubjectKind, before: int, after: int) -> list[Reward]:# ------------------------------------------------------------------ titles-#: Title bands per kind: (first level of the band, title id). The frontend-#: translates ``society.level.title.<id>``.+_RANK_BANDS: Final[tuple[tuple[int, str], ...]] = tuple((level, rank) for level, rank, _ in RANKS)++#: Title bands per kind: (first level of the band, title id). Every kind wears+#: the rank ladder, so the bands are the same; the per-kind shape stays so the+#: API can give a kind its own ladder later without a contract change.TITLES: Final[dict[SubjectKind, tuple[tuple[int, str], ...]]] = {- "person": (- (1, "newcomer"), (5, "apprentice"), (10, "operator"), (15, "specialist"),- (20, "strategist"), (25, "architect"), (30, "commander"), (40, "visionary"),- (50, "legend"),- ),- "agent": (- (1, "rookie"), (5, "trainee"), (10, "associate"), (15, "professional"),- (20, "expert"), (30, "veteran"), (40, "elite"), (50, "grandmaster"),- ),- "pet": (- (1, "hatchling"), (5, "buddy"), (10, "sidekick"), (20, "partner"),- (30, "guardian"), (40, "champion"), (50, "mythic"),- ),+ "person": _RANK_BANDS,+ "agent": _RANK_BANDS,+ "pet": _RANK_BANDS,}diff --git a/jarvis/ui/web/frontend/src/components/society/office/LevelHall.tsx b/jarvis/ui/web/frontend/src/components/society/office/LevelHall.tsxindex 8a4702e9a9..d29c68d8d1 100644--- a/jarvis/ui/web/frontend/src/components/society/office/LevelHall.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/LevelHall.tsx@@ -1,100 +1,88 @@/**- * The Level Hall: the agents floor's east wing, built like the trophy hall of- * a game. Midnight stone and brass, lit from within.+ * The Level Hall: the agents floor's east wing, a hall of honour. Cream and+ * charcoal marble underfoot, walnut and brass, a red runner up the middle,+ * and every piece on show is the real one — the same geometry the figures+ * wear.*- * - The Level Wall on the north wall: a live screen with the person's level,- * title, XP bar and the next reward, between two lit brass pillars.- * - The Upgrade Studio's stage in front of it: a round disc with a glowing- * rim and a slowly turning ring of marks. Stepping on it opens the studio.- * - The Level Road down the middle: a lit runway whose chevrons point up the- * levels, lined with a pedestal per reward. Each pedestal shows its reward- * as a small hologram in a glass case: lit once unlocked, a dark silhouette- * while locked, and the next unlock under a pulsing gold beam. A click on a- * pedestal opens that reward on the reward road.- * - The level guide at the road's start: a free-standing screen, the same on- * both faces, listing how XP is earned.+ * - The rank wall on the north wall: a walnut-framed shadow box holding all+ * 24 rank insignia on navy velvet, in two rows like a service chart —+ * enlisted and NCO ranks above, officers and generals below. Ranks the+ * person holds or held are struck in gold and silver, the current one is+ * framed in brass, the ones ahead are pewter silhouettes. A brass plaque+ * below reads the person's rank, level, XP and next promotion.+ * - The studio dais in front of it: a round walnut platform with a brass+ * ring and star inlay. Stepping on it opens the studio.+ * - Display cases along the runner, one per uniform piece, lowest unlock at+ * the south end: a mannequin in the uniform (wearing the person's own rank+ * insignia), a cap on a velvet head form, or ribbons and medals on a slanted+ * velvet board — exactly the pieces the figure wears. An unlocked case is+ * lit; a locked one stays dim behind smoked glass. A brass plaque on each+ * names the piece and the rank that brings it. A click opens it on the+ * promotion road.+ * - The service guide at the runner's start: a framed, double-sided board+ * listing how XP is earned.** Same rules as OfficeProps: every piece is built in local space centred on- * the origin, front facing +z, inside its `FURNITURE_SIZE` box; the light- * shaft and the lamps over the stage live in `LevelHallFittings`. The world- * keeps one palette in light and dark mode (office-map.md §2).+ * the origin, front facing +z, inside its `FURNITURE_SIZE` box; the lights+ * over the dais live in `LevelHallFittings`. The world keeps one palette in+ * light and dark mode (office-map.md §2).*/import { memo, useEffect, useMemo, useRef } from "react";-import { useFrame, type ThreeEvent } from "@react-three/fiber";+import { type ThreeEvent } from "@react-three/fiber";import {- AdditiveBlending, CanvasTexture, ConeGeometry, CylinderGeometry, DoubleSide, MeshBasicMaterial, MeshStandardMaterial,- RepeatWrapping, SphereGeometry, SRGBColorSpace, TorusGeometry, type Group, type Mesh, type Texture,+ CanvasTexture, CylinderGeometry, DoubleSide, MeshStandardMaterial, RepeatWrapping, Shape, ShapeGeometry, SRGBColorSpace, Vector2,+ type Texture,} from "three";import { useT } from "@/i18n";import { Box, matte, Rounded } from "./OfficeFurniture";import { cachedCanvasTexture, redrawWhenFontsLoad } from "./canvasMaterials";import { FURNITURE_SIZE, type Furniture, type FurnitureKind } from "./officeLayout";-import { levelFraction, nextUnlock, rewardRoad } from "../progression/cosmetics";-import { EFFECT_COLOURS, FRAME_STYLE, slotOf, type RewardId } from "../progression/levelCatalog";-import { useFrameStyle } from "../progression/LevelHud";+import { ToyFigure } from "./ToyFigure";+import { TOY, toyLookFor, type ToyLook } from "./toyFigureModel";+import { equippedFor, levelFraction, rewardRoad } from "../progression/cosmetics";+import { RANK_INFO, rankAt, slotOf, TITLE_IDS, type RankId, type RewardId } from "../progression/levelCatalog";import { PERSON_SUBJECT, type XpRuleRow } from "../progression/progressionApi";import { useProgression } from "../progression/progressionStore";-import { glowTexture } from "../progression/effects/flairTextures";+import { insigniaHeight, RankInsignia3D } from "../progression/regalia/insignia3d";+import { Aiguillette, BreastDecoration } from "../progression/regalia/decorations3d";+import { dressedLook, regaliaFor, type UniformId } from "../progression/regalia/dress";+import { Headwear, type HeadwearId } from "../progression/regalia/headwear3d";-type Vec3 = [number, number, number];type Ctx = CanvasRenderingContext2D;// ----------------------------------------------------------------------------// Materials: midnight stone, brass, cream marble and light.+// Materials: walnut, brass, navy velvet, glass.// ---------------------------------------------------------------------------const C = {- midnight: "#141b36",- navy: "#1d2b52",- ink: "#0d1228",- brass: "#d9b25c",- gold: "#ffd76e",- marble: "#efe8da",- marbleVein: "#d8cfbf",- cyan: "#8fe3ff",- locked: "#3a4570",+ walnut: "#4a2f1f",+ walnutDark: "#2c1b12",+ brass: "#c9a24a",+ velvet: "#1a2240",+ ink: "#141a2e",+ cream: "#efe8d8",} as const;const HM = {- midnight: matte(C.midnight, { roughness: 0.35, metalness: 0.25 }),- navy: matte(C.navy, { roughness: 0.5 }),- ink: matte(C.ink, { roughness: 0.3, metalness: 0.3 }),- brass: matte(C.brass, { roughness: 0.28, metalness: 0.75 }),- marble: matte(C.marble, { roughness: 0.32 }),- marbleVein: matte(C.marbleVein, { roughness: 0.4 }),- // Light strips and rings: lit from within, so they read as light in any scene lighting.- gold: new MeshStandardMaterial({ color: C.gold, emissive: C.gold, emissiveIntensity: 1.5, toneMapped: false }),- cyan: new MeshStandardMaterial({ color: C.cyan, emissive: C.cyan, emissiveIntensity: 1.3, toneMapped: false }),- glass: new MeshStandardMaterial({ color: "#d6ecff", transparent: true, opacity: 0.16, roughness: 0.04, depthWrite: false, side: DoubleSide }),- locked: new MeshStandardMaterial({ color: C.locked, roughness: 0.6, transparent: true, opacity: 0.75 }),-};--const GEO = {- disc: new CylinderGeometry(1, 1, 1, 48),- hex: new CylinderGeometry(1, 1, 1, 6),- ring: new TorusGeometry(1, 0.016, 8, 64),- ball: new SphereGeometry(1, 14, 10),- cone: new ConeGeometry(1, 1, 5),- rotor: new CylinderGeometry(1, 1, 1, 12),- shaft: new CylinderGeometry(0.55, 1.6, 2.9, 32, 1, true),- beam: new CylinderGeometry(0.2, 0.26, 1.5, 20, 1, true),+ walnut: matte(C.walnut, { roughness: 0.45 }),+ walnutDark: matte(C.walnutDark, { roughness: 0.4 }),+ brass: matte(C.brass, { roughness: 0.3, metalness: 0.7 }),+ velvet: matte(C.velvet, { roughness: 1 }),+ cream: matte(C.cream, { roughness: 0.5 }),+ ink: matte(C.ink, { roughness: 0.5 }),+ glass: new MeshStandardMaterial({ color: "#e4f0ff", transparent: true, opacity: 0.12, roughness: 0.05, metalness: 0.1, depthWrite: false, side: DoubleSide }),+ /** A locked case: smoked glass. */+ smoked: new MeshStandardMaterial({ color: "#20242e", transparent: true, opacity: 0.42, roughness: 0.1, depthWrite: false, side: DoubleSide }),+ /** The light panel inside the top of a lit case. */+ caseLight: new MeshStandardMaterial({ color: "#fff4dc", emissive: "#fff1d0", emissiveIntensity: 1.6, toneMapped: false }),+ caseDark: matte("#191b22", { roughness: 0.8 }),};const FONT = '"Inter Variable", "Inter", system-ui, sans-serif';--/** Lit material per colour, shared by every hologram. */-const litCache = new Map<string, MeshStandardMaterial>();-function lit(colour: string): MeshStandardMaterial {- let material = litCache.get(colour);- if (!material) {- material = new MeshStandardMaterial({ color: colour, emissive: colour, emissiveIntensity: 0.9, roughness: 0.3, metalness: 0.2, toneMapped: false });- litCache.set(colour, material);- }- return material;-}+const SERIF = 'Georgia, "Times New Roman", serif';// ----------------------------------------------------------------------------// Live canvas faces+// Canvas faces// ---------------------------------------------------------------------------/**@@ -125,7 +113,7 @@ function useLiveTexture(w: number, h: number, signature: string, draw: (ctx: Ctxtry {ctx = canvas?.getContext("2d") ?? null;} catch {- // jsdom without the canvas package throws "not implemented": the screen keeps its dark glass, which is honest.+ // jsdom without the canvas package throws "not implemented": the plaque keeps its plain face, which is honest.ctx = null;}if (!ctx || !texture) return;@@ -148,379 +136,277 @@ function fitText(ctx: Ctx, text: string, maxWidth: number): string {return `${cut}…`;}-function hexPath(ctx: Ctx, cx: number, cy: number, r: number): void {- ctx.beginPath();- for (let i = 0; i < 6; i += 1) {- const a = Math.PI / 6 + (i * Math.PI) / 3;- const x = cx + Math.cos(a) * r, y = cy + Math.sin(a) * r;- if (i === 0) ctx.moveTo(x, y); else ctx.lineTo(x, y);- }- ctx.closePath();-}--/** The screen's dark glass: a deep gradient, a faint grid and a soft vignette. */-function screenGround(ctx: Ctx, w: number, h: number): void {- const bg = ctx.createLinearGradient(0, 0, 0, h);- bg.addColorStop(0, "#1b2552");- bg.addColorStop(1, "#0b1030");- ctx.fillStyle = bg;- ctx.fillRect(0, 0, w, h);- ctx.strokeStyle = "rgba(143,227,255,0.06)";- ctx.lineWidth = 1;- for (let x = 0; x < w; x += 48) { ctx.beginPath(); ctx.moveTo(x, 0); ctx.lineTo(x, h); ctx.stroke(); }- for (let y = 0; y < h; y += 48) { ctx.beginPath(); ctx.moveTo(0, y); ctx.lineTo(w, y); ctx.stroke(); }- const glow = ctx.createRadialGradient(w * 0.3, h * 0.45, 10, w * 0.3, h * 0.45, w * 0.6);- glow.addColorStop(0, "rgba(255,215,110,0.16)");- glow.addColorStop(1, "rgba(255,215,110,0)");- ctx.fillStyle = glow;+/** Polished brass: a vertical sheen, a bevelled edge and engraved (dark, inset) text. */+function brassGround(ctx: Ctx, w: number, h: number): void {+ const g = ctx.createLinearGradient(0, 0, 0, h);+ g.addColorStop(0, "#e6c97f");+ g.addColorStop(0.45, "#c9a24a");+ g.addColorStop(1, "#9c7a2e");+ ctx.fillStyle = g;ctx.fillRect(0, 0, w, h);+ ctx.strokeStyle = "rgba(60,40,8,0.55)";+ ctx.lineWidth = Math.max(2, h * 0.04);+ ctx.strokeRect(ctx.lineWidth, ctx.lineWidth, w - ctx.lineWidth * 2, h - ctx.lineWidth * 2);}-interface WallLines {- level: number;- levelWord: string;- title: string;- xp: string;- toNext: string;- nextLabel: string;- nextName: string;- nextAt: string;- nextColours: [string, string];- hall: string;+function engrave(ctx: Ctx, text: string, x: number, y: number): void {+ ctx.fillStyle = "rgba(255,240,200,0.45)";+ ctx.fillText(text, x, y + 1.5);+ ctx.fillStyle = "#3a2a0c";+ ctx.fillText(text, x, y);}-function drawWall(ctx: Ctx, w: number, h: number, lines: WallLines, fraction: number, frame: { ring: string; fill: string; ink: string }): void {- screenGround(ctx, w, h);- ctx.textBaseline = "middle";- // The hall's name across the top.- ctx.fillStyle = "rgba(255,215,110,0.85)";- ctx.font = `700 34px ${FONT}`;- ctx.textAlign = "center";- ctx.fillText(fitText(ctx, lines.hall.toUpperCase(), w - 120), w / 2, 52);- ctx.textAlign = "left";- // The level badge: a hexagon in the person's frame colours.- const bx = 250, by = 330, br = 170;- ctx.save();- ctx.shadowColor = frame.ring;- ctx.shadowBlur = 40;- hexPath(ctx, bx, by, br);- ctx.fillStyle = frame.fill;- ctx.fill();- ctx.restore();- hexPath(ctx, bx, by, br);- ctx.lineWidth = 14;- ctx.strokeStyle = frame.ring;- ctx.stroke();- ctx.fillStyle = frame.ink;- ctx.textAlign = "center";- ctx.font = `600 34px ${FONT}`;- ctx.fillText(lines.levelWord.toUpperCase(), bx, by - 78);- ctx.font = `800 150px ${FONT}`;- ctx.fillText(String(lines.level), bx, by + 22);- ctx.textAlign = "left";- // Title, XP bar and what is missing.- const x0 = 480, barW = 600;- ctx.fillStyle = "#ffffff";- ctx.font = `800 76px ${FONT}`;- ctx.fillText(fitText(ctx, lines.title, w - x0 - 60), x0, 230);- const barY = 318, barH = 34;- ctx.fillStyle = "rgba(255,255,255,0.12)";- ctx.beginPath(); ctx.roundRect(x0, barY, barW, barH, barH / 2); ctx.fill();- const grad = ctx.createLinearGradient(x0, 0, x0 + barW, 0);- grad.addColorStop(0, "#ffb347");- grad.addColorStop(1, "#ffe08a");- ctx.fillStyle = grad;- ctx.beginPath(); ctx.roundRect(x0, barY, Math.max(barH, barW * fraction), barH, barH / 2); ctx.fill();- ctx.fillStyle = "#ffe9b0";- ctx.font = `700 38px ${FONT}`;- ctx.fillText(lines.xp, x0 + barW + 30, barY + barH / 2);- ctx.fillStyle = "rgba(255,255,255,0.78)";- ctx.font = `500 36px ${FONT}`;- ctx.fillText(fitText(ctx, lines.toNext, w - x0 - 60), x0, 400);- // The next reward.- const cardY = 460, cardH = 120, cardW = w - x0 - 60;- ctx.fillStyle = "rgba(255,255,255,0.07)";- ctx.beginPath(); ctx.roundRect(x0, cardY, cardW, cardH, 22); ctx.fill();- ctx.strokeStyle = "rgba(255,215,110,0.45)";- ctx.lineWidth = 3;- ctx.stroke();- const tile = ctx.createLinearGradient(x0 + 24, cardY + 20, x0 + 104, cardY + 100);- tile.addColorStop(0, lines.nextColours[0]);- tile.addColorStop(1, lines.nextColours[1]);- ctx.fillStyle = tile;- ctx.beginPath(); ctx.roundRect(x0 + 24, cardY + 20, 80, 80, 18); ctx.fill();- ctx.fillStyle = "rgba(255,215,110,0.95)";- ctx.font = `700 28px ${FONT}`;- ctx.fillText(fitText(ctx, lines.nextLabel.toUpperCase(), cardW - 160), x0 + 130, cardY + 38);- ctx.fillStyle = "#ffffff";- ctx.font = `700 40px ${FONT}`;- const name = fitText(ctx, lines.nextName, cardW - 160 - (lines.nextAt ? 220 : 0));- ctx.fillText(name, x0 + 130, cardY + 82);- if (lines.nextAt) {- ctx.textAlign = "right";- ctx.fillStyle = "rgba(255,255,255,0.7)";- ctx.font = `600 32px ${FONT}`;- ctx.fillText(lines.nextAt, x0 + cardW - 28, cardY + 82);- ctx.textAlign = "left";- }-}+const plateCache = new Map<string, MeshStandardMaterial>();-/** A reward's two tile colours: its frame ring and fill, or its effect's first and last colour. */-export function rewardColours(reward: RewardId): [string, string] {- if (slotOf(reward) === "frame") {- const style = FRAME_STYLE[reward as keyof typeof FRAME_STYLE];- return [style.ring, style.fill];+/** A brass plaque material with up to two engraved lines, cached by its text. */+function plaqueMaterial(lines: readonly string[], w = 512, h = 128): MeshStandardMaterial {+ const key = `hall-plaque:${w}x${h}:${lines.join("|")}`;+ const draw = (ctx: Ctx, cw: number, ch: number) => {+ brassGround(ctx, cw, ch);+ ctx.textAlign = "center";+ ctx.textBaseline = "middle";+ if (lines.length === 1) {+ ctx.font = `700 ${Math.round(ch * 0.42)}px ${SERIF}`;+ engrave(ctx, fitText(ctx, lines[0], cw - 40), cw / 2, ch / 2);+ } else {+ ctx.font = `700 ${Math.round(ch * 0.3)}px ${SERIF}`;+ engrave(ctx, fitText(ctx, lines[0], cw - 36), cw / 2, ch * 0.36);+ ctx.font = `600 ${Math.round(ch * 0.2)}px ${FONT}`;+ engrave(ctx, fitText(ctx, lines[1], cw - 36), cw / 2, ch * 0.72);+ }+ };+ let material = plateCache.get(key);+ if (!material) {+ const map = cachedCanvasTexture(key, w, h, draw);+ redrawWhenFontsLoad(key, map, [`700 40px ${FONT}`], draw);+ material = new MeshStandardMaterial({ color: map ? "#ffffff" : C.brass, map, roughness: 0.35, metalness: 0.45 });+ plateCache.set(key, material);}- const colours = EFFECT_COLOURS[reward as keyof typeof EFFECT_COLOURS];- return [colours[0], colours[colours.length - 1]];+ return material;}// ----------------------------------------------------------------------------// The Level Wall+// The rank wall// ----------------------------------------------------------------------------const WALL = { w: FURNITURE_SIZE.levelWall.w, h: FURNITURE_SIZE.levelWall.h, d: FURNITURE_SIZE.levelWall.d, screenW: 5.0, screenH: 2.08, screenY: 1.72 };+const WALL = { w: FURNITURE_SIZE.levelWall.w, h: FURNITURE_SIZE.levelWall.h, d: FURNITURE_SIZE.levelWall.d };+/** The velvet field inside the frame, and the two rows of ranks in it. */+const FIELD = { w: 6.0, h: 1.72, y: 1.83 };+const ROWS: readonly (readonly RankId[])[] = [TITLE_IDS.slice(0, 13), TITLE_IDS.slice(13)];+const CELL = FIELD.w / 13;-function LevelWall() {+function RankCell({ rank, reached, current, x, y, levelAt }: { rank: RankId; reached: boolean; current: boolean; x: number; y: number; levelAt: number }) {+ const t = useT();+ // As wide as the cell allows, unless that would make a tall chevron set overrun the row.+ const fitW = CELL * 0.64, maxH = 0.36;+ const width = Math.min(fitW, (fitW * maxH) / insigniaHeight(rank, fitW));+ const label = plaqueMaterial([t(`society.level.title.${rank}`), `${RANK_INFO[rank].grade} · ${t("society.level.lv").replace("{0}", String(levelAt))}`], 320, 112);+ return (+ <group position={[x, y, 0]}>+ {current && (+ <group>+ <Box size={[CELL - 0.03, 0.8, 0.012]} position={[0, -0.02, 0.006]} material={HM.brass} cast={false} />+ <Box size={[CELL - 0.07, 0.76, 0.014]} position={[0, -0.02, 0.008]} material={HM.velvet} cast={false} />+ </group>+ )}+ <group position={[0, 0.12, 0.02]}>+ {rank === "private"+ ? <mesh material={reached ? HM.brass : HM.ink}><torusGeometry args={[0.07, 0.006, 6, 32]} /></mesh>+ : <RankInsignia3D rank={rank} width={width} muted={!reached} />}+ </group>+ <mesh material={label} position={[0, -0.27, 0.018]}>+ <planeGeometry args={[CELL - 0.06, (CELL - 0.06) * (112 / 320)]} />+ </mesh>+ </group>+ );+}++interface StatusLines { hall: string; rank: string; grade: string; level: string; xp: string; next: string }++function drawStatus(ctx: Ctx, w: number, h: number, lines: StatusLines, fraction: number): void {+ brassGround(ctx, w, h);+ ctx.textBaseline = "middle";+ ctx.textAlign = "left";+ ctx.font = `700 ${Math.round(h * 0.2)}px ${SERIF}`;+ engrave(ctx, fitText(ctx, lines.rank, w * 0.5), 40, h * 0.32);+ ctx.font = `600 ${Math.round(h * 0.12)}px ${FONT}`;+ engrave(ctx, fitText(ctx, `${lines.grade} · ${lines.level}`, w * 0.5), 40, h * 0.62);+ // The XP bar: an engraved channel filled with dark enamel.+ const bx = w * 0.56, bw = w * 0.4, by = h * 0.26, bh = h * 0.13;+ ctx.fillStyle = "rgba(60,40,8,0.35)";+ ctx.fillRect(bx, by, bw, bh);+ ctx.fillStyle = "#1a2240";+ ctx.fillRect(bx + 3, by + 3, Math.max(0, (bw - 6) * fraction), bh - 6);+ ctx.textAlign = "right";+ ctx.font = `600 ${Math.round(h * 0.12)}px ${FONT}`;+ engrave(ctx, fitText(ctx, lines.xp, bw), bx + bw, h * 0.56);+ engrave(ctx, fitText(ctx, lines.next, bw), bx + bw, h * 0.78);+}++function RankWall() {const t = useT();const person = useProgression((s) => s.subjects[PERSON_SUBJECT]);- const rewards = useProgression((s) => s.snapshot?.rewards);+ const bands = useProgression((s) => s.snapshot?.titles.person);const level = person?.level ?? 1;- const frame = useFrameStyle("person", level);+ const held = rankAt(bands, level);+ const heldIndex = TITLE_IDS.indexOf(held);+ const startOf = (rank: RankId) => bands?.find((b) => b.title === rank)?.level ?? 1;+ const next = bands?.find((band) => band.level > level);const fraction = levelFraction(person);- const next = rewards ? nextUnlock(rewards, "person", level) : undefined;- const lines: WallLines = {- level,- levelWord: t("society.level.level_n").replace("{0}", "").trim(),- title: t(`society.level.title.${person?.title || "newcomer"}`),- xp: person && person.xpForNext > 0 ? t("society.level.xp_of").replace("{0}", String(person.xpIntoLevel)).replace("{1}", String(person.xpForNext)) : "",- toNext: person && person.xpForNext <= 0 ? t("society.level.max")- : t("society.level.to_next").replace("{0}", String(person ? person.xpForNext - person.xpIntoLevel : 40)).replace("{1}", String(level + 1)),- nextLabel: t("society.hall.next_reward"),- nextName: next ? t(`society.level.reward.${next.rewardId}`) : t("society.hall.all_unlocked"),- nextAt: next ? t("society.level.locked_at").replace("{0}", String(next.levels.person)) : "",- nextColours: next ? rewardColours(next.rewardId) : [C.gold, C.brass],+ const lines: StatusLines = {hall: t("society.office.room_levels"),+ rank: t(`society.level.title.${held}`),+ grade: RANK_INFO[held].grade,+ level: t("society.level.level_n").replace("{0}", String(level)),+ xp: person && person.xpForNext > 0+ ? t("society.level.xp_of").replace("{0}", String(person.xpIntoLevel)).replace("{1}", String(person.xpForNext)) : t("society.level.max"),+ next: next ? t("society.level.next_promotion").replace("{0}", t(`society.level.title.${next.title}`)).replace("{1}", String(next.level))+ : t("society.hall.top_title"),};- const signature = JSON.stringify([lines, Math.round(fraction * 200), frame]);- const face = useLiveTexture(1536, 640, signature, (ctx, w, h) => drawWall(ctx, w, h, lines, fraction, frame));+ const status = useLiveTexture(1024, 220, JSON.stringify([lines, Math.round(fraction * 200)]), (ctx, w, h) => drawStatus(ctx, w, h, lines, fraction));+ const header = plaqueMaterial([t("society.office.room_levels").toUpperCase()], 768, 112);return (<group>- {/* Backing panel with a brass frame round the screen. */}- <Box size={[WALL.w, WALL.h, 0.2]} position={[0, WALL.h / 2, -WALL.d / 2 + 0.1]} material={HM.midnight} />- <Box size={[WALL.screenW + 0.24, WALL.screenH + 0.24, 0.06]} position={[0, WALL.screenY, 0.03]} material={HM.brass} />- <mesh position={[0, WALL.screenY, 0.065]}>- <planeGeometry args={[WALL.screenW, WALL.screenH]} />- {face- ? <meshStandardMaterial map={face} emissiveMap={face} emissive="#ffffff" emissiveIntensity={0.85} roughness={0.4} />- : <meshStandardMaterial color={C.ink} roughness={0.3} />}+ {/* Walnut panelling, then the brass-framed velvet field. */}+ <Box size={[WALL.w, WALL.h, 0.18]} position={[0, WALL.h / 2, -WALL.d / 2 + 0.09]} material={HM.walnut} />+ <Box size={[WALL.w, 0.12, 0.24]} position={[0, WALL.h - 0.06, -WALL.d / 2 + 0.12]} material={HM.walnutDark} />+ <Box size={[WALL.w, 0.16, 0.22]} position={[0, 0.08, -WALL.d / 2 + 0.11]} material={HM.walnutDark} />+ <Box size={[FIELD.w + 0.16, FIELD.h + 0.16, 0.08]} position={[0, FIELD.y, 0.0]} material={HM.walnutDark} />+ <Box size={[FIELD.w + 0.06, FIELD.h + 0.06, 0.084]} position={[0, FIELD.y, 0.002]} material={HM.brass} />+ <Box size={[FIELD.w, FIELD.h, 0.088]} position={[0, FIELD.y, 0.004]} material={HM.velvet} />+ <group position={[0, 0, 0.05]}>+ {ROWS.map((row, r) => row.map((rank, i) => {+ const index = TITLE_IDS.indexOf(rank);+ const x = (i - (row.length - 1) / 2) * CELL;+ const y = FIELD.y + (r === 0 ? 0.43 : -0.43);+ return <RankCell key={rank} rank={rank} reached={index <= heldIndex} current={index === heldIndex} x={x} y={y} levelAt={startOf(rank)} />;+ }))}+ </group>+ {/* The hall's name above, the person's record below. */}+ <mesh material={header} position={[0, 2.88, 0.05]}>+ <planeGeometry args={[2.2, 2.2 * (112 / 768)]} />+ </mesh>+ <Box size={[3.0, 0.62, 0.05]} position={[0, 0.56, -0.02]} material={HM.walnutDark} />+ <mesh position={[0, 0.56, 0.008]}>+ <planeGeometry args={[2.84, 2.84 * (220 / 1024)]} />+ {status ? <meshStandardMaterial map={status} roughness={0.35} metalness={0.4} /> : <meshStandardMaterial color={C.brass} roughness={0.35} metalness={0.5} />}</mesh>- {/* Two lit brass pillars either side, a gold strip along the top and the bottom. */}- {[-1, 1].map((side) => (- <group key={side} position={[side * (WALL.w / 2 - 0.3), 0, 0]}>- <Box size={[0.4, WALL.h, 0.3]} position={[0, WALL.h / 2, -0.02]} material={HM.navy} />- <Box size={[0.07, WALL.h - 0.4, 0.04]} position={[0, WALL.h / 2, 0.14]} material={HM.gold} cast={false} />- <Box size={[0.46, 0.08, 0.34]} position={[0, WALL.h - 0.04, -0.02]} material={HM.brass} />- <Box size={[0.46, 0.12, 0.34]} position={[0, 0.06, -0.02]} material={HM.brass} />- </group>- ))}- <Box size={[WALL.screenW, 0.04, 0.04]} position={[0, WALL.screenY + WALL.screenH / 2 + 0.22, 0.05]} material={HM.gold} cast={false} />- <Box size={[WALL.screenW, 0.04, 0.04]} position={[0, WALL.screenY - WALL.screenH / 2 - 0.22, 0.05]} material={HM.gold} cast={false} /></group>);}// ----------------------------------------------------------------------------// The Upgrade Studio's stage+// The studio dais// ---------------------------------------------------------------------------const STAGE_R = FURNITURE_SIZE.studioStage.w / 2 - 0.04;+const GEO = { disc: new CylinderGeometry(1, 1, 1, 64) };++/** The dais's inlaid star, its points `r` from the centre. */+function starShape(r: number): Shape {+ return new Shape(Array.from({ length: 10 }, (_, i) => {+ const a = -Math.PI / 2 + (i * Math.PI) / 5;+ const rr = i % 2 === 0 ? r : r * 0.4;+ return new Vector2(Math.cos(a) * rr, Math.sin(a) * rr);+ }));+}++const STAR = new ShapeGeometry(starShape(STAGE_R * 0.32));-/** The stage disc; the Upgrade Studio's preview stands its figure on the same one. */+/** The studio dais; the studio's preview stands its figure on the same one. */export function StudioStage() {- const marks = useRef<Group>(null);- useFrame((_, dt) => { if (marks.current) marks.current.rotation.y += Math.min(dt, 0.1) * 0.22; });- const glow = useMemo(() => new MeshBasicMaterial({- map: glowTexture(), color: C.gold, transparent: true, opacity: 0.35, blending: AdditiveBlending, depthWrite: false,- }), []);- useEffect(() => () => glow.dispose(), [glow]);return (<group>- {/* Flat on purpose: figures stand at y 0 and auras glow at 0.018 m, so nothing here rises above ~0.015 m. */}- <mesh geometry={GEO.disc} material={HM.midnight} position={[0, 0.004, 0]} scale={[STAGE_R, 0.008, STAGE_R]} receiveShadow />- <mesh geometry={GEO.disc} material={HM.brass} position={[0, 0.009, 0]} scale={[STAGE_R * 0.98, 0.002, STAGE_R * 0.98]} />- <mesh geometry={GEO.disc} material={HM.navy} position={[0, 0.011, 0]} scale={[STAGE_R * 0.9, 0.002, STAGE_R * 0.9]} receiveShadow />- <mesh geometry={GEO.ring} material={HM.gold} position={[0, 0.013, 0]} rotation={[Math.PI / 2, 0, 0]} scale={[STAGE_R * 0.95, STAGE_R * 0.95, 0.5]} />- <mesh geometry={GEO.ring} material={HM.brass} position={[0, 0.012, 0]} rotation={[Math.PI / 2, 0, 0]} scale={[STAGE_R * 0.55, STAGE_R * 0.55, 0.4]} />- <mesh material={glow} position={[0, 0.014, 0]} rotation={[-Math.PI / 2, 0, 0]}>- <circleGeometry args={[STAGE_R * 0.75, 40]} />- </mesh>- <group ref={marks} position={[0, 0.013, 0]}>- {Array.from({ length: 16 }, (_, i) => {- const a = (i / 16) * Math.PI * 2, r = STAGE_R * 0.74;- return <Box key={i} size={[0.14, 0.008, 0.035]} position={[Math.cos(a) * r, 0, Math.sin(a) * r]} material={i % 4 === 0 ? HM.gold : HM.cyan} cast={false} />;- })}- </group>+ {/* Flat on purpose: figures stand at y 0, so nothing here rises above ~0.016 m. */}+ <mesh geometry={GEO.disc} material={HM.walnutDark} position={[0, 0.005, 0]} scale={[STAGE_R, 0.01, STAGE_R]} receiveShadow />+ <mesh geometry={GEO.disc} material={HM.brass} position={[0, 0.0105, 0]} scale={[STAGE_R * 0.97, 0.001, STAGE_R * 0.97]} />+ <mesh geometry={GEO.disc} material={HM.walnut} position={[0, 0.0115, 0]} scale={[STAGE_R * 0.94, 0.002, STAGE_R * 0.94]} receiveShadow />+ <mesh geometry={GEO.disc} material={HM.brass} position={[0, 0.0128, 0]} scale={[STAGE_R * 0.56, 0.001, STAGE_R * 0.56]} />+ <mesh geometry={GEO.disc} material={HM.walnut} position={[0, 0.0136, 0]} scale={[STAGE_R * 0.54, 0.0012, STAGE_R * 0.54]} receiveShadow />+ <mesh geometry={STAR} material={HM.brass} position={[0, 0.0146, 0]} rotation={[-Math.PI / 2, 0, 0]} /></group>);}// ----------------------------------------------------------------------------// Reward pedestals and their holograms+// Display cases// ----------------------------------------------------------------------------/** A reward as a small model, about 0.36 m across: lit in its own colours, or a dark silhouette while locked. */-function RewardMini({ reward, open }: { reward: RewardId; open: boolean }) {+const CASE = { w: 0.7, d: 0.7 };++/** A neutral display mannequin: stone-grey, no hair, no face. */+const MANNEQUIN: ToyLook = { ...toyLookFor(null, "hall-mannequin"), skin: "#cfc9bd", hairStyle: "bald", blush: false, eyewear: "none" };+const STILL = { current: { mode: "idle" as const, speed: 0 } };++/** What a case shows: the piece as the person would wear it at their own rank. */+function CaseContent({ reward, rank, open }: { reward: RewardId; rank: RankId; open: boolean }) {const slot = slotOf(reward);- const [a, b] = rewardColours(reward);- const effect = slot === "frame" ? [a, b] : EFFECT_COLOURS[reward as keyof typeof EFFECT_COLOURS];- const m = (colour: string) => (open ? lit(colour) : HM.locked);- if (slot === "frame") {- return (- <group rotation={[Math.PI / 2, 0, 0]}>- <mesh geometry={GEO.hex} material={m(a)} scale={[0.17, 0.05, 0.17]} />- <mesh geometry={GEO.hex} material={m(b)} position={[0, 0.03, 0]} scale={[0.12, 0.02, 0.12]} />- <mesh geometry={GEO.hex} material={m(b)} position={[0, -0.03, 0]} scale={[0.12, 0.02, 0.12]} />- </group>- );- }- if (slot === "trail") {- // A rising spiral of beads, each in the trail's colours.- return (- <group>- {Array.from({ length: 7 }, (_, i) => {- const angle = i * 0.95, r = 0.05 + i * 0.018;- return <mesh key={i} geometry={GEO.ball} material={m(effect[i % effect.length])}- position={[Math.cos(angle) * r, -0.15 + i * 0.05, Math.sin(angle) * r]} scale={0.022 + i * 0.006} />;- })}- </group>- );- }- if (slot === "aura") {- return (- <group position={[0, -0.1, 0]}>- <mesh geometry={GEO.ring} material={m(effect[0])} rotation={[Math.PI / 2, 0, 0]} scale={[0.17, 0.17, 2.4]} />- <mesh geometry={GEO.ring} material={m(effect[effect.length - 1])} rotation={[Math.PI / 2, 0, 0]} position={[0, 0.03, 0]} scale={[0.11, 0.11, 2]} />- <mesh geometry={GEO.disc} material={m(effect[0])} scale={[0.07, 0.012, 0.07]} />- </group>- );- }- if (reward === "gadget_halo") {- return <mesh geometry={GEO.ring} material={m(effect[0])} rotation={[Math.PI / 2.4, 0, 0]} scale={[0.14, 0.14, 3]} />;- }- if (reward === "gadget_crown") {+ if (slot === "uniform") {+ const regalia = regaliaFor(rank, {});return (- <group position={[0, -0.06, 0]}>- <mesh geometry={GEO.disc} material={m(effect[0])} position={[0, 0.04, 0]} scale={[0.13, 0.08, 0.13]} />- {[0, 1, 2, 3, 4].map((i) => {- const ang = (i / 5) * Math.PI * 2;- return <mesh key={i} geometry={GEO.cone} material={m(effect[0])} position={[Math.sin(ang) * 0.11, 0.12, Math.cos(ang) * 0.11]} scale={[0.028, 0.08, 0.028]} />;- })}- <mesh geometry={GEO.ball} material={m(effect[1] ?? effect[0])} position={[0, 0.05, 0.13]} scale={0.022} />+ <group position={[0, 0.3, 0]}>+ <ToyFigure look={dressedLook(MANNEQUIN, reward as UniformId, rank)} drive={STILL} paused heightM={1.2} regalia={regalia} mannequin />+ {/* The mannequin's stand under its feet. */}+ <mesh geometry={GEO.disc} material={HM.walnutDark} position={[0, -0.005, 0]} scale={[0.2, 0.01, 0.2]} /></group>);}- if (reward === "gadget_wings") {- // Two fans of long feathers.+ if (slot === "headwear") {+ const k = 0.55;return (- <group>- {[-1, 1].map((side) => (- <group key={side} scale={[side, 1, 1]}>- {[0, 1, 2, 3].map((i) => (- <mesh key={i} geometry={GEO.ball} material={m(i % 2 === 0 ? effect[0] : effect[1] ?? effect[0])}- position={[0.06 + i * 0.035, 0.02 + i * 0.02, 0]} rotation={[0, 0, -0.5 + i * 0.35]} scale={[0.11, 0.022, 0.012]} />- ))}- </group>- ))}+ <group position={[0, 0.98, 0]}>+ {/* A velvet head form on a turned walnut neck. */}+ <mesh material={HM.walnut} position={[0, 0.06, 0]}>+ <cylinderGeometry args={[0.035, 0.06, 0.12, 20]} />+ </mesh>+ <group position={[0, 0.12 - (TOY.head.y - TOY.head.ry) * k, 0]} scale={k}>+ <mesh material={HM.velvet} position={[0, TOY.head.y, 0]} scale={[TOY.head.rx, TOY.head.ry, TOY.head.rz]}>+ <sphereGeometry args={[1, 32, 20]} />+ </mesh>+ <Headwear kind={reward as HeadwearId} rank={rank} />+ </group></group>);}- // The helper drone: a body, four rotors and a lens.+ // Decorations lie on a slanted velvet board, three times life size so they read through the glass.+ const corded = reward === "decoration_aiguillette" || reward === "decoration_medals";return (- <group>- <mesh geometry={GEO.disc} material={m(effect[0])} scale={[0.07, 0.035, 0.07]} />- {[[-1, -1], [1, -1], [-1, 1], [1, 1]].map(([sx, sz]) => (- <group key={`${sx}${sz}`} position={[sx * 0.09, 0.02, sz * 0.09]}>- <Box size={[0.012, 0.012, 0.012]} position={[-sx * 0.04, 0, -sz * 0.04]} material={m(effect[0])} cast={false} />- <mesh geometry={GEO.rotor} material={m(effect[1] ?? effect[0])} scale={[0.04, 0.006, 0.04]} />- </group>- ))}- <mesh geometry={GEO.ball} material={m(effect[1] ?? effect[0])} position={[0, -0.02, 0.06]} scale={0.016} />+ <group position={[0, 1.2, -0.04]} rotation={[-0.38, 0, 0]}>+ <Box size={[0.56, 0.42, 0.03]} position={[0, 0, -0.015]} material={HM.velvet} cast={false} />+ <group scale={3} position={[0.02, 0.12, 0.002]}>+ <group position={[0.02, 0, 0]}><BreastDecoration decoration={reward} /></group>+ {corded && <group position={[-0.085, 0.02, 0]}><Aiguillette span={0.08} /></group>}+ </group>+ {!open && <Box size={[0.56, 0.42, 0.002]} position={[0, 0, 0.02]} material={HM.smoked} cast={false} />}</group>);}-const PEDESTAL = { holoY: 1.32, caseY: 1.31, caseH: 0.62, caseW: 0.56 };--/** The level plate on a pedestal's front: the unlock level, the reward's name, a padlock while locked. */-function plateMaterial(at: number, name: string, open: boolean, next: boolean, levelWord: string): MeshStandardMaterial {- const key = `level-plate:${at}:${name}:${open}:${next}:${levelWord}`;- const draw = (ctx: Ctx, w: number, h: number) => {- ctx.fillStyle = open ? "#1d2b52" : "#151b33";- ctx.fillRect(0, 0, w, h);- ctx.strokeStyle = next ? C.gold : open ? C.brass : "#4a5480";- ctx.lineWidth = 8;- ctx.strokeRect(4, 4, w - 8, h - 8);- ctx.textAlign = "center";- ctx.textBaseline = "middle";- ctx.fillStyle = next ? C.gold : open ? "#ffe9b0" : "#9aa3c7";- ctx.font = `800 54px ${FONT}`;- ctx.fillText(`${levelWord} ${at}`.trim(), w / 2, 56);- ctx.fillStyle = open ? "#ffffff" : "#aab2d4";- ctx.font = `600 30px ${FONT}`;- ctx.fillText(fitText(ctx, name, w - 40), w / 2, 120);- if (!open) {- // A small padlock in the corner.- ctx.strokeStyle = "#9aa3c7";- ctx.lineWidth = 5;- ctx.beginPath(); ctx.arc(w - 40, 34, 11, Math.PI, 0); ctx.stroke();- ctx.fillStyle = "#9aa3c7";- ctx.fillRect(w - 56, 34, 32, 24);- }- };- const map = cachedCanvasTexture(key, 384, 168, draw);- redrawWhenFontsLoad(key, map, [`800 54px ${FONT}`, `600 30px ${FONT}`], draw);- let material = plateCache.get(key);- if (!material) {- material = new MeshStandardMaterial({ color: map ? "#ffffff" : "#1d2b52", map, emissive: "#ffffff", emissiveMap: map, emissiveIntensity: map ? 0.55 : 0, roughness: 0.5 });- plateCache.set(key, material);- }- return material;+/** Heights of each case kind: the plinth's top and the glass above it. */+function caseShape(reward: RewardId): { plinth: number; glass: number } {+ const slot = slotOf(reward);+ if (slot === "uniform") return { plinth: 0.28, glass: 1.42 };+ return { plinth: 0.92, glass: 0.72 };}-const plateCache = new Map<string, MeshStandardMaterial>();-function RewardPedestal({ item }: { item: Furniture }) {+function DisplayCase({ item }: { item: Furniture }) {const t = useT();const index = Number(item.id.slice("level-pedestal-".length));const rewards = useProgression((s) => s.snapshot?.rewards);const level = useProgression((s) => s.subjects[PERSON_SUBJECT]?.level ?? 1);+ const bands = useProgression((s) => s.snapshot?.titles.person);+ const choices = useProgression((s) => s.choices.person);const road = useMemo(() => (rewards ? rewardRoad(rewards, "person") : []), [rewards]);- const reward = road[index];- const at = reward?.levels.person ?? 0;- const open = !!reward && level >= at;- const next = !!reward && !!rewards && nextUnlock(rewards, "person", level)?.rewardId === reward.rewardId;- const holo = useRef<Group>(null);- const beam = useRef<Mesh>(null);- useFrame((state, dt) => {- const step = Math.min(dt, 0.1);- if (holo.current) {- holo.current.rotation.y += step * (open ? 0.9 : 0.3);- holo.current.position.y = PEDESTAL.holoY + (open ? Math.sin(state.clock.elapsedTime * 1.6 + index) * 0.025 : 0);- }- if (beam.current) (beam.current.material as MeshBasicMaterial).opacity = 0.18 + 0.14 * Math.sin(state.clock.elapsedTime * 2.6);- });- const glow = useMemo(() => new MeshBasicMaterial({- map: glowTexture(), color: next ? C.gold : open && reward ? rewardColours(reward.rewardId)[0] : "#6b78b0",- transparent: true, opacity: open || next ? 0.55 : 0.2, blending: AdditiveBlending, depthWrite: false,- }), [next, open, reward]);- const beamMaterial = useMemo(() => new MeshBasicMaterial({- color: C.gold, transparent: true, opacity: 0.25, blending: AdditiveBlending, depthWrite: false, side: DoubleSide,- }), []);- useEffect(() => () => { glow.dispose(); beamMaterial.dispose(); }, [glow, beamMaterial]);+ const row = road[index];+ const reward = row?.rewardId;+ const at = row?.levels.person ?? 0;+ const open = !!row && level >= at;+ const worn = !!row && !!rewards && equippedFor(rewards, "person", level, choices)[row.slot] === reward;+ const rank = rankAt(bands, level);const onClick = (event: ThreeEvent<MouseEvent>) => {if (event.delta > 6 || !reward) return;event.stopPropagation();- useProgression.getState().openPanel("rewards", { subject: "person", reward: reward.rewardId });+ useProgression.getState().openPanel("rewards", { subject: "person", reward });};const hover = (on: boolean) => (event: ThreeEvent<PointerEvent>) => {if (!reward) return;@@ -528,120 +414,126 @@ function RewardPedestal({ item }: { item: Furniture }) {document.body.style.cursor = on ? "pointer" : "";};useEffect(() => () => { document.body.style.cursor = ""; }, []);- const name = reward ? t(`society.level.reward.${reward.rewardId}`) : "";- const levelWord = t("society.level.lv").replace("{0}", "").trim();+ if (!reward) return null;+ const { plinth, glass } = caseShape(reward);+ const top = plinth + glass;+ const state = worn ? t("society.hall.equipped") : open ? t("society.hall.unlocked")+ : `${t(`society.level.title.${rankAt(bands, at)}`)} · ${t("society.level.lv").replace("{0}", String(at))}`;+ const plaque = plaqueMaterial([t(`society.level.reward.${reward}`), state], 448, 128);return (<group onClick={onClick} onPointerOver={hover(true)} onPointerOut={hover(false)}>- {/* Plinth: a brass-banded cream marble column on a midnight base. */}- <Rounded size={[0.74, 0.12, 0.74]} radius={0.03} position={[0, 0.06, 0]} material={HM.midnight} />- <Rounded size={[0.56, 0.82, 0.56]} radius={0.04} position={[0, 0.53, 0]} material={HM.marble} />- <Box size={[0.585, 0.05, 0.585]} position={[0, 0.2, 0]} material={HM.brass} />- <Box size={[0.585, 0.05, 0.585]} position={[0, 0.86, 0]} material={HM.brass} />- <Rounded size={[0.68, 0.07, 0.68]} radius={0.02} position={[0, 0.975, 0]} material={HM.midnight} />- {reward && (- <mesh position={[0, 0.56, 0.282]} material={plateMaterial(at, name, open, next, levelWord)}>- <planeGeometry args={[0.46, 0.2]} />- </mesh>- )}- {/* The glass case, its brass cap and the light under the reward. */}- <mesh position={[0, PEDESTAL.caseY, 0]} material={HM.glass} renderOrder={2}>- <boxGeometry args={[PEDESTAL.caseW, PEDESTAL.caseH, PEDESTAL.caseW]} />+ {/* The walnut plinth with a brass band, a black base and a moulded top. */}+ <Rounded size={[CASE.w + 0.06, 0.08, CASE.d + 0.06]} radius={0.02} position={[0, 0.04, 0]} material={HM.walnutDark} />+ <Box size={[CASE.w, plinth - 0.1, CASE.d]} position={[0, 0.08 + (plinth - 0.1) / 2, 0]} material={HM.walnut} />+ <Box size={[CASE.w + 0.02, 0.025, CASE.d + 0.02]} position={[0, plinth - 0.03, 0]} material={HM.brass} />+ <Box size={[CASE.w + 0.04, 0.03, CASE.d + 0.04]} position={[0, plinth - 0.005, 0]} material={HM.walnutDark} />+ <mesh material={plaque} position={[0, plinth * 0.55, CASE.d / 2 + 0.002]}>+ <planeGeometry args={[0.5, 0.5 * (128 / 448)]} /></mesh>- <Box size={[0.6, 0.04, 0.6]} position={[0, PEDESTAL.caseY + PEDESTAL.caseH / 2 + 0.02, 0]} material={HM.brass} />- <mesh material={glow} position={[0, 1.02, 0]} rotation={[-Math.PI / 2, 0, 0]} renderOrder={1}>- <circleGeometry args={[0.3, 24]} />+ {/* The glass, its four brass posts and the lid with its light. */}+ <mesh position={[0, plinth + glass / 2, 0]} material={open ? HM.glass : HM.smoked} renderOrder={2}>+ <boxGeometry args={[CASE.w - 0.02, glass, CASE.d - 0.02]} /></mesh>- {reward && <group ref={holo} position={[0, PEDESTAL.holoY, 0]}><RewardMini reward={reward.rewardId} open={open} /></group>}- {next && <mesh ref={beam} geometry={GEO.beam} material={beamMaterial} position={[0, 1.02 + 0.75, 0]} renderOrder={3} />}+ {[[-1, -1], [1, -1], [-1, 1], [1, 1]].map(([sx, sz]) => (+ <Box key={`${sx}${sz}`} size={[0.018, glass, 0.018]} position={[sx * (CASE.w / 2 - 0.01), plinth + glass / 2, sz * (CASE.d / 2 - 0.01)]} material={HM.brass} cast={false} />+ ))}+ <Box size={[CASE.w + 0.02, 0.05, CASE.d + 0.02]} position={[0, top + 0.025, 0]} material={HM.walnutDark} />+ <mesh material={open ? HM.caseLight : HM.caseDark} position={[0, top - 0.002, 0]} rotation={[Math.PI / 2, 0, 0]}>+ <planeGeometry args={[CASE.w * 0.6, CASE.d * 0.6]} />+ </mesh>+ <CaseContent reward={reward} rank={rank} open={open} /></group>);}// ----------------------------------------------------------------------------// The Level Road and the level guide+// The runner and the service guide// ----------------------------------------------------------------------------function roadTexture(): Texture | null {- return cachedCanvasTexture("level-road", 256, 512, (ctx, w, h) => {- ctx.fillStyle = "#24336a";+function runnerTexture(): Texture | null {+ return cachedCanvasTexture("hall-runner", 256, 256, (ctx, w, h) => {+ ctx.fillStyle = "#7a1d25";ctx.fillRect(0, 0, w, h);- ctx.fillStyle = "rgba(255,255,255,0.04)";- ctx.fillRect(w * 0.1, 0, w * 0.8, h);- // Brass edges.- ctx.fillStyle = "#d9b25c";- ctx.fillRect(0, 0, 10, h);- ctx.fillRect(w - 10, 0, 10, h);- // Chevrons pointing up the levels (north).- ctx.strokeStyle = "rgba(255,215,110,0.75)";- ctx.lineWidth = 12;- ctx.lineCap = "round";- ctx.lineJoin = "round";- for (const y of [140, 380]) {- ctx.beginPath();- ctx.moveTo(w * 0.28, y + 50);- ctx.lineTo(w * 0.5, y);- ctx.lineTo(w * 0.72, y + 50);- ctx.stroke();- }+ // A fine woven grain.+ ctx.fillStyle = "rgba(0,0,0,0.08)";+ for (let y = 0; y < h; y += 4) ctx.fillRect(0, y, w, 1);+ ctx.fillStyle = "rgba(255,255,255,0.03)";+ for (let x = 0; x < w; x += 6) ctx.fillRect(x, 0, 1, h);+ // Gold borders with a thin inner line.+ ctx.fillStyle = "#c9a24a";+ ctx.fillRect(0, 0, 14, h);+ ctx.fillRect(w - 14, 0, 14, h);+ ctx.fillRect(22, 0, 3, h);+ ctx.fillRect(w - 25, 0, 3, h);});}-function LevelRoad({ w, d }: { w: number; d: number }) {+function Runner({ w, d }: { w: number; d: number }) {const material = useMemo(() => {- const base = roadTexture();+ const base = runnerTexture();const map = base ? base.clone() : null;if (map) {map.wrapS = RepeatWrapping;map.wrapT = RepeatWrapping;- map.repeat.set(1, Math.max(1, Math.round(d / 2.2)));+ map.repeat.set(1, Math.max(1, Math.round(d / w)));map.needsUpdate = true;}- return new MeshStandardMaterial({- color: map ? "#ffffff" : "#24336a", map, emissive: "#ffffff", emissiveMap: map, emissiveIntensity: map ? 0.35 : 0, roughness: 0.35,- });- }, [d]);+ return new MeshStandardMaterial({ color: map ? "#ffffff" : "#7a1d25", map, roughness: 0.95 });+ }, [d, w]);useEffect(() => () => { material.map?.dispose(); material.dispose(); }, [material]);return (<mesh material={material} position={[0, 0.008, 0]} rotation={[-Math.PI / 2, 0, 0]} receiveShadow>- <planeGeometry args={[w, d]} />+ <planeGeometry args={[w * 0.8, d]} /></mesh>);}interface GuideLines { title: string; subtitle: string; rows: { xp: string; text: string }[]; footer: string }+/** The guide's face: cream card stock, a navy rule, rows set like a printed order of service. */function drawGuide(ctx: Ctx, w: number, h: number, lines: GuideLines): void {- screenGround(ctx, w, h);+ ctx.fillStyle = "#f2ecdd";+ ctx.fillRect(0, 0, w, h);+ ctx.strokeStyle = "#1a2240";+ ctx.lineWidth = 6;+ ctx.strokeRect(24, 24, w - 48, h - 48);+ ctx.lineWidth = 1.5;+ ctx.strokeRect(36, 36, w - 72, h - 72);ctx.textBaseline = "middle";- ctx.fillStyle = C.gold;- ctx.font = `800 64px ${FONT}`;- ctx.fillText(fitText(ctx, lines.title, w - 100), 56, 74);- ctx.fillStyle = "rgba(255,255,255,0.72)";- ctx.font = `500 32px ${FONT}`;- ctx.fillText(fitText(ctx, lines.subtitle, w - 100), 56, 128);- const rowH = 70;+ ctx.textAlign = "center";+ ctx.fillStyle = "#1a2240";+ ctx.font = `700 58px ${SERIF}`;+ ctx.fillText(fitText(ctx, lines.title, w - 140), w / 2, 100);+ ctx.fillStyle = "#5b5345";+ ctx.font = `500 28px ${FONT}`;+ ctx.fillText(fitText(ctx, lines.subtitle, w - 140), w / 2, 150);+ ctx.fillStyle = "#b8964f";+ ctx.fillRect(w / 2 - 90, 180, 180, 3);+ const rowH = 62;+ ctx.textAlign = "left";lines.rows.forEach((row, i) => {- const y = 200 + i * rowH;- ctx.fillStyle = "rgba(255,255,255,0.06)";- ctx.beginPath(); ctx.roundRect(48, y - rowH / 2 + 6, w - 96, rowH - 12, 14); ctx.fill();- ctx.fillStyle = "#ffd76e";- ctx.font = `800 36px ${FONT}`;- ctx.fillText(row.xp, 72, y);- ctx.fillStyle = "#ffffff";- ctx.font = `500 34px ${FONT}`;- ctx.fillText(fitText(ctx, row.text, w - 330), 230, y);+ const y = 236 + i * rowH;+ ctx.fillStyle = "#1a2240";+ ctx.font = `800 32px ${FONT}`;+ ctx.fillText(row.xp, 90, y);+ ctx.fillStyle = "#2b2a26";+ ctx.font = `500 31px ${FONT}`;+ ctx.fillText(fitText(ctx, row.text, w - 380), 260, y);+ ctx.fillStyle = "rgba(26,34,64,0.12)";+ ctx.fillRect(90, y + rowH / 2 - 2, w - 180, 1.5);});- ctx.fillStyle = "rgba(143,227,255,0.85)";- ctx.font = `600 30px ${FONT}`;- ctx.fillText(fitText(ctx, lines.footer, w - 100), 56, h - 46);+ ctx.textAlign = "center";+ ctx.fillStyle = "#5b5345";+ ctx.font = `600 26px ${FONT}`;+ ctx.fillText(fitText(ctx, lines.footer, w - 140), w / 2, h - 72);}-const GUIDE = { w: FURNITURE_SIZE.levelGuide.w, h: FURNITURE_SIZE.levelGuide.h, screenW: 3.08, screenH: 1.7, screenY: 1.5 };+const GUIDE = { w: FURNITURE_SIZE.levelGuide.w, h: FURNITURE_SIZE.levelGuide.h, screenW: 3.0, screenH: 1.66, screenY: 1.5 };/** The guide lists the person's best-paying rules, at most this many. */const GUIDE_ROWS = 6;const NO_RULES: XpRuleRow[] = [];-function LevelGuide() {+function ServiceGuide() {const t = useT();const rules = useProgression((s) => s.snapshot?.rules ?? NO_RULES);const rows = useMemo(() => rules.filter((r) => r.kind === "person").sort((a, b) => b.xp - a.xp).slice(0, GUIDE_ROWS)@@ -650,58 +542,64 @@ function LevelGuide() {title: t("society.hall.guide_title"), subtitle: t("society.hall.guide_subtitle"), rows, footer: t("society.hall.guide_footer"),};const face = useLiveTexture(1280, 704, JSON.stringify(lines), (ctx, w, h) => drawGuide(ctx, w, h, lines));- const screen = face- ? <meshStandardMaterial map={face} emissiveMap={face} emissive="#ffffff" emissiveIntensity={0.85} roughness={0.4} />- : <meshStandardMaterial color={C.ink} roughness={0.3} />;+ const card = face+ ? <meshStandardMaterial map={face} roughness={0.8} />+ : <meshStandardMaterial color={C.cream} roughness={0.8} />;return (<group>{[-1, 1].map((side) => (- <group key={side} position={[side * (GUIDE.w / 2 - 0.1), 0, 0]}>- <Box size={[0.1, GUIDE.h - 0.05, 0.12]} position={[0, (GUIDE.h - 0.05) / 2, 0]} material={HM.brass} />- <Rounded size={[0.2, 0.06, 0.34]} radius={0.02} position={[0, 0.03, 0]} material={HM.midnight} />+ <group key={side} position={[side * (GUIDE.w / 2 - 0.12), 0, 0]}>+ <Box size={[0.09, GUIDE.h - 0.05, 0.09]} position={[0, (GUIDE.h - 0.05) / 2, 0]} material={HM.walnutDark} />+ <Box size={[0.13, 0.03, 0.13]} position={[0, GUIDE.h - 0.03, 0]} material={HM.brass} />+ <Rounded size={[0.24, 0.06, 0.34]} radius={0.02} position={[0, 0.03, 0]} material={HM.walnutDark} /></group>))}- <Rounded size={[GUIDE.screenW + 0.18, GUIDE.screenH + 0.18, 0.16]} radius={0.04} position={[0, GUIDE.screenY, 0]} material={HM.midnight} />- <Box size={[GUIDE.screenW + 0.18, 0.03, 0.17]} position={[0, GUIDE.screenY + GUIDE.screenH / 2 + 0.105, 0]} material={HM.gold} cast={false} />- {/* The same screen on both faces. */}- <mesh position={[0, GUIDE.screenY, 0.085]}><planeGeometry args={[GUIDE.screenW, GUIDE.screenH]} />{screen}</mesh>- <mesh position={[0, GUIDE.screenY, -0.085]} rotation={[0, Math.PI, 0]}><planeGeometry args={[GUIDE.screenW, GUIDE.screenH]} />{screen}</mesh>+ <Box size={[GUIDE.screenW + 0.16, GUIDE.screenH + 0.16, 0.1]} position={[0, GUIDE.screenY, 0]} material={HM.walnut} />+ <Box size={[GUIDE.screenW + 0.06, GUIDE.screenH + 0.06, 0.104]} position={[0, GUIDE.screenY, 0]} material={HM.brass} />+ {/* The same card on both faces. */}+ <mesh position={[0, GUIDE.screenY, 0.054]}><planeGeometry args={[GUIDE.screenW, GUIDE.screenH]} />{card}</mesh>+ <mesh position={[0, GUIDE.screenY, -0.054]} rotation={[0, Math.PI, 0]}><planeGeometry args={[GUIDE.screenW, GUIDE.screenH]} />{card}</mesh></group>);}/** Renderers of the Level Hall's furniture kinds; merged into OfficeProps' exhaustive table. */export const LEVEL_HALL_RENDERERS = {- levelWall: () => <LevelWall />,+ levelWall: () => <RankWall />,studioStage: () => <StudioStage />,- rewardPedestal: ({ item }: { item: Furniture }) => <RewardPedestal item={item} />,+ rewardPedestal: ({ item }: { item: Furniture }) => <DisplayCase item={item} />,levelRoad: ({ item }: { item: Furniture }) => {const size = item.size ?? FURNITURE_SIZE.levelRoad;- return <LevelRoad w={size.w} d={size.d} />;+ return <Runner w={size.w} d={size.d} />;},- levelGuide: () => <LevelGuide />,+ levelGuide: () => <ServiceGuide />,} satisfies Partial<Record<FurnitureKind, (props: { item: Furniture }) => JSX.Element>>;/**- * What hangs over the hall rather than stands in it: a brass ring lamp over- * the stage with a soft shaft of light down to it, and warm lights over the- * stage and the guide.+ * What hangs over the hall rather than stands in it: a brass canopy over the+ * dais with four spotlights aimed down at it, and warm light on the rank wall+ * and the guide.*/export const LevelHallFittings = memo(function LevelHallFittings({ stage, guide }: { stage: Pick<Furniture, "x" | "z">; guide: Pick<Furniture, "x" | "z"> | null }) {- const shaft = useMemo(() => new MeshBasicMaterial({- color: "#ffe2a0", transparent: true, opacity: 0.09, blending: AdditiveBlending, depthWrite: false, side: DoubleSide,- }), []);- useEffect(() => () => shaft.dispose(), [shaft]);- const at: Vec3 = [stage.x, 0, stage.z];return (<>- <group position={at}>- <mesh geometry={GEO.ring} material={HM.brass} position={[0, 3.05, 0]} rotation={[Math.PI / 2, 0, 0]} scale={[1.05, 1.05, 3]} />- <mesh geometry={GEO.ring} material={HM.gold} position={[0, 3.0, 0]} rotation={[Math.PI / 2, 0, 0]} scale={[0.95, 0.95, 2]} />- <mesh geometry={GEO.shaft} material={shaft} position={[0, 1.5, 0]} renderOrder={1} />- <pointLight position={[0, 2.6, 0.4]} color="#ffdca0" intensity={6} distance={7} decay={2} />+ <group position={[stage.x, 0, stage.z]}>+ <mesh material={HM.brass} position={[0, 3.12, 0]}>+ <cylinderGeometry args={[0.5, 0.5, 0.04, 40]} />+ </mesh>+ {[0, 1, 2, 3].map((i) => {+ const a = (i / 4) * Math.PI * 2 + Math.PI / 4;+ return (+ <group key={i} position={[Math.cos(a) * 0.4, 3.0, Math.sin(a) * 0.4]} rotation={[Math.sin(a) * -0.35, 0, Math.cos(a) * 0.35]}>+ <mesh material={HM.walnutDark}><cylinderGeometry args={[0.05, 0.065, 0.16, 16]} /></mesh>+ <mesh material={HM.caseLight} position={[0, -0.081, 0]} rotation={[Math.PI / 2, 0, 0]}><circleGeometry args={[0.05, 16]} /></mesh>+ </group>+ );+ })}+ <pointLight position={[0, 2.6, 0.4]} color="#ffe6bf" intensity={6} distance={7} decay={2} /></group>- {guide && <pointLight position={[guide.x, 2.8, guide.z - 1.4]} color="#cfe3ff" intensity={3.5} distance={6} decay={2} />}+ <pointLight position={[stage.x, 2.9, stage.z - 2.6]} color="#ffe2b0" intensity={4} distance={6} decay={2} />+ {guide && <pointLight position={[guide.x, 2.8, guide.z - 1.4]} color="#fff1da" intensity={3} distance={6} decay={2} />}</>);});diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsxindex ed9d1fbd05..774bfe84d2 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeAgents.tsx@@ -41,7 +41,7 @@ import { agentLogoAsset } from "@/components/agentic/AgentMark";import { LevelChip } from "../progression/LevelHud";import { agentSubject, petSubject } from "../progression/progressionApi";import { useProgression } from "../progression/progressionStore";-import { figureGadgetSlots, useWornGadget } from "../progression/wornGadget";+import { useDressedFigure } from "../progression/regalia/dress";/** The agent's symbol walks behind it as a little pet, about a fifth of its height. */export const PET_SIZE_M = 0.26;@@ -225,8 +225,7 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,const body = useRef<Group>(null);const ring = useRef<Mesh>(null);const drive = useRef<FigureDrive>({ mode: "idle", speed: 0 });- const gadget = useWornGadget("agent", agentSubject(agent.agentId));- const worn = figureGadgetSlots(gadget, { drive, top: OFFICE_FIGURE_HEIGHT_M + 0.02, paused: !awake, reduced });+ const dressed = useDressedFigure("agent", agentSubject(agent.agentId), look);const rng = useMemo(() => createRng(agent.agentId), [agent.agentId]);const mover = useRef<Mover>({ ...(arrivesByElevator ? ctx.spawn : { x: 0, z: 0 }), heading: Math.PI, path: [] });const plan = useRef<Plan | null>(null);@@ -428,9 +427,8 @@ function Walker({ agent, desk, ctx, arrivesByElevator, awake, reduced, selected,onClick={(event) => { event.stopPropagation(); onSelect(agent.agentId); }}onPointerOver={() => { document.body.style.cursor = "pointer"; }}onPointerOut={() => { document.body.style.cursor = ""; }}>- {!isGigi && <ToyFigure look={look} drive={drive} paused={!awake} heightM={OFFICE_FIGURE_HEIGHT_M} seatHeight={seatHeight}- back={worn.back} headwear={worn.headwear} />}- {!isGigi && worn.beside}+ {!isGigi && <ToyFigure look={dressed.look} drive={drive} paused={!awake} heightM={OFFICE_FIGURE_HEIGHT_M} seatHeight={seatHeight}+ regalia={dressed.regalia} />}</group><Nameplate agent={agent} activity={activity} selected={selected} onSelect={onSelect} height={isGigi ? leadPlate : undefined} /><AgentBubble agent={agent} lines={lines} selected={selected} onSelect={onSelect}diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsxindex 033d5ee309..fd9fd0a18b 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficePlayer.tsx@@ -25,7 +25,7 @@ import { jumpSquash, newJump, pressJump, stepJump } from "./officeJump";import { useProgression } from "../progression/progressionStore";import { PERSON_SUBJECT } from "../progression/progressionApi";import { LevelChip } from "../progression/LevelHud";-import { figureGadgetSlots, useWornGadget } from "../progression/wornGadget";+import { useDressedFigure } from "../progression/regalia/dress";/** The person's pace: a brisk walk, and a sprint on Shift (m/s). */export const PLAYER_WALK_SPEED = 2.0;@@ -165,9 +165,7 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {if (state.cheerUntil > prev.cheerUntil && !reduced) pressJump(jump);}), [jump, reduced]);const level = useProgression((s) => (s.snapshot ? s.subjects[PERSON_SUBJECT]?.level ?? 1 : null));- const gadget = useWornGadget("person", PERSON_SUBJECT);- const airborne = useMemo(() => () => jump.airborne, [jump]);- const worn = figureGadgetSlots(gadget, { drive, top: OFFICE_FIGURE_HEIGHT_M + 0.02, airborne, paused: !awake, reduced });+ const dressed = useDressedFigure("person", PERSON_SUBJECT, look);// Arrive by the elevator once per app run; coming back to the map keeps the// character where it was, unless a changed floor plan put that spot in a wall.@@ -294,9 +292,8 @@ export function OfficePlayer({ layout, grid, look, name, awake, reduced }: {<meshBasicMaterial color="#f5b83d" transparent opacity={0.8} side={DoubleSide} depthWrite={false} /></mesh><group ref={body}>- <ToyFigure look={look} drive={drive} paused={!awake} heightM={OFFICE_FIGURE_HEIGHT_M} holding={hasBone ? <TreatBone scale={1.15} /> : undefined}- back={worn.back} headwear={worn.headwear} />- {worn.beside}+ <ToyFigure look={dressed.look} drive={drive} paused={!awake} heightM={OFFICE_FIGURE_HEIGHT_M} holding={hasBone ? <TreatBone scale={1.15} /> : undefined}+ regalia={dressed.regalia} />{!firstPerson && (<Html center position={[0, OFFICE_FIGURE_HEIGHT_M + 0.35, 0]} zIndexRange={[25, 0]}><span className="office-plate office-plate-player" data-office-ui>diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsxindex 7a6c252ed3..05c71c0d35 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx@@ -76,41 +76,46 @@ function drawFloor(kind: RoomKind, ctx: CanvasRenderingContext2D, w: number, h:ctx.fillRect(Math.floor(rand() * w), Math.floor(rand() * h), s, s * (0.6 + rand() * 0.6));}} else if (kind === "levels") {- // Level Hall: large polished slabs of midnight stone, soft lighter clouds and a thin gold vein through each.- const [a, b, c, gold] = [0, 1, 2, 3].map((i) => accents[i] ?? base);- const tiles = 2, size = w / tiles;+ // Level Hall: a ceremonial floor of cream and charcoal marble squares, each with soft veins, laid with fine joints.+ const [cream, charcoal, creamVein, brass] = [0, 1, 2, 3].map((i) => accents[i] ?? base);+ const tiles = 4, size = w / tiles;for (let ty = 0; ty < tiles; ty += 1) {for (let tx = 0; tx < tiles; tx += 1) {- ctx.fillStyle = [a, b, c][(tx + ty * 2) % 3];- ctx.fillRect(tx * size, ty * size, size, size);- for (let i = 0; i < 40; i += 1) {- ctx.globalAlpha = 0.08 + rand() * 0.1;- ctx.fillStyle = "#4a5a96";- ctx.beginPath();- ctx.ellipse(tx * size + rand() * size, ty * size + rand() * size, 8 + rand() * 26, 5 + rand() * 12, rand() * Math.PI, 0, Math.PI * 2);- ctx.fill();- }- ctx.globalAlpha = 0.55;- ctx.strokeStyle = gold;- ctx.lineWidth = 1.2;+ const dark = (tx + ty) % 2 === 1;+ const x0 = tx * size, y0 = ty * size;+ ctx.fillStyle = dark ? charcoal : cream;+ ctx.fillRect(x0, y0, size, size);+ // Veins: a few long, gently wandering strokes per tile, clipped to it.+ ctx.save();ctx.beginPath();- let vx = tx * size, vy = ty * size + rand() * size;- ctx.moveTo(vx, vy);- while (vx < (tx + 1) * size) {- vx += 10 + rand() * 18;- vy += (rand() - 0.5) * 22;- ctx.lineTo(Math.min(vx, (tx + 1) * size), Math.max(ty * size, Math.min((ty + 1) * size, vy)));+ ctx.rect(x0, y0, size, size);+ ctx.clip();+ for (let v = 0; v < 3; v += 1) {+ ctx.globalAlpha = dark ? 0.16 + rand() * 0.1 : 0.22 + rand() * 0.14;+ ctx.strokeStyle = dark ? "#5b5e68" : creamVein;+ ctx.lineWidth = 0.6 + rand() * 1.1;+ ctx.beginPath();+ let vx = x0 - 4, vy = y0 + rand() * size;+ ctx.moveTo(vx, vy);+ while (vx < x0 + size + 4) {+ vx += 6 + rand() * 12;+ vy += (rand() - 0.45) * 10;+ ctx.lineTo(vx, vy);+ }+ ctx.stroke();}- ctx.stroke();+ ctx.restore();ctx.globalAlpha = 1;}}- // Brass joints between the slabs.- ctx.fillStyle = "rgba(217,178,92,0.55)";+ // Fine joints, a hint of brass where the squares meet.+ ctx.fillStyle = brass;+ ctx.globalAlpha = 0.35;for (let i = 0; i < tiles; i += 1) {- ctx.fillRect(i * size, 0, 2, h);- ctx.fillRect(0, i * size, w, 2);+ ctx.fillRect(i * size, 0, 1, h);+ ctx.fillRect(0, i * size, w, 1);}+ ctx.globalAlpha = 1;} else if (kind === "team") {// Carpet grain: fine speckles in the accent tones, plus a faint weave.for (let i = 0; i < 2600; i += 1) {diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsxindex 0f2fab200e..27dabb08d0 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx@@ -160,7 +160,7 @@ export function OfficeScene(props: OfficeSceneProps) {{/* Upstairs the person's pet comes along: to the coding floor and to play in the arcade. */}{floor !== "agents" && <GigiCompanion grid={grid} awake={awake} reduced={reduced} />}{/* Levels: what everyone wears, level-up bursts and "+XP"; after the walkers, so it reads this frame's positions. */}- <ProgressionLayer agents={agents} awake={awake} reduced={reduced} />+ <ProgressionLayer awake={awake} reduced={reduced} /><OfficeCameraRig layout={layout} overview={overview} /></>);diff --git a/jarvis/ui/web/frontend/src/components/society/office/ToyFigure.tsx b/jarvis/ui/web/frontend/src/components/society/office/ToyFigure.tsxindex b86f824d76..0f1bc52749 100644--- a/jarvis/ui/web/frontend/src/components/society/office/ToyFigure.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/ToyFigure.tsx@@ -22,7 +22,7 @@ import { RoundedBoxGeometry } from "three-stdlib";import type { FigureMode } from "../figures/FigureRig";import {blendPose, copyPose, createPose, poseFor, TOY, TOY_HEIGHT, walkCadence,- type HairStyle, type OutfitId, type PoseOptions, type ToyLook, type ToyPose,+ type HairStyle, type OutfitId, type PoseOptions, type ToyLook, type ToyPose, type UniformStyle,} from "./toyFigureModel";// ---------------------------------------------------------------------------@@ -171,12 +171,6 @@ function HairCap({ color, grow = 0, fringe = true }: { color: string; grow?: num);}-/** How far each hair style or hat rises above the bare head top, so headwear sits on it instead of inside it. */-const HAIR_TOP: Record<HairStyle, number> = {- bald: 0, buzz: 0.012, short: 0.035, slick: 0.035, sidepart: 0.04, long: 0.035, ponytail: 0.035,- curly: 0.07, bun: 0.06, spiky: 0.08, beanie: 0.06, cap: 0.035,-};-const SPIKES: Array<[number, number, number, number, number]> = [[0, 0.6, 0.1, 0.75, 0], [-0.12, 0.6, 0.04, 0.35, 0.45], [0.12, 0.6, 0.04, 0.35, -0.45],[0, 0.62, -0.05, -0.2, 0], [-0.21, 0.52, -0.04, -0.1, 0.95], [0.21, 0.52, -0.04, -0.1, -0.95],@@ -325,6 +319,7 @@ const CUFFED: ReadonlySet<OutfitId> = new Set(["suit", "blazer"]);/** The material of a garment: leather shines, knits and fleece stay soft. */function garment(look: ToyLook, color: string): MeshStandardMaterial {+ if (look.uniform) return matte(color, 0.78);if (look.outfit === "leather" && color === look.shirt) return matte(color, 0.32, 0.12);if (look.outfit === "quarterzip" || look.outfit === "turtleneck" || look.outfit === "hoodie") return matte(color, 0.95);return matte(color);@@ -337,11 +332,13 @@ const FRONT = TOY.torso.d / 2;* The opening of a jacket or vest: a shirt-coloured V (tip down) with lapels* along its edges, tilted back to follow the chest's rounded top.*/-function VOpening({ look, width, depth, lapel, tie }: { look: ToyLook; width: number; depth: number; lapel: number; tie: boolean }) {+function VOpening({ look, width, depth, lapel, tie, bow = false, lapelColour }: {+ look: ToyLook; width: number; depth: number; lapel: number; tie: boolean; bow?: boolean; lapelColour?: string;+}) {const top = 0.285;const angle = Math.atan2(width / 2, depth);const edge = Math.hypot(width / 2, depth);- const shade = garment(look, mix(look.shirt, "#000000", look.outfit === "leather" ? 0.25 : 0.14));+ const shade = lapelColour ? matte(lapelColour, 0.35) : garment(look, mix(look.shirt, "#000000", look.outfit === "leather" ? 0.25 : 0.14));return (<group position={[0, top - depth / 2, FRONT - 0.012]} rotation={[-0.22, 0, 0]}>{/* A cone of radius r has a face r·√3 wide; scaled flat in z it is a triangle on the chest. */}@@ -350,6 +347,15 @@ function VOpening({ look, width, depth, lapel, tie }: { look: ToyLook; width: nu<mesh key={sx} geometry={GEO.box} material={shade} castShadowposition={[sx * (width / 4 + lapel * 0.45), 0, 0.02]} rotation={[0, 0, -sx * angle]} scale={[lapel, edge + 0.02, 0.012]} />))}+ {bow && (+ <group position={[0, depth / 2 - 0.02, 0.024]}>+ {[-1, 1].map((sx) => (+ <mesh key={sx} geometry={GEO.wedge} material={matte(look.shirtAccent, 0.5)} position={[sx * 0.018, 0, 0]}+ rotation={[0, 0, sx * Math.PI / 2]} scale={[0.014, 0.03, 0.008]} />+ ))}+ <mesh geometry={GEO.box} material={matte(look.shirtAccent, 0.5)} scale={[0.012, 0.014, 0.012]} />+ </group>+ )}{tie && (<group position={[0, 0, 0.022]}><mesh geometry={GEO.box} material={matte(look.shirtAccent, 0.5)} position={[0, depth / 2 - 0.018, 0]} scale={[0.03, 0.024, 0.014]} />@@ -437,6 +443,98 @@ function OutfitDetails({ look }: { look: ToyLook }) {}}++/** A pocket flap with its button, on the chest's front. */+function PocketFlap({ x, y, colour, button }: { x: number; y: number; colour: string; button: string }) {+ return (+ <group position={[x, y, FRONT + 0.003]}>+ <mesh geometry={GEO.box} material={matte(mix(colour, "#000000", 0.12), 0.8)} scale={[0.07, 0.022, 0.008]} />+ <mesh geometry={GEO.lowSphere} material={matte(button, 0.35, 0.5)} position={[0, -0.004, 0.006]} scale={[0.0085, 0.0085, 0.005]} />+ </group>+ );+}++/** Everything a uniform adds to the chest: collar, tie, closure, pockets, belt and trims, by its cut. */+function UniformDetails({ look, u }: { look: ToyLook; u: UniformStyle }) {+ const metal = matte(u.buttons, 0.32, 0.6);+ const pockets = (lower: boolean) => (+ <>+ {[-1, 1].map((sx) => <PocketFlap key={`c${sx}`} x={sx * 0.072} y={0.15} colour={u.coat} button={u.buttons} />)}+ {lower && [-1, 1].map((sx) => <PocketFlap key={`l${sx}`} x={sx * 0.075} y={0.07} colour={u.coat} button={u.buttons} />)}+ </>+ );+ const belt = u.belt && (+ <group position={[0, 0.045, 0]}>+ <mesh geometry={GEO.box} material={matte(u.belt, 0.6)} position={[0, 0, FRONT + 0.002]} scale={[TOY.torso.w - 0.02, 0.026, 0.01]} />+ <mesh geometry={GEO.box} material={metal} position={[0, 0, FRONT + 0.008]} scale={[0.032, 0.03, 0.006]} />+ </group>+ );+ switch (u.cut) {+ case "shirt":+ return (+ <group>+ <VOpening look={look} width={0.07} depth={0.06} lapel={0.026} tie={false} />+ {/* The tie runs from the knot at the collar down the placket. */}+ <mesh geometry={GEO.box} material={matte(u.tie, 0.5)} position={[0, 0.262, FRONT + 0.004]} rotation={[-0.3, 0, 0]} scale={[0.03, 0.024, 0.014]} />+ <mesh geometry={GEO.box} material={matte(u.tie, 0.5)} position={[0, 0.17, FRONT + 0.006]} scale={[0.028, 0.16, 0.008]} />+ {pockets(false)}+ {belt}+ </group>+ );+ case "field":+ return (+ <group>+ <mesh geometry={GEO.collar} material={garment(look, u.coat)} position={[0, 0.287, 0]} scale={[1.05, 0.06, 1.05]} castShadow />+ <mesh geometry={GEO.box} material={garment(look, mix(u.coat, "#000000", 0.1))} position={[0.008, 0.15, FRONT + 0.004]} scale={[0.026, 0.25, 0.008]} />+ {Array.from({ length: 4 }, (_, i) => (+ <mesh key={i} geometry={GEO.lowSphere} material={metal} position={[0.008, 0.23 - i * 0.055, FRONT + 0.009]} scale={[0.007, 0.007, 0.004]} />+ ))}+ {pockets(true)}+ {u.tapes && [-1, 1].map((sx) => (+ <mesh key={sx} geometry={GEO.box} material={matte(u.tapes as string, 0.9)} position={[sx * 0.072, 0.185, FRONT + 0.003]} scale={[0.068, 0.013, 0.006]} />+ ))}+ {belt}+ </group>+ );+ case "service":+ return (+ <group>+ <VOpening look={look} width={0.13} depth={0.15} lapel={0.034} tie />+ {Array.from({ length: 4 }, (_, i) => (+ <mesh key={i} geometry={GEO.lowSphere} material={metal} position={[0, 0.125 - i * 0.032, FRONT + 0.006]} scale={[0.01, 0.01, 0.006]} />+ ))}+ {pockets(true)}+ {/* "U.S." discs on the collar. */}+ {[-1, 1].map((sx) => (+ <mesh key={sx} geometry={GEO.lowSphere} material={metal} position={[sx * 0.085, 0.255, FRONT - 0.02]} scale={[0.011, 0.011, 0.005]} />+ ))}+ {belt}+ </group>+ );+ case "mess":+ default:+ return (+ <group>+ <VOpening look={look} width={0.17} depth={0.2} lapel={0.04} tie={false} bow lapelColour={u.lapels} />+ {/* Gold studs down the dress shirt and a black cummerbund at the waist. */}+ {[0, 1, 2].map((i) => (+ <mesh key={i} geometry={GEO.lowSphere} material={metal} position={[0, 0.205 - i * 0.035, FRONT + 0.004]} scale={[0.007, 0.007, 0.004]} />+ ))}+ <mesh geometry={GEO.box} material={matte("#121318", 0.5)} position={[0, 0.06, FRONT - 0.002]} scale={[0.15, 0.05, 0.01]} />+ {/* Gold buttons either side of the open jacket, joined by a chain. */}+ {[-1, 1].map((sx) => (+ <mesh key={sx} geometry={GEO.lowSphere} material={metal} position={[sx * 0.1, 0.1, FRONT + 0.004]} scale={[0.011, 0.011, 0.006]} />+ ))}+ <mesh geometry={GEO.box} material={metal} position={[0, 0.1, FRONT + 0.006]} scale={[0.19, 0.0035, 0.004]} />+ {u.cuffBraid && [-1, 1].map((sx) => (+ <mesh key={`e${sx}`} geometry={GEO.box} material={matte(u.cuffBraid as string, 0.4, 0.5)} position={[sx * 0.088, 0.17, FRONT + 0.004]}+ rotation={[0, 0, sx * -0.36]} scale={[0.005, 0.2, 0.004]} />+ ))}+ </group>+ );+ }+}+function Eyewear({ look }: { look: ToyLook }) {if (look.eyewear === "none") return null;const eyeY = HD.y - 0.03;@@ -466,12 +564,17 @@ type JointRef = MutableRefObject<Group | null>;* sleeve over a bare arm; every other outfit has long sleeves ending in a cuff* at the wrist (a vest shows the shirt's sleeves, a suit the shirt cuff).*/-function Arm({ side, look, shoulder, elbow, holding }: { side: 1 | -1; look: ToyLook; shoulder: JointRef; elbow: JointRef; holding?: ReactNode }) {+function Arm({ side, look, shoulder, elbow, holding, sleeve }: {+ side: 1 | -1; look: ToyLook; shoulder: JointRef; elbow: JointRef; holding?: ReactNode; sleeve?: ReactNode;+}) {const skin = matte(look.skin);- const sleeveColour = look.outfit === "vest" ? look.inner : look.shirt;+ const sleeveColour = look.outfit === "vest" && !look.uniform ? look.inner : look.shirt;const cloth = garment(look, sleeveColour);- const long = look.outfit !== "tee";- const cuff = CUFFED.has(look.outfit) ? matte(look.inner) : garment(look, mix(sleeveColour, "#000000", 0.08));+ const long = look.outfit !== "tee" || !!look.uniform;+ const braid = look.uniform?.cuffBraid;+ const cuff = braid ? matte(braid, 0.4, 0.5)+ : look.uniform ? garment(look, mix(sleeveColour, "#000000", 0.1))+ : CUFFED.has(look.outfit) ? matte(look.inner) : garment(look, mix(sleeveColour, "#000000", 0.08));const hand = -TOY.foreArm - 0.006;return (<group ref={shoulder} position={[side * TOY.shoulderX, TOY.shoulderY, 0]}>@@ -479,6 +582,8 @@ function Arm({ side, look, shoulder, elbow, holding }: { side: 1 | -1; look: Toy<mesh geometry={GEO.sphere} material={cloth} position={[-side * 0.008, -0.004, 0]} scale={[TOY.armRadius + 0.012, TOY.armRadius + 0.008, TOY.armRadius + 0.012]} castShadow />{!long && <mesh geometry={GEO.sleeve} material={cloth} position={[0, -0.045, 0]} castShadow />}<mesh geometry={GEO.upperArm} material={long ? cloth : skin} position={[0, -TOY.upperArm / 2, 0]} castShadow />+ {/* A rank patch on the outer face of the upper sleeve, bent round the arm. */}+ {sleeve && <group position={[side * (TOY.armRadius + 0.001), -0.088, 0]} rotation={[0, side * Math.PI / 2, 0]}>{sleeve}</group>}<group ref={elbow} position={[0, -TOY.upperArm, 0]}><mesh geometry={GEO.foreArm} material={long ? cloth : skin} position={[0, -TOY.foreArm / 2 + 0.01, 0]} castShadow />{long && <mesh geometry={GEO.cuff} material={cuff} position={[0, hand + 0.052, 0]} />}@@ -493,14 +598,17 @@ function Arm({ side, look, shoulder, elbow, holding }: { side: 1 | -1; look: Toyfunction Leg({ side, look, hip, knee, ankle }: { side: 1 | -1; look: ToyLook; hip: JointRef; knee: JointRef; ankle: JointRef }) {const pants = matte(look.pants);+ const stripe = look.uniform?.stripe ? matte(look.uniform.stripe, 0.4, 0.5) : null;// Dress shoes are polished with a dark sole; sneakers keep the light rubber sole.const dress = DRESS_SHOES.has(look.outfit) && !isLight(look.shoes);const sole = matte(dress ? mix(look.shoes, "#000000", 0.45) : isLight(look.shoes) ? mix(look.shoes, "#9a9aa0", 0.25) : SOLE_LIGHT);return (<group ref={hip} position={[side * TOY.hipX, TOY.hipUp, 0]}><mesh geometry={GEO.thigh} material={pants} position={[0, -TOY.thigh / 2, 0]} castShadow />+ {stripe && <mesh geometry={GEO.box} material={stripe} position={[side * (TOY.legRadius - 0.002), -TOY.thigh / 2, 0]} scale={[0.006, TOY.thigh + 0.06, 0.018]} />}<group ref={knee} position={[0, -TOY.thigh, 0]}><mesh geometry={GEO.shin} material={pants} position={[0, -TOY.shin / 2 + 0.005, 0]} castShadow />+ {stripe && <mesh geometry={GEO.box} material={stripe} position={[side * 0.054, -TOY.shin / 2 + 0.005, 0]} scale={[0.006, TOY.shin + 0.04, 0.018]} />}<group ref={ankle} position={[0, -TOY.shin, 0]}><mesh geometry={GEO.shoe} material={matte(look.shoes, dress ? 0.3 : 0.6)} position={[0, -TOY.sole + 0.0425, (TOY.toe - TOY.heel) / 2]} castShadow /><mesh geometry={GEO.sole} material={sole} position={[0, -TOY.sole + 0.011, (TOY.toe - TOY.heel) / 2]} castShadow />@@ -528,13 +636,31 @@ export interface ToyFigureProps {seatHeight?: number;/** Something held in the right hand (e.g. a dog treat); the arm then stays raised forward. */holding?: ReactNode;- /** Worn on the upper back (e.g. the level wings); rides the torso through every hop and lean. */- back?: ReactNode;- /** Worn on top of the head (e.g. the level halo or crown); rides every nod, hop and lean. */- headwear?: ReactNode;+ /** Rank, decorations and headwear (level rewards); each piece rides the body part it is worn on. */+ regalia?: FigureRegalia;+ /** A display mannequin: no face, no hair. */+ mannequin?: boolean;}-export function ToyFigure({ look, drive, paused, heightM = TOY_HEIGHT, seatHeight = 0.52, holding, back, headwear }: ToyFigureProps) {+/**+ * What a figure wears beyond its outfit. Every slot is in the local space of+ * the part it rides:+ * - `sleeve`: on the outer face of each upper sleeve, origin on the arm's surface, front facing outward (+z);+ * - `shoulder`: on top of each shoulder, origin where it rests, its length along +x pointing outward, top +y;+ * - `chest`: in the torso's space (front at z = TOY.torso.d / 2);+ * - `hat`: in the head group's space; the hair then shows only below it.+ */+export interface FigureRegalia {+ sleeve?: ReactNode;+ shoulder?: ReactNode;+ chest?: ReactNode;+ hat?: ReactNode;+}++/** Where a shoulder piece rests on the torso: over the shoulder cap, sloping down outward. */+const SHOULDER_REST = { x: 0.15, y: 0.288, slope: 0.22 };++export function ToyFigure({ look, drive, paused, heightM = TOY_HEIGHT, seatHeight = 0.52, holding, regalia, mannequin = false }: ToyFigureProps) {const holds = useRef(false);holds.current = !!holding;const scale = heightM / TOY_HEIGHT;@@ -621,22 +747,29 @@ export function ToyFigure({ look, drive, paused, heightM = TOY_HEIGHT, seatHeighreturn (<group scale={scale}><group ref={pelvis} position={[0, TOY.thigh + TOY.shin + TOY.sole - TOY.hipUp, 0]}>- <mesh geometry={GEO.pelvis} material={matte(look.pants)} position={[0, TOY.pelvis.h / 2, 0]} castShadow />+ {/* A field or service coat covers the hips. */}+ <mesh geometry={GEO.pelvis} material={look.uniform && (look.uniform.cut === "field" || look.uniform.cut === "service") ? garment(look, look.shirt) : matte(look.pants)}+ position={[0, TOY.pelvis.h / 2, 0]} castShadow /><Leg side={1} look={look} hip={lHip} knee={lKnee} ankle={lAnkle} /><Leg side={-1} look={look} hip={rHip} knee={rKnee} ankle={rAnkle} /><group ref={torso} position={[0, TOY.hipUp, 0]}><mesh geometry={GEO.chest} material={garment(look, look.shirt)} position={[0, 0.02 + (TOY.torso.h - 0.02) / 2, 0]} castShadow />- <OutfitDetails look={look} />+ {look.uniform ? <UniformDetails look={look} u={look.uniform} /> : <OutfitDetails look={look} />}<mesh geometry={GEO.lowSphere} material={matte(look.skin)} position={[0, TOY.neckY - 0.01, 0]} scale={[0.07, 0.04, 0.07]} />- <Arm side={1} look={look} shoulder={lShoulder} elbow={lElbow} />- <Arm side={-1} look={look} shoulder={rShoulder} elbow={rElbow} holding={holding} />- {back && <group position={[0, 0.2, -TOY.torso.d / 2 - 0.01]}>{back}</group>}+ <Arm side={1} look={look} shoulder={lShoulder} elbow={lElbow} sleeve={regalia?.sleeve} />+ <Arm side={-1} look={look} shoulder={rShoulder} elbow={rElbow} holding={holding} sleeve={regalia?.sleeve} />+ {regalia?.shoulder && ([1, -1] as const).map((side) => (+ <group key={side} position={[side * SHOULDER_REST.x, SHOULDER_REST.y, 0]} rotation={[0, side === 1 ? 0 : Math.PI, -SHOULDER_REST.slope]}>+ {regalia.shoulder}+ </group>+ ))}+ {regalia?.chest}<group ref={head} position={[0, TOY.neckY, 0]}><mesh geometry={GEO.sphere} material={matte(look.skin)} position={[0, HD.y, 0]} scale={[HD.rx, HD.ry, HD.rz]} castShadow />- <Face look={look} />- <Eyewear look={look} />- <Hair style={look.hairStyle} look={look} />- {headwear && <group position={[0, HD.y + HD.ry + HAIR_TOP[look.hairStyle] + 0.02, 0]}>{headwear}</group>}+ {!mannequin && <Face look={look} />}+ {!mannequin && <Eyewear look={look} />}+ {mannequin ? null : regalia?.hat ? <HairUnderHat color={look.hair} /> : <Hair style={look.hairStyle} look={look} />}+ {regalia?.hat}</group></group></group>diff --git a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts b/jarvis/ui/web/frontend/src/components/society/office/officePalette.tsindex 9235070e82..db4b83dcf8 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts@@ -180,7 +180,7 @@ export const ROOM_FLOOR_COLOURS = {prizes: { base: "#3a1838", accents: ["#431c41", "#33152f"] },snack: { base: "#5a1e22", accents: ["#e9e2d6", "#4c191c"] },// Level Hall: deep midnight-blue polished stone with gold veins.- levels: { base: "#1c2547", accents: ["#222c55", "#18203e", "#26315e", "#d9b25c"] },+ levels: { base: "#e7e0d0", accents: ["#e7e0d0", "#2b2d33", "#bdb3a0", "#b8964f"] },} as const;/** Checkpoint gold: floor ring, hexagon token and the label badge. */diff --git a/jarvis/ui/web/frontend/src/components/society/office/toyFigureModel.ts b/jarvis/ui/web/frontend/src/components/society/office/toyFigureModel.tsindex acc8d73c26..ae343f0ec5 100644--- a/jarvis/ui/web/frontend/src/components/society/office/toyFigureModel.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/toyFigureModel.ts@@ -55,6 +55,37 @@ export interface ToyLook {blush: boolean;outfit: OutfitId;eyewear: Eyewear;+ /** A uniform worn over the look (a level reward): replaces the outfit's cut and colours. */+ uniform?: UniformStyle;+}++/**+ * A military uniform as the toy figure draws it. The cut decides the chest+ * (an open shirt collar and tie, a field jacket's stand collar and zip, a+ * belted service coat, a short mess jacket); the colours and trims do the rest.+ */+export interface UniformStyle {+ cut: "shirt" | "field" | "service" | "mess";+ /** Coat or shirt body. */+ coat: string;+ /** The shirt showing at the collar under a coat. */+ shirt: string;+ tie: string;+ tieKind: "long" | "bow";+ trousers: string;+ /** A stripe down the outer seam of each trouser leg. */+ stripe?: string;+ shoes: string;+ buttons: string;+ /** Pocket flaps on the chest (and the skirt of a coat). */+ pockets: 0 | 2 | 4;+ belt?: string;+ /** Gold braid round each cuff. */+ cuffBraid?: string;+ /** Lapel facing colour of a mess jacket. */+ lapels?: string;+ /** Name and service tapes over the pockets of a field jacket. */+ tapes?: string;}/** Natural skin tones, light to dark; the fallback and the snap target for fantasy skins. */diff --git a/jarvis/ui/web/frontend/src/components/society/progression/LevelHud.tsx b/jarvis/ui/web/frontend/src/components/society/progression/LevelHud.tsxindex 172ec2dee5..c99edf0ba9 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/LevelHud.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/LevelHud.tsx@@ -1,36 +1,34 @@/**- * The level system's HUD pieces over the Verse: the person's level card (a- * ring that fills with XP, the title, a bar with a trailing "ghost" that- * catches up after each gain), the pet's line under it, the level chip worn- * on name plates, and the toasts for agents that levelled up.+ * The level system's HUD pieces over the Verse: the person's level card (the+ * rank insignia in a ring that fills with XP, the rank, a bar with a trailing+ * "ghost" that catches up after each gain), the pet's line under it, the rank+ * chip worn on name plates, and the toasts for agents that were promoted.*/-import { useEffect, useMemo, useRef, useState } from "react";+import { useEffect, useRef, useState } from "react";import { useT } from "@/i18n";-import { equippedFor, levelFraction } from "./cosmetics";-import { FRAME_STYLE, type SubjectKind } from "./levelCatalog";+import { levelFraction } from "./cosmetics";+import { RANK_INFO, rankAt, type RankId, type SubjectKind } from "./levelCatalog";+import { RankInsignia } from "./insignia/RankInsignia";import { PERSON_SUBJECT, petSubject } from "./progressionApi";import { useProgression, type Celebration } from "./progressionStore";const TOAST_MS = 6500;-/** The frame a subject's chip wears: its chosen or best unlocked frame. */-export function useFrameStyle(kind: SubjectKind, level: number) {- const rewards = useProgression((s) => s.snapshot?.rewards);- const choice = useProgression((s) => (kind === "agent" ? undefined : s.choices[kind]?.frame));- return useMemo(() => {- const frame = rewards ? equippedFor(rewards, kind, level, choice ? { frame: choice } : {}).frame : undefined;- return FRAME_STYLE[(frame ?? "frame_none") as keyof typeof FRAME_STYLE];- }, [rewards, kind, level, choice]);+/** The rank a subject kind holds at `level`, from the server's ladder. */+export function useRankAt(kind: SubjectKind, level: number): RankId {+ const bands = useProgression((s) => s.snapshot?.titles[kind]);+ return rankAt(bands, level);}-/** The small hexagon level number on a name plate. */+/** The rank chip on a name plate: the insignia and the level number on a dark plate. */export function LevelChip({ kind, level }: { kind: SubjectKind; level: number }) {const t = useT();- const style = useFrameStyle(kind, level);+ const rank = useRankAt(kind, level);return (- <span className="level-chip" title={t("society.level.level_n").replace("{0}", String(level))}- style={{ background: style.fill, color: style.ink, boxShadow: `inset 0 0 0 1.5px ${style.ring}` }}>- {level}+ <span className="level-chip" data-tier={RANK_INFO[rank].tier}+ title={`${t(`society.level.title.${rank}`)} · ${t("society.level.level_n").replace("{0}", String(level))}`}>+ <RankInsignia rank={rank} size={14} className="level-chip-insignia" />+ <b>{level}</b></span>);}@@ -56,17 +54,19 @@ export function XpBar({ fraction, kind, label }: { fraction: number; kind: Subje);}+/** The rank insignia on a dark medallion inside a ring that fills with XP; the level sits on a tab below. */export function LevelRing({ kind, level, fraction, size = 44 }: { kind: SubjectKind; level: number; fraction: number; size?: number }) {- const style = useFrameStyle(kind, level);- const r = 18, c = 2 * Math.PI * r;+ const rank = useRankAt(kind, level);+ const r = 20, c = 2 * Math.PI * r;return (- <span className="level-ring" style={{ width: size, height: size }} data-kind={kind}>- <svg viewBox="0 0 44 44" width={size} height={size} aria-hidden>- <circle cx="22" cy="22" r={r} className="level-ring-track" />- <circle cx="22" cy="22" r={r} className="level-ring-fill" strokeDasharray={`${c * fraction} ${c}`} transform="rotate(-90 22 22)" />- <circle cx="22" cy="22" r="14" fill={style.fill} stroke={style.ring} strokeWidth="2" />+ <span className="level-ring" style={{ width: size, height: size }} data-kind={kind} data-tier={RANK_INFO[rank].tier}>+ <svg viewBox="0 0 48 48" width={size} height={size} aria-hidden>+ <circle cx="24" cy="24" r={r} className="level-ring-track" />+ <circle cx="24" cy="24" r={r} className="level-ring-fill" strokeDasharray={`${c * fraction} ${c}`} transform="rotate(-90 24 24)" />+ <circle cx="24" cy="24" r="16.5" className="level-ring-medal" /></svg>- <b style={{ color: style.ink }}>{level}</b>+ <RankInsignia rank={rank} size={size * 0.46} className="level-ring-insignia" />+ <b>{level}</b></span>);}@@ -89,11 +89,11 @@ export function LevelHud({ playerName, petName, compact }: { playerName: string;return (<button type="button" className="office-card level-hud" data-compact={compact || undefined} onClick={openHall}aria-label={t("society.level.open_panel")} aria-keyshortcuts="L">- <LevelRing kind="person" level={level} fraction={fraction} size={compact ? 34 : 44} />+ <LevelRing kind="person" level={level} fraction={fraction} size={compact ? 38 : 54} /><span className="level-hud-body"><span className="level-hud-name"><strong>{playerName}</strong>- <em>{t(`society.level.title.${person?.title || "newcomer"}`)}</em>+ <em>{t(`society.level.title.${person?.title || "private"}`)}</em></span><XpBar fraction={fraction} kind="person" label={t("society.level.xp_label")} />{!compact && <span className="level-hud-xp">{xpText}</span>}@@ -133,7 +133,7 @@ function LevelToast({ toast, name, onClose, label }: { toast: Celebration; name:<LevelChip kind="agent" level={toast.level} /><span><strong>{label("society.level.agent_up").replace("{0}", name).replace("{1}", String(toast.level))}</strong>- <em>{toast.away ? label("society.level.while_away") : label(`society.level.title.${toast.title || "rookie"}`)}</em>+ <em>{toast.away ? label("society.level.while_away") : label(`society.level.title.${toast.title || "private"}`)}</em></span></button>);diff --git a/jarvis/ui/web/frontend/src/components/society/progression/LevelUpBanner.tsx b/jarvis/ui/web/frontend/src/components/society/progression/LevelUpBanner.tsxindex 5e1db4c2c5..f5faaa9803 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/LevelUpBanner.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/LevelUpBanner.tsx@@ -1,26 +1,28 @@/**- * The level-up banner for the person and their pet, in four beats:- * light rays and a flash behind (0 s), "LEVEL UP" stamps in with an- * overshoot (0.1 s), the old number rolls out and the new one in (0.35 s),- * then the new title and each unlocked reward card slide up one after the- * other (0.8 s on). It stays about four seconds — longer when it has- * rewards to show — and a click or Escape closes it early. Several level-ups- * play one after another. Reduced motion shows the same card without motion.+ * The promotion card for the person and their pet, styled like a citation:+ * midnight blue, a fine double gold rule, no flashing. In four beats:+ *+ * 1. the card settles in and "Promoted" (or "Level up") is set (0–0.4 s);+ * 2. on a promotion the old insignia stands for a moment, then steps aside+ * and dims while the new one is laid on piece by piece — each chevron,+ * rocker, bar or star in turn — and catches the light once (0.5–1.6 s);+ * between two promotions the insignia stays and the level number rolls;+ * 3. the rank name, its grade and the level are set below (from 1.2 s);+ * 4. each uniform piece the promotion unlocked slides up after it.+ *+ * It stays about five seconds — longer with pieces to show — and a click or+ * Escape closes it early. Several level-ups play one after another. Reduced+ * motion shows the same card without motion.*/import { useEffect } from "react";import { useT } from "@/i18n";+import { RANK_INFO, rankAt } from "./levelCatalog";+import { RankInsignia } from "./insignia/RankInsignia";import { useProgression } from "./progressionStore";import { RewardIcon } from "./RewardIcon";-const BASE_MS = 4000;--function titleAt(bands: { level: number; title: string }[] | undefined, level: number): string {- let title = "";- for (const band of bands ?? []) if (level >= band.level) title = band.title;- return title;-}--const PER_REWARD_MS = 700;+const BASE_MS = 5200;+const PER_REWARD_MS = 800;export function LevelUpBanner({ playerName, petName }: { playerName: string; petName: string }) {const t = useT();@@ -39,36 +41,51 @@ export function LevelUpBanner({ playerName, petName }: { playerName: string; petif (!banner) return null;const pet = banner.kind === "pet";const who = pet ? t("society.level.pet_up").replace("{0}", petName) : playerName;- // The title line only when the climb crossed into a new title band.- const titleChanged = !!banner.title && titleAt(bands, banner.previousLevel) !== banner.title;+ const rank = rankAt(bands, banner.level);+ const before = rankAt(bands, banner.previousLevel);+ const promoted = before !== rank;+ const info = RANK_INFO[rank];+ const next = bands?.find((band) => band.level > banner.level);return (<div className="level-banner-layer" data-office-ui>- <button type="button" key={banner.id} className="level-banner" data-kind={banner.kind} onClick={dismiss}- aria-label={t("society.level.banner_aria").replace("{0}", who).replace("{1}", String(banner.level))}>- <span className="level-banner-rays" aria-hidden />- <span className="level-banner-flash" aria-hidden />- {banner.away && <span className="level-banner-away">{t("society.level.while_away")}</span>}- <span className="level-banner-kicker">{t("society.level.level_up")}</span>- <span className="level-banner-number" aria-hidden>- <span className="level-banner-old">{banner.previousLevel}</span>- <span className="level-banner-new">{banner.level}</span>+ <button type="button" key={banner.id} className="promo" data-tier={info.tier} data-promoted={promoted || undefined} onClick={dismiss}+ aria-label={(promoted ? t("society.level.promoted_aria") : t("society.level.banner_aria"))+ .replace("{0}", who).replace("{1}", String(banner.level)).replace("{2}", t(`society.level.title.${rank}`))}>+ <span className="promo-rule" aria-hidden />+ {banner.away && <span className="promo-away">{t("society.level.while_away")}</span>}+ <span className="promo-kicker">{promoted ? t("society.level.promoted") : t("society.level.level_up")}</span>+ <span className="promo-who">{who}</span>+ <span className="promo-stage" aria-hidden>+ {promoted && <span className="promo-old"><RankInsignia rank={before} size={64} /></span>}+ <span className="promo-new"><RankInsignia rank={rank} size={118} reveal={promoted} /></span>+ </span>+ <span className="promo-rank">{t(`society.level.title.${rank}`)}</span>+ <span className="promo-grade">+ <span>{info.grade}</span>+ <span className="promo-dot" aria-hidden />+ <span className="promo-level">+ {t("society.level.lv").replace("{0}", "")}+ <span className="promo-number">+ <span className="promo-number-old">{banner.previousLevel}</span>+ <span className="promo-number-new">{banner.level}</span>+ </span>+ </span></span>- <span className="level-banner-who">{who}</span>- {titleChanged && (- <span className="level-banner-title">- {t("society.level.title_line").replace("{0}", t(`society.level.title.${banner.title}`))}+ {!promoted && next && (+ <span className="promo-next">+ {t("society.level.next_promotion").replace("{0}", t(`society.level.title.${next.title}`)).replace("{1}", String(next.level))}</span>)}{banner.unlocked.length > 0 && (- <span className="level-banner-rewards">- <span className="level-banner-unlocked">{t("society.level.unlocked")}</span>+ <span className="promo-rewards">+ <span className="promo-unlocked">{t("society.level.unlocked")}</span>{banner.unlocked.map((reward, i) => (- <span key={reward} className="level-banner-reward" style={{ animationDelay: `${0.9 + i * 0.18}s` }}>- <RewardIcon reward={reward} size={34} />+ <span key={reward} className="promo-reward" style={{ animationDelay: `${1.7 + i * 0.22}s` }}>+ <RewardIcon reward={reward} size={40} /><span>{t(`society.level.reward.${reward}`)}</span></span>))}- <span className="level-banner-hint">{t(pet ? "society.level.equip_hint_pet" : "society.level.equip_hint")}</span>+ <span className="promo-hint">{t("society.level.equip_hint")}</span></span>)}</button>diff --git a/jarvis/ui/web/frontend/src/components/society/progression/ProgressionLayer.tsx b/jarvis/ui/web/frontend/src/components/society/progression/ProgressionLayer.tsxindex b5b7a4ad26..b6e7ddd9f9 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/ProgressionLayer.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/ProgressionLayer.tsx@@ -1,67 +1,22 @@/**- * Everything the level system draws inside the Verse's canvas: what the- * person, their pet and every agent wear (trail, aura, gadget), the burst of- * a level-up and the floating "+XP". It only reads the shared positions the- * walkers already publish (`player`, `agentPositions`, `petBody`); it never- * moves anyone.+ * What the level system draws inside the Verse's canvas besides the figures'+ * own uniforms and insignia (those are worn on the body, `regalia/dress.tsx`):+ * the moment of a level-up and the floating "+XP". It only reads the shared+ * positions the walkers already publish (`player`, `agentPositions`,+ * `petBody`); it never moves anyone.*/-import { useMemo, useRef } from "react";+import { useRef } from "react";import { useFrame } from "@react-three/fiber";-import { useT } from "@/i18n";-import type { SocietyAgent } from "../data";import { OFFICE_FIGURE_HEIGHT_M } from "../office/OfficeAgents";import { player } from "../office/officeStore";import { agentPositions, petBody } from "../office/walkerRegistry";-import { CosmeticTrail, type FlairSource, type TrailKind } from "./effects/CosmeticTrail";-import { CosmeticAura, CosmeticGadget, type AuraKind, type GadgetKind } from "./effects/CosmeticWear";-import { LevelUpBurst, XpPopup } from "./effects/LevelUpBurst";-import { equippedFor, type Loadout } from "./cosmetics";-import { agentSubject, PERSON_SUBJECT, petSubject, reportWorldAction } from "./progressionApi";+import { LevelUpBurst, XpPopup, type FlairSource } from "./effects/LevelUpBurst";+import { isRankId, rankAt } from "./levelCatalog";+import { PERSON_SUBJECT, petSubject, reportWorldAction } from "./progressionApi";import { useProgression } from "./progressionStore";-import type { SubjectKind } from "./levelCatalog";--/** The lead is the person's pet, never an agent with its own flair. */-const LEAD_AGENT_ID = "jarvis";const personSource: FlairSource = () => ({ x: player.x, z: player.z, heading: player.heading });const petSource: FlairSource = () => (petBody.active ? { x: petBody.x, z: petBody.z } : null);-const petTopSource: FlairSource = () => (petBody.active ? { x: petBody.x, z: petBody.z, y: petBody.top } : null);--/** Agents carry no heading in the registry; it is read off their motion, and held while they stand. */-function agentSource(agentId: string): FlairSource {- let last: { x: number; z: number } | null = null;- let heading = 0;- return () => {- const p = agentPositions.get(agentId);- if (!p) return null;- if (last) {- const dx = p.x - last.x, dz = p.z - last.z;- if (dx * dx + dz * dz > 1e-5) heading = Math.atan2(dx, dz);- }- last = { x: p.x, z: p.z };- return { x: p.x, z: p.z, heading };- };-}--/** `gadgetOnFigure`: the wearer is a figure that wears its gadget on its own body (`wornGadget.tsx`). */-function Flair({ loadout, source, topSource, top, scale, paused, reduced, gadgetOnFigure = false }: {- loadout: Loadout; source: FlairSource; topSource?: FlairSource; top: number; scale: number; paused: boolean; reduced: boolean;- gadgetOnFigure?: boolean;-}) {- return (- <>- {loadout.aura && <CosmeticAura kind={loadout.aura as AuraKind} source={source} scale={scale} paused={paused} reduced={reduced} />}- {loadout.trail && !reduced && <CosmeticTrail kind={loadout.trail as TrailKind} source={source} scale={scale} paused={paused} />}- {loadout.gadget && !gadgetOnFigure && <CosmeticGadget kind={loadout.gadget as GadgetKind} source={topSource ?? source} top={top} scale={scale}- paused={paused} reduced={reduced} />}- </>- );-}--function AgentFlair({ agentId, loadout, paused, reduced }: { agentId: string; loadout: Loadout; paused: boolean; reduced: boolean }) {- const source = useMemo(() => agentSource(agentId), [agentId]);- return <Flair loadout={loadout} source={source} top={OFFICE_FIGURE_HEIGHT_M + 0.02} scale={1} paused={paused} reduced={reduced} gadgetOnFigure />;-}/** Where a subject stands, for a burst or a "+XP", and how tall it is there. */function locate(subjectId: string, petId: string): { source: FlairSource; height: number; scale: number } | null {@@ -97,48 +52,25 @@ function useWalkTogether(awake: boolean) {});}-const BURST_LABEL: Record<SubjectKind, string> = { person: "society.level.burst_you", pet: "society.level.burst_pet", agent: "society.level.burst_agent" };--export function ProgressionLayer({ agents, awake, reduced }: { agents: ReadonlyMap<string, SocietyAgent>; awake: boolean; reduced: boolean }) {- const t = useT();- const rewards = useProgression((s) => s.snapshot?.rewards);- const subjects = useProgression((s) => s.subjects);- const choices = useProgression((s) => s.choices);+export function ProgressionLayer({ awake, reduced }: { awake: boolean; reduced: boolean }) {+ const titles = useProgression((s) => s.snapshot?.titles);const petId = useProgression((s) => s.petId);const bursts = useProgression((s) => s.bursts);const popups = useProgression((s) => s.popups);- const paused = !awake;// Popups and bursts expire on the scene's own clock.useFrame(() => useProgression.getState().expire(performance.now()));useWalkTogether(awake);- const personLevel = subjects[PERSON_SUBJECT]?.level ?? 1;- const petLevel = subjects[petSubject(petId)]?.level ?? 1;- const personLoadout = useMemo(() => (rewards ? equippedFor(rewards, "person", personLevel, choices.person) : {}), [rewards, personLevel, choices.person]);- const petLoadout = useMemo(() => (rewards ? equippedFor(rewards, "pet", petLevel, choices.pet) : {}), [rewards, petLevel, choices.pet]);- const agentLoadouts = useMemo(() => {- if (!rewards) return [];- const out: { agentId: string; loadout: Loadout }[] = [];- for (const id of agents.keys()) {- if (id === LEAD_AGENT_ID) continue;- const level = subjects[agentSubject(id)]?.level;- if (!level || level < 2) continue;- const loadout = equippedFor(rewards, "agent", level);- if (loadout.aura || loadout.trail || loadout.gadget) out.push({ agentId: id, loadout });- }- return out;- }, [rewards, agents, subjects]);-return (<group>- <Flair loadout={personLoadout} source={personSource} top={OFFICE_FIGURE_HEIGHT_M + 0.02} scale={1} paused={paused} reduced={reduced} gadgetOnFigure />- <Flair loadout={petLoadout} source={petSource} topSource={petTopSource} top={0.5} scale={0.55} paused={paused} reduced={reduced} />- {agentLoadouts.map(({ agentId, loadout }) => <AgentFlair key={agentId} agentId={agentId} loadout={loadout} paused={paused} reduced={reduced} />)}{bursts.map((burst) => {const where = locate(burst.subjectId, petId);if (!where) return null;- return <LevelUpBurst key={burst.id} source={where.source} kind={burst.kind} level={burst.level} label={t(BURST_LABEL[burst.kind])}+ const bands = titles?.[burst.kind];+ const rank = isRankId(burst.title) ? burst.title : rankAt(bands, burst.level);+ const promoted = rankAt(bands, burst.previousLevel) !== rank;+ return <LevelUpBurst key={burst.id} source={where.source} kind={burst.kind} level={burst.level} rank={rank} promoted={promoted}height={where.height} scale={where.scale} reduced={reduced} />;})}{popups.map((popup) => {diff --git a/jarvis/ui/web/frontend/src/components/society/progression/RewardIcon.tsx b/jarvis/ui/web/frontend/src/components/society/progression/RewardIcon.tsxindex 0aee878423..bb3d27dade 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/RewardIcon.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/RewardIcon.tsx@@ -1,33 +1,161 @@/**- * A cosmetic's small picture for the HUD and the progress panel: its slot's- * glyph on a tile in the effect's own colours. Purely decorative — the name- * always sits next to it.+ * A reward's picture for the HUD, the promotion card and the hall screen: the+ * piece itself, drawn from the same colours and ribbons the 3D figure wears —+ * the uniform's coat with its collar, tie and buttons, the cap, the ribbons+ * or the medals — on a dark display tile. Decorative: the name always sits+ * next to it.*/-import { EFFECT_COLOURS, FRAME_STYLE, slotOf, type RewardId } from "./levelCatalog";+import { useId } from "react";+import type { RewardId } from "./levelCatalog";+import { uniformStyle, type UniformId } from "./regalia/dress";+import { MEDAL_METALS, RIBBONS, ribbonSpans, type RibbonSpec } from "./regalia/ribbons";-function tileColours(reward: RewardId): [string, string] {- if (reward.startsWith("frame_")) {- const style = FRAME_STYLE[reward as keyof typeof FRAME_STYLE];- return [style.ring, style.fill];+const GOLD = "#d8ab47";+const GOLD_DARK = "#8f6518";++function Uniform({ id }: { id: UniformId }) {+ const u = uniformStyle(id, "captain");+ const open = u.cut === "service" || u.cut === "mess";+ return (+ <g strokeLinejoin="round">+ {/* Sleeves, then the body. */}+ <path d="M13 15 L7 35 L12 36.5 L16 24 Z M35 15 L41 35 L36 36.5 L32 24 Z" fill={u.coat} stroke="#00000055" strokeWidth={0.8} />+ <path d={u.cut === "mess" ? "M14 13 L34 13 L36 33 L24 37 L12 33 Z" : "M14 13 L34 13 L35.5 41 L12.5 41 Z"} fill={u.coat} stroke="#00000055" strokeWidth={0.8} />+ {u.cuffBraid && <path d="M7.6 33 L12.6 34.6 M40.4 33 L35.4 34.6" stroke={u.cuffBraid} strokeWidth={1.6} />}+ {/* The opening: a shirt V with the tie, or a field jacket's stand collar. */}+ {u.cut === "field" ? (+ <>+ <path d="M18 11 h12 v3.5 h-12 z" fill={u.coat} stroke="#00000055" strokeWidth={0.8} />+ <path d="M24 14 V41" stroke="#00000066" strokeWidth={1} />+ </>+ ) : (+ <>+ <path d={open ? "M18.5 13 L24 27 L29.5 13 Z" : "M20.5 13 L24 19 L27.5 13 Z"} fill={u.shirt} />+ {u.tieKind === "bow"+ ? <path d="M21 15 L24 16.5 L27 15 L27 18 L24 16.5 L21 18 Z" fill={u.tie} />+ : <path d={open ? "M23 14 L25 14 L25.6 24.5 L24 26.5 L22.4 24.5 Z" : "M23 14 L25 14 L25.6 30 L24 32 L22.4 30 Z"} fill={u.tie} />}+ {open && <path d="M18.5 13 L24 27 M29.5 13 L24 27" stroke={u.lapels ?? "#00000055"} strokeWidth={u.lapels ? 2.4 : 1} />}+ </>+ )}+ {u.pockets > 0 && [16.5, 27.5].map((x) => <rect key={x} x={x} y={20} width={4} height={1.8} rx={0.4} fill="#00000040" />)}+ {u.pockets === 4 && [16.2, 27.8].map((x) => <rect key={`l${x}`} x={x} y={31} width={4} height={1.8} rx={0.4} fill="#00000040" />)}+ {u.belt && <rect x={12.8} y={34} width={22.4} height={2.2} fill={u.belt} stroke="#00000044" strokeWidth={0.4} />}+ {(open ? [29, 32.5] : [22, 26.5, 31]).map((y) => <circle key={y} cx={24} cy={y} r={0.9} fill={u.buttons} />)}+ </g>+ );+}++function Headwear({ id }: { id: RewardId }) {+ if (id === "headwear_patrol_cap") {+ return (+ <g>+ <path d="M13 16 L35 16 L36 30 L12 30 Z" fill="#5c6248" stroke="#00000055" strokeWidth={0.8} />+ <path d="M11 29 L37 29 L39 33 Q24 36 9 33 Z" fill="#4d523b" stroke="#00000055" strokeWidth={0.8} />+ <path d="M24 19.5 L28 22 L28 24 L24 21.5 L20 24 L20 22 Z" fill={GOLD} />+ </g>+ );}- const colours = EFFECT_COLOURS[reward as keyof typeof EFFECT_COLOURS];- return [colours[0], colours[colours.length - 1]];+ if (id === "headwear_garrison_cap") {+ return (+ <g>+ <path d="M7 31 Q9 21 24 17 Q39 21 41 31 Z" fill="#1d2742" stroke="#00000066" strokeWidth={0.8} />+ <path d="M8 30.5 Q24 26 40 30.5" stroke={GOLD} strokeWidth={1} fill="none" />+ <path d="M24 17.5 Q33 20 40.5 30" stroke={GOLD} strokeWidth={0.8} fill="none" />+ <circle cx={14} cy={27} r={1.8} fill={GOLD} />+ </g>+ );+ }+ if (id === "headwear_beret") {+ return (+ <g>+ <path d="M9 28 Q8 17 22 15 Q38 14 41 24 Q41 29 33 29 L11 30 Z" fill="#141518" stroke="#ffffff22" strokeWidth={0.8} />+ <rect x={10} y={28.5} width={26} height={3} rx={1.2} fill="#24252a" />+ <path d="M14 18.5 h6 v4 q-3 3 -6 0 z" fill="#24386b" stroke={GOLD} strokeWidth={0.8} />+ <circle cx={17} cy={21} r={1} fill={GOLD} />+ </g>+ );+ }+ return (+ <g>+ <ellipse cx={24} cy={17} rx={17} ry={4.5} fill="#1d2742" stroke="#00000066" strokeWidth={0.8} />+ <path d="M11 18 L13 27 L35 27 L37 18 Z" fill="#1d2742" />+ <rect x={13} y={24} width={22} height={5} fill="#0f1013" />+ <path d="M13.5 28 h21" stroke={GOLD} strokeWidth={1.2} />+ <path d="M12 29 Q24 37 36 29 Z" fill="#0b0c0f" stroke="#ffffff22" strokeWidth={0.6} />+ <path d="M24 18.5 l2.4 1.6 -0.9 2.6 h-3 l-0.9 -2.6 z" fill={GOLD} />+ </g>+ );}-function Glyph({ reward }: { reward: RewardId }) {- const slot = slotOf(reward);- if (slot === "frame") return <path d="M7 2.5h10l5 9.5-5 9.5H7l-5-9.5z" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinejoin="round" />;- if (slot === "aura") return <><ellipse cx="12" cy="16" rx="9" ry="3.6" fill="none" stroke="currentColor" strokeWidth="2" /><circle cx="12" cy="9" r="3" fill="currentColor" /></>;- if (slot === "trail") return <><circle cx="6" cy="17" r="2.2" fill="currentColor" /><circle cx="12" cy="12" r="2.6" fill="currentColor" /><circle cx="18.5" cy="6.5" r="3" fill="currentColor" /></>;- return <path d="M12 2.8l2.6 5.6 6.1.7-4.5 4.2 1.2 6-5.4-3-5.4 3 1.2-6L3.3 9.1l6.1-.7z" fill="currentColor" />;+function Ribbon({ spec, x, y, w, h }: { spec: RibbonSpec; x: number; y: number; w: number; h: number }) {+ return (+ <g>+ {ribbonSpans(spec, w).map(([sx, sw, colour], i) => <rect key={i} x={x + sx} y={y} width={sw + 0.05} height={h} fill={colour} />)}+ <rect x={x} y={y} width={w} height={h} fill="none" stroke="#00000066" strokeWidth={0.4} />+ </g>+ );+}++function Decoration({ id }: { id: RewardId }) {+ const w = 10.5, h = 3.6;+ if (id === "decoration_ribbon_bar") {+ return <g>{[RIBBONS[4], RIBBONS[5], RIBBONS[6]].map((spec, i) => <Ribbon key={spec.id} spec={spec} x={8.25 + i * (w + 0.5)} y={22} w={w} h={h} />)}</g>;+ }+ if (id === "decoration_medals") {+ return (+ <g>+ {RIBBONS.slice(0, 3).map((spec, i) => {+ const x = 12 + i * 9;+ const metal = MEDAL_METALS[spec.medal.metal];+ return (+ <g key={spec.id}>+ <Ribbon spec={spec} x={x} y={10} w={7.5} h={11} />+ <circle cx={x + 3.75} cy={27} r={4.6} fill={metal.face} stroke={metal.edge} strokeWidth={0.9} />+ <circle cx={x + 3.75} cy={27} r={2.4} fill="none" stroke={metal.edge} strokeWidth={0.5} />+ </g>+ );+ })}+ </g>+ );+ }+ const rack = RIBBONS.slice(0, 9);+ const cords = id === "decoration_aiguillette";+ return (+ <g>+ {rack.map((spec, i) => {+ const row = Math.floor(i / 3), col = i % 3;+ return <Ribbon key={spec.id} spec={spec} x={8.25 + col * (w + 0.5)} y={(cords ? 8 : 16) + row * (h + 0.6)} w={w} h={h} />;+ })}+ {cords && (+ <g fill="none" stroke={GOLD} strokeWidth={1.3} strokeLinecap="round">+ <path d="M10 25 Q24 42 38 25" />+ <path d="M10 25 Q24 37 38 25" />+ <path d="M18 30 V40 M29 30 V41" />+ <path d="M18 40 l-1 2.6 h2 z M29 41 l-1 2.6 h2 z" fill={GOLD_DARK} stroke={GOLD_DARK} strokeWidth={0.6} />+ </g>+ )}+ </g>+ );}export function RewardIcon({ reward, locked = false, size = 30 }: { reward: RewardId; locked?: boolean; size?: number }) {- const [a, b] = tileColours(reward);+ const id = useId().replace(/:/g, "");return (- <span className="level-reward-icon" data-locked={locked || undefined} aria-hidden- style={{ width: size, height: size, background: locked ? undefined : `linear-gradient(145deg, ${a}, ${b})` }}>- <svg viewBox="0 0 24 24" width={size * 0.6} height={size * 0.6}><Glyph reward={reward} /></svg>+ <span className="level-reward-icon" data-locked={locked || undefined} aria-hidden style={{ width: size, height: size }}>+ <svg viewBox="0 0 48 48" width={size} height={size}>+ <defs>+ <radialGradient id={`${id}-tile`} cx="0.5" cy="0.3" r="0.8">+ <stop offset="0" stopColor="#2a3456" />+ <stop offset="1" stopColor="#121831" />+ </radialGradient>+ </defs>+ <rect x={0.5} y={0.5} width={47} height={47} rx={9} fill={`url(#${id}-tile)`} stroke="#c9a24a55" strokeWidth={1} />+ <g opacity={locked ? 0.35 : 1} style={locked ? { filter: "grayscale(1)" } : undefined}>+ {reward.startsWith("uniform_") && <Uniform id={reward as UniformId} />}+ {reward.startsWith("headwear_") && <Headwear id={reward} />}+ {reward.startsWith("decoration_") && <Decoration id={reward} />}+ </g>+ </svg></span>);}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/cosmetics.ts b/jarvis/ui/web/frontend/src/components/society/progression/cosmetics.tsindex 975f05fc87..2cc1f9c3b3 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/cosmetics.ts+++ b/jarvis/ui/web/frontend/src/components/society/progression/cosmetics.ts@@ -61,7 +61,8 @@ export function levelFraction(subject: Pick<SubjectLevel, "xpIntoLevel" | "xpForreturn Math.max(0, Math.min(1, subject.xpIntoLevel / subject.xpForNext));}-const CHOICES_KEY = "jarvis.verse.cosmetics.v1";+// v2: the rank uniforms replaced the trails, auras and gadgets of v1; old choices name ids that no longer exist.+const CHOICES_KEY = "jarvis.verse.cosmetics.v2";export type ChoiceBook = Partial<Record<"person" | "pet", Partial<Record<Slot, SlotChoice>>>>;diff --git a/jarvis/ui/web/frontend/src/components/society/progression/effects/AngelWings.tsx b/jarvis/ui/web/frontend/src/components/society/progression/effects/AngelWings.tsxdeleted file mode 100644index 584b678507..0000000000--- a/jarvis/ui/web/frontend/src/components/society/progression/effects/AngelWings.tsx+++ /dev/null@@ -1,368 +0,0 @@-/**- * The level-40 wings: a pair of gold-adorned angel wings worn on the figure's- * back. They are rendered inside the figure's torso, so they ride every hop,- * bob and lean of the body instead of following its ground position.- *- * Each wing is an arm (shoulder → elbow → wrist) carrying a fan of long- * secondaries and two rows of coverts, and a hand at the wrist carrying the- * primaries and their coverts. Every flight feather fades from pearl white- * into a gold tip and sits on a slightly larger gold blade that shows as a- * gilded rim. The arm wears a gold rail with jewelled joints and filigree- * scrolls, a warm glow sits behind each wing and gold dust drifts off them.- * The feathers of one layer are one instanced mesh, so a wing costs a handful- * of draw calls. The wings fold tight while the wearer sits, tuck in while it- * walks, rest half open while it stands and spread wide and beat in the air.- */-import { useLayoutEffect, useMemo, useRef } from "react";-import { useFrame } from "@react-three/fiber";-import {- AdditiveBlending, BufferAttribute, BufferGeometry, CatmullRomCurve3, Color, DoubleSide, Euler, Float32BufferAttribute,- Matrix4, MeshStandardMaterial, Quaternion, Shape, ShapeGeometry, SphereGeometry, TubeGeometry, Vector3,- type Group, type InstancedMesh, type Material, type Points,-} from "three";-import type { FigureMode } from "../../figures/FigureRig";-import { glowTexture, starTexture } from "./flairTextures";--/** One feather in its wing's plane: x points away from the body, y up (rig metres). */-interface Feather {- x: number;- y: number;- /** Direction the quill points, radians from +x towards +y. */- angle: number;- length: number;- /** Vane width as a share of the length. */- width: number;- /** Depth offset; more negative sits nearer a viewer behind the wearer. */- z: number;-}--const PEARL = new Color("#fffdf6");-const GOLD = new Color("#f2bf4c");-const PALE_GOLD = new Color("#fbe3a2");-const DEG = Math.PI / 180;-const lerp = (a: number, b: number, t: number) => a + (b - a) * t;--// ------------------------------------------------------------------ shared geometry and materials-// Built once per page on first use and shared by every wearer, like the flair textures.--let shared: {- flight: BufferGeometry; covert: BufferGeometry; feather: Material; gold: Material; gem: Material;- knob: BufferGeometry; jewel: BufferGeometry;-} | null = null;--/** A unit-length feather along +x, tip bent slightly back, coloured from pearl into `tip` from `fadeAt` on. */-function bentFeather(shape: Shape, tip: Color, fadeAt: number): BufferGeometry {- const geometry = new ShapeGeometry(shape, 8);- const position = geometry.attributes.position;- const colours = new Float32Array(position.count * 3);- const c = new Color();- for (let i = 0; i < position.count; i += 1) {- const x = position.getX(i);- position.setZ(i, -0.09 * x * x);- const t = Math.max(0, (x - fadeAt) / (1 - fadeAt));- c.copy(PEARL).lerp(tip, t * t * (3 - 2 * t));- c.toArray(colours, i * 3);- }- geometry.setAttribute("color", new Float32BufferAttribute(colours, 3));- geometry.computeVertexNormals();- return geometry;-}--function wingKit() {- if (shared) return shared;- // Long flight feather: narrow leading vane, wider trailing vane, rounded tip.- const flight = new Shape();- flight.moveTo(0, 0);- flight.bezierCurveTo(0.15, 0.06, 0.55, 0.1, 0.86, 0.07);- flight.quadraticCurveTo(1, 0.04, 1, 0);- flight.quadraticCurveTo(0.98, -0.08, 0.82, -0.12);- flight.bezierCurveTo(0.55, -0.15, 0.15, -0.1, 0, 0);- // Short, round covert feather.- const covert = new Shape();- covert.moveTo(0, 0);- covert.bezierCurveTo(0.2, 0.2, 0.75, 0.24, 1, 0);- covert.bezierCurveTo(0.75, -0.24, 0.2, -0.2, 0, 0);- shared = {- flight: bentFeather(flight, GOLD, 0.55),- covert: bentFeather(covert, PALE_GOLD, 0.6),- feather: new MeshStandardMaterial({- color: "#ffffff", vertexColors: true, roughness: 0.5, metalness: 0.05,- emissive: "#fff0c8", emissiveIntensity: 0.28, side: DoubleSide,- }),- gold: new MeshStandardMaterial({- color: "#f3bd3f", roughness: 0.26, metalness: 0.8, emissive: "#c48a12", emissiveIntensity: 0.5, side: DoubleSide,- }),- gem: new MeshStandardMaterial({ color: "#fffbe8", emissive: "#ffe9a6", emissiveIntensity: 2.2, roughness: 0.1, toneMapped: false }),- knob: new SphereGeometry(1, 16, 12),- jewel: new SphereGeometry(1, 12, 10),- };- return shared;-}--// ------------------------------------------------------------------ the feather plan--/** The arm's leading edge: shoulder, elbow, wrist (wing plane, rig metres). */-const ARM: readonly [number, number][] = [[0.03, 0], [0.2, 0.3], [0.4, 0.5]];--function onArm(t: number): [number, number] {- const k = Math.min(1, Math.max(0, t)) * (ARM.length - 1);- const i = Math.min(ARM.length - 2, Math.floor(k));- const f = k - i;- return [lerp(ARM[i][0], ARM[i + 1][0], f), lerp(ARM[i][1], ARM[i + 1][1], f)];-}--function armLayers(): { secondaries: Feather[]; coverts: Feather[] } {- const secondaries: Feather[] = [];- for (let i = 0; i < 11; i += 1) {- const u = i / 10;- const [x, y] = onArm(u * 0.96);- secondaries.push({ x, y, angle: lerp(-94, -58, u) * DEG, length: lerp(0.5, 0.56, u), width: 0.95, z: i * 0.002 });- }- const coverts: Feather[] = [];- for (let i = 0; i < 12; i += 1) {- const u = i / 11;- const [x, y] = onArm(u);- coverts.push({ x, y: y - 0.05, angle: lerp(-84, -50, u) * DEG, length: 0.26, width: 1, z: -0.02 + i * 0.001 });- }- for (let i = 0; i < 14; i += 1) {- const u = i / 13;- const [x, y] = onArm(u);- coverts.push({ x, y: y - 0.005, angle: lerp(-72, -35, u) * DEG, length: 0.14, width: 1.1, z: -0.032 + i * 0.001 });- }- return { secondaries, coverts };-}--const PRIMARY_LENGTHS = [0.66, 0.78, 0.82, 0.8, 0.76, 0.71, 0.66, 0.62, 0.58, 0.55, 0.52];--function handLayers(): { primaries: Feather[]; coverts: Feather[] } {- const primaries: Feather[] = PRIMARY_LENGTHS.map((length, i) => {- const u = i / (PRIMARY_LENGTHS.length - 1);- return { x: lerp(0.08, 0, u), y: lerp(0.025, 0, u), angle: lerp(38, -56, u) * DEG, length, width: 0.85, z: 0.012 + i * 0.002 };- });- const coverts: Feather[] = [];- for (let i = 0; i < 7; i += 1) {- const u = i / 6;- coverts.push({ x: lerp(0.07, -0.02, u), y: lerp(0.035, -0.02, u), angle: lerp(30, -42, u) * DEG, length: 0.3, width: 1, z: -0.015 + i * 0.001 });- }- return { primaries, coverts };-}--/** The gold blade inside a flight feather: a touch longer and wider, so a gilded rim shows around it. */-function trimOf(feathers: readonly Feather[]): Feather[] {- return feathers.map((f) => ({ ...f, length: f.length * 1.045, width: f.width * 1.25, z: f.z + 0.006 }));-}--/** The feather's far face: a second vane behind the gold blade, so the rim reads from both sides. */-function farFaceOf(feathers: readonly Feather[]): Feather[] {- return feathers.map((f) => ({ ...f, z: f.z + 0.012 }));-}--const ARM_LAYERS = armLayers();-const HAND_LAYERS = handLayers();-const SECONDARY_TRIM = trimOf(ARM_LAYERS.secondaries);-const PRIMARY_TRIM = trimOf(HAND_LAYERS.primaries);-const SECONDARY_FAR = farFaceOf(ARM_LAYERS.secondaries);-const PRIMARY_FAR = farFaceOf(HAND_LAYERS.primaries);--function Feathers({ feathers, geometry, material, shadow }: {- feathers: readonly Feather[]; geometry: BufferGeometry; material: Material; shadow: boolean;-}) {- const mesh = useRef<InstancedMesh>(null);- useLayoutEffect(() => {- const m = mesh.current;- if (!m) return;- const matrix = new Matrix4();- const q = new Quaternion();- const e = new Euler();- const p = new Vector3();- const s = new Vector3();- feathers.forEach((f, i) => {- // Rolled a little about the quill so neighbours overlap like shingles.- q.setFromEuler(e.set(0.28, 0, f.angle));- matrix.compose(p.set(f.x, f.y, f.z), q, s.set(f.length, f.length * f.width, f.length));- m.setMatrixAt(i, matrix);- });- m.instanceMatrix.needsUpdate = true;- }, [feathers]);- return <instancedMesh ref={mesh} args={[geometry, material, feathers.length]} castShadow={shadow} frustumCulled={false} />;-}--// ------------------------------------------------------------------ gold ornaments--/** A flat spiral in the wing plane, for the filigree scrolls under the arm. */-function scrollCurve(cx: number, cy: number, radius: number, turns: number, start: number, z: number): CatmullRomCurve3 {- const points: Vector3[] = [];- for (let i = 0; i <= 24; i += 1) {- const t = i / 24;- const a = start + t * turns * Math.PI * 2;- const r = radius * (1 - 0.82 * t);- points.push(new Vector3(cx + Math.cos(a) * r, cy + Math.sin(a) * r, z));- }- return new CatmullRomCurve3(points);-}--/** The gold rail, jewelled joints and filigree on one face of the arm; `face` −1 is the outer side, +1 the body side. */-function ArmOrnaments({ face }: { face: 1 | -1 }) {- const kit = wingKit();- const z = face < 0 ? -0.04 : 0.05;- const rail = useMemo(() => {- const curve = new CatmullRomCurve3([- new Vector3(-0.01, -0.04, z), new Vector3(0.1, 0.16, z), new Vector3(0.2, 0.3, z),- new Vector3(0.31, 0.42, z), new Vector3(0.42, 0.51, z),- ]);- return new TubeGeometry(curve, 40, 0.024, 10, false);- }, [z]);- const scrolls = useMemo(() => [- new TubeGeometry(scrollCurve(0.12, 0.08, 0.075, 1.3, 0.6, z), 48, 0.009, 6, false),- new TubeGeometry(scrollCurve(0.29, 0.31, 0.065, 1.2, 0.9, z), 48, 0.008, 6, false),- new TubeGeometry(scrollCurve(0.05, -0.11, 0.06, 1.1, 1.8, z), 40, 0.008, 6, false),- ], [z]);- useLayoutEffect(() => () => { rail.dispose(); scrolls.forEach((g) => g.dispose()); }, [rail, scrolls]);- const joints: [number, number, number][] = [[0.0, -0.03, 0.05], [0.2, 0.3, 0.045], [0.42, 0.51, 0.05]];- return (- <group>- <mesh geometry={rail} material={kit.gold} castShadow={face < 0} />- {scrolls.map((g, i) => <mesh key={i} geometry={g} material={kit.gold} />)}- {joints.map(([x, y, r], i) => (- <group key={i} position={[x, y, z]}>- <mesh geometry={kit.knob} material={kit.gold} scale={r} />- <mesh geometry={kit.jewel} material={kit.gem} position={[0, 0, face * r * 0.8]} scale={r * 0.55} />- </group>- ))}- </group>- );-}--// ------------------------------------------------------------------ gold dust--const DUST = 44;--function GoldDust({ spread, paused }: { spread: { current: number }; paused: boolean }) {- const points = useRef<Points>(null);- const pool = useMemo(() => {- const geometry = new BufferGeometry();- const position = new Float32Array(DUST * 3);- const colour = new Float32Array(DUST * 3);- geometry.setAttribute("position", new BufferAttribute(position, 3));- geometry.setAttribute("color", new BufferAttribute(colour, 3));- const age = new Float32Array(DUST).map(() => Math.random() * 2.4);- const life = new Float32Array(DUST).map(() => 1.6 + Math.random() * 1.2);- const sway = new Float32Array(DUST).map(() => Math.random() * Math.PI * 2);- return { geometry, position, colour, age, life, sway, tint: new Color() };- }, []);- useLayoutEffect(() => () => pool.geometry.dispose(), [pool]);- const spawn = (i: number) => {- const side = Math.random() < 0.5 ? -1 : 1;- const reach = lerp(0.35, 1.05, spread.current);- pool.position[i * 3] = side * (0.12 + Math.random() * reach);- pool.position[i * 3 + 1] = -0.45 + Math.random() * 0.95;- pool.position[i * 3 + 2] = -0.18 - Math.random() * 0.25;- pool.age[i] = 0;- };- useFrame((_, rawDt) => {- const dt = paused ? 0 : Math.min(rawDt, 0.1);- const { position, colour, age, life, sway, tint } = pool;- for (let i = 0; i < DUST; i += 1) {- age[i] += dt;- if (age[i] >= life[i]) spawn(i);- const t = age[i] / life[i];- position[i * 3] += Math.sin(age[i] * 2.4 + sway[i]) * 0.03 * dt;- position[i * 3 + 1] -= 0.16 * dt;- // Additive points fade by darkening: in, hold, out.- const fade = Math.min(1, t * 5) * (1 - t);- tint.copy(i % 3 === 0 ? PEARL : GOLD).multiplyScalar(fade * 1.4);- tint.toArray(colour, i * 3);- }- pool.geometry.attributes.position.needsUpdate = true;- pool.geometry.attributes.color.needsUpdate = true;- });- return (- <points ref={points} geometry={pool.geometry} frustumCulled={false} renderOrder={2}>- <pointsMaterial map={starTexture()} size={0.07} sizeAttenuation vertexColors transparent blending={AdditiveBlending} depthWrite={false} toneMapped={false} />- </points>- );-}--// ------------------------------------------------------------------ the wings--/** How open the wings rest in each figure mode (0 folded, 1 spread). */-const SPREAD: Record<FigureMode, number> = {- idle: 0.8, walk: 0.45, work: 0, talk: 0.75, sit: 0, sleep: 0, celebrate: 1, wave: 0.95,-};--/** The whole pair's size on the rig; the plan above is drawn at 1. */-const WING_SCALE = 1.3;--export interface WingMotion {- /** True while the wearer is off the floor (a jump): the wings spread and beat. */- airborne?: () => boolean;-}--export function AngelWings({ drive, airborne, paused, reduced }: {- drive: { current: { mode: FigureMode } };- paused: boolean;- reduced: boolean;-} & WingMotion) {- const kit = wingKit();- const arms = useRef<(Group | null)[]>([]);- const hands = useRef<(Group | null)[]>([]);- const state = useRef({ clock: Math.random() * 10, beat: 0 });- const spread = useRef(SPREAD.idle);-- useFrame((_, rawDt) => {- const s = state.current;- const dt = paused ? 0 : Math.min(rawDt, 0.1);- const flying = !!airborne?.();- const target = flying ? 1 : SPREAD[drive.current.mode] ?? SPREAD.idle;- spread.current += (target - spread.current) * (1 - Math.exp(-(flying ? 14 : 6) * dt));- s.clock += dt;- // A strong beat in the air that fades out after landing; a slow breath on the ground.- s.beat += ((flying ? 1 : 0) - s.beat) * (1 - Math.exp(-8 * dt));- const calm = reduced ? 0 : 1;- const breath = 0.05 * Math.sin(s.clock * 1.7) * calm;- const stroke = 0.5 * s.beat * Math.sin(s.clock * 15) * calm;- const lag = 0.4 * s.beat * Math.sin(s.clock * 15 - 0.7) * calm;- const k = spread.current;- for (let i = 0; i < 2; i += 1) {- const arm = arms.current[i];- const hand = hands.current[i];- if (arm) {- arm.rotation.y = lerp(1.25, 0.12, k);- arm.rotation.z = lerp(-0.3, 0.1, k) + breath + stroke;- }- if (hand) {- hand.rotation.y = lerp(1.1, 0, k);- hand.rotation.z = lerp(-0.75, 0, k) + breath * 0.6 + lag;- }- }- });-- return (- <group scale={WING_SCALE}>- {[1, -1].map((side, i) => (- // Leaned back a little so the arch clears the head; the right wing mirrors the left.- <group key={side} position={[side * 0.04, 0, 0]} scale={[side, 1, 1]} rotation={[-0.28, 0, 0]}>- <group ref={(g) => { arms.current[i] = g; }}>- <mesh position={[0.4, 0.15, 0.08]} scale={1.6}>- <planeGeometry args={[1, 1]} />- <meshBasicMaterial map={glowTexture()} color="#ffe6a8" transparent opacity={0.24} blending={AdditiveBlending} depthWrite={false} toneMapped={false} />- </mesh>- <Feathers feathers={SECONDARY_FAR} geometry={kit.flight} material={kit.feather} shadow={false} />- <Feathers feathers={SECONDARY_TRIM} geometry={kit.flight} material={kit.gold} shadow={false} />- <Feathers feathers={ARM_LAYERS.secondaries} geometry={kit.flight} material={kit.feather} shadow />- <Feathers feathers={ARM_LAYERS.coverts} geometry={kit.covert} material={kit.feather} shadow={false} />- <ArmOrnaments face={-1} />- <ArmOrnaments face={1} />- <group ref={(g) => { hands.current[i] = g; }} position={[ARM[2][0], ARM[2][1], 0]}>- <Feathers feathers={PRIMARY_FAR} geometry={kit.flight} material={kit.feather} shadow={false} />- <Feathers feathers={PRIMARY_TRIM} geometry={kit.flight} material={kit.gold} shadow={false} />- <Feathers feathers={HAND_LAYERS.primaries} geometry={kit.flight} material={kit.feather} shadow />- <Feathers feathers={HAND_LAYERS.coverts} geometry={kit.covert} material={kit.feather} shadow={false} />- </group>- </group>- </group>- ))}- {!reduced && <GoldDust spread={spread} paused={paused} />}- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/effects/CosmeticTrail.tsx b/jarvis/ui/web/frontend/src/components/society/progression/effects/CosmeticTrail.tsxdeleted file mode 100644index 1faea9d8a2..0000000000--- a/jarvis/ui/web/frontend/src/components/society/progression/effects/CosmeticTrail.tsx+++ /dev/null@@ -1,229 +0,0 @@-/**- * The trail a levelled-up figure leaves while it moves: glowing footprints,- * sparkles, a comet tail, a neon ribbon, a rainbow or star dust. Every trail- * lives in world space (it stays where it was drawn and fades), is one draw- * call, and recycles a fixed pool, so a long walk never allocates.- */-import { useEffect, useLayoutEffect, useMemo, useRef } from "react";-import { useFrame } from "@react-three/fiber";-import {- AdditiveBlending, BufferAttribute, BufferGeometry, Color, DoubleSide, Euler, InstancedMesh, Matrix4, PlaneGeometry,- Quaternion, Vector3, type Points,-} from "three";-import { EFFECT_COLOURS, type RewardId } from "../levelCatalog";-import { footprintTexture, glowTexture, starTexture } from "./flairTextures";-import { footprintAt, pruneSamples, pushSample, rainbowHue, RIBBON_MAX_SAMPLES, STEP_LENGTH_M, writeRibbon, type TrailSample } from "./trailModel";--export type TrailKind = Extract<RewardId, `trail_${string}`>;--/** Where the wearer is now; null hides nothing but stops new trail. */-export type FlairSource = () => { x: number; z: number; heading?: number; y?: number } | null;--const RIBBON_LIFE_S = 0.9;-const RIBBON_WIDTH: Partial<Record<TrailKind, number>> = { trail_comet: 0.34, trail_neon: 0.22, trail_rainbow: 0.4 };--export function CosmeticTrail({ kind, source, scale = 1, paused }: { kind: TrailKind; source: FlairSource; scale?: number; paused: boolean }) {- if (kind === "trail_footprints") return <Footprints source={source} scale={scale} paused={paused} />;- if (kind === "trail_sparkle" || kind === "trail_stardust") return <Sparks kind={kind} source={source} scale={scale} paused={paused} />;- return <Ribbon kind={kind} source={source} scale={scale} paused={paused} />;-}--// ------------------------------------------------------------------ footprints--const PRINTS = 16;-const PRINT_LIFE_S = 2.6;--function Footprints({ source, scale, paused }: { source: FlairSource; scale: number; paused: boolean }) {- const mesh = useRef<InstancedMesh>(null);- const state = useRef({ travelled: 0, left: true, last: null as { x: number; z: number } | null, next: 0, clock: 0 });- const born = useMemo(() => new Float32Array(PRINTS).fill(-99), []);- const geometry = useMemo(() => new PlaneGeometry(0.13 * scale, 0.2 * scale), [scale]);- useEffect(() => () => geometry.dispose(), [geometry]);- const tmp = useMemo(() => ({ m: new Matrix4(), q: new Quaternion(), e: new Euler(), p: new Vector3(), s: new Vector3(1, 1, 1), c: new Color() }), []);- const base = useMemo(() => new Color(EFFECT_COLOURS.trail_footprints[0]), []);-- // Before the first frame every print is hidden (zero scale, black), so none flashes at the origin.- useLayoutEffect(() => {- const m = mesh.current;- if (!m) return;- tmp.c.setRGB(0, 0, 0);- for (let i = 0; i < PRINTS; i++) { m.setColorAt(i, tmp.c); tmp.m.makeScale(0, 0, 0); m.setMatrixAt(i, tmp.m); }- m.instanceMatrix.needsUpdate = true;- if (m.instanceColor) m.instanceColor.needsUpdate = true;- }, [tmp, geometry]);-- useFrame((_, rawDt) => {- const m = mesh.current;- if (!m || paused) return;- const s = state.current;- s.clock += Math.min(rawDt, 0.1);- const at = source();- if (at) {- if (s.last) {- const step = Math.hypot(at.x - s.last.x, at.z - s.last.z);- s.travelled += step < 2.5 ? step : 0;- }- s.last = { x: at.x, z: at.z };- if (s.travelled >= STEP_LENGTH_M * scale) {- s.travelled = 0;- const print = footprintAt(at.x, at.z, at.heading ?? 0, s.left);- s.left = !s.left;- const i = s.next;- s.next = (i + 1) % PRINTS;- born[i] = s.clock;- tmp.e.set(-Math.PI / 2, print.rot + Math.PI, 0, "YXZ");- tmp.q.setFromEuler(tmp.e);- tmp.p.set(print.x, 0.022, print.z);- tmp.m.compose(tmp.p, tmp.q, tmp.s);- m.setMatrixAt(i, tmp.m);- m.instanceMatrix.needsUpdate = true;- }- }- for (let i = 0; i < PRINTS; i++) {- const fade = Math.max(0, 1 - (s.clock - born[i]) / PRINT_LIFE_S);- tmp.c.copy(base).multiplyScalar(fade * 0.85);- m.setColorAt(i, tmp.c);- }- if (m.instanceColor) m.instanceColor.needsUpdate = true;- });-- return (- <instancedMesh ref={mesh} args={[geometry, undefined, PRINTS]} frustumCulled={false} renderOrder={2}>- <meshBasicMaterial map={footprintTexture()} transparent blending={AdditiveBlending} depthWrite={false} side={DoubleSide} />- </instancedMesh>- );-}--// ------------------------------------------------------------------ sparks--const SPARKS = 48;--function nextRandom(seed: { value: number }): number {- seed.value = (Math.imul(seed.value, 1664525) + 1013904223) >>> 0;- return seed.value / 4294967296;-}--function Sparks({ kind, source, scale, paused }: { kind: "trail_sparkle" | "trail_stardust"; source: FlairSource; scale: number; paused: boolean }) {- const points = useRef<Points>(null);- const stardust = kind === "trail_stardust";- const life = stardust ? 1.4 : 0.9;- const pool = useMemo(() => {- const geometry = new BufferGeometry();- const positions = new Float32Array(SPARKS * 3);- const colours = new Float32Array(SPARKS * 3);- geometry.setAttribute("position", new BufferAttribute(positions, 3));- geometry.setAttribute("color", new BufferAttribute(colours, 3));- return { geometry, positions, colours, age: new Float32Array(SPARKS).fill(99), rise: new Float32Array(SPARKS), tint: new Float32Array(SPARKS), next: 0 };- }, []);- useEffect(() => () => pool.geometry.dispose(), [pool]);- const palette = useMemo(() => EFFECT_COLOURS[kind].map((c) => new Color(c)), [kind]);- const state = useRef({ last: null as { x: number; z: number } | null, debt: 0, clock: 0, seed: { value: 0x2545f491 } });-- useFrame((_, rawDt) => {- if (paused) return;- const dt = Math.min(rawDt, 0.1);- const s = state.current;- s.clock += dt;- const at = source();- const { positions, colours, age, rise, tint } = pool;- if (at) {- const moved = s.last ? Math.hypot(at.x - s.last.x, at.z - s.last.z) : 0;- s.last = { x: at.x, z: at.z };- if (moved > 0.004 && moved < 2.5) {- s.debt += dt * (stardust ? 34 : 26);- while (s.debt >= 1) {- s.debt -= 1;- const i = pool.next;- pool.next = (i + 1) % SPARKS;- const spread = (stardust ? 0.5 : 0.3) * scale;- positions[i * 3] = at.x + (nextRandom(s.seed) - 0.5) * spread;- positions[i * 3 + 1] = (0.08 + nextRandom(s.seed) * (stardust ? 1.0 : 0.6)) * scale + (at.y ?? 0);- positions[i * 3 + 2] = at.z + (nextRandom(s.seed) - 0.5) * spread;- rise[i] = (stardust ? 0.05 : 0.25) + nextRandom(s.seed) * 0.2;- tint[i] = Math.floor(nextRandom(s.seed) * palette.length);- age[i] = 0;- }- } else s.debt = 0;- }- let alive = false;- for (let i = 0; i < SPARKS; i++) {- if (age[i] >= life) { colours[i * 3] = colours[i * 3 + 1] = colours[i * 3 + 2] = 0; continue; }- age[i] += dt;- positions[i * 3 + 1] += rise[i] * dt;- let fade = Math.max(0, 1 - age[i] / life);- if (stardust) fade *= 0.55 + 0.45 * Math.sin(s.clock * 14 + i * 1.7);- const c = palette[tint[i]] ?? palette[0];- colours[i * 3] = c.r * fade; colours[i * 3 + 1] = c.g * fade; colours[i * 3 + 2] = c.b * fade;- alive = true;- }- if (points.current) points.current.visible = alive;- if (alive) {- pool.geometry.attributes.position.needsUpdate = true;- pool.geometry.attributes.color.needsUpdate = true;- }- });-- return (- <points ref={points} geometry={pool.geometry} frustumCulled={false} visible={false} renderOrder={2}>- <pointsMaterial map={stardust ? starTexture() : glowTexture()} size={(stardust ? 0.13 : 0.08) * Math.max(0.6, scale)} sizeAttenuation- vertexColors transparent blending={AdditiveBlending} depthWrite={false} />- </points>- );-}--// ------------------------------------------------------------------ ribbons--function Ribbon({ kind, source, scale, paused }: { kind: Exclude<TrailKind, "trail_footprints" | "trail_sparkle" | "trail_stardust">; source: FlairSource; scale: number; paused: boolean }) {- const strip = useMemo(() => {- const geometry = new BufferGeometry();- const positions = new Float32Array(RIBBON_MAX_SAMPLES * 6);- const colours = new Float32Array(RIBBON_MAX_SAMPLES * 6);- const index: number[] = [];- for (let i = 0; i < RIBBON_MAX_SAMPLES - 1; i++) {- const a = i * 2;- index.push(a, a + 1, a + 2, a + 1, a + 3, a + 2);- }- geometry.setIndex(index);- geometry.setAttribute("position", new BufferAttribute(positions, 3));- geometry.setAttribute("color", new BufferAttribute(colours, 3));- geometry.setDrawRange(0, 0);- return { geometry, positions, colours };- }, []);- useEffect(() => () => strip.geometry.dispose(), [strip]);- const samples = useRef<TrailSample[]>([]);- const clock = useRef(0);- const colourA = useMemo(() => new Color(EFFECT_COLOURS[kind][0]), [kind]);- const colourB = useMemo(() => new Color(EFFECT_COLOURS[kind][1] ?? EFFECT_COLOURS[kind][0]), [kind]);- const mix = useMemo(() => new Color(), []);- const width = (RIBBON_WIDTH[kind] ?? 0.3) * scale;-- useFrame((_, rawDt) => {- if (paused) return;- clock.current += Math.min(rawDt, 0.1);- const t = clock.current;- const at = source();- const list = samples.current;- if (at) pushSample(list, at.x, at.z, t);- pruneSamples(list, t, RIBBON_LIFE_S);- const n = list.length;- if (n < 2) { strip.geometry.setDrawRange(0, 0); return; }- const bright = writeRibbon(list, t, RIBBON_LIFE_S, width, 0.025, strip.positions);- for (let i = 0; i < n; i++) {- const along = i / (n - 1);- if (kind === "trail_rainbow") mix.setHSL(rainbowHue(along, t), 0.95, 0.6);- else if (kind === "trail_neon") mix.copy(colourA).lerp(colourB, 0.5 + 0.5 * Math.sin(t * 4 + along * 6));- else mix.copy(colourA).lerp(colourB, along * along);- const b = bright[i] * 0.9;- for (const v of [i * 6, i * 6 + 3]) { strip.colours[v] = mix.r * b; strip.colours[v + 1] = mix.g * b; strip.colours[v + 2] = mix.b * b; }- }- strip.geometry.setDrawRange(0, (n - 1) * 6);- strip.geometry.attributes.position.needsUpdate = true;- strip.geometry.attributes.color.needsUpdate = true;- });-- return (- <mesh geometry={strip.geometry} frustumCulled={false} renderOrder={2}>- <meshBasicMaterial vertexColors transparent blending={AdditiveBlending} depthWrite={false} side={DoubleSide} />- </mesh>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/effects/CosmeticWear.tsx b/jarvis/ui/web/frontend/src/components/society/progression/effects/CosmeticWear.tsxdeleted file mode 100644index d063112903..0000000000--- a/jarvis/ui/web/frontend/src/components/society/progression/effects/CosmeticWear.tsx+++ /dev/null@@ -1,278 +0,0 @@-/**- * What a levelled-up figure wears: an aura on the floor under it and a- * gadget on or around it. The aura follows the wearer's ground position- * every frame; a figure wears its gadget on its own body (`wornGadget.tsx`)- * and only the pet's follows a position. Nothing here is solid, casts a- * shadow or takes a click.- *- * Auras: a warm glow, a turning rune circle, a crackling storm ring and the- * prismatic legend circle with rising motes. Gadgets: a hovering drone, a- * halo and a crown. The wings are worn on the figure's back (AngelWings).- */-import { useEffect, useMemo, useRef } from "react";-import { useFrame } from "@react-three/fiber";-import {- AdditiveBlending, BufferAttribute, BufferGeometry, Color, DoubleSide,- type Group, type LineSegments, type Mesh, type MeshBasicMaterial, type Points,-} from "three";-import { EFFECT_COLOURS, type RewardId } from "../levelCatalog";-import { glowTexture, runeTexture } from "./flairTextures";-import type { FlairSource } from "./CosmeticTrail";--export type AuraKind = Extract<RewardId, `aura_${string}`>;-export type GadgetKind = Extract<RewardId, `gadget_${string}`>;--function useFollow(source: FlairSource, paused: boolean, place: (g: Group, at: NonNullable<ReturnType<FlairSource>>, t: number, dt: number) => void) {- const group = useRef<Group>(null);- const clock = useRef(0);- useFrame((_, rawDt) => {- const g = group.current;- if (!g) return;- const at = source();- g.visible = !!at;- if (!at) return;- const dt = paused ? 0 : Math.min(rawDt, 0.1);- clock.current += dt;- place(g, at, clock.current, dt);- });- return group;-}--// ------------------------------------------------------------------ auras--export function CosmeticAura({ kind, source, scale = 1, paused, reduced }: { kind: AuraKind; source: FlairSource; scale?: number; paused: boolean; reduced: boolean }) {- const disc = useRef<Mesh>(null);- const ringA = useRef<Mesh>(null);- const ringB = useRef<Mesh>(null);- const colours = useMemo(() => EFFECT_COLOURS[kind].map((c) => new Color(c)), [kind]);- const hue = useMemo(() => new Color(), []);- const group = useFollow(source, paused, (g, at, t) => {- g.position.set(at.x, 0.018, at.z);- const pulse = reduced ? 0.5 : 0.5 + 0.5 * Math.sin(t * 2.4);- if (disc.current) {- const m = disc.current.material as MeshBasicMaterial;- m.opacity = kind === "aura_glow" ? 0.35 + 0.3 * pulse : 0.22 + 0.15 * pulse;- disc.current.scale.setScalar(1 + 0.08 * pulse);- }- const spin = reduced ? 0 : t;- if (ringA.current) ringA.current.rotation.z = spin * (kind === "aura_storm" ? 1.6 : 0.5);- if (ringB.current) ringB.current.rotation.z = -spin * 0.8;- if (kind === "aura_legend") {- hue.setHSL((t * 0.08) % 1, 0.9, 0.65);- if (ringA.current) (ringA.current.material as MeshBasicMaterial).color.copy(hue);- hue.setHSL((t * 0.08 + 0.5) % 1, 0.9, 0.65);- if (ringB.current) (ringB.current.material as MeshBasicMaterial).color.copy(hue);- }- });- const flat: [number, number, number] = [-Math.PI / 2, 0, 0];- const r = 0.8 * scale;- return (- <group ref={group} renderOrder={1}>- <mesh ref={disc} rotation={flat} renderOrder={1}>- <circleGeometry args={[r, 40]} />- <meshBasicMaterial map={glowTexture()} color={colours[0]} transparent opacity={0.4} blending={AdditiveBlending} depthWrite={false} />- </mesh>- {kind !== "aura_glow" && (- <mesh ref={ringA} rotation={flat} position={[0, 0.004, 0]} renderOrder={1}>- <planeGeometry args={[r * 2.1, r * 2.1]} />- <meshBasicMaterial map={runeTexture()} color={colours[0]} transparent opacity={kind === "aura_storm" ? 0.55 : 0.8}- blending={AdditiveBlending} depthWrite={false} side={DoubleSide} />- </mesh>- )}- {kind === "aura_legend" && (- <mesh ref={ringB} rotation={flat} position={[0, 0.006, 0]} scale={0.7} renderOrder={1}>- <planeGeometry args={[r * 2.1, r * 2.1]} />- <meshBasicMaterial map={runeTexture()} color={colours[1]} transparent opacity={0.75} blending={AdditiveBlending} depthWrite={false} side={DoubleSide} />- </mesh>- )}- {kind === "aura_storm" && !reduced && <Lightning radius={r} colour={colours[1]} paused={paused} />}- {kind === "aura_legend" && !reduced && <Motes radius={r * 0.7} paused={paused} />}- </group>- );-}--const BOLTS = 6;-const BOLT_SEGMENTS = 4;--/** Short zig-zag arcs jumping round the ring, re-struck a dozen times a second. */-function Lightning({ radius, colour, paused }: { radius: number; colour: Color; paused: boolean }) {- const lines = useRef<LineSegments>(null);- const geometry = useMemo(() => {- const g = new BufferGeometry();- g.setAttribute("position", new BufferAttribute(new Float32Array(BOLTS * BOLT_SEGMENTS * 2 * 3), 3));- return g;- }, []);- useEffect(() => () => geometry.dispose(), [geometry]);- const next = useRef(0);- const clock = useRef(0);- useFrame((_, dt) => {- if (paused || !lines.current) return;- clock.current += Math.min(dt, 0.1);- if (clock.current < next.current) return;- next.current = clock.current + 0.08 + Math.random() * 0.06;- const pos = geometry.attributes.position.array as Float32Array;- let k = 0;- for (let b = 0; b < BOLTS; b++) {- const a0 = Math.random() * Math.PI * 2;- let x = Math.cos(a0) * radius * 0.55, y = 0.02, z = Math.sin(a0) * radius * 0.55;- for (let s = 0; s < BOLT_SEGMENTS; s++) {- const nx = x + Math.cos(a0) * radius * 0.12 + (Math.random() - 0.5) * 0.12;- const ny = y + 0.06 + Math.random() * 0.1;- const nz = z + Math.sin(a0) * radius * 0.12 + (Math.random() - 0.5) * 0.12;- pos[k++] = x; pos[k++] = y; pos[k++] = z; pos[k++] = nx; pos[k++] = ny; pos[k++] = nz;- x = nx; y = ny; z = nz;- }- }- geometry.attributes.position.needsUpdate = true;- (lines.current.material as MeshBasicMaterial).opacity = 0.5 + Math.random() * 0.5;- });- return (- <lineSegments ref={lines} geometry={geometry} frustumCulled={false} renderOrder={2}>- <lineBasicMaterial color={colour} transparent blending={AdditiveBlending} depthWrite={false} />- </lineSegments>- );-}--const MOTES = 24;--/** Prismatic motes spiralling up out of the legend circle. */-function Motes({ radius, paused }: { radius: number; paused: boolean }) {- const points = useRef<Points>(null);- const pool = useMemo(() => {- const geometry = new BufferGeometry();- const positions = new Float32Array(MOTES * 3);- const colours = new Float32Array(MOTES * 3);- geometry.setAttribute("position", new BufferAttribute(positions, 3));- geometry.setAttribute("color", new BufferAttribute(colours, 3));- return { geometry, positions, colours, phase: Float32Array.from({ length: MOTES }, (_, i) => i / MOTES) };- }, []);- useEffect(() => () => pool.geometry.dispose(), [pool]);- const c = useMemo(() => new Color(), []);- const clock = useRef(0);- useFrame((_, dt) => {- if (paused) return;- clock.current += Math.min(dt, 0.1);- const t = clock.current;- for (let i = 0; i < MOTES; i++) {- const life = (pool.phase[i] + t * 0.35) % 1;- const angle = i * 2.39996 + t * 1.2;- const r = radius * (1 - life * 0.5);- pool.positions[i * 3] = Math.cos(angle) * r;- pool.positions[i * 3 + 1] = 0.05 + life * 1.6;- pool.positions[i * 3 + 2] = Math.sin(angle) * r;- c.setHSL((i / MOTES + t * 0.1) % 1, 0.9, 0.65).multiplyScalar(Math.sin(life * Math.PI));- pool.colours[i * 3] = c.r; pool.colours[i * 3 + 1] = c.g; pool.colours[i * 3 + 2] = c.b;- }- pool.geometry.attributes.position.needsUpdate = true;- pool.geometry.attributes.color.needsUpdate = true;- });- return (- <points ref={points} geometry={pool.geometry} frustumCulled={false} renderOrder={2}>- <pointsMaterial map={glowTexture()} size={0.09} sizeAttenuation vertexColors transparent blending={AdditiveBlending} depthWrite={false} />- </points>- );-}--// ------------------------------------------------------------------ gadgets--/**- * A gadget drawn around its own origin, which is the top of the wearer's- * head. A figure wears it in its head slot (halo, crown) or body group- * (drone) so it rides every hop; the pet's follows its position instead.- */-export function GadgetModel({ kind, scale = 1, paused, reduced }: {- kind: GadgetKind; scale?: number; paused: boolean; reduced: boolean;-}) {- const spinner = useRef<Group>(null);- const extra = useRef<Group>(null);- const blink = useRef<Mesh>(null);- const clock = useRef(Math.random() * 10);- useFrame((_, rawDt) => {- clock.current += paused ? 0 : Math.min(rawDt, 0.1);- const t = clock.current;- const calm = reduced ? 0 : 1;- if (kind === "gadget_halo" && spinner.current) {- spinner.current.position.y = 0.14 * scale + 0.025 * Math.sin(t * 2.2) * calm;- spinner.current.rotation.z = 0.15 * Math.sin(t * 0.9) * calm;- }- if (kind === "gadget_crown" && spinner.current) spinner.current.rotation.y = t * 0.4 * calm;- if (kind === "gadget_drone" && spinner.current) {- spinner.current.rotation.y = t * 1.1 * calm;- if (extra.current) {- extra.current.position.y = 0.04 * Math.sin(t * 3) * calm;- extra.current.children.forEach((rotor, i) => { if (i < 4) rotor.rotation.y = t * 40 * calm; });- }- if (blink.current) (blink.current.material as MeshBasicMaterial).opacity = Math.sin(t * 6) > 0.2 ? 1 : 0.2;- }- });- const [main, accent] = EFFECT_COLOURS[kind];- return (- <group>- {kind === "gadget_halo" && (- <group ref={spinner}>- <mesh rotation={[Math.PI / 2, 0, 0]}>- <torusGeometry args={[0.17 * scale, 0.022 * scale, 10, 36]} />- <meshBasicMaterial color={main} toneMapped={false} />- </mesh>- <mesh rotation={[-Math.PI / 2, 0, 0]}>- <circleGeometry args={[0.32 * scale, 24]} />- <meshBasicMaterial map={glowTexture()} color={main} transparent opacity={0.6} blending={AdditiveBlending} depthWrite={false} />- </mesh>- </group>- )}- {kind === "gadget_crown" && (- <group ref={spinner} position={[0, -0.05 * scale, 0]} scale={scale}>- <mesh position={[0, 0.045, 0]}>- <cylinderGeometry args={[0.13, 0.12, 0.09, 20, 1, true]} />- <meshStandardMaterial color={main} metalness={0.7} roughness={0.25} emissive={main} emissiveIntensity={0.25} side={DoubleSide} />- </mesh>- {[0, 1, 2, 3, 4].map((i) => {- const a = (i / 5) * Math.PI * 2;- return (- <mesh key={i} position={[Math.sin(a) * 0.125, 0.12, Math.cos(a) * 0.125]}>- <coneGeometry args={[0.03, 0.08, 6]} />- <meshStandardMaterial color={main} metalness={0.7} roughness={0.25} emissive={main} emissiveIntensity={0.25} />- </mesh>- );- })}- <mesh position={[0, 0.05, 0.128]}>- <sphereGeometry args={[0.022, 10, 8]} />- <meshStandardMaterial color={accent} emissive={accent} emissiveIntensity={0.6} roughness={0.2} />- </mesh>- </group>- )}- {kind === "gadget_drone" && (- <group ref={spinner} position={[0, 0.2 * scale, 0]}>- <group ref={extra} position={[0.55 * scale, 0, 0]} scale={scale}>- {[[-1, -1], [1, -1], [-1, 1], [1, 1]].map(([sx, sz], i) => (- <mesh key={i} position={[sx * 0.075, 0.03, sz * 0.075]}>- <cylinderGeometry args={[0.045, 0.045, 0.006, 12]} />- <meshBasicMaterial color={accent} transparent opacity={0.45} />- </mesh>- ))}- <mesh>- <boxGeometry args={[0.13, 0.045, 0.13]} />- <meshStandardMaterial color={main} roughness={0.35} metalness={0.4} />- </mesh>- <mesh ref={blink} position={[0, -0.03, 0.066]}>- <sphereGeometry args={[0.014, 8, 6]} />- <meshBasicMaterial color={accent} transparent toneMapped={false} />- </mesh>- </group>- </group>- )}- </group>- );-}--/** A gadget that follows a ground position; `top` is the wearer's head-top height above the floor. */-export function CosmeticGadget({ kind, source, top, scale = 1, paused, reduced }: {- kind: GadgetKind; source: FlairSource; top: number; scale?: number; paused: boolean; reduced: boolean;-}) {- const group = useFollow(source, paused, (g, at) => { g.position.set(at.x, at.y ?? top, at.z); });- return (- <group ref={group}>- <GadgetModel kind={kind} scale={scale} paused={paused} reduced={reduced} />- </group>- );-}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/effects/LevelUpBurst.tsx b/jarvis/ui/web/frontend/src/components/society/progression/effects/LevelUpBurst.tsxindex b9ebdd00cc..a419d45591 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/effects/LevelUpBurst.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/effects/LevelUpBurst.tsx@@ -1,138 +1,83 @@/**- * The level-up moment in the world, in three beats that overlap:- *- * 1. a column of light shoots up from the floor around the figure (0–0.3 s),- * 2. two shockwave rings race out across the floor (0.05–1.1 s),- * 3. a fountain of sparks bursts up and rains back down (0.1–2.2 s),- *- * while a "LEVEL n" tag rises over the head. The column and sparks follow- * the figure if it keeps walking. Reduced motion keeps only the tag.+ * The level-up moment in the world, kept quiet the way a ceremony is: a+ * single gold ring runs out across the floor under the figure and a soft+ * light fades beneath it, while a plate rises over the head with the new+ * insignia — "Promoted · Sergeant" on a promotion, "Level 7" between two.+ * The ring and the plate follow the figure if it keeps walking. Reduced+ * motion keeps the plate and drops the ring.*/import { useEffect, useMemo, useRef } from "react";import { Html } from "@react-three/drei";import { useFrame } from "@react-three/fiber";-import { AdditiveBlending, BufferAttribute, BufferGeometry, Color, DoubleSide, type Group, type Mesh, type MeshBasicMaterial, type Points } from "three";-import { beamTexture, glowTexture } from "./flairTextures";-import type { FlairSource } from "./CosmeticTrail";-import type { SubjectKind } from "../levelCatalog";+import { AdditiveBlending, DoubleSide, MeshBasicMaterial, type Group, type Mesh } from "three";+import { useT } from "@/i18n";+import { glowTexture } from "./flairTextures";+import type { RankId, SubjectKind } from "../levelCatalog";+import { RankInsignia } from "../insignia/RankInsignia";import { BURST_MS } from "../progressionStore";-/** Gold for the person, the pet's teal, an agent's green: the same three as the HUD. */-export const BURST_COLOURS: Record<SubjectKind, [string, string]> = {- person: ["#ffd25e", "#fff3c4"],- pet: ["#5eead4", "#e0fffa"],- agent: ["#86efac", "#f0fff4"],-};+/** Where something stands this frame (and how high its top is), or null while it is not drawn. */+export type FlairSource = () => { x: number; z: number; y?: number; heading?: number } | null;-const SPARKS = 90;-const GRAVITY = 5.5;+const GOLD = "#e3b94f";/** 0..1 ease-out (cubic). */const easeOut = (x: number) => 1 - Math.pow(1 - Math.min(1, Math.max(0, x)), 3);-export function LevelUpBurst({ source, kind, level, label, height, scale = 1, reduced }: {- source: FlairSource; kind: SubjectKind; level: number; label: string; height: number; scale?: number; reduced: boolean;+export function LevelUpBurst({ source, kind, level, rank, promoted, height, scale = 1, reduced }: {+ source: FlairSource; kind: SubjectKind; level: number; rank: RankId; promoted: boolean; height: number; scale?: number; reduced: boolean;}) {+ const t = useT();const group = useRef<Group>(null);- const column = useRef<Mesh>(null);- const ring1 = useRef<Mesh>(null);- const ring2 = useRef<Mesh>(null);- const flash = useRef<Mesh>(null);- const sparks = useRef<Points>(null);- const t = useRef(0);- const [main, light] = BURST_COLOURS[kind];- const pool = useMemo(() => {- const geometry = new BufferGeometry();- const positions = new Float32Array(SPARKS * 3);- const colours = new Float32Array(SPARKS * 3);- const velocity = new Float32Array(SPARKS * 3);- const a = new Color(main), b = new Color(light);- for (let i = 0; i < SPARKS; i++) {- const angle = (i / SPARKS) * Math.PI * 2 * 7.3;- const out = (0.8 + ((i * 37) % 11) / 11 * 1.6) * scale;- velocity[i * 3] = Math.cos(angle) * out;- velocity[i * 3 + 1] = (2.6 + ((i * 53) % 13) / 13 * 2.8) * scale;- velocity[i * 3 + 2] = Math.sin(angle) * out;- const c = i % 3 === 0 ? b : a;- colours[i * 3] = c.r; colours[i * 3 + 1] = c.g; colours[i * 3 + 2] = c.b;- }- geometry.setAttribute("position", new BufferAttribute(positions, 3));- geometry.setAttribute("color", new BufferAttribute(colours.slice(), 3));- return { geometry, positions, base: colours, velocity };- }, [main, light, scale]);- useEffect(() => () => pool.geometry.dispose(), [pool]);+ const ring = useRef<Mesh>(null);+ const glow = useRef<Mesh>(null);+ const clock = useRef(0);+ const materials = useMemo(() => ({+ ring: new MeshBasicMaterial({ color: GOLD, transparent: true, opacity: 0.8, blending: AdditiveBlending, depthWrite: false, side: DoubleSide }),+ glow: new MeshBasicMaterial({ map: glowTexture(), color: GOLD, transparent: true, opacity: 0.5, blending: AdditiveBlending, depthWrite: false }),+ }), []);+ useEffect(() => () => { materials.ring.dispose(); materials.glow.dispose(); }, [materials]);useFrame((_, rawDt) => {const g = group.current;if (!g) return;const at = source();if (at) g.position.set(at.x, 0, at.z);- t.current += Math.min(rawDt, 0.1);- const s = t.current;+ clock.current += Math.min(rawDt, 0.1);+ const s = clock.current;if (reduced) return;- if (column.current) {- const grow = easeOut(s / 0.3);- const fade = s < 0.9 ? 1 : Math.max(0, 1 - (s - 0.9) / 1.2);- column.current.scale.set(1 - 0.35 * easeOut((s - 0.9) / 1.2), grow, 1 - 0.35 * easeOut((s - 0.9) / 1.2));- (column.current.material as MeshBasicMaterial).opacity = 0.75 * fade;- column.current.rotation.y = s * 1.5;- }- for (const [ring, delay, span] of [[ring1.current, 0.05, 1.0], [ring2.current, 0.25, 1.1]] as const) {- if (!ring) continue;- const k = (s - delay) / span;- ring.visible = k > 0 && k < 1;- ring.scale.setScalar(0.3 + easeOut(k) * 3.4 * scale);- (ring.material as MeshBasicMaterial).opacity = 0.9 * (1 - Math.min(1, Math.max(0, k)));- }- if (flash.current) {- const k = s / 0.5;- flash.current.visible = k < 1;- flash.current.scale.setScalar((0.6 + k * 2.4) * scale);- (flash.current.material as MeshBasicMaterial).opacity = 0.85 * (1 - k);+ if (ring.current) {+ const k = s / 1.2;+ ring.current.visible = k < 1;+ ring.current.scale.setScalar((0.35 + easeOut(k) * 1.5) * scale);+ materials.ring.opacity = 0.8 * (1 - k);}- const st = s - 0.1;- if (sparks.current) sparks.current.visible = st > 0 && st < 2.1;- if (st > 0) {- const { positions, velocity, base } = pool;- const colours = pool.geometry.attributes.color.array as Float32Array;- const fade = Math.max(0, 1 - st / 2.1);- for (let i = 0; i < SPARKS; i++) {- positions[i * 3] = velocity[i * 3] * st;- positions[i * 3 + 1] = Math.max(0.02, 0.4 * scale + velocity[i * 3 + 1] * st - 0.5 * GRAVITY * scale * st * st);- positions[i * 3 + 2] = velocity[i * 3 + 2] * st;- const twinkle = 0.6 + 0.4 * Math.sin(st * 20 + i);- colours[i * 3] = base[i * 3] * fade * twinkle; colours[i * 3 + 1] = base[i * 3 + 1] * fade * twinkle; colours[i * 3 + 2] = base[i * 3 + 2] * fade * twinkle;- }- pool.geometry.attributes.position.needsUpdate = true;- pool.geometry.attributes.color.needsUpdate = true;+ if (glow.current) {+ const k = s / 1.6;+ glow.current.visible = k < 1;+ materials.glow.opacity = 0.5 * (1 - easeOut(k));}});const flat: [number, number, number] = [-Math.PI / 2, 0, 0];+ const word = promoted ? t("society.level.promoted") : t("society.level.level_n").replace("{0}", String(level));return (<group ref={group}>{!reduced && <>- <mesh ref={column} position={[0, 3 * scale, 0]} renderOrder={3}>- <cylinderGeometry args={[0.55 * scale, 0.7 * scale, 6 * scale, 28, 1, true]} />- <meshBasicMaterial map={beamTexture()} color={main} transparent opacity={0.7} blending={AdditiveBlending} depthWrite={false} side={DoubleSide} />+ <mesh ref={glow} material={materials.glow} rotation={flat} position={[0, 0.03, 0]} scale={1.1 * scale} renderOrder={3}>+ <circleGeometry args={[0.8, 32]} /></mesh>- <mesh ref={flash} rotation={flat} position={[0, 0.03, 0]} renderOrder={3}>- <circleGeometry args={[0.6, 32]} />- <meshBasicMaterial map={glowTexture()} color={light} transparent opacity={0.8} blending={AdditiveBlending} depthWrite={false} />+ <mesh ref={ring} material={materials.ring} rotation={flat} position={[0, 0.035, 0]} visible={false} renderOrder={3}>+ <ringGeometry args={[0.95, 1, 64]} /></mesh>- {[ring1, ring2].map((ref, i) => (- <mesh key={i} ref={ref} rotation={flat} position={[0, 0.035, 0]} visible={false} renderOrder={3}>- <ringGeometry args={[0.86, 1, 48]} />- <meshBasicMaterial color={i === 0 ? main : light} transparent opacity={0.9} blending={AdditiveBlending} depthWrite={false} side={DoubleSide} />- </mesh>- ))}- <points ref={sparks} geometry={pool.geometry} frustumCulled={false} visible={false} renderOrder={3}>- <pointsMaterial map={glowTexture()} size={0.14 * scale} sizeAttenuation vertexColors transparent blending={AdditiveBlending} depthWrite={false} />- </points></>}- <Html center position={[0, height + 0.55, 0]} zIndexRange={[45, 40]}>- <span className="level-burst-tag" data-kind={kind} style={{ animationDuration: `${BURST_MS}ms` }} aria-hidden>- <small>{label}</small><b>{level}</b>+ <Html center position={[0, height + 0.6, 0]} zIndexRange={[45, 40]}>+ <span className="promo-tag" data-kind={kind} style={{ animationDuration: `${BURST_MS}ms` }} aria-hidden>+ <RankInsignia rank={rank} size={30} className="promo-tag-insignia" />+ <span>+ <small>{word}</small>+ <b>{t(`society.level.title.${rank}`)}</b>+ </span></span></Html></group>diff --git a/jarvis/ui/web/frontend/src/components/society/progression/effects/flairTextures.ts b/jarvis/ui/web/frontend/src/components/society/progression/effects/flairTextures.tsindex 711d4c5005..d8c50b6e50 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/effects/flairTextures.ts+++ b/jarvis/ui/web/frontend/src/components/society/progression/effects/flairTextures.ts@@ -1,6 +1,5 @@/**- * The few canvas textures every level effect shares: a soft glow, a- * four-point star, a rune circle, a footprint and a vertical light beam.+ * The soft glow texture the level effects and the Level Hall share.* Drawn once per page on first use; three.js re-uploads them from their* canvas after a lost WebGL context, so they are never disposed.*/@@ -35,67 +34,3 @@ export function glowTexture(): Texture {ctx.fillRect(0, 0, 64, 64);});}--export function starTexture(): Texture {- return canvasTexture("star", 64, (ctx) => {- const g = ctx.createRadialGradient(32, 32, 0, 32, 32, 12);- g.addColorStop(0, "rgba(255,255,255,1)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, 64, 64);- ctx.fillStyle = "rgba(255,255,255,0.95)";- for (const [w, h] of [[3, 30], [30, 3]] as const) {- ctx.beginPath();- ctx.ellipse(32, 32, w, h, 0, 0, Math.PI * 2);- ctx.fill();- }- });-}--/** A ring of rune ticks and dots on a thin circle, for the rune aura. */-export function runeTexture(): Texture {- return canvasTexture("runes", 256, (ctx) => {- ctx.translate(128, 128);- ctx.strokeStyle = "rgba(255,255,255,0.95)";- ctx.lineWidth = 3;- ctx.beginPath(); ctx.arc(0, 0, 118, 0, Math.PI * 2); ctx.stroke();- ctx.lineWidth = 1.5;- ctx.beginPath(); ctx.arc(0, 0, 92, 0, Math.PI * 2); ctx.stroke();- ctx.lineWidth = 3;- for (let i = 0; i < 16; i++) {- ctx.save();- ctx.rotate((i / 16) * Math.PI * 2);- ctx.translate(0, -105);- ctx.beginPath();- // A small glyph per slot: a stroke, a hook or a triangle in turn.- if (i % 3 === 0) { ctx.moveTo(-5, -6); ctx.lineTo(5, 6); ctx.moveTo(5, -6); ctx.lineTo(0, 0); }- else if (i % 3 === 1) { ctx.moveTo(0, -7); ctx.lineTo(0, 7); ctx.moveTo(0, -2); ctx.lineTo(6, -6); }- else { ctx.moveTo(-6, 6); ctx.lineTo(0, -7); ctx.lineTo(6, 6); ctx.closePath(); }- ctx.stroke();- ctx.restore();- }- });-}--/** A rounded sole with four toe dots; drawn pointing up (+v). */-export function footprintTexture(): Texture {- return canvasTexture("foot", 64, (ctx) => {- ctx.fillStyle = "rgba(255,255,255,1)";- ctx.beginPath(); ctx.ellipse(32, 38, 11, 17, 0, 0, Math.PI * 2); ctx.fill();- for (const [x, y, r] of [[22, 15, 4], [29, 11, 4.2], [36, 11, 4], [42, 15, 3.6]] as const) {- ctx.beginPath(); ctx.arc(x, y, r, 0, Math.PI * 2); ctx.fill();- }- });-}--/** Bright at the floor, fading out towards the top: the level-up column. */-export function beamTexture(): Texture {- return canvasTexture("beam", 16, (ctx) => {- const g = ctx.createLinearGradient(0, 128, 0, 0);- g.addColorStop(0, "rgba(255,255,255,1)");- g.addColorStop(0.35, "rgba(255,255,255,0.5)");- g.addColorStop(1, "rgba(255,255,255,0)");- ctx.fillStyle = g;- ctx.fillRect(0, 0, 16, 128);- }, 128);-}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/effects/trailModel.ts b/jarvis/ui/web/frontend/src/components/society/progression/effects/trailModel.tsdeleted file mode 100644index bc938d5979..0000000000--- a/jarvis/ui/web/frontend/src/components/society/progression/effects/trailModel.ts+++ /dev/null@@ -1,70 +0,0 @@-/**- * Pure bookkeeping behind the trails: where a ribbon keeps its samples, when- * the next footprint lands, how a ribbon turns into a flat strip on the floor.- * Kept free of three.js so the rules are unit tested.- */--export interface TrailSample { x: number; z: number; t: number }--/** Distance between two ribbon samples, metres. */-export const RIBBON_STEP_M = 0.12;-export const RIBBON_MAX_SAMPLES = 28;-/** Distance between two footprints, metres. */-export const STEP_LENGTH_M = 0.42;--/** Adds a sample once the mover is a step past the last one; drops the oldest beyond the cap. */-export function pushSample(samples: TrailSample[], x: number, z: number, t: number): boolean {- const last = samples[samples.length - 1];- if (last && Math.hypot(x - last.x, z - last.z) < RIBBON_STEP_M) return false;- // A jump of several metres is a teleport (elevator, floor switch): the ribbon starts over.- if (last && Math.hypot(x - last.x, z - last.z) > 2.5) samples.length = 0;- samples.push({ x, z, t });- if (samples.length > RIBBON_MAX_SAMPLES) samples.splice(0, samples.length - RIBBON_MAX_SAMPLES);- return true;-}--export function pruneSamples(samples: TrailSample[], t: number, lifeS: number): void {- let drop = 0;- while (drop < samples.length && t - samples[drop].t > lifeS) drop++;- if (drop > 0) samples.splice(0, drop);-}--/**- * Writes a flat strip along the samples into `positions` (two vertices per- * sample, at height `y`) and returns, per sample, how bright it is (1 at the- * newest, 0 at the oldest or fully aged). The strip narrows towards its tail.- */-export function writeRibbon(samples: readonly TrailSample[], t: number, lifeS: number, widthM: number, y: number,- positions: Float32Array): number[] {- const n = samples.length;- const bright: number[] = [];- for (let i = 0; i < n; i++) {- const s = samples[i];- const prev = samples[Math.max(0, i - 1)];- const next = samples[Math.min(n - 1, i + 1)];- let dx = next.x - prev.x, dz = next.z - prev.z;- const len = Math.hypot(dx, dz) || 1;- dx /= len; dz /= len;- const along = n > 1 ? i / (n - 1) : 1;- const age = Math.min(1, Math.max(0, (t - s.t) / lifeS));- const half = (widthM / 2) * along * (1 - age * 0.5);- // Perpendicular on the floor: (-dz, dx).- positions[i * 6] = s.x - dz * half; positions[i * 6 + 1] = y; positions[i * 6 + 2] = s.z + dx * half;- positions[i * 6 + 3] = s.x + dz * half; positions[i * 6 + 4] = y; positions[i * 6 + 5] = s.z - dx * half;- bright.push(along * (1 - age));- }- return bright;-}--/** Footprints alternate left and right of the path, a hand's width apart. */-export function footprintAt(x: number, z: number, heading: number, left: boolean): { x: number; z: number; rot: number } {- const side = left ? 1 : -1;- // Right of heading h is (−cos h, sin h) for a +z-forward figure.- return { x: x + Math.cos(heading) * 0.09 * side, z: z - Math.sin(heading) * 0.09 * side, rot: heading };-}--/** Hue (0..1) along a rainbow ribbon, cycling slowly with time. */-export function rainbowHue(along: number, t: number): number {- const h = (along * 0.85 + t * 0.15) % 1;- return h < 0 ? h + 1 : h;-}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/LevelHallScreen.tsx b/jarvis/ui/web/frontend/src/components/society/progression/hall/LevelHallScreen.tsxindex d8370cbf94..c6719ed371 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/hall/LevelHallScreen.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/LevelHallScreen.tsx@@ -1,21 +1,22 @@/*** The Level Hall screen: the game menu behind the hall's checkpoints, the- * level card and `L`. Five pages for the person or their pet (the pet IS+ * level card and `L`. Six pages for the person or their pet (the pet IS* Jarvis in the Verse):*- * - Overview: the level, title and XP bar, the next unlocks and the quickest- * ways to earn.+ * - Overview: the rank, level and XP bar, the next promotion, the next+ * uniform pieces and the quickest ways to earn.+ * - Ranks: the whole rank ladder as one chart, from private to five stars.* - Studio: the dressing room. Every slot's pieces as cards; an unlocked* piece is put on with one click, a locked one is tried on in the live* preview with the level it needs.- * - Rewards: the reward road from level 1 to the cap, every step's pieces and- * titles, and the chosen step in the preview.+ * - Rewards: the promotion road from level 1 to the cap, every step's rank+ * and pieces, and the chosen step in the preview.* - Guide: how levelling works — three steps, what the next levels cost, and* every rule that pays XP for you, your pet and your agents.* - Team: every agent's level, best first.*- * The chrome uses theme tokens (light and dark); the stage, the level badge- * and the rarity colours are the game's own and read in both modes.+ * The chrome uses theme tokens (light and dark); the stage and the insignia+ * are the game's own and read in both modes.*/import { useEffect, useMemo, useRef } from "react";import { useT } from "@/i18n";@@ -23,12 +24,15 @@ import { useCompanionPet } from "../../companion/companionPetStore";import type { SocietyAgent } from "../../data";import type { ToyLook } from "../../office/toyFigureModel";import { levelFraction, rewardRoad } from "../cosmetics";+import { RANK_INFO, rankAt } from "../levelCatalog";+import { RankInsignia } from "../insignia/RankInsignia";import { LevelChip, XpBar } from "../LevelHud";import { useLevelSound } from "../levelSounds";import { agentSubject, PERSON_SUBJECT, petSubject, type RewardRow, type XpRuleRow } from "../progressionApi";import { HALL_TABS, useProgression, type HallTab } from "../progressionStore";-import { groupRules, quickWins, upcomingLevelCosts, xpToReach } from "./hallModel";+import { groupRules, nextTitle, quickWins, upcomingLevelCosts, xpToReach } from "./hallModel";import { LevelHero, RewardCard, RuleRow, Section, TabIcon, type HallWho } from "./hallParts";+import { RanksTab } from "./RanksTab";import { RewardsTab } from "./RewardsTab";import { StudioTab } from "./StudioTab";import "./hall.css";@@ -38,10 +42,12 @@ const LEAD_AGENT_ID = "jarvis";const NO_RULES: XpRuleRow[] = [];const NO_REWARDS: RewardRow[] = [];const NO_CURVE: number[] = [0];+const NO_TITLES: { level: number; title: string }[] = [];/** Stroke icons in a 24 × 24 box for the page tabs. */const TAB_ICON: Record<HallTab, string> = {overview: "M12 2.8l8 4.6v9.2l-8 4.6-8-4.6V7.4zM12 8v4l3 2",+ ranks: "M5 10l7-4.5 7 4.5M5 15l7-4.5 7 4.5M5 20l7-4.5 7 4.5",studio: "M10 3l1.6 5.4L17 10l-5.4 1.6L10 17l-1.6-5.4L3 10l5.4-1.6zM18 14l.8 2.2L21 17l-2.2.8L18 20l-.8-2.2L15 17l2.2-.8z",rewards: "M4 10h16v10H4zM2.5 6.5h19V10h-19zM12 6.5V20M12 6.5C10 3 6.5 3 6.5 5s3 1.5 5.5 1.5M12 6.5C14 3 17.5 3 17.5 5s-3 1.5-5.5 1.5",guide: "M4 4.5h6a2 2 0 0 1 2 2V20a2 2 0 0 0-2-2H4zM20 4.5h-6a2 2 0 0 0-2 2V20a2 2 0 0 1 2-2h6z",@@ -54,8 +60,11 @@ function OverviewTab({ who }: { who: HallWho }) {const rewards = useProgression((s) => s.snapshot?.rewards ?? NO_REWARDS);const rules = useProgression((s) => s.snapshot?.rules ?? NO_RULES);const curve = useProgression((s) => s.snapshot?.levelXp ?? NO_CURVE);+ const titles = useProgression((s) => s.snapshot?.titles[who.kind] ?? NO_TITLES);const subject = useProgression((s) => s.subjects[who.subjectId]);const level = subject?.level ?? 1;+ const promotion = nextTitle(titles, level);+ const promoRank = promotion ? rankAt(titles, promotion.level) : null;const road = useMemo(() => rewardRoad(rewards, who.kind), [rewards, who.kind]);const upcoming = road.filter((r) => (r.levels[who.kind] ?? 0) > level).slice(0, 3);// With everything open, the page shows the three best pieces instead.@@ -65,7 +74,20 @@ function OverviewTab({ who }: { who: HallWho }) {<div className="hall-overview"><LevelHero who={who} />{who.kind === "pet" && <p className="hall-hint hall-wide">{t("society.level.pet_intro")}</p>}- <Section title={t(upcoming.length > 0 ? "society.hall.next_rewards" : "society.hall.best_pieces")} aside={+ <Section title={t("society.hall.next_promotion_title")} aside={+ <button type="button" className="hall-link" onClick={() => open("ranks")}>{t("society.hall.ranks_all")}</button>}>+ {promotion && promoRank ? (+ <button type="button" className="hall-promotion" data-tier={RANK_INFO[promoRank].tier} onClick={() => open("ranks")}>+ <RankInsignia rank={promoRank} size={64} />+ <span>+ <strong>{t(`society.level.title.${promoRank}`)}</strong>+ <em>{RANK_INFO[promoRank].grade} · {t("society.level.locked_at").replace("{0}", String(promotion.level))}</em>+ <span className="hall-promotion-xp">{t("society.hall.xp_needed").replace("{0}", xpToReach(curve, subject?.xp ?? 0, promotion.level).toLocaleString())}</span>+ </span>+ </button>+ ) : <p className="hall-hint">{t("society.hall.top_title")}</p>}+ </Section>+ {road.length > 0 && <Section title={t(upcoming.length > 0 ? "society.hall.next_rewards" : "society.hall.best_pieces")} aside={<button type="button" className="hall-link" onClick={() => open("rewards")}>{t("society.hall.road_all")}</button>}>{upcoming.length === 0 && <p className="hall-hint">{t("society.hall.all_unlocked")}</p>}{upcoming.length + best.length > 0 && (@@ -78,7 +100,7 @@ function OverviewTab({ who }: { who: HallWho }) {</div>)}{upcoming.length > 0 && <p className="hall-hint">{t("society.hall.try_hint")}</p>}- </Section>+ </Section>}<Section title={t("society.hall.quick_title")} aside={<button type="button" className="hall-link" onClick={() => open("guide")}>{t("society.hall.quick_all")}</button>}><ul className="hall-rules">{wins.map((rule) => <RuleRow key={rule.source} rule={rule} />)}</ul>@@ -147,7 +169,7 @@ function TeamTab({ agents }: { agents: readonly SocietyAgent[] }) {<span className="hall-rank">{i + 1}</span><LevelChip kind="agent" level={subject?.level ?? 1} /><span className="hall-rank-body">- <span><strong>{agent.name}</strong> <em>{t(`society.level.title.${subject?.title || "rookie"}`)}</em></span>+ <span><strong>{agent.name}</strong> <em>{t(`society.level.title.${subject?.title || "private"}`)}</em></span><XpBar fraction={levelFraction(subject)} kind="agent" label={t("society.level.agent_xp_label").replace("{0}", agent.name)} /></span><span className="hall-rank-xp">{t("society.level.total").replace("{0}", String(subject?.xp ?? 0))}</span>@@ -201,7 +223,7 @@ export function LevelHallScreen({ agents, playerName, petName, playerLook }: {<div ref={panel} className="hall" role="dialog" data-state="open" aria-modal="true" aria-labelledby="hall-title" tabIndex={-1}><header className="hall-head"><div className="hall-brand">- <span className="hall-brand-mark" aria-hidden><TabIcon path="M7 4h10v5a5 5 0 0 1-10 0V4zM7 6H4.5a2.5 2.5 0 0 0 2.6 3.6M17 6h2.5a2.5 2.5 0 0 1-2.6 3.6M12 14v3M8 20h8M9.5 17h5" size={20} /></span>+ <span className="hall-brand-mark" aria-hidden><TabIcon path={TAB_ICON.ranks} size={20} /></span><span><h2 id="hall-title">{t("society.hall.title")}</h2><small>{t("society.hall.subtitle")}</small>@@ -231,6 +253,7 @@ export function LevelHallScreen({ agents, playerName, petName, playerLook }: {<div className="hall-body" role="tabpanel" data-tab={tab}>{!loaded ? <p className="hall-empty">{t("society.hall.loading")}</p> : <>{tab === "overview" && <OverviewTab who={who} />}+ {tab === "ranks" && <RanksTab who={who} />}{tab === "studio" && <StudioTab key={who.who} who={who} />}{tab === "rewards" && <RewardsTab key={who.who} who={who} />}{tab === "guide" && <GuideTab who={who} petName={petName} />}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/LoadoutPreview.tsx b/jarvis/ui/web/frontend/src/components/society/progression/hall/LoadoutPreview.tsxindex 3b9fc8efe1..3aadf65b49 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/hall/LoadoutPreview.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/LoadoutPreview.tsx@@ -1,9 +1,9 @@/**- * The Upgrade Studio's live preview: the person's own figure or their pet on- * the hall's stage, wearing a loadout — the one they wear, or one with a- * locked piece put on to try. Trails only show in motion, so with a trail on- * the figure walks a slow circle round the stage; otherwise it stands while- * the stage turns. Drag turns it by hand.+ * The studio's live preview: the person's own figure on the hall's stage in+ * the uniform, cap and decorations of a loadout — the one they wear, or one+ * with a locked piece put on to try — and the insignia of their rank; or the+ * pet, which wears its rank on its name plate. The stage turns slowly; a+ * drag turns it by hand.** One canvas through `useWebglSurface` (AP-32: the context is handed back on* unmount and rebuilt when the browser takes it), rendering only while on@@ -28,14 +28,10 @@ import { OFFICE_FIGURE_HEIGHT_M } from "../../office/OfficeAgents";import { ToyFigure } from "../../office/ToyFigure";import type { ToyLook } from "../../office/toyFigureModel";import type { Loadout } from "../cosmetics";-import { figureGadgetSlots } from "../wornGadget";-import { CosmeticTrail, type FlairSource, type TrailKind } from "../effects/CosmeticTrail";-import { CosmeticAura, CosmeticGadget, type AuraKind, type GadgetKind } from "../effects/CosmeticWear";+import type { RankId } from "../levelCatalog";+import { dressedLook, regaliaFor, type UniformId } from "../regalia/dress";-/** The walk round the stage: radius in metres and speed in m/s. */-const WALK_R = 0.95;-const WALK_SPEED = 0.85;-/** How fast the stage turns while the figure stands, rad/s. */+/** How fast the stage turns, rad/s. */const TURN_SPEED = 0.35;/** Flying pets hover this high over the stage. */const HOVER_M = 0.32;@@ -44,14 +40,9 @@ const PET_SHOWN_M = 0.78;export type PreviewSubject = { kind: "person"; look: ToyLook } | { kind: "pet"; pet: CompanionPet };-/** Where the figure stands this frame, shared by the figure and every flair that follows it. */-interface Pose { x: number; z: number; heading: number; moving: boolean }--function PreviewScene({ subject, loadout, paused, reduced, spin }: {- subject: PreviewSubject; loadout: Loadout; paused: boolean; reduced: boolean; spin: { current: number };+function PreviewScene({ subject, loadout, rank, paused, reduced, spin }: {+ subject: PreviewSubject; loadout: Loadout; rank: RankId; paused: boolean; reduced: boolean; spin: { current: number };}) {- const walking = !!loadout.trail && !reduced;- const pose = useRef<Pose>({ x: 0, z: 0, heading: 0, moving: false });const clock = useRef(0);const body = useRef<Group>(null);const turntable = useRef<Group>(null);@@ -59,49 +50,26 @@ function PreviewScene({ subject, loadout, paused, reduced, spin }: {const petDrive = useRef<PetDrive>({ speed: 0, mood: "idle" });const pet = subject.kind === "pet" ? subject.pet : null;const flies = pet ? companionFlies(pet) : false;- // A pet stands on the same stage, drawn larger (its own group scales; the stage does not), so its walk shrinks to match.+ // A pet stands on the same stage, drawn larger (its own group scales; the stage does not).const grow = pet ? PET_SHOWN_M / pet.heightM : 1;const lift = flies ? HOVER_M / grow : 0;- const top = pet ? lift + pet.heightM + 0.04 : OFFICE_FIGURE_HEIGHT_M + 0.02;- const walkR = WALK_R / grow;- const scale = pet ? 0.5 : 1;const gigi = useMemo(() => ({ ...defaultCompanion("jarvis"), sizeM: GIGI_OFFICE_SIZE_M }), []);- const worn = figureGadgetSlots(pet ? null : (loadout.gadget as GadgetKind | undefined), { drive: figureDrive, top, paused, reduced });+ const person = subject.kind === "person" ? subject.look : null;+ const dressed = useMemo(() => (person ? {+ look: dressedLook(person, loadout.uniform as UniformId | undefined, rank), regalia: regaliaFor(rank, loadout),+ } : null), [person, loadout, rank]);useFrame((_, rawDt) => {const dt = paused ? 0 : Math.min(rawDt, 0.1);clock.current += dt;- const p = pose.current;- if (walking) {- const angle = (clock.current * WALK_SPEED) / WALK_R;- p.x = Math.cos(angle) * walkR;- p.z = Math.sin(angle) * walkR;- // Heading along the circle (counter-clockwise seen from above).- p.heading = Math.atan2(-Math.sin(angle), Math.cos(angle));- p.moving = true;- } else {- p.x = 0;- p.z = 0;- p.heading = 0;- p.moving = false;- }- figureDrive.current.mode = p.moving ? "walk" : "idle";- figureDrive.current.speed = p.moving ? WALK_SPEED : 0;- petDrive.current.speed = p.moving ? WALK_SPEED : 0;- if (body.current) {- body.current.position.set(p.x, lift + (flies && !reduced ? Math.sin(clock.current * 2.2) * 0.04 : 0), p.z);- body.current.rotation.y = p.heading;- }- // The stage turns while the figure stands; a drag adds its own turn.+ if (body.current) body.current.position.set(0, lift + (flies && !reduced ? Math.sin(clock.current * 2.2) * 0.04 : 0), 0);+ // The stage turns slowly; a drag adds its own turn.if (turntable.current) {- if (!walking && !reduced) spin.current += dt * TURN_SPEED;+ if (!reduced) spin.current += dt * TURN_SPEED;turntable.current.rotation.y = spin.current;}});- // Flair reads the pose in the turntable's frame, so it turns with the figure.- const ground: FlairSource = () => ({ x: pose.current.x, z: pose.current.z, heading: pose.current.heading });- const head: FlairSource = () => ({ x: pose.current.x, z: pose.current.z, y: top });return (<><hemisphereLight args={["#dfe8ff", "#1a1f3a", 0.9]} />@@ -118,19 +86,10 @@ function PreviewScene({ subject, loadout, paused, reduced, spin }: {<CompanionBody pet={pet} drive={petDrive} reduced={reduced} paused={paused} gigi={<CompanionModel appearance={gigi} lead />} /></Suspense></ModelBoundary>- ) : (- <>- <ToyFigure look={(subject as Extract<PreviewSubject, { kind: "person" }>).look} drive={figureDrive} paused={paused} heightM={OFFICE_FIGURE_HEIGHT_M}- back={worn.back} headwear={worn.headwear} />- {worn.beside}- </>+ ) : dressed && (+ <ToyFigure look={dressed.look} drive={figureDrive} paused={paused} heightM={OFFICE_FIGURE_HEIGHT_M} regalia={dressed.regalia} />)}</group>- {loadout.aura && <CosmeticAura key={loadout.aura} kind={loadout.aura as AuraKind} source={ground} scale={scale} paused={paused} reduced={reduced} />}- {walking && <CosmeticTrail key={loadout.trail} kind={loadout.trail as TrailKind} source={ground} scale={scale} paused={paused} />}- {loadout.gadget && pet && (- <CosmeticGadget key={loadout.gadget} kind={loadout.gadget as GadgetKind} source={head} top={top} scale={scale} paused={paused} reduced={reduced} />- )}</group></group><CameraFrame />@@ -138,21 +97,24 @@ function PreviewScene({ subject, loadout, paused, reduced, spin }: {);}-/** Frames the whole stage with the walk circle on it; a tall, narrow box stands further back. */+/** Frames the figure from the knees up; a tall, narrow box stands further back. */function CameraFrame() {const camera = useThree((s) => s.camera);const size = useThree((s) => s.size);useLayoutEffect(() => {const narrow = size.width / Math.max(1, size.height) < 0.9;- const distance = 4.9 * (narrow ? 1.22 : 1);- camera.position.set(0, 2.0, distance);- camera.lookAt(0, 0.5, 0);+ // Close on the figure: the insignia, ribbons and cap are what the studio shows off.+ const distance = 3.6 * (narrow ? 1.25 : 1);+ camera.position.set(0, 1.45, distance);+ camera.lookAt(0, 0.78, 0);camera.updateProjectionMatrix();}, [camera, size]);return null;}-export function LoadoutPreview({ subject, loadout, label }: { subject: PreviewSubject; loadout: Loadout; label: string }) {+export function LoadoutPreview({ subject, loadout, rank, label }: {+ subject: PreviewSubject; loadout: Loadout; rank: RankId; label: string;+}) {const t = useT();const host = useRef<HTMLDivElement>(null);const { generation } = useWebglSurface(host);@@ -180,12 +142,10 @@ export function LoadoutPreview({ subject, loadout, label }: { subject: PreviewSugl={{ antialias: true, alpha: true, powerPreference: "low-power" }} camera={{ fov: 30, near: 0.1, far: 40, position: [0, 1.75, 4.1] }}onCreated={({ gl }) => gl.setClearColor(0x000000, 0)}><Suspense fallback={null}>- <PreviewScene subject={subject} loadout={loadout} paused={!awake} reduced={reduced} spin={spin} />+ <PreviewScene subject={subject} loadout={loadout} rank={rank} paused={!awake} reduced={reduced} spin={spin} /></Suspense></Canvas></PreviewBoundary>- {/* A trail only shows in motion; with reduced motion the figure stands, so say why the try-on looks the same. */}- {reduced && loadout.trail && <p className="hall-preview-note">{t("society.hall.trail_reduced")}</p>}</div>);}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/RanksTab.tsx b/jarvis/ui/web/frontend/src/components/society/progression/hall/RanksTab.tsxnew file mode 100644index 0000000000..5f60b2466a--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/RanksTab.tsx@@ -0,0 +1,63 @@+/**+ * The rank ladder as one chart: every rank's insignia, name, pay grade and+ * the level it starts at, grouped by tier — enlisted, non-commissioned+ * officers, officers, general officers. Ranks already held are drawn in+ * full, the one held now is framed, the ones ahead are quiet silhouettes.+ * Choosing a rank ahead shows how much XP is still missing.+ */+import { useMemo } from "react";+import { useT } from "@/i18n";+import type { RankTier } from "../levelCatalog";+import { rankAt } from "../levelCatalog";+import { RankInsignia } from "../insignia/RankInsignia";+import { useProgression } from "../progressionStore";+import { rankLadder, xpToReach } from "./hallModel";+import type { HallWho } from "./hallParts";++const NO_TITLES: { level: number; title: string }[] = [];+const NO_CURVE: number[] = [0];+const TIERS: readonly RankTier[] = ["enlisted", "nco", "officer", "general"];++export function RanksTab({ who }: { who: HallWho }) {+ const t = useT();+ const titles = useProgression((s) => s.snapshot?.titles[who.kind] ?? NO_TITLES);+ const curve = useProgression((s) => s.snapshot?.levelXp ?? NO_CURVE);+ const subject = useProgression((s) => s.subjects[who.subjectId]);+ const level = subject?.level ?? 1;+ const held = rankAt(titles, level);+ const ladder = useMemo(() => rankLadder(titles), [titles]);+ return (+ <div className="hall-ranks">+ <p className="hall-lead">{t("society.hall.ranks_body")}</p>+ {TIERS.map((tier) => {+ const rungs = ladder.filter((rung) => rung.tier === tier);+ if (rungs.length === 0) return null;+ return (+ <section key={tier} className="hall-rank-tier" data-tier={tier}>+ <h3>{t(`society.hall.tier.${tier}`)}</h3>+ <ol className="hall-rank-grid">+ {rungs.map((rung) => {+ const reached = level >= rung.level;+ const current = rung.rank === held;+ const missing = xpToReach(curve, subject?.xp ?? 0, rung.level);+ return (+ <li key={rung.rank} className="hall-rank-cell" data-reached={reached || undefined} data-current={current || undefined}>+ {current && <span className="hall-rank-now">{t("society.hall.rank_held")}</span>}+ <span className="hall-rank-art">+ <RankInsignia rank={rung.rank} size={78} dim={!reached} />+ {rung.rank === "private" && <span className="hall-rank-none">{t("society.level.no_insignia")}</span>}+ </span>+ <strong>{t(`society.level.title.${rung.rank}`)}</strong>+ <span className="hall-rank-grade">{rung.grade}</span>+ <em>{reached ? t("society.hall.rank_from").replace("{0}", String(rung.level))+ : `${t("society.hall.rank_from").replace("{0}", String(rung.level))} · ${t("society.hall.xp_needed").replace("{0}", missing.toLocaleString())}`}</em>+ </li>+ );+ })}+ </ol>+ </section>+ );+ })}+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/RewardsTab.tsx b/jarvis/ui/web/frontend/src/components/society/progression/hall/RewardsTab.tsxindex 9d730a8976..0a735ad1a2 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/hall/RewardsTab.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/RewardsTab.tsx@@ -1,22 +1,22 @@/**- * The reward road: every level that brings something — pieces to wear and- * new titles — from the first unlock to the cap, as one horizontal road with- * the subject's own position on it. Choosing a step shows it below: the- * subject in the preview wearing that piece, how rare it is, at which level- * it opens and how much XP is still missing, and a button to put it on once- * it is open.+ * The promotion road: every level that brings something — a new rank, a+ * uniform piece, or both — from the first promotion to the cap, as one+ * horizontal road with the subject's own position on it. Choosing a step+ * shows it below: the figure in the preview as it will look at that rank+ * wearing that piece, the rank's insignia, name and grade, the level it+ * opens at and the XP still missing, and a button to put an open piece on.*/import { useEffect, useMemo, useRef, useState } from "react";import { useT } from "@/i18n";import { equippedFor, rewardRoad, type SlotChoice } from "../cosmetics";-import { slotOf, type RewardId, type Slot } from "../levelCatalog";+import { RANK_INFO, rankAt, slotOf, type RankId, type RewardId, type Slot } from "../levelCatalog";+import { RankInsignia } from "../insignia/RankInsignia";import type { RewardRow } from "../progressionApi";import { useProgression } from "../progressionStore";import { RewardIcon } from "../RewardIcon";-import { rarityOf, xpToReach } from "./hallModel";-import { LockGlyph, TabIcon, type HallWho } from "./hallParts";+import { xpToReach } from "./hallModel";+import { LockGlyph, type HallWho } from "./hallParts";import { LoadoutPreview } from "./LoadoutPreview";-import { FramePlate } from "./StudioTab";const NO_REWARDS: RewardRow[] = [];const NO_TITLES: { level: number; title: string }[] = [];@@ -25,7 +25,7 @@ const NO_CHOICES: Partial<Record<Slot, SlotChoice>> = {};interface Step { level: number; rewards: RewardRow[]; title?: string }-/** The road's steps: each level with a reward or a new title, lowest first. */+/** The road's steps: each level with a reward or a new rank, lowest first. */export function roadSteps(road: readonly RewardRow[], titles: readonly { level: number; title: string }[], kind: "person" | "pet"): Step[] {const byLevel = new Map<number, Step>();for (const reward of road) {@@ -56,9 +56,10 @@ export function RewardsTab({ who }: { who: HallWho }) {const road = useMemo(() => rewardRoad(rewards, who.kind), [rewards, who.kind]);const steps = useMemo(() => roadSteps(road, titles, who.kind), [road, titles, who.kind]);const nextStep = steps.find((s) => s.level > level);- const initial = (focus && road.find((r) => r.rewardId === focus)) || nextStep?.rewards[0] || road[road.length - 1];+ const focusRow = focus ? road.find((r) => r.rewardId === focus) : undefined;const [selected, setSelected] = useState<{ level: number; reward: RewardId | null }>(() => ({- level: initial ? initial.levels[who.kind] ?? 1 : nextStep?.level ?? 1, reward: initial?.rewardId ?? null,+ level: focusRow?.levels[who.kind] ?? nextStep?.level ?? steps[steps.length - 1]?.level ?? 1,+ reward: focusRow?.rewardId ?? nextStep?.rewards[0]?.rewardId ?? null,}));const step = steps.find((s) => s.level === selected.level) ?? nextStep ?? steps[0];const reward = step?.rewards.find((r) => r.rewardId === selected.reward) ?? step?.rewards[0];@@ -73,6 +74,8 @@ export function RewardsTab({ who }: { who: HallWho }) {const open = level >= step.level;const missing = xpToReach(curve, subject?.xp ?? 0, step.level);const worn = reward ? equipped[reward.slot] === reward.rewardId : false;+ const stepRank: RankId = rankAt(titles, step.level);+ const info = RANK_INFO[stepRank];return (<div className="hall-rewards"><p className="hall-lead">{t("society.hall.road_body")}</p>@@ -80,6 +83,7 @@ export function RewardsTab({ who }: { who: HallWho }) {{steps.map((s, i) => {const done = level >= s.level;const here = s === nextStep;+ const rank = rankAt(titles, s.level);return (<li key={s.level} data-done={done || undefined} data-here={here || undefined}>{here && <span className="hall-road-here">{t("society.hall.road_here").replace("{0}", String(level))}</span>}@@ -87,10 +91,10 @@ export function RewardsTab({ who }: { who: HallWho }) {onClick={() => setSelected({ level: s.level, reward: s.rewards[0]?.rewardId ?? null })}><span className="hall-road-level">{t("society.level.lv").replace("{0}", String(s.level))}</span><span className="hall-road-icons">- {s.rewards.map((r) => <RewardIcon key={r.rewardId} reward={r.rewardId} size={28} />)}- {s.title && <span className="hall-road-title-mark" aria-hidden><TabIcon path="M7 3.5h10v17l-5-3.6-5 3.6z" size={16} /></span>}+ {s.title && <RankInsignia rank={rank} size={30} dim={!done} />}+ {s.rewards.map((r) => <RewardIcon key={r.rewardId} reward={r.rewardId} size={30} locked={!done} />)}</span>- {s.title && <span className="hall-road-title">{t(`society.level.title.${s.title}`)}</span>}+ {s.title && <span className="hall-road-title">{t(`society.level.title.${rank}`)}</span>}{!done && <LockGlyph />}</button>{i < steps.length - 1 && <span className="hall-road-link" aria-hidden />}@@ -101,40 +105,40 @@ export function RewardsTab({ who }: { who: HallWho }) {<div className="hall-detail"><div className="hall-stage hall-stage-small">- <LoadoutPreview subject={who.preview} loadout={loadout} label={t("society.hall.preview_label").replace("{0}", who.name)} />- {reward?.slot === "frame" && (- <div className="hall-stage-bottom"><FramePlate name={who.name} level={step.level} frame={reward.rewardId} /></div>- )}+ <LoadoutPreview subject={who.preview} loadout={loadout} rank={stepRank}+ label={t("society.hall.preview_label").replace("{0}", who.name)} /></div><div className="hall-detail-info"><span className="hall-detail-kicker" data-open={open || undefined}>{open ? t("society.hall.reward_open").replace("{0}", String(step.level)) : t("society.hall.reward_locked").replace("{0}", String(step.level))}</span>+ <div className="hall-detail-rank" data-tier={info.tier}>+ <RankInsignia rank={stepRank} size={72} dim={!open} />+ <span>+ <strong>{t(`society.level.title.${stepRank}`)}</strong>+ <em>{info.grade} · {t(`society.hall.tier.${info.tier}`)}</em>+ </span>+ </div>{step.rewards.length > 1 && (<div className="hall-detail-pick" role="group" aria-label={t("society.level.lv").replace("{0}", String(step.level))}>{step.rewards.map((r) => (<button key={r.rewardId} type="button" aria-pressed={r.rewardId === reward?.rewardId}onClick={() => setSelected({ level: step.level, reward: r.rewardId })}>- <RewardIcon reward={r.rewardId} size={22} />+ <RewardIcon reward={r.rewardId} size={24} />{t(`society.level.reward.${r.rewardId}`)}</button>))}</div>)}{reward && (- <>- <h3>{t(`society.level.reward.${reward.rewardId}`)}</h3>- <span className="hall-card-meta">- <span className="hall-rarity" data-rarity={rarityOf(step.level)}>{t(`society.hall.rarity.${rarityOf(step.level)}`)}</span>- <span>{t(`society.level.slot.${reward.slot}`)}</span>+ <div className="hall-detail-piece">+ <RewardIcon reward={reward.rewardId} size={56} locked={!open} />+ <span>+ <h3>{t(`society.level.reward.${reward.rewardId}`)}</h3>+ <span className="hall-card-meta">{t(`society.level.slot.${reward.slot}`)}</span>+ <p>{t(`society.hall.slot_hint.${reward.slot}`)}</p></span>- <p>{t(`society.hall.slot_hint.${reward.slot}`)}</p>- </>- )}- {step.title && (- <p className="hall-detail-title">- {t("society.level.title_line").replace("{0}", t(`society.level.title.${step.title}`))}- </p>+ </div>)}{!open && <p className="hall-detail-missing">{t("society.hall.reward_missing").replace("{0}", missing.toLocaleString())}</p>}{reward && open && (diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/StudioTab.tsx b/jarvis/ui/web/frontend/src/components/society/progression/hall/StudioTab.tsxindex bb5c3fdc39..155e221d5c 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/hall/StudioTab.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/StudioTab.tsx@@ -1,35 +1,37 @@/**- * The Upgrade Studio: the dressing room for the person and their pet.+ * The studio: the dressing room for the person's uniform.*- * The live preview on the left wears the current loadout. On the right, one- * slot at a time (frame, trail, aura, gadget): "automatic" (always the best- * unlocked piece), "nothing", and every piece the subject can ever wear as a- * card. An unlocked piece is put on with one click; a locked one is tried on- * in the preview, marked as a try-on with the level and XP it still needs.- * The frame is not worn on the body, so the preview shows it on a name plate.+ * The live preview on the left wears the current loadout and the insignia of+ * the person's rank. On the right, one slot at a time (uniform, headwear,+ * decorations): "automatic" (always the finest unlocked piece), "own+ * clothes" (nothing from the slot), and every piece as a card with the rank+ * it comes with. An unlocked piece is put on with one click; a locked one is+ * tried on in the preview, marked as a try-on with the level and XP it still+ * needs. The pet wears no uniform: its page shows it with its rank.*/import { useMemo, useState } from "react";import { useT } from "@/i18n";import { equippedFor, rewardRoad, type SlotChoice } from "../cosmetics";-import { FRAME_STYLE, SLOTS, slotOf, type RewardId, type Slot } from "../levelCatalog";+import { rankAt, SLOTS, slotOf, type RankId, type RewardId, type Slot } from "../levelCatalog";+import { RankInsignia } from "../insignia/RankInsignia";import type { RewardRow } from "../progressionApi";import { useProgression } from "../progressionStore";import { RewardIcon } from "../RewardIcon";-import { rarityOf, xpToReach } from "./hallModel";-import { LevelHero, LockGlyph, TabIcon, type HallWho } from "./hallParts";+import { xpToReach } from "./hallModel";+import { LevelHero, LockGlyph, RankTag, TabIcon, type HallWho } from "./hallParts";import { LoadoutPreview } from "./LoadoutPreview";const NO_REWARDS: RewardRow[] = [];const NO_CURVE: number[] = [0];const NO_CHOICES: Partial<Record<Slot, SlotChoice>> = {};+const NO_TITLES: { level: number; title: string }[] = [];-/** The level number on a name plate in the frame a loadout wears: how the frame looks where it is worn. */-export function FramePlate({ name, level, frame }: { name: string; level: number; frame: RewardId | undefined }) {- const style = FRAME_STYLE[(frame ?? "frame_none") as keyof typeof FRAME_STYLE];+/** The name plate as it shows over the figure: the name and the rank chip. */+export function RankPlate({ name, level, rank }: { name: string; level: number; rank: RankId }) {return (<span className="hall-plate"><span>{name}</span>- <span className="level-chip" style={{ background: style.fill, color: style.ink, boxShadow: `inset 0 0 0 1.5px ${style.ring}, 0 0 10px ${style.ring}66` }}>{level}</span>+ <span className="level-chip"><RankInsignia rank={rank} size={16} /><b>{level}</b></span></span>);}@@ -38,14 +40,16 @@ export function StudioTab({ who }: { who: HallWho }) {const t = useT();const rewards = useProgression((s) => s.snapshot?.rewards ?? NO_REWARDS);const curve = useProgression((s) => s.snapshot?.levelXp ?? NO_CURVE);+ const titles = useProgression((s) => s.snapshot?.titles[who.kind] ?? NO_TITLES);const subject = useProgression((s) => s.subjects[who.subjectId]);const choices = useProgression((s) => s.choices[who.who] ?? NO_CHOICES);const choose = useProgression((s) => s.choose);const focus = useProgression((s) => s.focusReward);const level = subject?.level ?? 1;+ const rank = rankAt(titles, level);const road = useMemo(() => rewardRoad(rewards, who.kind), [rewards, who.kind]);const focusRow = focus ? road.find((r) => r.rewardId === focus) : undefined;- const [slot, setSlot] = useState<Slot>(focusRow?.slot ?? "gadget");+ const [slot, setSlot] = useState<Slot>(focusRow?.slot ?? "uniform");const [tryOn, setTryOn] = useState<RewardId | null>(focusRow && (focusRow.levels[who.kind] ?? 0) > level ? focusRow.rewardId : null);const equipped = useMemo(() => equippedFor(rewards, who.kind, level, choices), [rewards, who.kind, level, choices]);const loadout = tryOn ? { ...equipped, [slotOf(tryOn)]: tryOn } : equipped;@@ -60,7 +64,7 @@ export function StudioTab({ who }: { who: HallWho }) {return (<div className="hall-studio"><div className="hall-stage">- <LoadoutPreview subject={who.preview} loadout={loadout}+ <LoadoutPreview subject={who.preview} loadout={loadout} rank={rank}label={t("society.hall.preview_label").replace("{0}", who.name)} /><div className="hall-stage-top"><LevelHero who={who} compact />@@ -77,60 +81,67 @@ export function StudioTab({ who }: { who: HallWho }) {<button type="button" className="hall-button" onClick={() => setTryOn(null)}>{t("society.hall.try_on_back")}</button></div>) : (- <FramePlate name={who.name} level={level} frame={loadout.frame} />+ <RankPlate name={who.name} level={level} rank={rank} />)}<span className="hall-stage-hint">{t("society.hall.drag_hint")}</span></div></div><div className="hall-wardrobe">- <p className="hall-lead">{who.who === "person" ? t("society.hall.studio_body_you") : t("society.hall.studio_body").replace("{0}", who.name)}</p>- <div className="hall-slots" role="tablist" aria-label={t("society.hall.slots_label")}>- {slots.map((s) => {- const worn = loadout[s];- return (- <button key={s} type="button" role="tab" aria-selected={slot === s} className="hall-slot" onClick={() => setSlot(s)}>- {worn ? <RewardIcon reward={worn} size={26} /> : <span className="hall-slot-empty" aria-hidden />}- <span>{t(`society.level.slot.${s}`)}</span>- </button>- );- })}- </div>- <p className="hall-hint">{t(`society.hall.slot_hint.${slot}`)}</p>- <div className="hall-items" role="group" aria-label={t(`society.level.slot.${slot}`)}>- <button type="button" className="hall-item hall-item-plain" aria-pressed={current === "auto" && !tryOn} onClick={() => pick("auto")}>- <span className="hall-item-tile" aria-hidden><TabIcon path="M12 3v3M12 18v3M3 12h3M18 12h3M6 6l2 2M16 16l2 2M6 18l2-2M16 8l2-2" size={22} /></span>- <strong>{t("society.level.auto")}</strong>- <em>{t("society.hall.auto_hint")}</em>- </button>- <button type="button" className="hall-item hall-item-plain" aria-pressed={current === "none" && !tryOn} onClick={() => pick("none")}>- <span className="hall-item-tile" aria-hidden><TabIcon path="M5 5l14 14M12 3a9 9 0 1 1 0 18a9 9 0 1 1 0-18z" size={22} /></span>- <strong>{t("society.level.none")}</strong>- <em>{t("society.hall.none_hint")}</em>- </button>- {inSlot.map((reward) => {- const at = reward.levels[who.kind] ?? 0;- const open = level >= at;- const worn = equipped[slot] === reward.rewardId;- const pressed = tryOn ? tryOn === reward.rewardId : current === reward.rewardId;- const rarity = rarityOf(at);- return (- <button key={reward.rewardId} type="button" className="hall-item" data-rarity={rarity} data-open={open || undefined}- aria-pressed={pressed}- aria-label={open ? undefined : t("society.hall.locked_aria").replace("{0}", t(`society.level.reward.${reward.rewardId}`)).replace("{1}", String(at))}- onClick={() => (open ? pick(reward.rewardId) : setTryOn(reward.rewardId))}>- <RewardIcon reward={reward.rewardId} size={46} />- <strong>{t(`society.level.reward.${reward.rewardId}`)}</strong>- <span className="hall-rarity" data-rarity={rarity}>{t(`society.hall.rarity.${rarity}`)}</span>- <em data-open={open || undefined}>- {worn ? t("society.hall.equipped") : open ? t("society.hall.unlocked") : t("society.level.locked_at").replace("{0}", String(at))}- </em>- {!open && <LockGlyph />}- {worn && <span className="hall-item-check" aria-hidden><TabIcon path="M5 12.5l4.5 4.5L19 7.5" size={14} /></span>}- </button>- );- })}- </div>+ {slots.length === 0 ? (+ <div className="hall-insignia-card">+ <RankInsignia rank={rank} size={120} />+ <strong>{t(`society.level.title.${rank}`)}</strong>+ <p className="hall-hint">{t("society.hall.pet_rank_only").replace("{0}", who.name)}</p>+ </div>+ ) : <>+ <p className="hall-lead">{t("society.hall.studio_body_you")}</p>+ <div className="hall-slots" role="tablist" aria-label={t("society.hall.slots_label")}>+ {slots.map((s) => {+ const worn = loadout[s];+ return (+ <button key={s} type="button" role="tab" aria-selected={slot === s} className="hall-slot" onClick={() => setSlot(s)}>+ {worn ? <RewardIcon reward={worn} size={34} /> : <span className="hall-slot-empty" aria-hidden />}+ <span>{t(`society.level.slot.${s}`)}</span>+ </button>+ );+ })}+ </div>+ <p className="hall-hint">{t(`society.hall.slot_hint.${slot}`)}</p>+ <div className="hall-items" role="group" aria-label={t(`society.level.slot.${slot}`)}>+ <button type="button" className="hall-item hall-item-plain" aria-pressed={current === "auto" && !tryOn} onClick={() => pick("auto")}>+ <span className="hall-item-tile" aria-hidden><TabIcon path="M12 3v3M12 18v3M3 12h3M18 12h3M6 6l2 2M16 16l2 2M6 18l2-2M16 8l2-2" size={22} /></span>+ <strong>{t("society.level.auto")}</strong>+ <em>{t("society.hall.auto_hint")}</em>+ </button>+ <button type="button" className="hall-item hall-item-plain" aria-pressed={current === "none" && !tryOn} onClick={() => pick("none")}>+ <span className="hall-item-tile" aria-hidden><TabIcon path="M5 5l14 14M12 3a9 9 0 1 1 0 18a9 9 0 1 1 0-18z" size={22} /></span>+ <strong>{t("society.level.none")}</strong>+ <em>{t("society.hall.none_hint")}</em>+ </button>+ {inSlot.map((reward) => {+ const at = reward.levels[who.kind] ?? 0;+ const open = level >= at;+ const worn = equipped[slot] === reward.rewardId;+ const pressed = tryOn ? tryOn === reward.rewardId : current === reward.rewardId;+ return (+ <button key={reward.rewardId} type="button" className="hall-item" data-open={open || undefined}+ aria-pressed={pressed}+ aria-label={open ? undefined : t("society.hall.locked_aria").replace("{0}", t(`society.level.reward.${reward.rewardId}`)).replace("{1}", String(at))}+ onClick={() => (open ? pick(reward.rewardId) : setTryOn(reward.rewardId))}>+ <RewardIcon reward={reward.rewardId} size={58} locked={!open} />+ <strong>{t(`society.level.reward.${reward.rewardId}`)}</strong>+ <RankTag rank={rankAt(titles, at)} />+ <em data-open={open || undefined}>+ {worn ? t("society.hall.equipped") : open ? t("society.hall.unlocked") : t("society.level.locked_at").replace("{0}", String(at))}+ </em>+ {!open && <LockGlyph />}+ {worn && <span className="hall-item-check" aria-hidden><TabIcon path="M5 12.5l4.5 4.5L19 7.5" size={14} /></span>}+ </button>+ );+ })}+ </div>+ </>}</div></div>);diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/hall.css b/jarvis/ui/web/frontend/src/components/society/progression/hall/hall.cssindex 5abfedbe61..f88336afe1 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/hall/hall.css+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/hall.css@@ -1,9 +1,10 @@/** The Level Hall screen. The chrome (panel, tabs, cards, text) uses theme* tokens, so light and dark mode both read. The game's own pieces keep one- * look in both modes: the gold of levels, the teal of the pet, the rarity- * colours of rewards, and the midnight stage the preview stands on (the same- * room as the hall in the world).+ * look in both modes: the insignia, the reward pictures on their dark tiles,+ * the teal of the pet, and the midnight stage the preview stands on (the+ * same room as the hall in the world). Gold text is mixed with the theme's+ * ink so it stays legible on a light panel.*/.hall-layer { position:absolute; inset:0; z-index:50; display:flex; align-items:center; justify-content:center; padding:16px; background:rgb(0 0 0 / .38); backdrop-filter:blur(2px); }@@ -14,7 +15,7 @@/* ---------- head, tabs, foot ---------- */.hall-head { display:flex; align-items:center; gap:14px; padding:14px 16px 10px 18px; }.hall-brand { display:flex; align-items:center; gap:11px; flex:1; min-width:0; }-.hall-brand-mark { display:inline-flex; flex:none; align-items:center; justify-content:center; width:38px; height:38px; border-radius:11px; color:#2a1c00; background:linear-gradient(145deg, #ffe08a, #f0a92b); box-shadow:0 0 0 1px rgb(255 255 255 / .35) inset, 0 4px 14px rgb(240 169 43 / .35); }+.hall-brand-mark { display:inline-flex; flex:none; align-items:center; justify-content:center; width:38px; height:38px; border-radius:10px; color:#e3c06a; background:linear-gradient(180deg, #1d2748, #10162f); box-shadow:inset 0 0 0 1px #c9a24a; }.hall-brand h2 { margin:0; font-size:17px; font-weight:800; letter-spacing:-.01em; }.hall-brand small { display:block; margin-top:1px; font-size:12px; color:hsl(var(--muted-foreground)); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.hall-subject { display:inline-flex; flex:none; gap:2px; padding:3px; border-radius:999px; background:hsl(var(--secondary)); }@@ -26,12 +27,12 @@.hall-tabs { display:flex; gap:2px; padding:0 12px; border-bottom:1px solid hsl(var(--border)); overflow-x:auto; scrollbar-width:none; }.hall-tab { display:inline-flex; flex:none; align-items:center; gap:7px; padding:10px 12px 9px; border:0; border-bottom:2px solid transparent; background:none; color:hsl(var(--muted-foreground)); font:inherit; font-size:13px; font-weight:600; cursor:pointer; }.hall-tab:hover { color:hsl(var(--foreground)); }-.hall-tab[aria-selected="true"] { color:hsl(var(--foreground)); border-bottom-color:#f0a92b; }-.hall-tab[aria-selected="true"] svg { color:#f0a92b; }+.hall-tab[aria-selected="true"] { color:hsl(var(--foreground)); border-bottom-color:#c9a24a; }+.hall-tab[aria-selected="true"] svg { color:#c9a24a; }.hall-body { flex:1; min-height:0; overflow:auto; padding:18px; font-size:13px; }.hall-foot { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:9px 18px 11px; border-top:1px solid hsl(var(--border)); font-size:12px; color:hsl(var(--muted-foreground)); }.hall-sound { display:inline-flex; align-items:center; gap:7px; color:hsl(var(--foreground)); cursor:pointer; }-.hall-sound input { accent-color:#f0a92b; }+.hall-sound input { accent-color:#c9a24a; }/* ---------- shared ---------- */.hall-section { display:flex; flex-direction:column; gap:10px; min-width:0; }@@ -45,30 +46,27 @@.hall-button { border:1px solid hsl(var(--border)); border-radius:10px; padding:8px 14px; background:hsl(var(--background)); color:hsl(var(--foreground)); font:inherit; font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; }.hall-button:hover { background:hsl(var(--secondary)); }.hall-button:focus-visible, .hall-card:focus-visible, .hall-item:focus-visible, .hall-slot:focus-visible, .hall-road-step:focus-visible { outline:2px solid hsl(var(--ring)); outline-offset:2px; }-.hall-button-primary { align-self:flex-start; border-color:transparent; background:linear-gradient(180deg, #ffd96e, #f0a92b); color:#2a1c00; font-weight:800; box-shadow:0 4px 14px rgb(240 169 43 / .35); }-.hall-button-primary:hover { background:linear-gradient(180deg, #ffe28a, #f5b23d); }+.hall-button-primary { align-self:flex-start; border-color:#c9a24a; background:#141b33; color:#ecd9a4; font-weight:800; }+.hall-button-primary:hover { background:#1d2748; }-/* Rarity: one colour per tier, the same in both modes; text mixes it with the theme ink to stay legible. */-[data-rarity="common"] { --rar:148 163 184; }-[data-rarity="rare"] { --rar:59 130 246; }-[data-rarity="epic"] { --rar:168 85 247; }-[data-rarity="legendary"] { --rar:245 158 11; }-.hall-rarity { display:inline-flex; align-items:center; padding:1px 7px; border-radius:999px; background:rgb(var(--rar) / .16); color:color-mix(in srgb, rgb(var(--rar)) 72%, hsl(var(--foreground))); font-size:10px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }+/* The rank a piece comes with, or a rank on the road: a small tag with its insignia. */+.hall-rank-tag { display:inline-flex; align-items:center; gap:5px; padding:1px 8px 1px 4px; border-radius:6px; background:hsl(var(--secondary)); color:hsl(var(--foreground)); font-size:11px; font-weight:700; white-space:nowrap; }+.hall-rank-tag svg { display:block; }.hall-lock { position:absolute; top:9px; right:9px; color:hsl(var(--muted-foreground)); }/* A locked piece keeps its colours, dimmed: every card is also a preview of what is coming. */-.hall-card:not([data-open]) .level-reward-icon, .hall-item[data-rarity]:not([data-open]) .level-reward-icon,-.hall-road > li:not([data-done]) .level-reward-icon { filter:saturate(.6) brightness(.82); opacity:.78; }+/* ---------- level hero ---------- */-.hall-hero { display:flex; align-items:center; gap:22px; padding:18px 22px; border:1px solid rgb(245 184 61 / .35); border-radius:16px; background:radial-gradient(120% 160% at 0% 0%, rgb(245 184 61 / .18), transparent 60%), hsl(var(--secondary) / .6); }+.hall-hero { display:flex; align-items:center; gap:22px; padding:18px 22px; border:1px solid rgb(201 162 74 / .35); border-radius:16px; background:radial-gradient(120% 160% at 0% 0%, rgb(201 162 74 / .18), transparent 60%), hsl(var(--secondary) / .6); }.hall-hero[data-kind="pet"] { border-color:rgb(45 212 191 / .38); background:radial-gradient(120% 160% at 0% 0%, rgb(45 212 191 / .16), transparent 60%), hsl(var(--secondary) / .6); }.hall-hero[data-compact] { gap:14px; padding:10px 14px; }-.hall-hero .level-ring b { font-size:34px; }-.hall-hero[data-compact] .level-ring b { font-size:22px; }+.hall-hero .level-ring b { font-size:12px; line-height:17px; bottom:-7px; }+.hall-hero[data-compact] .level-ring b { font-size:10px; line-height:14px; bottom:-5px; }.hall-hero-body { display:flex; flex-direction:column; gap:6px; flex:1; min-width:0; }.hall-hero-name { font-size:21px; font-weight:800; letter-spacing:-.01em; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.hall-hero[data-compact] .hall-hero-name { font-size:15px; }-.hall-hero-title { align-self:flex-start; padding:2px 10px; border-radius:999px; background:rgb(245 184 61 / .18); color:color-mix(in srgb, #f0a92b 70%, hsl(var(--foreground))); font-size:12px; font-weight:800; }+.hall-hero-title { display:inline-flex; align-items:baseline; gap:8px; align-self:flex-start; padding:3px 10px; border-radius:7px; background:rgb(201 162 74 / .16); color:color-mix(in srgb, #c9a24a 55%, hsl(var(--foreground))); font-size:13px; font-weight:800; }+.hall-hero-title small { font-size:11px; font-weight:700; opacity:.75; letter-spacing:.04em; }.hall-hero[data-kind="pet"] .hall-hero-title { background:rgb(45 212 191 / .16); color:color-mix(in srgb, #14b8a6 70%, hsl(var(--foreground))); }.hall-hero .level-bar { height:10px; margin-top:4px; }.hall-hero[data-compact] .level-bar { height:7px; }@@ -81,31 +79,32 @@.hall-overview { display:grid; grid-template-columns:minmax(0, 1.35fr) minmax(0, 1fr); gap:18px; align-items:start; }.hall-overview > .hall-hero, .hall-overview > .hall-wide { grid-column:1 / -1; }.hall-cards { display:grid; grid-template-columns:1fr; gap:8px; }-.hall-card { position:relative; display:flex; align-items:center; gap:12px; width:100%; padding:11px 34px 11px 11px; border:1px solid hsl(var(--border)); border-left:3px solid rgb(var(--rar)); border-radius:12px; background:hsl(var(--background)); color:inherit; font:inherit; text-align:left; cursor:pointer; transition:background .12s, transform .12s; }+.hall-card { position:relative; display:flex; align-items:center; gap:12px; width:100%; padding:11px 34px 11px 11px; border:1px solid hsl(var(--border)); border-left:3px solid hsl(var(--border)); border-radius:12px; background:hsl(var(--background)); color:inherit; font:inherit; text-align:left; cursor:pointer; transition:background .12s, transform .12s; }.hall-card:hover { background:hsl(var(--secondary)); transform:translateX(2px); }+.hall-card[data-open] { border-left-color:#c9a24a; }.hall-card-text { display:flex; flex-direction:column; gap:3px; min-width:0; }.hall-card-text strong { font-size:14px; }-.hall-card-meta { display:flex; align-items:center; gap:8px; font-size:11.5px; color:hsl(var(--muted-foreground)); }+.hall-card-meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:11.5px; color:hsl(var(--muted-foreground)); }.hall-card-state { font-size:11.5px; color:hsl(var(--muted-foreground)); font-variant-numeric:tabular-nums; }.hall-card-state[data-open] { color:hsl(var(--success)); font-weight:600; }.hall-rules { display:grid; grid-template-columns:repeat(auto-fill, minmax(250px, 1fr)); gap:6px 10px; margin:0; padding:0; list-style:none; }.hall-overview .hall-rules { grid-template-columns:1fr; }.hall-rule { display:flex; align-items:flex-start; gap:10px; padding:8px 10px; border-radius:10px; background:hsl(var(--secondary) / .55); }-.hall-rule-xp { flex:none; min-width:40px; padding:2px 6px; border-radius:7px; background:rgb(245 184 61 / .2); color:color-mix(in srgb, #f0a92b 60%, hsl(var(--foreground))); font-size:12px; font-weight:800; text-align:center; font-variant-numeric:tabular-nums; }+.hall-rule-xp { flex:none; min-width:40px; padding:2px 6px; border-radius:7px; background:rgb(201 162 74 / .2); color:color-mix(in srgb, #c9a24a 60%, hsl(var(--foreground))); font-size:12px; font-weight:800; text-align:center; font-variant-numeric:tabular-nums; }.hall-rule-text { display:flex; flex-direction:column; gap:2px; font-size:13px; }.hall-rule-text em { font-style:normal; font-size:11px; color:hsl(var(--muted-foreground)); }/* ---------- the stage (game look in both modes) ---------- */-.hall-stage { position:relative; min-height:440px; overflow:hidden; border-radius:16px; background:radial-gradient(90% 70% at 50% 38%, #2b3c7c 0%, #151d3d 58%, #0a0f2c 100%); box-shadow:inset 0 0 0 1px rgb(255 215 110 / .22); color:#fff; }+.hall-stage { position:relative; min-height:440px; overflow:hidden; border-radius:16px; background:radial-gradient(80% 65% at 50% 40%, #27325a 0%, #141a33 60%, #0b1024 100%); box-shadow:inset 0 0 0 1px rgb(201 162 74 / .3); color:#fff; }.hall-stage-small { min-height:330px; }.hall-preview { position:absolute; inset:0; cursor:grab; touch-action:none; }.hall-preview:active { cursor:grabbing; }.hall-preview-note { position:absolute; left:12px; right:12px; top:50%; margin:0; padding:6px 10px; border-radius:10px; background:rgb(10 15 44 / .8); color:rgb(255 255 255 / .85); font-size:12px; text-align:center; pointer-events:none; }.hall-preview-fallback { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; margin:0; padding:20px; text-align:center; color:rgb(255 255 255 / .7); }.hall-stage-top { position:absolute; top:12px; left:12px; right:12px; pointer-events:none; }-.hall-stage .hall-hero { border-color:rgb(255 215 110 / .3); background:rgb(10 15 44 / .62); backdrop-filter:blur(6px); color:#fff; }+.hall-stage .hall-hero { border-color:rgb(201 162 74 / .3); background:rgb(10 15 44 / .62); backdrop-filter:blur(6px); color:#fff; }.hall-stage .hall-hero[data-kind="pet"] { border-color:rgb(94 234 212 / .35); }-.hall-stage .hall-hero-title { color:#ffe08a; background:rgb(255 210 94 / .18); }+.hall-stage .hall-hero-title { color:#ecd9a4; background:rgb(201 162 74 / .18); }.hall-stage .hall-hero[data-kind="pet"] .hall-hero-title { color:#99f6e4; background:rgb(94 234 212 / .16); }.hall-stage .hall-hero-xp span, .hall-stage .hall-hero-meta { color:rgb(255 255 255 / .7); }.hall-stage .level-bar { background:rgb(255 255 255 / .16); }@@ -114,29 +113,29 @@.hall-stage-bottom > * { pointer-events:auto; }.hall-stage-hint { font-size:11px; color:rgb(255 255 255 / .55); pointer-events:none !important; }.hall-plate { display:inline-flex; align-items:center; gap:8px; padding:4px 6px 4px 12px; border-radius:999px; background:rgb(14 18 36 / .85); box-shadow:0 0 0 1px rgb(255 255 255 / .12); color:#fff; font-size:13px; font-weight:700; }-.hall-plate .level-chip { min-width:26px; height:22px; font-size:12px; }-.hall-tryon { display:flex; align-items:center; gap:12px; max-width:100%; padding:8px 8px 8px 10px; border:1px solid #ffd25e; border-radius:12px; background:rgb(26 18 2 / .97); color:#fff3c4; box-shadow:0 0 24px rgb(255 210 94 / .3); }+.hall-plate .level-chip { height:22px; font-size:12px; padding:0 7px 0 4px; }+.hall-tryon { display:flex; align-items:center; gap:12px; max-width:100%; padding:8px 8px 8px 10px; border:1px solid #d9b764; border-radius:12px; background:rgb(26 18 2 / .97); color:#fff3c4; box-shadow:0 0 24px rgb(201 162 74 / .3); }.hall-tryon > span:nth-child(2) { display:flex; flex-direction:column; gap:1px; min-width:0; }.hall-tryon strong { font-size:13px; }.hall-tryon em { font-style:normal; font-size:11.5px; color:rgb(255 243 196 / .8); }-.hall-tryon-badge { flex:none; padding:3px 8px; border-radius:999px; background:#ffd25e; color:#2a1c00; font-size:10px; font-weight:900; letter-spacing:.1em; text-transform:uppercase; }-.hall-tryon .hall-button { border-color:rgb(255 210 94 / .5); background:rgb(255 255 255 / .08); color:#fff3c4; font-size:12px; padding:6px 10px; }+.hall-tryon-badge { flex:none; padding:3px 8px; border-radius:999px; background:#d9b764; color:#2a1c00; font-size:10px; font-weight:900; letter-spacing:.1em; text-transform:uppercase; }+.hall-tryon .hall-button { border-color:rgb(201 162 74 / .5); background:rgb(255 255 255 / .08); color:#fff3c4; font-size:12px; padding:6px 10px; }.hall-tryon .hall-button:hover { background:rgb(255 255 255 / .16); }/* ---------- studio ---------- */.hall-studio { display:grid; grid-template-columns:minmax(300px, 1.05fr) minmax(0, 1fr); gap:18px; min-height:100%; }.hall-studio .hall-stage { min-height:520px; }.hall-wardrobe { display:flex; flex-direction:column; gap:12px; min-width:0; }-.hall-slots { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:8px; }+.hall-slots { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:8px; }.hall-slot { display:flex; flex-direction:column; align-items:center; gap:6px; padding:10px 6px 9px; border:1px solid hsl(var(--border)); border-radius:12px; background:hsl(var(--background)); color:hsl(var(--muted-foreground)); font:inherit; font-size:12px; font-weight:700; cursor:pointer; }.hall-slot:hover { background:hsl(var(--secondary)); color:hsl(var(--foreground)); }-.hall-slot[aria-selected="true"] { border-color:#f0a92b; background:rgb(245 184 61 / .1); color:hsl(var(--foreground)); box-shadow:0 0 0 3px rgb(245 184 61 / .16); }+.hall-slot[aria-selected="true"] { border-color:#c9a24a; background:rgb(201 162 74 / .1); color:hsl(var(--foreground)); box-shadow:0 0 0 3px rgb(201 162 74 / .16); }.hall-slot-empty { width:26px; height:26px; border:1.5px dashed hsl(var(--border)); border-radius:8px; }.hall-items { display:grid; grid-template-columns:repeat(auto-fill, minmax(146px, 1fr)); gap:10px; }-.hall-item { position:relative; display:flex; flex-direction:column; align-items:center; gap:6px; padding:16px 10px 12px; border:1px solid hsl(var(--border)); border-bottom:3px solid rgb(var(--rar, 148 163 184)); border-radius:14px; background:hsl(var(--background)); color:inherit; font:inherit; text-align:center; cursor:pointer; transition:transform .12s, background .12s, box-shadow .12s; }+.hall-item { position:relative; display:flex; flex-direction:column; align-items:center; gap:6px; padding:16px 10px 12px; border:1px solid hsl(var(--border)); border-bottom:3px solid hsl(var(--border)); border-radius:14px; background:hsl(var(--background)); color:inherit; font:inherit; text-align:center; cursor:pointer; transition:transform .12s, background .12s, box-shadow .12s; }.hall-item:hover { transform:translateY(-2px); background:hsl(var(--secondary)); }-.hall-item[aria-pressed="true"] { border-color:#f0a92b; box-shadow:0 0 0 3px rgb(245 184 61 / .22); }-.hall-item[data-open] .level-reward-icon { box-shadow:0 0 16px rgb(var(--rar) / .55), inset 0 0 0 1px rgb(255 255 255 / .35); }+.hall-item[aria-pressed="true"] { border-color:#c9a24a; box-shadow:0 0 0 3px rgb(201 162 74 / .22); }+.hall-item[data-open] { border-bottom-color:#c9a24a; }.hall-item strong { font-size:13px; line-height:1.25; }.hall-item em { font-style:normal; font-size:11px; color:hsl(var(--muted-foreground)); font-variant-numeric:tabular-nums; }.hall-item em[data-open] { color:hsl(var(--success)); font-weight:600; }@@ -150,16 +149,15 @@.hall-road > li { position:relative; display:flex; flex:none; align-items:center; scroll-snap-align:center; }.hall-road-step { position:relative; display:flex; flex-direction:column; align-items:center; gap:7px; min-width:104px; padding:10px 10px 12px; border:1px solid hsl(var(--border)); border-radius:14px; background:hsl(var(--background)); color:inherit; font:inherit; cursor:pointer; transition:transform .12s, box-shadow .12s; }.hall-road-step:hover { background:hsl(var(--secondary)); }-.hall-road > li[data-done] .hall-road-step { border-color:rgb(245 184 61 / .55); background:rgb(245 184 61 / .08); }-.hall-road-step[aria-pressed="true"] { transform:translateY(-3px); border-color:#f0a92b; box-shadow:0 0 0 3px rgb(245 184 61 / .22), 0 8px 18px rgb(0 0 0 / .14); }+.hall-road > li[data-done] .hall-road-step { border-color:rgb(201 162 74 / .55); background:rgb(201 162 74 / .08); }+.hall-road-step[aria-pressed="true"] { transform:translateY(-3px); border-color:#c9a24a; box-shadow:0 0 0 3px rgb(201 162 74 / .22), 0 8px 18px rgb(0 0 0 / .14); }.hall-road-level { font-size:12.5px; font-weight:800; font-variant-numeric:tabular-nums; }.hall-road-icons { display:flex; align-items:center; gap:4px; }-.hall-road-title-mark { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:8px; background:hsl(var(--secondary)); color:hsl(var(--muted-foreground)); }.hall-road-title { padding:2px 8px; border-radius:999px; background:hsl(var(--secondary)); font-size:10.5px; font-weight:700; white-space:nowrap; }.hall-road-step .hall-lock { top:6px; right:6px; }.hall-road-link { width:26px; height:3px; border-radius:2px; background:hsl(var(--border)); }-.hall-road > li[data-done] .hall-road-link { background:linear-gradient(90deg, #f0a92b, #ffd25e); }-.hall-road-here { position:absolute; top:-26px; left:0; padding:2px 9px; border-radius:999px; background:#f0a92b; color:#2a1c00; font-size:10.5px; font-weight:800; white-space:nowrap; box-shadow:0 2px 8px rgb(240 169 43 / .4); }+.hall-road > li[data-done] .hall-road-link { background:linear-gradient(90deg, #c9a24a, #d9b764); }+.hall-road-here { position:absolute; top:-26px; left:0; padding:2px 9px; border-radius:6px; background:#141b33; color:#ecd9a4; font-size:10.5px; font-weight:800; white-space:nowrap; }.hall-detail { display:grid; grid-template-columns:minmax(280px, 1fr) minmax(0, 1fr); gap:20px; align-items:stretch; }.hall-detail-info { display:flex; flex-direction:column; justify-content:center; gap:10px; min-width:0; }.hall-detail-info h3 { margin:0; font-size:24px; font-weight:800; letter-spacing:-.01em; }@@ -168,18 +166,51 @@.hall-detail-kicker[data-open] { color:hsl(var(--success)); }.hall-detail-pick { display:flex; gap:6px; flex-wrap:wrap; }.hall-detail-pick button { display:inline-flex; align-items:center; gap:6px; padding:4px 10px 4px 4px; border:1px solid hsl(var(--border)); border-radius:999px; background:hsl(var(--background)); color:inherit; font:inherit; font-size:12px; font-weight:600; cursor:pointer; }-.hall-detail-pick button[aria-pressed="true"] { border-color:#f0a92b; background:rgb(245 184 61 / .1); }+.hall-detail-pick button[aria-pressed="true"] { border-color:#c9a24a; background:rgb(201 162 74 / .1); }.hall-detail-title { font-weight:700; color:hsl(var(--foreground)) !important; }-.hall-detail-missing { font-size:15px; font-weight:700; color:color-mix(in srgb, #f0a92b 70%, hsl(var(--foreground))) !important; }+.hall-detail-missing { font-size:15px; font-weight:700; color:color-mix(in srgb, #c9a24a 70%, hsl(var(--foreground))) !important; }.hall-detail-worn { align-self:flex-start; padding:5px 12px; border-radius:999px; background:hsl(var(--success) / .14); color:hsl(var(--success)); font-size:12.5px; font-weight:700; }+/* ---------- next promotion, the pet's rank, the road's detail ---------- */+.hall-promotion { display:flex; align-items:center; gap:16px; width:100%; padding:14px 16px; border:1px solid hsl(var(--border)); border-left:3px solid #c9a24a; border-radius:12px; background:hsl(var(--background)); color:inherit; font:inherit; text-align:left; cursor:pointer; }+.hall-promotion:hover { background:hsl(var(--secondary)); }+.hall-promotion:focus-visible { outline:2px solid hsl(var(--ring)); outline-offset:2px; }+.hall-promotion > span { display:flex; flex-direction:column; gap:3px; min-width:0; }+.hall-promotion strong { font-size:16px; }+.hall-promotion em { font-style:normal; font-size:12px; color:hsl(var(--muted-foreground)); }+.hall-promotion-xp { font-size:12.5px; font-weight:700; color:color-mix(in srgb, #c9a24a 60%, hsl(var(--foreground))); font-variant-numeric:tabular-nums; }+.hall-insignia-card { display:flex; flex-direction:column; align-items:center; gap:12px; padding:36px 24px; border:1px solid hsl(var(--border)); border-radius:16px; background:hsl(var(--secondary) / .5); text-align:center; }+.hall-insignia-card strong { font-size:20px; }+.hall-detail-rank { display:flex; align-items:center; gap:16px; }+.hall-detail-rank > span { display:flex; flex-direction:column; gap:3px; }+.hall-detail-rank strong { font-size:22px; font-weight:800; letter-spacing:-.01em; }+.hall-detail-rank em { font-style:normal; font-size:12.5px; color:hsl(var(--muted-foreground)); }+.hall-detail-piece { display:flex; align-items:flex-start; gap:14px; padding:12px; border:1px solid hsl(var(--border)); border-radius:12px; background:hsl(var(--background)); }+.hall-detail-piece h3 { margin:0 0 2px; font-size:16px !important; }+.hall-detail-piece p { margin:6px 0 0; font-size:12.5px; }++/* ---------- ranks chart ---------- */+.hall-ranks { display:flex; flex-direction:column; gap:18px; }+.hall-rank-tier h3 { margin:0 0 10px; font-size:11px; font-weight:700; letter-spacing:.07em; text-transform:uppercase; color:hsl(var(--muted-foreground)); }+.hall-rank-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(132px, 1fr)); gap:10px; margin:0; padding:0; list-style:none; }+.hall-rank-cell { position:relative; display:flex; flex-direction:column; align-items:center; gap:4px; padding:14px 8px 12px; border:1px solid hsl(var(--border)); border-radius:12px; background:hsl(var(--background)); text-align:center; }+.hall-rank-cell[data-reached] { background:hsl(var(--secondary) / .55); }+.hall-rank-cell[data-current] { border-color:#c9a24a; box-shadow:0 0 0 2px rgb(201 162 74 / .25); }+.hall-rank-art { position:relative; display:flex; align-items:center; justify-content:center; height:88px; padding:5px; border-radius:10px; background:#141a33; width:100%; }+.hall-rank-tier[data-tier="general"] .hall-rank-art { background:#0d0e12; }+.hall-rank-none { position:absolute; inset:auto 6px 8px; font-size:10px; color:rgb(255 255 255 / .55); }+.hall-rank-cell strong { font-size:12.5px; line-height:1.25; }+.hall-rank-grade { font-size:11px; font-weight:800; letter-spacing:.06em; color:color-mix(in srgb, #c9a24a 60%, hsl(var(--foreground))); }+.hall-rank-cell em { font-style:normal; font-size:10.5px; color:hsl(var(--muted-foreground)); font-variant-numeric:tabular-nums; }+.hall-rank-now { position:absolute; top:-9px; left:50%; transform:translateX(-50%); padding:1px 8px; border-radius:5px; background:#141b33; box-shadow:inset 0 0 0 1px #c9a24a; color:#ecd9a4; font-size:10px; font-weight:800; white-space:nowrap; }+/* ---------- guide ---------- */.hall-guide { display:flex; flex-direction:column; gap:20px; }.hall-steps { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; margin:0; padding:0; list-style:none; }.hall-steps > li { display:flex; flex-direction:column; gap:6px; padding:16px; border:1px solid hsl(var(--border)); border-radius:14px; background:hsl(var(--secondary) / .5); }.hall-steps strong { font-size:15px; }.hall-steps p { margin:0; color:hsl(var(--muted-foreground)); line-height:1.45; }-.hall-step-n { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:50%; background:linear-gradient(145deg, #ffe08a, #f0a92b); color:#2a1c00; font-size:14px; font-weight:900; }+.hall-step-n { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:7px; background:#141b33; box-shadow:inset 0 0 0 1px #c9a24a; color:#ecd9a4; font-size:14px; font-weight:900; }.hall-costs { display:flex; flex-direction:column; gap:2px; margin:4px 0 0; padding:0; list-style:none; font-size:12px; font-variant-numeric:tabular-nums; }.hall-rule-group h4 { margin:2px 0 8px; font-size:13px; font-weight:700; }.hall-guide-section { padding-top:4px; }diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/hall.test.tsx b/jarvis/ui/web/frontend/src/components/society/progression/hall/hall.test.tsxindex 8b2156356c..e5843cc62a 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/hall/hall.test.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/hall.test.tsx@@ -5,17 +5,18 @@ import { nextUnlock, rewardRoad } from "../cosmetics";import type { ProgressionSnapshot, RewardRow, XpRuleRow } from "../progressionApi";import { useProgression } from "../progressionStore";import type { ToyLook } from "../../office/toyFigureModel";-import { groupRules, nextTitle, quickWins, rarityOf, upcomingLevelCosts, xpToReach } from "./hallModel";+import { groupRules, nextTitle, quickWins, rankLadder, upcomingLevelCosts, xpToReach } from "./hallModel";import { LevelHallScreen } from "./LevelHallScreen";import { roadSteps } from "./RewardsTab";const REWARDS: RewardRow[] = [- { rewardId: "gadget_drone", slot: "gadget", levels: { person: 10, agent: 12, pet: 9 } },- { rewardId: "frame_bronze", slot: "frame", levels: { person: 3, agent: 3, pet: 3 } },- { rewardId: "frame_silver", slot: "frame", levels: { person: 10, agent: 10, pet: 10 } },- { rewardId: "trail_footprints", slot: "trail", levels: { person: 2, agent: null, pet: null } },- { rewardId: "gadget_wings", slot: "gadget", levels: { person: 40, agent: 45, pet: null } },+ { rewardId: "headwear_patrol_cap", slot: "headwear", levels: { person: 10, agent: null, pet: null } },+ { rewardId: "decoration_ribbon_bar", slot: "decoration", levels: { person: 3, agent: 3, pet: null } },+ { rewardId: "uniform_field_jacket", slot: "uniform", levels: { person: 10, agent: null, pet: null } },+ { rewardId: "uniform_service_shirt", slot: "uniform", levels: { person: 2, agent: null, pet: null } },+ { rewardId: "decoration_medals", slot: "decoration", levels: { person: 40, agent: 44, pet: null } },];+const BANDS = [{ level: 1, title: "private" }, { level: 5, title: "private_second_class" }, { level: 10, title: "sergeant" }];const CURVE = [0, 40, 105, 195, 310, 450, 615, 805, 1020, 1260];const rule = (source: XpRuleRow["source"], kind: XpRuleRow["kind"], xp: number): XpRuleRow =>({ source, kind, xp, trigger: "server", cooldownS: 0, dailyCap: 0 });@@ -26,15 +27,16 @@ const RULES: XpRuleRow[] = [function snapshot(): ProgressionSnapshot {return {- subjects: [{ subjectId: "person", kind: "person", xp: 130, level: 3, xpIntoLevel: 25, xpForNext: 90, title: "newcomer" }],+ subjects: [{ subjectId: "person", kind: "person", xp: 130, level: 3, xpIntoLevel: 25, xpForNext: 90, title: "private" }],petId: "gigi", recent: [], latestSeq: 0, maxLevel: 50, levelXp: CURVE, rules: RULES, rewards: REWARDS,- titles: { person: [{ level: 1, title: "newcomer" }, { level: 5, title: "apprentice" }], agent: [], pet: [] },+ titles: { person: BANDS, agent: BANDS, pet: BANDS },};}describe("hall model", () => {- it("grades rewards by the level they open at", () => {- expect([2, 5, 6, 15, 16, 30, 31, 50].map(rarityOf)).toEqual(["common", "common", "rare", "rare", "epic", "epic", "legendary", "legendary"]);+ it("reads the server's bands as the rank ladder, skipping unknown ranks", () => {+ expect(rankLadder([...BANDS, { level: 12, title: "admiral" }]).map((r) => [r.level, r.rank, r.grade, r.tier]))+ .toEqual([[1, "private", "E-1", "enlisted"], [5, "private_second_class", "E-2", "enlisted"], [10, "sergeant", "E-5", "nco"]]);});it("measures what is missing on the server's curve", () => {@@ -47,19 +49,19 @@ describe("hall model", () => {it("orders the road by unlock level, slot order within a level, and skips what a kind never wears", () => {expect(rewardRoad(REWARDS, "person").map((r) => r.rewardId))- .toEqual(["trail_footprints", "frame_bronze", "frame_silver", "gadget_drone", "gadget_wings"]);- expect(rewardRoad(REWARDS, "pet").map((r) => r.rewardId)).toEqual(["frame_bronze", "gadget_drone", "frame_silver"]);- expect(nextUnlock(REWARDS, "person", 3)?.rewardId).toBe("frame_silver");+ .toEqual(["uniform_service_shirt", "decoration_ribbon_bar", "uniform_field_jacket", "headwear_patrol_cap", "decoration_medals"]);+ expect(rewardRoad(REWARDS, "pet")).toEqual([]);+ expect(nextUnlock(REWARDS, "person", 3)?.rewardId).toBe("uniform_field_jacket");expect(nextUnlock(REWARDS, "person", 40)).toBeUndefined();});- it("builds road steps from rewards and title bands", () => {- const steps = roadSteps(rewardRoad(REWARDS, "person"), [{ level: 1, title: "newcomer" }, { level: 5, title: "apprentice" }, { level: 10, title: "operator" }], "person");+ it("builds road steps from rewards and promotions", () => {+ const steps = roadSteps(rewardRoad(REWARDS, "person"), BANDS, "person");expect(steps.map((s) => s.level)).toEqual([2, 3, 5, 10, 40]);- expect(steps.find((s) => s.level === 10)).toMatchObject({ title: "operator" });- expect(steps.find((s) => s.level === 10)!.rewards.map((r) => r.rewardId)).toEqual(["frame_silver", "gadget_drone"]);- expect(nextTitle([{ level: 5, title: "apprentice" }, { level: 1, title: "newcomer" }], 3)).toEqual({ level: 5, title: "apprentice" });- expect(nextTitle([{ level: 5, title: "apprentice" }], 5)).toBeUndefined();+ expect(steps.find((s) => s.level === 10)).toMatchObject({ title: "sergeant" });+ expect(steps.find((s) => s.level === 10)!.rewards.map((r) => r.rewardId)).toEqual(["uniform_field_jacket", "headwear_patrol_cap"]);+ expect(nextTitle([BANDS[1], BANDS[0]], 3)).toEqual(BANDS[1]);+ expect(nextTitle([BANDS[1]], 5)).toBeUndefined();});it("groups the rules for the guide and picks repeatable quick wins", () => {@@ -88,19 +90,29 @@ describe("Level Hall screen", () => {expect(screen.queryByRole("dialog")).toBeNull();});- it("opens on the overview with five pages and the next unlocks", () => {+ it("opens on the overview with six pages, the next promotion and the next unlocks", () => {useProgression.getState().openPanel("overview");mount();const dialog = screen.getByRole("dialog");const tabs = within(dialog).getAllByRole("tab");- expect(tabs).toHaveLength(5);+ expect(tabs).toHaveLength(6);expect(tabs[0].getAttribute("aria-selected")).toBe("true");expect(within(dialog).getByText("Ruby")).toBeTruthy();- // The next unlock (silver frame at level 10) opens in the studio, ready to try on.+ expect(dialog.querySelector(".hall-promotion")).toBeTruthy();+ // The next unlock (the field jacket at level 10) opens in the studio, ready to try on.const cards = dialog.querySelectorAll(".hall-card");expect(cards.length).toBe(3);fireEvent.click(cards[0]);- expect(useProgression.getState()).toMatchObject({ panel: "studio", focusReward: "frame_silver" });+ expect(useProgression.getState()).toMatchObject({ panel: "studio", focusReward: "uniform_field_jacket" });+ });++ it("charts every rank on the ranks page and marks the one held", () => {+ useProgression.getState().openPanel("ranks");+ mount();+ const cells = document.querySelectorAll(".hall-rank-cell");+ expect(cells).toHaveLength(BANDS.length);+ expect(document.querySelectorAll(".hall-rank-cell[data-current]")).toHaveLength(1);+ expect(cells[0].hasAttribute("data-current")).toBe(true);});it("switches between the person and the pet, and lists every way to earn on the guide", () => {@@ -122,8 +134,8 @@ describe("Level Hall screen", () => {it("forgets a focused reward when another page opens without one", () => {const store = useProgression.getState();- store.openPanel("rewards", { reward: "gadget_drone", subject: "pet" });- expect(useProgression.getState()).toMatchObject({ panel: "rewards", focusReward: "gadget_drone", hallSubject: "pet" });+ store.openPanel("rewards", { reward: "headwear_patrol_cap", subject: "pet" });+ expect(useProgression.getState()).toMatchObject({ panel: "rewards", focusReward: "headwear_patrol_cap", hallSubject: "pet" });useProgression.getState().openPanel("guide");expect(useProgression.getState()).toMatchObject({ focusReward: null, hallSubject: "pet" });});diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/hallModel.ts b/jarvis/ui/web/frontend/src/components/society/progression/hall/hallModel.tsindex d4a6b311d4..863c4bf965 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/hall/hallModel.ts+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/hallModel.ts@@ -3,17 +3,17 @@* curve, the rules and the reward levels all come from the snapshot; nothing* here re-derives the rulebook.*/-import type { SubjectKind, XpSource } from "../levelCatalog";+import { isRankId, RANK_INFO, type RankId, type RankTier, type SubjectKind, type XpSource } from "../levelCatalog";import type { XpRuleRow } from "../progressionApi";-/** How rare a reward feels, by the level it unlocks at: the colour of its card. */-export type Rarity = "common" | "rare" | "epic" | "legendary";+/** One rung of the rank ladder: the rank, the level it starts at, its grade and tier. */+export interface Rung { level: number; rank: RankId; grade: string; tier: RankTier }-export function rarityOf(unlockLevel: number): Rarity {- if (unlockLevel <= 5) return "common";- if (unlockLevel <= 15) return "rare";- if (unlockLevel <= 30) return "epic";- return "legendary";+/** The server's title bands as the rank ladder, lowest first; a band naming no known rank is skipped. */+export function rankLadder(bands: readonly { level: number; title: string }[]): Rung[] {+ return [...bands].sort((a, b) => a.level - b.level)+ .filter((band): band is { level: number; title: RankId } => isRankId(band.title))+ .map((band) => ({ level: band.level, rank: band.title, ...RANK_INFO[band.title] }));}/** XP still missing until `target` is reached (0 once it is); `levelXp[i]` is the total at which level i + 1 starts. */diff --git a/jarvis/ui/web/frontend/src/components/society/progression/hall/hallParts.tsx b/jarvis/ui/web/frontend/src/components/society/progression/hall/hallParts.tsxindex 33a77f935b..045e797032 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/hall/hallParts.tsx+++ b/jarvis/ui/web/frontend/src/components/society/progression/hall/hallParts.tsx@@ -1,15 +1,17 @@/*** Pieces the Level Hall screen's pages share: the tab icons, the level hero,- * reward cards, the padlock and the XP rule rows.+ * reward cards, the rank tag, the padlock and the XP rule rows.*/import type { ReactNode } from "react";import { useT } from "@/i18n";import { levelFraction } from "../cosmetics";import { LevelRing, XpBar } from "../LevelHud";+import { RANK_INFO, rankAt, type RankId } from "../levelCatalog";+import { RankInsignia } from "../insignia/RankInsignia";import type { RewardRow, XpRuleRow } from "../progressionApi";import { useProgression } from "../progressionStore";import { RewardIcon } from "../RewardIcon";-import { nextTitle, rarityOf } from "./hallModel";+import { nextTitle } from "./hallModel";import type { PreviewSubject } from "./LoadoutPreview";import { ruleLimit } from "./ruleLimit";@@ -55,7 +57,10 @@ export function LevelHero({ who, compact = false }: { who: HallWho; compact?: bo<LevelRing kind={who.kind} level={level} fraction={fraction} size={compact ? 76 : 120} /><div className="hall-hero-body"><span className="hall-hero-name">{who.name}</span>- <span className="hall-hero-title">{t(`society.level.title.${subject?.title || (who.kind === "pet" ? "hatchling" : "newcomer")}`)}</span>+ <span className="hall-hero-title">+ <span>{t(`society.level.title.${rankAt(titles, level)}`)}</span>+ <small>{RANK_INFO[rankAt(titles, level)].grade}</small>+ </span><XpBar fraction={fraction} kind={who.kind} label={t("society.level.xp_label")} /><span className="hall-hero-xp"><b>{atCap ? t("society.level.max") : t("society.level.xp_of").replace("{0}", String(subject?.xpIntoLevel ?? 0)).replace("{1}", String(subject?.xpForNext ?? 40))}</b>@@ -74,22 +79,33 @@ export function LevelHero({ who, compact = false }: { who: HallWho; compact?: bo);}-/** A reward as a card: its tile, name, slot and rarity, and whether it is open. */+/** The rank a level brings, as a small tag: its insignia and name. */+export function RankTag({ rank }: { rank: RankId }) {+ const t = useT();+ return (+ <span className="hall-rank-tag" data-tier={RANK_INFO[rank].tier}>+ <RankInsignia rank={rank} size={13} />+ {t(`society.level.title.${rank}`)}+ </span>+ );+}++/** A reward as a card: its picture, name, slot, the rank it comes with, and whether it is open. */export function RewardCard({ reward, kind, level, onClick, pressed, badge, xpMissing }: {reward: RewardRow; kind: "person" | "pet"; level: number; onClick?: () => void; pressed?: boolean; badge?: string; xpMissing?: number;}) {const t = useT();+ const titles = useProgression((s) => s.snapshot?.titles[kind] ?? NO_TITLES);const at = reward.levels[kind] ?? 0;const open = level >= at;- const rarity = rarityOf(at);const body = (<>- <RewardIcon reward={reward.rewardId} size={44} />+ <RewardIcon reward={reward.rewardId} size={48} locked={!open} /><span className="hall-card-text"><strong>{t(`society.level.reward.${reward.rewardId}`)}</strong><span className="hall-card-meta">- <span className="hall-rarity" data-rarity={rarity}>{t(`society.hall.rarity.${rarity}`)}</span><span>{t(`society.level.slot.${reward.slot}`)}</span>+ <RankTag rank={rankAt(titles, at)} /></span><span className="hall-card-state" data-open={open || undefined}>{badge ?? (open ? t("society.hall.unlocked") : xpMissing !== undefined@@ -101,8 +117,8 @@ export function RewardCard({ reward, kind, level, onClick, pressed, badge, xpMis</>);return onClick- ? <button type="button" className="hall-card" data-rarity={rarity} data-open={open || undefined} aria-pressed={pressed} onClick={onClick}>{body}</button>- : <div className="hall-card" data-rarity={rarity} data-open={open || undefined}>{body}</div>;+ ? <button type="button" className="hall-card" data-open={open || undefined} aria-pressed={pressed} onClick={onClick}>{body}</button>+ : <div className="hall-card" data-open={open || undefined}>{body}</div>;}export function LockGlyph() {diff --git a/jarvis/ui/web/frontend/src/components/society/progression/insignia/RankInsignia.tsx b/jarvis/ui/web/frontend/src/components/society/progression/insignia/RankInsignia.tsxnew file mode 100644index 0000000000..6381da878c--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/progression/insignia/RankInsignia.tsx@@ -0,0 +1,66 @@+/**+ * A rank's insignia as an SVG: embroidered gold on navy for enlisted ranks,+ * struck metal for officers, silver stars for generals. Drawn from the same+ * polygons as the 3D pieces (`rankArt.ts`). Private (E-1) wears no insignia,+ * so it shows an empty stitched outline. Decorative: the rank name always+ * sits next to it.+ */+import { useId, type CSSProperties } from "react";+import type { RankId } from "../levelCatalog";+import { FINISH_TONES, rankArt, svgPoints, type Finish } from "./rankArt";++const FINISHES: Finish[] = ["gold", "silver", "cloth"];++export function RankInsignia({ rank, size = 32, dim = false, reveal = false, className }: {+ rank: RankId;+ /** Height in px; the width follows the insignia's own shape. */+ size?: number;+ /** A rank not reached yet: drawn as a quiet silhouette. */+ dim?: boolean;+ /** Lay the pieces on one after another (CSS: `.rank-part` with `--i`, the piece's place in the stack). */+ reveal?: boolean;+ className?: string;+}) {+ const id = useId().replace(/:/g, "");+ const art = rankArt(rank);+ const pad = 4;+ const vbH = art.h + pad * 2;+ const vbW = art.w + pad * 2;+ const width = (size * vbW) / vbH;+ if (art.parts.length === 0) {+ return (+ <svg className={className} viewBox={`0 0 ${vbW} ${vbH}`} width={width} height={size} aria-hidden data-rank={rank}>+ <rect x={pad + 18} y={pad + 22} width={64} height={56} rx={10} fill="none" stroke="currentColor" strokeOpacity={0.45}+ strokeWidth={3} strokeDasharray="6 5" />+ </svg>+ );+ }+ return (+ <svg className={className} viewBox={`${-pad} ${-pad} ${vbW} ${vbH}`} width={width} height={size} aria-hidden data-rank={rank}+ data-dim={dim || undefined}>+ <defs>+ {FINISHES.map((finish) => {+ const tone = FINISH_TONES[finish];+ return (+ <linearGradient key={finish} id={`${id}-${finish}`} x1="0" y1="0" x2="0.35" y2="1">+ <stop offset="0" stopColor={tone.light} />+ <stop offset="0.45" stopColor={tone.mid} />+ <stop offset="1" stopColor={tone.dark} />+ </linearGradient>+ );+ })}+ </defs>+ <g opacity={dim ? 0.32 : 1} style={dim ? { filter: "grayscale(1)" } : undefined}>+ {art.parts.map((part, i) => {+ const tone = FINISH_TONES[part.finish];+ const order = reveal ? { className: "rank-part", style: { "--i": i } as CSSProperties } : {};+ if (part.detail) return <polygon key={i} points={svgPoints(part.pts)} fill={tone.dark} fillOpacity={0.55} {...order} />;+ return (+ <polygon key={i} points={svgPoints(part.pts)} fill={`url(#${id}-${part.finish})`} stroke={tone.edge}+ strokeWidth={part.finish === "cloth" ? 1.6 : 1.1} strokeLinejoin="round" {...order} />+ );+ })}+ </g>+ </svg>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/insignia/rankArt.ts b/jarvis/ui/web/frontend/src/components/society/progression/insignia/rankArt.tsnew file mode 100644index 0000000000..314c65117a--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/progression/insignia/rankArt.ts@@ -0,0 +1,363 @@+/**+ * The rank insignia as vector art: one source for every place a rank is+ * drawn — the SVG icons in the HUD, the banner and the hall screen, the+ * canvas of the Level Wall, and the extruded 3D pieces on a figure's sleeve+ * or shoulder and in the hall's display cases. Because every surface reads+ * these polygons, the insignia in a display case IS the one on the figure.+ *+ * Coordinates: a box 100 units wide, y pointing down (SVG convention); the+ * height depends on the insignia. Enlisted ranks are gold chevrons, rockers+ * and devices on a cut-to-shape navy backing worn on the upper sleeve;+ * officers wear metal pins (bars, oak leaves, the eagle) and general officers+ * silver stars on the shoulder. Private (E-1) wears no insignia.+ *+ * Pure geometry: no DOM, no three.js.+ */+import type { RankId } from "../levelCatalog";++export type Pt = readonly [number, number];++/** What a part is made of: embroidered gold, polished silver, or the navy cloth it is sewn onto. */+export type Finish = "gold" | "silver" | "cloth";++export interface InsigniaPart {+ pts: Pt[];+ finish: Finish;+ /** Raised detail (a leaf's veins, an eagle's feathers): drawn in a darker tone, extruded higher. */+ detail?: boolean;+}++export interface InsigniaArt {+ w: number;+ h: number;+ parts: InsigniaPart[];+ /** Where a figure wears it. */+ mount: "sleeve" | "shoulder" | "none";+}++// ---------------------------------------------------------------------------+// Primitives++/** Chevron geometry: each band rises RISE over a half-span of SPAN, BAND thick, a new band every STEP. */+const SPAN = 46;+const RISE = 30;+const BAND = 9.5;+const STEP = 13;+const TOP = 6;+/** How far a rocker sags at its centre. */+const SAG = 15;+/** The navy backing's margin round the gold. */+const MARGIN = 3.2;++function chevron(y0: number): Pt[] {+ return [+ [50, y0], [50 + SPAN, y0 + RISE], [50 + SPAN, y0 + RISE + BAND],+ [50, y0 + BAND], [50 - SPAN, y0 + RISE + BAND], [50 - SPAN, y0 + RISE],+ ];+}++/** A rocker: a band that hangs between the two leg ends, sagging SAG at the middle. */+function rockerEdge(yEnds: number, sag: number, steps = 16): Pt[] {+ const out: Pt[] = [];+ for (let i = 0; i <= steps; i += 1) {+ const u = -1 + (2 * i) / steps;+ out.push([50 + u * SPAN, yEnds + sag * (1 - u * u)]);+ }+ return out;+}++function rocker(yEnds: number): Pt[] {+ const top = rockerEdge(yEnds, SAG);+ const bottom = rockerEdge(yEnds + BAND, SAG).reverse();+ return [...top, ...bottom];+}++export function star(cx: number, cy: number, r: number, rotation = 0): Pt[] {+ const out: Pt[] = [];+ for (let i = 0; i < 10; i += 1) {+ const a = rotation - Math.PI / 2 + (i * Math.PI) / 5;+ const rr = i % 2 === 0 ? r : r * 0.4;+ out.push([cx + Math.cos(a) * rr, cy + Math.sin(a) * rr]);+ }+ return out;+}++export function ellipse(cx: number, cy: number, rx: number, ry: number, steps = 24, rotation = 0): Pt[] {+ const out: Pt[] = [];+ const c = Math.cos(rotation), s = Math.sin(rotation);+ for (let i = 0; i < steps; i += 1) {+ const a = (i / steps) * Math.PI * 2;+ const x = Math.cos(a) * rx, y = Math.sin(a) * ry;+ out.push([cx + x * c - y * s, cy + x * s + y * c]);+ }+ return out;+}++function roundRect(x0: number, y0: number, x1: number, y1: number, r: number): Pt[] {+ const out: Pt[] = [];+ const corners: [number, number, number][] = [[x1 - r, y0 + r, -Math.PI / 2], [x1 - r, y1 - r, 0], [x0 + r, y1 - r, Math.PI / 2], [x0 + r, y0 + r, Math.PI]];+ for (const [cx, cy, start] of corners) {+ for (let i = 0; i <= 4; i += 1) {+ const a = start + (i / 4) * (Math.PI / 2);+ out.push([cx + Math.cos(a) * r, cy + Math.sin(a) * r]);+ }+ }+ return out;+}++function diamond(cx: number, cy: number, rx: number, ry: number): Pt[] {+ return [[cx, cy - ry], [cx + rx, cy], [cx, cy + ry], [cx - rx, cy]];+}++function transform(pts: readonly Pt[], cx: number, cy: number, s: number, flipX = false): Pt[] {+ return pts.map(([x, y]) => [cx + (flipX ? -x : x) * s, cy + y * s] as Pt);+}++/**+ * A heraldic eagle with spread wings, its head turned to the viewer's left,+ * in a unit box (about -1..1). Wings are fans of feathers; a tail fan below.+ */+function eagleUnit(): { body: Pt[][]; detail: Pt[][] } {+ // Each wing is a fan of primary feathers raised from the shoulder, longest at the top.+ const pivot: Pt = [-0.14, -0.04];+ const feathers = 7;+ const wing: Pt[] = [[-0.06, -0.2]];+ for (let k = 0; k < feathers; k += 1) {+ const t = k / (feathers - 1);+ const angle = (-100 - t * 92) * (Math.PI / 180);+ const reach = 0.96 - t * 0.42;+ const tip: Pt = [pivot[0] + Math.cos(angle) * reach, pivot[1] + Math.sin(angle) * reach];+ // A feather has a rounded tip: two points either side of the axis.+ const across = angle + Math.PI / 2;+ wing.push([tip[0] + Math.cos(across) * 0.045, tip[1] + Math.sin(across) * 0.045]);+ wing.push([tip[0] + Math.cos(angle) * 0.03, tip[1] + Math.sin(angle) * 0.03]);+ wing.push([tip[0] - Math.cos(across) * 0.045, tip[1] - Math.sin(across) * 0.045]);+ if (k < feathers - 1) {+ const mid = angle - (92 / (feathers - 1) / 2) * (Math.PI / 180);+ const notch = reach * 0.8;+ wing.push([pivot[0] + Math.cos(mid) * notch, pivot[1] + Math.sin(mid) * notch]);+ }+ }+ wing.push([-0.12, 0.16]);+ const rightWing = wing.map(([x, y]) => [-x, y] as Pt).reverse();+ const body = ellipse(0, 0.06, 0.17, 0.34, 20);+ const head = ellipse(-0.03, -0.36, 0.12, 0.12, 16);+ const beak: Pt[] = [[-0.1, -0.4], [-0.27, -0.34], [-0.11, -0.29]];+ const tail: Pt[] = [[-0.12, 0.3], [-0.24, 0.72], [-0.1, 0.64], [0, 0.8], [0.1, 0.64], [0.24, 0.72], [0.12, 0.3]];+ // Raised feather lines on each wing and a breast shield.+ const detail: Pt[][] = [];+ for (const side of [-1, 1]) {+ for (let k = 0; k < 3; k += 1) {+ const angle = (-118 - k * 26) * (Math.PI / 180);+ const x0 = side * -(pivot[0] + Math.cos(angle) * 0.18), y0 = pivot[1] + Math.sin(angle) * 0.18;+ const x1 = side * -(pivot[0] + Math.cos(angle) * (0.66 - k * 0.08)), y1 = pivot[1] + Math.sin(angle) * (0.66 - k * 0.08);+ const nx = -(y1 - y0), ny = x1 - x0;+ const len = Math.hypot(nx, ny) || 1;+ const w = 0.016;+ detail.push([[x0 + (nx / len) * w, y0 + (ny / len) * w], [x1 + (nx / len) * w, y1 + (ny / len) * w],+ [x1 - (nx / len) * w, y1 - (ny / len) * w], [x0 - (nx / len) * w, y0 - (ny / len) * w]]);+ }+ }+ detail.push([[-0.1, -0.06], [0.1, -0.06], [0.1, 0.12], [0, 0.24], [-0.1, 0.12]]);+ return { body: [wing, rightWing, body, head, beak, tail], detail };+}++const EAGLE = eagleUnit();++export function eagle(cx: number, cy: number, s: number, finish: Finish): InsigniaPart[] {+ return [+ ...EAGLE.body.map((pts) => ({ pts: transform(pts, cx, cy, s), finish })),+ ...EAGLE.detail.map((pts) => ({ pts: transform(pts, cx, cy, s), finish, detail: true })),+ ];+}++/** A lobed oak leaf, stem down, centred on (50, cy). */+function oakLeaf(cy: number, finish: Finish): InsigniaPart[] {+ const length = 84, width = 30, top = cy - length / 2;+ const steps = 48;+ const right: Pt[] = [];+ for (let i = 0; i <= steps; i += 1) {+ const t = i / steps;+ const body = Math.pow(Math.sin(Math.PI * Math.pow(t, 0.8)), 0.85);+ const lobes = 0.74 + 0.26 * Math.cos(t * Math.PI * 2 * 3.5 + 0.6);+ right.push([50 + (width / 2) * body * lobes, top + t * length * 0.9]);+ }+ const stem: Pt[] = [[52.2, top + length * 0.9], [52.2, top + length], [47.8, top + length], [47.8, top + length * 0.9]];+ const left = right.map(([x, y]) => [100 - x, y] as Pt).reverse();+ const outline = [...right, ...stem.slice(1, 3), ...left];+ const veins: Pt[][] = [[[49.2, top + 6], [50.8, top + 6], [50.8, top + length * 0.9], [49.2, top + length * 0.9]]];+ for (let k = 0; k < 3; k += 1) {+ const y = top + 20 + k * 18;+ for (const side of [-1, 1]) {+ veins.push([[50, y], [50 + side * 10, y - 6], [50 + side * 10.6, y - 4.6], [50, y + 2]]);+ }+ }+ return [{ pts: outline, finish }, ...veins.map((pts) => ({ pts, finish, detail: true }))];+}++// ---------------------------------------------------------------------------+// Enlisted sets++interface ChevronSet { chevrons: number; rockers: number; device?: "diamond" | "star" | "wreath" | "sma" }++function chevronSet({ chevrons, rockers, device }: ChevronSet): InsigniaArt {+ const parts: InsigniaPart[] = [];+ const lastY = TOP + (chevrons - 1) * STEP;+ const legEnd = lastY + RISE + BAND;+ for (let i = 0; i < chevrons; i += 1) parts.push({ pts: chevron(TOP + i * STEP), finish: "gold" });+ const rockerEnds: number[] = [];+ for (let j = 0; j < rockers; j += 1) {+ const y = legEnd + 3.5 + j * STEP;+ rockerEnds.push(y);+ parts.push({ pts: rocker(y), finish: "gold" });+ }+ // The device sits in the space between the lowest chevron and the first rocker.+ const deviceY = (lastY + BAND + (rockerEnds[0] ?? legEnd) + SAG) / 2 + 2;+ if (device === "diamond") parts.push({ pts: diamond(50, deviceY, 8, 11.5), finish: "gold" });+ if (device === "star") parts.push({ pts: star(50, deviceY + 1, 12), finish: "gold" });+ if (device === "wreath") {+ parts.push({ pts: star(50, deviceY - 1, 9), finish: "gold" });+ for (const side of [-1, 1]) {+ for (let k = 0; k < 5; k += 1) {+ const a = Math.PI / 2 + side * (0.55 + k * 0.42);+ const r = 14;+ parts.push({ pts: ellipse(50 + Math.cos(a) * r, deviceY + 1 + Math.sin(a) * r, 3.6, 1.7, 10, a + Math.PI / 2), finish: "gold", detail: true });+ }+ }+ }+ if (device === "sma") {+ parts.push(...eagle(50, deviceY - 1, 11, "gold"));+ parts.push({ pts: star(33, deviceY + 5, 5.5), finish: "gold" }, { pts: star(67, deviceY + 5, 5.5), finish: "gold" });+ }+ // The navy backing: the gold outline grown by a margin, cut along the lowest band.+ const bottom = rockers > 0+ ? rockerEdge(rockerEnds[rockers - 1] + BAND + MARGIN, SAG + 0.6).reverse()+ : [[50 + SPAN + MARGIN, legEnd + MARGIN], [50, lastY + BAND + MARGIN * 1.6], [50 - SPAN - MARGIN, legEnd + MARGIN]] as Pt[];+ const sideBottom = rockers > 0 ? rockerEnds[rockers - 1] + BAND + MARGIN : legEnd + MARGIN;+ const backing: Pt[] = [+ [50, TOP - MARGIN * 1.7],+ [50 + SPAN + MARGIN, TOP + RISE - MARGIN * 0.3],+ [50 + SPAN + MARGIN, sideBottom],+ ...(rockers > 0 ? bottom : bottom.slice(1, 2)),+ [50 - SPAN - MARGIN, sideBottom],+ [50 - SPAN - MARGIN, TOP + RISE - MARGIN * 0.3],+ ];+ const h = Math.max(...backing.map(([, y]) => y)) + 2;+ return { w: 100, h, parts: [{ pts: backing, finish: "cloth" }, ...parts], mount: "sleeve" };+}++function specialist(): InsigniaArt {+ const shield = (inset: number): Pt[] => {+ const out: Pt[] = [];+ const r = 38 - inset;+ for (let i = 0; i <= 18; i += 1) {+ const a = Math.PI + (i / 18) * Math.PI;+ out.push([50 + Math.cos(a) * r, 44 + Math.sin(a) * r]);+ }+ out.push([88 - inset, 66 - inset * 0.3], [50, 98 - inset * 1.5], [12 + inset, 66 - inset * 0.3]);+ return out;+ };+ return {+ w: 100, h: 100, mount: "sleeve",+ parts: [{ pts: shield(0), finish: "gold" }, { pts: shield(5), finish: "cloth" }, ...eagle(50, 50, 30, "gold")],+ };+}++// ---------------------------------------------------------------------------+// Officers++function bar(x0: number, x1: number, finish: Finish): InsigniaPart[] {+ return [+ { pts: roundRect(x0, 10, x1, 90, 3), finish },+ // A raised rim inside the bar, the way a pin is struck.+ { pts: roundRect(x0 + 3.5, 14, x1 - 3.5, 86, 2), finish, detail: true },+ ];+}++function stars(count: number): InsigniaArt {+ const r = [0, 21, 17, 13.5, 11][count];+ const gap = (100 - 12) / count;+ const parts: InsigniaPart[] = [];+ for (let i = 0; i < count; i += 1) parts.push({ pts: star(50, 6 + gap * (i + 0.5), r), finish: "silver" });+ return { w: 100, h: 100, parts, mount: "shoulder" };+}++function fiveStars(): InsigniaArt {+ const parts: InsigniaPart[] = [];+ for (let i = 0; i < 5; i += 1) {+ const a = -Math.PI / 2 + (i * 2 * Math.PI) / 5;+ // Each star points out from the ring; their inner points meet in the middle.+ parts.push({ pts: star(50 + Math.cos(a) * 27, 50 + Math.sin(a) * 27, 17, a + Math.PI / 2), finish: "silver" });+ }+ return { w: 100, h: 100, parts, mount: "shoulder" };+}++// ---------------------------------------------------------------------------++const BUILD: Record<RankId, () => InsigniaArt> = {+ private: () => ({ w: 100, h: 100, parts: [], mount: "none" }),+ private_second_class: () => chevronSet({ chevrons: 1, rockers: 0 }),+ private_first_class: () => chevronSet({ chevrons: 1, rockers: 1 }),+ specialist,+ corporal: () => chevronSet({ chevrons: 2, rockers: 0 }),+ sergeant: () => chevronSet({ chevrons: 3, rockers: 0 }),+ staff_sergeant: () => chevronSet({ chevrons: 3, rockers: 1 }),+ sergeant_first_class: () => chevronSet({ chevrons: 3, rockers: 2 }),+ master_sergeant: () => chevronSet({ chevrons: 3, rockers: 3 }),+ first_sergeant: () => chevronSet({ chevrons: 3, rockers: 3, device: "diamond" }),+ sergeant_major: () => chevronSet({ chevrons: 3, rockers: 3, device: "star" }),+ command_sergeant_major: () => chevronSet({ chevrons: 3, rockers: 3, device: "wreath" }),+ sergeant_major_of_the_army: () => chevronSet({ chevrons: 3, rockers: 3, device: "sma" }),+ second_lieutenant: () => ({ w: 100, h: 100, parts: bar(38, 62, "gold"), mount: "shoulder" }),+ first_lieutenant: () => ({ w: 100, h: 100, parts: bar(38, 62, "silver"), mount: "shoulder" }),+ captain: () => ({+ w: 100, h: 100, mount: "shoulder",+ parts: [...bar(22, 43, "silver"), ...bar(57, 78, "silver"),+ { pts: roundRect(42, 20, 58, 25, 1), finish: "silver" }, { pts: roundRect(42, 75, 58, 80, 1), finish: "silver" }],+ }),+ major: () => ({ w: 100, h: 100, parts: oakLeaf(50, "gold"), mount: "shoulder" }),+ lieutenant_colonel: () => ({ w: 100, h: 100, parts: oakLeaf(50, "silver"), mount: "shoulder" }),+ colonel: () => ({ w: 100, h: 100, parts: eagle(50, 52, 46, "silver"), mount: "shoulder" }),+ brigadier_general: () => stars(1),+ major_general: () => stars(2),+ lieutenant_general: () => stars(3),+ general: () => stars(4),+ general_of_the_army: fiveStars,+};++const cache = new Map<RankId, InsigniaArt>();++/** The insignia of a rank, built once. */+export function rankArt(rank: RankId): InsigniaArt {+ let art = cache.get(rank);+ if (!art) {+ art = BUILD[rank]();+ cache.set(rank, art);+ }+ return art;+}++/** The officer's cap badge: the gold eagle. */+export const CAP_BADGE_ART: InsigniaArt = { w: 100, h: 100, parts: eagle(50, 52, 46, "gold"), mount: "none" };++/** A unit crest for enlisted headwear: a gold disc ringed in gold with a star. */+export const CREST_ART: InsigniaArt = {+ w: 100, h: 100, mount: "none",+ parts: [+ { pts: ellipse(50, 50, 46, 46, 36), finish: "gold" },+ { pts: ellipse(50, 50, 36, 36, 36), finish: "cloth" },+ { pts: star(50, 52, 28), finish: "gold" },+ ],+};++/** Polygon points as an SVG `points` attribute. */+export function svgPoints(pts: readonly Pt[]): string {+ return pts.map(([x, y]) => `${x.toFixed(2)},${y.toFixed(2)}`).join(" ");+}++/** The colours each finish is drawn in: a light, a mid and a dark stop, plus the edge line. */+export const FINISH_TONES: Record<Finish, { light: string; mid: string; dark: string; edge: string }> = {+ gold: { light: "#fbe7a1", mid: "#d8a93f", dark: "#8f6518", edge: "#5c3f0a" },+ silver: { light: "#ffffff", mid: "#c9ced6", dark: "#7c8592", edge: "#3d434d" },+ cloth: { light: "#2a3558", mid: "#1b2340", dark: "#111731", edge: "#0a0e1f" },+};diff --git a/jarvis/ui/web/frontend/src/components/society/progression/levelCatalog.ts b/jarvis/ui/web/frontend/src/components/society/progression/levelCatalog.tsindex 2d987ffe77..7b2ab0e4a8 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/levelCatalog.ts+++ b/jarvis/ui/web/frontend/src/components/society/progression/levelCatalog.ts@@ -9,22 +9,66 @@export const SUBJECT_KINDS = ["person", "agent", "pet"] as const;export type SubjectKind = (typeof SUBJECT_KINDS)[number];-export const SLOTS = ["frame", "trail", "aura", "gadget"] as const;+export const SLOTS = ["uniform", "headwear", "decoration"] as const;export type Slot = (typeof SLOTS)[number];export const REWARD_IDS = [- "frame_bronze", "frame_silver", "frame_gold", "frame_diamond",- "trail_footprints", "trail_sparkle", "trail_comet", "trail_neon", "trail_rainbow", "trail_stardust",- "aura_glow", "aura_runes", "aura_storm", "aura_legend",- "gadget_drone", "gadget_halo", "gadget_crown", "gadget_wings",+ "uniform_service_shirt", "uniform_field_jacket", "uniform_service_greens", "uniform_dress_blues", "uniform_mess_dress",+ "headwear_patrol_cap", "headwear_garrison_cap", "headwear_beret", "headwear_service_cap",+ "decoration_ribbon_bar", "decoration_ribbon_rack", "decoration_aiguillette", "decoration_medals",] as const;export type RewardId = (typeof REWARD_IDS)[number];+/** The rank ladder, lowest first: every subject kind wears it as its title. */export const TITLE_IDS = [- "newcomer", "apprentice", "operator", "specialist", "strategist", "architect", "commander", "visionary", "legend",- "rookie", "trainee", "associate", "professional", "expert", "veteran", "elite", "grandmaster",- "hatchling", "buddy", "sidekick", "partner", "guardian", "champion", "mythic",+ "private", "private_second_class", "private_first_class", "specialist", "corporal", "sergeant", "staff_sergeant",+ "sergeant_first_class", "master_sergeant", "first_sergeant", "sergeant_major", "command_sergeant_major",+ "sergeant_major_of_the_army", "second_lieutenant", "first_lieutenant", "captain", "major", "lieutenant_colonel",+ "colonel", "brigadier_general", "major_general", "lieutenant_general", "general", "general_of_the_army",] as const;+export type RankId = (typeof TITLE_IDS)[number];++/** Where a rank sits: enlisted, non-commissioned officer, officer or general officer. */+export type RankTier = "enlisted" | "nco" | "officer" | "general";++/** Each rank's pay grade and tier. The level it starts at comes from the server (`titles`). */+export const RANK_INFO: Record<RankId, { grade: string; tier: RankTier }> = {+ private: { grade: "E-1", tier: "enlisted" },+ private_second_class: { grade: "E-2", tier: "enlisted" },+ private_first_class: { grade: "E-3", tier: "enlisted" },+ specialist: { grade: "E-4", tier: "enlisted" },+ corporal: { grade: "E-4", tier: "nco" },+ sergeant: { grade: "E-5", tier: "nco" },+ staff_sergeant: { grade: "E-6", tier: "nco" },+ sergeant_first_class: { grade: "E-7", tier: "nco" },+ master_sergeant: { grade: "E-8", tier: "nco" },+ first_sergeant: { grade: "E-8", tier: "nco" },+ sergeant_major: { grade: "E-9", tier: "nco" },+ command_sergeant_major: { grade: "E-9", tier: "nco" },+ sergeant_major_of_the_army: { grade: "E-9", tier: "nco" },+ second_lieutenant: { grade: "O-1", tier: "officer" },+ first_lieutenant: { grade: "O-2", tier: "officer" },+ captain: { grade: "O-3", tier: "officer" },+ major: { grade: "O-4", tier: "officer" },+ lieutenant_colonel: { grade: "O-5", tier: "officer" },+ colonel: { grade: "O-6", tier: "officer" },+ brigadier_general: { grade: "O-7", tier: "general" },+ major_general: { grade: "O-8", tier: "general" },+ lieutenant_general: { grade: "O-9", tier: "general" },+ general: { grade: "O-10", tier: "general" },+ general_of_the_army: { grade: "O-11", tier: "general" },+};++export function isRankId(value: unknown): value is RankId {+ return typeof value === "string" && value in RANK_INFO;+}++/** The rank held at `level`, from the server's bands (lowest first); private before the snapshot arrives. */+export function rankAt(bands: readonly { level: number; title: string }[] | undefined, level: number): RankId {+ let rank: RankId = "private";+ for (const band of bands ?? []) if (level >= band.level && isRankId(band.title)) rank = band.title;+ return rank;+}export const XP_SOURCES = ["chat_turn", "voice_turn", "quest_posted", "quest_completed", "agent_hired", "mission_completed",@@ -45,33 +89,3 @@ export function slotOf(reward: RewardId): Slot {export function isRewardId(value: unknown): value is RewardId {return typeof value === "string" && (REWARD_IDS as readonly string[]).includes(value);}--/** Frame tiers colour the level chip on name plates and the HUD ring. */-export const FRAME_STYLE: Record<"frame_none" | Extract<RewardId, `frame_${string}`>, { ring: string; fill: string; ink: string }> = {- frame_none: { ring: "#94a3b8", fill: "#334155", ink: "#f8fafc" },- frame_bronze: { ring: "#d08a4f", fill: "#6b3b1c", ink: "#ffe8d3" },- frame_silver: { ring: "#d7dee8", fill: "#4b5563", ink: "#ffffff" },- frame_gold: { ring: "#ffd25e", fill: "#8a5a00", ink: "#fff7da" },- frame_diamond: { ring: "#9be8ff", fill: "#1d4e89", ink: "#ffffff" },-};--/**- * The colours of each effect in the diorama. The world keeps one palette in- * light and dark mode (office-map.md §2), so these are fixed, not tokens.- */-export const EFFECT_COLOURS: Record<Exclude<RewardId, `frame_${string}`>, readonly string[]> = {- trail_footprints: ["#ffe2a8"],- trail_sparkle: ["#fff1b8", "#ffd166"],- trail_comet: ["#7dd3fc", "#ffffff"],- trail_neon: ["#22d3ee", "#e879f9"],- trail_rainbow: ["#ff5e5e", "#ffb347", "#fff275", "#6ee7a0", "#5ec8ff", "#b18cff"],- trail_stardust: ["#c4b5fd", "#ffffff", "#93c5fd"],- aura_glow: ["#ffd98a"],- aura_runes: ["#7dd3fc"],- aura_storm: ["#a78bfa", "#e0f2fe"],- aura_legend: ["#ff8ad8", "#ffe36e", "#7af0ff"],- gadget_drone: ["#e2e8f0", "#38bdf8"],- gadget_halo: ["#ffe28a"],- gadget_crown: ["#ffcf40", "#e11d48"],- gadget_wings: ["#fbf8ef", "#f6dfa4"],-};diff --git a/jarvis/ui/web/frontend/src/components/society/progression/progression.css b/jarvis/ui/web/frontend/src/components/society/progression/progression.cssindex 5c96de2652..c1d24f78c8 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/progression.css+++ b/jarvis/ui/web/frontend/src/components/society/progression/progression.css@@ -1,9 +1,9 @@/** The Verse's level system. The level card, toasts and progress panel are* app chrome over the canvas: theme tokens only, so light and dark mode both- * read. The level chip, the "+XP" numbers, the world tag and the level-up- * banner belong to the game itself and keep one dark-and-gold look in both- * modes, like the name plates in the diorama.+ * read. The rank chip, the ring's medallion, the "+XP" numbers, the world+ * plate and the promotion card belong to the game itself and keep one+ * midnight-and-gold look in both modes, like the name plates in the diorama.*//* ---------- level card (HUD, top left) ---------- */@@ -21,11 +21,16 @@/* ---------- ring and bar ---------- */.level-ring { position:relative; display:inline-flex; flex:none; align-items:center; justify-content:center; }.level-ring svg { position:absolute; inset:0; }-.level-ring b { position:relative; font-size:15px; font-weight:800; font-variant-numeric:tabular-nums; }-.level-ring-track { fill:none; stroke:hsl(var(--border)); stroke-width:3.5; }-.level-ring-fill { fill:none; stroke-width:3.5; stroke-linecap:round; stroke:#f5b83d; transition:stroke-dasharray .7s cubic-bezier(.2,.8,.2,1); }+.level-ring-track { fill:none; stroke:hsl(var(--border)); stroke-width:3; }+.level-ring-fill { fill:none; stroke-width:3; stroke-linecap:round; stroke:#d9ab47; transition:stroke-dasharray .7s cubic-bezier(.2,.8,.2,1); }.level-ring[data-kind="pet"] .level-ring-fill { stroke:#2dd4bf; }.level-ring[data-kind="agent"] .level-ring-fill { stroke:#4ade80; }+.level-ring-medal { fill:#141b33; stroke:#c9a24a; stroke-width:1; }+.level-ring[data-tier="general"] .level-ring-medal { fill:#0d0e12; stroke:#e0b955; stroke-width:1.6; }+.level-ring-insignia { position:relative; filter:drop-shadow(0 1px 1px rgb(0 0 0 / .45)); }+.level-ring b { position:absolute; left:50%; bottom:-5px; transform:translateX(-50%); min-width:18px; padding:0 5px; border-radius:6px;+ background:#141b33; box-shadow:inset 0 0 0 1px #c9a24a; color:#f6e7bd; font-size:10px; line-height:14px; font-weight:800; text-align:center;+ font-variant-numeric:tabular-nums; }.level-bar { position:relative; display:block; height:6px; border-radius:999px; overflow:hidden; background:hsl(var(--muted)); }.level-bar i { position:absolute; left:0; top:0; bottom:0; border-radius:inherit; }.level-bar-gain { background:#fff1b8; box-shadow:0 0 8px #ffd25e; transition:width .15s ease-out; }@@ -35,8 +40,13 @@.level-bar[data-kind="agent"] .level-bar-fill { background:linear-gradient(90deg, #22c55e, #86efac); }.level-bar[data-kind="agent"] .level-bar-gain { background:#dcfce7; box-shadow:0 0 8px #86efac; }-/* ---------- level chip on name plates (in-world, one look) ---------- */-.level-chip { display:inline-flex; flex:none; align-items:center; justify-content:center; min-width:20px; height:18px; padding:0 4px; font-size:10px; font-weight:800; font-variant-numeric:tabular-nums; clip-path:polygon(18% 0, 82% 0, 100% 50%, 82% 100%, 18% 100%, 0 50%); }+/* ---------- rank chip on name plates (in-world, one look) ---------- */+.level-chip { display:inline-flex; flex:none; align-items:center; gap:3px; height:18px; padding:0 5px 0 3px; border-radius:5px; background:#141b33;+ box-shadow:inset 0 0 0 1px #b8913c; color:#f6e7bd; font-size:10px; font-variant-numeric:tabular-nums; }+.level-chip b { font-weight:800; }+.level-chip[data-tier="officer"] { box-shadow:inset 0 0 0 1px #d9dde3; }+.level-chip[data-tier="general"] { background:#0d0e12; box-shadow:inset 0 0 0 1.5px #e0b955; }+.level-chip-insignia { display:block; }.office-plate .level-chip { margin-left:1px; }/* ---------- agent toasts (bottom left) ---------- */@@ -47,52 +57,66 @@.level-toast em { font-style:normal; font-size:11px; color:hsl(var(--muted-foreground)); }@keyframes level-toast-in { from { opacity:0; transform:translateX(-24px) scale(.96); } to { opacity:1; transform:none; } }-/* ---------- world tag and "+XP" (in-world, one look) ---------- */-.level-burst-tag { display:inline-flex; align-items:center; gap:6px; padding:4px 12px 4px 10px; border-radius:999px; background:rgb(24 18 4 / .88); color:#fff3c4; box-shadow:0 0 0 2px #ffd25e, 0 0 22px rgb(255 210 94 / .65); font-weight:800; white-space:nowrap; pointer-events:none; animation-name:level-tag; animation-timing-function:ease-out; animation-fill-mode:both; }-.level-burst-tag small { font-size:10px; letter-spacing:.12em; text-transform:uppercase; }-.level-burst-tag b { font-size:18px; }-.level-burst-tag[data-kind="pet"] { color:#ccfbf1; box-shadow:0 0 0 2px #5eead4, 0 0 22px rgb(94 234 212 / .6); background:rgb(4 30 28 / .88); }-.level-burst-tag[data-kind="agent"] { color:#dcfce7; box-shadow:0 0 0 2px #86efac, 0 0 22px rgb(134 239 172 / .6); background:rgb(6 30 14 / .88); }-@keyframes level-tag { 0% { opacity:0; transform:translateY(20px) scale(.5); } 12% { opacity:1; transform:translateY(0) scale(1.15); } 20% { transform:scale(1); } 80% { opacity:1; transform:translateY(-24px); } 100% { opacity:0; transform:translateY(-40px); } }+/* ---------- world plate and "+XP" (in-world, one look) ---------- */+.promo-tag { display:inline-flex; align-items:center; gap:9px; padding:6px 14px 6px 8px; border-radius:8px; background:rgb(16 22 44 / .94);+ box-shadow:inset 0 0 0 1px #c9a24a, 0 8px 22px rgb(0 0 0 / .35); color:#f6e7bd; white-space:nowrap; pointer-events:none;+ animation-name:promo-tag; animation-timing-function:cubic-bezier(.2,.7,.2,1); animation-fill-mode:both; }+.promo-tag > span { display:flex; flex-direction:column; gap:1px; }+.promo-tag small { font-size:9.5px; font-weight:700; letter-spacing:.18em; text-transform:uppercase; color:#d9ab47; }+.promo-tag b { font-size:14px; font-weight:800; letter-spacing:.01em; }+@keyframes promo-tag { 0% { opacity:0; transform:translateY(14px); } 12% { opacity:1; transform:translateY(0); } 82% { opacity:1; transform:translateY(-8px); } 100% { opacity:0; transform:translateY(-14px); } }.level-xp-pop { display:inline-block; font-size:13px; font-weight:800; color:#ffe58a; text-shadow:0 1px 0 #6b4a00, 0 0 8px rgb(255 210 94 / .8); white-space:nowrap; pointer-events:none; animation:level-xp 1.6s ease-out both; }.level-xp-pop[data-kind="pet"] { color:#99f6e4; text-shadow:0 1px 0 #0f4f47, 0 0 8px rgb(94 234 212 / .8); }.level-xp-pop[data-kind="agent"] { color:#bbf7d0; text-shadow:0 1px 0 #14532d, 0 0 8px rgb(134 239 172 / .8); }@keyframes level-xp { 0% { opacity:0; transform:translateY(8px) scale(.7); } 15% { opacity:1; transform:translateY(0) scale(1.1); } 30% { transform:scale(1); } 100% { opacity:0; transform:translateY(-34px); } }-/* ---------- level-up banner (game overlay, one look) ---------- */-.level-banner-layer { position:absolute; inset:0; z-index:55; display:flex; align-items:center; justify-content:center; pointer-events:none; }-.level-banner { position:relative; pointer-events:auto; display:flex; flex-direction:column; align-items:center; gap:4px; min-width:300px; max-width:min(460px, calc(100% - 32px)); padding:26px 34px 22px; border:0; border-radius:22px; overflow:hidden; font:inherit; color:#fff7da; cursor:pointer;- background:radial-gradient(120% 90% at 50% 0%, rgb(84 58 6 / .96), rgb(20 14 2 / .96)); box-shadow:0 0 0 2px #ffd25e, 0 0 60px rgb(255 196 64 / .55), 0 24px 60px rgb(0 0 0 / .5); animation:level-banner-in .55s cubic-bezier(.2,1.5,.35,1) both; }-.level-banner[data-kind="pet"] { color:#e6fffb; background:radial-gradient(120% 90% at 50% 0%, rgb(8 74 66 / .96), rgb(2 20 18 / .96)); box-shadow:0 0 0 2px #5eead4, 0 0 60px rgb(45 212 191 / .5), 0 24px 60px rgb(0 0 0 / .5); }-.level-banner:focus-visible { outline:3px solid #fff; outline-offset:3px; }-.level-banner > * { position:relative; }-.level-banner-rays { position:absolute !important; inset:-60%; background:repeating-conic-gradient(from 0deg, rgb(255 226 140 / .16) 0 9deg, transparent 9deg 22deg); animation:level-rays 9s linear infinite; }-.level-banner[data-kind="pet"] .level-banner-rays { background:repeating-conic-gradient(from 0deg, rgb(153 246 228 / .16) 0 9deg, transparent 9deg 22deg); }-.level-banner-flash { position:absolute !important; inset:0; background:radial-gradient(circle at 50% 40%, rgb(255 255 255 / .9), transparent 60%); animation:level-flash .7s ease-out both; }-.level-banner-away { font-size:11px; font-weight:600; opacity:.8; }-.level-banner-kicker { font-size:15px; font-weight:900; letter-spacing:.32em; text-transform:uppercase; color:#ffd25e; text-shadow:0 0 14px rgb(255 210 94 / .8); animation:level-stamp .5s .1s cubic-bezier(.2,1.8,.4,1) both; }-.level-banner[data-kind="pet"] .level-banner-kicker { color:#5eead4; text-shadow:0 0 14px rgb(94 234 212 / .8); }-.level-banner-number { position:relative; display:grid; height:78px; overflow:hidden; font-size:72px; line-height:78px; font-weight:900; font-variant-numeric:tabular-nums; }-.level-banner-number > span { grid-area:1 / 1; text-align:center; }-.level-banner-old { animation:level-roll-out .45s .35s ease-in both; }-.level-banner-new { animation:level-roll-in .55s .45s cubic-bezier(.2,1.6,.4,1) both; text-shadow:0 0 24px rgb(255 226 140 / .9); }-.level-banner-who { font-size:15px; font-weight:700; }-.level-banner-title { margin-top:2px; padding:3px 12px; border-radius:999px; background:rgb(255 255 255 / .1); font-size:12px; font-weight:700; animation:level-rise .4s .8s ease-out both; }-.level-banner-rewards { display:flex; flex-direction:column; align-items:center; gap:6px; margin-top:12px; }-.level-banner-unlocked { font-size:10px; letter-spacing:.2em; text-transform:uppercase; opacity:.75; animation:level-rise .4s .85s ease-out both; }-.level-banner-reward { display:flex; align-items:center; gap:10px; min-width:220px; padding:6px 14px 6px 6px; border-radius:12px; background:rgb(255 255 255 / .1); box-shadow:inset 0 0 0 1px rgb(255 255 255 / .14); font-size:13px; font-weight:700; animation:level-rise .45s ease-out both; }-.level-banner-hint { margin-top:4px; font-size:11px; opacity:.7; animation:level-rise .4s 1.4s ease-out both; }-@keyframes level-banner-in { 0% { opacity:0; transform:scale(.4); } 60% { opacity:1; } 100% { transform:scale(1); } }-@keyframes level-rays { to { transform:rotate(360deg); } }-@keyframes level-flash { from { opacity:1; } to { opacity:0; } }-@keyframes level-stamp { 0% { opacity:0; transform:scale(2.4); } 100% { opacity:1; transform:scale(1); } }-@keyframes level-roll-out { to { opacity:0; transform:translateY(-80px); } }-@keyframes level-roll-in { 0% { opacity:0; transform:translateY(80px) scale(.6); } 100% { opacity:1; transform:none; } }-@keyframes level-rise { 0% { opacity:0; transform:translateY(14px); } 100% { opacity:1; transform:none; } }+/* ---------- promotion card (game overlay, one look) ---------- */+.level-banner-layer { position:absolute; inset:0; z-index:55; display:flex; align-items:center; justify-content:center; pointer-events:none; background:radial-gradient(60% 55% at 50% 50%, rgb(6 9 20 / .45), transparent 75%); }+.promo { position:relative; pointer-events:auto; display:flex; flex-direction:column; align-items:center; gap:2px; min-width:320px; max-width:min(440px, calc(100% - 32px));+ padding:26px 40px 24px; border:0; border-radius:14px; font:inherit; color:#f3ead2; cursor:pointer;+ background:linear-gradient(180deg, #1b2445 0%, #111833 60%, #0c1229 100%);+ box-shadow:0 0 0 1px #c9a24a, 0 30px 70px rgb(0 0 0 / .55); animation:promo-in .45s cubic-bezier(.2,.8,.2,1) both; }+.promo[data-tier="general"] { background:linear-gradient(180deg, #17181f 0%, #0d0e13 100%); box-shadow:0 0 0 1.5px #e0b955, 0 30px 70px rgb(0 0 0 / .6); }+.promo:focus-visible { outline:2px solid #f3ead2; outline-offset:4px; }+.promo-rule { position:absolute; inset:6px; border:1px solid rgb(201 162 74 / .55); border-radius:9px; pointer-events:none; }+.promo > :not(.promo-rule) { position:relative; }+.promo-away { font-size:11px; font-weight:600; color:#c9b88f; margin-bottom:4px; }+.promo-kicker { font-size:12px; font-weight:800; letter-spacing:.42em; padding-left:.42em; text-transform:uppercase; color:#d9ab47; animation:promo-kicker .6s .1s cubic-bezier(.2,.8,.2,1) both; }+.promo-who { font-size:13px; font-weight:600; color:#c9c2ad; animation:promo-rise .4s .2s ease-out both; }+.promo-stage { position:relative; display:flex; align-items:center; justify-content:center; height:138px; margin:10px 0 6px; }+.promo-new { display:flex; filter:drop-shadow(0 6px 14px rgb(0 0 0 / .5)); animation:promo-glint .9s 1.45s ease-out both; }+.promo:not([data-promoted]) .promo-new { animation:promo-rise .5s .25s ease-out both, promo-glint .9s .9s ease-out both; }+.promo-old { position:absolute; display:flex; animation:promo-old 1.1s .35s cubic-bezier(.4,0,.2,1) both; }+.promo-new .rank-part { animation:promo-part .32s calc(.75s + var(--i) * 70ms) cubic-bezier(.2,.9,.3,1.15) both; transform-box:fill-box; transform-origin:center; }+.promo-rank { font-size:24px; font-weight:800; letter-spacing:.01em; color:#fff6dc; text-align:center; animation:promo-rise .45s 1.15s ease-out both; }+.promo:not([data-promoted]) .promo-rank { animation-delay:.45s; }+.promo-grade { display:inline-flex; align-items:center; gap:8px; font-size:12px; font-weight:700; letter-spacing:.08em; color:#c9b88f; animation:promo-rise .45s 1.25s ease-out both; }+.promo:not([data-promoted]) .promo-grade { animation-delay:.55s; }+.promo-dot { width:3px; height:3px; border-radius:50%; background:#c9a24a; }+.promo-level { display:inline-flex; align-items:center; gap:4px; }+.promo-number { display:inline-grid; height:16px; overflow:hidden; font-variant-numeric:tabular-nums; color:#f3ead2; }+.promo-number > span { grid-area:1 / 1; text-align:center; }+.promo-number-old { animation:promo-roll-out .4s 1.5s ease-in both; }+.promo-number-new { animation:promo-roll-in .45s 1.6s cubic-bezier(.2,.9,.3,1.1) both; }+.promo:not([data-promoted]) .promo-number-old { animation-delay:.7s; }+.promo:not([data-promoted]) .promo-number-new { animation-delay:.8s; }+.promo-next { margin-top:8px; font-size:12px; color:#a9a28d; animation:promo-rise .4s 1s ease-out both; }+.promo-rewards { display:flex; flex-direction:column; align-items:stretch; gap:6px; width:100%; margin-top:16px; padding-top:14px; border-top:1px solid rgb(201 162 74 / .3); }+.promo-unlocked { font-size:10px; font-weight:700; letter-spacing:.24em; text-transform:uppercase; color:#d9ab47; text-align:center; animation:promo-rise .4s 1.6s ease-out both; }+.promo-reward { display:flex; align-items:center; gap:12px; padding:5px 12px 5px 5px; border-radius:10px; background:rgb(255 255 255 / .05); box-shadow:inset 0 0 0 1px rgb(201 162 74 / .25); font-size:13px; font-weight:700; text-align:left; animation:promo-rise .45s ease-out both; }+.promo-hint { margin-top:2px; font-size:11px; color:#a9a28d; text-align:center; animation:promo-rise .4s 2.1s ease-out both; }+@keyframes promo-in { 0% { opacity:0; transform:translateY(12px) scale(.97); } 100% { opacity:1; transform:none; } }+@keyframes promo-kicker { 0% { opacity:0; letter-spacing:.8em; } 100% { opacity:1; letter-spacing:.42em; } }+@keyframes promo-rise { 0% { opacity:0; transform:translateY(10px); } 100% { opacity:1; transform:none; } }+@keyframes promo-old { 0% { opacity:0; transform:scale(.9); } 20% { opacity:1; transform:none; } 55% { opacity:1; transform:none; } 100% { opacity:0; transform:translateX(-120px) scale(.7); } }+@keyframes promo-part { 0% { opacity:0; transform:translateY(-10px) scale(1.12); } 100% { opacity:1; transform:none; } }+@keyframes promo-glint { 0% { filter:drop-shadow(0 6px 14px rgb(0 0 0 / .5)) brightness(1); } 35% { filter:drop-shadow(0 6px 14px rgb(0 0 0 / .5)) drop-shadow(0 0 14px rgb(255 214 120 / .55)) brightness(1.35); } 100% { filter:drop-shadow(0 6px 14px rgb(0 0 0 / .5)) brightness(1); } }+@keyframes promo-roll-out { to { opacity:0; transform:translateY(-16px); } }+@keyframes promo-roll-in { 0% { opacity:0; transform:translateY(16px); } 100% { opacity:1; transform:none; } }/* ---------- reward icon ---------- */-.level-reward-icon { display:inline-flex; flex:none; align-items:center; justify-content:center; border-radius:8px; color:rgb(20 16 4 / .85); box-shadow:inset 0 0 0 1px rgb(255 255 255 / .35); }-.level-reward-icon[data-locked] { background:hsl(var(--muted)); color:hsl(var(--muted-foreground)); box-shadow:inset 0 0 0 1px hsl(var(--border)); }+.level-reward-icon { display:inline-flex; flex:none; align-items:center; justify-content:center; }+.level-reward-icon svg { display:block; }/* ---------- progress panel ---------- */.level-panel-layer { position:absolute; inset:0; z-index:50; display:flex; align-items:center; justify-content:center; padding:16px; background:rgb(0 0 0 / .25); }@@ -145,14 +169,12 @@@media (max-width:600px) {.level-hud { min-width:0; }.level-slot { grid-template-columns:1fr; }- .level-banner { padding:20px 18px 18px; }- .level-banner-number { font-size:56px; }+ .promo { min-width:0; padding:22px 20px 20px; }+ .promo-rank { font-size:20px; }}@media (prefers-reduced-motion: reduce) {- .level-banner, .level-banner-kicker, .level-banner-old, .level-banner-new, .level-banner-title, .level-banner-unlocked,- .level-banner-reward, .level-banner-hint, .level-toast, .level-burst-tag, .level-xp-pop { animation-duration:.01ms !important; animation-delay:0s !important; }- .level-banner-old { display:none; }- .level-banner-rays, .level-banner-flash { animation:none; opacity:.5; }+ .promo, .promo *, .level-toast, .promo-tag, .level-xp-pop { animation-duration:.01ms !important; animation-delay:0s !important; }+ .promo-old, .promo-number-old { display:none; }.level-bar i, .level-ring-fill { transition:none; }}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/progression.test.ts b/jarvis/ui/web/frontend/src/components/society/progression/progression.test.tsindex fa89ae8f4b..a49eb78f48 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/progression.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/progression/progression.test.ts@@ -2,43 +2,50 @@ import { beforeEach, describe, expect, it } from "vitest";import { equippedFor, levelFraction, progressFor, unlockedFor } from "./cosmetics";import { parseAwardEvent, parseSnapshot, type ProgressionSnapshot, type RewardRow } from "./progressionApi";import { awayCelebrations, useProgression } from "./progressionStore";-import { footprintAt, pruneSamples, pushSample, rainbowHue, RIBBON_MAX_SAMPLES, writeRibbon, type TrailSample } from "./effects/trailModel";-import { REWARD_IDS, slotOf } from "./levelCatalog";+import { RANK_INFO, rankAt, REWARD_IDS, slotOf, TITLE_IDS } from "./levelCatalog";+import { rankArt } from "./insignia/rankArt";+import { rackRows, ribbonsFor } from "./regalia/decorations3d";+import { dressedLook, regaliaFor, uniformStyle } from "./regalia/dress";+import type { ToyLook } from "../office/toyFigureModel";const REWARDS: RewardRow[] = [- { rewardId: "frame_bronze", slot: "frame", levels: { person: 3, agent: 3, pet: 3 } },- { rewardId: "frame_silver", slot: "frame", levels: { person: 10, agent: 10, pet: 10 } },- { rewardId: "trail_footprints", slot: "trail", levels: { person: 2, agent: null, pet: null } },- { rewardId: "trail_sparkle", slot: "trail", levels: { person: 5, agent: 5, pet: 2 } },- { rewardId: "aura_glow", slot: "aura", levels: { person: 7, agent: 8, pet: 5 } },+ { rewardId: "decoration_ribbon_bar", slot: "decoration", levels: { person: 3, agent: 3, pet: null } },+ { rewardId: "decoration_ribbon_rack", slot: "decoration", levels: { person: 10, agent: 10, pet: null } },+ { rewardId: "uniform_service_shirt", slot: "uniform", levels: { person: 2, agent: null, pet: null } },+ { rewardId: "uniform_field_jacket", slot: "uniform", levels: { person: 5, agent: null, pet: null } },+ { rewardId: "headwear_patrol_cap", slot: "headwear", levels: { person: 7, agent: null, pet: null } },];+const BANDS = [{ level: 1, title: "private" }, { level: 2, title: "private_second_class" }, { level: 4, title: "private_first_class" }];+/** Total XP at which each level starts, the server's `level_xp` for the first few levels. */const CURVE = [0, 40, 105, 195, 310, 450];function snapshot(overrides: Partial<ProgressionSnapshot> = {}): ProgressionSnapshot {return {subjects: [], petId: "ember", recent: [], latestSeq: 0, maxLevel: 50, levelXp: CURVE, rules: [], rewards: REWARDS,- titles: { person: [{ level: 1, title: "newcomer" }, { level: 5, title: "apprentice" }], agent: [], pet: [] },+ titles: { person: BANDS, agent: BANDS, pet: BANDS },...overrides,};}describe("cosmetics", () => {it("unlocks by the subject kind's own level", () => {- expect(unlockedFor(REWARDS, "person", 2).map((r) => r.rewardId)).toEqual(["trail_footprints"]);- expect(unlockedFor(REWARDS, "pet", 2).map((r) => r.rewardId)).toEqual(["trail_sparkle"]);- expect(unlockedFor(REWARDS, "agent", 4).map((r) => r.rewardId)).toEqual(["frame_bronze"]);+ expect(unlockedFor(REWARDS, "person", 2).map((r) => r.rewardId)).toEqual(["uniform_service_shirt"]);+ expect(unlockedFor(REWARDS, "pet", 50)).toEqual([]);+ expect(unlockedFor(REWARDS, "agent", 4).map((r) => r.rewardId)).toEqual(["decoration_ribbon_bar"]);});it("wears the latest unlock per slot unless the person chose", () => {- expect(equippedFor(REWARDS, "person", 7)).toEqual({ frame: "frame_bronze", trail: "trail_sparkle", aura: "aura_glow" });- expect(equippedFor(REWARDS, "person", 7, { trail: "trail_footprints", aura: "none" }))- .toEqual({ frame: "frame_bronze", trail: "trail_footprints" });+ expect(equippedFor(REWARDS, "person", 7))+ .toEqual({ decoration: "decoration_ribbon_bar", uniform: "uniform_field_jacket", headwear: "headwear_patrol_cap" });+ expect(equippedFor(REWARDS, "person", 7, { uniform: "uniform_service_shirt", headwear: "none" }))+ .toEqual({ decoration: "decoration_ribbon_bar", uniform: "uniform_service_shirt" });});it("ignores a chosen piece that is not unlocked (any more)", () => {- expect(equippedFor(REWARDS, "person", 4, { frame: "frame_silver" })).toEqual({ frame: "frame_bronze", trail: "trail_footprints" });+ expect(equippedFor(REWARDS, "person", 4, { decoration: "decoration_ribbon_rack" }))+ .toEqual({ decoration: "decoration_ribbon_bar", uniform: "uniform_service_shirt" });});it("measures progress inside a level from the server's curve", () => {@@ -56,19 +63,19 @@ describe("progressionApi", () => {subjects: [{ subject_id: "person", kind: "person", xp: 50, level: 2, xp_into_level: 10, xp_for_next: 65, title: "newcomer" }],pet_id: "miso", recent: [], latest_seq: 7, max_level: 50, level_xp: [0, 40],rules: [{ source: "chat_turn", kind: "person", xp: 5, trigger: "server", cooldown_s: 0, daily_cap: 100 }],- rewards: [{ reward_id: "aura_glow", slot: "aura", levels: { person: 7, agent: 8, pet: null } }, { reward_id: "hat_tall", slot: "gadget", levels: {} }],+ rewards: [{ reward_id: "headwear_beret", slot: "headwear", levels: { person: 24, agent: null, pet: null } }, { reward_id: "trail_rainbow", slot: "trail", levels: {} }],titles: { person: [{ level: 1, title: "newcomer" }] },});expect(parsed.subjects[0]).toMatchObject({ subjectId: "person", level: 2, xpIntoLevel: 10, xpForNext: 65 });expect(parsed.petId).toBe("miso");- expect(parsed.rewards.map((r) => r.rewardId)).toEqual(["aura_glow"]);+ expect(parsed.rewards.map((r) => r.rewardId)).toEqual(["headwear_beret"]);expect(parsed.rewards[0].levels.pet).toBeNull();expect(parsed.rules[0]).toMatchObject({ source: "chat_turn", dailyCap: 100 });});it("parses an award push and refuses one without a subject", () => {- expect(parseAwardEvent({ subject_id: "agent:scout", subject_kind: "agent", xp: 40, total_xp: 108, level: 3, previous_level: 2, unlocked: ["frame_bronze", "nope"] }))- .toMatchObject({ subjectId: "agent:scout", kind: "agent", level: 3, unlocked: ["frame_bronze"] });+ expect(parseAwardEvent({ subject_id: "agent:scout", subject_kind: "agent", xp: 40, total_xp: 108, level: 3, previous_level: 2, unlocked: ["decoration_ribbon_bar", "gadget_crown"] }))+ .toMatchObject({ subjectId: "agent:scout", kind: "agent", level: 3, unlocked: ["decoration_ribbon_bar"] });expect(parseAwardEvent({ xp: 5 })).toBeNull();expect(parseAwardEvent(null)).toBeNull();});@@ -90,12 +97,14 @@ describe("progressionStore", () => {});it("celebrates the person with a banner, a burst and a cheer; an agent with a toast", () => {- useProgression.getState().apply({ seq: 2, subjectId: "person", kind: "person", source: "agent_hired", xp: 50, totalXp: 50, level: 2, previousLevel: 1, title: "newcomer", unlocked: ["trail_footprints"] }, 1000);+ useProgression.getState().apply({ seq: 2, subjectId: "person", kind: "person", source: "agent_hired", xp: 50, totalXp: 50, level: 2, previousLevel: 1, title: "newcomer", unlocked: ["uniform_service_shirt"] }, 1000);useProgression.getState().apply({ seq: 3, subjectId: "agent:scout", kind: "agent", source: "task_done", xp: 40, totalXp: 40, level: 2, previousLevel: 1, title: "rookie", unlocked: [] }, 1000);const s = useProgression.getState();expect(s.banners.map((b) => b.subjectId)).toEqual(["person"]);expect(s.toasts.map((b) => b.subjectId)).toEqual(["agent:scout"]);expect(s.bursts).toHaveLength(2);+ // The burst carries the climb, so the world can tell a promotion from a level.+ expect(s.bursts[0]).toMatchObject({ level: 2, previousLevel: 1, title: "newcomer" });expect(s.cheerUntil).toBeGreaterThan(1000);});@@ -130,52 +139,89 @@ describe("progressionStore", () => {});const away = awayCelebrations(missed, 2);expect(away).toHaveLength(1);- expect(away[0]).toMatchObject({ subjectId: "agent:scout", level: 4, previousLevel: 1, away: true, unlocked: ["frame_bronze"] });+ expect(away[0]).toMatchObject({ subjectId: "agent:scout", level: 4, previousLevel: 1, away: true, unlocked: ["decoration_ribbon_bar"] });expect(awayCelebrations(missed, null)).toEqual([]);expect(awayCelebrations(missed, 4)).toEqual([]);});});-describe("trail model", () => {- it("samples a ribbon by distance, caps it and restarts after a teleport", () => {- const samples: TrailSample[] = [];- expect(pushSample(samples, 0, 0, 0)).toBe(true);- expect(pushSample(samples, 0.05, 0, 0.1)).toBe(false);- for (let i = 1; i <= 40; i++) pushSample(samples, i * 0.2, 0, i);- expect(samples).toHaveLength(RIBBON_MAX_SAMPLES);- pushSample(samples, 100, 100, 50);- expect(samples).toHaveLength(1);- });-- it("ages samples out", () => {- const samples: TrailSample[] = [{ x: 0, z: 0, t: 0 }, { x: 1, z: 0, t: 1 }];- pruneSamples(samples, 1.5, 1);- expect(samples).toEqual([{ x: 1, z: 0, t: 1 }]);- });-- it("writes a strip that is widest and brightest at the head", () => {- const samples: TrailSample[] = [{ x: 0, z: 0, t: 1 }, { x: 0, z: 1, t: 1 }, { x: 0, z: 2, t: 1 }];- const positions = new Float32Array(samples.length * 6);- const bright = writeRibbon(samples, 1, 1, 0.4, 0.02, positions);- expect(bright[0]).toBe(0);- expect(bright[2]).toBe(1);- const width = (i: number) => Math.hypot(positions[i * 6] - positions[i * 6 + 3], positions[i * 6 + 2] - positions[i * 6 + 5]);- expect(width(2)).toBeCloseTo(0.4);- expect(width(0)).toBeCloseTo(0);- expect(positions[1]).toBeCloseTo(0.02);- });-- it("places footprints left and right of the heading", () => {- const left = footprintAt(0, 0, 0, true);- const right = footprintAt(0, 0, 0, false);- expect(left.x).toBeGreaterThan(0);- expect(right.x).toBeLessThan(0);- expect(rainbowHue(0.5, 0)).toBeGreaterThanOrEqual(0);+describe("rank insignia", () => {+ it("climbs from no insignia to five stars, sleeve first, shoulder for officers", () => {+ expect(rankArt("private").parts).toEqual([]);+ expect(rankArt("private").mount).toBe("none");+ expect(rankArt("sergeant").mount).toBe("sleeve");+ expect(rankArt("second_lieutenant").mount).toBe("shoulder");+ expect(rankArt("general_of_the_army").mount).toBe("shoulder");+ // Chevrons and rockers count up: one chevron, then three, then three with three rockers.+ const gold = (rank: Parameters<typeof rankArt>[0]) => rankArt(rank).parts.filter((p) => p.finish === "gold" && !p.detail).length;+ expect(gold("private_second_class")).toBe(1);+ expect(gold("sergeant")).toBe(3);+ expect(gold("master_sergeant")).toBe(6);+ expect(gold("first_sergeant")).toBe(7);+ // Generals: one star per grade, five at the cap.+ expect(rankArt("brigadier_general").parts).toHaveLength(1);+ expect(rankArt("general").parts).toHaveLength(4);+ expect(rankArt("general_of_the_army").parts).toHaveLength(5);+ });++ it("draws every polygon inside its own box", () => {+ for (const rank of TITLE_IDS) {+ const art = rankArt(rank);+ for (const part of art.parts) {+ for (const [x, y] of part.pts) {+ expect(x).toBeGreaterThanOrEqual(-1);+ expect(x).toBeLessThanOrEqual(art.w + 1);+ expect(y).toBeGreaterThanOrEqual(-1);+ expect(y).toBeLessThanOrEqual(art.h + 1);+ }+ }+ }+ });++ it("reads the rank off the server's bands, private before any arrive", () => {+ expect(rankAt(BANDS, 3)).toBe("private_second_class");+ expect(rankAt(BANDS, 50)).toBe("private_first_class");+ expect(rankAt(undefined, 30)).toBe("private");+ expect(RANK_INFO.colonel).toEqual({ grade: "O-6", tier: "officer" });+ });+});++describe("regalia", () => {+ const look = { skin: "#f1c4a0", hair: "#2a1d15", hairStyle: "short", shirt: "#3f7fd6", shirtAccent: "#e5674f", inner: "#ffffff",+ pants: "#2f4a7a", shoes: "#f4f4f2", blush: false, outfit: "hoodie", eyewear: "none" } as ToyLook;++ it("dresses the figure in the uniform's colours and keeps its own face", () => {+ expect(dressedLook(look, undefined, "sergeant")).toBe(look);+ const blues = dressedLook(look, "uniform_dress_blues", "captain");+ expect(blues).toMatchObject({ skin: look.skin, hair: look.hair, shirt: "#1c2541", outfit: "suit" });+ // Officers wear gold braid on the cuffs; a private's blues have no trouser stripe.+ expect(blues.uniform?.cuffBraid).toBeTruthy();+ expect(uniformStyle("uniform_dress_blues", "private").stripe).toBeUndefined();+ expect(uniformStyle("uniform_mess_dress", "private").tieKind).toBe("bow");+ });++ it("wears enlisted rank on the sleeves, officer rank on the shoulders, and nothing else unworn", () => {+ expect(regaliaFor("sergeant", {})).toMatchObject({ shoulder: undefined, chest: undefined, hat: undefined });+ expect(regaliaFor("sergeant", {}).sleeve).toBeTruthy();+ expect(regaliaFor("colonel", {}).sleeve).toBeUndefined();+ expect(regaliaFor("colonel", {}).shoulder).toBeTruthy();+ expect(regaliaFor("private", {}).sleeve).toBeUndefined();+ const full = regaliaFor("major", { headwear: "headwear_service_cap", decoration: "decoration_medals" });+ expect(full.hat).toBeTruthy();+ expect(full.chest).toBeTruthy();+ });++ it("grows the ribbon rack with the decoration, rows of three", () => {+ expect(ribbonsFor("decoration_ribbon_bar")).toHaveLength(3);+ expect(ribbonsFor("decoration_ribbon_rack")).toHaveLength(9);+ expect(ribbonsFor("decoration_medals")).toHaveLength(5);+ expect(rackRows(9)).toEqual([3, 3, 3]);+ expect(rackRows(5)).toEqual([2, 3]);});});describe("level catalog", () => {it("names every reward after its slot", () => {- for (const id of REWARD_IDS) expect(["frame", "trail", "aura", "gadget"]).toContain(slotOf(id));+ for (const id of REWARD_IDS) expect(["uniform", "headwear", "decoration"]).toContain(slotOf(id));});});diff --git a/jarvis/ui/web/frontend/src/components/society/progression/progressionStore.ts b/jarvis/ui/web/frontend/src/components/society/progression/progressionStore.tsindex dab111f123..58fc80b5c5 100644--- a/jarvis/ui/web/frontend/src/components/society/progression/progressionStore.ts+++ b/jarvis/ui/web/frontend/src/components/society/progression/progressionStore.ts@@ -3,8 +3,8 @@** The first read hydrates it; every `ProgressionAwarded` push applies one* award, queues a floating "+XP" over whoever earned it and, on a level-up,- * a celebration: the big banner for the person and their pet, a toast for an- * agent, and a burst of light in the world for all three.+ * a celebration: the promotion card for the person and their pet, a toast for+ * an agent, and the moment in the world for all three.*/import { create } from "zustand";import type { AwardEvent, ProgressionSnapshot, SubjectLevel } from "./progressionApi";@@ -25,23 +25,25 @@ export interface Celebration {}export interface XpPopup { id: number; subjectId: string; xp: number; bornMs: number }-export interface Burst { id: number; subjectId: string; kind: SubjectKind; level: number; bornMs: number }+/** A level-up shown in the world; `title` is the rank held after it, `previousLevel` tells a promotion from a level. */+export interface Burst { id: number; subjectId: string; kind: SubjectKind; level: number; previousLevel: number; title: string; bornMs: number }/** How long a floating "+XP" and a level-up burst live, in ms. */export const POPUP_MS = 1600;-export const BURST_MS = 2600;+export const BURST_MS = 3200;/** How long the person's figure cheers after their own level-up. */export const CHEER_MS = 2200;const MAX_POPUPS = 12;const MAX_TOASTS = 4;/**- * The Level Hall screen's pages: where you stand, the Upgrade Studio (what you- * and your pet wear, with a live preview), the reward road, how XP is earned,- * and the team ranking. The hall's checkpoints, the level card and `L` open it.+ * The Level Hall screen's pages: where you stand, the rank ladder, the studio+ * (the uniform you wear, with a live preview), the promotion road, how XP is+ * earned, and the team ranking. The hall's checkpoints, the level card and+ * `L` open it.*/-export type HallTab = "overview" | "studio" | "rewards" | "guide" | "team";-export const HALL_TABS: readonly HallTab[] = ["overview", "studio", "rewards", "guide", "team"];+export type HallTab = "overview" | "ranks" | "studio" | "rewards" | "guide" | "team";+export const HALL_TABS: readonly HallTab[] = ["overview", "ranks", "studio", "rewards", "guide", "team"];/** Whose level the screen shows: the person's own, or their pet's (the pet IS Jarvis in the Verse). */export type HallSubject = "person" | "pet";@@ -120,7 +122,7 @@ export const useProgression = create<ProgressionState>((set, get) => ({const popups = [...s.popups, { id: nextId++, subjectId: award.subjectId, xp: award.xp, bornMs: nowMs }].slice(-MAX_POPUPS);if (award.level <= award.previousLevel) return { subjects: { ...s.subjects, [award.subjectId]: subject }, popups };const party = celebrationOf(award);- const bursts = [...s.bursts, { id: nextId++, subjectId: award.subjectId, kind: award.kind, level: award.level, bornMs: nowMs }];+ const bursts = [...s.bursts, { id: nextId++, subjectId: award.subjectId, kind: award.kind, level: award.level, previousLevel: award.previousLevel, title: award.title, bornMs: nowMs }];return {subjects: { ...s.subjects, [award.subjectId]: subject },popups,diff --git a/jarvis/ui/web/frontend/src/components/society/progression/regalia/decorations3d.tsx b/jarvis/ui/web/frontend/src/components/society/progression/regalia/decorations3d.tsxnew file mode 100644index 0000000000..d71b5053be--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/progression/regalia/decorations3d.tsx@@ -0,0 +1,173 @@+/**+ * Decorations in 3D: the ribbon rack over the left breast, full-size medals+ * on their drapes, and the gold aiguillette from the right shoulder. Each+ * piece is built round its own anchor so the same component sits on a+ * figure's chest and on the velvet board of a display case.+ *+ * - Ribbons and medals: origin at the centre of the rack, lying in the x/y+ * plane, facing +z.+ * - Aiguillette: origin where it hangs from the shoulder; its loops fall in+ * the x/y plane towards +x (the chest's centre when worn on the right).+ */+import { useMemo } from "react";+import { ExtrudeGeometry, MeshStandardMaterial, Shape, Vector2 } from "three";+import { cachedCanvasTexture } from "../../office/canvasMaterials";+import type { RewardId } from "../levelCatalog";+import { ellipse, star, type Pt } from "../insignia/rankArt";+import { MEDAL_COUNT, MEDAL_METALS, paintRibbon, RIBBONS, type RibbonSpec } from "./ribbons";+import { REGALIA_MATERIALS } from "./insignia3d";++/** A ribbon bar's size in metres (a real one is 35 × 10 mm; the toy wears it larger). */+export const RIBBON = { w: 0.03, h: 0.0095, gap: 0.0008 };++const ribbonMaterials = new Map<string, MeshStandardMaterial>();+function ribbonMaterial(spec: RibbonSpec): MeshStandardMaterial {+ let material = ribbonMaterials.get(spec.id);+ if (!material) {+ const map = cachedCanvasTexture(`ribbon:${spec.id}`, 128, 40, (ctx, w, h) => paintRibbon(ctx, spec, w, h));+ material = new MeshStandardMaterial({ map, color: map ? "#ffffff" : spec.stripes[0][0], roughness: 0.55 });+ ribbonMaterials.set(spec.id, material);+ }+ return material;+}++/** Which ribbons a decoration wears, in rack order (highest first). */+export function ribbonsFor(decoration: RewardId): RibbonSpec[] {+ if (decoration === "decoration_ribbon_bar") return [RIBBONS[4], RIBBONS[5], RIBBONS[6]];+ if (decoration === "decoration_medals") return RIBBONS.slice(0, MEDAL_COUNT);+ return [...RIBBONS];+}++/** Rows of three, the short row on top and centred, the way a rack is mounted. */+export function rackRows(count: number): number[] {+ const rows: number[] = [];+ let left = count;+ while (left > 0) { const n = left % 3 || 3; rows.push(n); left -= n; }+ return rows;+}++export function RibbonRack({ ribbons }: { ribbons: readonly RibbonSpec[] }) {+ const rows = rackRows(ribbons.length);+ const { w, h, gap } = RIBBON;+ const height = rows.length * (h + gap);+ let index = 0;+ return (+ <group>+ {rows.map((n, row) => {+ const y = height / 2 - (row + 0.5) * (h + gap);+ return Array.from({ length: n }, (_, i) => {+ const spec = ribbons[index++];+ const x = (i - (n - 1) / 2) * (w + gap);+ return (+ <mesh key={spec.id} material={ribbonMaterial(spec)} position={[x, y, 0.0025]}>+ <boxGeometry args={[w, h, 0.005]} />+ </mesh>+ );+ });+ })}+ </group>+ );+}++function shape(pts: readonly Pt[], s: number): Shape {+ return new Shape(pts.map(([x, y]) => new Vector2((x - 50) * s, (50 - y) * s)));+}++const medalGeometry = new Map<string, ExtrudeGeometry>();+function medalShape(kind: RibbonSpec["medal"]["shape"], size: number): ExtrudeGeometry {+ const key = `${kind}:${size}`;+ let geometry = medalGeometry.get(key);+ if (!geometry) {+ const s = size / 100;+ const outline = kind === "star" ? star(50, 52, 50) : kind === "cross"+ ? [[38, 4], [62, 4], [58, 38], [96, 38], [96, 62], [58, 62], [62, 96], [38, 96], [42, 62], [4, 62], [4, 38], [42, 38]] as Pt[]+ : ellipse(50, 50, 48, 48, 32);+ geometry = new ExtrudeGeometry(shape(outline, s), { depth: size * 0.06, bevelEnabled: true, bevelThickness: size * 0.03, bevelSize: size * 0.03, bevelSegments: 2 });+ geometry.computeVertexNormals();+ medalGeometry.set(key, geometry);+ }+ return geometry;+}++const medalMaterials = new Map<string, MeshStandardMaterial>();+function medalMaterial(metal: RibbonSpec["medal"]["metal"]): MeshStandardMaterial {+ let material = medalMaterials.get(metal);+ if (!material) {+ const tone = MEDAL_METALS[metal];+ material = new MeshStandardMaterial({ color: tone.face, metalness: 0.65, roughness: 0.3, emissive: tone.edge, emissiveIntensity: 0.25 });+ medalMaterials.set(metal, material);+ }+ return material;+}++/** Full-size medals in a row: each on its own short drape of ribbon, slightly overlapping like a court mount. */+export function MedalRow({ ribbons }: { ribbons: readonly RibbonSpec[] }) {+ const step = 0.019, drape = 0.024, size = 0.02;+ return (+ <group>+ {ribbons.map((spec, i) => {+ const x = (i - (ribbons.length - 1) / 2) * step;+ return (+ <group key={spec.id} position={[x, 0, 0.003 + i * 0.0006]}>+ <mesh material={ribbonMaterial(spec)} position={[0, -drape / 2, 0]}>+ <boxGeometry args={[step * 0.95, drape, 0.003]} />+ </mesh>+ <mesh geometry={medalShape(spec.medal.shape, size)} material={medalMaterial(spec.medal.metal)} position={[0, -drape - size * 0.42, 0.001]} castShadow />+ </group>+ );+ })}+ {/* The brass bar the drapes hang from. */}+ <mesh material={REGALIA_MATERIALS.gold} position={[0, 0.002, 0.004]}>+ <boxGeometry args={[step * ribbons.length + 0.004, 0.004, 0.004]} />+ </mesh>+ </group>+ );+}++/** Height of a decoration on the chest, so the anchor can sit it above a pocket. */+export function decorationSize(decoration: RewardId): { w: number; h: number } {+ if (decoration === "decoration_medals") return { w: 0.019 * MEDAL_COUNT, h: 0.024 + 0.02 };+ const rows = rackRows(ribbonsFor(decoration).length).length;+ return { w: 3 * (RIBBON.w + RIBBON.gap), h: rows * (RIBBON.h + RIBBON.gap) };+}++/** The decoration over the left breast: a rack, or the medals. Origin: the top centre of the piece. */+export function BreastDecoration({ decoration }: { decoration: RewardId }) {+ const ribbons = useMemo(() => ribbonsFor(decoration), [decoration]);+ if (decoration === "decoration_medals") return <MedalRow ribbons={ribbons} />;+ const { h } = decorationSize(decoration);+ return <group position={[0, -h / 2, 0]}><RibbonRack ribbons={ribbons} /></group>;+}++/**+ * The aiguillette: braided gold cords looping from the shoulder across the+ * chest, two of them ending in pointed metal tips.+ */+export function Aiguillette({ span = 0.11 }: { span?: number }) {+ const loops = [0.05, 0.075, 0.1];+ return (+ <group>+ {loops.map((sag, i) => (+ <mesh key={i} material={REGALIA_MATERIALS.braid} position={[span / 2, 0, i * 0.003]} rotation={[0, 0, Math.PI]} scale={[1, sag / (span / 2), 1]}>+ <torusGeometry args={[span / 2, 0.0042, 6, 28, Math.PI]} />+ </mesh>+ ))}+ {[0.32, 0.55].map((k, i) => {+ const x = span * k, top = -0.02, length = 0.07 + i * 0.015;+ return (+ <group key={k} position={[x, top, 0.008]}>+ <mesh material={REGALIA_MATERIALS.braid} position={[0, -length / 2, 0]}>+ <cylinderGeometry args={[0.0038, 0.0038, length, 6]} />+ </mesh>+ <mesh material={REGALIA_MATERIALS.gold} position={[0, -length - 0.008, 0]} rotation={[Math.PI, 0, 0]}>+ <coneGeometry args={[0.0055, 0.018, 10]} />+ </mesh>+ </group>+ );+ })}+ <mesh material={REGALIA_MATERIALS.gold} position={[span, 0, 0.004]}>+ <sphereGeometry args={[0.006, 10, 8]} />+ </mesh>+ </group>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/regalia/dress.tsx b/jarvis/ui/web/frontend/src/components/society/progression/regalia/dress.tsxnew file mode 100644index 0000000000..c61d0b5379--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/progression/regalia/dress.tsx@@ -0,0 +1,97 @@+/**+ * How a figure is dressed for its rank and loadout: the uniform it wears over+ * its own look, the insignia on its sleeves or shoulders, the decoration on+ * its chest and the hat on its head. The figure in the office, the studio+ * preview and the mannequins in the hall's display cases all dress through+ * here, so every surface shows the same pieces.+ */+import { useMemo } from "react";+import type { FigureRegalia } from "../../office/ToyFigure";+import { TOY, type ToyLook, type UniformStyle } from "../../office/toyFigureModel";+import { equippedFor, type Loadout } from "../cosmetics";+import { RANK_INFO, rankAt, type RankId, type RewardId } from "../levelCatalog";+import { rankArt } from "../insignia/rankArt";+import { useProgression } from "../progressionStore";+import { Aiguillette, BreastDecoration } from "./decorations3d";+import { Headwear, type HeadwearId } from "./headwear3d";+import { ShoulderBoard, SleevePatch } from "./insignia3d";++export type UniformId = Extract<RewardId, `uniform_${string}`>;++const GOLD = "#d2a33f";++/** Each uniform as the figure draws it; `officer` and `nco` add the trims those grades wear. */+export function uniformStyle(id: UniformId, rank: RankId): UniformStyle {+ const tier = RANK_INFO[rank].tier;+ const officer = tier === "officer" || tier === "general";+ const nco = tier !== "enlisted";+ switch (id) {+ case "uniform_service_shirt":+ return { cut: "shirt", coat: "#c8b38c", shirt: "#c8b38c", tie: "#433a28", tieKind: "long", trousers: "#8d7a6b", shoes: "#4b311d",+ buttons: "#7a6a4a", pockets: 2, belt: "#2f2418" };+ case "uniform_field_jacket":+ return { cut: "field", coat: "#5a613f", shirt: "#5a613f", tie: "#5a613f", tieKind: "long", trousers: "#5d6248", shoes: "#3b2f24",+ buttons: "#2b2b25", pockets: 4, tapes: "#2c3023" };+ case "uniform_service_greens":+ return { cut: "service", coat: "#3d4632", shirt: "#cbb892", tie: "#39331f", tieKind: "long", trousers: "#a08a7b", shoes: "#4a2e1a",+ buttons: "#c9a24a", pockets: 4, belt: "#3d4632" };+ case "uniform_dress_blues":+ return { cut: "service", coat: "#1c2541", shirt: "#f3f3ef", tie: "#121317", tieKind: "long", trousers: "#4a6a9e", shoes: "#0e0e10",+ buttons: "#d4a845", pockets: 4, stripe: nco ? GOLD : undefined, cuffBraid: officer ? GOLD : undefined };+ case "uniform_mess_dress":+ default:+ return { cut: "mess", coat: "#151e37", shirt: "#f7f7f3", tie: "#0f1013", tieKind: "bow", trousers: "#151e37", shoes: "#0e0e10",+ buttons: "#d4a845", pockets: 0, stripe: GOLD, cuffBraid: GOLD, lapels: "#22305a" };+ }+}++/** The look a figure shows with a uniform on: the uniform's colours over its own skin, hair and face. */+export function dressedLook(look: ToyLook, uniform: UniformId | undefined, rank: RankId): ToyLook {+ if (!uniform) return look;+ const u = uniformStyle(uniform, rank);+ return { ...look, outfit: "suit", shirt: u.coat, inner: u.shirt, shirtAccent: u.tie, pants: u.trousers, shoes: u.shoes, uniform: u };+}++/** Where the breast decoration hangs: over the left pocket, its top just under the shoulder line. */+const BREAST = { x: 0.075, y: 0.207, z: TOY.torso.d / 2 + 0.002 };+/** Where the aiguillette hangs from: the front of the right shoulder. */+const CORD = { x: -0.168, y: 0.252, z: TOY.torso.d / 2 - 0.012 };++/** The pieces a figure of `rank` wears with `loadout`; empty slots stay undefined. */+export function regaliaFor(rank: RankId, loadout: Loadout): FigureRegalia {+ const mount = rankArt(rank).mount;+ const decoration = loadout.decoration;+ const corded = decoration === "decoration_aiguillette" || decoration === "decoration_medals";+ return {+ sleeve: mount === "sleeve" ? <SleevePatch rank={rank} armRadius={TOY.armRadius} /> : undefined,+ shoulder: mount === "shoulder" ? <ShoulderBoard rank={rank} /> : undefined,+ chest: decoration ? (+ <>+ <group position={[BREAST.x, BREAST.y, BREAST.z]}><BreastDecoration decoration={decoration} /></group>+ {corded && <group position={[CORD.x, CORD.y, CORD.z]}><Aiguillette /></group>}+ </>+ ) : undefined,+ hat: loadout.headwear ? <Headwear kind={loadout.headwear as HeadwearId} rank={rank} /> : undefined,+ };+}++/** A figure's rank and loadout from the store: the person's own choices, an agent's best unlocks. */+export function useDress(kind: "person" | "agent", subjectId: string): { rank: RankId; loadout: Loadout } {+ const level = useProgression((s) => s.subjects[subjectId]?.level ?? 1);+ const rewards = useProgression((s) => s.snapshot?.rewards);+ const bands = useProgression((s) => s.snapshot?.titles[kind]);+ const choices = useProgression((s) => (kind === "person" ? s.choices.person : undefined));+ return useMemo(() => ({+ rank: rankAt(bands, level),+ loadout: rewards ? equippedFor(rewards, kind, level, choices) : {},+ }), [bands, level, rewards, kind, choices]);+}++/** The look and regalia a figure renders with, from its rank and loadout. */+export function useDressedFigure(kind: "person" | "agent", subjectId: string, look: ToyLook): { look: ToyLook; regalia: FigureRegalia } {+ const { rank, loadout } = useDress(kind, subjectId);+ return useMemo(() => ({+ look: dressedLook(look, loadout.uniform as UniformId | undefined, rank),+ regalia: regaliaFor(rank, loadout),+ }), [look, loadout, rank]);+}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/regalia/headwear3d.tsx b/jarvis/ui/web/frontend/src/components/society/progression/regalia/headwear3d.tsxnew file mode 100644index 0000000000..bd4c925a31--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/progression/regalia/headwear3d.tsx@@ -0,0 +1,175 @@+/**+ * Military headwear for the toy figure, built in its head group's space+ * (head centre `TOY.head.y` above the neck pivot, the face towards +z):+ *+ * - patrol cap: a soft flat-topped field cap with a short bill and the rank+ * sewn on the front;+ * - garrison cap: the folded side cap in Army blue with gold piping, worn+ * tilted to the right, the rank pinned at the left front (a unit crest for+ * enlisted ranks);+ * - beret: black wool pulled down over the right ear, a shield-shaped flash+ * over the left eye carrying the officer's rank or the unit crest;+ * - service cap: the peaked dress cap with a black band, a glossy visor, a+ * gold chin strap and the gold eagle; field-grade officers get one row of+ * gold oak leaves on the visor, general officers two.+ *+ * The figure hides its hair under a hat except for the band at the nape.+ */+import { CylinderGeometry, MeshStandardMaterial, SphereGeometry } from "three";+import { RoundedBoxGeometry } from "three-stdlib";+import { TOY } from "../../office/toyFigureModel";+import { RANK_INFO, type RankId, type RewardId } from "../levelCatalog";+import { CAP_BADGE_ART, CREST_ART, rankArt } from "../insignia/rankArt";+import { ArtPiece3D, RankInsignia3D, REGALIA_MATERIALS } from "./insignia3d";++const HD = TOY.head;++export type HeadwearId = Extract<RewardId, `headwear_${string}`>;++const GEO = {+ cyl: new CylinderGeometry(1, 1, 1, 48),+ crown: new CylinderGeometry(1.12, 1, 1, 48),+ sphere: new SphereGeometry(1, 40, 24),+ bill: new RoundedBoxGeometry(1, 1, 1, 3, 0.2),+ /** The front half of a disc: a visor. */+ visor: new CylinderGeometry(1, 1, 1, 40, 1, false, -Math.PI / 2, Math.PI),+ prism: new CylinderGeometry(1, 1, 1, 3),+};++const cloth = new Map<string, MeshStandardMaterial>();+function fabric(colour: string, roughness = 0.92): MeshStandardMaterial {+ const key = `${colour}|${roughness}`;+ let m = cloth.get(key);+ if (!m) { m = new MeshStandardMaterial({ color: colour, roughness }); cloth.set(key, m); }+ return m;+}+const PATENT = new MeshStandardMaterial({ color: "#0c0d10", roughness: 0.12, metalness: 0.2 });++/** The rank pinned on a cap: officers wear their pin, enlisted ranks the unit crest (or their sewn rank on the patrol cap). */+function CapPin({ rank, width }: { rank: RankId; width: number }) {+ const officer = RANK_INFO[rank].tier === "officer" || RANK_INFO[rank].tier === "general";+ if (officer) {+ const art = rankArt(rank);+ // Stars stacked for the shoulder are pinned side by side on a cap.+ const sideways = RANK_INFO[rank].tier === "general" && rank !== "general_of_the_army";+ return <group rotation={[0, 0, sideways ? Math.PI / 2 : 0]}><RankInsignia3D rank={rank} width={sideways ? (width * art.w) / art.h * 2.2 : width} /></group>;+ }+ return <ArtPiece3D id="crest" art={CREST_ART} width={width * 0.9} />;+}++function PatrolCap({ rank }: { rank: RankId }) {+ const shell = fabric("#5c6248");+ const sewn = rankArt(rank).mount === "sleeve";+ return (+ <group position={[0, HD.y + 0.14, 0]} rotation={[-0.1, 0, 0]}>+ <mesh geometry={GEO.crown} material={shell} position={[0, 0.07, 0]} scale={[HD.rx + 0.02, 0.17, HD.rz + 0.03]} castShadow />+ <mesh geometry={GEO.cyl} material={fabric("#4d523b")} position={[0, -0.005, 0]} scale={[HD.rx + 0.026, 0.035, HD.rz + 0.036]} />+ <mesh geometry={GEO.bill} material={shell} position={[0, -0.01, HD.rz + 0.08]} rotation={[0.22, 0, 0]} scale={[0.3, 0.022, 0.13]} castShadow />+ <group position={[0, 0.07, HD.rz + 0.034]}>+ {sewn ? <RankInsignia3D rank={rank} width={0.085} wrapRadius={0.3} /> : <CapPin rank={rank} width={0.06} />}+ </group>+ </group>+ );+}++function GarrisonCap({ rank }: { rank: RankId }) {+ const blue = fabric("#1d2742");+ return (+ <group position={[-0.02, HD.y + HD.ry - 0.06, 0]} rotation={[0, 0, 0.16]}>+ {/* The folded body: a wedge lying front to back, its ridge on top. */}+ <mesh geometry={GEO.prism} material={blue} rotation={[Math.PI / 2, 0, Math.PI]} position={[0, 0.045, 0]} scale={[0.16, 0.52, 0.095]} castShadow />+ <mesh geometry={GEO.cyl} material={blue} position={[0, 0, 0]} scale={[0.21, 0.04, HD.rz + 0.02]} />+ {/* Gold piping along the ridge and the curtain's edge. */}+ <mesh material={REGALIA_MATERIALS.braid} position={[0, 0.095, 0]}>+ <boxGeometry args={[0.01, 0.008, 0.5]} />+ </mesh>+ {[-1, 1].map((sx) => (+ <mesh key={sx} material={REGALIA_MATERIALS.braid} position={[sx * 0.135, 0.022, 0]} rotation={[0, 0, sx * 0.55]}>+ <boxGeometry args={[0.006, 0.006, 0.48]} />+ </mesh>+ ))}+ <group position={[0.11, 0.035, 0.17]} rotation={[0, 0.5, 0.5]}>+ <CapPin rank={rank} width={0.045} />+ </group>+ </group>+ );+}++function Beret({ rank }: { rank: RankId }) {+ const wool = fabric("#121316", 0.98);+ return (+ <group position={[0, HD.y + 0.1, 0]}>+ {/* Head band, then the crown pulled over the right side (-x). */}+ <mesh geometry={GEO.cyl} material={fabric("#1b1c20", 0.85)} position={[0, 0.02, 0]} scale={[HD.rx + 0.022, 0.04, HD.rz + 0.026]} />+ <mesh geometry={GEO.sphere} material={wool} position={[-0.05, 0.12, -0.01]} rotation={[0.05, 0, 0.32]}+ scale={[HD.rx + 0.07, 0.1, HD.rz + 0.06]} castShadow />+ {/* The flash over the left eye: a navy shield edged in gold. */}+ <group position={[0.1, 0.09, HD.rz + 0.005]} rotation={[-0.15, 0.32, 0]}>+ <mesh material={REGALIA_MATERIALS.braid} scale={[0.072, 0.082, 0.006]}>+ <sphereGeometry args={[0.5, 20, 12]} />+ </mesh>+ <mesh material={fabric("#24386b", 0.8)} position={[0, 0, 0.002]} scale={[0.064, 0.074, 0.006]}>+ <sphereGeometry args={[0.5, 20, 12]} />+ </mesh>+ <group position={[0, 0, 0.006]}><CapPin rank={rank} width={0.038} /></group>+ </group>+ </group>+ );+}++/** Rows of gold oak leaves on the visor: none below major, one for field grade, two for general officers. */+function visorRows(rank: RankId): number {+ const info = RANK_INFO[rank];+ if (info.tier === "general") return 2;+ if (rank === "major" || rank === "lieutenant_colonel" || rank === "colonel") return 1;+ return 0;+}++function ServiceCap({ rank }: { rank: RankId }) {+ const crown = fabric("#1d2742", 0.8);+ const rows = visorRows(rank);+ const vr = HD.rx + 0.03;+ return (+ <group position={[0, HD.y + 0.12, 0]} rotation={[-0.06, 0, 0]}>+ <mesh geometry={GEO.cyl} material={fabric("#0f1013", 0.6)} position={[0, 0.04, 0]} scale={[HD.rx + 0.024, 0.085, HD.rz + 0.03]} castShadow />+ <mesh geometry={GEO.crown} material={crown} position={[0, 0.12, -0.01]} scale={[HD.rx + 0.07, 0.075, HD.rz + 0.085]} castShadow />+ <mesh geometry={GEO.cyl} material={crown} position={[0, 0.16, -0.012]} scale={[HD.rx + 0.085, 0.022, HD.rz + 0.1]} castShadow />+ {/* The glossy visor, angled down over the brow. */}+ <mesh geometry={GEO.visor} material={PATENT} position={[0, 0.0, 0.03]} rotation={[0.38, 0, 0]} scale={[vr, 0.012, HD.rz + 0.1]} castShadow />+ {Array.from({ length: rows }, (_, row) => (+ <group key={row} position={[0, 0.004 - row * 0.018, 0.03]} rotation={[0.38, 0, 0]}>+ {Array.from({ length: 9 }, (_, i) => {+ const a = -0.95 + (i / 8) * 1.9;+ const r = HD.rz + 0.06 - row * 0.03;+ return (+ <mesh key={i} material={REGALIA_MATERIALS.gold} position={[Math.sin(a) * vr * (r / (HD.rz + 0.1)), 0.008, Math.cos(a) * r]}+ rotation={[0, a + 0.6, 0]} scale={[0.02, 0.004, 0.009]}>+ <sphereGeometry args={[1, 10, 6]} />+ </mesh>+ );+ })}+ </group>+ ))}+ {/* The gold chin strap across the band, buttoned at each side. */}+ <mesh material={REGALIA_MATERIALS.braid} position={[0, 0.015, HD.rz + 0.034]}>+ <boxGeometry args={[0.32, 0.016, 0.006]} />+ </mesh>+ {[-1, 1].map((sx) => (+ <mesh key={sx} material={REGALIA_MATERIALS.gold} position={[sx * 0.17, 0.015, HD.rz - 0.02]}>+ <sphereGeometry args={[0.012, 10, 8]} />+ </mesh>+ ))}+ <group position={[0, 0.115, HD.rz + 0.09]} rotation={[-0.12, 0, 0]}>+ <ArtPiece3D id="cap-badge" art={CAP_BADGE_ART} width={0.11} />+ </group>+ </group>+ );+}++/** A headwear piece for a figure of the given rank, in head-group space. */+export function Headwear({ kind, rank }: { kind: HeadwearId; rank: RankId }) {+ if (kind === "headwear_patrol_cap") return <PatrolCap rank={rank} />;+ if (kind === "headwear_garrison_cap") return <GarrisonCap rank={rank} />;+ if (kind === "headwear_beret") return <Beret rank={rank} />;+ return <ServiceCap rank={rank} />;+}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/regalia/insignia3d.tsx b/jarvis/ui/web/frontend/src/components/society/progression/regalia/insignia3d.tsxnew file mode 100644index 0000000000..9b35c076a1--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/progression/regalia/insignia3d.tsx@@ -0,0 +1,185 @@+/**+ * The rank insignia in 3D, extruded from the same polygons as the SVG icons+ * (`insignia/rankArt.ts`): navy cloth backing, raised gold embroidery, struck+ * gold and silver pins with a bevelled edge. The piece a figure wears and+ * the piece in a display case are the same geometry.+ *+ * Built in a local frame: the insignia lies in the x/y plane, its front+ * facing +z, its back at z = 0, `width` metres wide. With `wrapRadius` the+ * piece bends round a cylinder of that radius (an upper sleeve), so a flat+ * patch never floats off a round arm.+ */+import { useMemo } from "react";+import { BufferGeometry, ExtrudeGeometry, MeshStandardMaterial, Shape, Vector2 } from "three";+import { mergeGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js";+import type { RankId, RankTier } from "../levelCatalog";+import { RANK_INFO } from "../levelCatalog";+import { rankArt, type Finish, type InsigniaArt, type Pt } from "../insignia/rankArt";++/** Materials shared by every insignia: struck metal catches the light, cloth stays matte. */+export const REGALIA_MATERIALS = {+ gold: new MeshStandardMaterial({ color: "#d9aa45", metalness: 0.62, roughness: 0.32, emissive: "#3b2906", emissiveIntensity: 0.35 }),+ goldDetail: new MeshStandardMaterial({ color: "#9a6f1f", metalness: 0.55, roughness: 0.42 }),+ silver: new MeshStandardMaterial({ color: "#dfe3ea", metalness: 0.66, roughness: 0.26, emissive: "#2a2e36", emissiveIntensity: 0.3 }),+ silverDetail: new MeshStandardMaterial({ color: "#8e96a3", metalness: 0.6, roughness: 0.35 }),+ cloth: new MeshStandardMaterial({ color: "#1b2340", roughness: 0.95 }),+ boardNavy: new MeshStandardMaterial({ color: "#18213d", roughness: 0.85 }),+ boardBlack: new MeshStandardMaterial({ color: "#121318", roughness: 0.7 }),+ braid: new MeshStandardMaterial({ color: "#d2a33f", metalness: 0.5, roughness: 0.45, emissive: "#3b2906", emissiveIntensity: 0.3 }),+ /** A rank not reached yet: the whole piece in one dark pewter, a silhouette that still shows its form. */+ muted: new MeshStandardMaterial({ color: "#3a3f4c", metalness: 0.35, roughness: 0.6 }),+} as const;++type Layer = "cloth" | "gold" | "silver" | "goldDetail" | "silverDetail";++/** Depths in insignia units (the art is 100 units wide). */+const DEPTH = { cloth: 2.2, metal: 3.4, detail: 1.1 };++function shapeOf(pts: readonly Pt[], h: number): Shape {+ // Art space: y down, origin top-left. Shape space: y up, centred.+ return new Shape(pts.map(([x, y]) => new Vector2(x - 50, h / 2 - y)));+}++/** Bends a piece round a vertical cylinder of radius `r` (insignia units): x runs round it, z grows outward. */+function wrap(geometry: BufferGeometry, r: number): void {+ const pos = geometry.attributes.position;+ for (let i = 0; i < pos.count; i += 1) {+ const x = pos.getX(i), z = pos.getZ(i);+ const angle = x / r;+ pos.setXYZ(i, (r + z) * Math.sin(angle), pos.getY(i), (r + z) * Math.cos(angle) - r);+ }+ pos.needsUpdate = true;+ geometry.computeVertexNormals();+}++interface Built { layer: Layer; geometry: BufferGeometry }++const builtCache = new Map<string, Built[]>();++/** The merged geometry per material layer of a rank's insignia, in insignia units. */+function buildArt(id: string, art: InsigniaArt, wrapUnits: number | null): Built[] {+ const key = `${id}|${wrapUnits ?? "flat"}`;+ const cached = builtCache.get(key);+ if (cached) return cached;+ const hasCloth = art.parts.some((p) => p.finish === "cloth");+ const metalBase = hasCloth ? DEPTH.cloth : 0;+ const byLayer = new Map<Layer, BufferGeometry[]>();+ for (const part of art.parts) {+ const shape = shapeOf(part.pts, art.h);+ let geometry: BufferGeometry;+ let layer: Layer;+ if (part.finish === "cloth") {+ geometry = new ExtrudeGeometry(shape, { depth: DEPTH.cloth, bevelEnabled: false, curveSegments: 4 });+ layer = "cloth";+ } else if (part.detail) {+ geometry = new ExtrudeGeometry(shape, { depth: DEPTH.detail, bevelEnabled: false, curveSegments: 4 });+ geometry.translate(0, 0, metalBase + DEPTH.metal);+ layer = part.finish === "gold" ? "goldDetail" : "silverDetail";+ } else {+ geometry = new ExtrudeGeometry(shape, {+ depth: DEPTH.metal - 0.8, bevelEnabled: true, bevelThickness: 0.6, bevelSize: 0.55, bevelSegments: 2, curveSegments: 4,+ });+ geometry.translate(0, 0, metalBase + 0.6);+ layer = part.finish as Finish as Layer;+ }+ // Merging needs one attribute layout; extrusions carry uv and normal alike.+ const list = byLayer.get(layer) ?? [];+ list.push(geometry.index ? geometry.toNonIndexed() : geometry);+ byLayer.set(layer, list);+ }+ const built: Built[] = [];+ for (const [layer, list] of byLayer) {+ const merged = mergeGeometries(list, false);+ if (!merged) continue;+ if (wrapUnits) wrap(merged, wrapUnits);+ else merged.computeVertexNormals();+ built.push({ layer, geometry: merged });+ }+ builtCache.set(key, built);+ return built;+}++/** Any piece of vector art (`rankArt.ts`) in 3D, `width` metres wide; `id` names it in the geometry cache. */+export function ArtPiece3D({ id, art, width, wrapRadius, cast = false, muted = false }: {+ id: string; art: InsigniaArt; width: number;+ /** Draw every layer in the muted pewter (a rank not reached yet). */+ muted?: boolean;+ /** Bend round a cylinder of this radius in metres (a sleeve, a cap's front). */+ wrapRadius?: number;+ cast?: boolean;+}) {+ const s = width / art.w;+ const parts = useMemo(() => buildArt(id, art, wrapRadius ? wrapRadius / s : null), [id, art, wrapRadius, s]);+ if (parts.length === 0) return null;+ return (+ <group scale={s}>+ {parts.map(({ layer, geometry }) => (+ <mesh key={layer} geometry={geometry} material={muted ? REGALIA_MATERIALS.muted : REGALIA_MATERIALS[layer]} castShadow={cast} />+ ))}+ </group>+ );+}++/** A rank's insignia, `width` metres wide; nothing for a private, who wears none. */+export function RankInsignia3D({ rank, width, wrapRadius, cast, muted }: {+ rank: RankId; width: number; wrapRadius?: number; cast?: boolean; muted?: boolean;+}) {+ return <ArtPiece3D id={`rank:${rank}`} art={rankArt(rank)} width={width} wrapRadius={wrapRadius} cast={cast} muted={muted} />;+}++/** The height of a rank's insignia at `width` metres wide. */+export function insigniaHeight(rank: RankId, width: number): number {+ const art = rankArt(rank);+ return (art.h / art.w) * width;+}++// ---------------------------------------------------------------------------+// Where a figure wears it++/** Upper-sleeve patch of an enlisted rank: centred on the arm surface, bent round it. */+export function SleevePatch({ rank, armRadius, width = 0.07 }: { rank: RankId; armRadius: number; width?: number }) {+ if (rankArt(rank).mount !== "sleeve") return null;+ return <RankInsignia3D rank={rank} width={width} wrapRadius={armRadius} />;+}++/** The shoulder board of an officer or general: its length runs along local +x, its top faces +y. */+export const BOARD = { length: 0.135, width: 0.066, thick: 0.012 };++function boardLook(tier: RankTier): { base: MeshStandardMaterial; edge: number } {+ return tier === "general" ? { base: REGALIA_MATERIALS.boardBlack, edge: 0.012 } : { base: REGALIA_MATERIALS.boardNavy, edge: 0.004 };+}++export function ShoulderBoard({ rank }: { rank: RankId }) {+ const art = rankArt(rank);+ if (art.mount !== "shoulder") return null;+ const { base, edge } = boardLook(RANK_INFO[rank].tier);+ const { length: L, width: W, thick: T } = BOARD;+ // The insignia's long axis (art y) runs along the board, fitted inside the braid.+ const fit = Math.min((W - edge * 2) * 0.92, ((L - edge * 2 - 0.02) * 0.92 * art.w) / art.h);+ return (+ <group>+ <mesh material={base} position={[0, T / 2, 0]} castShadow>+ <boxGeometry args={[L, T, W]} />+ </mesh>+ {/* The pointed inner end that buttons at the collar. */}+ <mesh material={base} position={[-L / 2, T / 2, 0]} rotation={[0, Math.PI / 4, 0]}>+ <boxGeometry args={[W / Math.SQRT2, T, W / Math.SQRT2]} />+ </mesh>+ {/* Gold braid round the edge: a fine line for officers, a broad band for generals. */}+ {[-1, 1].map((sz) => (+ <mesh key={sz} material={REGALIA_MATERIALS.braid} position={[0.004, T + 0.0012, sz * (W / 2 - edge / 2)]}>+ <boxGeometry args={[L - 0.008, 0.0024, edge]} />+ </mesh>+ ))}+ <mesh material={REGALIA_MATERIALS.braid} position={[L / 2 - edge / 2, T + 0.0012, 0]}>+ <boxGeometry args={[edge, 0.0024, W]} />+ </mesh>+ <mesh material={REGALIA_MATERIALS.braid} position={[-L / 2 - W * 0.36, T + 0.002, 0]}>+ <cylinderGeometry args={[0.009, 0.009, 0.004, 16]} />+ </mesh>+ <group position={[0.008, T + 0.0024, 0]} rotation={[-Math.PI / 2, 0, -Math.PI / 2]}>+ <RankInsignia3D rank={rank} width={fit} />+ </group>+ </group>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/progression/regalia/ribbons.ts b/jarvis/ui/web/frontend/src/components/society/progression/regalia/ribbons.tsnew file mode 100644index 0000000000..579ca8d72d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/progression/regalia/ribbons.ts@@ -0,0 +1,69 @@+/**+ * Service ribbons and medals: the striped silk bars worn above the left+ * breast pocket and the full-size medals hung from them. One table drives+ * the SVG icons, the canvas textures on the 3D ribbons and the medal discs,+ * so a ribbon reads the same in the studio, on a figure and in the hall.+ *+ * Stripes are listed left to right as [colour, width]; widths are relative.+ */++export interface RibbonSpec {+ id: string;+ stripes: readonly (readonly [string, number])[];+ /** The medal hung from this ribbon: its metal and shape. */+ medal: { metal: "bronze" | "gold" | "silver"; shape: "disc" | "star" | "cross" };+}++const R = "#b3202a", W = "#f4f1e8", B = "#1f3b7a", Y = "#e9b928", G = "#1e6b3a", K = "#1a1a1a", L = "#5b9bd5", O = "#d8752b";++/** In order of precedence, highest first: the rack fills from the top left. */+export const RIBBONS: readonly RibbonSpec[] = [+ { id: "distinguished", stripes: [[B, 3], [W, 1], [R, 6], [W, 1], [B, 3]], medal: { metal: "gold", shape: "star" } },+ { id: "meritorious", stripes: [[R, 2], [W, 1], [R, 6], [W, 1], [R, 2]], medal: { metal: "bronze", shape: "star" } },+ { id: "commendation", stripes: [[W, 1], [G, 3], [W, 1], [G, 2], [W, 1], [G, 3], [W, 1]], medal: { metal: "bronze", shape: "cross" } },+ { id: "achievement", stripes: [[W, 1], [G, 2], [W, 1], [B, 2], [W, 1], [G, 2], [W, 1]], medal: { metal: "bronze", shape: "disc" } },+ { id: "good_conduct", stripes: [[R, 2], [W, 0.6], [R, 2], [W, 0.6], [R, 2], [W, 0.6], [R, 2]], medal: { metal: "bronze", shape: "disc" } },+ { id: "national_defense", stripes: [[R, 2], [W, 0.6], [B, 0.6], [W, 0.6], [R, 0.6], [Y, 3], [R, 0.6], [W, 0.6], [B, 0.6], [W, 0.6], [R, 2]], medal: { metal: "bronze", shape: "disc" } },+ { id: "service", stripes: [[R, 1], [O, 1], [Y, 1], [G, 1], [L, 1], [B, 1], [K, 0.6], [B, 1], [L, 1], [G, 1], [Y, 1], [O, 1], [R, 1]], medal: { metal: "bronze", shape: "disc" } },+ { id: "overseas", stripes: [[B, 1], [Y, 1], [G, 1], [Y, 2], [R, 1], [Y, 2], [G, 1], [Y, 1], [B, 1]], medal: { metal: "bronze", shape: "disc" } },+ { id: "leadership", stripes: [[Y, 1], [B, 1], [W, 1], [R, 3], [W, 1], [B, 1], [Y, 1]], medal: { metal: "silver", shape: "disc" } },+];++/** A ribbon's stripes as [x, width, colour] spans across a bar `width` wide. */+export function ribbonSpans(spec: RibbonSpec, width: number): [number, number, string][] {+ const total = spec.stripes.reduce((sum, [, w]) => sum + w, 0);+ let x = 0;+ return spec.stripes.map(([colour, w]) => {+ const span: [number, number, string] = [x, (w / total) * width, colour];+ x += (w / total) * width;+ return span;+ });+}++/** Paints a ribbon onto a canvas, with a soft silk sheen and a dark edge. */+export function paintRibbon(ctx: CanvasRenderingContext2D, spec: RibbonSpec, w: number, h: number): void {+ for (const [x, sw, colour] of ribbonSpans(spec, w)) {+ ctx.fillStyle = colour;+ ctx.fillRect(Math.floor(x), 0, Math.ceil(sw) + 1, h);+ }+ const sheen = ctx.createLinearGradient(0, 0, 0, h);+ sheen.addColorStop(0, "rgba(255,255,255,0.28)");+ sheen.addColorStop(0.45, "rgba(255,255,255,0)");+ sheen.addColorStop(1, "rgba(0,0,0,0.25)");+ ctx.fillStyle = sheen;+ ctx.fillRect(0, 0, w, h);+ ctx.strokeStyle = "rgba(0,0,0,0.45)";+ ctx.lineWidth = Math.max(1, h * 0.06);+ ctx.strokeRect(0, 0, w, h);+}++export const MEDAL_METALS: Record<RibbonSpec["medal"]["metal"], { face: string; edge: string }> = {+ bronze: { face: "#b9833f", edge: "#6d4a1e" },+ gold: { face: "#e2b54e", edge: "#80601a" },+ silver: { face: "#d6dbe2", edge: "#6f7784" },+};++/** How many ribbons each decoration wears, rows of three like a real rack. */+export const RACK_SIZE = { decoration_ribbon_bar: 3, decoration_ribbon_rack: 9, decoration_aiguillette: 9, decoration_medals: 9 } as const;+/** The full-size medals worn with the top decoration: the five highest. */+export const MEDAL_COUNT = 5;diff --git a/jarvis/ui/web/frontend/src/components/society/progression/wornGadget.tsx b/jarvis/ui/web/frontend/src/components/society/progression/wornGadget.tsxdeleted file mode 100644index 6519962388..0000000000--- a/jarvis/ui/web/frontend/src/components/society/progression/wornGadget.tsx+++ /dev/null@@ -1,60 +0,0 @@-/**- * Gadgets a figure (the person or an agent) wears on its own body, so they- * ride every hop, bob and lean instead of floating at a fixed height: the- * wings on its back, the halo and the crown on its head, the drone beside it- * in the body's frame. The pet keeps its gadget in `ProgressionLayer`.- */-import type { ReactNode } from "react";-import type { FigureMode } from "../figures/FigureRig";-import { equippedFor } from "./cosmetics";-import { useProgression } from "./progressionStore";-import { AngelWings, type WingMotion } from "./effects/AngelWings";-import { GadgetModel, type GadgetKind } from "./effects/CosmeticWear";--/** The gadget this figure wears right now, or null (unlocked, and not swapped out by the person). */-export function useWornGadget(kind: "person" | "agent", subjectId: string): GadgetKind | null {- return useProgression((s) => {- const rewards = s.snapshot?.rewards;- const level = s.subjects[subjectId]?.level;- if (!rewards || !level) return null;- const gadget = equippedFor(rewards, kind, level, kind === "person" ? s.choices.person : undefined).gadget;- return (gadget as GadgetKind | undefined) ?? null;- });-}--export interface FigureGadgetSlots {- /** For ToyFigure's `back` slot. */- back?: ReactNode;- /** For ToyFigure's `headwear` slot. */- headwear?: ReactNode;- /** Rendered beside the figure inside the group that carries its hop. */- beside?: ReactNode;-}--const HEADWEAR_SCALE = 1.25;--/** Where a figure wears `gadget`; every slot is empty when it wears none. */-export function figureGadgetSlots(gadget: GadgetKind | null | undefined, opts: {- drive: { current: { mode: FigureMode } };- /** Height of the figure's head top above its feet (m); the drone hovers off it. */- top: number;- paused: boolean;- reduced: boolean;-} & WingMotion): FigureGadgetSlots {- const { drive, top, paused, reduced, airborne } = opts;- if (gadget === "gadget_wings") return { back: <AngelWings drive={drive} airborne={airborne} paused={paused} reduced={reduced} /> };- if (gadget === "gadget_halo" || gadget === "gadget_crown") {- // A touch larger than the pet's, so it reads on a full-size head.- return { headwear: <GadgetModel key={gadget} kind={gadget} scale={HEADWEAR_SCALE} paused={paused} reduced={reduced} /> };- }- if (gadget === "gadget_drone") {- return {- beside: (- <group position={[0, top, 0]}>- <GadgetModel kind={gadget} paused={paused} reduced={reduced} />- </group>- ),- };- }- return {};-}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.jsonindex 049cbdbabc..00ed1efe57 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json@@ -1453,19 +1453,18 @@"pet_line": "{0} · Level {1}","max": "Höchstes Level erreicht","level_up": "Level-up",+ "promoted": "Befördert",+ "promoted_aria": "{0} wurde befördert: {2}, Level {1}. Zum Schließen klicken.",+ "next_promotion": "Nächste Beförderung: {0} ab Level {1}",+ "no_insignia": "Noch kein Abzeichen","pet_up": "{0} ist aufgestiegen","agent_up": "{0} hat Level {1} erreicht","while_away": "Während du weg warst","banner_aria": "{0} hat Level {1} erreicht. Zum Schließen klicken.",- "title_line": "Neuer Titel: {0}","unlocked": "Freigeschaltet",- "equip_hint": "Anlegen in der Umkleide der Level-Halle (L).",- "equip_hint_pet": "Deinem Pet anlegen in der Umkleide der Level-Halle (L).",- "burst_you": "Level",- "burst_pet": "Level",- "burst_agent": "Level",+ "equip_hint": "In der Umkleide der Level-Halle wählst du, was du trägst (L).","auto": "Automatisch",- "none": "Nichts",+ "none": "Eigene Kleidung","locked_at": "Ab Level {0}","to_next": "Noch {0} XP bis Level {1}","total": "{0} XP insgesamt",@@ -1485,56 +1484,50 @@"sound": "Level-up-Klänge","free_note": "XP gibt es nur für echte Arbeit, und sie kosten nie Tokens.","slot": {- "frame": "Rahmen",- "trail": "Spur",- "aura": "Aura",- "gadget": "Gadget"+ "uniform": "Uniform",+ "headwear": "Kopfbedeckung",+ "decoration": "Auszeichnungen"},"reward": {- "frame_bronze": "Bronzerahmen",- "frame_silver": "Silberrahmen",- "frame_gold": "Goldrahmen",- "frame_diamond": "Diamantrahmen",- "trail_footprints": "Leuchtende Fußspuren",- "trail_sparkle": "Funkelspur",- "trail_comet": "Kometenschweif",- "trail_neon": "Neonband",- "trail_rainbow": "Regenbogenspur",- "trail_stardust": "Sternenstaub",- "aura_glow": "Warmes Leuchten",- "aura_runes": "Runenkreis",- "aura_storm": "Sturmring",- "aura_legend": "Legendenkreis",- "gadget_drone": "Helfer-Drohne",- "gadget_halo": "Heiligenschein",- "gadget_crown": "Krone",- "gadget_wings": "Lichtflügel"+ "uniform_service_shirt": "Diensthemd mit Krawatte",+ "uniform_field_jacket": "Feldjacke",+ "uniform_service_greens": "Grüner Dienstanzug",+ "uniform_dress_blues": "Blaue Ausgehuniform",+ "uniform_mess_dress": "Blaue Messeuniform",+ "headwear_patrol_cap": "Feldmütze",+ "headwear_garrison_cap": "Schiffchen",+ "headwear_beret": "Schwarzes Barett",+ "headwear_service_cap": "Schirmmütze",+ "decoration_ribbon_bar": "Ordensspange",+ "decoration_ribbon_rack": "Große Ordensspange",+ "decoration_aiguillette": "Goldene Fangschnur",+ "decoration_medals": "Große Orden"},"title": {- "newcomer": "Neuling",- "apprentice": "Lehrling",- "operator": "Operator",- "specialist": "Spezialist",- "strategist": "Stratege",- "architect": "Architekt",- "commander": "Kommandant",- "visionary": "Visionär",- "legend": "Legende",- "rookie": "Frischling",- "trainee": "Trainee",- "associate": "Mitarbeiter",- "professional": "Profi",- "expert": "Experte",- "veteran": "Veteran",- "elite": "Elite",- "grandmaster": "Großmeister",- "hatchling": "Küken",- "buddy": "Kumpel",- "sidekick": "Sidekick",- "partner": "Partner",- "guardian": "Wächter",- "champion": "Champion",- "mythic": "Mythisch"+ "private": "Schütze",+ "private_second_class": "Gefreiter",+ "private_first_class": "Obergefreiter",+ "specialist": "Hauptgefreiter",+ "corporal": "Korporal",+ "sergeant": "Unteroffizier",+ "staff_sergeant": "Feldwebel",+ "sergeant_first_class": "Oberfeldwebel",+ "master_sergeant": "Hauptfeldwebel",+ "first_sergeant": "Kompaniefeldwebel",+ "sergeant_major": "Stabsfeldwebel",+ "command_sergeant_major": "Oberstabsfeldwebel",+ "sergeant_major_of_the_army": "Oberster Unteroffizier des Heeres",+ "second_lieutenant": "Leutnant",+ "first_lieutenant": "Oberleutnant",+ "captain": "Hauptmann",+ "major": "Major",+ "lieutenant_colonel": "Oberstleutnant",+ "colonel": "Oberst",+ "brigadier_general": "Brigadegeneral",+ "major_general": "Generalmajor",+ "lieutenant_general": "Generalleutnant",+ "general": "General",+ "general_of_the_army": "Fünf-Sterne-General"},"source": {"chat_turn": "Einen Chat-Turn mit Jarvis abschließen",@@ -1561,53 +1554,58 @@},"hall": {"title": "Level-Halle",- "subtitle": "Dein Level, deine Ausrüstung und was du als Nächstes freischaltest",+ "subtitle": "Dein Rang, deine Uniform und deine nächste Beförderung",+ "ranks_body": "Alle steigen dieselbe Leiter hinauf: erst die Mannschafts- und Unteroffiziersränge, dann die Offiziere, bis zu fünf Sternen auf Level 50.",+ "rank_held": "Dein Rang",+ "rank_from": "Ab Level {0}","subject_label": "Wessen Fortschritt","subject_you": "Du","tab_overview": "Überblick","tab_studio": "Umkleide",- "tab_rewards": "Belohnungen",+ "tab_rewards": "Beförderungen","tab_guide": "So levelst du","tab_team": "Team",+ "tab_ranks": "Ränge",+ "next_promotion_title": "Nächste Beförderung",+ "ranks_all": "Alle Ränge",+ "pet_rank_only": "{0} trägt keine Uniform: Sein Rang steht auf dem Namensschild und steigt mit jedem Level.","loading": "Level werden geladen …","next_reward": "Nächste Belohnung","all_unlocked": "Alles freigeschaltet",- "next_rewards": "Als Nächstes frei",- "best_pieces": "Deine besten Teile",+ "next_rewards": "Nächste Uniformteile",+ "best_pieces": "Deine besten Stücke","road_all": "Ganze Belohnungsstraße","try_hint": "Klick auf eine Belohnung, um sie in der Umkleide anzuprobieren.",- "next_title": "Nächster Titel: {0} ab Level {1}",- "top_title": "Höchster Titel erreicht",+ "next_title": "Nächste Beförderung: {0} ab Level {1}",+ "top_title": "Höchster Rang erreicht","quick_title": "Schnell XP sammeln","quick_all": "Alle Wege ansehen","xp_needed": "noch {0} XP","unlocked": "Freigeschaltet","equipped": "Angelegt",- "rarity": {- "common": "Gewöhnlich",- "rare": "Selten",- "epic": "Episch",- "legendary": "Legendär"+ "tier": {+ "enlisted": "Mannschaften",+ "nco": "Unteroffizier",+ "officer": "Offizier",+ "general": "General"},"studio_body": "Wähle für jeden Platz, was {0} trägt. Gesperrtes kannst du anprobieren.",- "studio_body_you": "Wähle für jeden Platz, was du trägst. Gesperrtes kannst du anprobieren.",+ "studio_body_you": "Wähle Uniform, Kopfbedeckung und Auszeichnungen. Gesperrtes kannst du anprobieren.","slots_label": "Plätze","slot_hint": {- "frame": "Der Rahmen um die Levelnummer am Namensschild und auf der Level-Karte.",- "trail": "Eine Spur, die beim Laufen zurückbleibt.",- "aura": "Ein Leuchten am Boden darunter.",- "gadget": "Ein Gadget an oder über der Figur."+ "uniform": "Was du im Dienst trägst. Dein Rangabzeichen sitzt am Ärmel (Mannschaften, Unteroffiziere) oder auf den Schulterklappen (Offiziere).",+ "headwear": "Die Mütze, vorn mit deinem Rangabzeichen oder dem Verbandsabzeichen.",+ "decoration": "Bandschnallen oder Orden über der linken Brusttasche; die Fangschnur hängt von der rechten Schulter."},- "auto_hint": "Immer das beste freie Teil",- "none_hint": "Dieser Platz bleibt leer",+ "auto_hint": "Immer das beste freigeschaltete Teil",+ "none_hint": "Hier trägst du deine eigene Kleidung","locked_aria": "{0}, gesperrt bis Level {1}. Zum Anprobieren klicken.","preview_label": "{0} auf der Bühne der Umkleide","drag_hint": "Zum Drehen ziehen",- "trail_reduced": "Spuren sieht man nur in Bewegung. Mit reduzierter Bewegung bleibt die Vorschau stehen.","try_on": "Anprobe","try_on_line": "Frei ab Level {0} · noch {1} XP","try_on_back": "Zurück zu meiner Ausrüstung",- "road_body": "Jede Stufe auf der Straße bringt etwas Neues. Wähl eine aus, um sie an dir zu sehen.",+ "road_body": "Jede Beförderung und jedes Uniformteil auf einem Weg. Wähl eine Stufe, um dich in diesem Rang zu sehen.","road_here": "Du · Lv {0}","reward_open": "Freigeschaltet bei Level {0}","reward_locked": "Wird frei bei Level {0}",@@ -1621,8 +1619,8 @@"step1_body": "Rede mit Jarvis, gib deinem Team Arbeit, entdecke das Verse. Jede Aktion zählt.","step2_title": "Aufsteigen","step2_body": "Ist die Leiste voll, erreichst du das nächste Level. Jedes Level braucht etwas mehr XP.",- "step3_title": "Freischalten",- "step3_body": "Neue Level bringen Titel und Ausrüstung. Leg sie in der Umkleide an.",+ "step3_title": "Befördert werden",+ "step3_body": "Beförderungen bringen echte Uniformteile. Leg sie in der Umkleide an.","cost_line": "Level {0}: {1} XP","section_you": "Für dich","section_pet": "Für {0}",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.jsonindex 27ee84db4d..827fc72fc4 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json@@ -1453,19 +1453,18 @@"pet_line": "{0} · level {1}","max": "Highest level reached","level_up": "Level up",+ "promoted": "Promoted",+ "promoted_aria": "{0} was promoted to {2} at level {1}. Click to close.",+ "next_promotion": "Next promotion: {0} at level {1}",+ "no_insignia": "No insignia yet","pet_up": "{0} levelled up","agent_up": "{0} reached level {1}","while_away": "While you were away","banner_aria": "{0} reached level {1}. Click to close.",- "title_line": "New title: {0}","unlocked": "Unlocked",- "equip_hint": "Put it on in the Level Hall studio (L).",- "equip_hint_pet": "Put it on your pet in the Level Hall studio (L).",- "burst_you": "Level",- "burst_pet": "Level",- "burst_agent": "Level",+ "equip_hint": "Choose what you wear in the Level Hall studio (L).","auto": "Automatic",- "none": "None",+ "none": "Own clothes","locked_at": "Unlocks at level {0}","to_next": "{0} XP to level {1}","total": "{0} XP in total",@@ -1485,56 +1484,50 @@"sound": "Level-up sounds","free_note": "XP only comes from real work and never costs tokens.","slot": {- "frame": "Frame",- "trail": "Trail",- "aura": "Aura",- "gadget": "Gadget"+ "uniform": "Uniform",+ "headwear": "Headwear",+ "decoration": "Decorations"},"reward": {- "frame_bronze": "Bronze frame",- "frame_silver": "Silver frame",- "frame_gold": "Gold frame",- "frame_diamond": "Diamond frame",- "trail_footprints": "Glowing footprints",- "trail_sparkle": "Sparkle trail",- "trail_comet": "Comet tail",- "trail_neon": "Neon ribbon",- "trail_rainbow": "Rainbow trail",- "trail_stardust": "Star dust",- "aura_glow": "Warm glow",- "aura_runes": "Rune circle",- "aura_storm": "Storm ring",- "aura_legend": "Legend circle",- "gadget_drone": "Helper drone",- "gadget_halo": "Halo",- "gadget_crown": "Crown",- "gadget_wings": "Light wings"+ "uniform_service_shirt": "Service shirt and tie",+ "uniform_field_jacket": "Field jacket",+ "uniform_service_greens": "Green service uniform",+ "uniform_dress_blues": "Blue dress uniform",+ "uniform_mess_dress": "Blue mess dress",+ "headwear_patrol_cap": "Patrol cap",+ "headwear_garrison_cap": "Garrison cap",+ "headwear_beret": "Black beret",+ "headwear_service_cap": "Service cap",+ "decoration_ribbon_bar": "Service ribbons",+ "decoration_ribbon_rack": "Full ribbon rack",+ "decoration_aiguillette": "Gold aiguillette",+ "decoration_medals": "Full-size medals"},"title": {- "newcomer": "Newcomer",- "apprentice": "Apprentice",- "operator": "Operator",+ "private": "Private",+ "private_second_class": "Private Second Class",+ "private_first_class": "Private First Class","specialist": "Specialist",- "strategist": "Strategist",- "architect": "Architect",- "commander": "Commander",- "visionary": "Visionary",- "legend": "Legend",- "rookie": "Rookie",- "trainee": "Trainee",- "associate": "Associate",- "professional": "Professional",- "expert": "Expert",- "veteran": "Veteran",- "elite": "Elite",- "grandmaster": "Grandmaster",- "hatchling": "Hatchling",- "buddy": "Buddy",- "sidekick": "Sidekick",- "partner": "Partner",- "guardian": "Guardian",- "champion": "Champion",- "mythic": "Mythic"+ "corporal": "Corporal",+ "sergeant": "Sergeant",+ "staff_sergeant": "Staff Sergeant",+ "sergeant_first_class": "Sergeant First Class",+ "master_sergeant": "Master Sergeant",+ "first_sergeant": "First Sergeant",+ "sergeant_major": "Sergeant Major",+ "command_sergeant_major": "Command Sergeant Major",+ "sergeant_major_of_the_army": "Sergeant Major of the Army",+ "second_lieutenant": "Second Lieutenant",+ "first_lieutenant": "First Lieutenant",+ "captain": "Captain",+ "major": "Major",+ "lieutenant_colonel": "Lieutenant Colonel",+ "colonel": "Colonel",+ "brigadier_general": "Brigadier General",+ "major_general": "Major General",+ "lieutenant_general": "Lieutenant General",+ "general": "General",+ "general_of_the_army": "General of the Army"},"source": {"chat_turn": "Finish a chat turn with Jarvis",@@ -1561,53 +1554,58 @@},"hall": {"title": "Level Hall",- "subtitle": "Your level, your gear and what you unlock next",+ "subtitle": "Your rank, your uniform and your next promotion",+ "ranks_body": "Every subject climbs the same ladder: enlisted ranks first, then the commission, up to five stars at level 50.",+ "rank_held": "Your rank",+ "rank_from": "From level {0}","subject_label": "Whose progress","subject_you": "You","tab_overview": "Overview","tab_studio": "Studio",- "tab_rewards": "Rewards",+ "tab_rewards": "Promotions","tab_guide": "How to level","tab_team": "Team",+ "tab_ranks": "Ranks",+ "next_promotion_title": "Next promotion",+ "ranks_all": "All ranks",+ "pet_rank_only": "{0} wears no uniform: its rank shows on its name plate and climbs with every level.","loading": "Loading levels…","next_reward": "Next reward","all_unlocked": "Everything unlocked",- "next_rewards": "Unlock next",- "best_pieces": "Your best pieces",+ "next_rewards": "Next uniform pieces",+ "best_pieces": "Your finest pieces","road_all": "Whole reward road","try_hint": "Click a reward to try it on in the studio.",- "next_title": "Next title: {0} at level {1}",- "top_title": "Highest title reached",+ "next_title": "Next promotion: {0} at level {1}",+ "top_title": "Highest rank reached","quick_title": "Quick XP","quick_all": "All ways to earn","xp_needed": "{0} XP to go","unlocked": "Unlocked","equipped": "Equipped",- "rarity": {- "common": "Common",- "rare": "Rare",- "epic": "Epic",- "legendary": "Legendary"+ "tier": {+ "enlisted": "Enlisted",+ "nco": "Non-commissioned officer",+ "officer": "Officer",+ "general": "General officer"},"studio_body": "Choose what {0} wears in every slot. Locked pieces can be tried on.",- "studio_body_you": "Choose what you wear in every slot. Locked pieces can be tried on.",+ "studio_body_you": "Choose your uniform, cap and decorations. Locked pieces can be tried on.","slots_label": "Slots","slot_hint": {- "frame": "The frame round the level number on the name plate and the level card.",- "trail": "A trail left behind while walking.",- "aura": "A glow on the floor underneath.",- "gadget": "A gadget on or above the figure."+ "uniform": "What you wear on duty. Your rank insignia sits on the sleeves (enlisted) or on shoulder boards (officers).",+ "headwear": "The cap, with your rank pinned or sewn on the front, or your unit crest.",+ "decoration": "Ribbons or medals over the left breast pocket; the aiguillette hangs from the right shoulder."},- "auto_hint": "Always the best unlocked piece",- "none_hint": "This slot stays empty",+ "auto_hint": "Always the finest piece you have unlocked",+ "none_hint": "Your own clothes in this slot","locked_aria": "{0}, locked until level {1}. Try it on.","preview_label": "{0} on the studio stage","drag_hint": "Drag to turn",- "trail_reduced": "Trails only show in motion. With reduced motion turned on, the preview stands still.","try_on": "Try-on","try_on_line": "Unlocks at level {0} · {1} XP to go","try_on_back": "Back to my gear",- "road_body": "Every step on the road brings something new. Pick one to see it on you.",+ "road_body": "Every promotion and every uniform piece on one road. Pick a step to see yourself at that rank.","road_here": "You · Lv {0}","reward_open": "Unlocked at level {0}","reward_locked": "Unlocks at level {0}",@@ -1621,8 +1619,8 @@"step1_body": "Talk to Jarvis, give your team work, explore the Verse. Every action counts.","step2_title": "Level up","step2_body": "When the bar is full you reach the next level. Each level takes a little more XP.",- "step3_title": "Unlock",- "step3_body": "New levels bring titles and gear. Put them on in the studio.",+ "step3_title": "Get promoted",+ "step3_body": "Promotions come with real uniform pieces. Put them on in the studio.","cost_line": "Level {0}: {1} XP","section_you": "For you","section_pet": "For {0}",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.jsonindex 6df586f1c0..2233b4a8a7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json@@ -1453,19 +1453,18 @@"pet_line": "{0} · nivel {1}","max": "Nivel máximo alcanzado","level_up": "Subida de nivel",+ "promoted": "Ascendido",+ "promoted_aria": "{0} ascendió a {2} en el nivel {1}. Haz clic para cerrar.",+ "next_promotion": "Próximo ascenso: {0} en el nivel {1}",+ "no_insignia": "Aún sin insignia","pet_up": "{0} ha subido de nivel","agent_up": "{0} ha llegado al nivel {1}","while_away": "Mientras no estabas","banner_aria": "{0} ha llegado al nivel {1}. Haz clic para cerrar.",- "title_line": "Nuevo título: {0}","unlocked": "Desbloqueado",- "equip_hint": "Póntelo en el probador de la sala de niveles (L).",- "equip_hint_pet": "Pónselo a tu mascota en el probador de la sala de niveles (L).",- "burst_you": "Nivel",- "burst_pet": "Nivel",- "burst_agent": "Nivel",+ "equip_hint": "Elige qué llevas en el vestuario del Salón de Niveles (L).","auto": "Automático",- "none": "Nada",+ "none": "Ropa propia","locked_at": "Se desbloquea en el nivel {0}","to_next": "{0} XP para el nivel {1}","total": "{0} XP en total",@@ -1485,56 +1484,50 @@"sound": "Sonidos de subida de nivel","free_note": "La XP solo llega por trabajo real y nunca cuesta tokens.","slot": {- "frame": "Marco",- "trail": "Estela",- "aura": "Aura",- "gadget": "Accesorio"+ "uniform": "Uniforme",+ "headwear": "Gorra",+ "decoration": "Condecoraciones"},"reward": {- "frame_bronze": "Marco de bronce",- "frame_silver": "Marco de plata",- "frame_gold": "Marco de oro",- "frame_diamond": "Marco de diamante",- "trail_footprints": "Huellas brillantes",- "trail_sparkle": "Estela de chispas",- "trail_comet": "Cola de cometa",- "trail_neon": "Cinta de neón",- "trail_rainbow": "Estela arcoíris",- "trail_stardust": "Polvo de estrellas",- "aura_glow": "Brillo cálido",- "aura_runes": "Círculo de runas",- "aura_storm": "Anillo de tormenta",- "aura_legend": "Círculo legendario",- "gadget_drone": "Dron ayudante",- "gadget_halo": "Aureola",- "gadget_crown": "Corona",- "gadget_wings": "Alas de luz"+ "uniform_service_shirt": "Camisa de servicio con corbata",+ "uniform_field_jacket": "Chaqueta de campaña",+ "uniform_service_greens": "Uniforme verde de servicio",+ "uniform_dress_blues": "Uniforme azul de gala",+ "uniform_mess_dress": "Uniforme de etiqueta azul",+ "headwear_patrol_cap": "Gorra de patrulla",+ "headwear_garrison_cap": "Gorra de guarnición",+ "headwear_beret": "Boina negra",+ "headwear_service_cap": "Gorra de plato",+ "decoration_ribbon_bar": "Pasadores de servicio",+ "decoration_ribbon_rack": "Pasador completo",+ "decoration_aiguillette": "Cordón dorado",+ "decoration_medals": "Medallas de gala"},"title": {- "newcomer": "Recién llegado",- "apprentice": "Aprendiz",- "operator": "Operador",+ "private": "Soldado raso",+ "private_second_class": "Soldado",+ "private_first_class": "Soldado de primera","specialist": "Especialista",- "strategist": "Estratega",- "architect": "Arquitecto",- "commander": "Comandante",- "visionary": "Visionario",- "legend": "Leyenda",- "rookie": "Novato",- "trainee": "En prácticas",- "associate": "Asociado",- "professional": "Profesional",- "expert": "Experto",- "veteran": "Veterano",- "elite": "Élite",- "grandmaster": "Gran maestro",- "hatchling": "Cría",- "buddy": "Colega",- "sidekick": "Compañero",- "partner": "Socio",- "guardian": "Guardián",- "champion": "Campeón",- "mythic": "Mítico"+ "corporal": "Cabo",+ "sergeant": "Sargento",+ "staff_sergeant": "Sargento de estado mayor",+ "sergeant_first_class": "Sargento de primera clase",+ "master_sergeant": "Sargento maestre",+ "first_sergeant": "Sargento primero",+ "sergeant_major": "Sargento mayor",+ "command_sergeant_major": "Sargento mayor de comando",+ "sergeant_major_of_the_army": "Sargento mayor del Ejército",+ "second_lieutenant": "Subteniente",+ "first_lieutenant": "Teniente",+ "captain": "Capitán",+ "major": "Mayor",+ "lieutenant_colonel": "Teniente coronel",+ "colonel": "Coronel",+ "brigadier_general": "General de brigada",+ "major_general": "General de división",+ "lieutenant_general": "Teniente general",+ "general": "General",+ "general_of_the_army": "General del Ejército"},"source": {"chat_turn": "Terminar un turno de chat con Jarvis",@@ -1561,53 +1554,58 @@},"hall": {"title": "Sala de niveles",- "subtitle": "Tu nivel, tu equipo y lo próximo que desbloqueas",+ "subtitle": "Tu rango, tu uniforme y tu próximo ascenso",+ "ranks_body": "Todos suben la misma escala: primero tropa y suboficiales, luego oficiales, hasta cinco estrellas en el nivel 50.",+ "rank_held": "Tu rango",+ "rank_from": "Desde el nivel {0}","subject_label": "Progreso de quién","subject_you": "Tú","tab_overview": "Resumen","tab_studio": "Probador",- "tab_rewards": "Recompensas",+ "tab_rewards": "Ascensos","tab_guide": "Cómo subir de nivel","tab_team": "Equipo",+ "tab_ranks": "Rangos",+ "next_promotion_title": "Próximo ascenso",+ "ranks_all": "Todos los rangos",+ "pet_rank_only": "{0} no lleva uniforme: su rango aparece en su placa y sube con cada nivel.","loading": "Cargando niveles…","next_reward": "Próxima recompensa","all_unlocked": "Todo desbloqueado",- "next_rewards": "Lo próximo",+ "next_rewards": "Próximas piezas de uniforme","best_pieces": "Tus mejores piezas","road_all": "Todo el camino de recompensas","try_hint": "Haz clic en una recompensa para probártela en el probador.",- "next_title": "Próximo título: {0} en el nivel {1}",- "top_title": "Título más alto alcanzado",+ "next_title": "Próximo ascenso: {0} en el nivel {1}",+ "top_title": "Rango más alto alcanzado","quick_title": "XP rápida","quick_all": "Todas las formas de ganar","xp_needed": "faltan {0} XP","unlocked": "Desbloqueado","equipped": "Equipado",- "rarity": {- "common": "Común",- "rare": "Raro",- "epic": "Épico",- "legendary": "Legendario"+ "tier": {+ "enlisted": "Tropa",+ "nco": "Suboficial",+ "officer": "Oficial",+ "general": "Oficial general"},"studio_body": "Elige lo que lleva {0} en cada hueco. Lo bloqueado se puede probar.",- "studio_body_you": "Elige lo que llevas en cada hueco. Lo bloqueado se puede probar.",+ "studio_body_you": "Elige uniforme, gorra y condecoraciones. Lo bloqueado se puede probar.","slots_label": "Huecos","slot_hint": {- "frame": "El marco del número de nivel en la placa con el nombre y en la tarjeta de nivel.",- "trail": "Una estela que queda al caminar.",- "aura": "Un brillo en el suelo debajo.",- "gadget": "Un accesorio sobre o encima de la figura."+ "uniform": "Lo que llevas de servicio. La insignia de tu rango va en las mangas (tropa y suboficiales) o en las hombreras (oficiales).",+ "headwear": "La gorra, con tu rango o el emblema de tu unidad al frente.",+ "decoration": "Pasadores o medallas sobre el bolsillo izquierdo; el cordón cuelga del hombro derecho."},- "auto_hint": "Siempre la mejor pieza desbloqueada",- "none_hint": "Este hueco queda vacío",+ "auto_hint": "Siempre la mejor pieza que has desbloqueado",+ "none_hint": "Tu propia ropa en este hueco","locked_aria": "{0}, bloqueado hasta el nivel {1}. Pruébatelo.","preview_label": "{0} en el escenario del probador","drag_hint": "Arrastra para girar",- "trail_reduced": "Las estelas solo se ven en movimiento. Con el movimiento reducido, la vista previa se queda quieta.","try_on": "Prueba","try_on_line": "Se desbloquea en el nivel {0} · faltan {1} XP","try_on_back": "Volver a mi equipo",- "road_body": "Cada paso del camino trae algo nuevo. Elige uno para verlo puesto.",+ "road_body": "Cada ascenso y cada pieza de uniforme en un solo camino. Elige un paso para verte con ese rango.","road_here": "Tú · Nv {0}","reward_open": "Desbloqueado en el nivel {0}","reward_locked": "Se desbloquea en el nivel {0}",@@ -1621,8 +1619,8 @@"step1_body": "Habla con Jarvis, dale trabajo a tu equipo, explora el Verse. Cada acción cuenta.","step2_title": "Sube de nivel","step2_body": "Cuando la barra se llena, alcanzas el siguiente nivel. Cada nivel pide un poco más de XP.",- "step3_title": "Desbloquea",- "step3_body": "Los niveles nuevos traen títulos y equipo. Póntelos en el probador.",+ "step3_title": "Asciende",+ "step3_body": "Los ascensos traen piezas de uniforme reales. Póntelas en el vestuario.","cost_line": "Nivel {0}: {1} XP","section_you": "Para ti","section_pet": "Para {0}",diff --git a/tests/unit/progression/test_routes.py b/tests/unit/progression/test_routes.pyindex 563c4311fb..212d240c00 100644--- a/tests/unit/progression/test_routes.py+++ b/tests/unit/progression/test_routes.py@@ -32,7 +32,7 @@ def test_the_first_read_carries_the_whole_rulebook(client: TestClient):assert len(body["level_xp"]) == MAX_LEVEL and body["level_xp"][0] == 0assert {r["source"] for r in body["rules"]} == {r.source for r in RULES}assert {r["reward_id"] for r in body["rewards"]} == {r.reward_id for r in REWARDS}- assert body["titles"]["person"][0] == {"level": 1, "title": "newcomer"}+ assert body["titles"]["person"][0] == {"level": 1, "title": "private"}def test_a_world_action_pays_and_shows_up_in_the_next_read(client: TestClient):diff --git a/tests/unit/progression/test_rules.py b/tests/unit/progression/test_rules.pyindex 2883b35acf..3a4dda6706 100644--- a/tests/unit/progression/test_rules.py+++ b/tests/unit/progression/test_rules.py@@ -4,6 +4,7 @@ from __future__ import annotationsfrom jarvis.progression.rules import (MAX_LEVEL,+ RANKS,REWARDS,RULES,SLOTS,@@ -66,7 +67,7 @@ def test_rules_have_unique_sources_and_pay_a_known_kind():assert "daily_visit" in WORLD_ACTIONS and "chat_turn" not in WORLD_ACTIONS-def test_rewards_are_unique_and_every_kind_gets_one_per_slot_family():+def test_rewards_are_unique_and_unlock_on_a_promotion():ids = [reward.reward_id for reward in REWARDS]assert len(ids) == len(set(ids))for reward in REWARDS:@@ -75,15 +76,21 @@ def test_rewards_are_unique_and_every_kind_gets_one_per_slot_family():for kind in SUBJECT_KINDS:level = reward.level_for(kind)assert level is None or 2 <= level <= MAX_LEVEL- for kind in SUBJECT_KINDS:- slots = {r.slot for r in unlocked_rewards(kind, MAX_LEVEL)}- assert {"frame", "trail", "aura"} <= slots+ # The person can dress in every slot; agents earn decorations; the pet wears its rank only.+ assert {r.slot for r in unlocked_rewards("person", MAX_LEVEL)} == set(SLOTS)+ assert {r.slot for r in unlocked_rewards("agent", MAX_LEVEL)} == {"decoration"}+ assert unlocked_rewards("pet", MAX_LEVEL) == []+ # A person's piece unlocks exactly on a promotion, so the banner can name the new rank with it.+ promotions = {level for level, _, _ in RANKS}+ for reward in REWARDS:+ assert reward.person in promotions, reward.reward_iddef test_rewards_between_names_only_what_the_climb_crossed():- assert [r.reward_id for r in rewards_between("person", 1, 2)] == ["trail_footprints"]- at_ten = {r.reward_id for r in rewards_between("person", 9, 10)}- assert at_ten == {"frame_silver", "gadget_drone"}+ assert rewards_between("person", 1, 2) == []+ assert [r.reward_id for r in rewards_between("person", 3, 4)] == ["uniform_service_shirt"]+ at_ten = {r.reward_id for r in rewards_between("person", 7, 10)}+ assert at_ten == {"uniform_field_jacket", "decoration_ribbon_bar"}assert rewards_between("person", 10, 10) == []@@ -92,9 +99,24 @@ def test_titles_start_at_level_one_and_climb():bands = TITLES[kind]assert bands[0][0] == 1assert [lvl for lvl, _ in bands] == sorted(lvl for lvl, _ in bands)- assert title_for("person", 1) == "newcomer"- assert title_for("person", 12) == "operator"- assert title_for("pet", MAX_LEVEL) == "mythic"+ assert title_for("person", 1) == "private"+ assert title_for("person", 11) == "sergeant"+ assert title_for("agent", 26) == "second_lieutenant"+ assert title_for("pet", MAX_LEVEL) == "general_of_the_army"+++def test_the_rank_ladder_climbs_from_enlisted_to_general():+ levels = [level for level, _, _ in RANKS]+ assert levels[0] == 1 and levels[-1] == MAX_LEVEL+ assert levels == sorted(set(levels))+ grades = [grade for _, _, grade in RANKS]+ assert grades[0] == "E-1" and grades[-1] == "O-11"+ # Enlisted first, then commissioned: no officer grade before the last enlisted one.+ first_officer = next(i for i, g in enumerate(grades) if g.startswith("O-"))+ assert all(g.startswith("E-") for g in grades[:first_officer])+ assert all(g.startswith("O-") for g in grades[first_officer:])+ for kind in SUBJECT_KINDS:+ assert [rank for _, rank in TITLES[kind]] == [rank for _, rank, _ in RANKS]def test_subject_ids_name_their_kind():diff --git a/tests/unit/progression/test_service.py b/tests/unit/progression/test_service.pyindex 3d3f17a4d7..7beb106730 100644--- a/tests/unit/progression/test_service.py+++ b/tests/unit/progression/test_service.py@@ -116,7 +116,8 @@ async def test_agents_level_from_finished_work_and_quests(setup):assert levels["person"] == (15 + 20, 1)up = [e for e in seen if e.subject_id == "agent:scout" and e.level > e.previous_level]assert up and up[-1].level == 3- assert "frame_bronze" in up[-1].unlocked+ assert "decoration_ribbon_bar" in up[-1].unlocked+ assert up[-1].title == "private_second_class"async def test_the_lead_is_the_pet_never_an_agent(setup):