From 4dd05726af4f1805579399a9bb9c9dd138d4f992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Sun, 25 Jan 2026 17:36:40 +0800 Subject: [PATCH] =?UTF-8?q?```=20fix(socket):=20=E4=BF=AE=E5=A4=8Dsocket?= =?UTF-8?q?=E5=B9=BF=E6=92=AD=E5=92=8C=E9=80=80=E5=87=BA=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E8=BF=94=E5=9B=9E=E5=80=BC=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正了Broadcast方法中错误的返回值true为false - 修正了QuitSelf方法中player遍历的返回值从true改为false - 在玩家退出时添加了睡眠模式错误码通知消息 feat(fight): 统一技能使用方法命名并修复战斗伤害计算逻辑 - 将所有技能使用方法名从Skill_Useed重命名为SkillUseed以保持一致性 --- common/contrib/drivers/pgsql/go.mod | 4 ++-- common/socket/kick.go | 17 ++++++++++++++--- logic/main.go | 2 +- logic/service/fight/boss/NewSeIdx_700.go | 4 ++-- logic/service/fight/boss/NewSeIdx_72.go | 2 +- logic/service/fight/boss/NewSeIdx_73.go | 2 +- logic/service/fight/boss/NewSeIdx_80.go | 2 +- logic/service/fight/boss/NewSeIdx_83.go | 2 +- logic/service/fight/effect/effect_107.go | 2 +- logic/service/fight/effect/effect_116.go | 2 +- logic/service/fight/effect/effect_6.go | 2 +- logic/service/fight/effect/effect_89.go | 2 +- logic/service/fight/fightc.go | 2 +- logic/service/fight/input/interface.go | 2 +- logic/service/fight/node/skill.go | 2 +- 15 files changed, 30 insertions(+), 19 deletions(-) diff --git a/common/contrib/drivers/pgsql/go.mod b/common/contrib/drivers/pgsql/go.mod index e6a0699cb..cdab99c91 100644 --- a/common/contrib/drivers/pgsql/go.mod +++ b/common/contrib/drivers/pgsql/go.mod @@ -3,8 +3,8 @@ module blazing/contrib/drivers/pgsql go 1.20 require ( - github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.8.0 - github.com/gogf/gf/v2 v2.8.0 + github.com/gogf/gf/contrib/drivers/pgsql/v2 v2.9.8 + github.com/gogf/gf/v2 v2.9.8 gorm.io/driver/postgres v1.5.6 gorm.io/gorm v1.25.7 ) diff --git a/common/socket/kick.go b/common/socket/kick.go index 5efb938f9..2cb1e6125 100644 --- a/common/socket/kick.go +++ b/common/socket/kick.go @@ -1,7 +1,9 @@ package socket import ( + "blazing/common/socket/errorcode" "blazing/cool" + "blazing/logic/service/common" "blazing/logic/service/player" "context" "fmt" @@ -20,7 +22,7 @@ func (s *Server) Broadcast(t string) int { value.SendPackCmd(50003, &Broadcast{ Name: t, }) - return true + return false }) return count @@ -43,14 +45,23 @@ func (s *Server) QuitSelf(a int) error { if a != 0 { player.Mainplayer.Range(func(key uint32, value *player.Player) bool { value.Kick(1) - return true + return false }) } else { go func() { + player.Mainplayer.Range(func(key uint32, value *player.Player) bool { + head := common.NewTomeeHeader(1001, value.Info.UserID) + + head.Result = uint32(errorcode.ErrorCodes.ErrXinPlanSleepMode) + + value.SendPack(head.Pack(nil)) + return false + }) + <-time.After(10 * time.Minute) player.Mainplayer.Range(func(key uint32, value *player.Player) bool { value.Kick(1) - return true + return false }) }() } diff --git a/logic/main.go b/logic/main.go index 109faa512..73382257a 100644 --- a/logic/main.go +++ b/logic/main.go @@ -42,7 +42,7 @@ func cleanup() { player.Mainplayer.Range(func(key uint32, value *player.Player) bool { value.Kick(1) - return true + return false }) fight.Fightpool.ReleaseTimeout(0) log.Println("资源清理完成,程序即将退出") diff --git a/logic/service/fight/boss/NewSeIdx_700.go b/logic/service/fight/boss/NewSeIdx_700.go index f8a4a9690..4527c3b81 100644 --- a/logic/service/fight/boss/NewSeIdx_700.go +++ b/logic/service/fight/boss/NewSeIdx_700.go @@ -13,7 +13,7 @@ type NewSel700 struct { NewSel0 } -func (e *NewSel700) Skill_Useed() bool { +func (e *NewSel700) SkillUseed() bool { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true } @@ -22,7 +22,7 @@ func (e *NewSel700) Skill_Useed() bool { } e.Input.Heal( - e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(e.Args()[0].Div(alpacadecimal.NewFromInt(100))), + e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Mul(e.Args()[0].Div(alpacadecimal.NewFromInt(100))), ) return true } diff --git a/logic/service/fight/boss/NewSeIdx_72.go b/logic/service/fight/boss/NewSeIdx_72.go index 19efc11b8..0d7a9e5d8 100644 --- a/logic/service/fight/boss/NewSeIdx_72.go +++ b/logic/service/fight/boss/NewSeIdx_72.go @@ -10,7 +10,7 @@ type NewSel72 struct { NewSel0 } -func (e *NewSel72) Skill_Useed() bool { +func (e *NewSel72) SkillUseed() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/boss/NewSeIdx_73.go b/logic/service/fight/boss/NewSeIdx_73.go index c28073d58..54eb47ae3 100644 --- a/logic/service/fight/boss/NewSeIdx_73.go +++ b/logic/service/fight/boss/NewSeIdx_73.go @@ -12,7 +12,7 @@ type NewSel73 struct { NewSel0 } -func (e *NewSel73) Skill_Useed() bool { +func (e *NewSel73) SkillUseed() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/boss/NewSeIdx_80.go b/logic/service/fight/boss/NewSeIdx_80.go index 9b4c728cb..d3c03c793 100644 --- a/logic/service/fight/boss/NewSeIdx_80.go +++ b/logic/service/fight/boss/NewSeIdx_80.go @@ -10,7 +10,7 @@ type NewSel80 struct { NewSel0 } -func (e *NewSel80) Skill_Useed() bool { +func (e *NewSel80) SkillUseed() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/boss/NewSeIdx_83.go b/logic/service/fight/boss/NewSeIdx_83.go index 813fb8fde..bbd49c623 100644 --- a/logic/service/fight/boss/NewSeIdx_83.go +++ b/logic/service/fight/boss/NewSeIdx_83.go @@ -12,7 +12,7 @@ type NewSel83 struct { NewSel0 } -func (e *NewSel83) Skill_Useed() bool { +func (e *NewSel83) SkillUseed() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/effect/effect_107.go b/logic/service/fight/effect/effect_107.go index fcf18d435..ed4c0865f 100644 --- a/logic/service/fight/effect/effect_107.go +++ b/logic/service/fight/effect/effect_107.go @@ -22,7 +22,7 @@ type Effect107 struct { } // 我方使用效果 -func (e *Effect107) Skill_Useed() bool { +func (e *Effect107) SkillUseed() bool { d := e.Ctx().Our.SumDamage.Cmp(alpacadecimal.NewFromInt(int64(e.SideEffectArgs[0]))) //说明伤害小于N diff --git a/logic/service/fight/effect/effect_116.go b/logic/service/fight/effect/effect_116.go index d6af60145..4c6c56097 100644 --- a/logic/service/fight/effect/effect_116.go +++ b/logic/service/fight/effect/effect_116.go @@ -32,7 +32,7 @@ func (e *Effect116) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } -func (e *Effect116) Skill_Useed() bool { +func (e *Effect116) SkillUseed() bool { if e.Input.FightC.IsFirst(e.Input.Player) { e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(alpacadecimal.NewFromInt(5))) diff --git a/logic/service/fight/effect/effect_6.go b/logic/service/fight/effect/effect_6.go index f3a6f75ed..c06c7579a 100644 --- a/logic/service/fight/effect/effect_6.go +++ b/logic/service/fight/effect/effect_6.go @@ -21,7 +21,7 @@ type Effect6 struct { } // 我方使用效果 -func (e *Effect6) Skill_Useed() bool { +func (e *Effect6) SkillUseed() bool { t := &info.DamageZone{ Type: info.DamageType.Fixed, //这个对面计算前是在他的回合,所以后手也能拿到伤害 diff --git a/logic/service/fight/effect/effect_89.go b/logic/service/fight/effect/effect_89.go index dfddeb590..f7de88d5b 100644 --- a/logic/service/fight/effect/effect_89.go +++ b/logic/service/fight/effect/effect_89.go @@ -30,7 +30,7 @@ func (e *Effect89) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } -func (e *Effect89) Skill_Useed() bool { +func (e *Effect89) SkillUseed() bool { e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Ctx().Our.SumDamage.Div(e.Args()[1])) diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index 7ce54806d..3e8798062 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -249,7 +249,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) //技能使用后 attacker.Exec(func(effect input.Effect) bool { //技能使用后的我方效果 effect.Ctx().SkillEntity = currentSkill - effect.Skill_Useed() + effect.SkillUseed() return true }) defender.Exec(func(effect input.Effect) bool { diff --git a/logic/service/fight/input/interface.go b/logic/service/fight/input/interface.go index 031388fea..71e91f1b4 100644 --- a/logic/service/fight/input/interface.go +++ b/logic/service/fight/input/interface.go @@ -33,7 +33,7 @@ type Effect interface { Damage_Shield(*info.DamageZone) bool // 护盾值变化时触发 //Damage_Use() bool // 伤害作用 Skill_Use_ex() bool //技能PP减少节点 - Skill_Useed() bool //技能PP减少节点 + SkillUseed() bool //技能PP减少节点 ActionEndEx() bool Action_end() bool //OnDefeat(opp *Input) bool // 精灵被击败时触发 diff --git a/logic/service/fight/node/skill.go b/logic/service/fight/node/skill.go index 7b18060a3..2e28a4cdd 100644 --- a/logic/service/fight/node/skill.go +++ b/logic/service/fight/node/skill.go @@ -42,7 +42,7 @@ func (e *EffectNode) Skill_Can() bool { func (e *EffectNode) Skill_Use_ex() bool { return true } -func (e *EffectNode) Skill_Useed() bool { +func (e *EffectNode) SkillUseed() bool { // if e.Effect != nil { // if e.Input.CurrentPet.Info.Hp == 0 { // e.OnDefeat(ctx.Input, ctx.SkillEntity) //死亡