feat: 更新战斗系统模型结构和Redis消息处理

- 引入gredis依赖用于Redis消息处理
- 将战斗相关的枚举和结构体从info包迁移到model包
- 更新战斗结束原因、攻击值等类型的引用路径
- 添加新的zset工具包到工作区
- 修改Redis消息处理逻辑以正确解析gredis.Message类型
- 在战斗控制器中统一使用model包下的类型定义
This commit is contained in:
昔念
2026-03-04 22:47:21 +08:00
parent d14dbde697
commit 4751594ee8
28 changed files with 2214 additions and 181 deletions

View File

@@ -5,6 +5,7 @@ import (
"blazing/common/socket/errorcode"
"blazing/common/utils"
"blazing/cool"
"blazing/modules/player/model"
"context"
"sync/atomic"
@@ -97,7 +98,7 @@ func (f *FightC) battleLoop() {
})
if f.Info.Status == info.BattleMode.FIGHT_WITH_NPC {
addpet := f.Opp.Player.GetInfo().PetList[0]
if f.Reason == info.BattleOverReason.Cacthok {
if f.Reason == model.BattleOverReason.Cacthok {
f.WinnerId = f.ownerID
addpet.EffectInfo = nil //清空特性信息
@@ -280,7 +281,7 @@ func (f *FightC) handleTimeout(ourID, oppID uint32, actions map[uint32]action.Ba
}
//获胜方是已经出招的
f.WinnerId = f.GetInputByPlayer(f.getPlayerByID(pid), false).Player.GetInfo().UserID
f.Reason = info.BattleOverReason.PlayerOVerTime
f.Reason = model.BattleOverReason.PlayerOVerTime
f.closefight = true
return true
}
@@ -365,7 +366,7 @@ func (f *FightC) handleItemAction(a *action.UseItemAction) {
ok, _ := f.Our.Capture(f.Opp.CurrentPet, a.ItemID, -1)
our := f.Our.Player.(*player.Player)
if ok {
f.Reason = info.BattleOverReason.Cacthok
f.Reason = model.BattleOverReason.Cacthok
f.closefight = true
} else {
our.SendPack(common.NewTomeeHeader(2409, f.ownerID).Pack(&info.CatchMonsterOutboundInfo{}))