一个体力刷新的小bug

This commit is contained in:
meixiongfeng 2024-01-03 15:37:46 +08:00
parent ff4f7bc196
commit f16e990078

View File

@ -679,9 +679,10 @@ func (this *User) change(session comm.IUserSession, attrs map[string]int32) (atn
}
return
}
this.recoverUserPs(user)
user.Ps += add
userEx.ConsumPs += -add
this.recoverUserPs(user)
change.Ps = user.Ps
go this.ModuleUiGame.HDPSTodayConsum(session.GetUserId(), userEx.ConsumPs)
} else {
@ -1104,7 +1105,7 @@ func (this *User) recoverUserPs(user *pb.DBUser) (change bool, total int32, next
yu int32
add int32
)
cur := configure.Now().Unix()
ggd := this.ModuleTools.GetGlobalConf()
if ggd == nil {
return
@ -1114,10 +1115,11 @@ func (this *User) recoverUserPs(user *pb.DBUser) (change bool, total int32, next
return
}
if user.Ps >= pconf.PsCeiling {
user.LastRecoverPsSec = cur
return
}
total = pconf.PsCeiling
cur := configure.Now().Unix()
if user.LastRecoverPsSec == 0 {
user.LastRecoverPsSec = cur
change = true