You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.2 KiB
116 lines
3.2 KiB
package main
|
|
|
|
import (
|
|
"math/rand"
|
|
"mazeratsgen/internal/helpers"
|
|
"mazeratsgen/internal/tables"
|
|
"os"
|
|
"text/template"
|
|
"time"
|
|
)
|
|
|
|
type MagicInfo struct {
|
|
Mutations []string
|
|
Insanities []string
|
|
Catastrophes []string
|
|
}
|
|
|
|
type TreasuresInfo struct {
|
|
MiscItems []string
|
|
WornItems []string
|
|
Weapons []string
|
|
Books []string
|
|
Tools []string
|
|
MagicalIngredients []string
|
|
Treasures []string
|
|
Potions []tables.Potion
|
|
ValuableMaterials []string
|
|
}
|
|
|
|
type Variables struct {
|
|
Characters []tables.Character
|
|
Cities []tables.City
|
|
MagicInfo MagicInfo
|
|
Monsters []tables.Monster
|
|
NPCs []tables.NPC
|
|
Wilds []tables.Wild
|
|
Dungeons []tables.Maze
|
|
Treasures TreasuresInfo
|
|
}
|
|
|
|
func main() {
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
var potions []tables.Potion
|
|
for i := 0; i < 10; i++ {
|
|
potions = append(potions, tables.GenPotion())
|
|
}
|
|
|
|
treasuresInfo := TreasuresInfo{
|
|
MiscItems: helpers.GenUniqueItems(10, tables.TreasureTable{}.GenMiscItem),
|
|
WornItems: helpers.GenUniqueItems(10, tables.TreasureTable{}.GenWornItem),
|
|
Weapons: helpers.GenUniqueItems(10, tables.TreasureTable{}.GenWeaponItem),
|
|
Books: helpers.GenUniqueItems(10, tables.TreasureTable{}.GenBookSubject),
|
|
Tools: helpers.GenUniqueItems(10, tables.TreasureTable{}.GenToolItem),
|
|
ValuableMaterials: helpers.GenUniqueItems(10, tables.TreasureTable{}.GenValuableMaterial),
|
|
MagicalIngredients: helpers.GenUniqueItems(10, tables.TreasureTable{}.GenMagicalIngredient),
|
|
Treasures: helpers.GenUniqueItems(10, tables.GenTreasure),
|
|
Potions: potions,
|
|
}
|
|
|
|
chars := []tables.Character{}
|
|
chars = append(chars, tables.GenCharacter("Upper Class", "Male"))
|
|
|
|
cities := []tables.City{}
|
|
cities = append(cities, tables.GenCity())
|
|
|
|
magicInfo := MagicInfo{
|
|
Mutations: helpers.GenUniqueItems(10, tables.MagicTable{}.GenMutation),
|
|
Insanities: helpers.GenUniqueItems(10, tables.MagicTable{}.GenInsanity),
|
|
Catastrophes: helpers.GenUniqueItems(10, tables.MagicTable{}.GenCatastrophe),
|
|
}
|
|
|
|
monsters := []tables.Monster{}
|
|
monsters = append(monsters, tables.GenMonster())
|
|
monsters = append(monsters, tables.GenMonster())
|
|
monsters = append(monsters, tables.GenMonster())
|
|
|
|
// Civilized, Underworld, Wilderness
|
|
npcs := []tables.NPC{}
|
|
npcs = append(npcs, tables.GenNPC())
|
|
npcs = append(npcs, tables.GenNPC())
|
|
npcs = append(npcs, tables.GenNPC())
|
|
npcs = append(npcs, tables.GenNPC())
|
|
npcs = append(npcs, tables.GenNPC())
|
|
npcs = append(npcs, tables.GenNPC())
|
|
|
|
wilds := []tables.Wild{}
|
|
wilds = append(wilds, tables.GenWild())
|
|
wilds = append(wilds, tables.GenWild())
|
|
wilds = append(wilds, tables.GenWild())
|
|
|
|
dungeons := []tables.Maze{}
|
|
dungeons = append(dungeons, tables.GenMaze())
|
|
dungeons = append(dungeons, tables.GenMaze())
|
|
dungeons = append(dungeons, tables.GenMaze())
|
|
|
|
variables := Variables{
|
|
Characters: chars,
|
|
Cities: cities,
|
|
MagicInfo: magicInfo,
|
|
Monsters: monsters,
|
|
NPCs: npcs,
|
|
Wilds: wilds,
|
|
Dungeons: dungeons,
|
|
Treasures: treasuresInfo,
|
|
}
|
|
|
|
tmpl, err := template.ParseFiles(helpers.LocalFile("game.html"))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
err = tmpl.Execute(os.Stdout, variables)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|