update to xml v4

escape special xml characters in cockatrice exporter
indent xml
This commit is contained in:
ebbit1q
2023-01-24 00:49:06 +01:00
parent e9a6653fa7
commit 71f29deae2

View File

@@ -115,6 +115,15 @@ script:
replace@(match:";", replace:"")+ #remove semicolons replace@(match:";", replace:"")+ #remove semicolons
replace@(match:"\\.", replace:"") #remove periods replace@(match:"\\.", replace:"") #remove periods
# escape special xml characters
xml_escape := replace@(match:"&",replace:"&") #escape ampersands
+ replace@(match:"\"",replace:"\\"") #escape double quote
+ replace@(match:"\'",replace:"\\'") #escape single quote
+ replace@(match:"\<",replace:"\\&lt;") #escape less than sign
#+ replace@(match:"\>",replace:"\\&gt;") #escape greater than sign, for some reason this upsets mse and they are technically not needed to escape
# escaped set code
setcode := xml_escape(set.set_code)
#functions for the !exportname command #functions for the !exportname command
exporter_name_filter := filter_text@(match:"!exporte?r?name [^\n\<]+") exporter_name_filter := filter_text@(match:"!exporte?r?name [^\n\<]+")
exporter_name_grabber := replace@(match:"!exporte?r?name ", replace:"") exporter_name_grabber := replace@(match:"!exporte?r?name ", replace:"")
@@ -147,7 +156,7 @@ 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) + ">" + 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) + ">" + 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:"")
@@ -157,7 +166,29 @@ script:
#functions for the !tapped command #functions for the !tapped command
contains_tapped := contains@(match:"!tapped") contains_tapped := contains@(match:"!tapped")
CIPT := {if contains_tapped(card.notes) then "\n "+"\<cipt>" + "1" + "\</cipt>" else ""} CIPT := {if contains_tapped(card.notes) then "\n "+"\<cipt>" + "1" + "\</cipt>" else ""}
# maintype, used in cockatrice's card type sorting,
# no longer automatically determined in v4 xml,
# first use the same heuristic used in "oracle" else do the same thing v3 xml did
# !maintype [type]! in the card notes overwrites this
filter_maintype := filter_text@(match:"!maintype ?[^!]+!?")
maintype :=
{
"\n "+"\<maintype>"
+(
if filter_maintype(card.notes) != "" then xml_escape(replace(match:"!$", replace:"", replace(match:"^!maintype ?", replace:"", filter_maintype(card.notes))))
else if contains(card.type, match:"Planeswalker") then "Planeswalker"
else if contains(card.type, match:"Creature") then "Creature"
else if contains(card.type, match:"Land") then "Land"
else if contains(card.type, match:"Sorcery") then "Sorcery"
else if contains(card.type, match:"Instant") then "Instant"
else if contains(card.type, match:"Artifact") then "Artifact"
else if contains(card.type, match:"Enchantment") then "Enchantment"
else xml_escape(replace(match:"^.* ", replace:"", replace(match:" —.*$", replace:"", card.type)))
)
+"\</maintype>"
}
card_color := card_color :=
{ {
@@ -185,34 +216,34 @@ script:
#write a normal card's XML text #write a normal card's XML text
write_normal := { write_normal := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+options.append_String_To_Names+strip_card_name(card_name())+"\</name>" +"\n "+"\<name>"+xml_escape(options.append_String_To_Names+strip_card_name(card_name()))+"\</name>"
# Set # Set
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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 "\"\"")
+ ">"+set.set_code+"\</set>" + ">"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color() + card_color()
+"\</color>" +"\</color>"
# Mana Cost # Mana Cost
+"\n "+"\<manacost>"+card.casting_cost+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost+"\</manacost>"
# Converted Mana Cost # Converted Mana Cost
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-"))+"\</type>"
+maintype()
# P/T # P/T
+(if contains(card.type, match:"Creature") then "\n ") +(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt)+"\</pt>")
+(if contains(card.type, match:"Creature") then "\<pt>") +"\n "+"\</prop>"
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\</pt>")
# Tablerow # Tablerow
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3" +(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2" else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0" else if contains(card.type, match:"Land") then "0"
@@ -221,28 +252,28 @@ script:
#CIPT #CIPT
+ CIPT() + CIPT()
# Rules Text # Rules Text
+"\n "+"\<text>"+card_rules_text()+"\</text>" +"\n "+"\<text>"+xml_escape(card_rules_text())+"\</text>"
+"\n"+"\</card>" +"\n "+"\</card>"
} }
write_token := { write_token := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+strip_card_name(card_name())+(if options.append_Set_Code_To_Tokens then " " + set.set_code else "")+"\</name>" +"\n "+"\<name>"+xml_escape(strip_card_name(card_name())+(if options.append_Set_Code_To_Tokens then " " + setcode else ""))+"\</name>"
# Set # Set
+"\n "+"\<set>"+set.set_code+"\</set>" +"\n "+"\<set>"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color() + card_color()
+"\</color>" +"\</color>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-"))+"\</type>"
+maintype()
# P/T # P/T
+(if contains(card.type, match:"Creature") then "\n ") +(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt)+"\</pt>")
+(if contains(card.type, match:"Creature") then "\<pt>") +"\n "+"\</prop>"
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\</pt>")
# Tablerow # Tablerow
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3" +(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2" else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0" else if contains(card.type, match:"Land") then "0"
@@ -251,30 +282,31 @@ script:
#CIPT #CIPT
+ CIPT() + CIPT()
# Rules Text # Rules Text
+"\n "+"\<text>"+card_rules_text()+"\</text>" +"\n "+"\<text>"+xml_escape(card_rules_text())+"\</text>"
# Token # Token
+ "\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 := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+options.append_String_To_Names+strip_card_name(card_name()) +"\n "+"\<name>"+xml_escape(options.append_String_To_Names+strip_card_name(card_name()))
#+" // "+strip_card_name(card.name_2) #+" // "+strip_card_name(card.name_2)
+"\</name>" +"\</name>"
# Set # Set
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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 "\"\"")
+ ">"+set.set_code+"\</set>" + ">"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+(if contains(card.shape, match:"flip") then +(if contains(card.shape, match:"flip") then
(if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M" (if contains(card.card_color, match:"multicolor") or contains(card.card_color, match:"hybrid") then "M"
else if contains(card.card_color, match:"white") then "W" else if contains(card.card_color, match:"white") then "W"
@@ -302,113 +334,114 @@ script:
) )
+"\</color>" +"\</color>"
# Mana Cost # Mana Cost
+"\n "+"\<manacost>"+card.casting_cost +"\n "+"\<manacost>"+card.casting_cost
+(if card.casting_cost_2 != "" then " // "+card.casting_cost_2) +(if card.casting_cost_2 != "" then " // "+card.casting_cost_2)
+"\</manacost>" +"\</manacost>"
# Converted Mana Cost # Converted Mana Cost
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+" // "+replace(card.type_2, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-")+" // "+replace(card.type_2, match:"—", replace:"-"))+"\</type>"
+maintype()
# P/T # P/T
+(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\n ") +(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\n ")
+(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\<pt>") +(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\<pt>")
+(if contains(card.type, match:"Creature") then card.pt) +(if contains(card.type, match:"Creature") then xml_escape(card.pt))
+(if contains(card.type, match:"Creature") and contains(card.type_2, match:"Creature") then " // ") +(if contains(card.type, match:"Creature") and contains(card.type_2, match:"Creature") then " // ")
+(if contains(card.type_2, match:"Creature") then card.pt_2) +(if contains(card.type_2, match:"Creature") then xml_escape(card.pt_2))
+(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\</pt>") +(if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "\</pt>")
+"\n "+"\</prop>"
# Tablerow # Tablerow
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") or contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3" +(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") or contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "2" else if contains(card.type, match:"Creature") or contains(card.type_2, match:"Creature") then "2"
else if contains(card.type, match:"Land") or contains(card.type_2, match:"Land") then "0" else if contains(card.type, match:"Land") or contains(card.type_2, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text # Rules Text
+"\n "+"\<text>"+card_rules_text()+"\n--- \n"+card_rules_text_2()+"\</text>" +"\n "+"\<text>"+xml_escape(card_rules_text()+"\n--- \n"+card_rules_text_2())+"\</text>"
+"\n"+"\</card>" +"\n "+"\</card>"
} }
write_double := { write_double := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+options.append_String_To_Names+strip_card_name(card_name()) +"\n "+"\<name>"+xml_escape(options.append_String_To_Names+strip_card_name(card_name()))
#+" | ("+strip_card_name(card.name_2)+")" #+" | ("+strip_card_name(card.name_2)+")"
+"\</name>" +"\</name>"
# Set # Set
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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())+".full." + to_lower(options.images_File_Type) + "\" >"+set.set_code+"\</set>" + " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color() + card_color()
+"\</color>" +"\</color>"
# Name of the related card
+"\n "+"\<related attach=\"attach\">"+strip_card_name(card.name_2)+"\</related>"
# Mana Cost # Mana Cost
+"\n "+"\<manacost>"+card.casting_cost+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost+"\</manacost>"
# Converted Mana Cost # Converted Mana Cost
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-"))+"\</type>"
+maintype()
# P/T # P/T
+(if contains(card.type, match:"Creature") then "\n ") +(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt)+"\</pt>")
+(if contains(card.type, match:"Creature") then "\<pt>") +"\n "+"\</prop>"
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\</pt>")
# Tablerow # Tablerow
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3" +(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2" else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0" else if contains(card.type, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text # Rules Text
+"\n "+"\<text>"+card_rules_text() +"\n "+"\<text>"+xml_escape(card_rules_text()
+"\n---\n(Back): "+strip_card_name(card.name_2)+"\</text>" +"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
+"\n"+"\</card>" # Name of the related card
+"\n"+"\<card>" +"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
+"\n "+"\</card>"
+"\n "+"\<card>"
# Name II # Name II
+"\n "+"\<name>" +"\n "+"\<name>"
#+"("+strip_card_name(card_name())+") | " #+"("+strip_card_name(card_name())+") | "
+strip_card_name(card.name_2) +xml_escape(strip_card_name(card.name_2))
+"\</name>" +"\</name>"
# Set II # Set II
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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)+".full." + to_lower(options.images_File_Type) + "\" >"+set.set_code+"\</set>" + " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color II # Color II
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color_2() + card_color_2()
+"\</color>" +"\</color>"
# Mana Cost II # Mana Cost II
+"\n "+"\<manacost>"+card.casting_cost_2+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost_2+"\</manacost>"
# Converted Mana Cost II # Converted Mana Cost II
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type II # Type II
+"\n "+"\<type>"+replace(card.type_2, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type_2, match:"—", replace:"-"))+"\</type>"
# P/T II # P/T II
+(if contains(card.type_2, match:"Creature") then "\n ") +(if contains(card.type_2, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt_2)+"\</pt>")
+(if contains(card.type_2, match:"Creature") then "\<pt>") +"\n "+"\</prop>"
+(if contains(card.type_2, match:"Creature") then card.pt_2)
+(if contains(card.type_2, match:"Creature") then "\</pt>")
# Tablerow II # Tablerow II
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3" +(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2" else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0" else if contains(card.type_2, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text II # Rules Text II
+"\n "+"\<text>"+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>"
+"\n"+"\</card>" +"\n "+"\</card>"
} }
# Count the number of paragraphs to detect number of walker abilities. # Count the number of paragraphs to detect number of walker abilities.
@@ -416,36 +449,39 @@ script:
filter_text@(match:"•") filter_text@(match:"•")
write_walker := { write_walker := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+options.append_String_To_Names+strip_card_name(card_name())+"\</name>" +"\n "+"\<name>"+xml_escape(options.append_String_To_Names+strip_card_name(card_name()))+"\</name>"
# Set # Set
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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 "\"\"")
+ ">"+set.set_code+"\</set>" + ">"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color() + card_color()
+"\</color>" +"\</color>"
# Mana Cost # Mana Cost
+"\n "+"\<manacost>"+card.casting_cost+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost+"\</manacost>"
# Converted Mana Cost # Converted Mana Cost
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-"))+"\</type>"
+maintype()
# Loyalty # Loyalty
+"\n "+"\<loyalty>"+card.loyalty+"\</loyalty>" +"\n "+"\<loyalty>"+card.loyalty+"\</loyalty>"
+"\n "+"\</prop>"
# Tablerow # Tablerow
+"\n "+"\<tablerow>"+"1"+"\</tablerow>" +"\n "+"\<tablerow>"+"1"+"\</tablerow>"
#CIPT #CIPT
+ CIPT() + CIPT()
# Rules Text # Rules Text
+"\n "+"\<text>" +"\n "+"\<text>"
+(if card.special_text or else "" != "" then card.special_text else +xml_escape((if card.special_text or else "" != "" then card.special_text else
card.loyalty_cost_1 card.loyalty_cost_1
+(if card.loyalty_cost_1 !="" then ": ") +(if card.loyalty_cost_1 !="" then ": ")
+split_text(match:"\n", card.rule_text).0 +split_text(match:"\n", card.rule_text).0
@@ -460,50 +496,51 @@ script:
+(if contains(paragraph_count(card.rule_text), match:"•••") then "\n") +(if contains(paragraph_count(card.rule_text), match:"•••") then "\n")
+card.loyalty_cost_4 +card.loyalty_cost_4
+(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>"
+"\n"+"\</card>" +"\n "+"\</card>"
} }
write_double_walker := { write_double_walker := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+options.append_String_To_Names+strip_card_name(card_name()) +"\n "+"\<name>"+xml_escape(options.append_String_To_Names+strip_card_name(card_name()))
#+" | ("+strip_card_name(card.name_2)+")" #+" | ("+strip_card_name(card.name_2)+")"
+"\</name>" +"\</name>"
# Set # Set
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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())+".full." + to_lower(options.images_File_Type) + "\" >"+set.set_code+"\</set>" + " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color() + card_color()
+"\</color>" +"\</color>"
# Name of the related card
+"\n "+"\<related attach=\"attach\">"+strip_card_name(card.name_2)+"\</related>"
# Mana Cost # Mana Cost
+"\n "+"\<manacost>"+card.casting_cost+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost+"\</manacost>"
# Converted Mana Cost # Converted Mana Cost
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-"))+"\</type>"
+maintype()
# Loyalty # Loyalty
+(if contains(card.type, match:"Planeswalker") then "\n "+"\<loyalty>"+card.loyalty+"\</loyalty>") +(if contains(card.type, match:"Planeswalker") then "\n "+"\<loyalty>"+card.loyalty+"\</loyalty>")
# P/T # P/T
+(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+card.pt+"\</pt>") +(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt)+"\</pt>")
+"\n "+"\</prop>"
# Tablerow # Tablerow
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3" +(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2" else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0" else if contains(card.type_2, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text # Rules Text
+"\n "+"\<text>" +"\n "+"\<text>"
+(if card.special_text or else "" != "" then card.special_text else +xml_escape((if card.special_text or else "" != "" then card.special_text else
card.loyalty_cost_1 card.loyalty_cost_1
+(if card.loyalty_cost_1 !="" then ": ") +(if card.loyalty_cost_1 !="" then ": ")
+split_text(match:"\n", card.rule_text).0 +split_text(match:"\n", card.rule_text).0
@@ -516,45 +553,49 @@ script:
+(if card.loyalty_cost_3 !="" then ": ") +(if card.loyalty_cost_3 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"••") then split_text(match:"\n", card.rule_text).2) +(if contains(paragraph_count(card.rule_text), match:"••") then split_text(match:"\n", card.rule_text).2)
+(if contains(paragraph_count(card.rule_text), match:"•••") then "\n")) +(if contains(paragraph_count(card.rule_text), match:"•••") then "\n"))
+"\n---\n(Back): "+strip_card_name(card.name_2)+"\</text>" +"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
+"\n"+"\</card>" # Name of the related card
+"\n"+"\<card>" +"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
+"\n "+"\</card>"
+"\n "+"\<card>"
# Name II # Name II
+"\n "+"\<name>" +"\n "+"\<name>"
#+strip_card_name(card_name())+") | " #+strip_card_name(card_name())+") | "
+strip_card_name(card.name_2)+"\</name>" +xml_escape(strip_card_name(card.name_2))+"\</name>"
# Set II # Set II
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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)+".full." + to_lower(options.images_File_Type) + "\" >"+set.set_code+"\</set>" + " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color II # Color II
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color_2() + card_color_2()
+"\</color>" +"\</color>"
# Mana Cost II # Mana Cost II
+"\n "+"\<manacost>"+card.casting_cost_2+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost_2+"\</manacost>"
# Converted Mana Cost II # Converted Mana Cost II
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type II # Type II
+"\n "+"\<type>"+replace(card.type_2, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type_2, match:"—", replace:"-"))+"\</type>"
# Loyalty II # Loyalty II
+(if contains(card.type_2, match:"Planeswalker") then "\n "+"\<loyalty>"+card.loyalty_2+"\</loyalty>") +(if contains(card.type_2, match:"Planeswalker") then "\n "+"\<loyalty>"+card.loyalty_2+"\</loyalty>")
# P/T II # P/T II
+(if contains(card.type_2, match:"Creature") then "\n "+"\<pt>"+card.pt_2+"\</pt>") +(if contains(card.type_2, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt_2)+"\</pt>")
+"\n "+"\</prop>"
# Tablerow II # Tablerow II
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3" +(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2" else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0" else if contains(card.type_2, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text II # Rules Text II
+"\n "+"\<text>" +"\n "+"\<text>"
+(if card.special_text_2 or else "" != "" then card.special_text_2 else +xml_escape((if card.special_text_2 or else "" != "" then card.special_text_2 else
card.loyalty_cost_4 card.loyalty_cost_4
+(if card.loyalty_cost_4 !="" then ": ") +(if card.loyalty_cost_4 !="" then ": ")
+split_text(match:"\n", card.rule_text_2).0 +split_text(match:"\n", card.rule_text_2).0
@@ -567,88 +608,90 @@ script:
+(if card.loyalty_cost_6 !="" then ": ") +(if card.loyalty_cost_6 !="" then ": ")
+(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>"
+"\n"+"\</card>" +"\n "+"\</card>"
} }
write_sparker := { write_sparker := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+options.append_String_To_Names+strip_card_name(card_name()) +"\n "+"\<name>"+xml_escape(options.append_String_To_Names+strip_card_name(card_name()))
#+" | ("+strip_card_name(card.name_2)+")" #+" | ("+strip_card_name(card.name_2)+")"
+"\</name>" +"\</name>"
# Set # Set
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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())+".full." + to_lower(options.images_File_Type) + "\" >"+set.set_code+"\</set>" + " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color() + card_color()
+"\</color>" +"\</color>"
# Name of the related card
+"\n "+"\<related attach=\"attach\">"+strip_card_name(card.name_2)+"\</related>"
# Mana Cost # Mana Cost
+"\n "+"\<manacost>"+card.casting_cost+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost+"\</manacost>"
# Converted Mana Cost # Converted Mana Cost
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-"))+"\</type>"
+maintype()
# P/T # P/T
+(if contains(card.type, match:"Creature") then "\n ") +(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt)+"\</pt>")
+(if contains(card.type, match:"Creature") then "\<pt>") +"\n "+"\</prop>"
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\</pt>")
# Tablerow # Tablerow
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3" +(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2" else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0" else if contains(card.type, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text # Rules Text
+"\n "+"\<text>"+card_rules_text() +"\n "+"\<text>"+xml_escape(card_rules_text()
+"\n---\n(Back): "+strip_card_name(card.name_2)+"\</text>" +"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
+"\n"+"\</card>" # Name of the related card
+"\n"+"\<card>" +"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
+"\n "+"\</card>"
+"\n "+"\<card>"
# Name II # Name II
+"\n "+"\<name>" +"\n "+"\<name>"
#+strip_card_name(card_name())+") | " #+strip_card_name(card_name())+") | "
+strip_card_name(card.name_2)+"\</name>" +xml_escape(strip_card_name(card.name_2))+"\</name>"
# Set II # Set II
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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)+".full." + to_lower(options.images_File_Type) + "\" >"+set.set_code+"\</set>" + " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color II # Color II
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color_2() + card_color_2()
+"\</color>" +"\</color>"
# Mana Cost II # Mana Cost II
+"\n "+"\<manacost>"+card.casting_cost_2+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost_2+"\</manacost>"
# Converted Mana Cost II # Converted Mana Cost II
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type II # Type II
+"\n "+"\<type>"+replace(card.type_2, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type_2, match:"—", replace:"-"))+"\</type>"
# Loyalty II # Loyalty II
+(if contains(card.type_2, match:"Planeswalker") then "\n "+"\<loyalty>"+card.loyalty_2+"\</loyalty>") +(if contains(card.type_2, match:"Planeswalker") then "\n "+"\<loyalty>"+card.loyalty_2+"\</loyalty>")
# P/T II # P/T II
+(if contains(card.type_2, match:"Creature") then "\n "+"\<pt>"+card.pt_2+"\</pt>") +(if contains(card.type_2, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt_2)+"\</pt>")
+"\n "+"\</prop>"
# Tablerow II # Tablerow II
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3" +(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2" else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0" else if contains(card.type_2, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text II # Rules Text II
+"\n "+"\<text>" +"\n "+"\<text>"
+(if card.special_text_2 or else "" != "" then card.special_text_2 else +xml_escape((if card.special_text_2 or else "" != "" then card.special_text_2 else
card.loyalty_cost_4 card.loyalty_cost_4
+(if card.loyalty_cost_4 !="" then ": ") +(if card.loyalty_cost_4 !="" then ": ")
+split_text(match:"\n", card.rule_text_2).0 +split_text(match:"\n", card.rule_text_2).0
@@ -661,49 +704,50 @@ script:
+(if card.loyalty_cost_6 !="" then ": ") +(if card.loyalty_cost_6 !="" then ": ")
+(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>"
+"\n"+"\</card>" +"\n "+"\</card>"
} }
write_sacrificer := { write_sacrificer := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+options.append_String_To_Names+strip_card_name(card_name()) +"\n "+"\<name>"+xml_escape(options.append_String_To_Names+strip_card_name(card_name()))
#+" | ("+strip_card_name(card.name_2)+")" #+" | ("+strip_card_name(card.name_2)+")"
+"\</name>" +"\</name>"
# Set # Set
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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())+".full." + to_lower(options.images_File_Type) + "\" >"+set.set_code+"\</set>" + " splitterPath=\""+"/"+options.append_String_To_Names+strip_card_name(card_name())+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color() + card_color()
+"\</color>" +"\</color>"
# Name of the related card
+"\n "+"\<related attach=\"attach\">"+strip_card_name(card.name_2)+"\</related>"
# Mana Cost # Mana Cost
+"\n "+"\<manacost>"+card.casting_cost+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost+"\</manacost>"
# Converted Mana Cost # Converted Mana Cost
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-"))+"\</type>"
+maintype()
# Loyalty # Loyalty
+(if contains(card.type, match:"Planeswalker") then "\n "+"\<loyalty>"+card.loyalty+"\</loyalty>") +(if contains(card.type, match:"Planeswalker") then "\n "+"\<loyalty>"+card.loyalty+"\</loyalty>")
# P/T # P/T
+(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+card.pt+"\</pt>") +(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt)+"\</pt>")
+"\n "+"\</prop>"
# Tablerow # Tablerow
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3" +(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2" else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0" else if contains(card.type_2, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text # Rules Text
+"\n "+"\<text>" +"\n "+"\<text>"
+(if card.special_text or else "" != "" then card.special_text else +xml_escape((if card.special_text or else "" != "" then card.special_text else
card.loyalty_cost_1 card.loyalty_cost_1
+(if card.loyalty_cost_1 !="" then ": ") +(if card.loyalty_cost_1 !="" then ": ")
+split_text(match:"\n", card.rule_text).0 +split_text(match:"\n", card.rule_text).0
@@ -716,91 +760,90 @@ script:
+(if card.loyalty_cost_3 !="" then ": ") +(if card.loyalty_cost_3 !="" then ": ")
+(if contains(paragraph_count(card.rule_text), match:"••") then split_text(match:"\n", card.rule_text).2) +(if contains(paragraph_count(card.rule_text), match:"••") then split_text(match:"\n", card.rule_text).2)
+(if contains(paragraph_count(card.rule_text), match:"•••") then "\n")) +(if contains(paragraph_count(card.rule_text), match:"•••") then "\n"))
+"\n---\n(Back): "+strip_card_name(card.name_2)+"\</text>" +"\n---\n(Back): "+strip_card_name(card.name_2))+"\</text>"
+"\n"+"\</card>" # Name of the related card
+"\n"+"\<card>" +"\n "+"\<related attach=\"attach\">"+xml_escape(strip_card_name(card.name_2))+"\</related>"
+"\n "+"\</card>"
+"\n "+"\<card>"
# Name II # Name II
+"\n "+"\<name>" +"\n "+"\<name>"
#+"("+strip_card_name(card_name())+") | " #+"("+strip_card_name(card_name())+") | "
+strip_card_name(card.name_2) +xml_escape(strip_card_name(card.name_2))
+"\</name>" +"\</name>"
# Set II # Set II
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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)+".full." + to_lower(options.images_File_Type) + "\" >"+set.set_code+"\</set>" + " splitterPath=\""+"/"+strip_card_name(card.name_2)+"." + to_lower(options.images_File_Type) + "\" >"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color II # Color II
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color_2() + card_color_2()
+"\</color>" +"\</color>"
# Mana Cost II # Mana Cost II
+"\n "+"\<manacost>"+card.casting_cost_2+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost_2+"\</manacost>"
# Converted Mana Cost II # Converted Mana Cost II
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type II # Type II
+"\n "+"\<type>"+replace(card.type_2, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type_2, match:"—", replace:"-"))+"\</type>"
# P/T II # P/T II
+(if contains(card.type_2, match:"Creature") then "\n ") +(if contains(card.type_2, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt_2)+"\</pt>")
+(if contains(card.type_2, match:"Creature") then "\<pt>") +"\n "+"\</prop>"
+(if contains(card.type_2, match:"Creature") then card.pt_2)
+(if contains(card.type_2, match:"Creature") then "\</pt>")
# Tablerow II # Tablerow II
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3" +(if contains(card.type_2, match:"Instant") or contains(card.type_2, match:"Sorcery") then "3"
else if contains(card.type_2, match:"Creature") then "2" else if contains(card.type_2, match:"Creature") then "2"
else if contains(card.type_2, match:"Land") then "0" else if contains(card.type_2, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text II # Rules Text II
+"\n "+"\<text>"+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>"
+"\n"+"\</card>" +"\n "+"\</card>"
} }
write_leveler := { write_leveler := {
"\n"+"\<card>" "\n "+"\<card>"
# Name # Name
+"\n "+"\<name>"+options.append_String_To_Names+strip_card_name(card_name())+"\</name>" +"\n "+"\<name>"+xml_escape(options.append_String_To_Names+strip_card_name(card_name()))+"\</name>"
# Set # Set
+"\n "+"\<set rarity=" +"\n "+"\<set rarity="
+(if contains(card.rarity,match:"uncommon") then "\"uncommon\"" +(if contains(card.rarity,match:"uncommon") then "\"uncommon\""
else if contains(card.rarity,match:"common") then "\"common\"" else if contains(card.rarity,match:"common") then "\"common\""
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 "\"\"")
+ ">"+set.set_code+"\</set>" + ">"+setcode+"\</set>"
+"\n "+"\<prop>"
# Color # Color
+"\n "+"\<color>" +"\n "+"\<color>"
+ card_color() + card_color()
+"\</color>" +"\</color>"
# Mana Cost # Mana Cost
+"\n "+"\<manacost>"+card.casting_cost+"\</manacost>" +"\n "+"\<manacost>"+card.casting_cost+"\</manacost>"
# Converted Mana Cost # Converted Mana Cost
+"\n "+"\<cmc>"+card.cmc+"\</cmc>" +"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Converted Mana Cost II
+"\n "+"\<cmc>"+card.cmc+"\</cmc>"
# Type # Type
+"\n "+"\<type>"+replace(card.type, match:"—", replace:"-")+"\</type>" +"\n "+"\<type>"+xml_escape(replace(card.type, match:"—", replace:"-"))+"\</type>"
+maintype()
# P/T # P/T
+(if contains(card.type, match:"Creature") then "\n ") +(if contains(card.type, match:"Creature") then "\n "+"\<pt>"+xml_escape(card.pt)+"\</pt>")
+(if contains(card.type, match:"Creature") then "\<pt>") +"\n "+"\</prop>"
+(if contains(card.type, match:"Creature") then card.pt)
+(if contains(card.type, match:"Creature") then "\</pt>")
#CIPT #CIPT
+ CIPT() + CIPT()
# Tablerow # Tablerow
+"\n "+"\<tablerow>" +"\n "+"\<tablerow>"
+(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3" +(if contains(card.type, match:"Instant") or contains(card.type, match:"Sorcery") then "3"
else if contains(card.type, match:"Creature") then "2" else if contains(card.type, match:"Creature") then "2"
else if contains(card.type, match:"Land") then "0" else if contains(card.type, match:"Land") then "0"
else "1") else "1")
+"\</tablerow>" +"\</tablerow>"
# Rules Text # Rules Text
+"\n "+"\<text>" +"\n "+"\<text>"
#Level I #Level I
+card_rules_text() +xml_escape(card_rules_text()
# Level II # Level II
+"\nLEVEL " + card.level_1 +"\nLEVEL " + card.level_1
+(if card.pt_2 != "" then "\n"+card.pt_2) +(if card.pt_2 != "" then "\n"+card.pt_2)
@@ -808,9 +851,9 @@ script:
# Level III # Level III
+"\nLEVEL " + card.level_2 +"\nLEVEL " + card.level_2
+(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>"
+"\n"+"\</card>" +"\n "+"\</card>"
} }
write_card := { if is_token() then "" write_card := { if is_token() then ""
@@ -833,8 +876,8 @@ 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 "_" + card.name_2}.full." + 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)) + "." + to_lower(options.images_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
) )
@@ -849,7 +892,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=\"3\">\n<cards>\n"+write_all_tokens+"\n\n</cards>\n</cockatrice_carddatabase>")) 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>"))
#other cards #other cards
to_string("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<cockatrice_carddatabase version=\"3\">\n<sets>\n<set>\n<name>"+set.set_code+"</name>\n<longname>"+set.title+"</longname>\n<settype>"+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 (options.include_Tokens and not(options.tokens_In_Separate_XML)) then ("\n\n <!-->Tokens</-->\n"+write_all_tokens)+"\n\n </cards>\n</cockatrice_carddatabase>")