WHITESPACE = _{ " " | "\t" | "\r" | "\n" }
separator = _{ "--------" }
line = @{ (!(NEWLINE) ~ ANY)+ }
INTEGER = @{ ASCII_DIGIT+ }
STRING = @{ ASCII_ALPHA+ }
STRING_WITH_SPACES = @{ (!("\"") ~ ANY)+ }
ALPHANUMERIC = @{ ASCII_ALPHANUMERIC+ }
non_separator_line = @{ !(separator) ~ line }
item = { SOI ~ (equipment) }
equipment = _ {
item_class
~ rarity_line
~ name
~ (separator|(base ~ separator))
~ limits_block?
~ weapon_stats_block?
~ requirements_block?
~ sockets_block?
~ item_level_block
~ modifiers_block?
~ modifiers_block?
~ modifiers_block?
}
item_level_blocsk = {
"Item Level: "
}
// { Prefix Modifier "Scorching" (Tier: 5) — Damage, Elemental, Fire, Attack }
annotation = _ {
"{"
~ modifier_type
~ WHITE_SPACE*
~ modifier_name?
~ WHITE_SPACE*
~ modifier_tier_line?
~ WHITE_SPACE*
~ modifier_tags?
~ "}"
}
modifier_name = { "\"" ~ STRING_WITH_SPACES ~ "\"" }
modifier_tier_line = _ { "(Tier: " ~ modifier_tier ~ ")" }
modifier_tags = _ { "—" ~ (modifier_tag ~ ("," ~ WHITE_SPACE* ~ modifier_tag)*)? }
modifier_tag = { ASCII_ALPHA+ } // Simple words like Damage, Elemental
modifier_tier = { INTEGER }
modifier_type = {
("Unique Modifier" | "Prefix Modifier" | "Master Crafted Prefix Modifier" | "Suffix Modifier" | "Master Crafted Suffix Modifier" | "Implicit Modifier" | "Explicit Modifier") // Add other types as needed
}
modifier_line = { non_separator_line }
modifier_entry = _ {
(annotation)?
~ modifier_line
}
modifiers_block = _ {
(modifier_entry)*
~ separator?
}
sockets_block = _ {
"Sockets: " ~ sockets ~ separator
}
sockets = { line }
item_level_block = _ {
"Item Level: " ~ ilvl ~ separator
}
ilvl = { INTEGER }
weapon_stats_block = _ {
weapon_type
~ ("Quality: " ~ quality)?
~ ("Physical Damage: " ~ physical_damage)?
~ ("Elemental Damage: " ~ elemental_damage)?
~ ("Critical Strike Chance: " ~ crit_strike_chance)?
~ ("Attacks per Second: " ~ attacks_per_second)?
~ ("Weapon Range: " ~ weapon_range)?
~ separator
}
quality = { line }
physical_damage = { line }
elemental_damage = { line }
crit_strike_chance = { line }
attacks_per_second = { line }
weapon_range = { line }
limits_block = _ {
"Limited to: " ~ limited_to ~ separator
}
requirements_block = _ {
"Requirements:"
~ (
("Level: " ~ lvl_req)
| ("Str: " ~ str_req)
| ("Dex: " ~ dex_req)
| ("Int: " ~ int_req)
| ("Class:: " ~ class_req)
)*
~ separator
}
lvl_req = { INTEGER }
str_req = { INTEGER }
dex_req = { INTEGER }
int_req = { INTEGER }
class_req = { STRING }
limited_to = { ALPHANUMERIC }
weapon_type = {
"Bow"
| "Claw"
| "Dagger"
| "Rune Dagger"
| "One Hand Axe"
| "One Hand Sword"
| "One Handed Mace"
| "Sceptre"
| "Staff"
| "Warstaff"
| "Two Hand Axe"
| "Two Hand Sword"
| "Two Handed Mace"
| "Wand"
| "Fishing Rod"
}
name = { line }
base = { non_separator_line }
item_class = _{ "Item Class: " ~ class }
class = {
"Bows"
| "Claws"
| "Daggers"
| "Rune Daggers"
| "One Hand Axes"
| "One Hand Swords"
| "Thrusting One Hand Swords"
| "One Handed Maces"
| "Sceptres"
| "Staves"
| "Warstaves"
| "Two Hand Axes"
| "Two Hand Swords"
| "Two Handed Maces"
| "Wands"
| "Fishing Rods"
| "Body Armours"
| "Boots"
| "Gloves"
| "Helmets"
| "Shields"
| "Quivers"
| "Amulets"
| "Belts"
| "Rings"
| "Trinkets"
| "Skill Gems"
| "Support Gems"
| "Jewels"
| "Abyss Jewels"
| "Life Flasks"
| "Mana Flasks"
| "Hybrid Flasks"
| "Utility Flasks"
// TODO: Add rest of the item types
}
rarity_line = _{ "Rarity: " ~ rarity }
rarity = { "Normal" | "Magic" | "Rare" | "Unique" | "Gem" }