From 38b934ce9098e4f1242d77434345302eb95d01a5 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 9 Sep 2007 19:07:00 +0000 Subject: [PATCH] Fixed spoiler export template git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@683 0fc631ac-6414-0410-93d0-97cfa31319b6 --- .../export-template | 4 +- data/magic.mse-game/game | 69 +++++++++---------- doc/type/style.txt | 4 +- src/gui/html_export_window.cpp | 4 +- 4 files changed, 38 insertions(+), 43 deletions(-) diff --git a/data/magic-spoiler.mse-export-template/export-template b/data/magic-spoiler.mse-export-template/export-template index e3e97c99..a4b5d798 100644 --- a/data/magic-spoiler.mse-export-template/export-template +++ b/data/magic-spoiler.mse-export-template/export-template @@ -147,7 +147,7 @@ script: }" } 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) if count > 0 then "

{title} ({count} {if count == 1 then "card" else "cards"})

" + @@ -204,7 +204,7 @@ script: write_group(title: "Multicolor split cards", code:"H") + write_group(title: "Colorless", code:"I") + write_group(title: "Non-basic lands", code:"K") + - write_group(title: "Basic lands", code:"LMNOPQ") + write_group(title: "Basic lands", code:"L") else write_cards(cards: set.cards) } diff --git a/data/magic.mse-game/game b/data/magic.mse-game/game index b61e96f3..1bf13b29 100644 --- a/data/magic.mse-game/game +++ b/data/magic.mse-game/game @@ -170,60 +170,53 @@ init script: ############################################################## Card number # 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_null_cost := { input == "" or input == "0" } basic_land_sort := { - 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:"Swamp") then "LD" # Swamps - else if contains(card.name, match:"Mountain") then "LE" # Mountains - else if contains(card.name, match:"Forest") then "LF" # Forests - else "LA" # other basic lands - } - norm_or_token := { - if contains(card.shape, match:"token") then "T" - else "N" + 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:"Swamp") then "LD" # Swamps + else if contains(card.name, match:"Mountain") then "LE" # Mountains + else if contains(card.name, match:"Forest") then "LF" # Forests + else "LA" # other basic lands } color_of_card := { card_color := card.card_color casting_cost := card.casting_cost 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 ( - if card.rarity != "basic land" then "K" # Nonbasic Land + if card.rarity != "basic land" then "K" # Nonbasic Land else basic_land_sort() ) else if is_null_cost(casting_cost) then ( - if chosen(choice: "hybrid", card_color) then "G" # Hybrids - else if is_multicolor(card_color) then "F" # Multicolor - else if chosen(choice:"white", card_color) then "A" # White - else if chosen(choice:"blue", card_color) then "B" # Blue - else if chosen(choice:"black", card_color) then "C" # Black - else if chosen(choice:"red", card_color) then "D" # Red - else if chosen(choice:"green", card_color) then "E" # Green - else "I" # Colorless / Artifact + if chosen(choice: "hybrid", card_color) then "G" # Hybrids + else if is_multicolor(card_color) then "F" # Multicolor + else if chosen(choice:"white", card_color) then "A" # White + else if chosen(choice:"blue", card_color) then "B" # Blue + else if chosen(choice:"black", card_color) then "C" # Black + else if chosen(choice:"red", card_color) then "D" # Red + else if chosen(choice:"green", card_color) then "E" # Green + else "I" # Colorless / Artifact ) else ( # use the casting cost colors := sort_text(casting_cost, order: "") - if colors == "" then "I" # Colorless / Artifact - else if colors == "W" then "A" # White - else if colors == "U" then "B" # Blue - else if colors == "B" then "C" # Black - else if colors == "R" then "D" # Red - else if colors == "G" then "E" # Green - else "F" # Multicolor + if colors == "" then "I" # Colorless / Artifact + else if colors == "W" then "A" # White + else if colors == "U" then "B" # Blue + else if colors == "B" then "C" # Black + else if colors == "R" then "D" # Red + else if colors == "G" then "E" # Green + 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 := { if set.sort_special_rarity == "with the rest" or card.rarity != "special" then "A" else "Z" diff --git a/doc/type/style.txt b/doc/type/style.txt index 50b04a83..b391ae04 100644 --- a/doc/type/style.txt +++ b/doc/type/style.txt @@ -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. | ^^^ @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 @"\n"@ 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 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@.
@@ -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. ! <<< <<< <<< <<< -| @"choice"@, @"multiple choice"@, @"boolean"@ +| @"choice"@,
@"multiple choice"@,
@"boolean"@ @popup style@ @"drop down"@ or @"in place"@ @"drop down"@ Where to place the drop down box for editing the value.
@"drop down"@ places the box below the field, similair to normal combo boxes.
@"in place"@ places the box at the mouse coordinates. diff --git a/src/gui/html_export_window.cpp b/src/gui/html_export_window.cpp index 6d69aa81..8bf75adf 100644 --- a/src/gui/html_export_window.cpp +++ b/src/gui/html_export_window.cpp @@ -64,7 +64,9 @@ void HtmlExportWindow::onOk(wxCommandEvent&) { info.directory_relative = fn.GetName() + _("-files"); fn.SetFullName(info.directory_relative); info.directory_absolute = fn.GetFullPath(); - wxMkdir(info.directory_absolute); + if (!wxDirExists(info.directory_absolute)) { + wxMkdir(info.directory_absolute); + } } // run export script Context& ctx = set->getContext();