更新说明
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-04-05 23:13:06 +08:00
committed by cnb
parent 24b463f0aa
commit d83cf365ac
39 changed files with 307 additions and 111 deletions

View File

@@ -5,6 +5,7 @@ import (
"blazing/modules/player/model"
)
// FightI 定义 common 服务层依赖的战斗操作接口。
type FightI interface {
Over(c PlayerI, id model.EnumBattleOverReason) //逃跑
UseSkill(c PlayerI, id uint32) //使用技能

View File

@@ -7,24 +7,25 @@ import (
"github.com/gogf/gf/v2/os/glog"
)
// MyWriter 自定义日志写入器,用于逻辑服日志转发。
type MyWriter struct {
logger *glog.Logger
user uint32
logger *glog.Logger // 底层 glog 实例。
user uint32 // 关联的玩家 ID。
}
// Write 实现 io.Writer并将日志写入系统日志与底层 logger。
func (w *MyWriter) Write(p []byte) (n int, err error) {
var (
s = string(p)
//ctx = context.Background()
)
service.NewBaseSysLogService().RecordLog(w.user, s)
return w.logger.Write(p)
}
func init() {
cool.Logger.SetWriter(&MyWriter{
logger: glog.New(),
})
cool.Logger.SetAsync(true)
}

View File

@@ -8,20 +8,18 @@ import (
"github.com/lunixbochs/struc"
)
// TomeeHeader 结构体字段定义
// TomeeHeader 定义协议包头。
type TomeeHeader struct {
Len uint32 `json:"len"`
Version byte `json:"version" struc:"[1]byte"`
CMD uint32 `json:"cmdId" struc:"uint32"`
UserID uint32 `json:"userId"`
//Error uint32 `json:"error" struc:"skip"`
Result uint32 `json:"result"`
Data []byte `json:"data" struc:"skip"` //组包忽略此字段// struc:"skip"
Res []byte `struc:"skip"`
//Return []byte `struc:"skip"` //返回记录
Len uint32 `json:"len"` // 包总长度(包头 + 数据体)。
Version byte `json:"version" struc:"[1]byte"` // 协议版本。
CMD uint32 `json:"cmdId" struc:"uint32"` // 命令 ID。
UserID uint32 `json:"userId"` // 玩家 ID。
Result uint32 `json:"result"` // 结果码。
Data []byte `json:"data" struc:"skip"` // 数据体,序列化时跳过。
Res []byte `struc:"skip"` // 预留返回数据,序列化时跳过。
}
// NewTomeeHeader 创建用于下行封包的默认 TomeeHeader。
func NewTomeeHeader(cmd uint32, userid uint32) *TomeeHeader {
return &TomeeHeader{

View File

@@ -7,6 +7,7 @@ import (
"blazing/modules/player/model"
)
// PlayerI 定义战斗与 common 服务依赖的最小玩家能力接口。
type PlayerI interface {
ApplyPetDisplayInfo(*space.SimpleInfo)
GetPlayerCaptureContext() *info.PlayerCaptureContext