Mechanics

cubemain

Horadric Cube recipe definitions — inputs, outputs, conditional gates, and mod blocks.

cubemain.txt defines every Horadric Cube recipe in the game: rune upgrades, gem combines, socket-creation recipes, crafted items, unique/rare item upgrades (Normal → Exceptional → Elite), the act-quest combines (Horadric Staff, Khalim's Will), the secret-portal recipes (Cow Level, Pandemonium, Uber Tristram), and the Token of Absolution. Each row is one recipe — a set of input items that, when transmuted in the Cube, yields one or more output items (or special effects like a portal).

227 rows, 106 columns. The schema is wide because each row supports up to 7 inputs, 3 outputs (each with a level-control block plus 5 property mods), and a conditional-gate function. Most live recipes use only the first output and one or two mod slots; the schema's full capacity is never reached in shipped data.

What's in a row

The 106 columns split into six functional groups.

Identity and gating

ColumnMeaning
descriptionPlain-text recipe name. Reference-only — the engine doesn't read it; the .txt comment helps modders identify the row at a glance.
enabled1 = recipe is live in the game; 0 = recipe exists in the table but is disabled (cut content, future content, debug). 5 rows are blank — a third state, neither enabled nor disabled; all 5 are scaffolding for an unfinished "Tempered" item-quality system that didn't ship. Counts: 157 enabled, 65 disabled, 5 blank.
firstLadderSeason / lastLadderSeasonRestricts the recipe to a range of ladder seasons. Both blank = no ladder restriction. 4 rows are ladder-restricted (to seasons 1–2).
min diffMinimum game difficulty required: 0 = all difficulties, 1 = Nightmare and Hell, 2 = Hell only. Only 1 row sets a value here (min diff = 2); the other 226 are blank (= no restriction).
version0 = Classic-mode recipe; 100 = Expansion-mode recipe. Counts: 55 Classic, 172 Expansion.
classRestricts the recipe to one player class (Code from PlayerClass.txt). 0 rows currently use this — all recipes are class-agnostic in shipped data.

Conditional gate (op / param / value)

A recipe can require an arbitrary check beyond having the right items in the cube — for example, "this recipe only works if the player has reached this difficulty on this quest." That check is encoded by op (which function), param (the function's input, usually a stat ID from ItemStatCost.txt), and value (the comparison threshold).

The engine supports 28 op codes (1–28). They cover: real-world calendar checks (op 1, 2), player-stat comparisons (3–14, base/non-base/current variants of ≥ ≤ ≠ =), input-item-stat comparisons (15–26, same comparison family), an item Mod Class check (27), and the quest-item / quest-difficulty check (28).

Of the 227 rows, only 6 set an op — and all 6 use op = 28. Those six are the act-quest item combines (Horadric Staff, Khalim's Will, Mephisto/Diablo/Baal organ portal, etc.) — recipes that require the quest to be at the right stage. Op codes 1–27 are documented in the engine but unused in shipped data; modders can rely on them.

Inputs

ColumnMeaning
numinputsHow many input items the recipe consumes. Range: 2–7. Distribution: most recipes use 3 (69) or 4 (141) inputs; a handful use 5–7.
input 1input 7Each input slot specifies one required item. The value is either a base-item code from armor.txt / weapons.txt / misc.txt, or one of the predefined codes from the Input/output code reference below, or a comma-separated combination (fhl,mag,upg = a magic upgradable Full Helm; r07,qty=3 = three Tal runes).

Output (the primary output block)

ColumnMeaning
outputWhat the recipe produces. Same code grammar as input 1: a base-item code, or one of the predefined output codes (useitem, usetype, Cow Portal, Pandemonium Portal, Pandemonium Finale Portal, Red Portal, pre=#, suf=#, etc.), or a comma-separated combination. See Input/output code reference.
lvlForces the output's item level to this absolute value. If set, overrides plvl and ilvl.
plvlMultiplier applied to the player's clvl; the result is added to the output's level requirement.
ilvlMultiplier applied to input 1's ilvl; the result is added to the output's level requirement.
mod 1mod 5Up to five properties added to the output. Each value is a Code from Properties.txt (gethit-skill, thorns, ac, dmg-pois, etc.).
mod N chancePercent chance the property is rolled. 0 (or blank) = always applied (this is a deliberate convention — 0 here does not mean "never").
mod N paramParam value for the property. Meaning depends on the property's Function ID in Properties.txt (often a skill ID or stat ID).
mod N min / mod N maxThe min and max values rolled for the property. Meaning again depends on the property's function (could be damage range, skill level, percent, etc.).

Output B and Output C (multi-output capacity)

The schema mirrors the entire Output block twice more — a full set of output b / b lvl / b plvl / b ilvl / b mod 1b mod 5 columns, and again as output c / c lvl / etc. — supporting recipes that yield two or three distinct items in one transmute.

0 of the 227 shipped rows currently populate output b or output c. The capacity is in the engine but no live recipe uses it.

Row terminator

ColumnMeaning
*eolEnd-of-row marker, always 0. Common to most .txt tables; reference-only, no gameplay effect.

Input/output code reference

Every input and output slot accepts either a base-item code (the 3- or 4-character code from armor.txt / weapons.txt / misc.txt) or one of these predefined codes. Codes can be combined with commas: fhl,mag,upg = a magic, upgradable Full Helm.

Quality and version codes (input or output)

CodeMeaning
lowLow Quality
norNormal Quality
hiqHigh Quality (Superior)
magMagic
setSet
rarRare
uniUnique
crfCrafted
tmpTempered
basBasic (Normal item tier)
excExceptional (item tier)
eliElite (item tier)

Sockets and ethereal (input or output)

CodeMeaning
nosNo sockets (input only)
sock=#Has # sockets (input) / Add # sockets (output)
noeNot Ethereal (input only)
ethEthereal
upgAllows Upgrades (input only)
nruNot a Rune Word (input only)

Quantity (input or output)

CodeMeaning
qty=#Quantity multiplier — r07,qty=3 = three Tal runes; on output, produces # of the item

Output-only codes

CodeMeaning
usetypeOutput uses input 1's item type
useitemOutput is input 1 itself (with whatever modifications follow)
modCarry over input 1's modifiers onto the output
pre=#Force the output to roll a specific MagicPrefix.txt prefix (# = row index)
suf=#Force the output to roll a specific MagicSuffix.txt suffix (# = row index)
uns / remUnsocket / remove all gems, runes, and jewels from the item's sockets
repRepair the item
rchRecharge all skill charges on the item
regIf the recipe uses usetype and the input is a Unique, reroll the Unique
Cow PortalOpen the portal to the Secret Cow Level
Pandemonium PortalOpen one of the three Pandemonium mini-uber portals (Matron's Den / Forgotten Sands / Furnace of Pain), avoiding duplicates within a game
Pandemonium Finale PortalOpen the portal to Uber Tristram
Red PortalOpen a permanent portal to a levels.txt ID; the destination is set inline (e.g. Red Portal,lvl=137,qty=1)

Conditional ops at a glance

The first column is the op value the recipe sets; the second describes what the engine checks. Player and input-item stat ops come in three flavors: base (hard points only), non-base (from states/skills/gear), and current (base + non-base combined).

opCheck
(blank)No condition (the default — used by 221 of 227 rows)
1Calendar day-of-month: param ≤ today ≤ value must be false
2Calendar day-of-week ≠ value (1=Sun … 7=Sat)
3 / 4 / 5 / 6Player current stat param is / / / = value
7 / 8 / 9 / 10Player base stat param is / / / = value
11 / 12 / 13 / 14Player non-base stat param is / / / = value
15 / 16 / 17 / 18Input item current stat param is / / / = value
19 / 20 / 21 / 22Input item base stat param is / / / = value
23 / 24 / 25 / 26Input item non-base stat param is / / / = value
27Item's Mod Class (unique ID or quality type) ≠ value
28Input is a quest item with QuestDiffCheck — quest-difficulty must be greater than current game difficulty (used by the act-quest combines: Horadric Staff, Khalim's Will, etc.)

Worked example: Token of Absolution

The Token of Absolution is a one-respec consumable, crafted from the four difficulty-keyed essences dropped by the act bosses on Hell:

ColumnValueNotes
description1 Twisted Essence of Suffering + 1 Charged Essence of Hatred + 1 Burning Essence of Terror + 1 Festering Essence of Destruction -> Token of AbsolutionReference-only label.
enabled1Live recipe.
version100Expansion-only.
numinputs4Four input slots used.
input 1input 4tes, ceh, bet, fedFour hardcoded essence codes — Andariel/Duriel/Mephisto/Diablo/Baal essence drops in Hell.
outputtoaThe Token of Absolution misc-item code.
op, param, value(blank)No conditional gate — having the four essences is the only requirement.
lvl / plvl / ilvl(blank)The token's level is whatever its misc.txt row defines, with no input-driven scaling.
mod 1mod 5(blank)The Token of Absolution carries no rolled properties — it's a fixed misc item.

The engine validates: enabled=1 (live), version matches (Expansion game), numinputs=4 matches what's in the cube, the four input codes match, no op condition to check — recipe succeeds, the four essences are consumed, one Token of Absolution is created.

For comparison, the Hit Power crafting recipe (1 Magic Full Helm + 1 Jewel + 1 Ith Rune + 1 Perfect Sapphire → Crafted Hit Power Helm) demonstrates the mod block in action: output = usetype,crf (output is a Crafted-quality version of input 1's helm type), mod 1 = gethit-skill with param=44 / min=5 / max=4 (a chance-on-being-struck skill cast — param/min/max meanings come from Properties.txt's function for gethit-skill), mod 2 = thorns with min=3 / max=7 (3–7 Thorns damage rolled at craft time).

Cross-references

  • armor.txt, weapons.txt, misc.txt — base-item codes used in the input N and output columns (fhl, r07, gpr, tes, toa, etc.).
  • MagicPrefix.txtpre=# in an output forces a specific prefix; # is the row index.
  • MagicSuffix.txtsuf=# in an output forces a specific suffix; # is the row index.
  • Properties.txtmod 1mod 5 reference property codes here; mod N param, mod N min, and mod N max are interpreted per the property's function.
  • ItemStatCost.txtop codes 3–26 reference stat IDs from this table via the param column.
  • PlayerClass.txt — the class column references player-class codes here (currently unused).
  • levels.txtRed Portal outputs reference area IDs from this table for the portal destination.