// This file contains all the guide book chapter pages
// done in a separate file for clarity and ease of formatting
// Made by InnerTri


// import the needed ActionFormData module, 
// as that is the ideal type of form for this purpose
import {
	ActionFormData,
	ModalFormData
} from "@minecraft/server-ui";

// import world to get the world's dynprops
import {
    world
} from "@minecraft/server";



// need to create all the chapters AFTER world has loaded,
// due to scripting 2.0.0 changes

// define all the chapters ahead of time, so that they can still be exported 
// even though their values are set on world load

let ch_select,
	ch_general,
	ch_behaviors,
	ch_catalog,
	ch_horse,
	ch_donkey,
	ch_mule,
	ch_zebra,
	ch_zorse,
	ch_zonkey,
	ch_seahorse_big,
	ch_seahorse_small,
	ch_unicorn,
	ch_pegasus,
	ch_alicorn,
	ch_rainbow,
	ch_fairy,
	ch_kelpie,
	ch_spider,
	ch_zombie,
	ch_skeleton,
	ch_creeper,
	ch_ender,
	ch_dragon,
	ch_crimson,
	ch_warped,
	ch_ghost,
	ch_lava,
	ch_blaze,
	ch_settings,
	ch_changes;

	export let chapters;

	// define the strings of the horse types that can be disabled through the settings
	// NOTE that these are NOT the type IDs! These string are what the dyn props will use for their names.
	// that is also why they are all caps-ed
	// for example: cyn_hao:disableHorse
	export const disableableHorseStrings = [
	"Horse",
	"Donkey",
	"Zebra",
	"Seahorse_big",
	"Seahorse_small",
	"Unicorn",
	"Rainbow",
	"Kelpie",
	"Spider",
	"Zombie",
	"Skeleton",
	"Creeper",
	"Ender",
	"Dragon",
	"Crimson",
	"Warped",
	"Ghost",
	"Lava",
	"Blaze"
	];

world.afterEvents.worldLoad.subscribe(
	event => {



		// add chapters to the chapter select form

		// originally I wanted to use for loops, supplemental arrays and their indices
		// but honestly that was reaching more effort than just hard-coding it
		// so I decided to just do the latter
		// let it be known that I tried, though
		ch_select = new ActionFormData()
		.title({"text":"§l§01,000,000 HORSES!§r"})
		.body({"text":"§lChapter Selection"})
		.button({"text":"General Information"},"textures/items/saddle.png")

		// behaviors chapter
		.button({"text":"Horse Behaviors"},"textures/cynosia/horses/item/icon_whistle.png")

		// catalouge chapter
		.button({"text":"Horse Catalog"},"textures/cynosia/horses/item/icon_catalog.png")

		// horse chapters chapter
		.button({"text":"Wild Horses"},"textures/cynosia/horses/book_icon/horse.png")
		.button({"text":"Donkeys"},"textures/cynosia/horses/book_icon/donkey.png")
		.button({"text":"Mules"},"textures/cynosia/horses/book_icon/mule.png")
		.button({"text":"Zebras"},"textures/cynosia/horses/book_icon/zebra.png")
		.button({"text":"Zorses"},"textures/cynosia/horses/book_icon/zorse.png")
		.button({"text":"Zonkeys"},"textures/cynosia/horses/book_icon/zonkey.png")
		.button({"text":"Seahorses"},"textures/cynosia/horses/book_icon/seahorse_big.png")
		.button({"text":"Small Seahorses"},"textures/cynosia/horses/book_icon/seahorse_small.png")
		.button({"text":"Unicorns"},"textures/cynosia/horses/book_icon/unicorn.png")
		.button({"text":"Pegasus"},"textures/cynosia/horses/book_icon/pegasus.png")
		.button({"text":"Alicorns"},"textures/cynosia/horses/book_icon/alicorn.png")
		.button({"text":"Rainbow Horses"},"textures/cynosia/horses/book_icon/rainbow.png")
		.button({"text":"Fairy Horses"},"textures/cynosia/horses/book_icon/fairy.png")
		.button({"text":"Kelpies"},"textures/cynosia/horses/book_icon/kelpie.png")
		.button({"text":"Spider Horses"},"textures/cynosia/horses/book_icon/spider.png")
		.button({"text":"Zombie Horses"},"textures/cynosia/horses/book_icon/zombie.png")
		.button({"text":"Skeleton Horses"},"textures/cynosia/horses/book_icon/skeleton.png")
		.button({"text":"Creeper Horses"},"textures/cynosia/horses/book_icon/creeper.png")
		.button({"text":"Ender Horses"},"textures/cynosia/horses/book_icon/ender.png")
		.button({"text":"Dragon Horses"},"textures/cynosia/horses/book_icon/dragon.png")
		.button({"text":"Crimson Horses"},"textures/cynosia/horses/book_icon/crimson.png")
		.button({"text":"Warped Horses"},"textures/cynosia/horses/book_icon/warped.png")
		.button({"text":"Ghost Horses"},"textures/cynosia/horses/book_icon/ghost.png")
		.button({"text":"Lava Horses"},"textures/cynosia/horses/book_icon/lava.png")
		.button({"text":"Blaze Horses"},"textures/cynosia/horses/book_icon/blaze.png")



		// settings chapter near the bottom
		.button({"text":"Settings"},"textures/items/redstone_dust")

		// changelog chapter near the bottom
		.button({"text":"Changelog"},"textures/items/paper")

		// close book button at the bottom
		.button({"text":"Close Book"},"textures/blocks/barrier");


// REMOVED TABS SINCE THEY ADD AN UNDESIRED SYMBOL

// General Information about the Add-On
ch_general = new ActionFormData()
.title({"text":"§lGeneral Information§r"})
.body({"text":`Welcome to the §a1,000,000 Horses!§r Add-On!

This book contains useful information about all the new horses and where to find them!

1,000,000 Horses! currently adds 19 new types of horses that spawn in the wild, and 6 more that are only acquired through breeding! 

Some of the horse types have variations, with the wild horses having over a million possible variations!

Saddles are now craftable with two iron in the lower corners, 5 leather connecting them across the top, and this book in the center.

Horses added by this mod have a range of body shapes and sizes. A bred horse's body is determined by blending their parents' bodies, and then multiplying that result by a random number between 0.75 and 1.25.

Vanilla Horses and Donkeys are not replaced with those found in this Add-On by default, but this can be toggled on in the §aSettings§r chapter at the bottom of chapter select.

Click the button below get a copy of this book for safekeeping! 
You can also craft one with a Book, Carrot, Wheat, Apple, and Sugar!
`})
// duplicate book button at the bottom, so they can make a backup
// they could also use the crafting recipe
.button({"text":"Duplicate Book"},"textures/cynosia/horses/item/icon_guide.png")
.button("Back");



// Information about Horses and their Behaviors
ch_behaviors = new ActionFormData()
.title({"text":"§lHorse Behaviors§r"})
.body({"text":`§lHorse Behaviors§r
§l§dWhistle§r
When tamed, all horse types will obey the §aHorse Whistle§r, a handy item that you can use to tell your horses to §bStay§r, §aFollow§r, or §6Wander§r.

Some horses will defend you when wandering, but please note that they will not attack enemies when told to follow!

Use the interact button while holding the whistle to cycle through the whistle options, then interact while looking at a nearby horse to whistle them.

You can also sneak-interact to whistle §lall§r nearby tamed horses!

Craft the whistle with 3 iron nuggets in the top left corner of a crafting menu, and this book in the center!

§l§dEquipment§r
All horse types can wear a chest and armor, and all but the Big Seahorse can wear carpets to give them fancy capes!

Use a shears to remove a chest from a horse.
§6CAUTION:§r This will drop all of the items it contained onto the ground!

§l§dBreeding§r
Many horse types can be bred, but most of the monster horses cannot.

When breeding horses there is a small chance they will have multiple babies!

Some horse types have a special breeding mode, which can be activated by giving them a specific item.

When active, the horse will have particles around them for §a3 minutes§r. If you breed them during this time, the baby will be a special type of horse! 

More details can be found in their chapters.
`})
.button("Back");



// Chapter that gives a copy of the Catalog
ch_catalog = new ActionFormData()
.title({"text":`§lHorse Catalog§r`})
.body({"text":`§lHorse Catalog§r

The horse catalog has pictures of all the new horse types, as well as every pattern of the wild horses!

Interact with the ground to open it!
Interact to go forward a page, and attack to go back a page.
`})

.button({"text":"Give Catalog"}, "textures/cynosia/horses/item/icon_catalog.png")
.button("Back");



// define each chapter
// chapter contents are pretty self-explanatory / self-discernable
// Each chapter contains (Bio Above) since, for some reason,
// displayed forms start at their bottoms
// because of this, if we didn't let them know there was more info at the top,
// there's a decent chance a given player would never see it
// there is a scrollbar, but interestingly enough that is *also* broken
// wild horses
ch_horse = new ActionFormData()
.title({"text":`§lWild Horses§r`})
.body({"text":`§lWild Horses§r

Wild Horses are found commonly in Plains, and occasionally in Savannas.

They're your standard horse, a good mount for getting around. Tame them by riding them!

They have 22 base coat colors, 14 mane/tail colors, 18 body patterns, 17 head patterns, and 14 leg patterns. 
Since each Horse has one of each, this makes for §a1,319,472§r possible Horse variations!

When bred, Horses will take patterns from their parents, with a small chance of a using a random one instead. 
If you give each Horse a Cake before giving them a breeding item, the baby will be a Rainbow Horse!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r Golden Carrot, Golden Apple, Enchanted Apple

§lChested Inventory:§r 9

§lVariants:§r 1,319,472

§lDrops:§r Leather
`})
.button("Back");



// donkeys
ch_donkey = new ActionFormData()
.title({"text":`§lDonkeys§r`})
.body({"text":`§lDonkeys§r

Donkeys are found in Plains and Meadows.

Donkeys are a bit slower than Horses, but can carry more. Tame them by riding them!

They will retaliate if you attack them!

They can breed with other Donkeys, or with a Horse to make a Mule!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r Golden Carrot, Golden Apple, Enchanted Apple

§lChested Inventory:§r 15

§lVariants:§r 3

§lDrops:§r Leather
`})
.button("Back");



// Mules
ch_mule = new ActionFormData()
.title({"text":`§lMules§r`})
.body({"text":`§lMules§r

Mules do not spawn naturally. They can only be obtained by breeding a Donkey with a Horse.

Mules will have a coat color similar to the base coat of their Horse parent.

They are generally better than Donkeys, having the same carry capacity but usually faster.

Mules are sterile and can't be bred!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r N/A

§lChested Inventory:§r 15

§lVariants:§r 22

§lDrops:§r Leather
`})
.button("Back");



// Zebras
ch_zebra = new ActionFormData()
.title({"text":`§lZebras§r`})
.body({"text":`§lZebras§r

Zebras are found in Savannas and Badlands Plateaus.

Zebras can be a bit faster than your average horse, but have a much smaller carrying capacity

They breed with other Zebras, Horses, and Donkeys!

Careful! They'll attack you if you hit them!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r Golden Carrot, Golden Apple, Enchanted Apple

§lChested Inventory:§r 6

§lVariants:§r 2

§lDrops:§r Leather
`})
.button("Back");



// zorses
ch_zorse = new ActionFormData()
.title({"text":`§lZorses§r`})
.body({"text":`§lZorses§r

Zorses do not spawn naturally. They can only be obtained by breeding a zebra with a Horse.

Zorses will have a coat and mane color similar to their Horse parent.

They have the same speed range and carry capacity as a Horse.

Zorses are sterile and can't be bred!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r N/A

§lChested Inventory:§r 9

§lVariants:§r 308

§lDrops:§r Leather
`})
.button("Back");



// zonkeys
ch_zonkey = new ActionFormData()
.title({"text":`§lZonkeys§r`})
.body({"text":`§lZonkeys§r

Zonkeys do not spawn naturally. They can only be obtained by breeding a Zebra with a Donkey.

They have the same speed range as a Horse, but can carry slightly more.

Zonkeys are sterile and can't be bred!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r N/A

§lChested Inventory:§r 12

§lDrops:§r Leather
`})
.button("Back");




// seahorses
ch_seahorse_big = new ActionFormData()
.title({"text":`§lBig Seahorses§r`})
.body({"text":`§lBig Seahorses§r

Big Seahorses are found in all ocean biomes, though the warmer the better.

They are an excellent water mount, providing water breathing to their rider. However, they are nearly useless on land.

§lHeal Items:§r Any Raw Fish other than Pufferfish

§lBreed Items:§r Any Raw Fish other than Pufferfish

§lChested Inventory:§r 9

§lVariants:§r 10

§lDrops:§r Tropical Fish, Prismarine Shard
`})
.button("Back");




// Small seahorses
ch_seahorse_small = new ActionFormData()
.title({"text":`§lSmall Seahorses§r`})
.body({"text":`§lSmall Seahorses§r

Small Seahorses are colorful little fish that are found in Warm Oceans.
They can be picked up by using a Water Bucket on them.

They don't do much, but make for excellent aquarium additions!

§lHeal Items:§r Kelp

§lBreed Items:§r Kelp

§lChested Inventory:§r N/A

§lVariants:§r 8

§lDrops:§r Tropical Fish, Prismarine Crystal
`})
.button("Back");




// Unicorns
ch_unicorn = new ActionFormData()
.title({"text":`§lUnicorns§r`})
.body({"text":`§lUnicorns§r

These mythical creatures are found rarely in Cherry Groves, Flower Forests, and on the highest peaks above the clouds!

Unicorns are on average much faster and can jump higher than Horses.

Careful! They'll attack you if you hit them!

They can breed with other Unicorns, but if you give each parent a Nether Star first, you'll get a Pegasus! 
If you give a star to just one parent, you will have a 50/50 chance to get a Pegasus.

Better yet, if you breed a Unicorn and a Pegasus (without a Nether Star), you will get an Alicorn!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r Golden Carrot, Golden Apple, Enchanted Apple

§lChested Inventory:§r 15

§lVariants:§r 8

§lDrops:§r Leather, Nether Quartz, Ghast Tear
`})
.button("Back");




// Pegasus
ch_pegasus = new ActionFormData()
.title({"text":`§lPegasus§r`})
.body({"text":`§lPegasus§r

Pegasus are typically obtained by breeding Unicorns after feeding them Nether Stars.
However, wild ones can allegedly be tempted into showing themselves by placing an offering of Hay Bales on the highest mountain peaks.

They have the same speed range as a Unicorn, but can fly if you double jump while riding!

They can breed with other Pegasus, but if you breed a Unicorn and a Pegasus, you will get an Alicorn!

Alternatively, if you give a Diamond to a Pegasus and a Rainbow Horse and then breed them with their respective items, you will get a Fairy Horse!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r Golden Carrot, Golden Apple, Enchanted Apple

§lChested Inventory:§r 15

§lVariants:§r 8

§lDrops:§r Leather, Feathers, Nether Quartz, Ghast Tear
`})
.button("Back");



// Alicorn
ch_alicorn = new ActionFormData()
.title({"text":`§lAlicorn§r`})
.body({"text":`§lAlicorn§r

Alicorns do not spawn naturally. They can only be obtained by breeding a Unicorn with a Pegasus.

They have the same speed range as a Unicorn, but can fly if you double jump while riding!

§lHeal Items:§r Wheat, Apple, Sugar, Hay, Golden Carrot, Golden Apple, Enchanted Apple

§lBreed Items:§r Golden Carrot, Golden Apple, Enchanted Apple

§lChested Inventory:§r 15

§lVariants:§r 8

§lDrops:§r Leather, Feathers, Nether Quartz, Ghast Tear
`})
.button("Back");



// Rainbow Horses
ch_rainbow = new ActionFormData()
.title({"text":`§lRainbow Horses§r`})
.body({"text":`§lRainbow Horses§r

Rainbow Horses do not spawn naturally. They can only be obtained by breeding Horses after feeding them Cake.

Rainbow Horses can be one of 16 different colors! You can breed them to get one with the same coat as one of the parents.

They have the same speed range as a horse, but can carry slightly more.

If you give a Diamond to Rainbow Horse and a Pegasus and then breed them with their respective breed items, you will get a Fairy Horse!

§lHeal Items:§r Wheat, Hay, Apple, Sugar, Cake

§lBreed Items:§r Cake

§lChested Inventory:§r 12

§lVariants:§r 16

§lDrops:§r Leather, Random Dyes
`})
.button("Back");




// Fairy Horses
ch_fairy = new ActionFormData()
.title({"text":`§lFairy Horses§r`})
.body({"text":`§lFairy Horses§r

Fairy Horses do not spawn naturally. They can only be obtained by breeding a Rainbow Horse with a Pegasus after feeding them Diamonds.

Like the Pegasus, they are fast, carry a lot, and can fly!

§lHeal Items:§r Wheat, Hay, Apple, Sugar, cake

§lBreed Items:§r Cake

§lChested Inventory:§r 15

§lVariants:§r 16

§lDrops:§r Leather, Glowstone Dust, Random Dyes
`})
.button("Back");



// Kelpies
ch_kelpie = new ActionFormData()
.title({"text":`§lKelpies§r`})
.body({"text":`§lKelpies§r

Kelpies are commonly found in swampy biomes.

Their attributes are a bit lower than Horses, but they are excellent swimmers!

Kelpies appear to be curious and friendly, and will follow you around!

You can tame them by riding them, but be careful - it is said that there may be sinister goals behind their friendly demeanour...

§lHeal Items:§r Cod, Salmon, Tropical Fish

§lBreed Items:§r Axolotl Bucket

§lChested Inventory:§r 9

§lVariants:§r 5

§lDrops:§r Leather, Kelp
`})
.button("Back");



// Spider Horses
ch_spider = new ActionFormData()
.title({"text":`§lSpider Horses§r`})
.body({"text":`§lSpider Horses§r

Spider Horses spawn rarely on the surface wherever Spiders can.

They are bigger and beefier than their arthropod cousins, but contrary to Spiders they will remain hostile during the day!

On average, they are slower than most other horses, but also more durable!

While they are unable to climb walls with a rider on them, they are able to jump the highest of all the horses and are immune to fall damage!

Their attacks cause slowness, and interacting with a tamed one while riding it will cause it to spray webs, slowing anything in front of it!
This ability has a 5 second cooldown.

§aAbility:§r Sprays Slowing Webs, 5s Cooldown

§lHeal Items:§r Any Raw or Cooked Meat

§lBreed Items:§r N/A

§lChested Inventory:§r 12

§lDrops:§r Leather, String, Spider Eye
`})
.button("Back");



// Zombie Horses
ch_zombie = new ActionFormData()
.title({"text":`§lZombie Horses§r`})
.body({"text":`§lZombie Horses§r

Zombie Horses spawn rarely on the surface wherever Zombies can.

They are not too different from Horses.
Zombie Horses are a little slower, have a little more health, and - most importantly - are hostile!

They will burn in daylight, but putting a carpet or armor on them will prevent this.
Please note that doing so will not §oextinguish§r an existing fire.
In other words, if they are already on fire, it will still damage them for the rest of it's remaining duration!

§lHeal Items:§r Any Raw or Cooked Meat

§lBreed Items:§r N/A

§lChested Inventory:§r 6

§lDrops:§r Leather, Rotten Flesh
`})
.button("Back");



// Skeleton Horses
ch_skeleton = new ActionFormData()
.title({"text":`§lSkeleton Horses§r`})
.body({"text":`§lSkeleton Horses§r

Skeleton Horses spawn rarely on the surface wherever Skeletons can, as well as in Soul Sand Valleys.

They are not too different from Horses.
Skeleton Horses are a little faster, have a little less health, and - most importantly - are hostile!

They attack by throwing bones at the player from a range.
Interacting with a tamed one while riding it will cause it to throw a damaging bone in front of it!
This ability has a 2 second cooldown.

They will burn in daylight, but putting a carpet or armor on them will prevent this.
Please note that doing so will not §oextinguish§r an existing fire.
In other words, if they are already on fire, it will still damage them for the rest of it's remaining duration!

§aAbility:§r Shoots Damaging Bones, 5s Cooldown

§lHeal Items:§r Milk Bucket

§lBreed Items:§r N/A

§lChested Inventory:§r 3

§lDrops:§r Bone
`})
.button("Back");



// Creeper Horses
ch_creeper = new ActionFormData()
.title({"text":`§lCreeper Horses§r`})
.body({"text":`§lCreeper Horses§r

Creeper Horses spawn rarely on the surface wherever Creepers can.

They are a blend of Horses and Creepers!
While Creeper Horses can be faster Creepers, they are still on the slower side of the horses.
Luckily, their explosions are a little weaker than those of Creepers.

They are also unable to jump very high due to their stubby little legs.

Should you manage to tame one, interacting with it when riding will have them perform an explosion that deals damage around them, as well as makes them hop back a short distance.
This explosion will not harm the Creeper Horse or it's rider, but use with caution! It will still hurt any other creatures, including pets and farm animals!
This ability has a 5 second cooldown.

A Wild Creeper Horse's explosion will destroy blocks, but a tamed one will not.
§l§cNOTE:§r A tamed Creeper Horse's explosion will not hurt it's rider, but it §lwill§r hurt other nearby entities, including tames!

§aAbility:§r Damaging Explosion, 5s Cooldown

§lHeal Items:§r Gunpowder, TNT

§lBreed Items:§r N/A

§lChested Inventory:§r 3

§lDrops:§r Gunpowder
`})
.button("Back");



// Ender Horses
ch_ender = new ActionFormData()
.title({"text":`§lEnder Horses§r`})
.body({"text":`§lEnder Horses§r

Ender Horses spawn rarely on the surface wherever Endermen can.

Ender Horses are not much different from Endermen.

They are slightly faster than most other horses, but have a little less health.
Water is also dangerous to them!

Just like Endermen, looking at them will cause them to become enraged!

Interacting with a tamed Ender Horse while riding it will cause it to teleport up to 32 blocks forward!
This ability has a 5 second cooldown.

§aAbility:§r Teleport Forward, 5s Cooldown

§lHeal Items:§r Chorus Fruit, Popped Chorus Fruit

§lBreed Items:§r N/A

§lChested Inventory:§r 6

§lDrops:§r Ender Pearl
`})
.button("Back");



// Dragon Horses
ch_dragon = new ActionFormData()
.title({"text":`§lDragon Horses§r`})
.body({"text":`§lDragon Horses§r

Dragon Horses are the most dangerous horse type, and will only spawn in the End.

They are among the fastest and have the most health out of all the horse types, and can fly if you double jump while riding!

They are hostile, and will breathe dragon breath at you from a distance!

Paired with their ability to fly, they can be very difficult to tame or take down. Approach them at your own peril!

Interacting with a tamed Dragon Horse while riding it will cause it to spew damaging dragon breath in front of it for a few seconds!
This ability has a 5 second cooldown.

§aAbility:§r Dragon Breath, 5s Cooldown

§lHeal Items:§r Chorus Fruit, Popped Chorus Fruit

§lBreed Items:§r Chorus Flower

§lChested Inventory:§r 12

§lDrops:§r Leather, Ender Pearl, Dragon Breath
`})
.button("Back");



// Crimson Horses
ch_crimson = new ActionFormData()
.title({"text":`§lCrimson Horses§r`})
.body({"text":`§lCrimson Horses§r

The Crimson Horse is a hostile denzien of Crimson Forests.

They have more health than a Hoglin, but are slower, deal less damage, and are tameable.

They are just as tempermental, however, and will still attack on sight!

§lHeal Items:§r Crimson Roots, Crimson Fungus, Nether Wart, Nether Wart Block

§lBreed Items:§r Nether Wart Block

§lChested Inventory:§r 12

§lDrops:§r Leather, Crimson Roots, Crimson Fungus 
`})
.button("Back");



// Warped Horses
ch_warped = new ActionFormData()
.title({"text":`§lWarped Horses§r`})
.body({"text":`§lWarped Horses§r

The Warped Horse is the passive relative of the Crimson Horse, living in Warped Forests.

They have less health than their cousin, but are faster and will never attack you.

§lHeal Items:§r Warped Roots, Warped Fungus, Warped Wart Block

§lBreed Items:§r Warped Wart Block

§lChested Inventory:§r 9

§lDrops:§r Leather, Warped Roots, Warped Fungus
`})
.button("Back");



// Ghost Horses
ch_ghost = new ActionFormData()
.title({"text":`§lGhost Horses§r`})
.body({"text":`§lGhost Horses§r

A remnant of a Horse's unfulfilled desires, the Ghost Horse is a special type that roams Soul Sand Valleys.

While they aren't very fast, they can jump high and will slowly float downward instead of falling.
Most notably, however, is that they are immune to all but fire damage!

They will burn in daylight, but putting a carpet or armor on them will prevent this.
Please note that doing so will not §oextinguish§r an existing fire.
In other words, if they are already on fire, it will still damage them for the rest of it's remaining duration!

They are completely passive.

Ghost Horses can be found in Soul Sand Valleys

§lHeal Items:§r Phantom Membrane

§lBreed Items:§r N/A

§lChested Inventory:§r 3

§lDrops:§r None
`})
.button("Back");



// Lava Horses
ch_lava = new ActionFormData()
.title({"text":`§lLava Horses§r`})
.body({"text":`§lLava Horses§r

The Lava Horse is the infernal cousin of the Kelpie.

Their attributes and behavior are similar to that of the Kelpie, but they are able to walk on Lava like Striders!

Should you manage to tame one, they might prove themselves to be the fastest way to get around in the Nether.
A few fire resistance potions are recommended for taming!

Water and rain will harm them, but they can be shielded from rain with any armor or carpet.

§lHeal Items:§r Charcoal, Coal, Coal Block, Magma Cream, Magma Block, Lava Bucket

§lBreed Items:§r N/A

§lChested Inventory:§r 12

§lDrops:§r Magma Cream, Magma Block
`})
.button("Back");



// Blaze Horses
ch_blaze = new ActionFormData()
.title({"text":`§lBlaze Horses§r`})
.body({"text":`§lBlaze Horses§r

The Blaze Horse is a another hostile Nether Horse, and can be found in Nether Fortresses.

They generally have more health than a Blaze, but are on the slower side of horse types.
Just like their namesake, they will attack you by shooting Small Fireballs! 

They will also float when falling like the Ghost Horse.

Water and rain will harm them, but they can be shielded from rain with any armor or carpet.

Interacting with a tamed one while riding it will make it release a burst of flame in an area around it, setting any (non-tamed) entities on fire!

§lHeal Items:§r Charcoal, Coal, Coal Block

§lBreed Items:§r N/A

§lChested Inventory:§r 6

§lDrops:§r Blaze Rod
`})
.button("Back");





// Settings
// Empty as it just needs to take up an index,
// to keep everything ordered as we'd like
// I would put the actual chapter here, but
// it seems like I'm not able to get the world's
// dyn property in this file, so we'll have to do that
// in the actual guidebook code
ch_settings = new ActionFormData()
.title({"text":`§lSettings Error§r`})
.body({"text":`

Something has gone wrong with the Settings chapter.
You aren't supposed to see this page!

`})
.button("Back");








// Changelog
ch_changes = new ActionFormData()
.title({"text":`§lChangelog§r`})
.body({"text":`
§l§aVersion 1.3.0 (Latest)§r

- Added 13 New Horse types!

- Added a section in Settings chapter to disable spawning of specific horses.

- Increased the chance of baby horses receiving better stats than their parents

- Fixed a bug that sometimes caused baby horses to inherit attributes from other nearby baby horses.

- Horses can now swim when ridden (instead of sinking)

- Fixed Horse head patterns being hidden when saddled.

- Made Donkey "Neutral" hostility

- Made small seahorses able to be picked up with a Water Bucket

- Horses can now follow their owner into the water.

- Cake, Diamond, and Nether Star are now consumed when used for breeding.

- Added 1 new Mane to Horses

- Added 1 new Patterns to Horses

- Added 2 new Head Pattern to Horses

- Added 2 more body color variants to Donkey

- Added an Albino Zebra variant

- Added an Albino Zonkey variant

- Added a rare Blue Eyes head variant to Unicorns and Pegasus.

- Added a rare Dark body color variant to Unicorns and Pegasus.

- Allowed Pegasus to spawn under certain conditions

- Fixed Horses not being able to have entities leashed to them.

- Fixed bug causing the Tallest and Shortest bred horses to be unable to be mounted.

- Adjusted Zebra seats' heights

- Fixed Big Seahorses having an inaccessible 10th inventory slot.

- Increased speed of Big Seahorses when in Follow mode

- Added a Breeding section in the Horse Behaviors chapter

- Reworded some texts in the guidebook

- Fixed Chest removal sound on some Horses

- Fixed Pale Moss Carpet not being equippable to Horses.

- Increased Fairy Horse's Chested Inventory Slots to 15

- Added a second layer of protection against fall damage for flyers.

- Fixed Gray Rainbow Horse's saddle color

- Fixed Light Gray Rainbow Horse's saddle color

- Made Unicorns unable to mounted when angry

- Darkened the Catalogue's text to compensate for Vibrant Visuals' brightening

- Fixed Pegasus and Fairy Horse standing-sleep animation

- Fixed an error that was making the Guidebook ignore the first time it was used in a world.

- Fixed green fairy horse not having a sparkle

- Updated Horse Replacement Setting to replace Skeleton and Zombie Horses as well

- Clarified in Horse Whistle AoE message that it only affects nearby tamed horses

- Fixed some bucking sounds

- Updated Add-On Key Art and 2 screenshots


§l§aVersion 1.0.3§r
- Fixed Xbox Incompatibility issue (hopefully)


§l§6Version 1.0.0§r
- 1,000,000 Horses! Releases!



Please send us feedback on the 1,000,000 Horses! Marketplace store page or our Discord! 
`})
.button("Back");


		
		// once all chapters are created, initialize the chapters array
		// this was originally a const array, but now that the objects must be declared after world load,
		// it seems like consts are just... not usable?
		// so compile all the chapters into one const array,
		// so that we're not exporting 40+ different variables,
		// and export it (done at chapters variable creation, at the top)
		// 0 clue if this is generally frowned-upon or not, but it works
		chapters = [
			ch_select,
			ch_general,
			ch_behaviors,
			ch_catalog,
			ch_horse,
			ch_donkey,
			ch_mule,
			ch_zebra,
			ch_zorse,
			ch_zonkey,
			ch_seahorse_big,
			ch_seahorse_small,
			ch_unicorn,
			ch_pegasus,
			ch_alicorn,
			ch_rainbow,
			ch_fairy,
			ch_kelpie,
			ch_spider,
			ch_zombie,
			ch_skeleton,
			ch_creeper,
			ch_ender,
			ch_dragon,
			ch_crimson,
			ch_warped,
			ch_ghost,
			ch_lava,
			ch_blaze,
			ch_settings,
			ch_changes
		];
	}
)









// Function for settings chapter,
// since we need to have the toggle reflect the
// world's dyn property AT THE TIME OF OPENING THE CHAPTER
// so this function will be called in guideBook.js
export function getSettingsChapter() {
	// get whether or not horses are currently being replaced
	let dynPropReplaceHorses = world.getDynamicProperty("cyn_hao:replaceHorses");
	// if the dyn prop is not initialized, do so and set it to false
	if (dynPropReplaceHorses == undefined) {
		dynPropReplaceHorses = false;
		world.setDynamicProperty("cyn_hao:replaceHorses", dynPropReplaceHorses);
		console.info("Initialized dynPropReplaceHorses as false.")
	}

	// get the world dyn props for allllll the horses
	let dynPropSpawns = [];
	
	let currDynProp;
	let currString = "";

	for(let dynPropString of disableableHorseStrings) {
		// set the current string
		currString = "cyn_hao:disable" + dynPropString + ""
		// get the current value of the dyn prop
		currDynProp = world.getDynamicProperty(currString)

		// if the current dynProp is not inited, init it
		if (currDynProp == undefined) {
			currDynProp = false
			world.setDynamicProperty(currString, currDynProp)
		}

		// add the dyn prop to the array
		dynPropSpawns.push(currDynProp)
	}



	// Settings
	// POTENTIAL IDEA: Should every horse chapter simply have their own toggle on it?
	// Instead of one mega list in the settings chapter?
	// Mmm, maybe not I guess - way more convenient to bulk-disable from a huge list than
	// enter chapter
	// toggle off
	// scroll down
	// hit back
	// PER horse you want to disable
	// I guess, arguably, it would be painful but maybe could do both.
	let form = new ModalFormData()
	.title({"text":`§lSettings§r`})
	.label('§6§lNote:§r §6You must click the Submit Button at the bottom of the page in order for changes to take effect!§r')

	.toggle("Replace Vanilla Horse Spawns", 
		{
			defaultValue: dynPropReplaceHorses,
			tooltip: {"text":`Existing Horses and Donkeys will §cnot§r be replaced, but new Vanilla Horses and Donkeys will be converted into Add-On horses when spawned`}
// LEAVE THIS UNTABBED!!! We're using a literal string, so if we tab it,
			// they get put in the book as weird characters
		})

	.divider()
	.label("§lDisabled Horses§r")
	.label("Disabling a horse will §cnot§r despawn existing ones! It will only prevent new ones from spawning.")

	// now for the tedious part, display a toggle for every horse
	.toggle("Horse",  { defaultValue: dynPropSpawns[0]})
	.toggle("Donkey",  { defaultValue: dynPropSpawns[1]})
	.toggle("Zebra",  { defaultValue: dynPropSpawns[2]})
	.toggle("Big Seahorse",  { defaultValue: dynPropSpawns[3]})
	.toggle("Small Seahorse",  { defaultValue: dynPropSpawns[4]})
	.toggle("Unicorn",  { defaultValue: dynPropSpawns[5]})
	.toggle("Rainbow Horse",  { defaultValue: dynPropSpawns[6]})
	.toggle("Kelpie",  { defaultValue: dynPropSpawns[7]})
	.toggle("Spider Horse",  { defaultValue: dynPropSpawns[8]})
	.toggle("Zombie Horse",  { defaultValue: dynPropSpawns[9]})
	.toggle("Skeleton Horse",  { defaultValue: dynPropSpawns[10]})
	.toggle("Creeper Horse",  { defaultValue: dynPropSpawns[11]})
	.toggle("Ender Horse",  { defaultValue: dynPropSpawns[12]})
	.toggle("Dragon Horse",  { defaultValue: dynPropSpawns[13]})
	.toggle("Crimson Horse",  { defaultValue: dynPropSpawns[14]})
	.toggle("Warped Horse",  { defaultValue: dynPropSpawns[15]})
	.toggle("Ghost Horse",  { defaultValue: dynPropSpawns[16]})
	.toggle("Lava Horse",  { defaultValue: dynPropSpawns[17]})
	.toggle("Blaze Horse",  { defaultValue: dynPropSpawns[18]})
	



	// finally, return the form we have created
	return form;
}