diff --git a/modules/martialhall/api_info.go b/modules/martialhall/api_info.go index 2630a67a0..bf9b7d2a7 100644 --- a/modules/martialhall/api_info.go +++ b/modules/martialhall/api_info.go @@ -29,11 +29,11 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.MartialhallInfoReq) code = pb.ErrorCode_ConfigNoFound return } - check(mart.Pillar1, mdata) - check(mart.Pillar2, mdata) - check(mart.Pillar3, mdata) - check(mart.Pillar4, mdata) - check(mart.Pillar5, mdata) + check(this.module.ModuleRtask, session, mart.Pillar1, mdata) + check(this.module.ModuleRtask, session, mart.Pillar2, mdata) + check(this.module.ModuleRtask, session, mart.Pillar3, mdata) + check(this.module.ModuleRtask, session, mart.Pillar4, mdata) + check(this.module.ModuleRtask, session, mart.Pillar5, mdata) this.module.modelMartialhall.Add(session.GetUserId(), mart) session.SendMsg(string(this.module.GetType()), "info", &pb.MartialhallInfoResp{Info: mart}) return diff --git a/modules/martialhall/api_receive.go b/modules/martialhall/api_receive.go index 22ae1ea5f..3f5d549af 100644 --- a/modules/martialhall/api_receive.go +++ b/modules/martialhall/api_receive.go @@ -60,7 +60,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.MartialhallRecei code = pb.ErrorCode_MartialhallNotUnlocked return } - check(pillar, mdata) + check(this.module.ModuleRtask, session, pillar, mdata) if pillar.State != pb.PillarState_Receive { code = pb.ErrorCode_MartialhallInUse return diff --git a/modules/martialhall/api_upgrade.go b/modules/martialhall/api_upgrade.go index cb34c67b7..08cd51ea7 100644 --- a/modules/martialhall/api_upgrade.go +++ b/modules/martialhall/api_upgrade.go @@ -46,11 +46,11 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.MartialhallUpgra } if issucc { mart.Lv++ - settlement(mart.Pillar1, mdata) - settlement(mart.Pillar2, mdata) - settlement(mart.Pillar3, mdata) - settlement(mart.Pillar4, mdata) - settlement(mart.Pillar5, mdata) + settlement(this.module.ModuleRtask, session, mart.Pillar1, mdata) + settlement(this.module.ModuleRtask, session, mart.Pillar2, mdata) + settlement(this.module.ModuleRtask, session, mart.Pillar3, mdata) + settlement(this.module.ModuleRtask, session, mart.Pillar4, mdata) + settlement(this.module.ModuleRtask, session, mart.Pillar5, mdata) this.module.modelMartialhall.Add(session.GetUserId(), mart) } diff --git a/modules/martialhall/core.go b/modules/martialhall/core.go index e02ab8dfb..b5f61180f 100644 --- a/modules/martialhall/core.go +++ b/modules/martialhall/core.go @@ -1,6 +1,7 @@ package martialhall import ( + "go_dreamfactory/comm" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" @@ -8,26 +9,35 @@ import ( ) //结算 -func settlement(pillar *pb.DBPillar, mdata *cfg.GameKungfuMasterworkerData) { +func settlement(rtask comm.IRtask, session comm.IUserSession, pillar *pb.DBPillar, mdata *cfg.GameKungfuMasterworkerData) { if pillar == nil || pillar.State != pb.PillarState_Useing { return } - pillar.Reward += int32(time.Unix(pillar.End, 0).Sub(time.Unix(pillar.Lastbill, 0)).Minutes() * float64(mdata.Exp)) + 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) + } + } //结算 -func check(pillar *pb.DBPillar, mdata *cfg.GameKungfuMasterworkerData) { +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)) { - pillar.Reward += int32(time.Unix(pillar.End, 0).Sub(time.Unix(pillar.Lastbill, 0)).Minutes() * float64(mdata.Exp)) + 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) + } } } diff --git a/modules/martialhall/modelMartialhall.go b/modules/martialhall/modelMartialhall.go index 2f9875221..37b0e44f6 100644 --- a/modules/martialhall/modelMartialhall.go +++ b/modules/martialhall/modelMartialhall.go @@ -128,25 +128,25 @@ func (this *modelMartialhall) checkReddot25(seesion comm.IUserSession) bool { if mdata, err = this.module.configure.getMasterworker(mart.Lv); err != nil { return false } - check(mart.Pillar1, mdata) + check(this.module.ModuleRtask, seesion, mart.Pillar1, mdata) if mart.Pillar1.State == pb.PillarState_Receive { return true } - check(mart.Pillar2, mdata) + check(this.module.ModuleRtask, seesion, mart.Pillar2, mdata) if mart.Pillar2.State == pb.PillarState_Receive { return true } - check(mart.Pillar3, mdata) + check(this.module.ModuleRtask, seesion, mart.Pillar3, mdata) if mart.Pillar3.State == pb.PillarState_Receive { return true } - check(mart.Pillar4, mdata) + check(this.module.ModuleRtask, seesion, mart.Pillar4, mdata) if mart.Pillar4.State == pb.PillarState_Receive { return true } - check(mart.Pillar5, mdata) + check(this.module.ModuleRtask, seesion, mart.Pillar5, mdata) if mart.Pillar5.State == pb.PillarState_Receive { return true }