竞技场特权添加
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
|
info *pb.DBArenaUser
|
||||||
challenge *cfg.GameArenaBuyChallengeData
|
challenge *cfg.GameArenaBuyChallengeData
|
||||||
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 {
|
||||||
@ -34,18 +35,19 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (code p
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.module.modelArena.recoverTicket(session, info)
|
this.module.modelArena.recoverTicket(session, info)
|
||||||
// global = this.module.configure.GetGlobalConf()
|
|
||||||
// if info.Ticket+req.BuyNum > global.ArenaTicketMax {
|
if maxbuy, err = this.module.configure.GetchallengeDataCount(); err != nil {
|
||||||
// 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 {
|
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
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
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,20 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
return
|
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) {
|
func (this *configureComp) GetchallengeData(buynum int32) (result *cfg.GameArenaBuyChallengeData, err error) {
|
||||||
var (
|
var (
|
||||||
@ -71,7 +85,13 @@ func (this *configureComp) GetchallengeData(buynum int32) (result *cfg.GameArena
|
|||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
result = v.(*cfg.GameArenaBuyChallenge).GetDataMap()[buynum]
|
for _, v := range v.(*cfg.GameArenaBuyChallenge).GetDataList() {
|
||||||
|
if v.Num == buynum {
|
||||||
|
result = v
|
||||||
|
return
|
||||||
|
}
|
||||||
|
result = v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ type Arena struct {
|
|||||||
service base.IRPCXService
|
service base.IRPCXService
|
||||||
mail comm.Imail
|
mail comm.Imail
|
||||||
battle comm.IBattle
|
battle comm.IBattle
|
||||||
|
privilege comm.IPrivilege
|
||||||
api *apiComp
|
api *apiComp
|
||||||
configure *configureComp
|
configure *configureComp
|
||||||
modelArena *modelArena
|
modelArena *modelArena
|
||||||
@ -53,6 +54,10 @@ func (this *Arena) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.mail = module.(comm.Imail)
|
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_ModuleArenaRaceSettlement), this.Rpc_ModuleArenaRaceSettlement)
|
||||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleArenaModifyIntegral), this.Rpc_ModuleArenaModifyIntegral)
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleArenaModifyIntegral), this.Rpc_ModuleArenaModifyIntegral)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user