mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-12-05 19:01:04 +00:00
* fix(audio,client): start music immediately on login/track change and remove non-HD tooltip jitter Eliminates artificial client-side music start and fade-out delays across all platforms, prioritizes music packets at the start of server login, and replaces jittery non-HD hover tooltips in Game.java. ### Core & Client Rendering - 2006Scape Client/src/main/java/Game.java: - Updated method49() to call method853(musicVolume2, is, aBoolean995) directly on all platforms instead of routing through method684/method899 fade-out queues. - Reset anInt720 to 0 in constructMusic(), method853(), and method368() when stopped so the initial track and post-login music start without a 20-tick (~400ms) delay. - Replaced the non-HD chatTextDrawingArea.method390(..., loopCycle / 1000, ...) fallback with chatTextDrawingArea.textLeftShadow(...) so Walk here and hover tooltips render crisply with HD disabled. ### Server Login Audio - 2006Scape Server/src/main/java/com/rs2/net/PacketSender.java: - Moved music/sound volume configs (168, 169), player.getPlayList().sendMusicConfigs(), and Music.playMusic(player) to run right after frame 249 and duplicate-login checks in loginPlayer(), flushing the login song before quest, skill, sidebar, and equipment packets. * refactor(ui): use ClientSettings.SERVER_NAME in Plugin Hub modal title Replaces the hardcoded RUNELITE prefix in the Plugin Hub modal header with ClientSettings.SERVER_NAME so the UI branding stays consistent with the configured server name. ### UI & Styling - 2006Scape Client/src/main/java/PluginPanelUI.java: - Updated drawViewportModal title formatting to use ClientSettings.SERVER_NAME + " PLUGIN & SCRIPT HUB" (and " PLUGIN HUB" when scripts are unavailable). * feat(client): migrate Ground Items and Menu Entry Swapper plugins to online repository Removes the built-in `GroundItemsOverlayPlugin` and `MenuEntrySwapperPlugin` classes from the client bundle so players install them manually from the Online Repo tab (`2006scape-plugins`), and adds minimal `ScriptInterpreter`, `PluginContext`, and `PluginGraphics` host support so both plugins run natively in the interpreted plugin dialect. ### Plugin Host Infrastructure - `ScriptInterpreter.java`: - Added `@defaultEnabled` metadata parsing (`ScriptMetadata.defaultEnabled`) and overrode `InterpretedPlugin.isEnabledByDefault()`. - Registered `MenuEntry.class` in `compile(String)` so interpreted plugins can invoke `MenuEntry.stripColorTags(...)` and menu entry helpers. - Overrode `InterpretedPlugin.onCommand(String, String[])` to forward chat commands (`command`, joined `args`) to interpreted plugins. - `PluginContext.java`: - Added `createList()` and `createMap()` collection helpers for interpreted plugins. - `PluginGraphics.java`: - Added `worldToScreenList(int, int, int)` returning a 2-element `List<Integer>` for array-free coordinate projection. ### Cleanups & Deprecations - `PluginManager.java`: - Removed `MenuEntrySwapperPlugin` and `GroundItemsOverlayPlugin` registrations from `registerBuiltIns()`, leaving `Hd317Plugin`. - `MenuEntrySwapperPlugin.java`, `GroundItemsOverlayPlugin.java`: - Removed built-in plugin classes (migrated to `2006scape-plugins/plugins/MenuEntrySwapper.java` and `GroundItems.java`). * perf(plugins): optimize ScriptInterpreter/PluginContext and fix Web Online Repo SHA lookup Improve script/plugin execution speed for TeaVM/Web and Desktop/Android, add throttled in-game chat error reporting, and fix Online Repo commit SHA resolution on Web. ### Script & Plugin Engine - `PluginContext.java` - Added `getGroundItems(int radius)` to scan only `[plx - radius, plx + radius]` x `[ply - radius, ply + radius]` instead of the full 104x104 tile grid, with a `game == null` fallback to `getGroundItems()` for unit test mocks. - `ScriptInterpreter.java` - Pre-parsed `FunctionDef` bodies into `List<Stmt>` (`parseBlock`, `parseIfStatement`, `parseSimpleStatement`) at compile time, removing per-execution substring scanning in `executeStmts`. - Added `METHOD_CACHE` (`getCachedMethods`) to index public methods by lowercase name per `Class<?>`, eliminating repeated `clazz.getMethods()` scans in `invokeReflectiveMethod`. - Added `Environment.reportedErrors` and `reportRuntimeError` to surface the first uncaught runtime error per function to in-game chat. - `PluginManager.java` - Added `reportedPluginErrors` (cleared on `reloadExternal()`) and `reportPluginError` across `onGameTick`, `onPostBuildMenu`, and `onRenderOverlays` to surface the first error per plugin/phase to in-game chat. ### Online Repository - `PluginRepoClient.java` - Added `REPO_COMMIT_API_URL` using `PLUGIN_REPO_SLUG` (`2006-Scape/Client-Extensions`) and `PLUGIN_REPO_BRANCH` (`main`) as a CORS-friendly fallback in `resolveLatestMainSha()` when `.git/info/refs` is unavailable in the browser. * perf(graphics): add native drawTileLabelBatches for ground item overlays Move per-frame ground item tile and label rendering loops from interpreted script execution into compiled Java on `PluginGraphics` to eliminate per-frame TeaVM reflection and AST overhead. ### Graphics Pipeline - `PluginGraphics.java` - Added `drawTileLabelBatches(List<?>, int, int)` to project cached tile coordinates (`worldToScreen` with `worldToScreenList` fallback for unit test mocks), lazily cache `getTextWidth`, render lootbeams, and draw label boxes/text in compiled Java. * perf(plugins): add ground item signature and native tile batch builder to PluginContext Eliminate periodic stutters caused by `GroundItems` rebuilding its tile cache in `ScriptInterpreter` every 500ms by providing a zero-allocation ground item fingerprint and compiled batch builder. ### Plugin API - `PluginContext.java` - Added `getGroundItemsSignature(int radius)` to compute a lightweight FNV-1a fingerprint of ground items within `radius` tiles without allocating `GroundItemWrapper` objects or looking up `ItemDef`. - Added `buildGroundItemTiles(...)` to perform wildcard filtering, duplicate collapsing, sorting, label/quantity/value formatting, and border/lootbeam preparation in compiled Java. * refactor(plugins): remove GroundItems-specific buildGroundItemTiles from PluginContext Keep `PluginContext` limited to generic client API primitives (`getGroundItems(int)` and `getGroundItemsSignature(int)`) while moving Ground Items-specific grouping, tier coloring, and label formatting back into the plugin. ### Cleanups & Deprecations - `PluginContext.java` - Removed `buildGroundItemTiles(...)` and its private helpers (`matchesAnyPattern`, `getGroundItemColor`, `formatItemQuantity`, `formatItemValue`) along with unused `Map`/`HashMap`/`LinkedHashMap` imports. * feat(scripts): add ternary, modulo, compound assignments, constructors, list literals, and indexing Expand `ScriptInterpreter` expression and statement support to simplify plugin and script authoring across Desktop, Android, and Web. ### Script & Plugin Engine - `ScriptInterpreter.java` - Added short-circuiting ternary (`cond ? a : b` with `findMatchingTernaryColon`), `%` modulo operator, and unified `+=`, `-=`, `*=`, `/=`, `%=` compound assignments. - Added `target[index]` reads and `target[index] = value` writes for `List`, `Map`, arrays, and `String`, plus bracket-aware `findTopLevelOp` and `parseArguments`. - Added `[a, b, c]` list literals and `new ClassName(...)` constructors (`ArrayList`, `HashMap`, `LinkedHashMap`, `HashSet`, `StringBuilder`, `WorldArea`, `MenuEntry`, plus reflective constructor fallback). - Fast-pathed `StringBuilder` (`append`, `toString`, `length`, `setLength`) in `invokeMethod` and fixed `findMethodOpenParen` to ignore parentheses inside string literals. - `ScriptInterpreterTest.java` - Added `evaluatesTernaryModuloConstructorsAndIndexing` covering ternary, `%`, `*=`, `/=`, `%=`, list literals, `new HashMap()`, `new StringBuilder()`, indexing, and unbalanced parentheses inside strings. * fix(scripts): support long literals with L suffix in ScriptInterpreter Parse integer literals ending in `l` or `L` (e.g. `0L`) as `Long` instead of returning `null`. ### Bug Fixes & Edge Cases - `ScriptInterpreter.java` - Added `^-?\d+[lL]$` literal handling in `evalExpression` before standard integer literal parsing. * feat(scripts): add for/for-each/switch/break/continue, braceless blocks, and TeaVM fast-paths Expand `ScriptInterpreter` control-flow support and add direct non-reflective fast-paths for `PluginContext`, `PluginGraphics`, `MenuEntry`, and `GroundItemWrapper` to eliminate TeaVM `Class.getMethods()` `ReferenceError`s and per-tick reflection overhead. ### Script & Plugin Engine - `ScriptInterpreter.java` - Added `for (init; cond; update)`, enhanced `for (var : iterable)`, `switch`/`case`/`default`, `break`/`continue` (`BreakSignal`, `ContinueSignal`), and braceless single-statement bodies (`parseBodyOrSingleStatement`) for `if`, `else`, `while`, and `for`. - Added direct fast-paths in `invokeMethod` for `PluginContext` (`isLoggedIn`, `getGroundItems`, `getGroundItemsSignature`, `createList`, `createMap`, `sendClientMessage`, `getPlayerX`, `getPlayerY`, `getPlayerAnim`, `isBankOpen`, `getInventoryCount`, `walkTo`), `PluginContext.GroundItemWrapper` (`getDistance`), `MenuEntry` (`stripColorTags`, `matches`, `getAction`, `getTarget`, `getRawText`, `setRawText`), and `PluginGraphics` (`drawTileLabelBatches`, `fillRect`, `drawRect`, `drawCenteredString`, `drawString`, `drawStringBold`, `getTextWidth`, `getTextWidthBold`, `worldToScreenList`, `drawLootbeam`, `getViewportWidth`, `getViewportHeight`). - Added `try/catch` guard around `clazz.getMethods()` in `getCachedMethods` and included `[expr|phase]` diagnostics in `reportRuntimeError`. ### Unit Tests - `ScriptInterpreterTest.java` - Added `evaluatesForLoopsBreakContinueBracelessAndSwitch` covering `for`, `for-each`, `break`, `continue`, braceless `if`, `switch` fallthrough/default, and `MenuEntry` fast-paths. * feat(plugin-hub): add multi-line STRING config editor overlay and localStorage config seeding Replaces the non-editable "(Edit in .properties or chat)" placeholder in Plugin Hub settings with an interactive multi-line text editor overlay supporting cursor navigation and click positioning. Also seeds plugin settings on first boot and adds live localStorage reload support for web/cross-platform storage editing. ### Command Infrastructure - `PluginManager.java`: - Added `reloadStorage()` and `applyConfigToPlugin(...)` so external storage edits hot-reload `2006scape_plugin_settings` and `2006scape_script_*` entries into active plugins and scripts. - Updated `loadConfig()` to call `saveConfig()` when `DesktopHooks.loadPluginConfig()` returns `null`, seeding `2006scape_plugin_settings` on first boot. - `RSApplet.java`: - Queued Left (`1`) and Right (`2`) arrow keys into `charQueue` when `PluginPanelUI.isSearchFocused()` is true so arrow-key cursor movement reaches the modal editor without affecting normal gameplay. ### UI & Edge Cases - `PluginPanelUI.java`: - Replaced `(Edit in .properties or chat)` with a `220px` preview box in `drawConfigEditor` and `handleConfigTab`. - Added `drawConfigStringEditorOverlay`, `getStringEditorBounds`, and `wrapTextForWidth` to render a focused multi-line wrapped editor (up to 1,024 chars) with Clear, Cancel, and Save buttons. - Added `editingStringCursor` with Left/Right arrow, Home/End, mid-string insert/backspace, vertical gold caret rendering, auto-scroll to keep the cursor line visible, and pixel-accurate click-to-place-cursor support. - Added `commitStringEdit(PluginManager)` to auto-commit on blur, Back, or Close.