From d8718e8eac977b7fc3b7727aaf591fa76b1189ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <1@72wo.cn> Date: Sun, 30 Nov 2025 01:54:46 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(fight):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=88=98=E6=96=97=E5=87=86=E5=A4=87=E5=AE=8C=E6=88=90=E5=B9=BF?= =?UTF-8?q?=E6=92=AD=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 ReadyFight 方法中增加对所有玩家的广播,发送玩家准备完成的消息。 新增 S2C_2404 结构体用于通知客户端指定用户已准备完成, 若为野怪则 userID 设置为 0。 ``` --- logic/service/fight/action.go | 3 +++ logic/service/fight/info/info.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/logic/service/fight/action.go b/logic/service/fight/action.go index 890a3383..6d1bdd73 100644 --- a/logic/service/fight/action.go +++ b/logic/service/fight/action.go @@ -129,7 +129,10 @@ func (f *FightC) UseItem(c common.PlayerI, cacthid, itemid uint32) { // ReadyFight 处理玩家战斗准备逻辑,当满足条件时启动战斗循环 func (f *FightC) ReadyFight(c common.PlayerI) { + f.Broadcast(func(ff *input.Input) { + ff.Player.SendPackCmd(2404, &info.S2C_2404{UserID: c.GetInfo().UserID}) + }) // 2. 标记当前玩家已准备完成 input := f.GetInputByPlayer(c, false) input.Finished = true diff --git a/logic/service/fight/info/info.go b/logic/service/fight/info/info.go index 967a1243..88419fc5 100644 --- a/logic/service/fight/info/info.go +++ b/logic/service/fight/info/info.go @@ -200,6 +200,10 @@ type FightUserInfo struct { // 使用[16]byte存储固定长度的字节数组 Nick string `struc:"[16]byte"` } +type S2C_2404 struct { + // 用户ID(野怪为0),@UInt long + UserID uint32 `fieldDesc:"userID 如果为野怪则为0" ` +} // NoteReadyToFightInfo 战斗准备就绪消息结构体,NoteReadyToFightInfo type NoteReadyToFightInfo struct {