Format spec

This is a spec for passing data to combat simulator with pre-filled values in BNF format.
Just add the resulting string prepended with # to the page url.

<data> ::= "#", [<attacker>], [<defender>]

<attacker> ::= "a:", <race> [, <attack-type>], <units> [, <upgrades>] [, <population>] [, <cata-targets>] [, <hero>] [, <plus-stat>] [, <scout-art>] [, <big-party>] [, <brewery>], "#"
<defender> ::= "d:", <race> [, <population>] [, <wall>] [, <residence>] [, <stonemason>] [, <traps>] [, <plus-stat>] [, <scout-art>] [, <dur-art>] [, <big-party>], (<def-side>){1,}, "#"
(* here race is attribute of place of battle, affects type of wall *)

<def-side> ::= ";", <race>, <units> [, <upgrades>] [, <hero>]
(* here race is attribute of units *)
<race> ::= "r", <digit>
(* 1 - romans, 2 - teutons, 3 - gauls; off:/4 - natar/; def:/4 - nature, 5 - natar/ *)
<units> ::= "u", <number-array>
(* examples: "u10,,,10", "u,,100" *)
<upgrades> ::= "U", ( <number-array> | "!", <number> )
(* notice compact indexing (50 imps @10 up level are "u,,50U10", not "u,,50U,,10") and CAPITAL "U" *)
(* "!U<number>" means, that all units have the same upgrade level *)
<attack-type> ::= "R"[,<number>](* R for raid, empty for normal *)
(* R0 = R: raid, R1 = '' (default): normal, R2: siege *)
<population> ::= "p", <number> (* population of whole account *)
<wall> ::= "w", <number> (* wall level *)
<residence> ::= "R", <number> (* residence/palace level *)
<stonemason> ::= "s", <number> (* stonemason level *)
<traps> ::= "t", <number> (* traps amount *)
<plus-stat> ::= "P" (* plus-offense or plus-defense *)
<scout-art> ::= "S", <number> (* scouting artifact effect: 0 - 10x, 1 - 5x, 2 - 3x, 3 - 1x, 4 - 0.33x, 5 - 0.2x, 6 - 0.1x *)
<dur-art> ::= "D", <number> (* durability artifact effect: 0 - 5x, 1 - 4x, 2 - 3x, 3 - 2x, 4 - 1x, 5 - 0.5x, 6 - 0.33x, 7 - 0.25x, 8 - 0.2x *)
<brewery> ::= "B", <number> (* brewery level celebration *)
<big-party> ::= "C" (* big celebration from any side *)
<cata-targets> ::= "b", <number> [, <number>]
(* levels of targeted buildings *)

<hero> ::= "h" [, <digit>, ",", <number>, ",", <number>, ",", <number>] [, <hero-items>]
(* unit-type(0-4), self skill(0-100), bonus skill(0-100), health(0-100) *)
<hero-items> ::= "i", <number-array> (* comma-separated indices for items: right-hand, left-hand, body, cages, bandages, bandage type (0 - small, 1 - big) *) (* item quality is not supported yet *)

<number-array> ::= <number-null> [, ",", <number-null>]{0,9}
<number> ::= <digit>{1,} [, <multiplier>]
<number-null> ::= <digit>{0,} (* empty string considered as zero *)

<digit> ::= ( "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" )
<multiplier> ::= ( "K" | "M" )
(* K is for 1'000 and M is for 1'000'000 *)