ChaosMixFormulas.xml

Named formulas for computing a recipe's success rate. Each formula has a unique Id and a sequence of tokens evaluated as a postfix expression. Recipes pick a formula by Id in their <SuccessRate FormulaId="..."/>.

File Location#

Data/Plugins/Items/ChaosMix/ChaosMix_Formulas.xml

Loaded once at GameServer startup. Hot reloadable via the ChaosMix plugin admin command.

Schema#

<ChaosMixFormulas>
    <Formula Id="..." MaxRate="...">
        <Token Op="..." />
        <Token Op="..." Value="..." />
    </Formula>
</ChaosMixFormulas>

Formula Attributes#

AttributeTypeEffect
IdintUnique formula identifier. Recipes reference this
NamestringOptional label for readability
MaxRateint 0-100Hard ceiling on the computed success rate. Engine clamps the final number to this

Token Operations#

Tokens form an infix expression, read left to right by a recursive-descent evaluator with standard precedence: MUL / DIV bind tighter than ADD / SUB, and LP / RP group sub-expressions. Each operand token (constants and item-derived values) sits between or around the arithmetic operators, exactly the way the expression would read in code.

Operand tokens#

OpEffect
NUMBERThe literal number supplied in the Value attribute
MAXRATEThe formula's own MaxRate value
LUCKOPT25 if any item in the chaos box has the Luck option, 0 otherwise
ITEMSum of the BuyMoney of every item currently in the chaos box
WINGSum of the BuyMoney of chaos-box items whose item section is 12 (wings/capes)
EXCELLENTSum of the BuyMoney of chaos-box items that carry any Excellent option
EQUIPSum of the BuyMoney of chaos-box items in equipment sections (0..11)
SETSum of the BuyMoney of chaos-box items flagged as Set (Ancient) items
LEVEL1The +level of the item that matches the recipe's source index 0. If nothing in the box matches source 0 (for example the box is empty), this is 0
NONJEWELITEMSum of the BuyMoney of chaos-box items excluding Bless/Soul/Life/Creation/Guardian jewels in section 14

Operator tokens#

OpEffect
ADDInfix +
SUBInfix -
MULInfix *
DIVInfix / (float division; divisor of 0 leaves the running result unchanged)
LP / RPOpen/close parenthesis - genuinely affect evaluation order, not just readability
INTTruncation function. Must be followed by an LP ... RP group; the enclosed sub-expression is truncated toward zero

The final numeric result is clamped to MaxRate (and then to 100) by the calling code in the recipe layer before use.

Example Formulas#

<Formula Id="1" MaxRate="90">
    <Token Op="MAXRATE" />
</Formula>

Evaluates to MaxRate, i.e. 90. Final rate is a flat 90%.

Cross-File Dependencies#

AttributeRelated in
IdReferenced by ChaosMix_Recipes.xml <SuccessRate FormulaId="..."/>
Parent plugin overviewChaosMix plugin README

Common Issues#

  • Recipe always fails - formula produces 0 (missing tokens, wrong token order, or MaxRate=0). Remember the tokens are infix: an orphan operator at the start or end yields 0
  • Recipe's cap does not match the formula - the recipe's own <SuccessRate MaxRate="..."/> overrides the formula's MaxRate whenever the recipe sets it to anything other than 100. Leave the attribute off the recipe to inherit the formula's cap
  • LUCKOPT token has no effect - no item in the chaos box has the Luck option. LUCKOPT reads the combined Luck flag across the box, not a single source
  • LEVEL1 evaluates as 0 - nothing in the chaos box matches the recipe's source index 0 at the moment of evaluation
  • INT seems to do nothing - INT must be immediately followed by an LP ... RP group; without the parenthesis it is a no-op factor
  • Edits to MaxRate not applying - formulas are keyed by Id. Keep the same Id when editing and reload the plugin

Last updated April 21, 2026