gemforge.swf
The Gem Forge crafting window, opened at a Gem Forge station. Lets players drag gems into 12 inventory slots and one central upgrade slot, select which gem stat to augment/reroll/move, choose a booster/insurance item, review required crafting ingredients, and execute the upgrade.
Document/main class: GemForge (extends _kiwi.Core.UIComponent)
SWF-specific classes: 14 (excluding slot-skin stubs and dummy)
Main class: GemForge
Root window component. Manages 12 gem inventory slots (gemSlot0–gemSlot11), one upgrade target slot (upgradeSlot), 3 stat display rows, 5 booster/insurance item slots, and a required-ingredients panel. Constructor sets slot sizes (small=55px for slots at index % 3 != 2, large=77px for every 3rd slot, xlarge=100px for upgradeSlot), assigns colour frames (blue/yellow/red/opal cycling per group of 3 slots), initialises requiredItems, wires ingredient/insurance tooltip listeners, and on console builds a full DirectionalMapping graph for D-pad navigation. configUI() selects the correct augment button variant (PC vs. console), registers SlotDragDropHelper.registerDropCallback, and registers ExternalInterface callbacks.
Public methods
previewUpgrade(gemName:String, level:int, powerRank:int, quality:int, rarity:int, isRepair:Boolean, canAugment:Boolean, needsRepair:Boolean) : void— updates the upgrade slot's rarity/quality, clears and re-enables stat rows, updatestxtChooseStatvisibility, and setsaugmentButton.labelto one of$RepairLabel,$GemForge_RerollStat,$GemForge_MoveStat, or$GemForge_AugmentStatdepending on mode. Drives booster slot frames (frame 1=repair mode, frame 2=augment mode). The power rank is stored inpowerRankStatand never displayed (power_rank_49.powerRankValueis never written), and the$Level_X/$NoRarityPowerRankstrings it translates into locals are discarded, so the panel shows neither.addStat(name:String, value:String, roll:String, boost:int) : void— appends a stat entry tostatList, then refreshes all visibleGemStatRowinstances (text fields, boost pip visibility, roll-details HTML text). In REROLL_SLOT mode colours stats cyan (0xC2FFFF); otherwise green name / teal value.addIngredient(icon:String, name:String, description:String, numHave:Number, numNeed:Number) : *— appends toingredientList, showsrequiredItems.requiredLabel, and updatesreqText0/reqText1with HTML colour-coded have/need counts (red#FF3333if insufficient, white if sufficient). SetshaveIngredientsflag; enablesaugmentButtonifcanAugment && haveIngredients.resetIngredients() : void— clearsingredientListand hides allreqImage/reqTextchildren.clearForge() : void— disables augment button, resetsselectedStat, firesExternalInterface.call("OnSelectStat", -1), clears stat list, hides stats panel, resets upgrade slot rarity/quality to 0.selectAugment(index:int) : void— updates which booster/insurance slot hasequipped=true, changesaugmentButton.labelto match the mode (augment/reroll/move).setAugmentInfo(index:int, icon:String, name:String, description:String) : *— setsiconImageandslotImageSize=48on the specified booster slot; stores name/description ininsuranceListfor tooltip display.getCurrentSlotId() : int— returns thedataproperty of the currently console-selected element (slot index 0–12, stat row index 200–202, or booster index 100–104). Returns -1 if nothing selected.moveSelection(dx:int, dy:int) : void— console D-pad navigation; walks theDirectionalMappinggraph, skipping invisible nodes recursively.highlightSlot(focusUpgradeSlot:Boolean) : void— forces highlight toupgradeSlotif param is true, otherwise re-highlights current selection.activateSlot() : void— activates the currently selected element: callsSlot.activate()for gem slots,selectStat(rowIndex)for stat rows, orExternalInterface.call("OnUpgradeSelected", index)for booster slots.moveGemToSlot(itemId:String, qty:int, type:int, slotIndex:int) : void— firesExternalInterface.call("OnDropOntoSlot", itemId, qty, type, slotData)for the target slot.
Key fields
gemSlot0–gemSlot11 : Slot— 12 gem inventory slots (data values 0–11). Slots at index % 3 == 2 are large (77px); others are small (55px). Colour frames cycle blue/yellow/red/opal. The engine fills them by writingiconImage,rarityandquantitydirectly on each namedgemSlotN.upgradeSlot : Slot— the central target gem slot (data=12, xlarge 100px, disabled by default).stats : MovieClip— container forrow0/row1/row2(GemStatRowinstances, rowIndex 200–202).insuranceContainer : MovieClip— container forinsuranceItem0–insuranceItem4(each has a.slotSlotBasic; data values 100–104). Boosters 0–2 are the$GemForge_AugmentStat("Improve Stat") items, 3 is$GemForge_RerollStat("Reroll Stat") and 4 is$GemForge_MoveStat("Move Boost").requiredItems : MovieClip— ingredient display panel withreqImage0/reqImage1,reqText0/reqText1,requiredLabel,instructions.augmentButton : LabelButton— active button (eitherpcAugmentButtonorconsoleAugmentButtondepending on platform).pcAugmentButton / consoleAugmentButton : LabelButton— platform-specific variants; only one is visible at runtime.buttonSelect / trigger : MovieClip— shown/hidden on console focus gain/loss.buttonLegend : MovieClip— controller button legend; repositioned viaPositioningButtonson NX platform.selectedStat : int— rowIndex of the currently selected stat row (-1 if none); 200–202 range.selectedAugment : *— index of the active booster slot (0–4), or -1.haveIngredients / canAugment : Boolean— gate flags for augment button enable state.ingredientList / insuranceList / statList : Array— data caches for ingredient, booster, and stat entries.currentSelection : MovieClip— console-mode currently highlighted UI element.- Constants:
REROLL_SLOT=3,MOVE_SLOT=4,STAT_DISPLAY_COUNT=3,BOOSTER_ITEM_COUNT=5,TOOLTIP_PADDING=10.
Frame scripts / timeline
- Frame 1:
stop()— PC layout. - Frame 11:
stop()— Console layout. - Frame 21:
stop()— NX/Switch layout.
Runtime dependencies & integration
ExternalInterface.addCallbackregistrations:previewUpgrade,addStat,addIngredient,resetIngredients,clearForge,selectAugment,setAugmentInfo,getCurrentSlotId,fuseGems,moveSelection,highlightSlot,activateSlot,moveGemToSlot,LoseFocus,GainFocus.- Outbound
ExternalInterface.call:OnUpgradeRequest(),OnSelectStat(statIndex)(the row, 0–2, or -1 fromclearForge/resetIngredients; the engine answers a selection by re-sending the whole gem —previewUpgrade, which clears every row, then the stats — andpreviewUpgradere-marks the selected row),OnDropOntoSlot(itemId, qty, type, slotData),OnUpgradeSelected(boosterIndex),UIComponent.OnShowTooltip(x, y, name, desc),UIComponent.OnHideTooltip(). SlotDragDropHelper.registerDropCallback— receives drag-drop events from the shared drag system;onDrophit-tests against all gem slots and the upgrade slot.IggyFunctions.translate—$GemInstructions_empty,$Forge_Gems,$Level_X,$NoRarityPowerRank,$GemPreviewName{n},$GemPreviewState{n}. The last two are the preview-icon tooltips (onPreviewRollOver): names 0–3 read Cracked, Level Up, Double Level Up and Tier Up.DirectionalMapping— console D-pad navigation graph; manually defined adjacency between all 13 gem slots, 3 stat rows, and 5 booster items.GlowFilter— applied to booster/insurance items on console highlight (color0xCCCC00, blurX/Y=2, strength=100).PositioningButtons— NX-specific helper to repositionbuttonLegendrelative tobackBanner.
Other game-specific classes
GemStatRow(extendsBaseButton, embedssymbol47) — stat display row. Fields:statName,statValue,rollDetails(TextFields),selectedIndicator,boost0–boost4(pip MovieClips),rowIndex.selectStatsetter shows/hidesselectedIndicator.toggleHighlightapplies a hover glow.pulsingsetter animates the indicator viaIggyTween(console "choose a stat" prompt). 6 frame stops (1, 10, 11, 20, 30, 40).GemForge_flatimeline clips:stats_45(symbol163) —row0/row1/row2GemStatRow container.insurance_8(symbol153) —insuranceItem0–insuranceItem4container; frame 11 sends items 0–3 to "Console" frame.required_items_16(symbol161) — ingredient panel withrequiredLabel,reqText0/1,reqImage0/1/2,instructions. Two frames. OnlyreqImage0/reqImage1are ever set up or filled;reqImage2is unused.power_rank_49(symbol168) —powerRankValue:TextField. Two frames.color_frame_large_20(symbol98) — 4-frame gem colour state indicator (blue/yellow/red/opal).triggerLegend_54(symbol173) —textField:TextField, two frames (PC/console).equipped_39(symbol57) — 2-frame equipped toggle.bannerTop_2/bannerBottom_5(symbols 139/142) — animated frame banners (15-frame animations).animatedHighlightLarge_24/animatedHiglight_32(symbols 103/87) — animated selection highlight clips (6-frame loops).qualityPips_43(symbol71) — quality pip display, stops at frame 1.slotFrameLarge_23,slotFrame_31,slot_frame_small_29,slotFrameXL_36— slot frame border variants.
- Asset wrappers (9):
Equipped(symbol13),SlotBackground(symbol123),SlotBackgroundLocked(symbol10),SlotFrameHigh(symbol8),SlotFrameMedium(symbol5),SlotFrameNormal(symbol2),image(ArtClip, symbol106),art(ArtClip, symbol64),slot/slot_large/slot_xlarge(Slot subclasses),btnGreen/btnGreenWide(LabelButton, 4-state),dummy(BitmapData placeholder).
Notable logic
- Slot size and colour assignment: gem slots are sized small (55px) or large (77px) based on
index % 3 == 2, so the large gem is the last of each set. Colour (slotColorchild MovieClip label) cycles in groups of 3: 0–2 = blue ($GemElementBlue, Water), 3–5 = yellow ($GemElementYellow, Air), 6–8 = red ($GemElementRed, Fire), 9–11 = opal ($GemElementOpal, Cosmic). - Ingredient colour coding:
addIngredientrendersnumHave/numNeedin HTML; insufficient quantities appear in red (#FF3333), sufficient in white. The augment button is only enabled when all ingredients are sufficient ANDcanAugmentis true. - Augment mode button labels:
selectAugmentandpreviewUpgradecooperate to set the correct label. Repair takes priority; then REROLL_SLOT (index 3) = reroll; MOVE_SLOT (index 4) = move; otherwise = augment. - Console D-pad graph: the adjacency graph is fully hardcoded in the constructor. Navigation skips invisible nodes recursively.
highlightSelectionshows a slot tooltip atroot.width + 10for gem slots, togglesGemStatRow.toggleHighlight, or applies aGlowFilterfor booster items. - Drag-drop integration:
onDropuseshitTestPointagainst slots 0–8 and the upgrade slot. Slots 9–11, the whole Cosmic set, are not in the list, so a gem dropped on one of them sends noOnDropOntoSlot.