Files
rpgzrox/back_end/globais.go
2025-07-11 10:08:28 -03:00

73 lines
2.8 KiB
Go

package main
import (
"context"
"database/sql"
"github.com/go-redis/redis/v8"
)
type Table struct {
Name string
}
type plyInv struct {
ID int `json:"id"`
ItemName string `json:"itemname"`
ItemQuantidade int `json:"itemquantidade"`
ItemPeso int `json:"itempeso"`
}
type plyPwr struct {
ID int `json:"id"`
Name string `json:"name"`
Desc string `json:"desc"`
}
type logEntry struct {
ID int `json:"id"`
Log string `json:"log"`
}
type resp_json struct {
Status string `json:"Status"`
Message string `json:"Message,omitempty"`
PlayerID *int64 `json:"PlayerID,omitempty"`
Logs []logEntry `json:"Logs,omitempty"`
InvPeso int `json:"invPeso,omitempty"`
InvItems []plyInv `json:"InvItems,omitempty"`
InvPws []plyPwr `json:"InvPws,omitempty"`
Foto string `json:"Foto,omitempty"`
PlayerName string `json:"PlayerName,omitempty"`
Conhecimento *int64 `json:"Conhecimento,omitempty"`
Level *int64 `json:"Level,omitempty"`
Idade *int64 `json:"Idade,omitempty"`
Altura *float64 `json:"Altura,omitempty"`
Vida string `json:"Vida,omitempty"`
VidaPorcentagem *float64 `json:"VidaPorcentagem,omitempty"`
Destresa *int64 `json:"Destresa,omitempty"`
Inteligencia *int64 `json:"Inteligencia,omitempty"`
Força *int64 `json:"Força,omitempty"`
Constituição *int64 `json:"Constituição,omitempty"`
Cárisma *int64 `json:"Cárisma,omitempty"`
Inventario *int64 `json:"Inventario,omitempty"`
Descrição string `json:"Descrição,omitempty"`
}
var (
db *sql.DB
redisCL *redis.Client
ctx = context.Background()
table_list = map[string]string{
"players": "CREATE TABLE players (`id` INT NOT NULL AUTO_INCREMENT,`foto` LONGTEXT NOT NULL,`player` VARCHAR(15) NOT NULL,`password` TEXT NOT NULL,`nome` VARCHAR(30) NOT NULL, `conhecimento` INT NOT NULL DEFAULT '0',`level` INT NOT NULL DEFAULT '0',`idade` INT NOT NULL DEFAULT '18',`altura` FLOAT NOT NULL DEFAULT '1.40',`vida` INT NOT NULL DEFAULT '10',`vida_maxima` INT NOT NULL DEFAULT '10',`destresa` INT NOT NULL DEFAULT '0',`inteligencia` INT NOT NULL DEFAULT '0',`força` INT NOT NULL DEFAULT '0',`constituição` INT NOT NULL DEFAULT '0',`cárisma` INT NOT NULL DEFAULT '0',`inventario` INT NOT NULL DEFAULT '10',`descrição` TEXT NOT NULL,PRIMARY KEY (`id`)) ENGINE = InnoDB;",
"roll_logs": "CREATE TABLE roll_logs (`id` INT NOT NULL AUTO_INCREMENT , `log` TEXT NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB;",
}
formatFILES = map[string]bool{
".png": true,
".jpg": true,
".jpeg": true,
".gif": true,
}
cookieName string = "_Session_"
load_data map[string]interface{}
)