Commit Graph

775 Commits

Author SHA1 Message Date
medievalshell 49836bbeef feat: branding furni image position editor (move + scale)
Adds an "Editor Posizione" button to the furni infostand action bar for
branding / MPU furni, opening a dialog to position and zoom the image:
- draggable dot moves offsetX/Y (live, local preview only)
- slider zooms the image (scale, via the renderer's per-sprite scale)
- offsetZ kept as z-index; Save persists + broadcasts via SetObjectData
- radio "Live" + all editor labels go through LocalizeText (external texts)

Pairs with the renderer branding scale/offset support and Arcturus' `scale`
default on InteractionRoomAds.
2026-05-28 15:33:05 +02:00
duckietm bade7e2623 🆙 Update texts to use JSON5 and added all text 2026-05-28 15:25:27 +02:00
duckietm e7088595df 🆙 Small update 2026-05-28 14:05:09 +02:00
DuckieTM c7ae4907ad Merge pull request #171 from medievalshell/Dev
feat: rare values panel + fortune wheel UI + prize editor + feat: soundboard (room-scoped custom audio pads) + feat: hotel radio widget (client-side, multi-station)
2026-05-28 13:49:52 +02:00
DuckieTM 475c71af2e Merge branch 'Dev' into Dev 2026-05-28 13:49:43 +02:00
duckietm 05d71dd163 🆙 Small fix for the navigator
This mirrors what the old god-hook used to do and what the rest of the codebase still uses for everything else. The TanStack one-shot listener pattern (awaitNitroResponse registers a listener, awaits one matching response, removes itself) is fragile against renderer-bundle quirks — the parser fires but the listener never matches, so the promise never resolves and query.data stays undefined forever. That's exactly the symptom you saw: server logs show the response arriving, client UI stays blank.
2026-05-28 13:46:44 +02:00
DuckieTM 566d1f655b Merge pull request #170 from simoleo89/feat/navigator-p2-query
feat(navigator): TanStack Query for search (P2)
2026-05-28 13:19:39 +02:00
DuckieTM f9914c4458 Merge pull request #172 from duckietm/Dev
Dev
2026-05-28 13:19:09 +02:00
DuckieTM 30039feb31 Merge branch 'Dev' into feat/navigator-p2-query 2026-05-28 13:06:05 +02:00
DuckieTM eef436f65c Merge pull request #169 from simoleo89/feat/navigator-p5-error-boundaries
feat(navigator): wrap sub-views in WidgetErrorBoundary
2026-05-28 13:05:12 +02:00
DuckieTM 8e46eae3d0 Merge pull request #168 from simoleo89/feat/navigator-modernization
feat(navigator): wired-tools-style hook split + Zustand UI store (P1)
2026-05-28 13:04:48 +02:00
duckietm 69042451e6 🆕 Added the option turn in menu for BOT 2026-05-28 13:01:11 +02:00
medievalshell acb3dd7ef1 feat: hotel radio widget (client-side, multi-station)
Adds a compact collapsible radio widget (top-left) that plays internet
radio streams with the HTML5 Audio API — no server/renderer changes.

- station list loaded from a JSON5 config file (loadGamedata: JSON + JSON5),
  shipped as radio-stations.json5.example so each hotel fills in its own
- shows the selected station + a dropdown (3 visible, scrolls if more) to
  switch; volume slider; animated equalizer + LIVE indicator
- first station autostarts quietly (5%) on load, with a resume-on-first-
  gesture fallback for browser autoplay policy
2026-05-28 10:20:15 +02:00
medievalshell 4833ab8447 feat: soundboard pads can load from a JSON5 file (DB fallback)
When the server (soundboard_sounds table) returns no pads, the client now
loads them from a JSON5 config file (loadGamedata accepts plain JSON and
JSON5). Useful when the DB / CMS isn't set up yet.

File-defined pads play locally for the clicker; DB-backed pads still go
through the server broadcast so everyone in the room hears them. Ships a
radio-style soundboard-sounds.json5.example template.
2026-05-28 10:19:16 +02:00
medievalshell 48ed3ad7ba fix: show furniture-occupied tiles in the floor plan editor
The editor never requested occupied tiles, so tiles holding furniture
were indistinguishable from empty floor and could be edited/voided.

- request GetOccupiedTilesMessageComposer when the editor opens
- handle RoomOccupiedTilesMessageEvent -> SET_OCCUPIED_TILES
- new Tile.occupied flag (kept separate from `blocked`/void): occupied
  tiles render with a distinct marker and are protected from PAINT/
  ERASE/ADJUST and brush-to-selection edits
- occupied is purely informational and never changes the saved tilemap
  (no accidental voiding of floor under furni)

Tests: reducer cases for SET_OCCUPIED_TILES + edit protection; container
test asserts the occupied event is non-destructive on save; route the
canvas pointer test through elementFromPoint (jsdom has no getScreenCTM).
2026-05-28 09:20:20 +02:00
medievalshell 7a65e5bf6d feat: soundboard (room-scoped custom audio pads)
Client side of the soundboard. Room owners enable it in Room Settings >
Misc (next to the YouTube TV toggle). When enabled, a soundboard icon
appears in the toolbar for everyone in the room; pressing a pad broadcasts
the sound so all occupants hear it. Incoming SoundboardPlay is played via
the HTML5 Audio API.

Also: fix FloorplanCanvasSVG to use ReactElement instead of the removed
global JSX namespace (React 19), and pair the client Dev branch with the
renderer fork that carries the custom features in CI.

How sounds are managed (works with any CMS):
Sounds are rows in the `soundboard_sounds` table:
    id, name, url, enabled, sort_order
The emulator loads every row with enabled=1 (ordered by sort_order, id)
and sends the list to clients on room enter; the client plays `url`
directly, so any publicly reachable audio URL works (mp3/ogg/wav).

To add a sound from an admin/housekeeping panel of any CMS:
  1. Upload the audio file to wherever the CMS stores public assets
     (same approach as custom badge images).
  2. INSERT a row into `soundboard_sounds` with the display name and the
     public URL of the uploaded file, enabled = 1.
  3. Reload the emulator soundboard (or restart) to pick it up.
Relative urls resolve against the `soundboard.url.prefix` config key
(falls back to `asset.url`); absolute urls are used as-is.
2026-05-28 09:04:17 +02:00
medievalshell 61aceaa422 feat: rare values panel + fortune wheel UI + prize editor
Toolbar buttons, FortuneWheelView (animated wheel, prize icons, recent winners),
RareValuesView (diamond price guide + staff prize-editor tab), furni infostand
value line, useFortuneWheel/useRareValues hooks, it/en text examples.
2026-05-28 02:39:02 +02:00
simoleo89 26772f7073 feat(navigator): drive search via TanStack Query + setTab/setFilter UI store
NavigatorView reads searchResult/isFetching from useNavigatorSearch
instead of useNavigatorData/useNavigatorUiState. Tab clicks call
setTab(code) on the UI store, which atomically updates the query key
and triggers refetch. The 4 lifecycle useEffect blocks driving the
old imperative flow (needsSearch / reloadCurrentSearch / markReady)
are removed — the query handles all of it now.

NavigatorSearchView has a debounced (300ms) onChange -> setFilter
that drives the same query refetch. Explicit submit (Enter / button)
skips the debounce and calls setFilter immediately.

linkTracker case 'search' now setTab + setFilter + show — no more
pendingSearch ref.

useNavigatorSearch.test.tsx: cast constructors as any to satisfy tsgo
against real renderer types while keeping runtime stubs no-arg-safe.

yarn typecheck / test / lint:hooks all clean (only pre-existing
floorplan environmental failures).
2026-05-27 19:25:30 +02:00
simoleo89 ee3736474d refactor(navigator): remove search ownership from useNavigatorStore
P2 core surgery: search result + NavigatorSearchEvent listener +
sendSearch + reloadCurrentSearch all leave useNavigatorStore. The new
useNavigatorSearch query hook owns the cache. useNavigatorActions is
deleted entirely — the only two actions it exposed are gone, and no
consumer outside Navigator depended on it.

NavigatorMetadataEvent handler now seeds the UI store's currentTabCode
on first arrival, activating the query the moment top-level contexts
land.

useNavigatorData: searchResult removed from closure and return.
useNavigatorUiState: currentTabCode + currentFilter added.
index.ts: useNavigatorActions removed, useNavigatorSearch added.

NavigatorView.tsx is intentionally broken at this commit and gets
fixed in the next.
2026-05-27 19:20:27 +02:00
simoleo89 7435326dad feat(navigator): useNavigatorSearch query hook (P2 core)
useNitroQuery keyed on [currentTabCode, currentFilter] from
navigatorUiStore. Fires NavigatorSearchComposer; subscribes to
NavigatorSearchEvent with an accept-filter that rejects results whose
code does not match the current tab. Invalidates on FlatCreatedEvent
and RoomSettingsUpdatedEvent for server-driven refresh.

nitro-renderer.mock.ts: add connection.send stub to GetCommunication
so SendMessageComposer (which calls GetCommunication().connection.send)
does not throw in tests that exercise useNitroQuery.

TDD: 7 cases incl. enabled-gating, accept-filter rejection on
mismatched tab, invalidator round-trip.
2026-05-27 19:18:24 +02:00
simoleo89 8f1b664b2f feat(navigator): add currentTabCode + currentFilter to UI store (P2 prep)
setTab(code) atomically updates currentTabCode and resets currentFilter
to '' — switching tabs starts a fresh search context. setFilter(value)
updates only the filter — the user is typing in the same tab.

TDD: 3 new cases (16 total in navigatorUiStore.test).
2026-05-27 19:15:08 +02:00
simoleo89 1810a86618 docs(navigator): P2 TanStack Query design + integrated plan
Combines spec + 5-task plan into a single doc for faster execution.
Branch: feat/navigator-p2-query (forked from feat/navigator-modernization
P1 tip). Migrates search from event-driven imperative state to
useNitroQuery with cache per [tabCode, filter], invalidator on
FlatCreatedEvent + RoomSettingsUpdatedEvent, accept-filter that rejects
mismatched-tab server pushes.

Key API changes: useNavigatorActions DELETED (sendSearch +
reloadCurrentSearch gone); useNavigatorData no longer returns
searchResult; navigatorUiStore adds currentTabCode + currentFilter +
setTab + setFilter; new useNavigatorSearch hook returns the
{ searchResult, isFetching, refetch } triple.
2026-05-27 19:11:31 +02:00
simoleo89 d5b0743382 feat(navigator): wrap sub-views in WidgetErrorBoundary
Each of the 5 Navigator sub-views (RoomCreator, DoorState, RoomInfo,
RoomLink, RoomSettings) is now wrapped in its own WidgetErrorBoundary so
a crash inside one no longer takes down the others. Matches the pattern
already applied to the 13 room widgets + 20 furniture widgets.

Zero behavioural change in the happy path. yarn typecheck +
yarn test --run + yarn lint:hooks all clean (only the 3 pre-existing
floorplan failures remain, unrelated to Navigator).
2026-05-27 19:08:38 +02:00
simoleo89 1148c0a628 refactor(navigator): remove deprecated useNavigator god-hook
P1 complete. All 13 consumers migrated to the wired-tools-style split:
- useNavigatorData / useNavigatorUiState / useNavigatorActions (filters)
- useNavigatorStore (internal useBetween closure with sendSearch + reloadCurrentSearch)
- navigatorUiStore (Zustand for 9 UI flags)
- useDoorState (extracted to src/hooks/rooms/widgets)

Spec: docs/superpowers/specs/2026-05-26-navigator-modernization-p1-design.md
Plan: docs/superpowers/plans/2026-05-26-navigator-modernization-p1.md

Next phases (separate specs/plans): P2 (TanStack Query for search),
P3 (reactive favourites via snapshot), P4 (visual rework + virtualization
+ persistence).
2026-05-27 19:01:48 +02:00
simoleo89 1d580e6d24 refactor(navigator): migrate all 13 consumers off useNavigator god-hook
Mechanical swap to the new filter hooks landed in the previous commits:
- NavigatorDoorStateView -> useDoorState (snapshot/setSnapshot/reset)
- NavigatorView -> useNavigatorData + useNavigatorUiState +
  useNavigatorActions + direct useNavigatorUiStore.getState() in handlers
  (linkTracker collapsed to a dispatch table; 9 useState gone)
- NavigatorSearchView -> useNavigatorData + useNavigatorActions
  (sendSearch prop drilling removed)
- NavigatorSearchResultItemView -> useDoorState (setSnapshot aliased as
  setDoorData; call sites unchanged - DoorStateSnapshot is compatible)
- 9 bulk consumers (one-line import swap) -> useNavigatorData

Zero behavioural change intended. yarn typecheck + yarn test --run +
yarn lint:hooks all clean on this commit.
2026-05-27 18:58:03 +02:00
simoleo89 3c10ccdaee fix(navigator): restore useNotification() inside useNavigatorStore
Commit 8ab0021a introduced an unjustified deviation: it removed the
useNotification() call from inside useNavigatorStore and replaced it
with a module-level _simpleAlert ref + _injectSimpleAlert() exported
function, on the theory that nested useBetween calls corrupt
use-between's state.

That diagnosis is wrong. Production proof:
- useCatalog.ts:56 calls useNotification() inside useCatalogStore
- useWiredToolsStore.ts:131 calls useNotification() inside its store
- The original useNavigator.ts:32 calls useNotification() inside its
  state closure
All three have been in production for ages without issue. Nested
useBetween calls work fine.

The smoke-test failure that prompted the workaround was a mock issue,
not a real bug. Reverting to the standard pattern — useNotification()
direct inside the useBetween store closure. Production alerts work
again immediately without requiring an explicit injection call from
consumers.

Mock additions (src/nitro-renderer.mock.ts):
- Added 23 notification MessageEvent subclasses (AchievementNotification-
  MessageEvent, ActivityPoint..., BadgeReceived, ClubGiftNotification,
  ClubGiftSelected, ConnectionError, HabboBroadcast, HotelClosedAndOpens,
  HotelClosesAndWillOpenAt, HotelWillCloseInMinutes, InfoFeedEnable,
  MaintenanceStatus, ModeratorCaution, ModeratorMessage, MOTD,
  NotificationDialog, PetLevel, PetReceived, RespectReceived, RoomEnter,
  SimpleAlert, UserBanned, WiredRewardResult) so useNotificationStore
  can register its listeners without throwing.
- Added RoomEnterEffect stub (isRunning: false, totalRunningTime: 0).
- Added WiredRewardResultMessageEvent static constants.
2026-05-27 18:50:40 +02:00
simoleo89 8ab0021af6 feat(navigator): wired-tools-style hook split (Store + 3 filters)
Splits the 492-line useNavigator god-hook into a useBetween-backed
useNavigatorStore closure plus three flat-shape filters
(useNavigatorData, useNavigatorUiState, useNavigatorActions), mirroring
the wired-tools layout. sendSearch + reloadCurrentSearch are extracted
as named actions out of NavigatorView locals.

Door-mode handling is removed from this store and lives in useDoorState
(committed previously) - see GetGuestRoomResultEvent and
GenericErrorEvent dual-subscription with mutually exclusive filters.

The simpleAlert dependency is lifted out of the useBetween scope via a
module-level _simpleAlert ref + _injectSimpleAlert() to avoid nested
useBetween calls that corrupt use-between's module-level dispatcher
state. The ref is null in tests (no events fire during smoke tests) and
is populated in production by the navigator consumer before any alert
is needed.

The barrel index.ts no longer re-exports useNavigator. The 13 consumers
will fail typecheck until the next commit migrates them; the hook files
themselves are clean. Smoke test covers filter shapes.

INTENTIONAL INTERMEDIATE-BROKEN COMMIT: yarn typecheck is RED at this
SHA on the 13 consumer files. The next commit (consumer migration sweep)
brings it back to green.
2026-05-27 18:44:24 +02:00
Life fac2878bc8 Merge branch 'duckietm:main' into feat/navigator-modernization 2026-05-27 18:32:42 +02:00
DuckieTM a8cf1060e1 Merge pull request #167 from duckietm/Dev
Dev
2026-05-27 15:37:26 +02:00
duckietm 00fbdc6f6d 🆙 Small update toolbar 2026-05-27 15:37:09 +02:00
DuckieTM 7054567e92 Merge pull request #164 from simoleo89/fix/toolbar-desktop-breakpoint-1700
fix(toolbar): bump desktop layout breakpoint to 1700px to avoid icon clip
2026-05-27 13:51:06 +02:00
duckietm b1244cbd5a 🆙 Fix BOTS in catalog and inventory 2026-05-27 13:42:11 +02:00
DuckieTM dc93c72e23 Merge pull request #166 from duckietm/Dev
🆕 Added Pickup furni to the floorplan
2026-05-27 09:41:58 +02:00
duckietm a52a4a024a 🆕 Added Pickup furni to the floorplan 2026-05-27 09:39:08 +02:00
DuckieTM ebd2f739bb Merge pull request #165 from duckietm/Dev
🆙 Enable back the live previes of the floorplan
2026-05-27 07:46:33 +02:00
duckietm acf870ff6a 🆙 Enable back the live previes of the floorplan 2026-05-27 07:46:10 +02:00
simoleo89 f97650d7f6 fix(rooms): useDoorState handles roomEnter reset + test-order isolation
Code review of Task 2 (commit 07bbc0c7) found two real issues:

1. The GetGuestRoomResultEvent handler did not handle parser.roomEnter,
   so after the consumer migration (Tasks 5-8) a successful room entry
   would no longer dismiss the door dialog. Fix: reset to INITIAL when
   parser.roomEnter is true, before the roomForward branch.

2. The test suite was order-dependent — the useBetween singleton
   persisted state across tests, so 'exposes the initial NONE snapshot'
   passed only because it ran first. Fix: beforeEach renders the hook
   once, calls reset(), then unmounts; afterEach calls cleanup().

Plus one new test case verifying the roomEnter -> reset behavior.
2026-05-26 21:54:31 +02:00
simoleo89 07bbc0c78d feat(navigator): extract useDoorState (TDD) – Task 2
- Add `src/hooks/rooms/widgets/useDoorState.ts`: useBetween-based
  singleton wrapping DoorbellMessageEvent / RoomDoorbellAcceptedEvent /
  FlatAccessDeniedMessageEvent / GenericErrorEvent /
  GetGuestRoomResultEvent; all 5 handlers wrapped in useCallback([])
  so their references are stable across useBetween tick() calls and
  the effect dep-array never triggers re-registration.
- Add `src/hooks/rooms/widgets/useDoorState.test.tsx`: 11-case Vitest
  suite (initial state, 5 event transitions, 2 no-op guards,
  GetGuestRoomResultEvent doorbell/password paths, reset()).
- Extend `src/nitro-renderer.mock.ts`: new MessageEvent base class with
  callBack/type/getParser; DoorbellMessageEvent / RoomDoorbellAcceptedEvent /
  FlatAccessDeniedMessageEvent / GenericErrorEvent / GetGuestRoomResultEvent
  concrete stubs; RoomDataParser.DOORBELL_STATE + PASSWORD_STATE; separate
  msgListeners map (cleared independently of NitroEvent listeners so
  useBetween subscriptions survive between test cases); WeakMap wrapper
  for correct removeMessageEvent; GetCommunication routes to msgListeners.

All 11 useDoorState tests pass; full suite 453/456 (3 pre-existing
FloorplanCanvasSVG jsdom/SVG-CTM failures unrelated to this task).
2026-05-26 21:35:52 +02:00
Life 1f0cf88344 Refine descriptions and comments in CI workflow
Updated descriptions for workflow_dispatch inputs and improved comments for clarity.
2026-05-26 20:46:36 +02:00
simoleo89 1868559d62 feat(navigator): Zustand UI store for panel-visibility + lifecycle flags
Hoists the 9 useState in NavigatorView (isVisible, isReady, isCreatorOpen,
isRoomInfoOpen, isRoomLinkOpen, isOpenSavesSearches, isLoading, needsInit,
needsSearch) into a createNitroStore-backed Zustand store with named
actions. Future linkTracker / lifecycle wiring will call these actions
instead of mutating local component state.

TDD: 14 cases on each action's transitions + idempotency.
2026-05-26 20:43:01 +02:00
simoleo89 cee3a2a457 docs(navigator): P1 implementation plan (9 tasks, TDD where applicable)
Bite-sized tasks with exact code blocks:
- Task 1: navigatorUiStore (TDD, 14 cases)
- Task 2: useDoorState extraction (TDD, 11 cases incl. dual-subscription filters)
- Task 3: useNavigatorStore internal closure (move all non-door listeners + new actions)
- Task 4: 3 filters + barrel rewrite + smoke test
- Tasks 5-8: 13 consumer migrations (atomic commit)
- Task 9: delete useNavigator.ts + final verification (typecheck/test/lint/manual)

Each commit is a green stopping point except Task 4 step 8 (intentional
intermediate-broken commit while consumers still import the removed
useNavigator export from the barrel). Tasks 5-8 land atomically to close
that gap in the next commit.
2026-05-26 20:38:59 +02:00
Life 6f23b274ce Merge branch 'duckietm:main' into feat/navigator-modernization 2026-05-26 20:32:07 +02:00
simoleo89 66062c64ea docs(navigator): P1 modernization design (hook split + UI store)
First of four planned phases reworking the Navigator on a clean
origin/Dev base. P1 is pure refactor (zero visible change): split
the 492-line useNavigator god-hook into wired-tools-style filters
(useNavigatorData / useNavigatorUiState / useNavigatorActions),
extract door lifecycle to useDoorState under src/hooks/rooms/widgets,
hoist the 9 local useState in NavigatorView into a Zustand
navigatorUiStore, migrate all 13 active consumers, and delete the
shim.

The Zustand UI store uses per-key selectors in useNavigatorUiState
to match createNitroStore's documented convention ("subscribe to
specific slices only").

Spec also anchors the visual rework (P4) target so architecture
decisions in P1 align with where we are heading: rich empty states,
card hover-reveal, saved-search chip row, filter intent chips,
sticky section headers, skeleton loaders.

Out of scope for P1 (each gets its own future spec): TanStack Query
migration of search (P2), reactive favourites/snapshot pattern (P3),
virtualization + empty states + persistence + chips (P4), Form
Action on search input (P6), WidgetErrorBoundary wrap (P5,
parallel-eligible).
2026-05-26 20:31:31 +02:00
Life 3e0813921b Merge branch 'duckietm:main' into fix/toolbar-desktop-breakpoint-1700 2026-05-26 20:28:04 +02:00
simoleo89 6022911448 fix(toolbar): bump desktop layout breakpoint to 1700px to avoid icon clip
The left-nav container is `max-w-[calc(50vw-242px)]` (reserves the chat
frame width) and uses `overflow-x: clip`. With the full icon set
(habbo, rooms, game, catalog, buildersclub, inventory, ME, wired-tools,
camera, youtube, modtools, furnieditor, housekeeping) the icons exceed
the available 528-608px around the 1540-1700px viewport range, so the
last icons get silently clipped on the right.

Raising the desktop breakpoint from 1540px to 1700px makes the client
fall back to the mobile-scrollable layout (`.tb-bar-scroll`) below
1700px, which scrolls horizontally and doesn't clip.

Above 1700px the desktop fixed-icon layout still applies, now with
enough horizontal room for every icon even with mod+HK enabled.

Touch devices are unaffected (already forced onto the mobile layout
via `pointer: coarse`).
2026-05-26 19:27:38 +02:00
DuckieTM 82542a7d2b Merge pull request #163 from duckietm/Dev
🆙 Small fix Floorplanner
2026-05-26 17:16:31 +02:00
duckietm d5d5ca59a8 🆙 Small fix Floorplanner 2026-05-26 17:16:14 +02:00
DuckieTM 828bb5b605 Merge pull request #162 from duckietm/Dev
Dev
2026-05-26 16:38:23 +02:00
duckietm bf0a73eaf8 🆕 Brand new Floorplan 2026-05-26 16:38:01 +02:00
DuckieTM 4f0a8be2b0 Merge pull request #158 from simoleo89/pr/floor-editor-modernization
feat(floorplan-editor): React rewrite + live in-room preview + UX polish
2026-05-26 13:21:29 +02:00