fix: 修复空提交问题

This commit is contained in:
1
2025-11-23 23:38:03 +00:00
parent aa4574b5eb
commit 240c349b8a
45 changed files with 113 additions and 4438 deletions

View File

@@ -1,11 +1,14 @@
package player
import (
"blazing/common/utils"
"blazing/logic/service/common"
"blazing/logic/service/fight/info"
"blazing/modules/blazing/model"
"math/rand"
"time"
"github.com/gogf/gf/v2/util/grand"
)
type baseplayer struct {
@@ -17,7 +20,7 @@ type baseplayer struct {
// NewPlayerCaptureContext 创建用户捕捉上下文(每次登录调用)
func newbaseplayer() baseplayer {
rng := rand.New(rand.NewSource(time.Now().UnixNano() + int64(rand.Intn(1000000))))
rng := rand.New(rand.NewSource(time.Now().UnixNano() + int64(grand.Intn(1000000))))
ret := baseplayer{}
ret.PlayerCaptureContext = &info.PlayerCaptureContext{
rng,
@@ -41,6 +44,13 @@ func (f *baseplayer) GetPlayerCaptureContext() *info.PlayerCaptureContext {
return f.PlayerCaptureContext
}
func (f *baseplayer) FindPet(CatchTime uint32) (int, *model.PetInfo, bool) {
return utils.FindWithIndex(f.Info.PetList, func(item model.PetInfo) bool {
return item.CatchTime == CatchTime
})
}
// // 计算整数的二进制1的个数Integer.bitCount
// func bitsCount(n int) int {
// count := 0