Compare commits

...

5 Commits

  1. 6
      TODO.md
  2. 19
      cmd/generate.go
  3. 6
      go.mod
  4. 18
      go.sum
  5. 13
      internal/handlers/handlers.go
  6. 68
      internal/handlers/magic.go
  7. 41
      internal/handlers/maze.go
  8. 41
      internal/handlers/npc.go
  9. 19
      internal/handlers/spell.go
  10. 19
      internal/handlers/treasure.go
  11. 20
      internal/helpers/helpers.go
  12. 2
      internal/tables/character.go
  13. 35
      internal/tables/city.go
  14. 11
      internal/tables/magic.go
  15. 76
      internal/tables/maze.go
  16. 150
      internal/tables/npc.go
  17. 2
      internal/tables/tables.go
  18. 40
      internal/tables/treasure.go
  19. 15
      internal/tables/wild.go
  20. 303
      web/swagger/docs.go
  21. 303
      web/swagger/swagger.json
  22. 200
      web/swagger/swagger.yaml

@ -1,5 +1,4 @@
Things I'd like to do/fix:
- `go get -u github.com/swaggo/swag/cmd/swag` in Docker
- Search for "existing" in returned table text and replace with generated things
- NOTE: Faction may be easiest
- Replace 1d6 rolls with helper
@ -8,3 +7,8 @@ Things I'd like to do/fix:
- Figure out how to distribute web/ in binaryfile
- Add PORT env var/flag (super easy)
- Generate truly unique list of items (handle impossible requests, expensive computation)
- Pointer on MazeTable?
- Support rooms variable on City/Maze
Simple fixes:
- Fix EXTERNAL in activities from https://mazerats.jerryaldrichiii.com/api/dungeon/1596344718521570230

@ -77,9 +77,21 @@ var generateSpellCmd = &cobra.Command{
Short: "Generate a spell",
Run: func(cmd *cobra.Command, args []string) {
t := tables.MagicTable{Roller: dice.NewRoller(flagSeed)}
i := t.Generate()
template := t.Template()
output, err := buildOutput(i, template, flagFormat)
i := t.Spell(t.Roller.TableRoll())
output, err := buildOutput(i, "{{.}}", flagFormat)
if err != nil {
panic(err)
}
fmt.Printf(output)
},
}
var generateNPCCmd = &cobra.Command{
Use: "npc",
Short: "Generate an NPC",
Run: func(cmd *cobra.Command, args []string) {
t := tables.NPCTable{Roller: dice.NewRoller(flagSeed)}
output, err := buildOutput(t.Generate(), t.Template(), flagFormat)
if err != nil {
panic(err)
}
@ -115,4 +127,5 @@ func init() {
generateCmd.AddCommand(generateMonsterCmd)
generateCmd.AddCommand(generateNameCmd)
generateCmd.AddCommand(generateSpellCmd)
generateCmd.AddCommand(generateNPCCmd)
}

@ -5,17 +5,17 @@ go 1.14
require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect
github.com/go-openapi/spec v0.19.8 // indirect
github.com/go-openapi/spec v0.19.9 // indirect
github.com/go-openapi/swag v0.19.9 // indirect
github.com/gorilla/mux v1.7.4
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mailru/easyjson v0.7.2 // indirect
github.com/spf13/cobra v1.0.0
github.com/swaggo/swag v1.6.7
github.com/throttled/throttled v2.2.4+incompatible
github.com/urfave/cli/v2 v2.2.0 // indirect
golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
golang.org/x/text v0.3.3 // indirect
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d // indirect
golang.org/x/tools v0.0.0-20200727233628-55644ead90ce // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)

@ -53,11 +53,15 @@ github.com/go-openapi/jsonreference v0.19.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3Hfo
github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o=
github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
github.com/go-openapi/jsonreference v0.19.4 h1:3Vw+rh13uq2JFNxgnMTGE1rnoieU9FmyE1gvnyylsYg=
github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=
github.com/go-openapi/spec v0.19.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
github.com/go-openapi/spec v0.19.4 h1:ixzUSnHTd6hCemgtAJgluaTSGYpLNpJY4mA2DIkdOAo=
github.com/go-openapi/spec v0.19.4/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo=
github.com/go-openapi/spec v0.19.8 h1:qAdZLh1r6QF/hI/gTq+TJTvsQUodZsM7KLqkAJdiJNg=
github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk=
github.com/go-openapi/spec v0.19.9 h1:9z9cbFuZJ7AcvOHKIY+f6Aevb4vObNDkTEyoMfO7rAc=
github.com/go-openapi/spec v0.19.9/go.mod h1:vqK/dIdLGCosfvYsQV3WfC7N3TiZSnGY2RZKoFK7X28=
github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg=
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY=
@ -86,6 +90,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
@ -104,6 +110,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8=
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
github.com/mailru/easyjson v0.7.2 h1:V9ecaZWDYm7v9uJ15RZD6DajMu5sE0hdep0aoDwT9g4=
github.com/mailru/easyjson v0.7.2/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@ -242,6 +250,16 @@ golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f h1:JcoF/bowzCDI+MXu1yLqQGN
golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d h1:F3OmlXCzYtG9YE6tXDnUOlJBzVzHF8EcmZ1yTJlcgIk=
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200714190737-9048b464a08d h1:hYhnolbefSSt3WZp66sgmgnEOFv5PD6a5PIcnKJ8jdU=
golang.org/x/tools v0.0.0-20200714190737-9048b464a08d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200715235423-130c9f19d3fe h1:q+DqTBqwpg3C8p5kTZ0WSLOmLxH57dKhWAieWmuFv7M=
golang.org/x/tools v0.0.0-20200715235423-130c9f19d3fe/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6 h1:nULzSsKgihxFGLnQFv2T7lE5vIhOtg8ZPpJHapEt7o0=
golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305 h1:yaM5S0KcY0lIoZo7Fl+oi91b/DdlU2zuWpfHrpWbCS0=
golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200727233628-55644ead90ce h1:HEwYEPqqa3/M0N2Q6IgtBaf2CaxvmRiVdAhX6LR7uE4=
golang.org/x/tools v0.0.0-20200727233628-55644ead90ce/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=

@ -9,7 +9,12 @@ import (
func LoadHandlers(r *mux.Router) {
r.HandleFunc("/api/generate/name", GenName)
r.HandleFunc("/api/generate/spell", GenSpell)
r.HandleFunc("/api/generate/potion", GenPotion)
r.HandleFunc("/api/generate/mutation", GenMutation)
r.HandleFunc("/api/generate/insanity", GenInsanity)
r.HandleFunc("/api/generate/catastrophe", GenCatastrophe)
r.HandleFunc("/api/generate/monster", GenMonster)
r.HandleFunc("/api/monster/{seed}", Monster)
@ -17,9 +22,17 @@ func LoadHandlers(r *mux.Router) {
r.HandleFunc("/api/generate/character", GenCharacter)
r.HandleFunc("/api/character/{seed}", Character)
r.HandleFunc("/api/generate/npc", GenNPC)
r.HandleFunc("/api/npc/{seed}", NPC)
r.HandleFunc("/api/generate/character", GenCharacter)
r.HandleFunc("/api/generate/city", GenCity)
r.HandleFunc("/api/city/{seed}", City)
r.HandleFunc("/api/generate/dungeon", GenDungeon)
r.HandleFunc("/api/dungeon/{seed}", Dungeon)
r.HandleFunc("/api/roll/{xdy}", Roll)
}

@ -0,0 +1,68 @@
package handlers
import (
"mazeratsgen/internal/dice"
"mazeratsgen/internal/tables"
"net/http"
"time"
)
// @Summary Generate a spell
// @Tags magic
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/spell [get]
// @Success 200
func GenSpell(w http.ResponseWriter, r *http.Request) {
t := tables.MagicTable{Roller: dice.NewRoller(time.Now().UnixNano())}
s := t.Spell(t.Roller.TableRoll())
WriteResponse(w, r, s, "{{.}}")
}
// @Summary Generate a mutation
// @Tags magic
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/mutation [get]
// @Success 200
func GenMutation(w http.ResponseWriter, r *http.Request) {
t := tables.MagicTable{Roller: dice.NewRoller(time.Now().UnixNano())}
m := t.Mutation(t.Roller.TableRoll())
WriteResponse(w, r, m, "{{.}}")
}
// @Summary Generate a insanity
// @Tags magic
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/insanity [get]
// @Success 200
func GenInsanity(w http.ResponseWriter, r *http.Request) {
t := tables.MagicTable{Roller: dice.NewRoller(time.Now().UnixNano())}
i := t.Insanity(t.Roller.TableRoll())
WriteResponse(w, r, i, "{{.}}")
}
// @Summary Generate a catastrophe
// @Tags magic
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/catastrophe [get]
// @Success 200
func GenCatastrophe(w http.ResponseWriter, r *http.Request) {
t := tables.MagicTable{Roller: dice.NewRoller(time.Now().UnixNano())}
c := t.Catastrophe(t.Roller.TableRoll())
WriteResponse(w, r, c, "{{.}}")
}
// @Summary Generate a catastrophe
// @Tags magic
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/catastrophe [get]
// @Success 200
func GenCatastophe(w http.ResponseWriter, r *http.Request) {
t := tables.MagicTable{Roller: dice.NewRoller(time.Now().UnixNano())}
c := t.Catastrophe(t.Roller.TableRoll())
WriteResponse(w, r, c, "{{.}}")
}

@ -0,0 +1,41 @@
package handlers
import (
"fmt"
"github.com/gorilla/mux"
"mazeratsgen/internal/dice"
"mazeratsgen/internal/tables"
"net/http"
"strconv"
"time"
)
// @Summary Generate a dungeon
// @Tags dungeon
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/dungeon [get]
// @Success 200 {object} tables.Maze
func GenDungeon(w http.ResponseWriter, r *http.Request) {
t := tables.MazeTable{Roller: dice.NewRoller((time.Now().UnixNano()))}
WriteResponse(w, r, t.Generate(), t.Template())
}
// @Summary Generate a specific dungeon using a seed
// @Tags dungeon
// @Produce application/json, text/plain
// @Method GET
// @Router /api/dungeon/{seed} [get]
// @Param seed path int64 true "Int64"
// @Success 200 {object} tables.Maze
func Dungeon(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
seed, err := strconv.ParseInt(vars["seed"], 10, 64)
if err != nil {
w.Write([]byte(fmt.Sprintf("Unable to parse '%v' as Int64", vars["seed"])))
return
}
t := tables.MazeTable{Roller: dice.NewRoller(seed)}
WriteResponse(w, r, t.Generate(), t.Template())
}

@ -0,0 +1,41 @@
package handlers
import (
"fmt"
"github.com/gorilla/mux"
"mazeratsgen/internal/dice"
"mazeratsgen/internal/tables"
"net/http"
"strconv"
"time"
)
// @Summary Generate an NPC
// @Tags NPC
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/npc [get]
// @Success 200 {object} tables.NPC
func GenNPC(w http.ResponseWriter, r *http.Request) {
t := tables.NPCTable{Roller: dice.NewRoller(time.Now().UnixNano())}
WriteResponse(w, r, t.Generate(), t.Template())
}
// @Summary Generate a specific NPC using a seed
// @Tags NPC
// @Produce application/json, text/plain
// @Method GET
// @Router /api/npc/{seed} [get]
// @Param seed path int64 true "Int64"
// @Success 200 {object} tables.NPC
func NPC(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
seed, err := strconv.ParseInt(vars["seed"], 10, 64)
if err != nil {
w.Write([]byte(fmt.Sprintf("Unable to parse '%v' as Int64", vars["seed"])))
return
}
t := tables.NPCTable{Roller: dice.NewRoller(seed)}
WriteResponse(w, r, t.Generate(), t.Template())
}

@ -1,19 +0,0 @@
package handlers
import (
"mazeratsgen/internal/dice"
"mazeratsgen/internal/tables"
"net/http"
"time"
)
// @Summary Generate a spell
// @Tags magic
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/spell [get]
// @Success 200
func GenSpell(w http.ResponseWriter, r *http.Request) {
t := tables.MagicTable{Roller: dice.NewRoller(time.Now().UnixNano())}
WriteResponse(w, r, t.Generate(), t.Template())
}

@ -0,0 +1,19 @@
package handlers
import (
"mazeratsgen/internal/dice"
"mazeratsgen/internal/tables"
"net/http"
"time"
)
// @Summary Generate a potion
// @Tags treasure
// @Produce application/json, text/plain
// @Method GET
// @Router /api/generate/potion [get]
// @Success 200
func GenPotion(w http.ResponseWriter, r *http.Request) {
t := tables.TreasureTable{Roller: dice.NewRoller(time.Now().UnixNano())}
WriteResponse(w, r, t.GenPotion(), t.PotionTemplate())
}

@ -18,18 +18,24 @@ func GenUniqueItems(total int, fn genFunc, seed int64) []string {
items := []string{}
// Generate initial items
for i := 0; i <= total; i++ {
for i := 0; i < total; i++ {
items = append(items, fn(roller.TableRoll()))
}
// Walk items and check if they match any other item. If they do then replace
// it with a fresh item. This doesn't guarantee unique items, but prevents
// Denial of Service attacks (a bit)
for i, item := range items {
for x := 0; x < len(items); x++ {
if items[x] == item {
items[i] = fn(roller.TableRoll())
break
// Denial of Service attacks (a bit) by only doing 5 passes.
passes := 5
for p := 0; p <= passes; p++ {
for i, _ := range items {
for x := 0; x < len(items); x++ {
if x == i {
break
}
if items[x] == items[i] {
items[i] = fn(roller.TableRoll())
break
}
}
}
}

@ -86,7 +86,7 @@ func (t *CharacterTable) Generate() Character {
}
}
func (t CharacterTable) Template() string {
func (t *CharacterTable) Template() string {
return strings.TrimSpace(`
Name: {{.Name}}
Feature: {{.Feature}}

@ -38,7 +38,7 @@ type City struct {
func (t *CityTable) Generate() City {
upperClassBuildings := []Building{}
// Future Jerry...the weird for loops here are to add noise to seed
// Future Jerry...the weird `for` loops here are to add noise to the seed.
// This will break if more than 6 rooms are needed
for i := 0; i < 3; i++ {
@ -129,7 +129,8 @@ func (t *CityTable) CityTheme(roll [2]int) string {
case [2]int{2, 5}:
return t.DistrictTheme(t.Roller.TableRoll())
case [2]int{2, 6}:
return NPCTable{Roller: t.Roller}.DivineDomain(t.Roller.TableRoll())
npcTable := NPCTable{Roller: t.Roller}
return npcTable.DivineDomain(t.Roller.TableRoll())
case [2]int{3, 1}:
return t.GenFaction(t.Roller.TableRoll()).Type
case [2]int{3, 5}:
@ -147,7 +148,7 @@ func (t *CityTable) CityTheme(roll [2]int) string {
func (t *CityTable) CityEvent(roll [2]int) string {
switch roll {
case [2]int{1, 4}:
case [2]int{2, 4}:
return t.GenFaction(t.Roller.TableRoll()).Type
default:
return data.Tables.City.CityEvents[roll[0]-1][roll[1]-1]
@ -172,14 +173,14 @@ func (t *CityTable) DistrictTheme(roll [2]int) string {
}
}
func (t CityTable) GenBuilding(roll int) Building {
func (t *CityTable) GenBuilding(roll int) Building {
if roll <= 3 {
return t.LowerClassBuilding(t.Roller.TableRoll())
}
return t.UpperClassBuilding(t.Roller.TableRoll())
}
func (t CityTable) UpperClassBuilding(roll [2]int) Building {
func (t *CityTable) UpperClassBuilding(roll [2]int) Building {
return Building{
Type: data.Tables.City.UpperClassBuildings[roll[0]-1][roll[1]-1],
TacticalFeature: t.TacticalBuildingFeature(t.Roller.TableRoll()),
@ -187,7 +188,7 @@ func (t CityTable) UpperClassBuilding(roll [2]int) Building {
}
}
func (t CityTable) LowerClassBuilding(roll [2]int) Building {
func (t *CityTable) LowerClassBuilding(roll [2]int) Building {
return Building{
Type: data.Tables.City.LowerClassBuildings[roll[0]-1][roll[1]-1],
TacticalFeature: t.TacticalBuildingFeature(t.Roller.TableRoll()),
@ -195,7 +196,7 @@ func (t CityTable) LowerClassBuilding(roll [2]int) Building {
}
}
func (t CityTable) BuildingRoom(roll [2]int) string {
func (t *CityTable) BuildingRoom(roll [2]int) string {
switch roll {
case [2]int{3, 1}:
return MazeTable{Roller: t.Roller}.DungeonRoom(t.Roller.TableRoll())
@ -204,7 +205,7 @@ func (t CityTable) BuildingRoom(roll [2]int) string {
}
}
func (t CityTable) TacticalStreetFeature(roll [2]int) string {
func (t *CityTable) TacticalStreetFeature(roll [2]int) string {
mazeTable := MazeTable{Roller: t.Roller}
switch roll {
case [2]int{2, 3}:
@ -218,26 +219,27 @@ func (t CityTable) TacticalStreetFeature(roll [2]int) string {
}
}
func (t CityTable) TacticalBuildingFeature(roll [2]int) string {
func (t *CityTable) TacticalBuildingFeature(roll [2]int) string {
switch roll {
case [2]int{1, 1}:
roll, _ := t.Roller.Roll("1d6")
return MonsterTable{Roller: t.Roller}.Base(roll[0]) + "Nests"
return MonsterTable{Roller: t.Roller}.Base(roll[0]) + " Nests"
default:
return data.Tables.City.TacticalBuildingFeatures[roll[0]-1][roll[1]-1]
}
}
func (t CityTable) FactionTrait(roll [2]int) string {
func (t *CityTable) FactionTrait(roll [2]int) string {
switch roll {
case [2]int{4, 4}:
return NPCTable{Roller: t.Roller}.Personality(t.Roller.TableRoll())
npcTable := NPCTable{Roller: t.Roller}
return npcTable.Personality(t.Roller.TableRoll())
default:
return data.Tables.City.FactionTraits[roll[0]-1][roll[1]-1]
}
}
func (t CityTable) GenFaction(roll [2]int) Faction {
func (t *CityTable) GenFaction(roll [2]int) Faction {
return Faction{
Type: data.Tables.City.Factions[roll[0]-1][roll[1]-1],
Trait: t.FactionTrait(t.Roller.TableRoll()),
@ -245,7 +247,7 @@ func (t CityTable) GenFaction(roll [2]int) Faction {
}
}
func (t CityTable) FactionGoal(roll [2]int) string {
func (t *CityTable) FactionGoal(roll [2]int) string {
switch roll {
case [2]int{1, 6}:
return "Control " + t.GenFaction(t.Roller.TableRoll()).Type
@ -260,12 +262,13 @@ func (t CityTable) FactionGoal(roll [2]int) string {
}
}
func (t CityTable) CityActivity(roll [2]int) string {
func (t *CityTable) CityActivity(roll [2]int) string {
switch roll {
case [2]int{2, 5}:
return MazeTable{Roller: t.Roller}.DungeonActivity(t.Roller.TableRoll())
case [2]int{4, 2}:
return NPCTable{Roller: t.Roller}.Mission(t.Roller.TableRoll())
npcTable := NPCTable{Roller: t.Roller}
return npcTable.Mission(t.Roller.TableRoll())
case [2]int{6, 6}:
return WildTable{Roller: t.Roller}.WildernessActivity(t.Roller.TableRoll())
default:

@ -9,14 +9,6 @@ type MagicTable struct {
Roller *dice.Roller
}
func (t MagicTable) Generate() interface{} {
return t.Spell(t.Roller.TableRoll())
}
func (t MagicTable) Template() string {
return "{{ . }}"
}
func (t MagicTable) Spell(roll [2]int) string {
switch roll[0] {
case 1:
@ -134,7 +126,8 @@ func (t MagicTable) Insanity(roll [2]int) string {
case [2]int{6, 2}:
return monTable.Trait(t.Roller.TableRoll())
case [2]int{6, 4}:
return NPCTable{Roller: t.Roller}.Personality(t.Roller.TableRoll())
npcTable := NPCTable{Roller: t.Roller}
return npcTable.Personality(t.Roller.TableRoll())
default:
return data.Tables.Magic.Insanities[roll[0]-1][roll[1]-1]
}

@ -4,6 +4,7 @@ import (
"mazeratsgen/internal/data"
"mazeratsgen/internal/dice"
"mazeratsgen/internal/helpers"
"strings"
)
type MazeTable struct {
@ -22,43 +23,74 @@ type Maze struct {
Ruination string
Reward string
Activities []string
Rooms []Room
Rooms []string
Tricks []string
Hazards []string
TrapEffects []string
TrapTriggers []string
Seed int64
}
func GenMaze(seed int64) Maze {
roller := dice.NewRoller(seed)
mazeTable := MazeTable{Roller: roller}
func (t MazeTable) Generate() Maze {
total_rooms := 5
roomTypes := helpers.GenUniqueItems(total_rooms, mazeTable.DungeonRoom, seed)
roomDetails := helpers.GenUniqueItems(total_rooms, mazeTable.DungeonRoomDetail, seed)
rooms := []Room{}
roomTypes := helpers.GenUniqueItems(total_rooms, t.DungeonRoom, t.Roller.Seed)
roomDetails := helpers.GenUniqueItems(total_rooms, t.DungeonRoomDetail, t.Roller.Seed)
rooms := []string{}
for i := 0; i < total_rooms; i++ {
room := Room{
Type: roomTypes[i],
Detail: roomDetails[i],
}
room := roomTypes[i] + " with " + strings.ToLower(roomDetails[i])
rooms = append(rooms, room)
}
return Maze{
Form: mazeTable.DungeonForm(roller.TableRoll()),
Entrance: mazeTable.DungeonEntrance(roller.TableRoll()),
Layout: mazeTable.DungeonLayout(roller.TableRoll()),
Ruination: mazeTable.DungeonRuination(roller.TableRoll()),
Reward: mazeTable.DungeonReward(roller.TableRoll()),
Activities: helpers.GenUniqueItems(5, mazeTable.DungeonActivity, seed),
Form: t.DungeonForm(t.Roller.TableRoll()),
Entrance: t.DungeonEntrance(t.Roller.TableRoll()),
Layout: t.DungeonLayout(t.Roller.TableRoll()),
Ruination: t.DungeonRuination(t.Roller.TableRoll()),
Reward: t.DungeonReward(t.Roller.TableRoll()),
Activities: helpers.GenUniqueItems(5, t.DungeonActivity, t.Roller.Seed),
Rooms: rooms,
Hazards: helpers.GenUniqueItems(5, mazeTable.DungeonHazard, seed),
Tricks: helpers.GenUniqueItems(5, mazeTable.DungeonTrick, seed),
TrapEffects: helpers.GenUniqueItems(5, mazeTable.TrapEffect, seed),
TrapTriggers: helpers.GenUniqueItems(5, mazeTable.TrapTrigger, seed),
Hazards: helpers.GenUniqueItems(5, t.DungeonHazard, t.Roller.Seed),
Tricks: helpers.GenUniqueItems(5, t.DungeonTrick, t.Roller.Seed),
TrapEffects: helpers.GenUniqueItems(5, t.TrapEffect, t.Roller.Seed),
TrapTriggers: helpers.GenUniqueItems(5, t.TrapTrigger, t.Roller.Seed),
Seed: t.Roller.Seed,
}
}
func (t MazeTable) Template() string {
return strings.TrimSpace(`
Form: {{.Form}}
Entrance: {{.Entrance}}
Layout: {{.Layout}}
Ruination: {{.Ruination}}
Reward: {{.Reward}}
Activities:
{{- range $activity := .Activities}}
{{$activity}}
{{- end}}
Rooms:
{{- range $room := .Rooms}}
{{$room}}
{{- end}}
Tricks:
{{- range $trick := .Tricks}}
{{$trick}}
{{- end}}
Hazards:
{{- range $hazard := .Hazards}}
{{$hazard}}
{{- end}}
Trap Effects:
{{- range $trapEffect := .TrapEffects}}
{{$trapEffect}}
{{- end}}
Trap Triggers:
{{- range $trapTrigger := .TrapTriggers}}
{{$trapTrigger}}
{{- end}}
Seed: {{.Seed}}
`)
}
func (t MazeTable) DungeonEntrance(roll [2]int) string {
roll[0], roll[1] = roll[0]-1, roll[0]-1
return data.Tables.Maze.DungeonEntrances[roll[0]][roll[1]]

@ -4,6 +4,7 @@ import (
"mazeratsgen/internal/data"
"mazeratsgen/internal/dice"
"mazeratsgen/internal/helpers"
"strings"
)
type NPCTable struct {
@ -32,31 +33,30 @@ type NPC struct {
Misfortunes []string
Missions []string
Methods []string
Seed int64
}
func GenNPC(seed int64) NPC {
roller := dice.NewRoller(seed)
npcTable := NPCTable{Roller: roller}
func (t *NPCTable) Generate() NPC {
var occupation, class, gender string
occupationRoll, _ := roller.Roll("1d3")
occupationRoll, _ := t.Roller.Roll("1d3")
switch occupationRoll[0] {
case 1:
occupation = npcTable.CivilizedNPC(roller.TableRoll())
occupation = t.CivilizedNPC(t.Roller.TableRoll())
case 2:
occupation = npcTable.UnderworldNPC(roller.TableRoll())
occupation = t.UnderworldNPC(t.Roller.TableRoll())
case 3:
occupation = npcTable.WildernessNPC(roller.TableRoll())
occupation = t.WildernessNPC(t.Roller.TableRoll())
}
classRoll, _ := roller.Roll("1d2")
classRoll, _ := t.Roller.Roll("1d2")
if classRoll[0] == 1 {
class = "Upperclass"
} else {
class = "Lowerclass"
}
genderRoll, _ := roller.Roll("1d2")
genderRoll, _ := t.Roller.Roll("1d2")
if genderRoll[0] == 1 {
gender = "Male"
} else {
@ -64,59 +64,105 @@ func GenNPC(seed int64) NPC {
}
return NPC{
Name: GenName(class, gender, seed).FullName,
Name: GenName(class, gender, t.Roller.Seed).FullName,
Gender: gender,
Occupation: occupation,
Class: class,
Gender: gender,
Appearance: npcTable.Appearance(roller.TableRoll()),
PhysicalDetail: npcTable.PhysicalDetail(roller.TableRoll()),
Clothing: npcTable.Clothing(roller.TableRoll()),
Personality: npcTable.Personality(roller.TableRoll()),
Mannerism: npcTable.Mannerism(roller.TableRoll()),
Secret: npcTable.Secret(roller.TableRoll()),
Reputation: npcTable.Reputation(roller.TableRoll()),
Relationship: npcTable.Relationship(roller.TableRoll()),
Hobby: npcTable.Hobby(roller.TableRoll()),
DivineDomain: npcTable.DivineDomain(roller.TableRoll()),
AfterTheParty: npcTable.AfterTheParty(roller.TableRoll()),
Assets: helpers.GenUniqueItems(3, npcTable.Asset, seed),
Liabilities: helpers.GenUniqueItems(3, npcTable.Liability, seed),
Goals: helpers.GenUniqueItems(3, npcTable.NPCGoal, seed),
Misfortunes: helpers.GenUniqueItems(3, npcTable.Misfortune, seed),
Missions: helpers.GenUniqueItems(3, npcTable.Mission, seed),
Methods: helpers.GenUniqueItems(3, npcTable.Method, seed),
Appearance: t.Appearance(t.Roller.TableRoll()),
PhysicalDetail: t.PhysicalDetail(t.Roller.TableRoll()),
Clothing: t.Clothing(t.Roller.TableRoll()),
Personality: t.Personality(t.Roller.TableRoll()),
Mannerism: t.Mannerism(t.Roller.TableRoll()),
Secret: t.Secret(t.Roller.TableRoll()),
Reputation: t.Reputation(t.Roller.TableRoll()),
Relationship: t.Relationship(t.Roller.TableRoll()),
Hobby: t.Hobby(t.Roller.TableRoll()),
DivineDomain: t.DivineDomain(t.Roller.TableRoll()),
AfterTheParty: t.AfterTheParty(t.Roller.TableRoll()),
Assets: helpers.GenUniqueItems(3, t.Asset, t.Roller.Seed),
Liabilities: helpers.GenUniqueItems(3, t.Liability, t.Roller.Seed),
Goals: helpers.GenUniqueItems(3, t.NPCGoal, t.Roller.Seed),
Misfortunes: helpers.GenUniqueItems(3, t.Misfortune, t.Roller.Seed),
Missions: helpers.GenUniqueItems(3, t.Mission, t.Roller.Seed),
Methods: helpers.GenUniqueItems(3, t.Method, t.Roller.Seed),
Seed: t.Roller.Seed,
}
}
func (t NPCTable) CivilizedNPC(tableRole [2]int) string {
func (t *NPCTable) Template() string {
return strings.TrimSpace(`
Name: {{.Name}}
Gender: {{.Gender}}
Class: {{.Class}}
Occupation: {{.Occupation}}
Appearance: {{.Appearance}}
Physical Detail: {{.PhysicalDetail}}
Clothing: {{.Clothing}}
Personality: {{.Personality}}
Mannerism: {{.Mannerism}}
Secret: {{.Secret}}
Reputation: {{.Reputation}}
Relationship: {{.Relationship}}
Hobby: {{.Hobby}}
Divine Domain: {{.DivineDomain}}
After The Party: {{.AfterTheParty}}
Assets:
{{- range $asset := .Assets }}
{{$asset}}
{{- end}}
Liabilities:
{{- range $liability := .Liabilities }}
{{$liability}}
{{- end}}
Goal:
{{- range $goal := .Goals }}
{{$goal}}
{{- end}}
Misfortunes:
{{- range $misfortune := .Misfortunes }}
{{$misfortune}}
{{- end}}
Missions:
{{- range $mission := .Missions }}
{{$mission}}
{{- end}}
Methods:
{{- range $method := .Methods }}
{{$method}}
{{- end}}
Seed: {{.Seed}}
`)
}
func (t *NPCTable) CivilizedNPC(tableRole [2]int) string {
return data.Tables.NPC.CivilizedNPCs[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) UnderworldNPC(tableRole [2]int) string {
func (t *NPCTable) UnderworldNPC(tableRole [2]int) string {
return data.Tables.NPC.UnderworldNPCs[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) WildernessNPC(tableRole [2]int) string {
func (t *NPCTable) WildernessNPC(tableRole [2]int) string {
return data.Tables.NPC.WildernessNPCs[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) FemaleName(tableRole [2]int) string {
func (t *NPCTable) FemaleName(tableRole [2]int) string {
return data.Tables.NPC.FemaleNames[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) MaleName(tableRole [2]int) string {
func (t *NPCTable) MaleName(tableRole [2]int) string {
return data.Tables.NPC.MaleNames[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) UpperClassSurname(tableRole [2]int) string {
func (t *NPCTable) UpperClassSurname(tableRole [2]int) string {
return data.Tables.NPC.UpperClassSurnames[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) LowerClassSurname(tableRole [2]int) string {
func (t *NPCTable) LowerClassSurname(tableRole [2]int) string {
return data.Tables.NPC.LowerClassSurnames[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Asset(tableRole [2]int) string {
func (t *NPCTable) Asset(tableRole [2]int) string {
switch tableRole {
case [2]int{2, 3}:
return "Leader of existing faction"
@ -127,7 +173,7 @@ func (t NPCTable) Asset(tableRole [2]int) string {
}
}
func (t NPCTable) Liability(tableRole [2]int) string {
func (t *NPCTable) Liability(tableRole [2]int) string {
switch tableRole {
case [2]int{3, 1}:
return MagicTable{Roller: t.Roller}.Insanity(t.Roller.TableRoll())
@ -136,7 +182,7 @@ func (t NPCTable) Liability(tableRole [2]int) string {
}
}
func (t NPCTable) NPCGoal(tableRole [2]int) string {
func (t *NPCTable) NPCGoal(tableRole [2]int) string {
treasureTable := TreasureTable{Roller: t.Roller}
switch tableRole {
case [2]int{1, 3}:
@ -172,39 +218,39 @@ func (t NPCTable) NPCGoal(tableRole [2]int) string {
}
}
func (t NPCTable) Misfortune(tableRole [2]int) string {
func (t *NPCTable) Misfortune(tableRole [2]int) string {
return data.Tables.NPC.Misfortunes[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Mission(tableRole [2]int) string {
func (t *NPCTable) Mission(tableRole [2]int) string {
return data.Tables.NPC.Missions[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Method(tableRole [2]int) string {
func (t *NPCTable) Method(tableRole [2]int) string {
return data.Tables.NPC.Methods[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Appearance(tableRole [2]int) string {
func (t *NPCTable) Appearance(tableRole [2]int) string {
return data.Tables.NPC.Appearances[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) PhysicalDetail(tableRole [2]int) string {
func (t *NPCTable) PhysicalDetail(tableRole [2]int) string {
return data.Tables.NPC.PhysicalDetails[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Clothing(tableRole [2]int) string {
func (t *NPCTable) Clothing(tableRole [2]int) string {
return data.Tables.NPC.Clothing[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Personality(tableRole [2]int) string {
func (t *NPCTable) Personality(tableRole [2]int) string {
return data.Tables.NPC.Personalities[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Mannerism(tableRole [2]int) string {
func (t *NPCTable) Mannerism(tableRole [2]int) string {
return data.Tables.NPC.Mannerisms[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Secret(tableRole [2]int) string {
func (t *NPCTable) Secret(tableRole [2]int) string {
switch tableRole {
case [2]int{4, 5}:
return t.Misfortune(t.Roller.TableRoll())
@ -215,19 +261,19 @@ func (t NPCTable) Secret(tableRole [2]int) string {
}
}
func (t NPCTable) Reputation(tableRole [2]int) string {
func (t *NPCTable) Reputation(tableRole [2]int) string {
return data.Tables.NPC.Reputations[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Hobby(tableRole [2]int) string {
func (t *NPCTable) Hobby(tableRole [2]int) string {
return data.Tables.NPC.Hobbies[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) Relationship(tableRole [2]int) string {
func (t *NPCTable) Relationship(tableRole [2]int) string {
return data.Tables.NPC.Relationships[tableRole[0]-1][tableRole[1]-1]
}
func (t NPCTable) DivineDomain(tableRole [2]int) string {
func (t *NPCTable) DivineDomain(tableRole [2]int) string {
switch tableRole {
case [2]int{1, 1}:
roll, _ := t.Roller.Roll("1d6")
@ -242,7 +288,7 @@ func (t NPCTable) DivineDomain(tableRole [2]int) string {
}
}
func (t NPCTable) AfterTheParty(tableRole [2]int) string {
func (t *NPCTable) AfterTheParty(tableRole [2]int) string {
switch tableRole {
case [2]int{3, 3}:
return "Insulted an existing faction"

@ -7,8 +7,6 @@ import (
"text/template"
)
// TODO: Add GenRandomName
type Name struct {
FirstName string
LastName string

@ -4,6 +4,7 @@ import (
"mazeratsgen/internal/data"
"mazeratsgen/internal/dice"
"mazeratsgen/internal/helpers"
"strings"
)
type TreasureTable struct {
@ -16,32 +17,41 @@ type Potion struct {
OnFailure string
}
func GenTreasure(seed int64) string {
roller := dice.NewRoller(seed)
treasureTable := TreasureTable{Roller: roller}
trait := treasureTable.TreasureTrait(roller.TableRoll())
item := treasureTable.TreasureItem(roller.TableRoll())
func (t *TreasureTable) GenTreasure() string {
treasureTable := TreasureTable{Roller: t.Roller}
trait := treasureTable.TreasureTrait(t.Roller.TableRoll())
item := treasureTable.TreasureItem(t.Roller.TableRoll())
return trait + " " + item
}
func GenPotion(seed int64) Potion {
roller := dice.NewRoller(seed)
magicTable := MagicTable{Roller: roller}
treasureTable := TreasureTable{Roller: roller}
func (t *TreasureTable) PotionTemplate() string {
return strings.TrimSpace(`
Effect: {{.Effect}}
Ingredients:
{{- range $ingredient := .Ingredients}}
{{$ingredient}}
{{- end}}
Failure: {{.OnFailure}}
`)
}
func (t *TreasureTable) GenPotion() Potion {
magicTable := MagicTable{Roller: t.Roller}
treasureTable := TreasureTable{Roller: t.Roller}
var onFailure string
onFailRoll, _ := roller.Roll("1d2")
onFailRoll, _ := t.Roller.Roll("1d2")
if onFailRoll[0] == 1 {
onFailure = magicTable.Mutation(roller.TableRoll())
onFailure = magicTable.Mutation(t.Roller.TableRoll())
} else {
onFailure = magicTable.Insanity(roller.TableRoll())
onFailure = magicTable.Insanity(t.Roller.TableRoll())
}
ingredientRoll, _ := roller.Roll("1d3")
ingredientRoll, _ := t.Roller.Roll("1d3")
return Potion{
Effect: treasureTable.PotionBase(roller.TableRoll()),
Effect: treasureTable.PotionBase(t.Roller.TableRoll()),
OnFailure: onFailure,
Ingredients: helpers.GenUniqueItems(ingredientRoll[0], treasureTable.MagicalIngredient, seed),
Ingredients: helpers.GenUniqueItems(ingredientRoll[0], treasureTable.MagicalIngredient, t.Roller.Seed),
}
}

@ -101,9 +101,11 @@ func (t WildTable) WildernessRegionTrait(roll [2]int) string {
func (t WildTable) WildernessDiscovery(roll [2]int) string {
switch roll {
case [2]int{1, 5}:
return CityTable{Roller: t.Roller}.CityActivity(t.Roller.TableRoll())
t := CityTable{Roller: t.Roller}
return t.CityActivity(t.Roller.TableRoll())
case [2]int{1, 6}:
return NPCTable{Roller: t.Roller}.CivilizedNPC(t.Roller.TableRoll())
npcTable := NPCTable{Roller: t.Roller}
return npcTable.CivilizedNPC(t.Roller.TableRoll())
case [2]int{2, 3}:
return MazeTable{Roller: t.Roller}.DungeonActivity(t.Roller.TableRoll())
case [2]int{3, 1}:
@ -115,7 +117,8 @@ func (t WildTable) WildernessDiscovery(roll [2]int) string {
case [2]int{5, 1}:
return "Lost an existing NPC"
case [2]int{6, 1}:
return NPCTable{Roller: t.Roller}.UnderworldNPC(t.Roller.TableRoll())
npcTable := NPCTable{Roller: t.Roller}
return npcTable.UnderworldNPC(t.Roller.TableRoll())
case [2]int{6, 2}:
return WildTable{Roller: t.Roller}.WildernessActivity(t.Roller.TableRoll())
case [2]int{6, 3}:
@ -123,7 +126,8 @@ func (t WildTable) WildernessDiscovery(roll [2]int) string {
case [2]int{6, 4}:
return WildTable{Roller: t.Roller}.WildernessStructure(t.Roller.TableRoll())
case [2]int{6, 5}:
return NPCTable{Roller: t.Roller}.WildernessNPC(t.Roller.TableRoll())
npcTable := NPCTable{Roller: t.Roller}
return npcTable.WildernessNPC(t.Roller.TableRoll())
default:
return data.Tables.Wild.WildernessDiscoveries[roll[0]-1][roll[1]-1]
}
@ -132,7 +136,8 @@ func (t WildTable) WildernessDiscovery(roll [2]int) string {
func (t WildTable) WildernessActivity(roll [2]int) string {
switch roll {
case [2]int{2, 1}:
return CityTable{Roller: t.Roller}.CityActivity(t.Roller.TableRoll())
t := CityTable{Roller: t.Roller}
return t.CityActivity(t.Roller.TableRoll())
case [2]int{2, 6}:
return MazeTable{Roller: t.Roller}.DungeonActivity(t.Roller.TableRoll())
default:

@ -83,6 +83,50 @@ var doc = `{
}
}
},
"/api/dungeon/{seed}": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"dungeon"
],
"summary": "Generate a specific dungeon using a seed",
"parameters": [
{
"type": "integer",
"description": "Int64",
"name": "seed",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/tables.Maze"
}
}
}
}
},
"/api/generate/catastrophe": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"magic"
],
"summary": "Generate a catastrophe",
"responses": {
"200": {}
}
}
},
"/api/generate/character": {
"get": {
"produces": [
@ -123,6 +167,41 @@ var doc = `{
}
}
},
"/api/generate/dungeon": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"dungeon"
],
"summary": "Generate a dungeon",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/tables.Maze"
}
}
}
}
},
"/api/generate/insanity": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"magic"
],
"summary": "Generate a insanity",
"responses": {
"200": {}
}
}
},
"/api/generate/monster": {
"get": {
"produces": [
@ -143,6 +222,21 @@ var doc = `{
}
}
},
"/api/generate/mutation": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"magic"
],
"summary": "Generate a mutation",
"responses": {
"200": {}
}
}
},
"/api/generate/name": {
"get": {
"produces": [
@ -158,6 +252,41 @@ var doc = `{
}
}
},
"/api/generate/npc": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"NPC"
],
"summary": "Generate an NPC",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/tables.NPC"
}
}
}
}
},
"/api/generate/potion": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"treasure"
],
"summary": "Generate a potion",
"responses": {
"200": {}
}
}
},
"/api/generate/spell": {
"get": {
"produces": [
@ -202,6 +331,35 @@ var doc = `{
}
}
},
"/api/npc/{seed}": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"NPC"
],
"summary": "Generate a specific NPC using a seed",
"parameters": [
{
"type": "integer",
"description": "Int64",
"name": "seed",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/tables.NPC"
}
}
}
}
},
"/api/roll/{xdy}": {
"get": {
"produces": [
@ -380,6 +538,65 @@ var doc = `{
}
}
},
"tables.Maze": {
"type": "object",
"properties": {
"activities": {
"type": "array",
"items": {
"type": "string"
}
},
"entrance": {
"type": "string"
},
"form": {
"type": "string"
},
"hazards": {
"type": "array",
"items": {
"type": "string"
}
},
"layout": {
"type": "string"
},
"reward": {
"type": "string"
},
"rooms": {
"type": "array",
"items": {
"type": "string"
}
},
"ruination": {
"type": "string"
},
"seed": {
"type": "integer"
},
"trapEffects": {
"type": "array",
"items": {
"type": "string"
}
},
"trapTriggers": {
"type": "array",
"items": {
"type": "string"
}
},
"tricks": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"tables.Monster": {
"type": "object",
"properties": {
@ -452,6 +669,92 @@ var doc = `{
"$ref": "#/definitions/tables.MonsterStat"
}
}
},
"tables.NPC": {
"type": "object",
"properties": {
"afterTheParty": {
"type": "string"
},
"appearance": {
"type": "string"
},
"assets": {
"type": "array",
"items": {
"type": "string"
}
},
"class": {
"type": "string"
},
"clothing": {
"type": "string"
},
"divineDomain": {
"type": "string"
},
"gender": {
"type": "string"
},
"goals": {
"type": "array",
"items": {
"type": "string"
}
},
"hobby": {
"type": "string"
},
"liabilities": {
"type": "array",
"items": {
"type": "string"
}
},
"mannerism": {
"type": "string"
},
"methods": {
"type": "array",
"items": {
"type": "string"
}
},
"misfortunes": {
"type": "array",
"items": {
"type": "string"
}
},
"missions": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"occupation": {
"type": "string"
},
"personality": {
"type": "string"
},
"physicalDetail": {
"type": "string"
},
"relationship": {
"type": "string"
},
"reputation": {
"type": "string"
},
"secret": {
"type": "string"
}
}
}
}
}`

@ -65,6 +65,50 @@
}
}
},
"/api/dungeon/{seed}": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"dungeon"
],
"summary": "Generate a specific dungeon using a seed",
"parameters": [
{
"type": "integer",
"description": "Int64",
"name": "seed",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/tables.Maze"
}
}
}
}
},
"/api/generate/catastrophe": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"magic"
],
"summary": "Generate a catastrophe",
"responses": {
"200": {}
}
}
},
"/api/generate/character": {
"get": {
"produces": [
@ -105,6 +149,41 @@
}
}
},
"/api/generate/dungeon": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"dungeon"
],
"summary": "Generate a dungeon",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/tables.Maze"
}
}
}
}
},
"/api/generate/insanity": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"magic"
],
"summary": "Generate a insanity",
"responses": {
"200": {}
}
}
},
"/api/generate/monster": {
"get": {
"produces": [
@ -125,6 +204,21 @@
}
}
},
"/api/generate/mutation": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"magic"
],
"summary": "Generate a mutation",
"responses": {
"200": {}
}
}
},
"/api/generate/name": {
"get": {
"produces": [
@ -140,6 +234,41 @@
}
}
},
"/api/generate/npc": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"NPC"
],
"summary": "Generate an NPC",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/tables.NPC"
}
}
}
}
},
"/api/generate/potion": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"treasure"
],
"summary": "Generate a potion",
"responses": {
"200": {}
}
}
},
"/api/generate/spell": {
"get": {
"produces": [
@ -184,6 +313,35 @@
}
}
},
"/api/npc/{seed}": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"NPC"
],
"summary": "Generate a specific NPC using a seed",
"parameters": [
{
"type": "integer",
"description": "Int64",
"name": "seed",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/tables.NPC"
}
}
}
}
},
"/api/roll/{xdy}": {
"get": {
"produces": [
@ -362,6 +520,65 @@
}
}
},
"tables.Maze": {
"type": "object",
"properties": {
"activities": {
"type": "array",
"items": {
"type": "string"
}
},
"entrance": {
"type": "string"
},
"form": {
"type": "string"
},
"hazards": {
"type": "array",
"items": {
"type": "string"
}
},
"layout": {
"type": "string"
},
"reward": {
"type": "string"
},
"rooms": {
"type": "array",
"items": {
"type": "string"
}
},
"ruination": {
"type": "string"
},
"seed": {
"type": "integer"
},
"trapEffects": {
"type": "array",
"items": {
"type": "string"
}
},
"trapTriggers": {
"type": "array",
"items": {
"type": "string"
}
},
"tricks": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"tables.Monster": {
"type": "object",
"properties": {
@ -434,6 +651,92 @@
"$ref": "#/definitions/tables.MonsterStat"
}
}
},
"tables.NPC": {
"type": "object",
"properties": {
"afterTheParty": {
"type": "string"
},
"appearance": {
"type": "string"
},
"assets": {
"type": "array",
"items": {
"type": "string"
}
},
"class": {
"type": "string"
},
"clothing": {
"type": "string"
},
"divineDomain": {
"type": "string"
},
"gender": {
"type": "string"
},
"goals": {
"type": "array",
"items": {
"type": "string"
}
},
"hobby": {
"type": "string"
},
"liabilities": {
"type": "array",
"items": {
"type": "string"
}
},
"mannerism": {
"type": "string"
},
"methods": {
"type": "array",
"items": {
"type": "string"
}
},
"misfortunes": {
"type": "array",
"items": {
"type": "string"
}
},
"missions": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
},
"occupation": {
"type": "string"
},
"personality": {
"type": "string"
},
"physicalDetail": {
"type": "string"
},
"relationship": {
"type": "string"
},
"reputation": {
"type": "string"
},
"secret": {
"type": "string"
}
}
}
}
}

@ -100,6 +100,45 @@ definitions:
type:
type: string
type: object
tables.Maze:
properties:
activities:
items:
type: string
type: array
entrance:
type: string
form:
type: string
hazards:
items:
type: string
type: array
layout:
type: string
reward:
type: string
rooms:
items:
type: string
type: array
ruination:
type: string
seed:
type: integer
trapEffects:
items:
type: string
type: array
trapTriggers:
items:
type: string
type: array
tricks:
items:
type: string
type: array
type: object
tables.Monster:
properties:
ability:
@ -150,6 +189,63 @@ definitions:
$ref: '#/definitions/tables.MonsterStat'
type: object
type: object
tables.NPC:
properties:
afterTheParty:
type: string
appearance:
type: string
assets:
items:
type: string
type: array
class:
type: string
clothing:
type: string
divineDomain:
type: string
gender:
type: string
goals:
items:
type: string
type: array
hobby:
type: string
liabilities:
items:
type: string
type: array
mannerism:
type: string
methods:
items:
type: string
type: array
misfortunes:
items:
type: string
type: array
missions:
items:
type: string
type: array
name:
type: string
occupation:
type: string
personality:
type: string
physicalDetail:
type: string
relationship:
type: string
reputation:
type: string
secret:
type: string
type: object
info:
contact: {}
license: {}
@ -193,6 +289,35 @@ paths:
summary: Generate a specific city using a seed
tags:
- city
/api/dungeon/{seed}:
get:
parameters:
- description: Int64
in: path
name: seed
required: true
type: integer
produces:
- application/json
- ' text/plain'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/tables.Maze'
summary: Generate a specific dungeon using a seed
tags:
- dungeon
/api/generate/catastrophe:
get:
produces:
- application/json
- ' text/plain'
responses:
"200": {}
summary: Generate a catastrophe
tags:
- magic
/api/generate/character:
get:
produces:
@ -219,6 +344,29 @@ paths:
summary: Generate a city
tags:
- city
/api/generate/dungeon:
get:
produces:
- application/json
- ' text/plain'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/tables.Maze'
summary: Generate a dungeon
tags:
- dungeon
/api/generate/insanity:
get:
produces:
- application/json
- ' text/plain'
responses:
"200": {}
summary: Generate a insanity
tags:
- magic
/api/generate/monster:
get:
produces:
@ -232,6 +380,16 @@ paths:
summary: Generate a monster
tags:
- monster
/api/generate/mutation:
get:
produces:
- application/json
- ' text/plain'
responses:
"200": {}
summary: Generate a mutation
tags:
- magic
/api/generate/name:
get:
produces:
@ -242,6 +400,29 @@ paths:
summary: Generate a character name
tags:
- character
/api/generate/npc:
get:
produces:
- application/json
- ' text/plain'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/tables.NPC'
summary: Generate an NPC
tags:
- NPC
/api/generate/potion:
get:
produces:
- application/json
- ' text/plain'
responses:
"200": {}
summary: Generate a potion
tags:
- treasure
/api/generate/spell:
get:
produces:
@ -271,6 +452,25 @@ paths:
summary: Generate a specific monster using a seed
tags:
- monster
/api/npc/{seed}:
get:
parameters:
- description: Int64
in: path
name: seed
required: true
type: integer
produces:
- application/json
- ' text/plain'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/tables.NPC'
summary: Generate a specific NPC using a seed
tags:
- NPC
/api/roll/{xdy}:
get:
parameters:

Loading…
Cancel
Save