一个体力刷新的小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 return
} }
this.recoverUserPs(user)
user.Ps += add user.Ps += add
userEx.ConsumPs += -add userEx.ConsumPs += -add
this.recoverUserPs(user)
change.Ps = user.Ps change.Ps = user.Ps
go this.ModuleUiGame.HDPSTodayConsum(session.GetUserId(), userEx.ConsumPs) go this.ModuleUiGame.HDPSTodayConsum(session.GetUserId(), userEx.ConsumPs)
} else { } else {
@ -1104,7 +1105,7 @@ func (this *User) recoverUserPs(user *pb.DBUser) (change bool, total int32, next
yu int32 yu int32
add int32 add int32
) )
cur := configure.Now().Unix()
ggd := this.ModuleTools.GetGlobalConf() ggd := this.ModuleTools.GetGlobalConf()
if ggd == nil { if ggd == nil {
return return
@ -1114,10 +1115,11 @@ func (this *User) recoverUserPs(user *pb.DBUser) (change bool, total int32, next
return return
} }
if user.Ps >= pconf.PsCeiling { if user.Ps >= pconf.PsCeiling {
user.LastRecoverPsSec = cur
return return
} }
total = pconf.PsCeiling total = pconf.PsCeiling
cur := configure.Now().Unix()
if user.LastRecoverPsSec == 0 { if user.LastRecoverPsSec == 0 {
user.LastRecoverPsSec = cur user.LastRecoverPsSec = cur
change = true change = true