|
|
@@ -1,4 +1,5 @@ |
|
|
|
require "prawn" |
|
|
|
require "prawn/grouping" |
|
|
|
require "pry" |
|
|
|
|
|
|
|
require_relative "spell" |
|
|
@@ -180,75 +181,80 @@ class ShardsOfPower |
|
|
|
@pdf.outline.section rating_title, :destination => @pdf.page_number |
|
|
|
end |
|
|
|
|
|
|
|
pdf.font_size FONT_SIZE_SECTION |
|
|
|
pdf.text rating_title |
|
|
|
rating_spells.sort_by! { |spell| spell.name } |
|
|
|
|
|
|
|
rating_spells.sort_by { |spell| spell.name }.each do |spell| |
|
|
|
rating_spells.each do |spell| |
|
|
|
puts "\t\tCompiling #{spell.full_title} by #{spell.authors.join(', ')}" |
|
|
|
|
|
|
|
pdf.outline.add_subsection_to(rating_title) do |
|
|
|
@pdf.outline.section spell.full_title, :destination => @pdf.page_number |
|
|
|
end |
|
|
|
pdf.group do |g| |
|
|
|
if spell == rating_spells.first |
|
|
|
g.font_size FONT_SIZE_SECTION |
|
|
|
g.text rating_title |
|
|
|
end |
|
|
|
|
|
|
|
spell_ary = [{:text => "#{spell.name} (", :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SUBSECTION}] |
|
|
|
|
|
|
|
g.font_size FONT_SIZE_BODY |
|
|
|
previous = false |
|
|
|
spell.arcana.each do |arcanum| |
|
|
|
spell_ary << {:text => ", ", :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SUBSECTION} if previous |
|
|
|
spell_ary << {:text => arcanum.to_s.titleize, :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SUBSECTION} |
|
|
|
spell_ary << {:text => spell.send(arcanum).to_dots, :color => "004E6D", :size => FONT_SIZE_SUBSECTION, :character_spacing => -5} |
|
|
|
|
|
|
|
previous = true |
|
|
|
end |
|
|
|
|
|
|
|
spell_ary << {:text => " )", :font => "Lilith", :styles => [], :color => "004E6D", :size => FONT_SIZE_SUBSECTION, :character_spacing => -3} |
|
|
|
|
|
|
|
g.formatted_text spell_ary |
|
|
|
|
|
|
|
g.formatted_text [ |
|
|
|
{:text => "Practice: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.practice, :font => "Goudy"}, |
|
|
|
] |
|
|
|
|
|
|
|
spell_ary = [{:text => "#{spell.name} (", :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SUBSECTION}] |
|
|
|
|
|
|
|
pdf.font_size FONT_SIZE_BODY |
|
|
|
previous = false |
|
|
|
spell.arcana.each do |arcanum| |
|
|
|
spell_ary << {:text => ", ", :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SUBSECTION} if previous |
|
|
|
spell_ary << {:text => arcanum.to_s.titleize, :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SUBSECTION} |
|
|
|
spell_ary << {:text => spell.send(arcanum).to_dots, :color => "004E6D", :size => FONT_SIZE_SUBSECTION, :character_spacing => -5} |
|
|
|
previous = true |
|
|
|
end |
|
|
|
|
|
|
|
spell_ary << {:text => " )", :font => "Lilith", :styles => [], :color => "004E6D", :size => FONT_SIZE_SUBSECTION, :character_spacing => -3} |
|
|
|
|
|
|
|
pdf.formatted_text spell_ary |
|
|
|
|
|
|
|
pdf.formatted_text [ |
|
|
|
{:text => "Practice: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.practice, :font => "Goudy"}, |
|
|
|
] |
|
|
|
|
|
|
|
pdf.formatted_text [ |
|
|
|
{:text => "Primary Factor: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.primary_factor, :font => "Goudy"}, |
|
|
|
] |
|
|
|
|
|
|
|
pdf.formatted_text [ |
|
|
|
{:text => "Withstand: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.withstand, :font => "Goudy"}, |
|
|
|
] if !spell.withstand.nil? |
|
|
|
|
|
|
|
pdf.formatted_text [ |
|
|
|
{:text => "Cost: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.cost, :font => "Goudy"}, |
|
|
|
] if !spell.cost.nil? |
|
|
|
|
|
|
|
pdf.formatted_text [ |
|
|
|
{:text => "Suggested Rote Skills: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.suggested_rote_skills.join(', '), :font => "Goudy"}, |
|
|
|
] |
|
|
|
g.formatted_text [ |
|
|
|
{:text => "Primary Factor: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.primary_factor, :font => "Goudy"}, |
|
|
|
] |
|
|
|
|
|
|
|
pdf.formatted_text [ |
|
|
|
{:text => spell.authors.length == 1 ? "Author: " : "Authors: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.authors.join(', '), :font => "Goudy"}, |
|
|
|
] |
|
|
|
g.formatted_text [ |
|
|
|
{:text => "Withstand: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.withstand, :font => "Goudy"}, |
|
|
|
] if !spell.withstand.nil? |
|
|
|
|
|
|
|
pdf.text spell.rules_text, :inline_format => true |
|
|
|
g.formatted_text [ |
|
|
|
{:text => "Cost: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.cost, :font => "Goudy"}, |
|
|
|
] if !spell.cost.nil? |
|
|
|
|
|
|
|
spell.reaches.each do |reach| |
|
|
|
pdf.formatted_text [ |
|
|
|
{:text => "+#{reach[0]} Reach: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => reach[1], :font => "Goudy"}, |
|
|
|
g.formatted_text [ |
|
|
|
{:text => "Suggested Rote Skills: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.suggested_rote_skills.join(', '), :font => "Goudy"}, |
|
|
|
] |
|
|
|
end |
|
|
|
|
|
|
|
spell.adds.each do |add| |
|
|
|
pdf.formatted_text [ |
|
|
|
{:text => "#{add[:verb] ? add[:verb] : "Add"} #{add[:arcana].collect { |arcanum, rating| [arcanum, rating].to_arcanum_with_dots }.to_list(:separator => add[:separator])}: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => add[:effect], :font => "Goudy"}, |
|
|
|
g.formatted_text [ |
|
|
|
{:text => spell.authors.length == 1 ? "Author: " : "Authors: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => spell.authors.join(', '), :font => "Goudy"}, |
|
|
|
] |
|
|
|
|
|
|
|
g.text spell.rules_text, :inline_format => true |
|
|
|
|
|
|
|
spell.reaches.each do |reach| |
|
|
|
g.formatted_text [ |
|
|
|
{:text => "+#{reach[0]} Reach: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => reach[1], :font => "Goudy"}, |
|
|
|
] |
|
|
|
end |
|
|
|
|
|
|
|
spell.adds.each do |add| |
|
|
|
g.formatted_text [ |
|
|
|
{:text => "#{add[:verb] ? add[:verb] : "Add"} #{add[:arcana].collect { |arcanum, rating| [arcanum, rating].to_arcanum_with_dots }.to_list(:separator => add[:separator])}: ", :styles => [:bold], :font => "Goudy"}, |
|
|
|
{:text => add[:effect], :font => "Goudy"}, |
|
|
|
] |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|