1
0

initial commit

This commit is contained in:
Ninjananas
2024-08-31 12:29:28 +02:00
commit 7bdea04111
12 changed files with 10584 additions and 0 deletions

37
deck.rb Normal file
View File

@@ -0,0 +1,37 @@
require 'squib'
data = Squib.xlsx file: 'cards.xlsx', explode: 'quantite'
def icon_to_svg(icon)
icon.nil? ? nil : "icone_#{icon}.svg"
end
def rank_to_banner_svg(rank)
rank.nil? ? nil : (rank.start_with?('+') || rank.start_with?('-')) ? "banniere_mod.svg" : "banniere_rang.svg"
end
Squib::Deck.new(cards: data['nom'].size, layout: 'layout.yml') do
background color: 'white'
rect layout: 'cut'
#rect layout: 'safe'
icon_file = data['icone'].map { |icon| icon_to_svg(icon) }
svg file: icon_file, layout: 'icon'
banner_file = data['rang'].map { |rank| rank_to_banner_svg(rank) }
svg file: banner_file, layout: 'banner'
text str: data['rang'], layout: 'banner_text'
text str: data['nom'], layout: banner_file.map { |banner| banner.nil? ? 'name' : 'name_with_banner'}
alt_icon_file = data['icone_alt'].map { |icon| icon_to_svg(icon) }
svg file: alt_icon_file, layout: 'alt_icon'
alt_banner_file = data['rang_alt'].map { |rank| rank_to_banner_svg(rank) }
svg file: alt_banner_file, layout: 'alt_banner'
text str: data['rang_alt'], layout: 'alt_banner_text'
save_sheet columns: 4
save_pdf trim: 37.5, file: 'sheet.pdf'
hand range: [0, 7, 15, 25, 38, 17], trim: 37.5
end