Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
5f1ef25006
@ -75,7 +75,7 @@ func (this *apiComp) ActivityBuy(session comm.IUserSession, req *pb.PayActivityB
|
|||||||
|
|
||||||
buynum = info.Activitys[conf.Type].Items[conf.Id].Buyunm
|
buynum = info.Activitys[conf.Type].Items[conf.Id].Buyunm
|
||||||
totalbuy = info.Activitys[conf.Type].Items[conf.Id].Totalbuynum
|
totalbuy = info.Activitys[conf.Type].Items[conf.Id].Totalbuynum
|
||||||
if conf.RepeatNum >= totalbuy || conf.BuyNum >= 0 && buynum >= conf.BuyNum {
|
if conf.RepeatNum <= totalbuy || (conf.BuyNum >= 0 && buynum >= conf.BuyNum) {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ReqParameterError,
|
Code: pb.ErrorCode_ReqParameterError,
|
||||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||||
|
@ -3,6 +3,7 @@ package uniongve
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 参数校验
|
// 参数校验
|
||||||
@ -13,11 +14,44 @@ func (this *apiComp) RouletteCheck(session comm.IUserSession, req *pb.UniongveRo
|
|||||||
|
|
||||||
// 获取工会 转轮
|
// 获取工会 转轮
|
||||||
func (this *apiComp) Roulette(session comm.IUserSession, req *pb.UniongveRouletteReq) (errdata *pb.ErrorData) {
|
func (this *apiComp) Roulette(session comm.IUserSession, req *pb.UniongveRouletteReq) (errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
confs []*cfg.GameGuildBossRouletteData
|
||||||
|
award []*pb.UserAssets = make([]*pb.UserAssets, 0)
|
||||||
|
weight []int32 = make([]int32, 0)
|
||||||
|
index int32
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
|
||||||
if errdata = this.RouletteCheck(session, req); errdata != nil {
|
if errdata = this.RouletteCheck(session, req); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if confs, err = this.module.configure.getguildbossroulette(); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range confs {
|
||||||
|
weight = append(weight, v.Weight)
|
||||||
|
}
|
||||||
|
|
||||||
|
index = comm.GetRandW(weight)
|
||||||
|
|
||||||
|
for _, v := range confs[index].Reward {
|
||||||
|
award = append(award, &pb.UserAssets{
|
||||||
|
A: v.A,
|
||||||
|
T: v.T,
|
||||||
|
N: v.N,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if errdata = this.module.DispenseRes(session, confs[index].Reward, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), "roulette", &pb.UniongveRouletteResp{})
|
session.SendMsg(string(this.module.GetType()), "roulette", &pb.UniongveRouletteResp{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,25 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取所有难度一的boos
|
||||||
|
func (this *MCompConfigure) getguildbossroulette() (results []*cfg.GameGuildBossRouletteData, err error) {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
)
|
||||||
|
|
||||||
|
if v, err = this.GetConfigure(game_guildbossroulette); err != nil {
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
data, ok := v.(*cfg.GameGuildBossRoulette)
|
||||||
|
if !ok {
|
||||||
|
err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
results = data.GetDataList()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 获取所有难度一的boos
|
// 获取所有难度一的boos
|
||||||
func (this *MCompConfigure) getguildboss() (results []*cfg.GameGuildBossData, err error) {
|
func (this *MCompConfigure) getguildboss() (results []*cfg.GameGuildBossData, err error) {
|
||||||
var (
|
var (
|
||||||
|
Loading…
Reference in New Issue
Block a user