Skip to content

chore: add source skyui/props scripts for editing/import - #204

Open
zndxcvbn wants to merge 4 commits into
mainfrom
chore-add-props-as
Open

zndxcvbn wants to merge 4 commits into
mainfrom
chore-add-props-as

Conversation

@zndxcvbn

@zndxcvbn zndxcvbn commented May 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Added infrastructure for enhanced property processing and item filtering across menu systems.
    • Introduced support for compound property values and flexible property mapping configurations.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR introduces a configuration-driven property data processing system for SkyUI menus. Four ActionScript utilities form a pipeline: ItemFilter validates objects by requirements, PropertyLookup applies keyword and data-member-based property mappings, CompoundProperty generates concatenated composite values, and PropertyDataExtender orchestrates them to process list entries. The system is integrated into the build for six menu targets.

Changes

Property Data Processing Pipeline

Layer / File(s) Summary
ItemFilter foundation
source/actionscript/Common/skyui/props/ItemFilter.as
ItemFilter stores requirement key/value pairs and evaluates whether candidate objects pass all requirements. Supports array/object initialization, optional requirement insertion, and strict-equality filtering.
PropertyLookup configuration-driven mapper
source/actionscript/Common/skyui/props/PropertyLookup.as
PropertyLookup parses config to build mappings from source values (keywords and multi-part data-member names) to output properties. Applies ItemFilter gating, per-property defaults, then keyword-matched and data-member-matched values with data-member precedence.
CompoundProperty value generator
source/actionscript/Common/skyui/props/CompoundProperty.as
CompoundProperty generates a single output property by concatenating padded values from multiple sources. Applies ItemFilter, checks overwrite mode, builds compound with per-source defaults, applies target-level default if empty.
PropertyDataExtender orchestrator
source/actionscript/Common/skyui/props/PropertyDataExtender.as
PropertyDataExtender implements IListProcessor and instantiates PropertyLookup and CompoundProperty handlers from config. processList applies all handlers to each entry in a list, then optionally removes iconColor.
Build system integration
source/swfsources.cmake
CMake updates add the props source block (four new ActionScript files) to six menu targets: bartermenu, containermenu, craftingmenu, giftmenu, inventorymenu, and magicmenu.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • doodlum/SkyUI-Community#183: The main PR's swfsources.cmake update adds the new Common/skyui/props source block to multiple Add_SWF targets, which depends on the (retrieved PR's) refactored hierarchical Add_SWF source-list parsing behavior; the changes are therefore tightly coupled in the same CMake macro/listing mechanism.

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 title accurately describes the main change: adding new ActionScript property handler classes to the source directory for editing and import purposes.
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.


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/Common/skyui/props/CompoundProperty.as`:
- Line 17: The assignment this.defaultValues = configObject.defaultValues can
leave undefined values and cause literal "undefined" to be concatenated into
compoundValue and break when configObject.defaultValues or
configObject.concatenateList is missing; update CompoundProperty initialization
and compound generation to defensively check for existence and correct types:
ensure this.defaultValues is set to an empty array if configObject.defaultValues
is falsy or not an Array, ensure this.concatenateList is set to an empty array
or false when missing, and in the compound-building logic (where compoundValue
is assembled) only append values after null/undefined checks (use !== undefined
&& !== null) and skip or substitute defaults instead of concatenating
"undefined", and guard loops with length checks on concatenateList/defaultValues
before indexing.

In `@source/actionscript/Common/skyui/props/PropertyLookup.as`:
- Around line 22-25: The constructor assigns optional maps (defaultValues,
keywords) directly which can be null/undefined and later cause crashes in
processProperty and other methods; normalize these fields to safe defaults
during construction (e.g. set this.defaultValues and this.keywords to empty
objects/arrays when a_configObject.* is falsy) and update any reads in
processProperty, iterateDefaultValues or similar methods to assume non-null maps
(or guard with a short-circuit). Specifically, update the initialization around
propertiesToSet/itemFilter to default this.defaultValues and this.keywords, and
audit processProperty, the loops referenced (the blocks handling
defaultValues/keywords), and any iteration methods to rely on those normalized
fields instead of unguarded access.
🪄 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: c386ab84-4ef1-49fc-aa78-a9e5c0e899ca

📥 Commits

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

📒 Files selected for processing (5)
  • source/actionscript/Common/skyui/props/CompoundProperty.as
  • source/actionscript/Common/skyui/props/ItemFilter.as
  • source/actionscript/Common/skyui/props/PropertyDataExtender.as
  • source/actionscript/Common/skyui/props/PropertyLookup.as
  • source/swfsources.cmake

{
this.propertyToSet = configObject.propertyToSet;
this.itemFilter = new skyui.props.ItemFilter(configObject.filter);
this.defaultValues = configObject.defaultValues;

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 | 🟠 Major | ⚡ Quick win

Prevent "undefined" pollution and null-config crashes in compound generation.

Current initialization can append literal "undefined" to compoundValue, and missing defaultValues/concatenateList can break processing.

💡 Suggested fix
 function CompoundProperty(configObject:Object)
 {
     this.propertyToSet = configObject.propertyToSet;
     this.itemFilter = new skyui.props.ItemFilter(configObject.filter);
-    this.defaultValues = configObject.defaultValues;
+    this.defaultValues = (configObject.defaultValues instanceof Object) ? configObject.defaultValues : {};
@@
-    this.propertyList = configObject.concatenateList;
+    this.propertyList = (configObject.concatenateList instanceof Array) ? configObject.concatenateList : [];
 }
@@
-        for(var i: Number = 0; i < this.propertyList.length; i++)
+        for(var i: Number = 0; i < this.propertyList.length; i++)
         {
-            var currProp: String = propertyList[i];
-            var currVal: String = String(this.defaultValues[currProp]);
+            var currProp: String = this.propertyList[i];
+            var currVal: String = "";
+            if (this.defaultValues[currProp] != undefined) {
+                currVal = String(this.defaultValues[currProp]);
+            }
             if (obj.hasOwnProperty(currProp) && obj[currProp] != undefined && obj[currProp] != "") {
                 currVal = String(obj[currProp]);
             }
             compoundValue += this._padString(currVal, this.numPadding, this.padString);
         }
         
-        if (compoundValue == "" && this.defaultValues[this.propertyToSet]) {
+        if (compoundValue == "" && this.defaultValues[this.propertyToSet] != undefined) {
             compoundValue = this.defaultValues[this.propertyToSet];
         }

Also applies to: 31-31, 64-66, 73-82

🤖 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/Common/skyui/props/CompoundProperty.as` at line 17, The
assignment this.defaultValues = configObject.defaultValues can leave undefined
values and cause literal "undefined" to be concatenated into compoundValue and
break when configObject.defaultValues or configObject.concatenateList is
missing; update CompoundProperty initialization and compound generation to
defensively check for existence and correct types: ensure this.defaultValues is
set to an empty array if configObject.defaultValues is falsy or not an Array,
ensure this.concatenateList is set to an empty array or false when missing, and
in the compound-building logic (where compoundValue is assembled) only append
values after null/undefined checks (use !== undefined && !== null) and skip or
substitute defaults instead of concatenating "undefined", and guard loops with
length checks on concatenateList/defaultValues before indexing.

Comment on lines +22 to +25
this.propertiesToSet = a_configObject.propertiesToSet; //TODO: eventually determine this automatically?
this.itemFilter = new skyui.props.ItemFilter(a_configObject.filter);
this.defaultValues = a_configObject.defaultValues;
this.keywords = a_configObject.keywords;

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 | 🟠 Major | ⚡ Quick win

Normalize optional maps before iterating/reading them.

defaultValues and keywords are treated as optional, but processProperty iterates/reads them unguarded. Missing config can crash property processing.

💡 Suggested fix
 function PropertyLookup(a_configObject: Object)
 {
     this.propertiesToSet = a_configObject.propertiesToSet; //TODO: eventually determine this automatically?
     this.itemFilter = new skyui.props.ItemFilter(a_configObject.filter);
-    this.defaultValues = a_configObject.defaultValues;
-    this.keywords = a_configObject.keywords;
+    this.defaultValues = (a_configObject.defaultValues instanceof Object) ? a_configObject.defaultValues : {};
+    this.keywords = (a_configObject.keywords instanceof Object) ? a_configObject.keywords : {};
     this._parseDataMemberList(a_configObject);
     
     this.lastValue = -1;
 }
@@
-    for(var keyword in a_obj.keywords) {
-        var keywordValues: Object = this.getKeywordValues(keyword);
-        if (keywordValues != undefined) {
-            // keyword match found
-            for (var propertyToSet in keywordValues) {
-                valToSet = keywordValues[propertyToSet];
-                // Don't bother setting if default value is already set
-                if (valToSet != undefined && valToSet != this.defaultValues[propertyToSet]) {
-                    a_obj[propertyToSet] = valToSet;
+    if (a_obj.keywords instanceof Object) {
+        for (var keyword in a_obj.keywords) {
+            var keywordValues: Object = this.getKeywordValues(keyword);
+            if (keywordValues != undefined) {
+                // keyword match found
+                for (var propertyToSet in keywordValues) {
+                    valToSet = keywordValues[propertyToSet];
+                    // Don't bother setting if default value is already set
+                    if (valToSet != undefined && valToSet != this.defaultValues[propertyToSet]) {
+                        a_obj[propertyToSet] = valToSet;
+                    }
                 }
+                break;
             }
-            break;
         }
     }

Also applies to: 145-149, 153-167, 181-182

🤖 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/Common/skyui/props/PropertyLookup.as` around lines 22 -
25, The constructor assigns optional maps (defaultValues, keywords) directly
which can be null/undefined and later cause crashes in processProperty and other
methods; normalize these fields to safe defaults during construction (e.g. set
this.defaultValues and this.keywords to empty objects/arrays when
a_configObject.* is falsy) and update any reads in processProperty,
iterateDefaultValues or similar methods to assume non-null maps (or guard with a
short-circuit). Specifically, update the initialization around
propertiesToSet/itemFilter to default this.defaultValues and this.keywords, and
audit processProperty, the loops referenced (the blocks handling
defaultValues/keywords), and any iteration methods to rely on those normalized
fields instead of unguarded access.

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