This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Probably only works on Ruby 2.5.0 | |
require 'json' | |
def create_monster mon | |
cont = [] | |
cont.append("subtitle | #{mon['meta']}") | |
cont.append("rule") | |
cont.append("property | Armor class | #{mon['Armor Class']}") | |
cont.append("property | Hit points | #{mon['Hit Points']}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'rails-html-sanitizer' | |
def get_monster_list | |
monster_urls = [] | |
firstpage = Nokogiri::HTML(open("https://www.dndbeyond.com/monsters?filter-search=&filter-source=1&filter-type=0&page=1")) | |
num_pages = firstpage.xpath('//li[@class="b-pagination-item"]')[firstpage.xpath('//li[@class="b-pagination-item"]').length - 2].text.to_i | |
puts "Found #{num_pages} pages..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"title": "Aboleth", | |
"icon": "imp-laugh", | |
"contents": [ | |
"subtitle | Large aberration, lawful evil", | |
"rule", | |
"property | Armor class | 17 (Natural Armor)", | |
"property | Hit points | 135 (18d10 + 36)", | |
"property | Speed | 10 ft., swim 40 ft. ", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"name": "Aboleth", | |
"meta": "Large aberration, lawful evil", | |
"Armor Class": "17 (Natural Armor)", | |
"Hit Points": "135 (18d10 + 36)", | |
"Speed": "10 ft., swim 40 ft. ", | |
"STR": "21", | |
"STR_mod": "(+5)", | |
"DEX": "9", |