2022-11-18 23:08:08 -05:00
|
|
|
require 'squib'
|
2023-01-01 20:54:41 -05:00
|
|
|
require 'game_icons'
|
|
|
|
|
2023-01-13 19:17:22 -05:00
|
|
|
module Icons
|
|
|
|
|
|
|
|
def self.getIcon(name, color = 'black')
|
|
|
|
return GameIcons.get(name).
|
|
|
|
recolor(fg: color, bg: 'white', fg_opacity: 1.0, bg_opacity: 0.0).
|
|
|
|
string
|
|
|
|
end
|
|
|
|
|
|
|
|
AUDIENCE = getIcon 'delapouite/person'
|
|
|
|
MUSIC = getIcon 'delapouite/musical-score'
|
|
|
|
|
|
|
|
LOVE = getIcon 'skoll/hearts'
|
|
|
|
ANGER = getIcon 'skoll/fist'
|
|
|
|
JOY = getIcon 'lorc/delighted'
|
|
|
|
SAD = getIcon 'lorc/tear-tracks'
|
|
|
|
end
|
2023-01-01 20:54:41 -05:00
|
|
|
|
2023-01-02 22:27:14 -05:00
|
|
|
VOLUMES = {
|
|
|
|
"ppp" => 1,
|
|
|
|
"pp" => 2,
|
|
|
|
"p" => 3,
|
|
|
|
"mp" => 4,
|
|
|
|
"mf" => 5,
|
|
|
|
"f" => 6,
|
|
|
|
"ff" => 7,
|
|
|
|
"fff" => 8,
|
|
|
|
}
|
|
|
|
|
2023-01-14 15:44:16 -05:00
|
|
|
data = Squib.csv file: 'data.csv'
|
2023-01-01 20:54:41 -05:00
|
|
|
|
2023-01-14 15:44:16 -05:00
|
|
|
Squib::Deck.new(cards: data.nrows) do
|
2023-01-01 20:54:41 -05:00
|
|
|
use_layout file: 'economy.yml'
|
|
|
|
use_layout file: 'layout.yml'
|
|
|
|
background color: 'white'
|
|
|
|
cut_zone
|
|
|
|
safe_zone
|
|
|
|
|
|
|
|
text layout: :title, str: data.name
|
|
|
|
|
2023-01-14 15:44:16 -05:00
|
|
|
# svg layout: :art, data: Icons::MUSIC
|
|
|
|
text layout: :art, align: :center, valign: :middle, str: data.traits do |embed|
|
|
|
|
embed.svg key: 'l', width: 128, height: 128, data: Icons::LOVE
|
|
|
|
embed.svg key: 'a', width: 128, height: 128, data: Icons::ANGER
|
|
|
|
embed.svg key: 'j', width: 128, height: 128, data: Icons::JOY
|
|
|
|
embed.svg key: 's', width: 128, height: 128, data: Icons::SAD
|
|
|
|
end
|
2023-01-01 20:54:41 -05:00
|
|
|
|
|
|
|
rect layout: :description
|
|
|
|
text layout: :description, str: data.effect.zip(data.blurb).map { |e, b|
|
|
|
|
"#{e}#{b ? "\n<i>#{b}</i>" : nil}"
|
|
|
|
} do |embed|
|
2023-02-24 22:47:22 -05:00
|
|
|
embed.svg key: '{A}', width: 32, height: 32, data: Icons::AUDIENCE
|
2023-01-14 15:44:16 -05:00
|
|
|
embed.svg key: '{l}', width: 32, height: 32, data: Icons::LOVE
|
|
|
|
embed.svg key: '{a}', width: 32, height: 32, data: Icons::ANGER
|
|
|
|
embed.svg key: '{j}', width: 32, height: 32, data: Icons::JOY
|
|
|
|
embed.svg key: '{s}', width: 32, height: 32, data: Icons::SAD
|
2023-01-01 20:54:41 -05:00
|
|
|
end
|
2023-02-24 22:47:22 -05:00
|
|
|
text layout: :volume, markup: true, str: data.volume.map { |v| "<b><i>#{v} (#{VOLUMES[v]})</i></b>" }
|
|
|
|
text layout: :audience, ellipsize: :autoscale, str: data.audience.map { |au| "{A}#{au}"} do |embed|
|
|
|
|
embed.svg key: '{A}', width: 48, height: 48, data: Icons::AUDIENCE
|
|
|
|
end
|
2022-11-18 23:08:08 -05:00
|
|
|
|
|
|
|
save format: :png
|
2023-01-01 21:28:20 -05:00
|
|
|
save_sheet prefix: "sheet",
|
|
|
|
columns: 5, rows: 4, trim: '0.125in', count_format: ''
|
|
|
|
|
2022-11-18 23:08:08 -05:00
|
|
|
end
|