保存体力变化值
This commit is contained in:
parent
76a39dc594
commit
b9fbdf2a51
@ -1028,7 +1028,7 @@ func (this *User) BingoSetUserLv(session comm.IUserSession, lv int32) error {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 玩家体力恢复
|
// 玩家体力恢复
|
||||||
func (this *User) recoverUserPs(user *pb.DBUser) (total int32, nexttime int64) {
|
func (this *User) recoverUserPs(user *pb.DBUser) (change bool, total int32, nexttime int64) {
|
||||||
var (
|
var (
|
||||||
yu int32
|
yu int32
|
||||||
add int32
|
add int32
|
||||||
@ -1049,6 +1049,7 @@ func (this *User) recoverUserPs(user *pb.DBUser) (total int32, nexttime int64) {
|
|||||||
cur := time.Now().Unix()
|
cur := time.Now().Unix()
|
||||||
if user.LastRecoverPsSec == 0 {
|
if user.LastRecoverPsSec == 0 {
|
||||||
user.LastRecoverPsSec = cur
|
user.LastRecoverPsSec = cur
|
||||||
|
change = true
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
diff := cur - user.LastRecoverPsSec
|
diff := cur - user.LastRecoverPsSec
|
||||||
@ -1065,6 +1066,7 @@ func (this *User) recoverUserPs(user *pb.DBUser) (total int32, nexttime int64) {
|
|||||||
}
|
}
|
||||||
user.LastRecoverPsSec = cur
|
user.LastRecoverPsSec = cur
|
||||||
user.Ps += add
|
user.Ps += add
|
||||||
|
change = true
|
||||||
}
|
}
|
||||||
nexttime = user.LastRecoverPsSec + int64(ggd.PsRecovery)
|
nexttime = user.LastRecoverPsSec + int64(ggd.PsRecovery)
|
||||||
return
|
return
|
||||||
@ -1257,7 +1259,7 @@ func (this *User) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (red
|
|||||||
this.Errorln(err)
|
this.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
total, t := this.recoverUserPs(user)
|
change, total, t := this.recoverUserPs(user)
|
||||||
reddot[comm.Reddot30100] = &pb.ReddotItem{
|
reddot[comm.Reddot30100] = &pb.ReddotItem{
|
||||||
Rid: int32(comm.Reddot30100),
|
Rid: int32(comm.Reddot30100),
|
||||||
Activated: true,
|
Activated: true,
|
||||||
@ -1265,6 +1267,12 @@ func (this *User) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (red
|
|||||||
Progress: user.Ps,
|
Progress: user.Ps,
|
||||||
Total: total,
|
Total: total,
|
||||||
}
|
}
|
||||||
|
if change {
|
||||||
|
this.modelUser.Change(session.GetUserId(), map[string]interface{}{
|
||||||
|
"ps": user.Ps,
|
||||||
|
"lastRecoverPsSec": user.LastRecoverPsSec,
|
||||||
|
})
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user