Skip to content

refactor(item-menus): restore scripts from decompiled to source version#200

Open
zndxcvbn wants to merge 25 commits into
mainfrom
restore-as
Open

refactor(item-menus): restore scripts from decompiled to source version#200
zndxcvbn wants to merge 25 commits into
mainfrom
restore-as

Conversation

@zndxcvbn

@zndxcvbn zndxcvbn commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Restoring the original appearance of scripts from ItemMenus adapted for import into JPEXS.
The number of this. scripts before and after the change should be the same, and if the scripts import without errors, then everything is fine.

If the number of this. scripts is the same or there are errors, then to check:

  1. Create Test_1.as and Test_2.as
  2. In VS Code, Ctrl + Shift + P --> Compare Active File With...
  3. In Test_1.as, place the selected script code from the main branch
  4. cmake --build --preset debug
  5. In Test_2.as, place the decompiled script code from JPEXS after importing the script
  6. If the files don't differ significantly except for the numbering of the _locN_ variable, then everything is fine

Summary by CodeRabbit

  • Refactor

    • Modernized many inventory/menu UI modules with explicit typing and clearer visibility while preserving behavior.
  • Bug Fixes / Polish

    • More consistent barter/item price display (buy/sell clamping, rounding) and clearer bottom-bar/navigation labeling. Icon selection and per-item display logic adjusted for more reliable visuals.
  • Stability

    • Internal structure and iteration fixes to improve robustness without altering user-facing features.

Review Change Stack

zndxcvbn added 20 commits May 14, 2026 17:03
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ad2d8dbf-8e74-464a-8c01-7ad275f40b84

📥 Commits

Reviewing files that changed from the base of the PR and between 26c49a6 and c4ddccd.

📒 Files selected for processing (2)
  • source/actionscript/CraftingMenu/CraftingDataSetter.as
  • source/actionscript/ItemMenus/MagicDataSetter.as
🚧 Files skipped from review as they are similar to previous changes (1)
  • source/actionscript/ItemMenus/MagicDataSetter.as

📝 Walkthrough

Walkthrough

Across ItemMenus, classes and helpers were converted from untyped ActionScript to explicitly typed declarations with explicit public/private visibility. Signatures, fields, and internal helpers now include type annotations; observable UI/menu behavior and data-processing rules are preserved.

Changes

ActionScript Type System & Visibility Modernization

Layer / File(s) Summary
Data Processing & Icon Setter Classes
source/actionscript/ItemMenus/BarterDataSetter.as, source/actionscript/ItemMenus/InventoryIconSetter.as, source/actionscript/ItemMenus/MagicIconSetter.as, source/actionscript/ItemMenus/MagicDataSetter.as, source/actionscript/ItemMenus/ItemcardDataExtender.as
Converted to typed AS3 classes. processList/processEntry signatures typed; private helper functions added/typed. Barter multipliers, SKSE field fixes, and icon-mapping logic preserved while control flow normalized.
List & Category UI Components
source/actionscript/ItemMenus/CategoryList.as, source/actionscript/ItemMenus/CategoryListEntry.as
Typed public/static constants, explicit properties and accessors, and typed event handlers. Segmented icon layout, selector animation, and icon loading behavior unchanged.
Menu Base Infrastructure & Shared Components
source/actionscript/ItemMenus/ItemMenu.as, source/actionscript/ItemMenus/BottomBar.as, source/actionscript/ItemMenus/InventoryLists.as, source/actionscript/ItemMenus/ItemCard.as
Core menu/list/card/bottom-bar converted to explicit typed declarations and visibility. Initialization, fade lifecycle, item-card positioning, stat/barter display, and dynamic-sizing flows preserved (height sizing moved earlier).
Barter Menu Implementation
source/actionscript/ItemMenus/BarterMenu.as
Public APIs typed (SetBarterMultipliers, UpdatePlayerInfo, etc.). Transaction flow (quantity slider → raw-deal warning → confirmation → ItemSelect), multiplier application, rounding/clamping, and bottom-bar updates preserved.
Container Menu Implementation
source/actionscript/ItemMenus/ContainerMenu.as
Typed state and methods; equip/transfer routing, pickpocket overlay, "Take All", and poison handling preserved. Handlers made explicitly private where applicable.
Gift Menu Implementation
source/actionscript/ItemMenus/GiftMenu.as
Typed private state (_bGivingGifts, icon art) and typed public APIs. Callback wiring, data-processor setup, and bottom-bar gift updates unchanged.
Magic Menu Implementation
source/actionscript/ItemMenus/MagicMenu.as
Typed fields including new public hideButtonFlag, retyped APIs and private handlers. DragonSoulSpent now calls updateBottomBar(true); navigation and button-state logic preserved.
Inventory Menu Implementation
source/actionscript/ItemMenus/InventoryMenu.as
Typed member declarations and APIs; GameDelegate wiring, list layout/data processors, input routing, and submenu/quantity logic preserved. Several handlers narrowed to private.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

  • doodlum/SkyUI-Community#173: Modifies ItemMenu.setConfig and InventoryLists to use ListLayout.defaults.entryWidth and apply dynamic width to adaptive inventory display.
  • doodlum/SkyUI-Community#176: Changes to CategoryListEntry signatures align with typed BasicListEntry/TabularListEntry APIs.

Suggested Reviewers

  • doodlum
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly describes the main change: restoring ActionScript scripts from decompiled JPEXS form back to original source form.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@source/actionscript/ItemMenus/ItemMenu.as`:
- Line 615: The base-class method updateBottomBar(a_bSelected: Boolean) is
declared private but is invoked polymorphically (this.updateBottomBar(false))
and overridden in subclasses (MagicMenu, InventoryMenu, GiftMenu, ContainerMenu,
BarterMenu); change its visibility from private to protected so subclasses can
override it while keeping encapsulation, ensure the method signature remains the
same and preserve or implement a sensible default body in
ItemMenu.updateBottomBar to avoid runtime errors when called from the base
class.

In `@source/actionscript/ItemMenus/MagicMenu.as`:
- Around line 88-91: In DragonSoulSpent(), updateBottomBar() is called without
the required Boolean selected-state parameter; change the call to pass the
current selected state (e.g., this.updateBottomBar(true) if the item remains
selected, or better: this.updateBottomBar(this.itemCard &&
this.itemCard.isSelected)) so the UI refreshes using the selected-button set;
locate the DragonSoulSpent function and the updateBottomBar(Boolean) method and
supply the appropriate Boolean (preferably this.itemCard.isSelected) when
invoking updateBottomBar.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: abe5553e-e171-49bc-b12a-1853fde403e1

📥 Commits

Reviewing files that changed from the base of the PR and between 25920a0 and 05ce273.

📒 Files selected for processing (15)
  • source/actionscript/ItemMenus/BarterDataSetter.as
  • source/actionscript/ItemMenus/BarterMenu.as
  • source/actionscript/ItemMenus/BottomBar.as
  • source/actionscript/ItemMenus/CategoryList.as
  • source/actionscript/ItemMenus/CategoryListEntry.as
  • source/actionscript/ItemMenus/ContainerMenu.as
  • source/actionscript/ItemMenus/GiftMenu.as
  • source/actionscript/ItemMenus/InventoryDataSetter.as
  • source/actionscript/ItemMenus/InventoryIconSetter.as
  • source/actionscript/ItemMenus/InventoryLists.as
  • source/actionscript/ItemMenus/InventoryMenu.as
  • source/actionscript/ItemMenus/ItemMenu.as
  • source/actionscript/ItemMenus/ItemcardDataExtender.as
  • source/actionscript/ItemMenus/MagicIconSetter.as
  • source/actionscript/ItemMenus/MagicMenu.as

Comment thread source/actionscript/ItemMenus/ItemMenu.as
Comment thread source/actionscript/ItemMenus/MagicMenu.as Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@source/actionscript/ItemMenus/ItemCard.as`:
- Line 65: Remove the no-op self-assignment in ItemCard: delete the line that
assigns this.QuantitySlider_mc = this.QuantitySlider_mc; (a decompiler artifact)
from the ItemCard class/constructor so the QuantitySlider_mc field is not
redundantly reassigned; search for and remove identical patterns where a
property is assigned to itself (e.g., other occurrences like QuantitySlider_mc)
to clean up decompiler artifacts.
- Around line 310-316: Remove the duplicated calls to gotoAndStop on the
ShoutTextInstance entries: inside the branch that checks bWordKnown and the else
branch, only call this["ShoutTextInstance" + i].gotoAndStop("Known") or
this["ShoutTextInstance" + i].gotoAndStop("Unlocked") once (respectively).
Locate the code in ItemCard.as around the bWordKnown conditional and delete the
redundant second gotoAndStop invocation so each branch makes a single call to
gotoAndStop with the appropriate frame name.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fd64998f-d273-447b-8872-048c50748f5a

📥 Commits

Reviewing files that changed from the base of the PR and between 05ce273 and 26c49a6.

📒 Files selected for processing (3)
  • source/actionscript/ItemMenus/ItemCard.as
  • source/actionscript/ItemMenus/MagicDataSetter.as
  • source/actionscript/ItemMenus/MagicMenu.as
🚧 Files skipped from review as they are similar to previous changes (1)
  • source/actionscript/ItemMenus/MagicMenu.as

Shared.GlobalFunc.MaintainTextFormat();
Shared.GlobalFunc.AddReverseFunctions();
gfx.events.EventDispatcher.initialize(this);
this.QuantitySlider_mc = this.QuantitySlider_mc;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Look for any other self-assignments in the restored files to spot residual JPEXS artifacts.
rg -nP '\bthis\.(\w+)\s*=\s*this\.\1\s*;' -g '*.as'

Repository: doodlum/SkyUI-Community

Length of output: 2652


Remove self-assignment — confirmed as JPEXS decompiler artifact.

this.QuantitySlider_mc = this.QuantitySlider_mc; is a no-op and is part of a systematic decompiler artifact pattern. A search across the codebase found 28+ identical self-assignments in restored ActionScript files (TrainingMenu, StartMenu, SleepWaitMenu, CenteredList, LevelUpMenu, DialogueMenu, Console, TweenMenu, MessageBox, CraftingMenu, Quest_Journal, and MarkerDescription). This line should be removed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@source/actionscript/ItemMenus/ItemCard.as` at line 65, Remove the no-op
self-assignment in ItemCard: delete the line that assigns this.QuantitySlider_mc
= this.QuantitySlider_mc; (a decompiler artifact) from the ItemCard
class/constructor so the QuantitySlider_mc field is not redundantly reassigned;
search for and remove identical patterns where a property is assigned to itself
(e.g., other occurrences like QuantitySlider_mc) to clean up decompiler
artifacts.

Comment on lines +310 to +316
} else if (bWordKnown) {
this["ShoutTextInstance" + i].gotoAndStop("Known");
this["ShoutTextInstance" + i].gotoAndStop("Known");
} else {
this["ShoutTextInstance" + i].gotoAndStop("Unlocked");
this["ShoutTextInstance" + i].gotoAndStop("Unlocked");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

# Check if the file exists and read the relevant section
head -n 320 source/actionscript/ItemMenus/ItemCard.as | tail -n 20

Repository: doodlum/SkyUI-Community

Length of output: 1666


🏁 Script executed:

# Check for README and project metadata
head -50 README.md 2>/dev/null || head -50 readme.txt 2>/dev/null || ls -la | head -20

Repository: doodlum/SkyUI-Community

Length of output: 2319


🏁 Script executed:

# Search for other instances of duplicate gotoAndStop calls to confirm the pattern
rg "gotoAndStop\(" source/actionscript/ -A 1 | head -100

Repository: doodlum/SkyUI-Community

Length of output: 6633


🏁 Script executed:

# Search for comments or TODOs around this area mentioning decompiler or artifacts
rg "decompil|JPEXS|artifact" source/actionscript/ -i

Repository: doodlum/SkyUI-Community

Length of output: 3654


🏁 Script executed:

# Check if there are any .swf files or original source references in the project
find . -name "*.swf" -o -name "*original*" -o -name "*backup*" | head -20

Repository: doodlum/SkyUI-Community

Length of output: 789


🏁 Script executed:

# Search for other patterns of duplicate method calls (not just gotoAndStop) to see if this is systematic
rg "this\[.*\]\.\w+\(.*\);\s*this\[.*\]\.\1\(" source/actionscript/ --multiline

Repository: doodlum/SkyUI-Community

Length of output: 313


🏁 Script executed:

# Try the pattern search with PCRE2 flag for backreferences
rg "gotoAndStop\(([^)]+)\);\s*\[ShoutText[^\]]*\]\.gotoAndStop\(\1\)" source/actionscript/ --pcre2 -A 1 -B 1

Repository: doodlum/SkyUI-Community

Length of output: 49


🏁 Script executed:

# Look at broader context around the suspicious code in ItemCard.as
sed -n '300,325p' source/actionscript/ItemMenus/ItemCard.as

Repository: doodlum/SkyUI-Community

Length of output: 1947


🏁 Script executed:

# Check if there are any GitHub issues or discussions about duplicate gotoAndStop calls
find . -name "*.md" -o -name "*.txt" | xargs grep -l "duplicate\|gotoAndStop" 2>/dev/null

Repository: doodlum/SkyUI-Community

Length of output: 96


Remove duplicate gotoAndStop calls — confirmed decompiler artifacts.

The duplicate calls in both the Known and Unlocked branches are confirmed. Given this is a decompilation restoration project and JPEXS decompiler issues are already documented in the codebase (see BasicListEntry.as), these redundant statements are almost certainly artifacts. Calling the same method twice with identical arguments serves no purpose and should be removed.

Cleanup to apply
                    } else if (bWordKnown) {
                        this["ShoutTextInstance" + i].gotoAndStop("Known");
-                       this["ShoutTextInstance" + i].gotoAndStop("Known");
                    } else {
                        this["ShoutTextInstance" + i].gotoAndStop("Unlocked");
-                       this["ShoutTextInstance" + i].gotoAndStop("Unlocked");
                    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@source/actionscript/ItemMenus/ItemCard.as` around lines 310 - 316, Remove the
duplicated calls to gotoAndStop on the ShoutTextInstance entries: inside the
branch that checks bWordKnown and the else branch, only call
this["ShoutTextInstance" + i].gotoAndStop("Known") or this["ShoutTextInstance" +
i].gotoAndStop("Unlocked") once (respectively). Locate the code in ItemCard.as
around the bWordKnown conditional and delete the redundant second gotoAndStop
invocation so each branch makes a single call to gotoAndStop with the
appropriate frame name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant