Update style
Fix <sep-soft> issue in maintype() Add support for <related> tags and persistent relations Condense some options
This commit is contained in:
@@ -20,28 +20,21 @@ file type: *.xml|*.xml|*.*|*.*
|
|||||||
|
|
||||||
option field:
|
option field:
|
||||||
type: choice
|
type: choice
|
||||||
name: version
|
name: info
|
||||||
choice: CS/ECH 2.0
|
choice: CS/ECH 2.0, guide: https://tinyurl.com/ctexportv2
|
||||||
option field:
|
|
||||||
type:choice
|
|
||||||
name: Usage Guide
|
|
||||||
choice: https://tinyurl.com/csexporter
|
|
||||||
option field:
|
option field:
|
||||||
type: text
|
type: text
|
||||||
name: cockatrice Set Type
|
name: cockatrice Set Type
|
||||||
description: The "set type" your set will appear as in Cockatrice. "Custom" should be the default.
|
description: The "set type" your set will appear as in Cockatrice. "Custom" should be the default.
|
||||||
default: Custom
|
default: Custom
|
||||||
option field:
|
|
||||||
type: boolean
|
|
||||||
name: export Images
|
|
||||||
description: Whether or not to export images along with the XML. These images are recommended for Cockatrice use.
|
|
||||||
initial: yes
|
|
||||||
option field:
|
option field:
|
||||||
type: choice
|
type: choice
|
||||||
name: images File Type
|
name: export Images
|
||||||
description: Which file extension you want the images exported as. JPG is lower quality but lower file size.
|
description: Export images along with the XML? Recommended for Cockatrice use. JPG is lower quality but lower file size.
|
||||||
|
choice: no
|
||||||
choice: JPG
|
choice: JPG
|
||||||
choice: PNG
|
choice: PNG
|
||||||
|
initial: no
|
||||||
option field:
|
option field:
|
||||||
type: boolean
|
type: boolean
|
||||||
name: tokens In Separate XML
|
name: tokens In Separate XML
|
||||||
@@ -57,49 +50,40 @@ option field:
|
|||||||
name: append String To Names
|
name: append String To Names
|
||||||
description: Appended to the front of all card names and image names.
|
description: Appended to the front of all card names and image names.
|
||||||
option field:
|
option field:
|
||||||
type: boolean
|
type: multiple choice
|
||||||
name: include Common
|
name: rarities to export
|
||||||
description: Whether to include common cards or not.
|
choice: common
|
||||||
initial: yes
|
choice: uncommon
|
||||||
option field:
|
choice: rare
|
||||||
type: boolean
|
choice: mythic rare
|
||||||
name: include Uncommon
|
choice: basic land
|
||||||
description: Whether to include uncommon cards or not.
|
choice: special
|
||||||
initial: yes
|
choice: token
|
||||||
option field:
|
choice: masterpiece
|
||||||
type: boolean
|
initial: common, uncommon, rare, mythic rare, basic land, special, token, masterpiece
|
||||||
name: include Rare
|
option style:
|
||||||
description: Whether to include rare cards or not.
|
rarities to export:
|
||||||
initial: yes
|
render style: checklist
|
||||||
option field:
|
direction: vertical
|
||||||
type: boolean
|
export Images:
|
||||||
name: include Mythic
|
render style: both
|
||||||
description: Whether to include mythic rare cards or not.
|
choice images:
|
||||||
initial: yes
|
no: {built_in_image("bool_no")}
|
||||||
option field:
|
JPG: {built_in_image("bool_yes")}
|
||||||
type: boolean
|
PNG: {built_in_image("bool_yes")}
|
||||||
name: include Basic Land
|
|
||||||
description: Whether to include basic land rarity cards or not.
|
|
||||||
initial: yes
|
|
||||||
option field:
|
|
||||||
type: boolean
|
|
||||||
name: include Tokens
|
|
||||||
description: Whether to include tokens or not.
|
|
||||||
initial: yes
|
|
||||||
option field:
|
|
||||||
type: boolean
|
|
||||||
name: include Special
|
|
||||||
description: Whether to include special rarity cards or not.
|
|
||||||
initial: yes
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
splitter_name := {false} ## experimental future thing for splitting dfc images
|
splitter_name := {false} ## experimental future thing for splitting dfc images
|
||||||
#determine if the card is a type that is a "token" i.e. it should be batched with tokens instead of with other cards
|
#determine if the card is a type that is a "token" i.e. it should be batched with tokens instead of with other cards
|
||||||
is_token := {contains(card.shape, match:"token") or contains(card.shape, match:"emblem") or contains(card.shape, match:"rulestip") }
|
is_token := {contains(card.shape, match:"token") or contains(card.shape, match:"emblem") or contains(card.shape, match:"rulestip") }
|
||||||
is_double := {contains(card.shape, match:"double") }
|
is_double := {contains(card.shape, match:"double") }
|
||||||
|
|
||||||
|
file_type := {if options.export_Images == "PNG" then "png" else "jpg"}
|
||||||
|
|
||||||
#determine if the card is of a rarity that should be included
|
#determine if the card is of a rarity that should be included
|
||||||
included_rarity := {
|
included_rarity := {
|
||||||
|
(is_token() and chosen(options.rarities_to_export, choice:"token")) or chosen(options.rarities_to_export, choice:card.rarity)
|
||||||
|
}
|
||||||
|
included_rarity2 := {
|
||||||
(is_token() and options.include_Tokens)
|
(is_token() and options.include_Tokens)
|
||||||
or (card.rarity == "basic land" and options.include_Basic_Land)
|
or (card.rarity == "basic land" and options.include_Basic_Land)
|
||||||
or (card.rarity == "common" and options.include_Common)
|
or (card.rarity == "common" and options.include_Common)
|
||||||
@@ -114,6 +98,7 @@ script:
|
|||||||
replace@(match: "’",replace:"'") + #replace bad apostrophe with good apostrophe
|
replace@(match: "’",replace:"'") + #replace bad apostrophe with good apostrophe
|
||||||
replace@(match:":", replace:"")+ #remove colons
|
replace@(match:":", replace:"")+ #remove colons
|
||||||
replace@(match:";", replace:"")+ #remove semicolons
|
replace@(match:";", replace:"")+ #remove semicolons
|
||||||
|
replace@(match:"\n", replace:"")+ #remove linebreaks
|
||||||
replace@(match:"\\.", replace:"") #remove periods
|
replace@(match:"\\.", replace:"") #remove periods
|
||||||
|
|
||||||
# escape special xml characters
|
# escape special xml characters
|
||||||
@@ -132,9 +117,12 @@ script:
|
|||||||
#determining what name should be used for the card
|
#determining what name should be used for the card
|
||||||
card_name := { if exporter_name_grabber(exporter_name_filter(card.notes)) != "" then exporter_name_grabber(exporter_name_filter(card.notes)) else card.name }
|
card_name := { if exporter_name_grabber(exporter_name_filter(card.notes)) != "" then exporter_name_grabber(exporter_name_filter(card.notes)) else card.name }
|
||||||
|
|
||||||
|
#surround mana symbols in curly brackets
|
||||||
|
format_mana := replace@(match:"(CHAOS|[1-9][0-9]+(?:\\/.)?|.\\/.\\/.|.\\/.|[+-]?[^.,: ])", replace:{"\{"+_1+"}"}, in_context:"<sym(-auto)?><match></sym")
|
||||||
|
|
||||||
#determining what rules text should be used for the card
|
#determining what rules text should be used for the card
|
||||||
card_rules_text := { if card.special_text != "" then card.special_text else card.rule_text }
|
card_rules_text := { format_mana(if card.special_text != "" then card.special_text else card.rule_text) }
|
||||||
card_rules_text_2 := { if card.special_text_2 != "" then card.special_text_2 else card.rule_text_2 }
|
card_rules_text_2 := { format_mana(if card.special_text_2 != "" then card.special_text_2 else card.rule_text_2) }
|
||||||
|
|
||||||
#helpers to find the correct count for this token relation, and generate the requisite XML
|
#helpers to find the correct count for this token relation, and generate the requisite XML
|
||||||
token_count_regex := "<([0-9]+|x)>"
|
token_count_regex := "<([0-9]+|x)>"
|
||||||
@@ -145,8 +133,11 @@ script:
|
|||||||
#helpers to find if a auto-attachment is desired for this token relation, and generate the requisite XML
|
#helpers to find if a auto-attachment is desired for this token relation, and generate the requisite XML
|
||||||
add_attachment := {if filter_text(match: "<attach>", input) != "" then " attach=\"attach\"" else ""}
|
add_attachment := {if filter_text(match: "<attach>", input) != "" then " attach=\"attach\"" else ""}
|
||||||
|
|
||||||
|
#helpers to find if persistent is desired for this token relation, and generate the requisite XML
|
||||||
|
add_persistent := {if filter_text(match:"<(conjure|persistent)>", input) != "" then " persistent=\"persistent\"" else ""}
|
||||||
|
|
||||||
#helper functions for converted_related later
|
#helper functions for converted_related later
|
||||||
related_entry_regex := "(.+?[^[:space:]]);"
|
related_entry_regex := "(.+?[^[:space:]])(?:;|\n|$)"
|
||||||
|
|
||||||
#convert the !related command field to <reverse-related> XML blocks
|
#convert the !related command field to <reverse-related> XML blocks
|
||||||
convert_related :=
|
convert_related :=
|
||||||
@@ -157,12 +148,25 @@ script:
|
|||||||
replace@(match:"!",replace: "") + #blank out the command ender
|
replace@(match:"!",replace: "") + #blank out the command ender
|
||||||
|
|
||||||
#for every other card name, surround it with reverse-related tags and put in relevant attributes
|
#for every other card name, surround it with reverse-related tags and put in relevant attributes
|
||||||
{for each entry in (break_text(match:related_entry_regex, input)) do ("\<reverse-related" + add_related_count(entry) + add_attachment(entry) + ">" + xml_escape(strip_card_name(entry)) + "\</reverse-related>\n")}
|
{for each entry in (break_text(match:related_entry_regex, input)) do ("\<reverse-related" + add_related_count(entry) + add_attachment(entry) + add_persistent(entry) + ">" + xml_escape(strip_card_name(entry)) + "\</reverse-related>\n")}
|
||||||
|
|
||||||
#remove accidentily created empty <reverse-related> XML blocks
|
#remove accidentily created empty <reverse-related> XML blocks
|
||||||
remove_empty := replace@(match:"\<reverse-related>\</reverse-related>", replace:"")
|
remove_empty := replace@(match:"\<(reverse-)?related>\</(reverse-)?related>", replace:"")
|
||||||
|
|
||||||
|
#convert the !token command field to <related> XML blocks
|
||||||
|
convert_token :=
|
||||||
|
replace@(match: "!tokens? ?\n?", replace:"")+ #blank out the related command itself
|
||||||
|
replace@(match: "\<",replace:"<") + #replace junk Start of Header characters with proper "less than sign"s
|
||||||
|
replace@(match: "’",replace:"'") + #replace bad apostrophe with good apostrophe
|
||||||
|
replace@(match: "<X>",replace:"<x>") + #replace accidentily capital X with lowercase X
|
||||||
|
replace@(match:"!",replace: "") + #blank out the command ender
|
||||||
|
|
||||||
|
#for every other card name, surround it with reverse-related tags and put in relevant attributes
|
||||||
|
{for each entry in (break_text(match:related_entry_regex, input)) do ("\<related" + add_related_count(entry) + add_attachment(entry) + add_persistent(entry) + ">" + xml_escape(strip_card_name(entry)) + "\</related>\n")}
|
||||||
|
|
||||||
|
|
||||||
filter_related := filter_text@(match:"!relate ?[^!]+!?")
|
filter_related := filter_text@(match:"!relate ?[^!]+!?")
|
||||||
|
filter_token := filter_text@(match:"!tokens? ?[^!]+!?")
|
||||||
|
|
||||||
#functions for the !tapped command
|
#functions for the !tapped command
|
||||||
contains_tapped := contains@(match:"!tapped")
|
contains_tapped := contains@(match:"!tapped")
|
||||||
@@ -186,7 +190,7 @@ script:
|
|||||||
else if contains(card.type, match:"Instant") then "Instant"
|
else if contains(card.type, match:"Instant") then "Instant"
|
||||||
else if contains(card.type, match:"Artifact") then "Artifact"
|
else if contains(card.type, match:"Artifact") then "Artifact"
|
||||||
else if contains(card.type, match:"Enchantment") then "Enchantment"
|
else if contains(card.type, match:"Enchantment") then "Enchantment"
|
||||||
else xml_escape(replace(match:"^.* ", replace:"", replace(match:" —.*$", replace:"", card.type)))
|
else xml_escape(replace(match:"^.* ", replace:"", replace(match:"(<sep-soft>)? —.*$", replace:"", card.type)))
|
||||||
)
|
)
|
||||||
+"\</maintype>"
|
+"\</maintype>"
|
||||||
}
|
}
|
||||||
@@ -254,6 +258,7 @@ script:
|
|||||||
+ CIPT()
|
+ CIPT()
|
||||||
# Rules Text
|
# Rules Text
|
||||||
+"\n "+"\<text>"+xml_escape(card_rules_text())+"\</text>"
|
+"\n "+"\<text>"+xml_escape(card_rules_text())+"\</text>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
write_token := {
|
write_token := {
|
||||||
@@ -288,7 +293,7 @@ script:
|
|||||||
+ "\n "+"\<token>1\</token>"
|
+ "\n "+"\<token>1\</token>"
|
||||||
# Reverse Related
|
# Reverse Related
|
||||||
#if there is a !related block in the cards notes, set up the reverse-related XML elements
|
#if there is a !related block in the cards notes, set up the reverse-related XML elements
|
||||||
+ (if filter_related(card.notes) != "" then remove_empty("\n" + convert_related(filter_related(card.notes))))
|
+ (if filter_related(card.notes) != "" then remove_empty("\n " + convert_related(filter_related(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
write_flip := {
|
write_flip := {
|
||||||
@@ -360,6 +365,7 @@ script:
|
|||||||
+"\</tablerow>"
|
+"\</tablerow>"
|
||||||
# Rules Text
|
# Rules Text
|
||||||
+"\n "+"\<text>"+xml_escape(card_rules_text()+"\n--- \n"+card_rules_text_2())+"\</text>"
|
+"\n "+"\<text>"+xml_escape(card_rules_text()+"\n--- \n"+card_rules_text_2())+"\</text>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
write_double := {
|
write_double := {
|
||||||
@@ -375,7 +381,7 @@ script:
|
|||||||
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
||||||
else if contains(card.rarity,match:"rare") then "\"rare\""
|
else if contains(card.rarity,match:"rare") then "\"rare\""
|
||||||
else "\"\"")
|
else "\"\"")
|
||||||
+ " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
|
+ " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + file_type() + "\" >"+setcode+"\</set>"
|
||||||
+"\n "+"\<prop>"
|
+"\n "+"\<prop>"
|
||||||
# Color
|
# Color
|
||||||
+"\n "+"\<color>"
|
+"\n "+"\<color>"
|
||||||
@@ -403,6 +409,7 @@ script:
|
|||||||
+"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
|
+"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
|
||||||
# Name of the related card
|
# Name of the related card
|
||||||
+"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
|
+"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
+"\n "+"\<card>"
|
+"\n "+"\<card>"
|
||||||
# Name II
|
# Name II
|
||||||
@@ -417,7 +424,7 @@ script:
|
|||||||
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
||||||
else if contains(card.rarity,match:"rare") then "\"rare\""
|
else if contains(card.rarity,match:"rare") then "\"rare\""
|
||||||
else "\"\"")
|
else "\"\"")
|
||||||
+ " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
|
+ " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + file_type() + "\" >"+setcode+"\</set>"
|
||||||
+"\n "+"\<prop>"
|
+"\n "+"\<prop>"
|
||||||
# Color II
|
# Color II
|
||||||
+"\n "+"\<color>"
|
+"\n "+"\<color>"
|
||||||
@@ -442,6 +449,7 @@ script:
|
|||||||
# Rules Text II
|
# Rules Text II
|
||||||
+"\n "+"\<text>"+xml_escape(card_rules_text_2()
|
+"\n "+"\<text>"+xml_escape(card_rules_text_2()
|
||||||
+"\n---\n(Front): "+strip_card_name(card_name()))+"\</text>"
|
+"\n---\n(Front): "+strip_card_name(card_name()))+"\</text>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,6 +507,7 @@ script:
|
|||||||
+(if card.loyalty_cost_4 !="" then ": ")
|
+(if card.loyalty_cost_4 !="" then ": ")
|
||||||
+(if contains(paragraph_count(card.rule_text), match:"•••") then split_text(match:"\n", card.rule_text).3)))
|
+(if contains(paragraph_count(card.rule_text), match:"•••") then split_text(match:"\n", card.rule_text).3)))
|
||||||
+"\</text>"
|
+"\</text>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
write_double_walker := {
|
write_double_walker := {
|
||||||
@@ -514,7 +523,7 @@ script:
|
|||||||
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
||||||
else if contains(card.rarity,match:"rare") then "\"rare\""
|
else if contains(card.rarity,match:"rare") then "\"rare\""
|
||||||
else "\"\"")
|
else "\"\"")
|
||||||
+ " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
|
+ " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + file_type() + "\" >"+setcode+"\</set>"
|
||||||
+"\n "+"\<prop>"
|
+"\n "+"\<prop>"
|
||||||
# Color
|
# Color
|
||||||
+"\n "+"\<color>"
|
+"\n "+"\<color>"
|
||||||
@@ -557,6 +566,7 @@ script:
|
|||||||
+"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
|
+"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
|
||||||
# Name of the related card
|
# Name of the related card
|
||||||
+"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
|
+"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
+"\n "+"\<card>"
|
+"\n "+"\<card>"
|
||||||
# Name II
|
# Name II
|
||||||
@@ -570,7 +580,7 @@ script:
|
|||||||
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
||||||
else if contains(card.rarity,match:"rare") then "\"rare\""
|
else if contains(card.rarity,match:"rare") then "\"rare\""
|
||||||
else "\"\"")
|
else "\"\"")
|
||||||
+ " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
|
+ " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + file_type() + "\" >"+setcode+"\</set>"
|
||||||
+"\n "+"\<prop>"
|
+"\n "+"\<prop>"
|
||||||
# Color II
|
# Color II
|
||||||
+"\n "+"\<color>"
|
+"\n "+"\<color>"
|
||||||
@@ -610,6 +620,7 @@ script:
|
|||||||
+(if contains(paragraph_count(card.rule_text_2), match:"••") then split_text(match:"\n", card.rule_text_2).2)
|
+(if contains(paragraph_count(card.rule_text_2), match:"••") then split_text(match:"\n", card.rule_text_2).2)
|
||||||
+(if contains(paragraph_count(card.rule_text_2), match:"•••") then "\n"))
|
+(if contains(paragraph_count(card.rule_text_2), match:"•••") then "\n"))
|
||||||
+"\n---\n(Front): "+strip_card_name(card_name()))+"\</text>"
|
+"\n---\n(Front): "+strip_card_name(card_name()))+"\</text>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
write_sparker := {
|
write_sparker := {
|
||||||
@@ -625,7 +636,7 @@ script:
|
|||||||
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
||||||
else if contains(card.rarity,match:"rare") then "\"rare\""
|
else if contains(card.rarity,match:"rare") then "\"rare\""
|
||||||
else "\"\"")
|
else "\"\"")
|
||||||
+ " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
|
+ " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + file_type() + "\" >"+setcode+"\</set>"
|
||||||
+"\n "+"\<prop>"
|
+"\n "+"\<prop>"
|
||||||
# Color
|
# Color
|
||||||
+"\n "+"\<color>"
|
+"\n "+"\<color>"
|
||||||
@@ -653,6 +664,7 @@ script:
|
|||||||
+"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
|
+"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
|
||||||
# Name of the related card
|
# Name of the related card
|
||||||
+"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
|
+"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
+"\n "+"\<card>"
|
+"\n "+"\<card>"
|
||||||
# Name II
|
# Name II
|
||||||
@@ -666,7 +678,7 @@ script:
|
|||||||
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
||||||
else if contains(card.rarity,match:"rare") then "\"rare\""
|
else if contains(card.rarity,match:"rare") then "\"rare\""
|
||||||
else "\"\"")
|
else "\"\"")
|
||||||
+ " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
|
+ " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + file_type() + "\" >"+setcode+"\</set>"
|
||||||
+"\n "+"\<prop>"
|
+"\n "+"\<prop>"
|
||||||
# Color II
|
# Color II
|
||||||
+"\n "+"\<color>"
|
+"\n "+"\<color>"
|
||||||
@@ -706,6 +718,7 @@ script:
|
|||||||
+(if contains(paragraph_count(card.rule_text_2), match:"••") then split_text(match:"\n", card.rule_text_2).2)
|
+(if contains(paragraph_count(card.rule_text_2), match:"••") then split_text(match:"\n", card.rule_text_2).2)
|
||||||
+(if contains(paragraph_count(card.rule_text_2), match:"•••") then "\n"))
|
+(if contains(paragraph_count(card.rule_text_2), match:"•••") then "\n"))
|
||||||
+"\n---\n(Front): "+strip_card_name(card_name()))+"\</text>"
|
+"\n---\n(Front): "+strip_card_name(card_name()))+"\</text>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
write_sacrificer := {
|
write_sacrificer := {
|
||||||
@@ -721,7 +734,7 @@ script:
|
|||||||
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
||||||
else if contains(card.rarity,match:"rare") then "\"rare\""
|
else if contains(card.rarity,match:"rare") then "\"rare\""
|
||||||
else "\"\"")
|
else "\"\"")
|
||||||
+ " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
|
+ " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + file_type() + "\" >"+setcode+"\</set>"
|
||||||
+"\n "+"\<prop>"
|
+"\n "+"\<prop>"
|
||||||
# Color
|
# Color
|
||||||
+"\n "+"\<color>"
|
+"\n "+"\<color>"
|
||||||
@@ -764,6 +777,7 @@ script:
|
|||||||
+"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
|
+"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
|
||||||
# Name of the related card
|
# Name of the related card
|
||||||
+"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
|
+"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
+"\n "+"\<card>"
|
+"\n "+"\<card>"
|
||||||
# Name II
|
# Name II
|
||||||
@@ -778,7 +792,7 @@ script:
|
|||||||
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
else if contains(card.rarity,match:"mythic") then "\"mythic\""
|
||||||
else if contains(card.rarity,match:"rare") then "\"rare\""
|
else if contains(card.rarity,match:"rare") then "\"rare\""
|
||||||
else "\"\"")
|
else "\"\"")
|
||||||
+ " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
|
+ " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + file_type() + "\" >"+setcode+"\</set>"
|
||||||
+"\n "+"\<prop>"
|
+"\n "+"\<prop>"
|
||||||
# Color II
|
# Color II
|
||||||
+"\n "+"\<color>"
|
+"\n "+"\<color>"
|
||||||
@@ -803,6 +817,7 @@ script:
|
|||||||
# Rules Text II
|
# Rules Text II
|
||||||
+"\n "+"\<text>"+xml_escape(card_rules_text_2()
|
+"\n "+"\<text>"+xml_escape(card_rules_text_2()
|
||||||
+"\n---\n(Front): "+strip_card_name(card_name()))+"\</text>"
|
+"\n---\n(Front): "+strip_card_name(card_name()))+"\</text>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
write_leveler := {
|
write_leveler := {
|
||||||
@@ -854,6 +869,7 @@ script:
|
|||||||
+(if card.pt_3 != "" then "\n"+card.pt_3)
|
+(if card.pt_3 != "" then "\n"+card.pt_3)
|
||||||
+"\n"+card.rule_text_3)
|
+"\n"+card.rule_text_3)
|
||||||
+"\</text>"
|
+"\</text>"
|
||||||
|
+ (if filter_token(card.notes) != "" then remove_empty("\n " + convert_token(filter_token(card.notes))))
|
||||||
+"\n "+"\</card>"
|
+"\n "+"\</card>"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,14 +894,14 @@ script:
|
|||||||
write_image_file(
|
write_image_file(
|
||||||
card,
|
card,
|
||||||
directory: set.set_code,
|
directory: set.set_code,
|
||||||
file: (options.append_String_To_Names+strip_card_name(card_name())+(if is_token() and options.append_Set_Code_To_Tokens then " " + set.set_code else "")+if splitter_name() and is_double() then "_" + strip_card_name(card.name_2)) + "." + to_lower(options.images_File_Type),
|
file: (options.append_String_To_Names+strip_card_name(card_name())+(if is_token() and options.append_Set_Code_To_Tokens then " " + set.set_code else "")+if splitter_name() and is_double() then "_" + strip_card_name(card.name_2)) + "." + file_type(),
|
||||||
width: (if contains(card.shape, match:"split") or contains(card.shape, match:"double") then 752 else 375),
|
width: (if contains(card.shape, match:"split") or contains(card.shape, match:"double") then 752 else 375),
|
||||||
height: 523
|
height: 523
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if images are set to be rendered, render all images of rarities that have been selected
|
#if images are set to be rendered, render all images of rarities that have been selected
|
||||||
write_images := if options.export_Images then for each card in filter_list(cards,filter:{included_rarity(card:input)}) do write_image() else ""
|
write_images := if options.export_Images != "no" then for each card in filter_list(cards,filter:{included_rarity(card:input)}) do write_image() else ""
|
||||||
|
|
||||||
write_cards := to_text(for each card in cards do write_card())
|
write_cards := to_text(for each card in cards do write_card())
|
||||||
write_all_tokens := to_text(for each card in cards do write_token_if_token())
|
write_all_tokens := to_text(for each card in cards do write_token_if_token())
|
||||||
@@ -893,7 +909,7 @@ script:
|
|||||||
#Main export script
|
#Main export script
|
||||||
|
|
||||||
#tokens in Separate XML
|
#tokens in Separate XML
|
||||||
if (options.include_Tokens and options.tokens_In_Separate_XML) then write_text_file(file:set.set_code + " Tokens" + ".xml", to_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<cockatrice_carddatabase version=\"4\">\n <cards>\n"+write_all_tokens+"\n\n </cards>\n</cockatrice_carddatabase>"))
|
if (chosen(options.rarities_to_export, choice:"token") and options.tokens_In_Separate_XML) then write_text_file(file:set.set_code + " Tokens" + ".xml", to_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<cockatrice_carddatabase version=\"4\">\n <cards>\n"+write_all_tokens+"\n\n </cards>\n</cockatrice_carddatabase>"))
|
||||||
|
|
||||||
#other cards
|
#other cards
|
||||||
to_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<cockatrice_carddatabase version=\"4\">\n <sets>\n <set>\n <name>"+setcode+"</name>\n <longname>"+xml_escape(set.title)+"</longname>\n <settype>"+xml_escape(options.cockatrice_Set_Type)+"</settype>\n </set>\n </sets>\n <cards>\n"+write_cards+if (options.include_Tokens and not(options.tokens_In_Separate_XML)) then ("\n\n <!-->Tokens</-->\n"+write_all_tokens)+"\n\n </cards>\n</cockatrice_carddatabase>")
|
to_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<cockatrice_carddatabase version=\"4\">\n <sets>\n <set>\n <name>"+setcode+"</name>\n <longname>"+xml_escape(set.title)+"</longname>\n <settype>"+xml_escape(options.cockatrice_Set_Type)+"</settype>\n </set>\n </sets>\n <cards>\n"+write_cards+if (chosen(options.rarities_to_export, choice:"token") and not(options.tokens_In_Separate_XML)) then ("\n\n <!-->Tokens</-->\n"+write_all_tokens)+"\n\n </cards>\n</cockatrice_carddatabase>")
|
||||||
|
|||||||
Reference in New Issue
Block a user