1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-20 21:34:27 +08:00
parent aeeac8b2ed
commit 922f7c3622
17 changed files with 138 additions and 38 deletions

View File

@@ -37,10 +37,6 @@ type ServerList struct {
IsVip uint32 `gorm:"default:0;not null;comment:'是否为VIP服务器'" json:"is_vip"`
//isdebug 是否本地服
IsDebug uint8 `gorm:"default:0;comment:'是否为调试模式'" json:"is_debug"`
//服务器异色概率设定ServerList
ShinyRate uint8 `gorm:"default:0;comment:'异色概率'" json:"shiny_rate"`
//服务器天气设定ServerList
WeatherRate uint8 `gorm:"default:0;comment:'天气概率'" json:"weather_rate"`
//服务器属主Desc
Owner uint32 `gorm:"comment:'服务器属主'" json:"owner"`

View File

@@ -11,23 +11,24 @@ type Items struct {
}
type Item struct {
ID int `xml:"ID,attr"` // 物品ID与items.xml一致
Name string `xml:"Name,attr"` // 物品名称
Rarity int `xml:"Rarity,attr,omitempty"` // 稀有度
ItemType int `xml:"ItemType,attr"` // 物品类型0胶囊 1体力药剂 2活力药剂
Max int `xml:"Max,attr"` // 最大堆叠数量
Price int `xml:"Price,attr"` // 价格
Bonus float64 `xml:"Bonus,attr,omitempty"` // 倍率(如捕捉胶囊的加成倍数,修正为浮点型)
Tradability int `xml:"Tradability,attr"` // 可交易性0/1
VipTradability int `xml:"VipTradability,attr"` // VIP可交易性0/1
DailyKey int `xml:"DailyKey,attr,omitempty"` // 每日限制键值
DailyOutMax int `xml:"DailyOutMax,attr,omitempty"` // 每日最大产出
Wd int `xml:"wd,attr"` // 未知属性
UseMax int `xml:"UseMax,attr"` // 最大使用次数
LifeTime int `xml:"LifeTime,attr"` // 生命周期0为永久
Purpose int `xml:"purpose,attr"` // 用途标识
Bean int `xml:"Bean,attr,omitempty"` // 豆子数量
Hide int `xml:"Hide,attr"` // 是否隐藏0/1
ID int `xml:"ID,attr"` // 物品ID与items.xml一致
Name string `xml:"Name,attr"` // 物品名称
Rarity int `xml:"Rarity,attr,omitempty"` // 稀有度
ItemType int `xml:"ItemType,attr"` // 物品类型0胶囊 1体力药剂 2活力药剂
Max int `xml:"Max,attr"` // 最大堆叠数量
Price int `xml:"Price,attr"` // 价格
Bonus float64 `xml:"Bonus,attr,omitempty"` // 倍率(如捕捉胶囊的加成倍数,修正为浮点型)
Tradability int `xml:"Tradability,attr"` // 可交易性0/1
VipTradability int `xml:"VipTradability,attr"` // VIP可交易性0/1
DailyKey int `xml:"DailyKey,attr,omitempty"` // 每日限制键值
DailyOutMax int `xml:"DailyOutMax,attr,omitempty"` // 每日最大产出
Wd int `xml:"wd,attr"` // 未知属性
UseMax int `xml:"UseMax,attr"` // 最大使用次数
LifeTime int `xml:"LifeTime,attr"` // 生命周期0为永久
Purpose int `xml:"purpose,attr"` // 用途标识
Bean int `xml:"Bean,attr,omitempty"` // 豆子数量
Hide int `xml:"Hide,attr"` // 是否隐藏0/1
Texture int `xml:"Texture,attr,omitempty"`
Sort int `xml:"Sort,attr,omitempty"` // 排序序号
Des string `xml:"des,attr,omitempty"` // 物品用途XML中无该属性保留字段供自定义
Color string `xml:"color,attr,omitempty"` // 装备名字颜色

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,7 @@
package controller
import (
"blazing/common/data/xmlres"
"blazing/common/socket/errorcode"
"blazing/common/utils"
"blazing/cool"
@@ -83,8 +84,12 @@ func (h Controller) ChangePlayerDoodle(data *user.ChangeDoodleInboundInfo, playe
}
player.Info.Coins -= changeDoodleCost
player.Info.Texture = data.Id
player.Info.Color = data.Color
info, ok := xmlres.ItemsMAP[int(data.Id)]
if !ok {
return nil, errorcode.ErrorCodes.ErrSystemBusy
}
player.Info.Texture = uint32(info.Texture)
player.Info.Color = uint32(info.Texture)
result = &user.ChangeDoodleOutboundInfo{
UserId: player.Info.UserID,

View File

@@ -75,10 +75,10 @@ func main() {
// }
// 解析命令行参数
cool.Config.GameOnlineID = gcmd.GetOpt("id", "1").Uint16()
go Start() //注入service
// if cool.Config.PortBL == 1 || cool.Config.PortBL == 2 { //只分析1服务器的
// go PprofWeb()
// }
go Start() //注入service
if cool.Config.GameOnlineID == 2 { //只分析1服务器的
go PprofWeb()
}
//go PprofWeb()
go monitorMemAndQuit()
fmt.Println("Process start, pid:", os.Getpid())

View File

@@ -99,12 +99,12 @@ func (f *FightC) UseSkill(c common.PlayerI, id uint32) {
for _, v := range f.GetInputByPlayer(c, false).CurrentPet.Skills {
if v.ID == int(id) {
ret.SkillEntity = v
f.actionChan <- ret
break
}
}
f.actionChan <- ret
}
// 玩家使用技能

View File

@@ -14,7 +14,7 @@ func init() {
// 注册路由
cool.RegisterController(&PetRewardController{
&cool.Controller{
Prefix: "/admin/game/petreward",
Prefix: "/admin/config/petreward",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewPetRewardService(),
},

View File

@@ -14,7 +14,7 @@ func init() {
// 注册路由
cool.RegisterController(&CdkController{
&cool.Controller{
Prefix: "/admin/game/cdk",
Prefix: "/admin/config/cdk",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewCdkService(),
},

View File

@@ -14,7 +14,7 @@ func init() {
// 注册路由
cool.RegisterController(&ItemController{
&cool.Controller{
Prefix: "/admin/game/item",
Prefix: "/admin/config/item",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewItemService(),
},

View File

@@ -0,0 +1,22 @@
package admin
import (
"blazing/cool"
"blazing/modules/config/service"
)
type MapController struct {
*cool.Controller
}
func init() {
// 注册路由
cool.RegisterController(&MapController{
&cool.Controller{
Prefix: "/admin/config/map",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewMapService(),
},
})
}

View File

@@ -14,7 +14,7 @@ func init() {
// 注册路由
cool.RegisterController(&ColorController{
&cool.Controller{
Prefix: "/admin/game/shiny",
Prefix: "/admin/config/shiny",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewShinyService(),
},

View File

@@ -14,7 +14,7 @@ func init() {
// 注册路由
cool.RegisterController(&ShopController{
&cool.Controller{
Prefix: "/admin/game/shop",
Prefix: "config/shop",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewShopService(),
},

View File

@@ -12,7 +12,7 @@ type TalkConfigController struct {
func init() {
var task_info_controller = &TalkConfigController{
&cool.Controller{
Prefix: "/admin/sun/talkconfig",
Prefix: "/admin/config/talkconfig",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewTalkConfigService(),
},

View File

@@ -0,0 +1,45 @@
package model
import (
"blazing/cool"
)
// 表名常量定义:地图配置表
const (
TableNameMapConfig = "config_map" // 地图配置表记录地图ID、刷野怪开关、天气开关、掉落物配置等核心信息
)
// MapConfig 地图核心配置模型(包含地图基础属性、刷怪配置、天气配置、掉落物配置)
type MapConfig struct {
*BaseConfig
// 核心字段
MapID uint32 `gorm:"not null;primaryKey;comment:'地图唯一ID主键'" json:"map_id" description:"地图ID"`
IsSpawnMonster int32 `gorm:"not null;default:0;comment:'是否开启刷怪1:开启0:关闭)'" json:"is_spawn_monster" description:"是否开启刷怪"`
//`gorm:"type:int[];comment:'副宠物IDs1,2,3'" json:"sub_pet_ids"`
WeatherType []uint32 `gorm:"type:int[];comment:'天气类型( 1-雨天2-雪天)'" json:"weather_type"`
// 掉落物配置
DropItemIds []uint32 `gorm:"type:int[];comment:'掉落物IDs" json:"drop_item_ids"`
}
// -------------------------- 核心配套方法(遵循项目规范)--------------------------
func (*MapConfig) TableName() string {
return TableNameMapConfig
}
func (*MapConfig) GroupName() string {
return "default"
}
func NewMapConfig() *MapConfig {
return &MapConfig{
BaseConfig: NewBaseConfig(),
}
}
// -------------------------- 表结构自动同步 --------------------------
func init() {
cool.CreateTable(&MapConfig{})
}

View File

@@ -0,0 +1,31 @@
package service
import (
"blazing/cool"
"blazing/modules/config/model"
)
type MapService struct {
*cool.Service
}
func NewMapService() *MapService {
return &MapService{
&cool.Service{
Model: model.NewMapConfig(),
PageQueryOp: &cool.QueryOp{
KeyWordField: []string{"remake"},
},
},
}
}
func (s *MapService) GetData(p1 uint32) (ret *model.MapConfig) {
//cacheKey := strings.Join([]string{fmt.Sprintf("%d", p1), fmt.Sprintf("%d", p2)}, ":")
m := dbm_enable(s.Model)
m.Wheref(`male_pet_ids @> ARRAY[?]::integer[]`, p1).Scan(&ret)
return
}

View File

@@ -12,7 +12,7 @@ type ItemBagController struct {
func init() {
var task_info_controller = &ItemBagController{
&cool.Controller{
Prefix: "/admin/sun/item",
Prefix: "/admin/game/item",
Api: []string{"Delete", "Update", "Info", "List", "Page"},
Service: service.NewItemService(0), //因为page已经过滤所以这里需要改成0
},

View File

@@ -15,7 +15,7 @@ type PlayerController struct {
func init() {
var task_info_controller = &PlayerController{
&cool.Controller{
Prefix: "/admin/sun/player",
Prefix: "/admin/game/player",
Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"},
Service: service.NewInfoService(0),
},