46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package martialhall
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/configure"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
"time"
|
|
)
|
|
|
|
//结算
|
|
func settlement(rtask comm.IRtask, session comm.IUserSession, pillar *pb.DBPillar, mdata *cfg.GameKungfuMasterworkerData) {
|
|
if pillar == nil || pillar.State != pb.PillarState_Useing {
|
|
return
|
|
}
|
|
minutes := int32(time.Unix(pillar.End, 0).Sub(time.Unix(pillar.Lastbill, 0)).Minutes())
|
|
pillar.Reward += minutes * mdata.Exp
|
|
pillar.Lastbill = configure.Now().Unix()
|
|
if configure.Now().After(time.Unix(pillar.End, 0)) {
|
|
pillar.State = pb.PillarState_Receive
|
|
}
|
|
if minutes > 0 {
|
|
// rtask.SendToRtask(session, comm.Rtype135, minutes)
|
|
go rtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype135, 1))
|
|
}
|
|
|
|
}
|
|
|
|
//结算
|
|
func check(rtask comm.IRtask, session comm.IUserSession, pillar *pb.DBPillar, mdata *cfg.GameKungfuMasterworkerData) {
|
|
if pillar == nil || pillar.State != pb.PillarState_Useing {
|
|
return
|
|
}
|
|
//达到修炼时间
|
|
if configure.Now().After(time.Unix(pillar.End, 0)) {
|
|
minutes := int32(time.Unix(pillar.End, 0).Sub(time.Unix(pillar.Lastbill, 0)).Minutes())
|
|
pillar.Reward += minutes * mdata.Exp
|
|
pillar.Lastbill = configure.Now().Unix()
|
|
pillar.State = pb.PillarState_Receive
|
|
if minutes > 0 {
|
|
// rtask.SendToRtask(session, comm.Rtype135, minutes)
|
|
go rtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype135, 1))
|
|
}
|
|
}
|
|
}
|