Browse Source

Column boxes

master
The Stranjer 4 years ago
parent
commit
81f79d0822
1 changed files with 72 additions and 68 deletions
  1. +72
    -68
      shards_of_power.rb

+ 72
- 68
shards_of_power.rb View File

@@ -32,7 +32,7 @@ class ShardsOfPower
pdf.font_size FONT_SIZE_CHAPTER
pdf.font "Abess"
puts "\tPrinting chapter to document"
pdf.text "Chapter #{number_name}: #{chapter_name}"
pdf.text "Chapter #{number_name}: #{chapter_name}", :align => :center

puts "\tRestoring body text"
pdf.font "Goudy"
@@ -50,7 +50,7 @@ class ShardsOfPower

puts "\tSetting font size"
pdf.font_size FONT_SIZE_SECTION
pdf.text section_name
pdf.text section_name, :align => :center

puts "\tRestoring body text"
pdf.font_size FONT_SIZE_BODY
@@ -113,7 +113,7 @@ class ShardsOfPower
pdf.image("cover.png", :width => 612, :height => 792)
puts "Printing inner cover..."
pdf.start_new_page(:margin => 75)
pdf.start_new_page(:margin => 50)

pdf.font "Abess"
pdf.font_size 72
@@ -134,21 +134,23 @@ class ShardsOfPower

start_chapter "One", "Introduction"

pdf.text "Like every supernatural entity in the Chronicles of Darkness, there is a boundless breadth and depth of topics to discuss within them. The Awakened are by no stretch of the imagination an exception to this rule. This book does not dare claim that this will cover all of them, but it does dare to cover the broad strokes on a certain subtopic of the lives of those touched by the Supernal who still reside in the Fallen World: their toolkit.\n\n<b>Mage: the Awakening</b> covered the broadest strokes on Awakened life in general, but there is so much more to the means by which Mages conduct their affairs and pursue their Obsessions that simply is not covered in that volume. There will be yet more that this one fails to consider. However, it is designed to touch on the high level ideas, and dig into some of the specifics for them, leaving you, the reader compelled, and hopefully, inspired as to where to explore next.", :inline_format => true
start_section "Tools Of Awakened Life"
pdf.text "This book is meant to be used as a toolkit. Each of the spells are modular, and for the most part do not operate off of each other. You, as the Storyteller or player, are meant to take the things you find fun, interesting and compelling while leaving the things you find silly, improper, or frustrating behind. This line of thought naturally extends to all of the Conditions, optional Arcana principles, alternative Relinquishment methods, and so on.\n\nThis book was written on a rolling basis by a number of people. It is a compilation, that accumulated over time. It did not get created overnight. As such, by the time you receive this file, there is a good likelihood that it's still in development, which means there might be more up-to-date versions of it, and additionally it may be open to input for your spells, your Artifacts, and your optional rules. The invite code at the time of publication is <b>Cx3JBpB</b>.", :inline_format => true
pdf.column_box([0, pdf.cursor], :columns => 2, :width => pdf.bounds.width) do
pdf.text "Like every supernatural entity in the Chronicles of Darkness, there is a boundless breadth and depth of topics to discuss within them. The Awakened are by no stretch of the imagination an exception to this rule. This book does not dare claim that this will cover all of them, but it does dare to cover the broad strokes on a certain subtopic of the lives of those touched by the Supernal who still reside in the Fallen World: their toolkit.\n\n<b>Mage: the Awakening</b> covered the broadest strokes on Awakened life in general, but there is so much more to the means by which Mages conduct their affairs and pursue their Obsessions that simply is not covered in that volume. There will be yet more that this one fails to consider. However, it is designed to touch on the high level ideas, and dig into some of the specifics for them, leaving you, the reader compelled, and hopefully, inspired as to where to explore next.", :inline_format => true
start_section "Tools Of Awakened Life"
pdf.text "This book is meant to be used as a toolkit. Each of the spells are modular, and for the most part do not operate off of each other. You, as the Storyteller or player, are meant to take the things you find fun, interesting and compelling while leaving the things you find silly, improper, or frustrating behind. This line of thought naturally extends to all of the Conditions, optional Arcana principles, alternative Relinquishment methods, and so on.\n\nThis book was written on a rolling basis by a number of people. It is a compilation, that accumulated over time. It did not get created overnight. As such, by the time you receive this file, there is a good likelihood that it's still in development, which means there might be more up-to-date versions of it, and additionally it may be open to input for your spells, your Artifacts, and your optional rules. The invite code at the time of publication is <b>Cx3JBpB</b>.", :inline_format => true

start_section "Chapters"
start_section "Chapters"

pdf.text "There are multiple chapters in this book. Each of them covers a specific set of topics.\n\n<b>Chapter One</b> is ithe Introduction. It is what you are reading now. It gives the mission statement, the credits, and a few other key details before you get into the spells and the Conditions.\n\n<b>Chapter Two</b> is the megagrimoire. It is a grimoire of grimoires, much like the book that White Wolf released when they still called themselves that, and is a combined set of spells that the players of this community have mutually agreed are at least somewhat reasonable. Many of us helped each other write these spells. All of their names will be listed in them, alphabetically.", :inline_format => true
pdf.text "There are multiple chapters in this book. Each of them covers a specific set of topics.\n\n<b>Chapter One</b> is ithe Introduction. It is what you are reading now. It gives the mission statement, the credits, and a few other key details before you get into the spells and the Conditions.\n\n<b>Chapter Two</b> is the megagrimoire. It is a grimoire of grimoires, much like the book that White Wolf released when they still called themselves that, and is a combined set of spells that the players of this community have mutually agreed are at least somewhat reasonable. Many of us helped each other write these spells. All of their names will be listed in them, alphabetically.", :inline_format => true

start_section "Credits"
start_section "Credits"

spell_authors = spells.collect { |spell| spell.authors }.flatten.uniq.sort
spell_authors = spells.collect { |spell| spell.authors }.flatten.uniq.sort

pdf.text "The following users have contributed to Shards of Power, in alphabetical order: #{spell_authors.to_list}"
pdf.text "The following users have contributed to Shards of Power, in alphabetical order: #{spell_authors.to_list}"
end

start_chapter("Two", "Spells")

@@ -159,77 +161,79 @@ class ShardsOfPower

start_section("#{arcanum_name} Spells")

arcanum_spells.group_by(&arcanum).sort_by { |rating, spells| rating }.to_h.each do |rating, rating_spells|
rating_title = "#{rating.to_dots} #{Spell::RANKS[rating - 1]} of #{arcanum_name}"
puts "\tCompiling #{rating_title} spells..."
pdf.outline.add_subsection_to("#{arcanum_name} Spells") do
@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 }.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
pdf.column_box([0, pdf.cursor], :columns => 2, :width => pdf.bounds.width) do
arcanum_spells.group_by(&arcanum).sort_by { |rating, spells| rating }.to_h.each do |rating, rating_spells|
rating_title = "#{rating.to_dots} #{Spell::RANKS[rating - 1]} of #{arcanum_name}"
puts "\tCompiling #{rating_title} spells..."
pdf.outline.add_subsection_to("#{arcanum_name} Spells") do
@pdf.outline.section rating_title, :destination => @pdf.page_number
end

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
pdf.font_size FONT_SIZE_SECTION
pdf.text rating_title

spell_ary << {:text => " )", :font => "Lilith", :styles => [], :color => "004E6D", :size => FONT_SIZE_SUBSECTION, :character_spacing => -3}
rating_spells.sort_by { |spell| spell.name }.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.formatted_text spell_ary
spell_ary = [{:text => "#{spell.name} (", :font => "Lilith", :color => "004E6D", :size => FONT_SIZE_SUBSECTION}]

pdf.formatted_text [
{:text => "Practice: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.practice, :font => "Goudy"},
]
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

pdf.formatted_text [
{:text => "Primary Factor: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.primary_factor, :font => "Goudy"},
]
spell_ary << {:text => " )", :font => "Lilith", :styles => [], :color => "004E6D", :size => FONT_SIZE_SUBSECTION, :character_spacing => -3}

pdf.formatted_text [
{:text => "Withstand: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.withstand, :font => "Goudy"},
] if !spell.withstand.nil?
pdf.formatted_text spell_ary

pdf.formatted_text [
{:text => "Suggested Rote Skills: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.suggested_rote_skills.join(', '), :font => "Goudy"},
]
pdf.formatted_text [
{:text => "Practice: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.practice, :font => "Goudy"},
]

pdf.formatted_text [
{:text => spell.authors.length == 1 ? "Author: " : "Authors: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.authors.join(', '), :font => "Goudy"},
]
pdf.formatted_text [
{:text => "Primary Factor: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.primary_factor, :font => "Goudy"},
]

pdf.text spell.rules_text, :inline_format => true
pdf.formatted_text [
{:text => "Withstand: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.withstand, :font => "Goudy"},
] if !spell.withstand.nil?

spell.reaches.each do |reach|
pdf.formatted_text [
{:text => "+#{reach[0]} Reach: ", :styles => [:bold], :font => "Goudy"},
{:text => reach[1], :font => "Goudy"},
{: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"},
{:text => spell.authors.length == 1 ? "Author: " : "Authors: ", :styles => [:bold], :font => "Goudy"},
{:text => spell.authors.join(', '), :font => "Goudy"},
]

pdf.text spell.rules_text, :inline_format => true

spell.reaches.each do |reach|
pdf.formatted_text [
{:text => "+#{reach[0]} Reach: ", :styles => [:bold], :font => "Goudy"},
{:text => reach[1], :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"},
]
end
end
end
end


Loading…
Cancel
Save