ChaosMix

Server-authoritative chaos mix system with customizable recipes, success rate formulas, and item filtering options

The ChaosMix Plugin is a comprehensive server-side chaos machine system that replaces hardcoded mix logic with data-driven XML configuration. It consists of three configuration files that work together to define all chaos mix recipes, success rate calculations, and item filtering rules.

File Locations

  • GameServer/Data/Plugins/ChaosMix/ChaosMix_Options.xml - Item filtering and charm option presets

  • GameServer/Data/Plugins/ChaosMix/ChaosMix_Formulas.xml - Reusable success rate calculation formulas

  • GameServer/Data/Plugins/ChaosMix/ChaosMix_Recipes.xml - Complete mix recipes (122 recipes)

System Architecture

The plugin loads configurations in this order:

  1. Formulas - Parsed first since recipes reference them

  2. Options - Mix/charm/chaos charm presets loaded

  3. Recipes - Complete mix definitions loaded and organized by MixType

Mix Types

Each NPC has a dedicated MixType that categorizes its available recipes:

MixType
Value
NPC
Description

GOBLIN_NORMAL

0

Chaos Goblin

Standard upgrades

GOBLIN_CHAOSITEM

1

Chaos Goblin

Chaos items (Helm, Weapon, etc.)

GOBLIN_ADD380

2

Chaos Goblin

+380 Ancient items

CASTLE_SENIOR

3

Castle Senior

Castle siege items

TRAINER

4

Trainer

Pet/mount training

OSBOURNE

5

Osbourne

Wings

JERRIDON

6

Jerridon

Blood Castle items

ELPIS

7

Elpis

Dinorant/Fenrir

CHAOS_CARD

8

Chaos Card

Card gambling

CHERRYBLOSSOM

9

Cherry Blossom

Special items

EXTRACT_SEED

10

Seed Master

Seed extraction

SEED_SPHERE

11

Seed Sphere

Seed spheres

ATTACH_SOCKET

12

Socket Master

Socket attachment

DETACH_SOCKET

13

Socket Master

Socket removal

Configuration File 1: ChaosMix_Options.xml

Defines reusable option presets for item filtering and charm behavior.

MixOption Presets

Controls what items can be added to the chaos box for a particular recipe.

Attribute
Type
Default
Description

Id

int

-

Unique preset ID (referenced by recipes)

Char

char

-

Legacy character code (A-I) - optional, not used by plugin

Name

string

-

Human-readable preset name

ExcludeChaosItems

bool

false

When true, blocks Chaos Machine-specific items (Chaos Helm, Weapon, etc.) from being added

Exclude380

bool

false

When true, blocks +380 Ancient items from being added

ExcludeFenrir

bool

false

When true, blocks Fenrir items from being added

UpgradableOnly

bool

false

When true, only allows items that can be upgraded (weapons/armor with +level)

triangle-exclamation
circle-exclamation

CharmOption Presets

Controls how Bless charms affect success rate.

Attribute
Type
Default
Description

Id

int

-

Unique preset ID

Char

char

-

Legacy character code - optional, not used by plugin

Name

string

-

Human-readable preset name

MaxCharms

int

10

Maximum number of charms allowed (0 = no charms)

BonusPerCharm

int

1

Success rate bonus per charm (typically +1% per charm)

triangle-exclamation

ChaosCharmOption Presets

Controls whether Chaos charms (special items that guarantee success) are allowed.

Attribute
Type
Default
Description

Id

int

-

Unique preset ID

Char

char

-

Legacy character code - optional, not used by plugin

Name

string

-

Human-readable preset name

MaxChaosCharms

int

1

Maximum chaos charms allowed (0 = not allowed, 1 = one allowed)

triangle-exclamation

Preset Examples

Allows all item types - most permissive option.

Configuration File 2: ChaosMix_Formulas.xml

Defines reusable mathematical formulas for calculating success rates using token-based expressions.

Formula Structure

Attribute
Type
Default
Description

Id

int

-

Unique formula ID (referenced by recipes via FormulaId)

Name

string

-

Human-readable formula description

MaxRate

int

100

Maximum success rate cap (0-100) regardless of calculation result

Formula Tokens

Formulas are defined as sequences of tokens that are evaluated using recursive descent parsing (respects operator precedence and parentheses).

Operators

Token Op
Symbol
Description

NUMBER

-

Literal number value (specify with Value attribute)

ADD

+

Addition

SUB

-

Subtraction

MUL

*

Multiplication

DIV

/

Division (safe - returns 0 if divisor is 0)

LP

(

Left parenthesis

RP

)

Right parenthesis

INT

INT()

Convert to integer (truncate)

Variable Tokens

These tokens reference values calculated from chaos box contents:

Token Op
Description
Calculation

MAXRATE

Returns the MaxRate value

Direct value from formula's MaxRate attribute

ITEM

Total buy value of all items

Sum of m_BuyMoney for all items

WING

Buy value of wing items

Sum of m_BuyMoney for items in section 12

EXCELLENT

Buy value of excellent items

Sum of m_BuyMoney for items with excellent flags

EQUIP

Buy value of equipment

Sum of m_BuyMoney for items in sections 0-11 (weapons/armor)

SET

Buy value of set items

Sum of m_BuyMoney for set items

LEVEL1

Level of first item

m_Level of first item in chaos box (0 if empty)

NONJEWELITEM

Buy value excluding jewels

Sum of m_BuyMoney excluding Bless/Soul/Life/Creation/Guardian

LUCKOPT

Luck option bonus

Returns 25 if any item has luck, 0 otherwise

Common Formulas

Simple fixed rate - just returns the MaxRate value. Used when success rate doesn't depend on items.

Configuration File 3: ChaosMix_Recipes.xml

Defines complete mix recipes with all requirements, costs, and rewards. Contains 122 recipes organized by MixType.

Recipe Structure

Basic Identifiers

Attribute
Type
Description

MixType

int

Mix type (0-13) - determines which NPC offers this recipe

MixIndex

int

Index within the MixType array - client uses this to identify the recipe

MixID

int

Legacy mix ID - used for backwards compatibility

Display Node

Controls how the recipe appears in the client UI.

Attribute
Type
Description

NameText1/2/3

int

GlobalText indices for recipe name (multi-line support)

DescText1/2/3

int

GlobalText indices for description

AdviceText1/2/3

int

GlobalText indices for advice/tips

Width

int

Preview item width in grid (1-8)

Height

int

Preview item height in grid (1-8)

Requirements Node

Attribute
Type
Description

Level

int

Minimum character level required to perform this mix

ZenCost Node

Attribute
Type
Description

Type

char

Zen calculation method: 'A'=flat cost, 'B'=rate*value, 'C'=flat, 'D'=flat (intended for harmony but not implemented)

Value

uint

Base zen cost or multiplier depending on Type

Zen calculation types:

  • Type A/C/D: Flat cost - charges exactly the Value amount

  • Type B: Rate-based - charges (successRate * Value) zen

circle-info

Type D was intended for special Jewel of Harmony cost calculations but currently behaves identically to Type A/C (flat cost).

SuccessRate Node

Attribute
Type
Description

FormulaId

int

Reference to a formula in ChaosMix_Formulas.xml (0 = use inline tokens)

MaxRate

int

Optional override for formula's MaxRate

If FormulaId is 0, you can define inline <Token> nodes here instead of referencing a formula.

Options Node

Attribute
Type
Description

MixOptionId

int

Reference to MixOption preset ID

CharmOptionId

int

Reference to CharmOption preset ID

ChaosCharmOptionId

int

Reference to ChaosCharmOption preset ID

Sources Node

Contains multiple <Source> elements defining required items.

Attribute
Type
Description

Index

int

Source slot index (0-7)

TypeMin

int

Minimum item type code (item index)

TypeMax

int

Maximum item type code (allows range matching)

LevelMin

int

Minimum item level (0-255)

LevelMax

int

Maximum item level

OptionMin

int

Minimum +option level (0-255)

OptionMax

int

Maximum +option level

DurMin

int

Minimum durability or stack count (0-255)

DurMax

int

Maximum durability or stack count

CountMin

int

Minimum item count required (supports stackable items)

CountMax

int

Maximum item count allowed (255 = unlimited)

SpecialFlags

uint

Bitflags for special requirements (see below)

Special Flags

Bitflags that can be combined using OR:

Flag
Hex
Description

CMIX_SF_EXCELLENT

0x01

Item must have excellent options

CMIX_SF_ADD380

0x02

Item must be +380 Ancient

CMIX_SF_SETITEM

0x04

Item must be a set item

CMIX_SF_HARMONY

0x08

Item must have Jewel of Harmony applied

CMIX_SF_SOCKET

0x10

Item must have sockets

Rewards Node

Attribute
Type
Description

ItemBagId

int

Reference to EventItemBagManager item bag (0 = legacy hardcoded reward)

Weight

int

Weight for weighted random selection (if multiple rewards)

Important Behavior

circle-info

Formula Evaluation Order: Formulas are NOT RPN (Reverse Polish Notation). They use recursive descent parsing that respects standard mathematical operator precedence (multiplication/division before addition/subtraction) and parentheses. This means you write expressions naturally: 50 + LUCKOPT, not 50 LUCKOPT +. The INT() operator truncates to integer, useful for preventing fractional rate increases.

circle-info

Source Validation Best-Match: When validating chaos box contents, each item is matched against source requirements in order. Once an item matches a source, it won't be matched against other sources. If you have overlapping source ranges, order matters.

circle-info

Stackable Item Counting: For stackable items (jewels, potions), the DurMin/DurMax attributes check against stack count (not durability), and multiple stacks can satisfy a single source's CountMin requirement.

circle-exclamation
circle-info

Tax Application: All zen costs are subject to Castle Siege chaos machine tax. The final cost is: zenCost + (zenCost * taxRate / 100).

Recipe Examples

Explanation:

  • Requires level 10 character

  • Costs 2,000,000 zen flat

  • Base 50% success rate + 25% if item has luck

  • Requires exactly one +9 item, one Jewel of Chaos, one Jewel of Bless, one Jewel of Soul

  • Reward handled by legacy code

Common Configuration Tasks

Adding a New Recipe

  1. Decide which MixType (NPC) should offer the recipe

  2. Assign a unique MixIndex within that MixType

  3. Define source requirements (required items with ranges)

  4. Choose or create a FormulaId for success rate

  5. Set MixOptionId, CharmOptionId, ChaosCharmOptionId

  6. Define zen cost and type

  7. Add Display text references

  8. Test in-game and verify item validation

Creating a Custom Formula

  1. Open ChaosMix_Formulas.xml

  2. Add a new <Formula> with unique Id

  3. Define MaxRate (hard cap on success)

  4. Add Token elements in RPN order

  5. Use LUCKOPT, ITEM, WING, etc. variables as needed

  6. Reference the formula in recipes with FormulaId="X"

Adjusting Success Rates

Global Changes: Edit the base number in formulas (e.g., change "50" to "60" in formula 2) Individual Recipe: Override MaxRate in the recipe's SuccessRate node Luck Impact: LUCKOPT always adds 25% when luck is present

circle-exclamation

Item Type Codes

Item type codes follow the formula: (Section * 512) + ItemIndex

Common sections:

  • 0-5: Weapons

  • 6-11: Armor

  • 12: Wings

  • 13: Pets/Helpers

  • 14: Jewels/Potions

  • 15: Scrolls

Example: Jewel of Chaos = section 14, index 22 = (14 * 512) + 22 = 7190

Common Issues

triangle-exclamation
circle-exclamation
circle-exclamation
circle-exclamation
triangle-exclamation
circle-info

Client Must Match: The client must have matching recipe data. Recipes are synced to client via GameDataSync. If the client doesn't have the recipe, it won't show in the chaos machine UI even if the server has it configured.

Reload Command

The plugin supports runtime reloading:

This re-reads all three XML files without restarting the server. Useful for testing configuration changes.

Last updated