From 647bd1c915acfa48b9b494467246667b84bae4f2 Mon Sep 17 00:00:00 2001 From: cajun <12363371+CajunAvenger@users.noreply.github.com> Date: Fri, 4 Oct 2024 19:00:04 -0500 Subject: [PATCH] DFC & Exporter Fixes --- .../export-template | 4 +++- .../script | 6 ++++-- .../export-template | 10 ++++++--- data/magic-m15-mainframe-dfc.mse-style/style | 9 +++----- data/magic.mse-game/script | 21 ++++++++++++------- 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/data/magic-cockatrice-v2.mse-export-template/export-template b/data/magic-cockatrice-v2.mse-export-template/export-template index 32744be8a..aef88b6b5 100644 --- a/data/magic-cockatrice-v2.mse-export-template/export-template +++ b/data/magic-cockatrice-v2.mse-export-template/export-template @@ -899,7 +899,9 @@ script: #render image file write_image := { - if length(card.stylesheet.card_regions) > 0 then write_multi_image() + sts := card.stylesheet + if sts == nil then sts := set.stylesheet + if length(sts.card_regions) > 0 then write_multi_image() else write_single_image() } format_file_name := { diff --git a/data/magic-lackeybot.mse-export-template/script b/data/magic-lackeybot.mse-export-template/script index a1ba0de0f..7d0d29af0 100644 --- a/data/magic-lackeybot.mse-export-template/script +++ b/data/magic-lackeybot.mse-export-template/script @@ -673,11 +673,13 @@ write_card_images := { height: image_export_height() ) - len := length(card.stylesheet.card_regions) + 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 := card.stylesheet.card_regions[i] + region_info := sts.card_regions[i] region := crop( card_image, width: region_info.width, diff --git a/data/magic-lackeyccg.mse-export-template/export-template b/data/magic-lackeyccg.mse-export-template/export-template index 6314e5029..f89a1c0df 100644 --- a/data/magic-lackeyccg.mse-export-template/export-template +++ b/data/magic-lackeyccg.mse-export-template/export-template @@ -742,7 +742,9 @@ script: + ".jpg" }@(fillin:"") write_card_image := { - if length(card.stylesheet.card_regions) > 0 + sts := card.stylesheet + if sts == nil then sts := set.stylesheet + if length(sts.card_regions) > 0 then write_multi_images(); write_image_file( card, @@ -753,9 +755,11 @@ script: ) } write_multi_images := { + sts := card.stylesheet + if sts == nil then sts := set.stylesheet card_image := to_card_image(card) - for i from 0 to length(card.stylesheet.card_regions)-1 do ( - region_info := card.stylesheet.card_regions[i] + for i from 0 to length(sts.card_regions)-1 do ( + region_info := sts.card_regions[i] region_name := region_info.name fillin := if region_name == "front" or region_name == "minifront" or region_name == "meldpair" then "a" diff --git a/data/magic-m15-mainframe-dfc.mse-style/style b/data/magic-m15-mainframe-dfc.mse-style/style index 000864c78..e9848ff7e 100644 --- a/data/magic-m15-mainframe-dfc.mse-style/style +++ b/data/magic-m15-mainframe-dfc.mse-style/style @@ -1027,11 +1027,12 @@ init script: styling_field := if instance <= 1 then styling.front_style else styling.back_style if styling_field == "auto-sizing planeswalker" then ( counter := 1 + bumper := 8 * (instance-1) for x from 1 to 8 do ( - tf := card["level_" + (x*instance) + "_text"] + tf := card["level_" + (x+bumper) + "_text"] if tf != "" and tf != zwsp then counter := x; ) - tf := card["level_" + counter + "_text"] + tf := card["level_" + (counter+bumper) + "_text"] if active then counter := counter - ( if tf == "" or tf == zwsp then 1 else 0) else counter := counter + 1 styling_field := counter; @@ -1524,10 +1525,6 @@ init script: flavor_bar_disabled_1 := { mainframe_walker() or a_saga() or not set.use_flavor_bar } flavor_bar_disabled_2 := { mainframe_walkerb() or b_saga() or not set.use_flavor_bar } - is_blank := { - input == "" or input == zwsp - } - watermark_include := "/magic-modules.mse-include/watermarks" ############################################################## Set info fields set info style: diff --git a/data/magic.mse-game/script b/data/magic.mse-game/script index 822f9b2fd..db1b74035 100644 --- a/data/magic.mse-game/script +++ b/data/magic.mse-game/script @@ -33,7 +33,7 @@ include file: language include file: statistics_script include file: /magic-blends.mse-include/new-blends ############################################################## Versioning -version_date := {"2024-10-01 Template Pack 3.0.5: Magic Modules & Showcase Catchup - UBWalker fix"} +version_date := {"2024-10-01 Template Pack 3.0.5: Magic Modules & Showcase Catchup - DFC & Exporter Fixes"} version := version_date ############################################################## Common filters ############################################################## Utility @@ -63,6 +63,7 @@ remove_zwsp := replace@(match:"​", replace:"") #### Replace spaces by a spacer separate_words := remove_tags + trim + replace@(match:" ", replace: {spacer}) zwsp := "​" # this is a zero-width space not blank +is_blank := { input == "" or input == zwsp } ############################################################## Type is_creature := lang_setting("is_creature") @@ -396,14 +397,16 @@ corrected_card_number := { if exporter_num_grabber(exporter_num_filter(card.note crop_multi_image := { image_map := hash_new() - m3in1 := card.stylesheet.full_name == "M15 Style Meld cards (3-in-1)" + sts := card.stylesheet + if sts == nil then sts := set.stylesheet + m3in1 := sts.full_name == "M15 Style Meld cards (3-in-1)" three_cards := false cs := get_card_styling(card) if m3in1 and cs.three_cards or else false then three_cards := true card_image := to_card_image(card) - len := length(card.stylesheet.card_regions) + len := length(sts.card_regions) for i from 0 to len-1 do ( - region_info := card.stylesheet.card_regions[i] + region_info := sts.card_regions[i] if m3in1 and three_cards and (region_info.name == "front" or region_info.name == "meldback") then "" else if m3in1 and (not three_cards) and (region_info.name != "front" and region_info.name != "meldback") @@ -3559,16 +3562,20 @@ loyalty_level_is_active := { number := to_int(replace(input, match: "lv", replace: "")) or else 999 if number > 24 then false else ( - instance := if number < 9 then 1 else if number < 17 then 2 else 3 - loyalty_abilities_count(active:true) >= (number mod 8)) + instance := if number < 9 then 1 else if number < 17 then 2 else 3 + mod_val := number mod 8 + if mod_val == 0 then mod_val := 8 + loyalty_abilities_count(active:true) >= mod_val + ) } loyalty_abilities_count := { styling_field := if instance <= 1 then (styling.number_of_textboxes or else "0") else (styling["number_of_textboxes_" + instance] or else "0") if styling_field == "automatic" then ( counter := 1 + bumper := 8 * (instance-1) for x from 1 to 8 do ( - tf := card["level_" + (x*instance) + "_text"] + tf := card["level_" + (x+bumper) + "_text"] if tf != "" and tf != zwsp then counter := x; ) tf := card["level_" + counter + "_text"]