```
fix(monster): 调整闪光宠物生成概率并修复时间种子问题 将闪光宠物的生成条件从 `grand.Meet(1, 100)` 修改为 `grand.Meet(30, 100)`, 同时为 `RandSHiny` 方法增加时间偏移参数以提升随机性。 此外,修正了登录任务判断逻辑中的索引范围错误,字段命名优化以及部分冗余代码清理。 ```
This commit is contained in:
@@ -51,8 +51,8 @@ func (p *Player) genMonster() {
|
||||
|
||||
ttt.Lv = gconv.Uint32(RandomStringFromSlice(lv))
|
||||
|
||||
if xmlres.PetMAP[int(ttt.Id)].CatchRate != 0 && grand.Meet(1, 100) {
|
||||
ttt.RandSHiny()
|
||||
if xmlres.PetMAP[int(ttt.Id)].CatchRate != 0 && grand.Meet(30, 100) {
|
||||
ttt.RandSHiny(int64(i))
|
||||
}
|
||||
|
||||
if len(id) == 1 { //说明这里只固定刷一个,概率变尼尔尼奥
|
||||
@@ -92,10 +92,15 @@ func (p *Player) genMonster() {
|
||||
for i := 0; i < 3; i++ {
|
||||
|
||||
p.OgreInfo.Data[p.monsters[i]] = t1.Data[p.monsters[i]]
|
||||
|
||||
}
|
||||
}
|
||||
p.OgreInfo.Data[oldnum] = OgrePetInfo{}
|
||||
p.OgreInfo.Data[newNum] = t1.Data[newNum]
|
||||
// for i, e := range p.OgreInfo.Data {
|
||||
// println(i, e.Id, len(e.ShinyInfo))
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ type OgrePetInfo struct {
|
||||
Ext uint32 `struc:"skip"` //是否变尼尔尼奥
|
||||
}
|
||||
|
||||
func (o *OgrePetInfo) RandSHiny() {
|
||||
func (o *OgrePetInfo) RandSHiny(t int64) {
|
||||
o.ShinyInfo = make([]model.GlowFilter, 1)
|
||||
// 假设 t 是包含 ShinyInfo 字段的结构体,ShinyInfo 是 GlowFilter 类型的切片
|
||||
o.ShinyInfo[0] = model.GlowFilter{
|
||||
@@ -72,7 +72,7 @@ func (o *OgrePetInfo) RandSHiny() {
|
||||
|
||||
}
|
||||
|
||||
o.ShinyInfo[0].ColorMatrixFilter = RandomMatrixNoSingleColorBrightDefault(time.Now().Unix(), [5]uint8{0, 0, 0, 1, 0}, 0.6)
|
||||
o.ShinyInfo[0].ColorMatrixFilter = RandomMatrixNoSingleColorBrightDefault(time.Now().Unix()+t, [5]uint8{0, 0, 0, 1, 0}, 0.6)
|
||||
//g.Dump(ttt.ShinyInfo)
|
||||
// ttt.Shiny = 0 //待确认是否刷新异色
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func (lw *Player) CompleteLogin() {
|
||||
// 定义检查函数:判断84-87索引中是否有任意一个元素不等于3
|
||||
func (lw *Player) IsNewPlayer() bool {
|
||||
// 遍历84到87的索引
|
||||
for i := 84; i <= 87; i++ {
|
||||
for i := 85; i <= 88; i++ {
|
||||
if lw.Info.GetTask(i) != model.Completed {
|
||||
return true // 只要有一个不等于3,就返回true
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ type OutInfo struct {
|
||||
VipStage uint32 `struc:"uint32" fieldDesc:"暂时不明建议先给固定值1" json:"vip_stage"`
|
||||
|
||||
// 人物状态 =0 步行 !=0 飞行
|
||||
ActionType uint32 `struc:"uint32" fieldDesc:"人物状态 =0 步行 !=0 飞行" json:"action_type"`
|
||||
Flag uint32 `struc:"uint32" fieldDesc:"人物状态 =0 步行 !=0 飞行" json:"action_type"`
|
||||
|
||||
// 上线的地图id
|
||||
Pos model.Pos `fieldDesc:"上线的地图id" json:"pos"`
|
||||
@@ -94,7 +94,7 @@ type OutInfo struct {
|
||||
// 宠物皮肤暂时无法测试,给 0
|
||||
PetSkin uint32 `struc:"uint32" fieldDesc:"宠物皮肤暂时无法测试, 给0" json:"pet_skin"`
|
||||
// 填充字符
|
||||
Reserved [3]uint32 `struc:"uint32" fieldDesc:"填充字符" json:"reserved"`
|
||||
Reserved [3]uint32
|
||||
|
||||
// 暂时不明给0
|
||||
FightFlag uint32 `struc:"uint32" fieldDesc:"暂时不明给0" json:"fight_flag"`
|
||||
|
||||
@@ -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