EventItemBag

Event Item Bag system for defining loot tables with weighted drops, item options, and nested bag references

The EventItemBag system allows you to define reusable loot tables for monsters, events, and special items. When triggered, bags randomly select items from their pool based on configured rates and rules.

File Locations

Bag Registry: GameServer/Data/EventItemBagManager.xml Bag Definitions: GameServer/Data/EventItemBag/###␣-␣Name.xml

The registry maps bag indices to trigger conditions (item type, monster class, or special value), while individual bag XML files define the actual loot tables.

Dependencies

Depends On
Purpose

Option rate indices used by extended bag Item entries (Option0-6)

Required for the Count attribute to take effect on stackable items

Used when SetItemDropRate triggers a random set item drop

File Naming Convention

Bag files must follow this exact pattern:

###␣-␣Name.xml
  • ### = Three-digit bag index (000-999) matching EventItemBagManager.xml

  • = Single space

  • - = Hyphen

  • = Single space

  • Name.xml = Descriptive name with .xml extension

Examples:

  • 000 - Box of Luck.xml

  • 012 - Blood Castle 1.xml

  • 051 - Game Master Box.xml

EventItemBagManager.xml Structure

Maps bag indices to trigger conditions.

Attribute
Type
Description

Index

int

Bag index (must match filename ###)

ItemIndex

int or *

Item type that triggers this bag (e.g., 7179 = Box of Luck). Use * for wildcard

ItemLevel

int or *

Item level required to trigger. Use * for any level

MonsterClass

int or *

Monster class that drops this bag. Use * for any monster

SpecialValue

int or *

Event-specific trigger ID. Use * for any value

circle-info

At least one of ItemIndex+ItemLevel, MonsterClass, or SpecialValue must be specified. The system checks these in order when determining which bag to use.

Trigger Examples

Bag Configuration Formats

Bags support two formats: Simple and Extended.

Simple Format

Randomly selects one item from a flat list. All items have equal probability.

Extended Format

Weighted drops with sections, class requirements, and advanced options.

circle-info

If both <Drop> entries and <ExtendedBag> exist in the same file, the Extended format takes priority and Simple drops are ignored.

BagConfig Attributes

Common configuration for both formats.

Attribute
Type
Default
Description

Name

string

-

Bag name (for reference only)

DropZen

int

0

Zen amount to drop if item roll fails

ItemDropRate

int

100

Rate out of 100 for item drop chance. If check fails (random >= rate), drops DropZen instead. 100 = always try item, 0 = always drop zen

ItemDropCount

int

1

Simple format only: Number of drop attempts. Each attempt rolls ItemDropRate for item vs zen. Extended format ignores this and uses BagInfo DropRate instead

SetItemDropRate

int

0

Rate out of 10000 for random set item instead of bag item (e.g., 100 = 1%)

ItemDropType

int

0

0 = Fixed options, 1 = Randomize Skill/Luck and scale Option+3 inversely

Fireworks

int

0

Simple format: 1 = Send fireworks effect after all drops complete, 0 = No effect. Extended format: Ignored, use OptionValue & 1 in DropInfo instead

circle-exclamation

Simple Format: Drop Entries

Flat list of items with equal probability.

Attribute
Type
Description

Cat

int

Item category (0-15)

ItemIndex

int

Item index within category

MinLevel

int

Minimum item level (0-15)

MaxLevel

int

Maximum item level (0-15). If same as MinLevel, fixed level. If higher, random level in range

Skill

int or *

0 = No skill, 1 = Force skill, * = Use ItemOptionRate default rate logic

Luck

int or *

0 = No luck, 1 = Force luck, * = Use ItemOptionRate default rate logic

Option

int or *

Fixed Option+X level (0-7 or 0-28). 0 = No option, * = Use ItemOptionRate default rate logic

Exc

int or *

Number of excellent options to force generate (0-6), * = Use ItemOptionRate default rate logic

Set

int or *

0 = No set, 1 = Force set generation, * = Use ItemOptionRate default rate logic

Socket

int or *

0 = Use ItemOptionRate index 0 for socket generation, 1-5 = Force N sockets (0xFE placeholders), * = Use ItemOptionRate default rate logic

Count

int

Stack size to assign when the item drops. 0 or omitted = default behavior (stack of 1). Only applies to items registered as stackable in ItemStack.xml. See ItemStack

ItemDropType Behavior

When ItemDropType="1":

  • Skill: Randomized (50% chance)

  • Luck: Randomized (50% chance)

  • Option: Scaled inversely by MaxItemOption. Higher option values become less likely

  • Exc: If any excellent option is set, forces Skill=1

circle-info

Use ItemDropType="1" for natural monster drops with variable quality. Use ItemDropType="0" for fixed event rewards.

Extended Format: BagInfo

Defines weighted drop pools with class requirements.

Attribute
Type
Description

Index

int

BagInfo index (must be unique within file, arbitrary number)

DropRate

int

Rate out of 10000 for this bag to activate (e.g., 10000 = 100%, 5000 = 50%)

circle-exclamation

Extended Format: DropInfo

Defines sections within a BagInfo. One section is randomly selected based on weights and class requirements.

Attribute
Type
Description

Section

int

ItemSection Id to use if selected

SectionRate

int

Weight for weighted random selection. Higher = more likely

Money

int

Zen amount to drop if section is selected but has no valid items

OptionValue

int

Bitflags: Bit 0 (+1) = Send fireworks for this drop, Bit 1 (+2) = Check party member classes instead of just bag opener. Can combine (e.g., 3 = fireworks + party check)

RequireClass

string

Space-separated minimum ChangeUp requirement per class: DW DK FE MG DL SU RF. Value is minimum (ChangeUp+1). 0=block, 1=allow base class, 2=require 1st ChangeUp+, 3=require 2nd ChangeUp+, 4=require 3rd ChangeUp+

Class Requirement Format

Position mapping:

  1. Dark Wizard (0=blocked, 1=base class, 2=1st ChangeUp+, 3=2nd ChangeUp+, 4=3rd ChangeUp+)

  2. Dark Knight

  3. Fairy Elf

  4. Magic Gladiator

  5. Dark Lord

  6. Summoner

  7. Ragefighter

Example: "1 0 0 0 0 0 0" = Only Dark Wizards, base class and above (any ChangeUp) Example: "2 2 0 0 0 0 0" = Only DW/DK with at least 1st class quest completed Example: "3 3 3 0 0 0 0" = Only DW/DK/FE with at least 2nd class quest completed

circle-info

If multiple DropInfo entries match the player's class, they compete via SectionRate weights. If none match, NO drop occurs (the DropInfo is skipped entirely). The Money attribute is only used if a DropInfo IS selected but its ItemSection is empty or invalid.

Extended Format: ItemSection

Defines item pools referenced by DropInfo sections.

ItemSection attributes:

  • Id = Section identifier (referenced by DropInfo)

Item attributes:

Attribute
Type
Description

Index

int

Item index (full index, e.g., 6277 = 12*512 + 277)

Level

int

Base item level (0-15)

Grade

int

Excellent option bitmask to use if Option4 rate generates 0 excellent options (fallback value when no excellent options roll)

Option0

int or *

Level generation rate index. * = Use default. See ItemOptionRate GetItemOption0

Option1

int or *

Skill option rate index. * = Use default. See ItemOptionRate GetItemOption1

Option2

int or *

Luck option rate index. * = Use default. See ItemOptionRate GetItemOption2

Option3

int or *

Option+X rate index. * = Use default. See ItemOptionRate GetItemOption3

Option4

int or *

Excellent option rate index. * = Use default. See ItemOptionRate GetItemOption4

Option5

int or *

Set option rate index. * = Use default. See ItemOptionRate GetItemOption5

Option6

int or *

Socket option rate index. * = Use default. See ItemOptionRate GetItemOption6

Duration

int

Time-limited item duration in seconds. 0 = Permanent. 1209600 = 14 days

Count

int

Stack size to assign when the item drops. 0 or omitted = default behavior (stack of 1). Only applies to items registered as stackable in ItemStack.xml. See ItemStack

circle-info

Option0-6 reference ItemOptionRate.xml indices, not direct values. Use * to apply default rate logic, or specify an index for custom rates.

Option Index System

All Option0-6 attributes reference rate tables in ItemOptionRate.xml:

  • Option0: Level adjustment (can increase/decrease base level)

  • Option1: Skill (0% or 100% chance depending on rate)

  • Option2: Luck (0% or 100% chance depending on rate)

  • Option3: Add option level (0-7 or 0-28, rate-based)

  • Option4: Excellent options (generates 0-6 exc options by rate)

  • Option5: Set bonus (generates set attribute by rate)

  • Option6: Socket slots (generates 0-5 sockets by rate)

See ItemOptionRate for rate index definitions.

Stack Count (Count Attribute)

Both simple bag <Drop> rows and extended bag <Item> rows accept a Count attribute that controls the stack size of the dropped item.

Rules

  • If Count is omitted or 0, the item drops with the default durability/stack value of 1 (unchanged behavior).

  • If Count is greater than 0 and the item is registered as stackable in ItemStack.xml, the item's stack count is set to that value.

  • If the item is not registered as stackable in ItemStack.xml, Count is ignored and the item drops with a stack of 1. Setting Count on a non-stackable item has no effect.

  • The stack count is stored in the same byte field as durability. For items where Count > 1, the durability field carries the count value to the client.

  • Maximum value is 255 (stored as a single byte).

circle-info

Items that stack (jewels, potions, etc.) are defined in GameServer/Data/Item/ItemStack.xml. You can only use Count to control how many of a stackable item drop at once. Using Count on equipment or other non-stackable items does nothing.

circle-exclamation

Examples

Simple bag dropping 10 Jewels of Bless at once:

Extended bag dropping 5 Jewels of Soul at once:

Important Behavior

GetItem vs DropItem (Extended Format)

GetItem (used when bag opens into inventory):

  • Processes BagInfo entries until ONE succeeds

  • Returns the first item that passes all checks

  • Ignores remaining BagInfo entries after first success

  • Result: Maximum 1 item per bag open

DropItem (used when bag drops items on ground):

  • Processes ALL BagInfo entries

  • Each BagInfo that passes DropRate check drops an item

  • Result: Can drop multiple items if multiple BagInfo entries succeed

circle-info

This difference allows tiered loot: when opened in inventory you get ONE item, but when dropped on ground (e.g., event reward) you can configure multiple guaranteed drops using multiple BagInfo entries with DropRate=10000.

Selection Algorithm

Simple Format:

  1. Repeat ItemDropCount times:

    • Roll random 0-99, if >= ItemDropRate, drop DropZen zen and continue to next iteration

    • Roll random 0-9999, if < SetItemDropRate, drop random set item and continue

    • Otherwise, pick random item from Drop list (equal probability) and drop it

  2. If Fireworks=1, send fireworks effect after all drops

Extended Format:

  1. For EACH BagInfo (can process multiple BagInfo per bag open):

    • Roll random 0-9999, if >= DropRate, skip this BagInfo entirely

    • Build list of DropInfo entries matching player class/ChangeUp requirements

    • If no DropInfo matches class, skip this BagInfo (no drop)

    • Select one DropInfo by weighted random (SectionRate)

    • Find ItemSection with matching Section Id

    • If section doesn't exist or is empty, drop Money zen

    • Otherwise, pick random item from section (equal probability)

    • Generate item options using Option0-6 rate indices via ItemOptionRate

    • If OptionValue & 1, send fireworks effect for this drop

  2. Process continues for all BagInfo entries (can drop multiple items if multiple BagInfo pass their DropRate)

Class Requirement Checking

  • OptionValue & 2 = 0: Check only the player opening the bag

  • OptionValue & 2 = 2: Check all party members. If any party member matches, that DropInfo is eligible

This allows party-wide class rewards where any qualifying member triggers the drop.

Nested Bags

To reference another bag from a drop, add a <Drop> entry pointing to an item that has its own bag definition:

If item 14/13 has a bag definition in EventItemBagManager.xml, opening it triggers that bag's logic.

circle-info

This creates tiered rewards: outer box drops inner box, which drops final items. Useful for progressive reward systems.

Examples

Fixed rewards with equal probability.

Result: Always drops Jewel of Bless. No randomness.

Common Issues

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

Last updated