Compare commits

..

No commits in common. 'c9953b04ef0316e17e5035fe9c141cbb07a4b67b' and '76868519def4cd34895c924c676db60a420a7529' have entirely different histories.

  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. 14
      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,4 +1,5 @@
Things I'd like to do/fix: 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 - Search for "existing" in returned table text and replace with generated things
- NOTE: Faction may be easiest - NOTE: Faction may be easiest
- Replace 1d6 rolls with helper - Replace 1d6 rolls with helper
@ -7,8 +8,3 @@ Things I'd like to do/fix:
- Figure out how to distribute web/ in binaryfile - Figure out how to distribute web/ in binaryfile
- Add PORT env var/flag (super easy) - Add PORT env var/flag (super easy)
- Generate truly unique list of items (handle impossible requests, expensive computation) - 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,21 +77,9 @@ var generateSpellCmd = &cobra.Command{
Short: "Generate a spell", Short: "Generate a spell",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
t := tables.MagicTable{Roller: dice.NewRoller(flagSeed)} t := tables.MagicTable{Roller: dice.NewRoller(flagSeed)}
i := t.Spell(t.Roller.TableRoll()) i := t.Generate()
output, err := buildOutput(i, "{{.}}", flagFormat) template := t.Template()
if err != nil { output, err := buildOutput(i, template, flagFormat)
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 { if err != nil {
panic(err) panic(err)
} }
@ -127,5 +115,4 @@ func init() {
generateCmd.AddCommand(generateMonsterCmd) generateCmd.AddCommand(generateMonsterCmd)
generateCmd.AddCommand(generateNameCmd) generateCmd.AddCommand(generateNameCmd)
generateCmd.AddCommand(generateSpellCmd) generateCmd.AddCommand(generateSpellCmd)
generateCmd.AddCommand(generateNPCCmd)
} }

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

@ -53,15 +53,11 @@ 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.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc=
github.com/go-openapi/jsonreference v0.19.3 h1:5cxNfTy0UVC3X8JL5ymxzyoUZmo8iZb+jeTWn7tUa8o= 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.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.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI=
github.com/go-openapi/spec v0.19.4 h1:ixzUSnHTd6hCemgtAJgluaTSGYpLNpJY4mA2DIkdOAo= 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.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 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.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.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.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY=
@ -90,8 +86,6 @@ 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 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 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/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.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/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= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
@ -110,8 +104,6 @@ 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.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 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8=
github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= 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.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.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@ -250,16 +242,6 @@ 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-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 h1:F3OmlXCzYtG9YE6tXDnUOlJBzVzHF8EcmZ1yTJlcgIk=
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= 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-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-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=

@ -9,12 +9,7 @@ import (
func LoadHandlers(r *mux.Router) { func LoadHandlers(r *mux.Router) {
r.HandleFunc("/api/generate/name", GenName) r.HandleFunc("/api/generate/name", GenName)
r.HandleFunc("/api/generate/spell", GenSpell) 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/generate/monster", GenMonster)
r.HandleFunc("/api/monster/{seed}", Monster) r.HandleFunc("/api/monster/{seed}", Monster)
@ -22,17 +17,9 @@ func LoadHandlers(r *mux.Router) {
r.HandleFunc("/api/generate/character", GenCharacter) r.HandleFunc("/api/generate/character", GenCharacter)
r.HandleFunc("/api/character/{seed}", Character) 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/generate/city", GenCity)
r.HandleFunc("/api/city/{seed}", City) r.HandleFunc("/api/city/{seed}", City)
r.HandleFunc("/api/generate/dungeon", GenDungeon)
r.HandleFunc("/api/dungeon/{seed}", Dungeon)
r.HandleFunc("/api/roll/{xdy}", Roll) r.HandleFunc("/api/roll/{xdy}", Roll)
} }

@ -1,68 +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())}
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, "{{.}}")
}

@ -1,41 +0,0 @@
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())
}

@ -1,41 +0,0 @@
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())
}

@ -0,0 +1,19 @@
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())
}

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

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

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

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

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

@ -4,7 +4,6 @@ import (
"mazeratsgen/internal/data" "mazeratsgen/internal/data"
"mazeratsgen/internal/dice" "mazeratsgen/internal/dice"
"mazeratsgen/internal/helpers" "mazeratsgen/internal/helpers"
"strings"
) )
type NPCTable struct { type NPCTable struct {
@ -33,30 +32,31 @@ type NPC struct {
Misfortunes []string Misfortunes []string
Missions []string Missions []string
Methods []string Methods []string
Seed int64
} }
func (t *NPCTable) Generate() NPC { func GenNPC(seed int64) NPC {
roller := dice.NewRoller(seed)
npcTable := NPCTable{Roller: roller}
var occupation, class, gender string var occupation, class, gender string
occupationRoll, _ := t.Roller.Roll("1d3") occupationRoll, _ := roller.Roll("1d3")
switch occupationRoll[0] { switch occupationRoll[0] {
case 1: case 1:
occupation = t.CivilizedNPC(t.Roller.TableRoll()) occupation = npcTable.CivilizedNPC(roller.TableRoll())
case 2: case 2:
occupation = t.UnderworldNPC(t.Roller.TableRoll()) occupation = npcTable.UnderworldNPC(roller.TableRoll())
case 3: case 3:
occupation = t.WildernessNPC(t.Roller.TableRoll()) occupation = npcTable.WildernessNPC(roller.TableRoll())
} }
classRoll, _ := t.Roller.Roll("1d2") classRoll, _ := roller.Roll("1d2")
if classRoll[0] == 1 { if classRoll[0] == 1 {
class = "Upperclass" class = "Upperclass"
} else { } else {
class = "Lowerclass" class = "Lowerclass"
} }
genderRoll, _ := t.Roller.Roll("1d2") genderRoll, _ := roller.Roll("1d2")
if genderRoll[0] == 1 { if genderRoll[0] == 1 {
gender = "Male" gender = "Male"
} else { } else {
@ -64,105 +64,59 @@ func (t *NPCTable) Generate() NPC {
} }
return NPC{ return NPC{
Name: GenName(class, gender, t.Roller.Seed).FullName, Name: GenName(class, gender, seed).FullName,
Gender: gender,
Occupation: occupation, Occupation: occupation,
Class: class, Class: class,
Appearance: t.Appearance(t.Roller.TableRoll()), Gender: gender,
PhysicalDetail: t.PhysicalDetail(t.Roller.TableRoll()), Appearance: npcTable.Appearance(roller.TableRoll()),
Clothing: t.Clothing(t.Roller.TableRoll()), PhysicalDetail: npcTable.PhysicalDetail(roller.TableRoll()),
Personality: t.Personality(t.Roller.TableRoll()), Clothing: npcTable.Clothing(roller.TableRoll()),
Mannerism: t.Mannerism(t.Roller.TableRoll()), Personality: npcTable.Personality(roller.TableRoll()),
Secret: t.Secret(t.Roller.TableRoll()), Mannerism: npcTable.Mannerism(roller.TableRoll()),
Reputation: t.Reputation(t.Roller.TableRoll()), Secret: npcTable.Secret(roller.TableRoll()),
Relationship: t.Relationship(t.Roller.TableRoll()), Reputation: npcTable.Reputation(roller.TableRoll()),
Hobby: t.Hobby(t.Roller.TableRoll()), Relationship: npcTable.Relationship(roller.TableRoll()),
DivineDomain: t.DivineDomain(t.Roller.TableRoll()), Hobby: npcTable.Hobby(roller.TableRoll()),
AfterTheParty: t.AfterTheParty(t.Roller.TableRoll()), DivineDomain: npcTable.DivineDomain(roller.TableRoll()),
Assets: helpers.GenUniqueItems(3, t.Asset, t.Roller.Seed), AfterTheParty: npcTable.AfterTheParty(roller.TableRoll()),
Liabilities: helpers.GenUniqueItems(3, t.Liability, t.Roller.Seed), Assets: helpers.GenUniqueItems(3, npcTable.Asset, seed),
Goals: helpers.GenUniqueItems(3, t.NPCGoal, t.Roller.Seed), Liabilities: helpers.GenUniqueItems(3, npcTable.Liability, seed),
Misfortunes: helpers.GenUniqueItems(3, t.Misfortune, t.Roller.Seed), Goals: helpers.GenUniqueItems(3, npcTable.NPCGoal, seed),
Missions: helpers.GenUniqueItems(3, t.Mission, t.Roller.Seed), Misfortunes: helpers.GenUniqueItems(3, npcTable.Misfortune, seed),
Methods: helpers.GenUniqueItems(3, t.Method, t.Roller.Seed), Missions: helpers.GenUniqueItems(3, npcTable.Mission, seed),
Seed: t.Roller.Seed, Methods: helpers.GenUniqueItems(3, npcTable.Method, seed),
} }
} }
func (t *NPCTable) Template() string { func (t NPCTable) CivilizedNPC(tableRole [2]int) 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] 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] 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] 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] 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] 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] 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] 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 { switch tableRole {
case [2]int{2, 3}: case [2]int{2, 3}:
return "Leader of existing faction" return "Leader of existing faction"
@ -173,7 +127,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 { switch tableRole {
case [2]int{3, 1}: case [2]int{3, 1}:
return MagicTable{Roller: t.Roller}.Insanity(t.Roller.TableRoll()) return MagicTable{Roller: t.Roller}.Insanity(t.Roller.TableRoll())
@ -182,7 +136,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} treasureTable := TreasureTable{Roller: t.Roller}
switch tableRole { switch tableRole {
case [2]int{1, 3}: case [2]int{1, 3}:
@ -218,39 +172,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] 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] 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] 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] 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] 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] 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] 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] 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 { switch tableRole {
case [2]int{4, 5}: case [2]int{4, 5}:
return t.Misfortune(t.Roller.TableRoll()) return t.Misfortune(t.Roller.TableRoll())
@ -261,19 +215,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] 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] 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] 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 { switch tableRole {
case [2]int{1, 1}: case [2]int{1, 1}:
roll, _ := t.Roller.Roll("1d6") roll, _ := t.Roller.Roll("1d6")
@ -288,7 +242,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 { switch tableRole {
case [2]int{3, 3}: case [2]int{3, 3}:
return "Insulted an existing faction" return "Insulted an existing faction"

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

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

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

@ -83,50 +83,6 @@ 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": { "/api/generate/character": {
"get": { "get": {
"produces": [ "produces": [
@ -167,41 +123,6 @@ 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": { "/api/generate/monster": {
"get": { "get": {
"produces": [ "produces": [
@ -222,21 +143,6 @@ var doc = `{
} }
} }
}, },
"/api/generate/mutation": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"magic"
],
"summary": "Generate a mutation",
"responses": {
"200": {}
}
}
},
"/api/generate/name": { "/api/generate/name": {
"get": { "get": {
"produces": [ "produces": [
@ -252,41 +158,6 @@ 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": { "/api/generate/spell": {
"get": { "get": {
"produces": [ "produces": [
@ -331,35 +202,6 @@ 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}": { "/api/roll/{xdy}": {
"get": { "get": {
"produces": [ "produces": [
@ -538,65 +380,6 @@ 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": { "tables.Monster": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -669,92 +452,6 @@ var doc = `{
"$ref": "#/definitions/tables.MonsterStat" "$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,50 +65,6 @@
} }
} }
}, },
"/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": { "/api/generate/character": {
"get": { "get": {
"produces": [ "produces": [
@ -149,41 +105,6 @@
} }
} }
}, },
"/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": { "/api/generate/monster": {
"get": { "get": {
"produces": [ "produces": [
@ -204,21 +125,6 @@
} }
} }
}, },
"/api/generate/mutation": {
"get": {
"produces": [
"application/json",
" text/plain"
],
"tags": [
"magic"
],
"summary": "Generate a mutation",
"responses": {
"200": {}
}
}
},
"/api/generate/name": { "/api/generate/name": {
"get": { "get": {
"produces": [ "produces": [
@ -234,41 +140,6 @@
} }
} }
}, },
"/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": { "/api/generate/spell": {
"get": { "get": {
"produces": [ "produces": [
@ -313,35 +184,6 @@
} }
} }
}, },
"/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}": { "/api/roll/{xdy}": {
"get": { "get": {
"produces": [ "produces": [
@ -520,65 +362,6 @@
} }
} }
}, },
"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": { "tables.Monster": {
"type": "object", "type": "object",
"properties": { "properties": {
@ -651,92 +434,6 @@
"$ref": "#/definitions/tables.MonsterStat" "$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,45 +100,6 @@ definitions:
type: type:
type: string type: string
type: object 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: tables.Monster:
properties: properties:
ability: ability:
@ -189,63 +150,6 @@ definitions:
$ref: '#/definitions/tables.MonsterStat' $ref: '#/definitions/tables.MonsterStat'
type: object type: object
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: info:
contact: {} contact: {}
license: {} license: {}
@ -289,35 +193,6 @@ paths:
summary: Generate a specific city using a seed summary: Generate a specific city using a seed
tags: tags:
- city - 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: /api/generate/character:
get: get:
produces: produces:
@ -344,29 +219,6 @@ paths:
summary: Generate a city summary: Generate a city
tags: tags:
- city - 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: /api/generate/monster:
get: get:
produces: produces:
@ -380,16 +232,6 @@ paths:
summary: Generate a monster summary: Generate a monster
tags: tags:
- monster - monster
/api/generate/mutation:
get:
produces:
- application/json
- ' text/plain'
responses:
"200": {}
summary: Generate a mutation
tags:
- magic
/api/generate/name: /api/generate/name:
get: get:
produces: produces:
@ -400,29 +242,6 @@ paths:
summary: Generate a character name summary: Generate a character name
tags: tags:
- character - 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: /api/generate/spell:
get: get:
produces: produces:
@ -452,25 +271,6 @@ paths:
summary: Generate a specific monster using a seed summary: Generate a specific monster using a seed
tags: tags:
- monster - 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}: /api/roll/{xdy}:
get: get:
parameters: parameters:

Loading…
Cancel
Save