Commit b11cfe8a authored by twanvl's avatar twanvl

Fixed spoiler export template

parent cb31a811
...@@ -147,7 +147,7 @@ script: ...@@ -147,7 +147,7 @@ script:
}</ul>" }</ul>"
} }
write_group := { write_group := {
cards := filter_list(set.cards, filter: { contains(match:sort_index(card:input), code } ) cards := filter_list(set.cards, filter: { contains(color_of_card(card:input), match:code) } )
count := number_of_items(in:cards) count := number_of_items(in:cards)
if count > 0 then if count > 0 then
"<h2>{title} ({count} {if count == 1 then "card" else "cards"})</h2>" + "<h2>{title} ({count} {if count == 1 then "card" else "cards"})</h2>" +
...@@ -204,7 +204,7 @@ script: ...@@ -204,7 +204,7 @@ script:
write_group(title: "Multicolor split cards", code:"H") + write_group(title: "Multicolor split cards", code:"H") +
write_group(title: "Colorless", code:"I") + write_group(title: "Colorless", code:"I") +
write_group(title: "Non-basic lands", code:"K") + write_group(title: "Non-basic lands", code:"K") +
write_group(title: "Basic lands", code:"LMNOPQ") write_group(title: "Basic lands", code:"L")
else else
write_cards(cards: set.cards) write_cards(cards: set.cards)
} }
......
...@@ -170,60 +170,53 @@ init script: ...@@ -170,60 +170,53 @@ init script:
############################################################## Card number ############################################################## Card number
# Index for sorting, white cards are first, so white->A, blue->B, .. , # Index for sorting, white cards are first, so white->A, blue->B, .. ,
# multi->F, hybrid->G, diff color splits -> H, arti->I, land->K, basic land->L, plains->M, island->N, swamp->O, mountain->P, forest->Q # The code consists of 4 parts:
# normal/token, color, shifted, split
sort_index := {
(if contains(card.shape, match:"token") then "T" else "N") + # Tokens come last
color_of_card() +
(if contains(card.shape, match:"shifted") then "1" else "0") + # planeshifted cards come after normal ones
(if contains(card.shape, match:"split") then "1" else "0") # split cards come after normal ones
}
is_multicolor := { chosen(choice: "multicolor") and input != "artifact, multicolor" } is_multicolor := { chosen(choice: "multicolor") and input != "artifact, multicolor" }
is_null_cost := { input == "" or input == "0" } is_null_cost := { input == "" or input == "0" }
basic_land_sort := { basic_land_sort := {
if contains(card.name, match:"Plains") then "LB" # Plains if contains(card.name, match:"Plains") then "LB" # Plains
else if contains(card.name, match:"Island") then "LC" # Islands else if contains(card.name, match:"Island") then "LC" # Islands
else if contains(card.name, match:"Swamp") then "LD" # Swamps else if contains(card.name, match:"Swamp") then "LD" # Swamps
else if contains(card.name, match:"Mountain") then "LE" # Mountains else if contains(card.name, match:"Mountain") then "LE" # Mountains
else if contains(card.name, match:"Forest") then "LF" # Forests else if contains(card.name, match:"Forest") then "LF" # Forests
else "LA" # other basic lands else "LA" # other basic lands
}
norm_or_token := {
if contains(card.shape, match:"token") then "T"
else "N"
} }
color_of_card := { color_of_card := {
card_color := card.card_color card_color := card.card_color
casting_cost := card.casting_cost casting_cost := card.casting_cost
if card.shape == "split" and if card.shape == "split" and
casting_cost != card.casting_cost_2 then "H" # Diff Color Splits casting_cost != card.casting_cost_2 then "H" # Diff Color Splits
else if chosen(choice: "land", card_color) then ( else if chosen(choice: "land", card_color) then (
if card.rarity != "basic land" then "K" # Nonbasic Land if card.rarity != "basic land" then "K" # Nonbasic Land
else basic_land_sort() else basic_land_sort()
) else if is_null_cost(casting_cost) then ( ) else if is_null_cost(casting_cost) then (
if chosen(choice: "hybrid", card_color) then "G" # Hybrids if chosen(choice: "hybrid", card_color) then "G" # Hybrids
else if is_multicolor(card_color) then "F" # Multicolor else if is_multicolor(card_color) then "F" # Multicolor
else if chosen(choice:"white", card_color) then "A" # White else if chosen(choice:"white", card_color) then "A" # White
else if chosen(choice:"blue", card_color) then "B" # Blue else if chosen(choice:"blue", card_color) then "B" # Blue
else if chosen(choice:"black", card_color) then "C" # Black else if chosen(choice:"black", card_color) then "C" # Black
else if chosen(choice:"red", card_color) then "D" # Red else if chosen(choice:"red", card_color) then "D" # Red
else if chosen(choice:"green", card_color) then "E" # Green else if chosen(choice:"green", card_color) then "E" # Green
else "I" # Colorless / Artifact else "I" # Colorless / Artifact
) else ( ) else (
# use the casting cost # use the casting cost
colors := sort_text(casting_cost, order: "<WUBRG>") colors := sort_text(casting_cost, order: "<WUBRG>")
if colors == "" then "I" # Colorless / Artifact if colors == "" then "I" # Colorless / Artifact
else if colors == "W" then "A" # White else if colors == "W" then "A" # White
else if colors == "U" then "B" # Blue else if colors == "U" then "B" # Blue
else if colors == "B" then "C" # Black else if colors == "B" then "C" # Black
else if colors == "R" then "D" # Red else if colors == "R" then "D" # Red
else if colors == "G" then "E" # Green else if colors == "G" then "E" # Green
else "F" # Multicolor else "F" # Multicolor
) )
} }
is_shifted := {
if contains(card.shape, match:"shifted") then "1"
else "0"
}
is_split := {
if contains(card.shape, match:"split") then "1"
else "0"
}
sort_index := { norm_or_token() + color_of_card() + is_shifted() + is_split()
}
rarity_sort := { rarity_sort := {
if set.sort_special_rarity == "with the rest" or card.rarity != "special" then "A" else "Z" if set.sort_special_rarity == "with the rest" or card.rarity != "special" then "A" else "Z"
......
...@@ -73,7 +73,7 @@ The rest of the properties depend on the type of [[type:field]] this style is fo ...@@ -73,7 +73,7 @@ The rest of the properties depend on the type of [[type:field]] this style is fo
A line height of @0@ means all lines are in the same position, @1@ is normal behaviour, @2@ skips a line, etc. A line height of @0@ means all lines are in the same position, @1@ is normal behaviour, @2@ skips a line, etc.
| ^^^ @line height hard@ [[type:double]] @1@ Multiplier for the line height of 'hard' line breaks. These are breaks caused by the enter key. | ^^^ @line height hard@ [[type:double]] @1@ Multiplier for the line height of 'hard' line breaks. These are breaks caused by the enter key.
| ^^^ @line height line@ [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by @"<line>\n</line>"@ tags. | ^^^ @line height line@ [[type:double]] @1@ Multiplier for the line height of 'soft' line breaks. These are breaks caused by @"<line>\n</line>"@ tags.
| ^^^ @line height soft max@ ^^^ ''disabled'' When there is still vertical room in the text box, increase the line heights to at most these values to spread the text more evenly. | ^^^ @line height soft max@ [[type:double]] ''disabled'' When there is still vertical room in the text box, increase the line heights to at most these values to spread the text more evenly.
| ^^^ @line height hard max@ ^^^ ^^^ ^^^ | ^^^ @line height hard max@ ^^^ ^^^ ^^^
| ^^^ @line height line max@ ^^^ ^^^ ^^^ | ^^^ @line height line max@ ^^^ ^^^ ^^^
| ^^^ @paragraph height@ [[type:double]] ''flexible'' The height of paragraphs. If specified, each paragraph is given this much space, and aligned inside that space as specified by @alignment@.<br/> | ^^^ @paragraph height@ [[type:double]] ''flexible'' The height of paragraphs. If specified, each paragraph is given this much space, and aligned inside that space as specified by @alignment@.<br/>
...@@ -86,7 +86,7 @@ The rest of the properties depend on the type of [[type:field]] this style is fo ...@@ -86,7 +86,7 @@ The rest of the properties depend on the type of [[type:field]] this style is fo
| ^^^ @content lines@ [[type:int]] ''automatic'' When read from a script, gives the number of lines of the current content in this box. | ^^^ @content lines@ [[type:int]] ''automatic'' When read from a script, gives the number of lines of the current content in this box.
! <<< <<< <<< <<< ! <<< <<< <<< <<<
| @"choice"@, @"multiple choice"@, @"boolean"@ | @"choice"@,<br/>@"multiple choice"@,<br/>@"boolean"@
@popup style@ @"drop down"@ or @"in place"@ @"drop down"@ Where to place the drop down box for editing the value.<br/> @popup style@ @"drop down"@ or @"in place"@ @"drop down"@ Where to place the drop down box for editing the value.<br/>
@"drop down"@ places the box below the field, similair to normal combo boxes.<br/> @"drop down"@ places the box below the field, similair to normal combo boxes.<br/>
@"in place"@ places the box at the mouse coordinates. @"in place"@ places the box at the mouse coordinates.
......
...@@ -64,7 +64,9 @@ void HtmlExportWindow::onOk(wxCommandEvent&) { ...@@ -64,7 +64,9 @@ void HtmlExportWindow::onOk(wxCommandEvent&) {
info.directory_relative = fn.GetName() + _("-files"); info.directory_relative = fn.GetName() + _("-files");
fn.SetFullName(info.directory_relative); fn.SetFullName(info.directory_relative);
info.directory_absolute = fn.GetFullPath(); info.directory_absolute = fn.GetFullPath();
wxMkdir(info.directory_absolute); if (!wxDirExists(info.directory_absolute)) {
wxMkdir(info.directory_absolute);
}
} }
// run export script // run export script
Context& ctx = set->getContext(); Context& ctx = set->getContext();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment