Reference: Gamble.txt

Purpose

An experiment that was never officially released. This was to allow a gamble system similar to Diablo 2, where a general item type could be purchased and it would have random properties.

IMPORTANT!

This system has not been fully tested. There may be bugs or exploits. If you decide to use this feature, test it first to make sure the results work as expected, and that the server doesn't crash.

This also performs a linear search on the entire item database using the ID ranges provided. If the ranges operate on the entire database, server performance could suffer.

How It Works

When an item is purchased from a vendor, it searches the gamble list for the ItemDef mID of the purchased item. This vendor item should be an ItemDef entry specifically created for gambling, a kind of template item for "display purposes" only. Note that a file does exist with some templates already created (ItemDef_Gamble.txt).

If found as a gamble item, a search is performed on the item database (of the static ItemDef entries loaded from file). The search will attempt to query a list of items matching the search type and input criteria, returning a list of ItemDef IDs that match.

If the list has any results, a random ID is chosen from the list. The player will be given that item instead of the gamble template item that was purchased.

File Format

Basic INI format. Properties are loaded as key=value pairs.
Comment character: semicolon (;)
Uses Entry headers.

Block Format

[ENTRY] N/A Begins a new entry.
Name String Not used. Internal identification name. Max size is 19 characters.
TriggerItemID Integer If an item is purchased from a vendor that matches this ItemDef mID, an item database search will be performed using the search type and input criteria below.
SearchType String Must be one of these types:{linear, equip, query}

linear : Generate a list of potential items whos ItemDef mID ranges from MinID to MaxID (inclusive). Requires the MinID and MaxID properties. Both items must exist in the database.
equip : Uses MinID and MaxID just like linear but filters items to only allow the matching EquipType property.
query : Any of the properties below may be arbitrarily used for filter purposes, as long as they are valid (where valid is assumed to be a value that is not -1)

MinID Integer Minimum ID to accept in a range of items. The item must exist. Corresponds to the ItemDef mID property.
MaxID Integer Maximum ID to accept in a range of items. The item must exist. Corresponds to the ItemDef mID property.
EquipType Integer Limits the search to only accept a particular equipment type. Corresponds to the ItemDef mEquipType property, which must be a numerical value from the EquipType table
WeaponType Integer Limits the search to only accept a particular weapon type. Corresponds to the ItemDef mWeaponType property, which must be a numerical value from the WeaponType table.
MinLevel Integer Limits the search to only accept items whos ItemDef mMinUseLevel value is equal or higher to this.
MaxLevel Integer Limits the search to only accept items whos ItemDef mMinUseLevel value is equal or lower than this.