上传武馆训练累计时间加成
This commit is contained in:
parent
af571fb456
commit
49f6ef637a
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user