feat(go): 升级 Go 版本至 1.20

统一将所有模块的 Go 版本从 1.18 或 1.19 升级到 1.20,以使用最新的语言特性和性能改进。

feat(service): 新增乱斗服务默认宠物生成逻辑

在 fight 模块中调用新的 MELEEService.Def() 方法来生成初始对战宠物,
并根据配置
This commit is contained in:
2025-12-15 14:26:24 +08:00
parent 78bb2bd148
commit 937f97fe83
19 changed files with 79 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
module blazing/contrib/drivers/mysql
go 1.18
go 1.20
require (
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.6.3

View File

@@ -1,6 +1,6 @@
module blazing/contrib/drivers/pgsql
go 1.18
go 1.20
require (
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.8.0

View File

@@ -1,6 +1,6 @@
module blazing/contrib/files/local
go 1.18
go 1.20
require github.com/gogf/gf/v2 v2.8.0

View File

@@ -1,6 +1,6 @@
module blazing/contrib/files/pngcm
go 1.18
go 1.20
require github.com/gogf/gf/v2 v2.8.0

View File

@@ -1,6 +1,6 @@
module blazing/common
go 1.19
go 1.20
require github.com/panjf2000/gnet v1.6.7

View File

@@ -1,5 +1,5 @@
module github.com/pointernil/bitset32
go 1.19
go 1.20
require github.com/bits-and-blooms/bitset v1.5.0 // direct

View File

@@ -1,6 +1,6 @@
module github.com/antlabs/cronex
go 1.19
go 1.20
require github.com/antlabs/timer v0.1.4

View File

@@ -1,5 +1,5 @@
module github.com/xiaoqidun/limit
go 1.18
go 1.20
require golang.org/x/time v0.8.0

View File

@@ -1,6 +1,6 @@
module github.com/bruceshao/lockfree
go 1.18
go 1.20
require (
github.com/davecgh/go-spew v1.1.1 // indirect

View File

@@ -1,6 +1,6 @@
module blazing/logic
go 1.19
go 1.20
require (
github.com/antlabs/timer v0.1.4

View File

@@ -6,6 +6,7 @@ import (
"blazing/common/utils"
"blazing/cool"
"blazing/modules/blazing/model"
"blazing/modules/blazing/service"
"fmt"
"blazing/logic/service/common"
@@ -171,16 +172,54 @@ func (f *FightC) initplayer(c common.PlayerI) (*input.Input, errorcode.ErrorCode
if len(meetpet) == 0 {
initmeetpet()
}
for i, v := range meetpet {
v1 := v
if len(in.AllPet) > 2 {
break
}
r := service.NewMELEEService().Def()
for i, v := range r {
if v.Lv == 0 {
v.Lv = 100
}
// var effect int
// if len(v.Effect) > 0 {
// effect = int(v.Effect[0])
// }
pet := model.GenPetInfo(int(v.MonID), 24, int(v.Nature), int(v.Effect[0]), int(v.Lv), nil)
if v.Color != nil {
pet.ShinyInfo = append(pet.ShinyInfo, *v.Color)
}
if len(v.Prop) == 5 {
pet.Prop = [5]uint32(v.Prop)
}
if len(v.SKill) != 0 {
for i := 0; i < 4; i++ {
if v.SKill[i] != 0 {
pet.SkillList[i].ID = v.SKill[i]
}
}
}
pet.CatchTime = c.GetInfo().UserID + uint32(i)*1000000
pet.Cure()
in.AllPet = append(in.AllPet, info.CreateBattlePetEntity(*pet, f.rand))
v1.CatchTime = c.GetInfo().UserID + uint32(i)*1000000
v1.Cure()
in.AllPet = append(in.AllPet, info.CreateBattlePetEntity(v1, f.rand))
}
// for i, v := range meetpet {
// v1 := v
// if len(in.AllPet) > 2 {
// break
// }
// v1.CatchTime = c.GetInfo().UserID + uint32(i)*1000000
// v1.Cure()
// in.AllPet = append(in.AllPet, info.CreateBattlePetEntity(v1, f.rand))
// }
//in.AllPet = in.AllPet[:3]
default:

View File

@@ -1,6 +1,6 @@
module blazing/login
go 1.19
go 1.20
require (
github.com/gogf/gf/contrib/nosql/redis/v2 v2.8.0

View File

@@ -32,7 +32,7 @@ type MeleeConfig struct {
Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
SKill []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS技能'" json:"skill"`
Effect []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS特性'" json:"effect"`
Color string `gorm:"not null;default:'0';comment:'BOSS颜色'" json:"color"`
Color *string `gorm:"comment:'BOSS颜色'" json:"color"`
IsEnable uint32 `gorm:"not null;default:0;comment:'是否启用'" json:"is_enable"`
// ISMELEE uint32 `gorm:"not null;default:0;comment:'是否乱斗配置'" json:"is_melee"`
@@ -82,10 +82,7 @@ type MeleeConfig struct {
// MeleeConfigEX 扩展BOSS配置模型用于前端/业务层的数组格式解析)
type MeleeConfigEX struct {
MeleeConfig
Color GlowFilter `json:"color"`
ISboss uint32 `gorm:"not null;default:0;comment:'是否是Boss'" json:"is_boss"`
ISgift uint32 `gorm:"not null;default:0;comment:'是否是礼物'" json:"is_gif"`
Color *GlowFilter `json:"color"`
}
// TableName 指定MeleeConfig对应的数据库表名

View File

@@ -16,3 +16,14 @@ func NewMELEEService() *MELEEService {
},
}
}
func (s *MELEEService) Def() []model.MeleeConfigEX {
var pets []model.MeleeConfigEX
m := cool.DBM(s.Model)
m.OrderRandom().Limit(3).Scan(&pets)
return pets
// return ret.Interface().([]model.PetFusion)
}

View File

@@ -49,10 +49,10 @@ func (s *PetFusionMaterialService) Data(Material1 [4]uint32) uint32 {
var effect *model.PetFusionMaterial //一个特性应该是唯一的,但是我们要获取默认随机特性
condition := g.Map{
"material1": fusions[Material1[0]].ID,
"material2": fusions[Material1[1]].ID,
"material3": fusions[Material1[2]].ID,
"material4": fusions[Material1[3]].ID,
"material1": Material1[0],
"material2": Material1[1],
"material3": Material1[2],
"material4": Material1[3],
"is_enable": 1,
}
m.Where(condition).Cache(gdb.CacheOption{

View File

@@ -1,6 +1,6 @@
module blazing/modules/dict
go 1.18
go 1.20
require github.com/gogf/gf/v2 v2.8.0

View File

@@ -1,6 +1,6 @@
module blazing/modules
go 1.19
go 1.20
require (
)

View File

@@ -1,6 +1,6 @@
module blazing/modules/space
go 1.18
go 1.20
require github.com/gogf/gf/v2 v2.8.0

View File

@@ -1,6 +1,6 @@
module blazing/modules/task
go 1.18
go 1.20
require (
github.com/gogf/gf/v2 v2.8.0