From cf332d916f482b340e0ad9ceec248afc0d596984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Tue, 3 Feb 2026 00:23:51 +0800 Subject: [PATCH] 1 --- README.md | 2 ++ logic/service/player/Monster.go | 3 ++- logic/service/player/new.go | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e4c397070..387819e7d 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ go tool pprof -http :8081 "http://125.208.20.223:54612/debug/debug/pprof/profile" go tool pprof -http :8081 "http://127.0.0.1:9909/debug/pprof/profile" +go tool pprof -http :8081 "http://202.189.15.67:62672/debug/pprof/profile" + 详情查看 [文档](./docs) - [战斗](./docs/battle.md) diff --git a/logic/service/player/Monster.go b/logic/service/player/Monster.go index 722c62aaa..58fe87dbe 100644 --- a/logic/service/player/Monster.go +++ b/logic/service/player/Monster.go @@ -40,11 +40,12 @@ func (p *Player) GenMonster() { p.monsters, oldnum, newNum = replaceOneNumber(p.monsters) replce = []int{newNum} //产生替换新的精灵 if atomic.CompareAndSwapUint32(&p.Canmon, 2, 1) { - p.MapNPC.Reset(10 * time.Second) + p.OgreInfo.Data = [9]OgrePetInfo{} //切地图清空 replce = p.monsters[:] //产生替换新的精灵 } + p.MapNPC.Reset(10 * time.Second) p.OgreInfo.Data[oldnum] = OgrePetInfo{} //切地图清空 mapss, ok := xmlres.MonsterMap[gconv.Int(p.Info.MapID)] diff --git a/logic/service/player/new.go b/logic/service/player/new.go index 59fb583ec..132e41836 100644 --- a/logic/service/player/new.go +++ b/logic/service/player/new.go @@ -7,6 +7,12 @@ import ( "time" ) +// 定义刷野间隔常量(可根据业务调整) +const ( + firstEnterInterval = 7 * time.Second // 首次进图/退出战斗后首次 刷新间隔 + normalRefreshInterval = 10 * time.Second // 正常循环 刷新间隔 +) + // NewPlayer 使用 Options 模式创建 Player 实例 func NewPlayer(opts ...PlayerOption) *Player { p := &Player{