Merge branch 'main' of https://cnb.cool/blzing/blazing
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
昔念
2026-03-02 21:56:34 +08:00
32 changed files with 344 additions and 126 deletions

View File

@@ -25,11 +25,26 @@ func init() {
}
type TimeMapReq struct {
g.Meta `path:"/timemap" method:"POST"`
g.Meta `path:"/timemap" method:"GET"`
}
func (this *MapController) TimeMap(ctx context.Context, req *TimeMapReq) (res *cool.BaseRes, err error) {
res = &cool.BaseRes{}
res.Data = service.NewMapService().GetTimeMap()
// re := service.NewMapService().GetTimeMap()
// for _, v := range re {
// v.
// }
return res, nil
}
// type MapTipReq struct {
// g.Meta `path:"/maptip" method:"GET"`
// }
// func (this *MapController) MapTip(ctx context.Context, req *MapTipReq) (res *cool.BaseRes, err error) {
// res = &cool.BaseRes{}
// res.Data = service.NewMapService().GetTimeMap()
// return res, nil
// }

View File

@@ -34,9 +34,9 @@ type QuitSReq struct {
func (this *ServerController) Quit(ctx context.Context, req *QuitSReq) (res *cool.BaseRes, err error) {
res = &cool.BaseRes{}
serv := service.NewServerService().GetServerID(uint16(req.ID))
serv := service.NewServerService().GetServerID(req.ID)
aa, ok := cool.GetClient(serv.Port)
aa, ok := cool.GetClient(serv.OnlineID*100000 + serv.Port)
if ok && aa != nil { //如果已经存在且这个端口已经被存过
aa.QuitSelf(req.Code)
}

View File

@@ -30,7 +30,7 @@ type MapPit struct {
// 复用通用基础配置ID/创建时间/更新时间等)
MapID int32 `gorm:"not null;index;comment:'所属地图ID'" json:"map_id" description:"地图ID"`
RefreshID []int `gorm:"type:int[];comment:'精灵ID列表'" json:"refresh_id"`
RefreshID []uint32 `gorm:"type:int[];comment:'精灵ID列表'" json:"refresh_id"`
Pos []int `gorm:"type:int[];comment:'坑位位置'" json:"pos"`
//最小等级
MinLevel int `gorm:"type:int;not null;default:1;comment:'最小等级'" json:"min_level"`

View File

@@ -39,3 +39,13 @@ func (s *MapService) GetTimeMap() (ret []model.MapConfig) {
return
}
// func (s *MapService) GetTimeTip() (ret []model.MapConfig) {
// //cacheKey := strings.Join([]string{fmt.Sprintf("%d", p1), fmt.Sprintf("%d", p2)}, ":")
// m := dbm_notenable(s.Model)
// m.Where(`is_time_space`, 1).Scan(&ret)
// return
// }

View File

@@ -3,6 +3,8 @@ package service
import (
"blazing/cool"
"blazing/modules/config/model"
"github.com/samber/lo"
)
type MapNodeService struct {
@@ -44,3 +46,16 @@ func (s *MapNodeService) GetDataNode(mapid, node uint32) *model.MapNode {
return pet
}
func (s *MapNodeService) GetTip(mapid uint32) []uint32 {
var pet []model.MapNode //一个特性应该是唯一的,但是我们要获取默认随机特性
dbm_enable(s.Model).Where("map_id", mapid).Scan(&pet)
var ret []uint32
for _, v := range pet {
ret = append(ret, v.TriggerID)
}
return lo.Union(ret)
}

View File

@@ -3,6 +3,8 @@ package service
import (
"blazing/cool"
"blazing/modules/config/model"
"github.com/samber/lo"
)
type MapPitService struct {
@@ -28,3 +30,16 @@ func (s *MapPitService) GetData(mapid, pos uint32) []model.MapPit {
return pet
}
func (s *MapPitService) GetDataALL(mapid uint32) []uint32 {
var pet []model.MapPit //一个特性应该是唯一的,但是我们要获取默认随机特性
dbm_enable(s.Model).Where("map_id", mapid).Scan(&pet)
var ret []uint32
for _, v := range pet {
ret = append(ret, v.RefreshID...)
}
return lo.Union(ret)
}

View File

@@ -29,7 +29,7 @@ func NewServerService() *ServerService {
var rr []g.MapStrAny
r, _ := gconv.Map(data)["list"].(gdb.Result)
for i := 0; i < len(r); i++ {
t, ok := cool.GetClient(gconv.Uint16(r[i].Map()["port"]))
t, ok := cool.GetClient(10000*gconv.Uint32(r[i].Map()["online_id"])+gconv.Uint32(r[i].Map()["port"]))
// tt.Friends = v.Friends
subm := r[i].GMap()
@@ -74,7 +74,7 @@ func (s *ServerService) GetPort(DepartmentID uint) gdb.List {
var res gdb.Result
m := cool.DBM(s.Model).Where("is_open", 1).Fields("ip", "port", "online_id", "is_vip", "name")
if DepartmentID != 1 {
res, _ = m.All()
} else {
@@ -107,7 +107,7 @@ func (s *ServerService) StartUPdate(OnlineID uint16, isinstall int) model.Server
return tttt
}
func (s *ServerService) SetServerID(OnlineID uint16, Port uint16) error {
func (s *ServerService) SetServerID(OnlineID uint32, Port uint32) error {
m := cool.DBM(s.Model).Where("online_id", OnlineID)
@@ -122,7 +122,7 @@ func (s *ServerService) SetServerID(OnlineID uint16, Port uint16) error {
return nil
}
func (s *ServerService) GetServerID(OnlineID uint16) model.ServerList {
func (s *ServerService) GetServerID(OnlineID uint32) model.ServerList {
var tttt model.ServerList
cool.DBM(s.Model).Where("online_id", OnlineID).Scan(&tttt)
@@ -131,7 +131,7 @@ func (s *ServerService) GetServerID(OnlineID uint16) model.ServerList {
}
// 保存版本号
func (s *ServerService) SetServerScreen(id uint16, name string) {
func (s *ServerService) SetServerScreen(id uint32, name string) {
cool.DBM(s.Model).Where("online_id", id).Data("old_screen", name).Update()

View File

@@ -3,6 +3,8 @@ package service
import (
"blazing/cool"
"blazing/modules/config/model"
"github.com/samber/lo"
)
type TalkConfigService struct {
@@ -25,3 +27,16 @@ func (s *TalkConfigService) GetCache(flag int) model.MineralCollectionConfig {
return config
}
func (s *TalkConfigService) GetTip(mapid uint32) []uint32 {
var item []model.TaskConfig
dbm_enable(s.Model).Where("map_id", mapid).Scan(&item)
var res []uint32
for _, v := range item {
res = append(res, v.ItemRewardIds...)
}
return lo.Union(res)
}

View File

@@ -57,3 +57,4 @@ func (s *TaskService) IsAcceptable(taskid uint32) (out *model.TaskConfig) {
return
}

View File

@@ -313,7 +313,8 @@ func (pet *PetInfo) Downgrade(level uint32) {
if ok {
if basic.EvolvesFrom != 0 {
if basic.EvolvesFrom != 0 && xmlres.PetMAP[int(basic.EvolvesFrom)].EvolvFlag == 0 {
pet.ID = uint32(basic.EvolvesFrom)
}