上传梦境购买次数特权
This commit is contained in:
parent
d78785fdfd
commit
6580f92a4e
@ -23,6 +23,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.MoonfantasyBuyReq) (
|
|||||||
info *pb.DBUserMFantasy
|
info *pb.DBUserMFantasy
|
||||||
challengeD *cfg.GameDreamlandChallengeData
|
challengeD *cfg.GameDreamlandChallengeData
|
||||||
need []*cfg.Gameatn
|
need []*cfg.Gameatn
|
||||||
|
maxbuy, vipbuy int
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
@ -32,14 +33,21 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.MoonfantasyBuyReq) (
|
|||||||
code = pb.ErrorCode_CacheReadError
|
code = pb.ErrorCode_CacheReadError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.module.modelUserMF.recoverTicket(session,info)
|
this.module.modelUserMF.recoverTicket(session, info)
|
||||||
need = make([]*cfg.Gameatn, 0)
|
if maxbuy, err = this.module.configure.GetchallengeDataCount(); err != nil {
|
||||||
for i := int32(0); i < req.BuyNum; i++ {
|
|
||||||
if challengeD, err = this.module.configure.GetchallengeData(info.BuyNum + i + 1); err != nil {
|
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if challengeD == nil {
|
vipbuy = int(this.module.privilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType6))
|
||||||
|
|
||||||
|
need = make([]*cfg.Gameatn, 0)
|
||||||
|
for i := int32(0); i < req.BuyNum; i++ {
|
||||||
|
|
||||||
|
if int(info.BuyNum+i+1) > maxbuy+vipbuy {
|
||||||
|
code = pb.ErrorCode_ArenaTicketBuyUp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if challengeD, err = this.module.configure.GetchallengeData(info.BuyNum + i + 1); err != nil || challengeD == nil {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,27 @@ func (this *configureComp) GetchallengeData(buynum int32) (result *cfg.GameDream
|
|||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
result = v.(*cfg.GameDreamlandChallenge).GetDataMap()[buynum]
|
for _, v := range v.(*cfg.GameDreamlandChallenge).GetDataList() {
|
||||||
|
if v.Buynum == buynum {
|
||||||
|
result = v
|
||||||
|
return
|
||||||
|
}
|
||||||
|
result = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///获取月之秘境触购买表
|
||||||
|
func (this *configureComp) GetchallengeDataCount() (count int, err error) {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
)
|
||||||
|
if v, err = this.GetConfigure(game_dreamlandchallenge); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
count = len(v.(*cfg.GameDreamlandChallenge).GetDataList())
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ type Moonfantasy struct {
|
|||||||
chat comm.IChat
|
chat comm.IChat
|
||||||
friend comm.IFriend
|
friend comm.IFriend
|
||||||
battle comm.IBattle
|
battle comm.IBattle
|
||||||
|
privilege comm.IPrivilege
|
||||||
api_comp *apiComp
|
api_comp *apiComp
|
||||||
configure *configureComp
|
configure *configureComp
|
||||||
modelDream *modelDreamComp
|
modelDream *modelDreamComp
|
||||||
@ -65,6 +66,10 @@ func (this *Moonfantasy) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.battle = module.(comm.IBattle)
|
this.battle = module.(comm.IBattle)
|
||||||
|
if module, err = this.service.GetModule(comm.ModulePrivilege); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.privilege = module.(comm.IPrivilege)
|
||||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTrigger), this.Rpc_ModuleMoonfantasyTrigger)
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTrigger), this.Rpc_ModuleMoonfantasyTrigger)
|
||||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTriggerMF), this.Rpc_ModuleMoonfantasyTriggerMF)
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTriggerMF), this.Rpc_ModuleMoonfantasyTriggerMF)
|
||||||
event.RegisterGO(comm.EventOpenCond, this.EventOpenCond)
|
event.RegisterGO(comm.EventOpenCond, this.EventOpenCond)
|
||||||
|
Loading…
Reference in New Issue
Block a user