public := true designer_map := { [ "101": "Pipsqueak", "DOA": "Pipsqueak", "LVS": "Pipsqueak", "Storytime": "Pipsqueak", "Discoveries of Akieva": "Pipsqueak", "Love Song": "Pipsqueak", "AVX": "Pipsqueak", "Animus Vox": "Pipsqueak", "AKD": "Parasign", "Arkadai": "Parasign", "ALK": "Zangy", "Alkabah": "Zangy", "ALR": "Mako", "Alara": "Mako", "TTR": "Mako", "Theros Triumphant": "Mako", "ATB": "CanterburyEgg", "GNJ": "CanterburyEgg", "GHQ": "CanterburyEgg", "SUR": "CanterburyEgg", "KOD": "CanterburyEgg", "DSS": "CanterburyEgg", "NJB": "CanterburyEgg", "Al Tabaq": "CanterburyEgg", "Goliaths of Nangjiao": "CanterburyEgg", "Glacia": "CanterburyEgg", "Glacia: Hail to the Queen": "CanterburyEgg", "Glacia Hail to the Queen": "CanterburyEgg", "Glacia, Hail to the Queen": "CanterburyEgg", "Surging Tide": "CanterburyEgg", "Surging Tides": "CanterburyEgg", "Kahembo Olde Dawn": "CanterburyEgg", "Kahembo: Olde Dawn": "CanterburyEgg", "Kahembo": "CanterburyEgg", "Dark Seas of Shiryen": "CanterburyEgg", "Nangjiao In Bloom": "CanterburyEgg", "AFM": "Korakhos", "K15": "Korakhos", "KZD": "Korakhos", "TOW": "Korakhos", "Aftermath": "Korakhos", "K15 Core Set": "Korakhos", "Khaliz-Dorahn": "Korakhos", "Tides of War": "Korakhos", "Tide of War": "Korakhos", "ACA": "HerziQuerzi", "BYK": "HerziQuerzi", "CAC": "HerziQuerzi", "MAC": "HerziQuerzi", "HVF": "HerziQuerzi", "PFP": "HerziQuerzi", "TWR": "HerziQuerzi", "Arcanum Academia": "HerziQuerzi", "Beyond Our Ken": "HerziQuerzi", "Beyond our Ken": "HerziQuerzi", "Carpe Arcanum": "HerziQuerzi", "Memorium Arcanum": "HerziQuerzi", "Harvest Festival": "HerziQuerzi", "Plagues of Fretport": "HerziQuerzi", "A Tourney at Whiterun": "HerziQuerzi", "Tourney at Whiterun": "HerziQuerzi", "DHL": "FifthDragon", "Descent from the Highlands": "FifthDragon", "Descent": "FifthDragon", "EAU": "Simon Williamson", "Eralou": "Simon Williamson", "EIA": "Dodger", "ONO": "Dodger", "Elmare: Into the Abyss": "Dodger", "Elmare Into the Abyss": "Dodger", "Elmare": "Dodger", "Adventurers of Onora": "Dodger", "Adventures of Onora": "Dodger", "EOW": "Purplemurasaki", "End of Wollensie": "Purplemurasaki", "HI12": "Cajun", "KXP": "Cajun", "NVA": "Cajun", "OPH": "Cajun", "ORP": "Cajun", "MPS_OPO": "Cajun", "MPS_HI12": "Cajun", "VTM": "Cajun", "MON": "Cajun", "SPK": "Cajun", "High Noon": "Cajun", "Karina's Explorations": "Cajun", "Novea": "Cajun", "Ophorio": "Cajun", "Oirohpo": "Cajun", "Ophorio Sagas": "Cajun", "Daisite Outlaws": "Cajun", "Villains: the Musical": "Cajun", "Villains: The Musical": "Cajun", "Villains The Musical": "Cajun", "Villains the Musical": "Cajun", "Monsters of Chikyu": "Cajun", "Monsters of Chikyuu": "Cajun", "Sparks": "Cajun", "Sparks of a Multiverse": "Cajun", "FNV": "TEST", "Feanav": "TEST", "Feanav: The Apothecary's Progress": "TEST", "Feanav: the Apothecary's Progress": "TEST", "IMP": "Timespiraled", "PSA": "Timespiraled", "TOJ": "Timespiraled", "WAY": "Timespiraled", "SWR": "Timespiraled", "TMI": "Timespiraled", "Imperial Legacies": "Timespiraled", "Path of Shadows": "Timespiraled", "Tales of Old Jidai": "Timespiraled", "Worlds Away": "Timespiraled", "Seasons of War": "Timespiraled", "Toll Midnight": "Timespiraled", "KLC": "fluffyDeathbringer", "LAW": "fluffyDeathbringer", "MIS": "fluffyDeathbringer", "Kaleidoscope": "fluffyDeathbringer", "Lovi Awoken": "fluffyDeathbringer", "Lovi": "fluffyDeathbringer", "Mious": "fluffyDeathbringer", "POA": "Daij_Djan", "Pyramids of Atuum": "Daij_Djan", "RVO": "Emily", "Riddles of Revio": "Emily", "RWR": "CyberChronometer", "Rail War": "CyberChronometer", "SOR": "WindyDelcarlo", "Spark of the Revolution": "WindyDelcarlo", "Spark of a Revolution": "WindyDelcarlo", "Spark of Revolution": "WindyDelcarlo", "SOU": "Matt", "QRB": "Matt", "Scriptures of Urshad": "Matt", "Quest for the Roseblade": "Matt", "OTH": "Matt & DrChillbrain", "Over the Horizon": "Matt & DrChillbrain", "STN": "Wrenn", "Survive the Night": "Wrenn", "UNR": "water the weeds", "The Unraveling": "water the weeds", "Unraveling": "water the weeds", "RCM": "gynoidpoet", "Road to Caru Mapu": "gynoidpoet", "PAX": "Scribbl", "Panxiou": "Scribbl", "VHS": "Avery", "Video Horror System": "Avery", "ACT": "Zangy & Fleur", "The Stage Presents": "Zangy & Fleur", "The Neverending Act": "Zangy & Fleur", "The Stage Presents: The Neverending Act": "Zangy & Fleur", "ZER": "Umisa", "Zero": "Umisa", "VST": "Reuben", "Vastuum": "Reuben", "SRC": "Zangy", "Secrets of the River City": "Zangy", "KUT": "Matt", "Kuutalya": "Matt", "GQC": "CanterburyEgg", "Ghariv, the Quaking City": "CanterburyEgg", "SVG": "Occo", "Svergard": "Occo", "VRD": "DrChillbrain", "Viridian's Last Mission": "DrChillbrain", "KRS": "zarepath", "Karsus": "zarepath", "KSV": "Bergland", "Karslav": "Bergland", "BLR": "Pipsqueak", "Blood Like Rivers": "Pipsqueak", "DOV": "Matt", "Duelists of Vereaux": "Matt", "POP": "dr platypeople", "Hyperpop": "dr platypeople", "TRX": "Zangy", "Theros: Age of Trax": "Zangy", "OLD": "Dodger", "Awakening in Oldun": "Dodger", "Cybaros": "Splitmoon", "CYB": "Splitmoon", "Cliques of Nylin": "Stasis", "CNY": "Stasis", "nil": nil ] } code_map := [ "Imperial Legacies": "IMP", "Path of Shadows": "PSA", "Shrine": "SHRINE", "Mana Pool": "L2", "Land Bundle": "L" ] export_me := { if contains(card.notes, match:"!noexport") then false #else if contains(card.text+card.text_2+card.notes, match:"enter") or contains(card.super_type, match:"Enchantment") # then true else if options.update or else false then contains(card.notes, match:"!update") else true } fix_tm := replace@(match:"™", replace:"TM") fixed_set_code := { base := trim(fix_tm(if options.set_code != "" then options.set_code else set.set_code)) if base == "MSEM Champions" then "MPS_MSE" else if code_map[base] or else "" != "" then code_map[base] else base } dfc_splitter_name := { name := card_name() second := if contains(card.shape, match:"double faced") then remove_tags(card.name_2) else "" if options.image_name == "dfc name" and second != "" then name + "_" + second else name } pull_designer_1 := { design_command := designer_name_grabber(designer_name_filter(card.notes)) design_credit := card.card_code_text != "" and not match(card.card_code_text, match:"^(Story Spotlight|([|] ?)?FT(:| ?[-—]| by| from| written))") possible_designer := replace(replace(card.card_code_text, match:"[*✉]", replace:""), match:"^ +", replace:"") ## !design XXX ## if public, basic check ## if public, default designers ## check credit vs fixer map ## check credit exists ## check set code vs cached map ## default designer if design_command != "" then design_command else if public and options.check_designers and design_credit then possible_designer else if public or not options.check_designers then options.default_designer else if designer_map()[possible_designer] or else "" != "" then designer_map()[possible_designer] else if design_credit and possible_designer != "" then possible_designer else if designer_map()[fixed_set_code()] or else "" != "" then designer_map()[fixed_set_code()] else options.default_designer } pull_designer := { base := trim(pull_designer_1()) if public then base else designer_map()[base] or else base } a_lackey_image_export_width := { if contains(card.shape, match:"split") then "445" else if contains(card.shape, match:"double faced") then "626" else "312" } a_lackey_image_export_height := { if contains(card.shape, match:"split") then "312" else "445" } image_export_width := { if options.export_images == "lackey size" then if contains(card.shape, match:"split") then "445" else if contains(card.shape, match:"double faced") then "626" else "312" else if contains(card.shape, match:"split") then 523 else if contains(card.shape, match:"double faced") then 752 else 375 } image_export_height := { if options.export_images == "lackey size" then if contains(card.shape, match:"split") then "312" else "445" else if contains(card.shape, match:"split") then 375 else 523 } remove_commas := replace@(match:":", replace:"")+ replace@(match:"<(/|\\\\)?i>", replace:"")+ replace@(match:"[\<>:\\\\/\"\\*\\?\\|]", replace:"") token_export := {use_token() or contains(card.shape, match:"rulestip")} v_rep := { if input != "V" then input else if options.v_mana_replacement == "" then input else options.v_mana_replacement } escape_quotes := replace@(match:"\"", replace:"\\\\\"") exporter_name_filter := filter_text@(match:"(^|[^!])!exporte?r?name [^\n!]+") exporter_name_grabber := replace@(match:".*!exporte?r?name ", replace:"") has_export_tag := match@(match:"!export\\b") hidden_name_filter := filter_text@(match:"!hiddenname [^\n!]+") hidden_name_grabber := replace@(match:"!hiddenname ", replace:"") hidden_tag_filter := filter_text@(match:"!hidetag [^\n!]+") hidden_tag_grabber := replace@(match:"!hidetag ", replace:"") hidden_name := { given := hidden_name_grabber(hidden_name_filter(remove_tags(card.notes))) if given != "" and db then given := replace(given, match:"//", replace:"__") tag := hidden_tag_grabber(hidden_tag_filter(remove_tags(card.notes))) tag := if tag != "" then " " + tag else "" name := if given == "" then remove_tags(card.name) else given shape := if contains(card.notes, match:"!notes secretface") then "secretface" else lackey_shape() breaker := if card.name_2 == "" then "" else if db then "//" else if shape == "doubleface" or shape == "secretface" then "__" else "//" name2 := if card.name_2 == "" then "" else remove_tags(card.name_2) tag2 := if shape == "secretface" then replace(tag, match:"[)]", replace:"b)") else if name2 != "" then tag else "" partial_name := if given == "" and tag == "" then "" ## no hidden name else if given != "" then given ## hiddenname else if shape == "secretface" then name + tag + breaker + name2 + tag2 ## secretface else if shape == "doubleface" and db then name + breaker + name2 + tag ## double database else if shape == "doubleface" then name + tag + breaker + name2 + tag2 ## double hidden else if db or shape == "split" then name + breaker + name2 + tag ## split / normal db / adv db else name + tag ## adventure hidden / normal hidden replace(partial_name, match:"(\n|^ +| +$)", replace:"") }@(db:false) patch_note_filter := filter_text@(match:"!update [^\n!]+") patch_note_grabber := replace@(match:"!update ", replace:"") patch_note := {escape_quotes(patch_note_grabber(patch_note_filter(card.notes)))} card_name := { replace(if exporter_name_grabber(exporter_name_filter(card.notes)) != "" then exporter_name_grabber(exporter_name_filter(card.notes)) else remove_tags(card.name), match:"(\n| +$|^ +)", replace:"") } notes_filter := filter_text@(match:"!notes? [^\n!]+") notes_grabber := replace@(match:"!notes? ", replace:"") +replace@(match:"([^,]+)", replace:{"\"" + _1 + "\""}) +replace@(match:"italics", replace:"italic") card_note_array := { "[" + (if notes_grabber(notes_filter(card.notes)) != "" then notes_grabber(notes_filter(card.notes)) else "") + "]" } exporter_num_filter := filter_text@(match:"!num [^\n!]+") exporter_num_grabber := replace@(match:"!num ", replace:"") lackey_script_filter := filter_text@(match:"!script [^\n]+") lackey_script_grabber := replace@(match:"!script ", replace:"") designer_name_filter := filter_text@(match:"!designe?r? [^\n]+") designer_name_grabber := replace@(match:"!designe?r? ", replace:"") link_filter := filter_text@(match:"!link [^\n]+") link_grabber := replace@(match:"!link ", replace:"") link_name := { if link_grabber(link_filter(card.notes)) != "" then link_grabber(link_filter(card.notes)) else "" } is_revived := { if contains(card.notes, match:"!revivetoken") then "Revived " else ""} database_name := { if exporter_name_grabber(exporter_name_filter(card.notes)) != "" then exporter_name_grabber(exporter_name_filter(card.notes)) else if contains(card.shape, match: "split") or contains(card.shape, match:"double") or contains(card.shape, match:"adventure") then remove_tags(card.name) + "//" + remove_tags(card.name_2) else is_revived() + remove_tags(card.name) } forced_script := { if lackey_script_grabber(lackey_script_filter(card.notes)) != "" then "[" + lackey_script_grabber(lackey_script_filter(card.notes)) + "]" else "\"\""} type_trim := replace@(match:"Basic ", replace:"")+ replace@(match:"Legendary", replace:"")+ replace@(match:"Snow ", replace:"")+ replace@(match:"World ", replace:"")+ replace@(match:"Token ", replace:"") ####### Script that converts the card's mana cost lackey_bot_rule_filter := replace@(match:"’", replace:"'")+ replace@(match:"\n", replace:"\\\\n")+ replace@(match:";;", replace:"\\\\n\\\\n")+ replace@(match:"[(]", replace:"*(")+ replace@(match:"[)]", replace: ")*")+ replace@(match:"\"", replace:"”")+ replace@(match:" ”", replace:" “") break_cleaner := replace@(match:"\n", replace:"") + replace@(match:"\"", replace:"\\\\\"") mana_script := replace@(match:"(2|H|W|U|B|R|G|S|C)/(W|U|B|R|G|S|C)", replace:{"\{"+_1+"/"+_2+"\}"})+ replace@(match:"(X|Y|Z|W|U|B|R|G|S|C)", in_context:"(?", replace:{"\{"+_1+"\}"})+ replace@(match:"([1-9][0-9])", in_context:"(?", replace:{"\{"+_1+"\}"})+ replace@(match:"([0-9])", in_context:"(?(?!})", replace:{"\{"+_1+"\}"})+ replace@(match:"V", replace:{"\{"+v_rep("V")+"\}"}) lackey_bot_mana_filter := replace@(match:"([0-9WUBRGCSHEQTXYZEDV/]+)", replace:{"\{"+_2+"}"})+ replace@(match:"([0-9HSCWUBRGXYZEDV/])", in_context:"\{[0-9HSCWUBRGXYZEDV/]*[0-9HSCWUBRGXYZEDV/]*}", replace:{"\{"+v_rep(_1)+"}"})+ replace@(match:"}\{/}\{", replace:"/")+ replace@(match:"\{([0-9])}\{([0-9])}", replace:{"\{"+_1+_2+"}"})+ replace@(match:"\{\{", replace:"\{")+ replace@(match:"}}", replace:"}") color_condense := replace@(match:"(, )?(artifact|multicolor|land|hybrid|horizontal|vertical|radial|overlay)", replace: "") indicator_color_name := { cond := color_condense(input) if cond == "white" then "\{White\} " else if cond == "blue" then "\{Blue\} " else if cond == "black" then "\{Black\} " else if cond == "red" then "\{Red\} " else if cond == "green" then "\{Green\} " else if cond == "white, blue" then "\{White/Blue\} " else if cond == "blue, black" then "\{Blue/Black\} " else if cond == "black, red" then "\{Black/Red\} " else if cond == "red, green" then "\{Red/Green\} " else if cond == "white, green" then "\{Green/White\} " else if cond == "white, black" then "\{White/Black\} " else if cond == "blue, red" then "\{Blue/Red\} " else if cond == "black, green" then "\{Black/Green\} " else if cond == "white, red" then "\{Red/White\} " else if cond == "blue, green" then "\{Green/Blue\} " else if cond == "white, black, red" then "\{White/Black/Red\} " else if cond == "blue, red, green" then "\{Blue/Red/Green\} " else if cond == "white, black, green" then "\{Black/Green/White\} " else if cond == "white, blue, red" then "\{Red/White/Blue\} " else if cond == "blue, black, green" then "\{Green/Blue/Black\} " else if cond == "white, blue, black" then "\{White/Blue/Black\} " else if cond == "blue, black, red" then "\{Blue/Black/Red\} " else if cond == "black, red, green" then "\{Black/Red/Green\} " else if cond == "white, red, green" then "\{Red/Green/White\} " else if cond == "white, blue, green" then "\{Green/White/Blue\} " else "" } trim_zeroes := replace@(match: "^00?", replace: "")+ replace@(match: "a?/[0-9b]+", replace: "") corrected_card_number := { if exporter_num_grabber(exporter_num_filter(card.notes)) != "" then exporter_num_grabber(exporter_num_filter(card.notes)) else if card.custom_card_number != "" then trim_zeroes(card.custom_card_number) else card_number() } lackey_bot_flavor := {"*" + input + "*" } apos_filter := replace@(match:"’", replace:"'") paragraph_count := replace@(match:"\n", replace:"~")+ filter_text@(match:"~") text_script := { replace( remove_tags(input) + (if card.rule_text_3 != "" then "\\n" + card.rule_text_3 else ""), match:"[ ][ ]+•", replace: "\\n•" ) } leveler_text := { card.rule_text + "\\n" + "[PROGRESS " + card.level_1 + "] " + card.rule_text_2 + "\\n" + "[PROGRESS " + card.level_2 + "] " + card.rule_text_3 + "\\n" } flavor_script := { if input == "" then "" else replace(italic_filter(input), match:"\n", replace:"\\\\n") + "\\n" } italic_filter := replace@(match:"", replace:"*")+ replace@(match:" *", replace:"*")+ replace@(match:" ", replace:"* ")+ replace@(match:" ", replace:"* ")+ replace@(match:" ", replace:"* ")+ replace@(match:"", replace:"*")+ replace@(match:"", replace:"*")+ replace@(match:"", replace:"*")+ replace@(match:" ", replace:" *")+ replace@(match:" ", replace:" *")+ replace@(match:" ", replace:" *")+ replace@(match:"", replace:"*")+ replace@(match:"", replace:"*")+ replace@(match:"", replace:"*")+ replace@(match:"\\*\\*+", replace:"") walker_text := { lackey_bot_mana_filter(lackey_bot_rule_filter((if card.loyalty_cost_1 != "" then "[" + card.loyalty_cost_1 + "]: ") +(if card.level_1_text != "" then card.level_1_text else split_text(match:"\n", card.rule_text).0)+"\\n" + "[" + card.loyalty_cost_2 + "]" +(if card.loyalty_cost_2 !="" then ": ") +(if card.level_2_text != "" then card.level_2_text+"\\n" else if contains(paragraph_count(card.rule_text), match:"~") then split_text(match:"\n", card.rule_text).1+"\\n") + "[" + card.loyalty_cost_3 + "]" +(if card.loyalty_cost_3 !="" then ": ") +(if card.level_3_text != "" then card.level_3_text+"\\n" else if contains(paragraph_count(card.rule_text), match:"~~") then split_text(match:"\n", card.rule_text).2+"\\n") + ( if card.loyalty_cost_4 != "" then "[" + card.loyalty_cost_4 + "]" +": ") +(if card.level_4_text != "" then card.level_4_text+"\\n" else if contains(paragraph_count(card.rule_text), match:"~~~") then split_text(match:"\n", card.rule_text).3+"\\n"))) } walker_text_2 := { lackey_bot_mana_filter(lackey_bot_rule_filter((if card.loyalty_cost_5 != "" then "[" + card.loyalty_cost_5 + "]: ") +(if card.loyalty_cost_5 !="" then ": ") +(if card.level_5_text != "" then card.level_5_text+"\\n" else split_text(match:"\n", card.rule_text_2).0)+"\\n" + "[" + card.loyalty_cost_6 + "]" +(if card.loyalty_cost_6 !="" then ": ") +(if card.level_6_text != "" then card.level_6_text+"\\n" else if contains(paragraph_count(card.rule_text_2), match:"~") then split_text(match:"\n", card.rule_text_2).1+"\\n") + "[" + card.loyalty_cost_7 + "]" +(if card.loyalty_cost_7 !="" then ": ") +(if card.level_7_text != "" then card.level_7_text+"\\n" else if contains(paragraph_count(card.rule_text_2), match:"~~") then split_text(match:"\n", card.rule_text_2).2+"\\n") + ( if card.loyalty_cost_8 != "" then "[" + card.loyalty_cost_8 + "]" +": ") +(if card.level_8_text != "" then card.level_8_text+"\\n" else if contains(paragraph_count(card.rule_text_2), match:"~~~") then split_text(match:"\n", card.rule_text_2).3+"\\n"))) } apos_fix := replace@(match:"’", replace:"'") use_token := { contains(card.shape, match:"token") or contains(card.shape, match:"emblem") or contains(card.super_type, match:"Token") or contains(card.super_type, match:"Emblem") } search_code := { (if card.rarity == "masterpiece" then "MPS_" else if card.rarity == "special" and not use_bonus() then "PRO_" else if use_token() then "TKN_" else "") + fixed_set_code() } use_promo := match@(match:"!promo\\b") use_bonus := { card.rarity == "special" and not use_promo(card.notes) } lackey_shape := { if contains(card.shape, match: "adventure") then "adventure" else if contains(card.shape, match: "aftermath") or contains(card.shape, match: "split") then "split" else if contains(card.shape, match:"double") then "doubleface" else "normal" } rarity_name := { if use_token() then "Token" else if contains(fixed_set_code(), match:"MPS") or card.rarity == "masterpiece" then "Masterpiece" else if use_bonus() then "Bonus" else if card.rarity == "special" then "Promo" else if card.rarity == "mythic rare" then "M" else if card.rarity == "rare" then "R" else if card.rarity == "uncommon" then "U" else if card.rarity == "common" then "C" else "L" } lb_rarity_code := { if use_token() or fixed_set_code() != "MPS_MSE" then "*" + fixed_set_code() + " " + rarity_name() + "*" else "*MSEM Champion*" } check_champion := { sc := fixed_set_code() checker := "" if sc == "MPS_MSE" or sc == "CHAMPIONS" or sc == "REV" then checker := if card.custom_card_number != "" then card.custom_card_number else card.card_code_text else if sc == "LAIR" and match(card.copyright, match:"Top Xs|League Leaders") then checker := card.copyright split_text(checker, match:"— ?").1 or else "" } rename_filter := filter_text@(match:"!renameof [^\n!]+") rename_grabber := replace@(match:"!renameof ", replace:"") check_rename := { rn := rename_grabber(rename_filter(card.notes)) if rn == "" then rn else rn + "_" + search_code() } add_token_filter := filter_text@(match:"!addtoken [^\n!]+") add_token_grabber := replace@(match:"!addtoken ", replace:"") replace_token_filter := filter_text@(match:"!replacetoken [^\n!]+") replace_token_grabber := replace@(match:"!replacetoken ", replace:"") token_tag_filter := filter_text@(match:"!tokentag [^\n!]+") token_tag_grabber := replace@(match:"!tokentag ", replace:"") has_subtitle := { card.alias != "" and contains(card.notes, match:"!subtitle")} token_scripts := { add_token_argument := add_token_grabber(add_token_filter(card.notes)) replace_token_argument := replace_token_grabber(replace_token_filter(card.notes)) token_tag_argument := token_tag_grabber(token_tag_filter(card.notes)) output := "" if add_token_argument != "" then output := output + "\"aa\": \"" + add_token_argument + "\"" + (if replace_token_argument != "" or token_tag_argument != "" then ", " else "") if replace_token_argument != "" then output := output + "\"rr\": \"" + replace_token_argument + "\"" + (if token_tag_argument != "" then ", " else "") if token_tag_argument != "" then output := output + "\"t\": \"" + token_tag_argument + "\"" if output != "" then output := "\"tokenscripts\": \{" + output + "\}, " output } text_processing1 := {text_processing(input, box:"")} text_processing2 := {text_processing(input, box:"2")} textpends := "!(append|prepend|inpend|exitpend)" text_processing := { blocks := split_text(card.notes, match:textpends+box+" ") cmds := break_text(card.notes, match:textpends+box+" ") if length(cmds) > 0 then ( shift := if not contains(card.notes, match:cmds[0]+blocks[0]) then 1 else 0 for x from 0 to length(cmds)-1 do ( cmd := replace(to_lower(cmds[x]), match:"2? $", replace:""); inf := replace(blocks[x+shift], match:"\n\n\n.*", replace:""); input := command_processing[cmd](input, info:inf); "" ) ) replace(input, match:"\\\\n$", replace:"") } command_processing := [ "!append": { input + lackey_bot_rule_filter(info) }, "!prepend": { replace(lackey_bot_rule_filter(info), match:"\\\\n$", replace:"") + input }, "!exitpend": { input }, "!inpend": { swaps := split_text(info, match:"/replace/") apps := split_text(info, match:"/add/") if length(swaps) > 1 then replace(input, match:swaps.0, replace:lackey_bot_rule_filter(swaps.1)) else if length(apps) > 1 then replace(input, match:"(.*)({apps.0})(.*)", replace:"\\1\\2{lackey_bot_rule_filter(apps.1)}\\3") else input } ] write_normal := { " \"" + (if hidden_name() != "" then hidden_name(db:true) else break_cleaner(apos_fix(database_name()))) + "_" + search_code() + "\": \{" + "\"fullName\": \"" + break_cleaner(apos_fix(database_name())) + "\", " + ( if has_subtitle() then "\"cardName\": \"" + break_cleaner(remove_tags(card.name)) + "\", " + "\"alias\": \"" + break_cleaner(card.alias) + "\", " if card.alias != "" then "\"cardName\": \"" + break_cleaner(card.alias) + "\", " + "\"alias\": \"" + break_cleaner(remove_tags(card.name)) + "\", " else "\"cardName\": \"" + break_cleaner(remove_tags(card.name)) + "\", " ) + "\"manaCost\": \"" + mana_script(card.casting_cost) + "\", " + "\"typeLine\": \"" + break_cleaner(card.type) + "\", " + "\"rarityLine\": \"" + lb_rarity_code() + "\", " + "\"rulesText\": \"" + text_processing1(if card.special_text != "" then lackey_bot_rule_filter(text_script(lackey_bot_mana_filter(card.special_text))) else if card.shape == "leveler" then lackey_bot_mana_filter(lackey_bot_rule_filter(leveler_text())) else if card.loyalty != "" then walker_text() else lackey_bot_rule_filter(text_script(lackey_bot_mana_filter(card.rule_text))),) + "\", " + "\"flavorText\": \"" + flavor_script(if contains(card.chapter_text, match:"") then card.chapter_text else card.flavor_text) + "\", " + "\"power\": " + (if card.power == "*" then "\"★\"" else if card.power == "" then "\"\"" else if (to_number(card.power) or else false != card.power) then "\"" + card.power + "\"" else card.power) + ", " + "\"toughness\": " + (if card.toughness == "*" then "\"★\"" else if card.toughness == "" then "\"\"" else if (to_number(card.toughness) or else false != card.toughness) then "\"" + card.toughness + "\"" else card.toughness) + ", " + "\"loyalty\": " + (if (to_number(card.loyalty) or else false != card.loyalty) then "\"" + card.loyalty + "\"" else card.loyalty) + ", " + "\"color\": \"" + (if contains(card.super_type, match:"Land") then "" else indicator_color_name(card.card_color)) + "\", " + "\"cmc\": " + cmc(card.casting_cost) + ", " + "\"cardType\": \"" + type_trim(card.super_type) + "\", " + (if contains(card.shape, match: "split") or contains(card.shape, match:"double") or contains(card.shape, match:"adventure") or contains(card.shape, match:"aftermath") then secondCard()) + "\"rarity\": \"" + (if rarity_name() == "Token" then "token" else if rarity_name() == "Bonus" then "bonus" else if rarity_name() == "Masterpiece" then "masterpiece" else card.rarity) + "\", " + "\"shape\": \"" + lackey_shape() + "\", " + "\"setID\": \"" + (if use_token() then "tokens" else fixed_set_code()) + "\", " + (if use_token() then "\"parentSet\": \"" + fixed_set_code() + "\", " else "") + "\"cardID\": \"" + (if use_token() then fixed_set_code() else "") + corrected_card_number() + "\", " + "\"designer\": \"" + pull_designer() + "\", " + "\"script\": " + forced_script() + ", " + (if has_export_tag(card.notes) then "\"tagged\": true, " else "") + "\"notes\": " + card_note_array() + ", " + token_scripts() + (if check_champion() != "" then "\"champion\": \"" + check_champion() + "\"," else "") + (if check_rename() != "" then "\"rename\": \"" + check_rename() + "\"," else "") + (if hidden_name() != "" then "\"hidden\": \"" + hidden_name() + "\"," else "") + (if link_name() != "" then "\"link\": \"" + link_name() + "\"," else "") + (if patch_note() != "" then "\"patchNote\": \"" + patch_note() + "\"," else "") + "\"artist\": \"" + break_cleaner(card.illustrator) + (if contains(card.shape, match: "split") or contains(card.shape, match:"double") and card.illustrator != card.illustrator_2 and card.illustrator_2 != "" then "\", \"artist2\": \"" + break_cleaner(card.illustrator_2)) + "\"\},\n" } write_command:= {" \"" + apos_fix(database_name()) + "_" + search_code() + "\": \{" + "\"fullName\": \"" + apos_fix(database_name()) + "\", " + "\"cardName\": \"" + remove_tags(card.name) + "\", " + "\"manaCost\": \"\", " + "\"typeLine\": \"\", " + "\"rarityLine\": \"\", " + "\"rulesText\": \"" + (if card.loyalty != "" then walker_text() else lackey_bot_rule_filter(text_script(lackey_bot_mana_filter(card.rule_text)))) + "\", " + "\"flavorText\": \"\", " + "\"power\": \"\", " + "\"toughness\": \"\", " + "\"loyalty\": \"\", " + "\"color\": \"\", " + "\"cmc\": \"\", " + "\"cardType\": \"\", " + "\"rarity\": \"\", " + "\"shape\": \"normal\", " + "\"setID\": \"BOT\", " + "\"cardID\": \"\"\},\n" } secondCard := { ( if card.alias_2 != "" then "\"cardName2\": \"" + break_cleaner(card.alias_2) + "\", " + "\"alias2\": \"" + break_cleaner(remove_tags(card.name_2)) + "\", " else "\"cardName2\": \"" + break_cleaner(remove_tags(card.name_2)) + "\", " ) + "\"manaCost2\": \"" + mana_script(card.casting_cost_2) + "\", " + "\"typeLine2\": \"" + break_cleaner(card.type_2) + "\", " + "\"rarityLine2\": \"" + lb_rarity_code() + "\", " + "\"rulesText2\": \"" + text_processing2(if card.special_text_2 != "" then lackey_bot_rule_filter(text_script(lackey_bot_mana_filter(card.special_text_2))) else if card.loyalty_2 != "" then walker_text_2() else lackey_bot_rule_filter(text_script(lackey_bot_mana_filter(card.rule_text_2)))) + "\", " + "\"flavorText2\": \"" + flavor_script(card.flavor_text_2) + "\", " + "\"power2\": " + (if card.power_2 == "*" then "\"★\"" else if card.power_2 == "" then "\"\"" else if (to_number(card.power_2) or else false != card.power_2) then "\"" + card.power_2 + "\"" else card.power_2) + ", " + "\"toughness2\": " + (if card.toughness_2 == "*" then "\"★\"" else if card.toughness_2 == "" then "\"\"" else if (to_number(card.toughness_2) or else false != card.toughness_2) then "\"" + card.toughness_2 + "\"" else card.toughness_2) + ", " + "\"loyalty2\": " + (if (to_number(card.loyalty_2) or else false != card.loyalty_2) then "\"" + card.loyalty_2 + "\"" else card.loyalty_2) + ", " + "\"color2\": \"" + (if contains(card.super_type, match:"Land") then "" else indicator_color_name(card.card_color_2)) + "\", " + "\"cmc2\": " + cmc(card.casting_cost_2) + ", " + "\"cardType2\": \"" + type_trim(card.super_type_2) + "\", " } write_update := { if not export_me() then "" else write_normal() } ####################################write_update := { if options.update and not contains(card.notes, match:"!alter") then "" else write_normal() } write_cards := to_text(for each card in cards do write_update()) clean_cards := replace@(match:",\n$", replace: "\n") +replace@(match:"’", replace:"'") +replace@(match:"\\\\n[ \t]+", replace:"\\\\n") ####################################to_string("\{\n"+clean_cards(write_cards+"THATSALLF0LKS") +"}") file_name := { if options.image_name == "card number" then ( if token_export() or (not public and (fixed_set_code() == "MSEMAR" or card_name() == "Glory Counter" or card_name() == "Idol" or card_name() == "Morph" or card_name() == "Manifest" or card_name() == "Shimmer" or card_name() == "Submerge")) then fixed_set_code()+corrected_card_number() else corrected_card_number() ) + fillin + ".jpg" else if fillin == "b" then remove_tags(card.name_2) +".jpg" else card_name() + ".jpg" }@(fillin:"") lackey_sizer := [ 375: 312, 523: 445 ] write_card_images := { ## base card write_image_file( card, directory: fixed_set_code(), file: file_name(), width: image_export_width(), height: image_export_height() ) sts := card.stylesheet if sts == nil then sts := set.stylesheet len := length(sts.card_regions) if len > 0 then ( card_image := to_card_image(card) for i from 0 to len-1 do ( region_info := sts.card_regions[i] region := crop( card_image, width: region_info.width, height: region_info.height, offset_x: region_info.x, offset_y: region_info.y ) fillin := if region_info.name == "front" or region_info.name == "minifront" then "a" else if region_info.name == "back" or region_info.name == "meldpair" then "b" else if region_info.name == "meld" or region_info.name == "thirdcard" then "c" else region_info.name fn := file_name(fillin:fillin) w := region_info.width h := region_info.height if options.export_images == "lackey size" then ( w := lackey_sizer[w] or else w h := lackey_sizer[h] or else h ) write_image_file( region, directory: fixed_set_code(), file: fn, width: w, height: h ) ) ) "" }