feat(middleware): 添加WebSocket服务端处理器 添加了WebSocket服务端处理器,支持WebSocket连接的升级和处理, 包括授权验证功能的实现 fix(fight): 修复NPC战斗逻辑中的问题 移除了NPC回合结束时的调试输出,优化了NPC技能选择逻辑, 确保只选择可使用的技能,并添加了NPC动作执行
57 lines
1.9 KiB
Go
57 lines
1.9 KiB
Go
package model
|
|
|
|
import (
|
|
"blazing/cool"
|
|
)
|
|
|
|
const TableNameServerList = "server_list"
|
|
|
|
// 服务器设置天气地图|地图是否显示其他人,设置异色概率|ip
|
|
// ServerList mapped from table <server_list>
|
|
type ServerList struct {
|
|
*cool.Model
|
|
OnlineID uint16 `gorm:"column:online_id;comment:'在线ID';uniqueIndex" json:"online_id"`
|
|
IP string `gorm:"type:string;comment:'服务器IP'" json:"ip"`
|
|
Port uint16 `gorm:"comment:'端口号,通常是小整数'" json:"port"`
|
|
IsOpen uint8 `gorm:"default:0;not null;comment:'是否开启'" json:"is_open"`
|
|
//登录地址
|
|
LoginAddr string `gorm:"type:string;comment:'登录地址'" json:"login_addr"`
|
|
//账号
|
|
Account string `gorm:"type:string;comment:'账号'" json:"account"`
|
|
//密码
|
|
Password string `gorm:"type:string;comment:'密码'" json:"password"`
|
|
CanPort []uint32 `gorm:"type:jsonb;comment:'可连接端口'" json:"can_port"`
|
|
IsVip uint32 `gorm:"default:0;not null;comment:'是否为VIP服务器'" json:"is_vip"`
|
|
//服务器异色概率设定ServerList
|
|
ShinyRate uint8 `gorm:"default:0;comment:'异色概率'" json:"shiny_rate"`
|
|
//服务器天气设定ServerList
|
|
WeatherRate uint8 `gorm:"default:0;comment:'天气概率'" json:"weather_rate"`
|
|
//服务器名称Desc
|
|
Name string `gorm:"comment:'服务器名称'" json:"name"`
|
|
//服务器属主Desc
|
|
Owner uint32 `gorm:"comment:'服务器属主'" json:"owner"`
|
|
Desc string `gorm:"comment:'服务器描述'" json:"desc"`
|
|
}
|
|
|
|
// TableName ServerList's table name
|
|
func (*ServerList) TableName() string {
|
|
return TableNameServerList
|
|
}
|
|
|
|
// GroupName ServerList's table group
|
|
func (*ServerList) GroupName() string {
|
|
return "default"
|
|
}
|
|
|
|
// NewServerList create a new ServerList
|
|
func NewServerList() *ServerList {
|
|
return &ServerList{
|
|
Model: cool.NewModel(),
|
|
}
|
|
}
|
|
|
|
// init 创建表
|
|
func init() {
|
|
cool.CreateTable(&ServerList{})
|
|
}
|