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, "{{.}}") }