```
fix(monster): 调整闪光宠物生成概率并修复时间种子问题 将闪光宠物的生成条件从 `grand.Meet(1, 100)` 修改为 `grand.Meet(30, 100)`, 同时为 `RandSHiny` 方法增加时间偏移参数以提升随机性。 此外,修正了登录任务判断逻辑中的索引范围错误,字段命名优化以及部分冗余代码清理。 ```
This commit is contained in:
@@ -41,7 +41,7 @@ func (c *PetBagController) GetSession(ctx context.Context, req *PetGetReq) (res
|
||||
//r = g.RequestFromCtx(ctx)
|
||||
)
|
||||
t := model.GenPetInfo(
|
||||
req.PetTypeId, req.IndividualValue, req.NatureId, req.AbilityTypeEnum, req.IsShiny, req.Level)
|
||||
req.PetTypeId, req.IndividualValue, req.NatureId, req.AbilityTypeEnum, req.Level, nil)
|
||||
|
||||
service.NewUserService(uint32(admin.UserId)).Pet.PetAdd(t)
|
||||
return
|
||||
|
||||
@@ -59,14 +59,15 @@ func IsToday(t1 *gtime.Time) bool {
|
||||
if t1 == nil {
|
||||
return false
|
||||
}
|
||||
t := t1.Time
|
||||
|
||||
// 统一转换为 UTC 时区
|
||||
tUTC := t1.Time.UTC()
|
||||
// 截断 UTC 时间到当天 00:00:00
|
||||
nowUTC := time.Now().UTC().Truncate(24 * time.Hour)
|
||||
tTrunc := tUTC.Truncate(24 * time.Hour)
|
||||
// 获取当前时间
|
||||
now := time.Now()
|
||||
|
||||
return nowUTC.Equal(tTrunc)
|
||||
// 比较年、月、日是否相同
|
||||
return t.Year() == now.Year() &&
|
||||
t.Month() == now.Month() &&
|
||||
t.Day() == now.Day()
|
||||
}
|
||||
|
||||
type TaskService struct {
|
||||
|
||||
Reference in New Issue
Block a user