竞技场特权添加
This commit is contained in:
parent
74b6289258
commit
37c52e4f09
@ -24,6 +24,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (code p
|
||||
info *pb.DBArenaUser
|
||||
challenge *cfg.GameArenaBuyChallengeData
|
||||
need []*cfg.Gameatn
|
||||
maxbuy, vipbuy int
|
||||
err error
|
||||
)
|
||||
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
|
||||
@ -34,18 +35,19 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (code p
|
||||
return
|
||||
}
|
||||
this.module.modelArena.recoverTicket(session, info)
|
||||
// global = this.module.configure.GetGlobalConf()
|
||||
// if info.Ticket+req.BuyNum > global.ArenaTicketMax {
|
||||
// code = pb.ErrorCode_ArenaTicketBuyUp
|
||||
// return
|
||||
// }
|
||||
need = make([]*cfg.Gameatn, 0)
|
||||
for i := int32(0); i < req.BuyNum; i++ {
|
||||
if challenge, err = this.module.configure.GetchallengeData(info.Buynum + i + 1); err != nil {
|
||||
|
||||
if maxbuy, err = this.module.configure.GetchallengeDataCount(); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
if challenge == nil {
|
||||
vipbuy = int(this.module.privilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType5))
|
||||
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 challenge, err = this.module.configure.GetchallengeData(info.Buynum + i + 1); err != nil || challenge == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
|
@ -62,6 +62,20 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
return
|
||||
}
|
||||
|
||||
///获取月之秘境触购买表
|
||||
func (this *configureComp) GetchallengeDataCount() (count int, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_arenabuychallenge); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
} else {
|
||||
count = len(v.(*cfg.GameArenaBuyChallenge).GetDataList())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
///获取月之秘境触购买表
|
||||
func (this *configureComp) GetchallengeData(buynum int32) (result *cfg.GameArenaBuyChallengeData, err error) {
|
||||
var (
|
||||
@ -71,7 +85,13 @@ func (this *configureComp) GetchallengeData(buynum int32) (result *cfg.GameArena
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
} else {
|
||||
result = v.(*cfg.GameArenaBuyChallenge).GetDataMap()[buynum]
|
||||
for _, v := range v.(*cfg.GameArenaBuyChallenge).GetDataList() {
|
||||
if v.Num == buynum {
|
||||
result = v
|
||||
return
|
||||
}
|
||||
result = v
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ type Arena struct {
|
||||
service base.IRPCXService
|
||||
mail comm.Imail
|
||||
battle comm.IBattle
|
||||
privilege comm.IPrivilege
|
||||
api *apiComp
|
||||
configure *configureComp
|
||||
modelArena *modelArena
|
||||
@ -53,6 +54,10 @@ func (this *Arena) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.mail = module.(comm.Imail)
|
||||
if module, err = this.service.GetModule(comm.ModulePrivilege); err != nil {
|
||||
return
|
||||
}
|
||||
this.privilege = module.(comm.IPrivilege)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleArenaRaceSettlement), this.Rpc_ModuleArenaRaceSettlement)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleArenaModifyIntegral), this.Rpc_ModuleArenaModifyIntegral)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user