```
feat(go): 升级 Go 版本至 1.20 统一将所有模块的 Go 版本从 1.18 或 1.19 升级到 1.20,以使用最新的语言特性和性能改进。 feat(service): 新增乱斗服务默认宠物生成逻辑 在 fight 模块中调用新的 MELEEService.Def() 方法来生成初始对战宠物, 并根据配置
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
module blazing/contrib/drivers/mysql
|
module blazing/contrib/drivers/mysql
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.6.3
|
github.com/gogf/gf/contrib/drivers/mysql/v2 v2.6.3
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/contrib/drivers/pgsql
|
module blazing/contrib/drivers/pgsql
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.8.0
|
github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.8.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/contrib/files/local
|
module blazing/contrib/files/local
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require github.com/gogf/gf/v2 v2.8.0
|
require github.com/gogf/gf/v2 v2.8.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/contrib/files/pngcm
|
module blazing/contrib/files/pngcm
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require github.com/gogf/gf/v2 v2.8.0
|
require github.com/gogf/gf/v2 v2.8.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/common
|
module blazing/common
|
||||||
|
|
||||||
go 1.19
|
go 1.20
|
||||||
|
|
||||||
require github.com/panjf2000/gnet v1.6.7
|
require github.com/panjf2000/gnet v1.6.7
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module github.com/pointernil/bitset32
|
module github.com/pointernil/bitset32
|
||||||
|
|
||||||
go 1.19
|
go 1.20
|
||||||
|
|
||||||
require github.com/bits-and-blooms/bitset v1.5.0 // direct
|
require github.com/bits-and-blooms/bitset v1.5.0 // direct
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module github.com/antlabs/cronex
|
module github.com/antlabs/cronex
|
||||||
|
|
||||||
go 1.19
|
go 1.20
|
||||||
|
|
||||||
require github.com/antlabs/timer v0.1.4
|
require github.com/antlabs/timer v0.1.4
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module github.com/xiaoqidun/limit
|
module github.com/xiaoqidun/limit
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require golang.org/x/time v0.8.0
|
require golang.org/x/time v0.8.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module github.com/bruceshao/lockfree
|
module github.com/bruceshao/lockfree
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/logic
|
module blazing/logic
|
||||||
|
|
||||||
go 1.19
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/antlabs/timer v0.1.4
|
github.com/antlabs/timer v0.1.4
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"blazing/common/utils"
|
"blazing/common/utils"
|
||||||
"blazing/cool"
|
"blazing/cool"
|
||||||
"blazing/modules/blazing/model"
|
"blazing/modules/blazing/model"
|
||||||
|
"blazing/modules/blazing/service"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"blazing/logic/service/common"
|
"blazing/logic/service/common"
|
||||||
@@ -171,17 +172,55 @@ func (f *FightC) initplayer(c common.PlayerI) (*input.Input, errorcode.ErrorCode
|
|||||||
if len(meetpet) == 0 {
|
if len(meetpet) == 0 {
|
||||||
initmeetpet()
|
initmeetpet()
|
||||||
}
|
}
|
||||||
for i, v := range meetpet {
|
r := service.NewMELEEService().Def()
|
||||||
v1 := v
|
|
||||||
if len(in.AllPet) > 2 {
|
for i, v := range r {
|
||||||
break
|
|
||||||
|
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]
|
||||||
}
|
}
|
||||||
|
|
||||||
v1.CatchTime = c.GetInfo().UserID + uint32(i)*1000000
|
|
||||||
v1.Cure()
|
|
||||||
in.AllPet = append(in.AllPet, info.CreateBattlePetEntity(v1, f.rand))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
pet.CatchTime = c.GetInfo().UserID + uint32(i)*1000000
|
||||||
|
pet.Cure()
|
||||||
|
in.AllPet = append(in.AllPet, info.CreateBattlePetEntity(*pet, 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]
|
//in.AllPet = in.AllPet[:3]
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/login
|
module blazing/login
|
||||||
|
|
||||||
go 1.19
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gogf/gf/contrib/nosql/redis/v2 v2.8.0
|
github.com/gogf/gf/contrib/nosql/redis/v2 v2.8.0
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ type MeleeConfig struct {
|
|||||||
Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
|
Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
|
||||||
SKill []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS技能'" json:"skill"`
|
SKill []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS技能'" json:"skill"`
|
||||||
Effect []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS特性'" json:"effect"`
|
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"`
|
IsEnable uint32 `gorm:"not null;default:0;comment:'是否启用'" json:"is_enable"`
|
||||||
|
|
||||||
// ISMELEE uint32 `gorm:"not null;default:0;comment:'是否乱斗配置'" json:"is_melee"`
|
// ISMELEE uint32 `gorm:"not null;default:0;comment:'是否乱斗配置'" json:"is_melee"`
|
||||||
@@ -82,10 +82,7 @@ type MeleeConfig struct {
|
|||||||
// MeleeConfigEX 扩展BOSS配置模型(用于前端/业务层的数组格式解析)
|
// MeleeConfigEX 扩展BOSS配置模型(用于前端/业务层的数组格式解析)
|
||||||
type MeleeConfigEX struct {
|
type MeleeConfigEX struct {
|
||||||
MeleeConfig
|
MeleeConfig
|
||||||
Color GlowFilter `json:"color"`
|
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"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName 指定MeleeConfig对应的数据库表名
|
// TableName 指定MeleeConfig对应的数据库表名
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ func (s *PetFusionMaterialService) Data(Material1 [4]uint32) uint32 {
|
|||||||
|
|
||||||
var effect *model.PetFusionMaterial //一个特性应该是唯一的,但是我们要获取默认随机特性
|
var effect *model.PetFusionMaterial //一个特性应该是唯一的,但是我们要获取默认随机特性
|
||||||
condition := g.Map{
|
condition := g.Map{
|
||||||
"material1": fusions[Material1[0]].ID,
|
"material1": Material1[0],
|
||||||
"material2": fusions[Material1[1]].ID,
|
"material2": Material1[1],
|
||||||
"material3": fusions[Material1[2]].ID,
|
"material3": Material1[2],
|
||||||
"material4": fusions[Material1[3]].ID,
|
"material4": Material1[3],
|
||||||
"is_enable": 1,
|
"is_enable": 1,
|
||||||
}
|
}
|
||||||
m.Where(condition).Cache(gdb.CacheOption{
|
m.Where(condition).Cache(gdb.CacheOption{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/modules/dict
|
module blazing/modules/dict
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require github.com/gogf/gf/v2 v2.8.0
|
require github.com/gogf/gf/v2 v2.8.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/modules
|
module blazing/modules
|
||||||
|
|
||||||
go 1.19
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/modules/space
|
module blazing/modules/space
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require github.com/gogf/gf/v2 v2.8.0
|
require github.com/gogf/gf/v2 v2.8.0
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module blazing/modules/task
|
module blazing/modules/task
|
||||||
|
|
||||||
go 1.18
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gogf/gf/v2 v2.8.0
|
github.com/gogf/gf/v2 v2.8.0
|
||||||
|
|||||||
Reference in New Issue
Block a user