Commit Graph

40 Commits

Author SHA1 Message Date
simoleo89 807efcff8f merge: integrate duckietm/Dev (JSON5 + split-aware gamedata loader)
# Conflicts:
#	packages/session/src/SessionDataManager.ts
#	yarn.lock
2026-05-19 17:01:58 +02:00
medievalshell ae9bc8bfce feat(utils): split-aware gamedata loader with tiered merge
Introduces loadGamedata(url, options?) and mergeGamedata(a, b) in
@nitrots/utils. The loader transparently accepts:

- a single-file URL (legacy) -> parsed as before
- a directory URL ending with '/' -> tier-merged from core/custom/seasonal,
  each tier driven by its own manifest.json5

Merge rules:

- arrays of objects sharing an id key (id, classname, name): merged by id,
  later layers overriding earlier ones
- arrays without an id key: concatenated
- plain objects: recursive merge per key
- anything else: later value wins

All gamedata consumers (FurnitureDataLoader, ProductDataLoader,
EffectAssetDownloadManager, AvatarRenderManager actions+figuredata,
LocalizationManager) are migrated to loadGamedata. Behaviour is unchanged
for single-file URLs, so existing deployments need no config changes;
opt-in to split mode by appending '/' to the URL once the layout is in
place.

README updated with the directory layout, merge table and programmatic
usage example. The companion CLI splitter that produces the core/ tier
from legacy files lives in the Nitro V3 client repo.
2026-05-18 21:19:54 +02:00
simoleo89 761d8ffe19 feat(session): snapshot getter for UserDataManager room user list
Extends the snapshot pattern to the room's user list. The React client
currently has many widgets each calling `getUserDataByIndex(idx)` in a
loop (chat, doorbell, room player list, infostand …) — every render
walks the underlying Map and rebuilds an array. With
`getRoomUserListSnapshot(): ReadonlyArray<IRoomUserData>` consumers can
memoize on the array reference and only rebuild when something actually
changed.

Invalidation fires on every state-changing path:
- updateUserData (add/replace)
- removeUserData (leave)
- updateFigure / updateName / updateMotto / updateNickIcon /
  updateCustomization / updateBackground / updateAchievementScore /
  updatePetLevel / updatePetBreedingStatus

The inner IRoomUserData objects keep their existing in-place mutation
semantics (deep-clone would be too expensive for 30+ avatars on every
single status push). Consumers should treat each entry as a
snapshot-at-time-of-read and not retain references across an
invalidation.

New event: NitroEventType.ROOM_USER_LIST_UPDATED. Interface and event
additions are backwards-compatible; no existing accessors changed.

Also tidied: `updatePetLevel` now uses the explicit `if(!userData)
return;` guard pattern matching the rest of the methods (was a one-line
inline conditional).
2026-05-18 20:52:33 +02:00
simoleo89 a599e0cf89 feat(session): snapshot getters for IgnoredUsersManager + GroupInformationManager
Extends the v2.1.0 React-friendly snapshot pattern (originally on
SessionDataManager / RoomSessionManager) to two more session-state
holders the React client reads frequently:

- IgnoredUsersManager.getIgnoredUsersSnapshot(): ReadonlyArray<string>
- GroupInformationManager.getGroupBadgesSnapshot(): ReadonlyMap<number, string>

Both follow the same shape: lazy-frozen snapshot, cached until the
underlying state mutates, then invalidated and a dispatched event lets
the React client rebuild via useSyncExternalStore.

Two new NitroEventType members carry the invalidation signal:
- IGNORED_USERS_UPDATED — dispatched by IgnoredUsersManager whenever
  the list changes (initial load, add, remove, queue-truncate case 2).
- GROUP_BADGES_UPDATED — dispatched by GroupInformationManager only
  when the incoming HabboGroupBadges payload contains at least one
  new or changed mapping (no-op refresh stays quiet).

This lets the user-info popup, profile page, friend/guild filtering,
and any other consumer share a single read through useSyncExternalStore
instead of each subscribing to the underlying message events
independently.

API additions are interface-respecting and backwards-compatible — the
existing `isIgnored(name)` / `getGroupBadge(groupId)` accessors stay
untouched.
2026-05-18 20:50:24 +02:00
duckietm 31df26bd1b 🆕 Added support for JSON5 2026-05-18 16:14:38 +02:00
simoleo89 22d4e5bfb0 SocketConnection parser cast + RoomChatHandler arg-order fix
- SocketConnection.processMessage() did 'new events[0].parserClass()'
  where parserClass is typed as 'Function' on IMessageEvent (no
  construct signature). Cast to 'new () => IMessageParser' at the
  call site so the spawned instance is type-correct downstream.
- RoomChatHandler dispatched RoomSessionChatEvent with the args in
  the wrong order: '[]' (intended as the 'links' array) was landing
  in the 'chatColours' string slot. Swap to '"", []' so links go
  to position 8 and chatColours stays a string.
2026-05-11 21:10:04 +02:00
simoleo89 08d1efafbe Drop dead sendWhisperGroupMessage — composer never existed
IRoomSession.sendWhisperGroupMessage(userId) was declared in the
interface and implemented in RoomSession by sending 'new
ChatWhisperGroupComposer(userId)' — but no such composer class
exists in the renderer (the file was never created). The only
whisper composer is RoomUnitChatWhisperComposer, which takes
(recipientName, message, styleId), not a userId.

No client call site references sendWhisperGroupMessage (grep across
Nitro-V3/src returned zero hits). Removing the dead interface method
+ broken impl is safer than inventing a ChatWhisperGroupComposer
class with no server-side handler.
2026-05-11 21:09:31 +02:00
simoleo89 ddb7222b66 chore: bump TypeScript pins to ^6.0.3 across all 12 workspaces + thumbmarkjs 1.9 + add CLAUDE.md
Each workspace package was still pinning `typescript: ~5.5.x` or
`~5.8.2` in its own devDependencies even though the root bumped to 6.0.3
in 60b1143. The pins were dead (yarn 1 hoists from root) but they're
misleading when reading a single package.json. Bring them all to
`^6.0.3` to match the root.

Other:
- @thumbmarkjs/thumbmarkjs 1.8.1 → 1.9.0 (root + communication package)
- yarn.lock regenerated from a clean install (vitest 4 hoisting was
  flaking on the patch vite bump; reverted vite to ^8.0.10)

Adds CLAUDE.md at the repo root: short project context for future
sessions — stack, the 12-workspace layout, the React-friendly v2.1.0
additions (`subscribe()`, `subscribeMessage()`, snapshot getters), build
scripts, and known gotchas (`SessionDataManager.getUserData` does NOT
exist; sendChat* expects 3 args; dispatchEvent is sync).
2026-05-10 21:29:50 +02:00
simoleo89 87cf47847c feat(events,session): add React-friendly subscribe APIs and snapshot getters
Adds backwards-compatible primitives needed to consume the renderer from
React 19 hooks (useSyncExternalStore, use(), TanStack Query) without
re-architecting the event bus.

- EventDispatcher.subscribe(type, cb): () => void — unsubscriber-returning
  wrapper matching the useSyncExternalStore subscribe signature.
- CommunicationManager.subscribeMessage(eventCtor, handler): () => void —
  packet-stream equivalent.
- SessionDataManager.getUserDataSnapshot() and
  RoomSessionManager.getActiveRoomSessionSnapshot() — referentially-stable
  read-only views invalidated through new SESSION_DATA_UPDATED and
  ROOM_SESSION_UPDATED events.

All additive; existing addEventListener/removeEventListener / IRoomSession
APIs are unchanged. Bumps renderer to 2.1.0.
2026-05-10 19:16:32 +02:00
Lorenzune 5fc4564467 Merge remote-tracking branch 'duckie/main' into merge-duckie-main-2026-05-06
# Conflicts:
#	packages/communication/src/messages/parser/room/unit/RoomUnitInfoParser.ts
#	packages/communication/src/messages/parser/user/data/UserProfileParser.ts
#	packages/events/src/session/RoomSessionUserFigureUpdateEvent.ts
#	packages/session/src/handler/RoomUsersHandler.ts
2026-05-06 04:23:13 +02:00
duckietm 2f7b80e894 🆕 Card Background 2026-05-04 08:44:40 +02:00
duckietm 2a707c3b8d 🆙 Cleanup log in console 2026-04-28 09:41:37 +02:00
Lorenzune 7bf552824f Sync renderer safety push 2026-04-21 08:57:35 +02:00
duckietm fd74fd323b 🆙 Some minor mem tweaks 2026-03-31 16:03:21 +02:00
Lorenzune 99c4acea38 Expose room, user and furni metadata for wired tools
- parse extra room snapshot data such as hotel time, room item limit and group context

- expose richer furni metadata including flags, dimensions and teleport targets

- expose richer user metadata including room-entry fields and ids needed by inspection tools

- keep session and room engine models aligned with the new wired monitor/inspection flow
2026-03-27 09:37:14 +01:00
duckietm 4701c0b153 🆙 Automatic resume / reconnect when conection was lost 2026-03-23 13:24:32 +01:00
Lorenzune 10b3d64ee0 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	packages/communication/src/NitroMessages.ts
2026-03-21 14:49:08 +01:00
DuckieTM f198fbfb99 Merge pull request #10 from simoleo89/feature/custom-prefix-system-clean
feat: Custom Prefix System (Renderer)
2026-03-21 08:46:44 +01:00
simoleo89 68af013c60 feat: custom prefix system protocol layer
Prefix parsers, composers and events:
- UserPrefixesParser, PrefixReceivedParser, ActivePrefixUpdatedParser
- PurchasePrefixComposer, SetActivePrefixComposer, DeletePrefixComposer, RequestPrefixesComposer
- RoomUnitChatParser reads prefixText/Color/Icon/Effect from chat packets
- RoomSessionChatEvent carries prefix data to client
- RoomChatHandler passes prefix fields through event chain
2026-03-20 17:22:50 +01:00
duckietm 4e41e9db5c 🆙 Stage 2 reconnect 2026-03-20 17:10:56 +01:00
duckietm 958693fe2e 🆙 Stage 1 reconnect 2026-03-20 16:06:03 +01:00
duckietm 5aef7a3de2 🆕 Disconnection handler, when you got disconnected you automatic go back to the room 2026-03-19 15:04:47 +01:00
DuckieTM 8653f1f499 Merge pull request #2 from Lorenzune/pr/room-chat-extra-params-20260318
fix(session): forward room chat extra params
2026-03-19 09:52:33 +01:00
duckietm 5b139dfef8 🆙 Update better error handeling 2026-03-19 09:40:49 +01:00
Lorenzune c328a12533 fix(session): forward room chat extra params 2026-03-18 17:03:25 +01:00
Lorenzune 4d6c14ea82 fix(session): forward room chat extra params 2026-03-18 17:01:10 +01:00
duckietm 7582255fe3 🆙 Fixed groupbadges 2026-02-20 16:38:16 +01:00
duckietm 9f3eb783fc 🆙 Groupbadges loading fix 2026-02-20 11:49:33 +01:00
DuckieTM eb4fe80612 🆙 Updates
- Added Test Coverage
- Fix Potential Memory Leaks
2026-01-31 13:21:59 +01:00
duckietm 476f71a482 🆙 Add backgrounds to renderer 2025-05-22 10:31:31 +02:00
duckietm 7c40e69c75 🆙 added Backgrounds to the renderer 2025-05-20 14:16:05 +02:00
DuckieTM d864fe3018 🆙 Update Deps. + WiP 2025-03-15 14:54:10 +01:00
DuckieTM beac15e20a 🆙 Even more updates 2025-03-09 11:56:32 +01:00
DuckieTM 791309ff73 🆙 More Updates 2025-03-09 11:45:21 +01:00
DuckieTM 70b1d232d5 🆙 Update dependencies 2025-03-09 10:39:43 +01:00
duckietm 14bf0fdcbd 🆙 Fix firework memory leak and update pixi.js 2024-09-13 08:04:35 +02:00
duckietm bd09ea8b25 🆙 added latest changes 2024-07-04 15:03:26 +02:00
duckietm d5a3a05c40 Updated the renderer V2 2024-04-25 11:35:50 +02:00
duckietm 95bc0045ec Added Color to the Renderer and Avatar update 2024-04-04 09:26:05 +02:00
duckietm b3134ce50b Move to Renderer V2 2024-04-03 09:27:56 +02:00