Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
cc710d851f
@ -905,6 +905,7 @@ const (
|
||||
Rtype232 TaskType = 232 // 种族塔通关x阵营x层
|
||||
Rtype234 TaskType = 234 // 完成多次捕羊大赛
|
||||
Rtype235 TaskType = 235 // 指定X龙的等级达到Y级
|
||||
Rtype236 TaskType = 236 // 购买X章的商店物品数量达到Y件
|
||||
)
|
||||
const (
|
||||
MailLineEasy int32 = 1 // 简单
|
||||
|
@ -152,7 +152,7 @@ type (
|
||||
// 检查圣桃树奖励是否发放
|
||||
CheckPeachReward(session IUserSession, ctime int64)
|
||||
|
||||
CreateOneHero(session IUserSession, heroCfgId string, bPush bool) (hero *pb.DBHero, atno []*pb.UserAtno, errdata *pb.ErrorData)
|
||||
CreateOneHero(session IUserSession, heroCfgId string) (hero *pb.DBHero, atno []*pb.UserAtno, errdata *pb.ErrorData)
|
||||
}
|
||||
|
||||
//玩家
|
||||
|
@ -104,7 +104,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
var hero *pb.DBHero
|
||||
firstGet[heroRecord.WishHero] = false
|
||||
|
||||
if hero, atno, errdata = this.module.ModuleHero.CreateOneHero(session, heroRecord.WishHero, true); errdata == nil {
|
||||
if hero, atno, errdata = this.module.ModuleHero.CreateOneHero(session, heroRecord.WishHero); errdata == nil {
|
||||
for _, v := range atno {
|
||||
if v.A == "hero" && v.T == heroRecord.WishHero && v.N == 1 {
|
||||
firstGet[heroRecord.WishHero] = true
|
||||
@ -347,7 +347,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
|
||||
firstGet[heroId] = false
|
||||
var atno []*pb.UserAtno
|
||||
if hero, atno, errdata = this.module.ModuleHero.CreateOneHero(session, heroId, true); errdata == nil {
|
||||
if hero, atno, errdata = this.module.ModuleHero.CreateOneHero(session, heroId); errdata == nil {
|
||||
for _, v := range atno {
|
||||
if v.A == "hero" && v.T == heroId && v.N == 1 {
|
||||
firstGet[heroId] = true
|
||||
|
@ -721,15 +721,14 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 创建一条英雄信息,如果有这个英雄 则转换成对应的碎片
|
||||
func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, err error) {
|
||||
func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, atno []*pb.UserAtno, err error) {
|
||||
heros := make([]*pb.DBHero, 0)
|
||||
uid := session.GetUserId()
|
||||
heroCfg, _ := this.module.configure.GetHeroConfig(heroCfgId)
|
||||
|
||||
bFirst := true
|
||||
if heroCfg == nil {
|
||||
err = errors.New("not found hero configID")
|
||||
this.module.Errorf("not found hero configID:%s", heroCfgId)
|
||||
@ -750,7 +749,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
}
|
||||
bFirst = true
|
||||
|
||||
for _, obj := range heros {
|
||||
if obj.HeroID == heroCfgId {
|
||||
hero = obj
|
||||
@ -764,6 +763,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if bFirst { // 没有当前英雄
|
||||
count -= 1
|
||||
hero, err = this.initHeroOverlying(uid, heroCfgId, 1)
|
||||
@ -805,7 +805,6 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
||||
}
|
||||
}
|
||||
if bAdd {
|
||||
|
||||
res = append(res, heroCfg.Herofrag...)
|
||||
for _, v := range heroCfg.Herofrag {
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
@ -858,9 +857,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if bChange {
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
|
@ -94,7 +94,7 @@ func (this *Hero) Start() (err error) {
|
||||
}
|
||||
|
||||
// 创建单个叠加英雄
|
||||
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, errdata *pb.ErrorData) {
|
||||
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, atno []*pb.UserAtno, errdata *pb.ErrorData) {
|
||||
var (
|
||||
err error
|
||||
tasks []*pb.BuriedParam
|
||||
@ -107,11 +107,14 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
hero, bFirst, atno, err = this.modelHero.createHero(session, heroCfgId, num)
|
||||
if err == nil && bFirst {
|
||||
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype228, cfg.Star))
|
||||
return
|
||||
hero, atno, err = this.modelHero.createHero(session, heroCfgId, num)
|
||||
if err == nil {
|
||||
for _, v := range atno {
|
||||
if v.A == "hero" && v.N == 1 {
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype228, cfg.Star))
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
@ -212,24 +215,24 @@ func (this *Hero) EventUserOffline(uid, sessionid string) {
|
||||
// 批量创建多个英雄
|
||||
func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]int32, bPush bool) (atno []*pb.UserAtno, errdata *pb.ErrorData) {
|
||||
var (
|
||||
changeList []*pb.DBHero
|
||||
firstGet []string
|
||||
bFirst bool
|
||||
hero *pb.DBHero
|
||||
szAddHero []string
|
||||
changeList []*pb.DBHero
|
||||
hero *pb.DBHero
|
||||
)
|
||||
for heroCfgId, num := range heros {
|
||||
if num == 0 { // 数量为0 不做处理
|
||||
continue
|
||||
}
|
||||
if hero, bFirst, atno, errdata = this.createRepeatHero(session, heroCfgId, num); errdata != nil {
|
||||
if hero, atno, errdata = this.createRepeatHero(session, heroCfgId, num); errdata != nil {
|
||||
this.Errorf("create hero %s failed", heroCfgId)
|
||||
continue
|
||||
}
|
||||
szAddHero = append(szAddHero, heroCfgId)
|
||||
if bFirst {
|
||||
firstGet = append(firstGet, heroCfgId)
|
||||
changeList = append(changeList, hero)
|
||||
for _, v := range atno {
|
||||
if v.A == "hero" && v.N == 1 {
|
||||
changeList = append(changeList, hero)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if db.IsCross() {
|
||||
@ -237,19 +240,9 @@ func (this *Hero) CreateRepeatHeros(session comm.IUserSession, heros map[string]
|
||||
} else {
|
||||
go this.moduleFetter.AddHerosFetterData(session.GetUserId(), szAddHero)
|
||||
}
|
||||
if bPush { //推送
|
||||
if len(changeList) > 0 {
|
||||
session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeList})
|
||||
}
|
||||
|
||||
// 首次获得英雄 则推送
|
||||
if len(firstGet) > 0 {
|
||||
session.SendMsg("hero", "firstget", &pb.HeroFirstGetPush{
|
||||
HeroId: firstGet,
|
||||
})
|
||||
}
|
||||
if len(changeList) > 0 {
|
||||
session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeList})
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -1016,36 +1009,31 @@ func (this *Hero) AddHerosExp(session comm.IUserSession, heroObjs []string, exp
|
||||
}
|
||||
|
||||
// 获得一个英雄
|
||||
func (this *Hero) CreateOneHero(session comm.IUserSession, heroCfgId string, bPush bool) (hero *pb.DBHero, atno []*pb.UserAtno, errdata *pb.ErrorData) {
|
||||
func (this *Hero) CreateOneHero(session comm.IUserSession, heroCfgId string) (hero *pb.DBHero, atno []*pb.UserAtno, errdata *pb.ErrorData) {
|
||||
var (
|
||||
//hero *pb.DBHero
|
||||
firstGet []string
|
||||
bFirst bool
|
||||
szAddHero []string
|
||||
szAddHero []string
|
||||
changeList []*pb.DBHero
|
||||
)
|
||||
|
||||
if hero, bFirst, atno, errdata = this.createRepeatHero(session, heroCfgId, 1); errdata != nil {
|
||||
if hero, atno, errdata = this.createRepeatHero(session, heroCfgId, 1); errdata != nil {
|
||||
this.Errorf("create hero %s failed", heroCfgId)
|
||||
return
|
||||
}
|
||||
szAddHero = append(szAddHero, heroCfgId)
|
||||
if bFirst {
|
||||
firstGet = append(firstGet, heroCfgId)
|
||||
}
|
||||
|
||||
if db.IsCross() {
|
||||
go this.moduleFetter.SendRpcAddHero(session.GetUserId(), szAddHero, session.GetServiecTag())
|
||||
} else {
|
||||
go this.moduleFetter.AddHerosFetterData(session.GetUserId(), szAddHero) // 异步调用
|
||||
}
|
||||
if bPush { //推送
|
||||
session.SendMsg("hero", "change", &pb.HeroChangePush{List: []*pb.DBHero{hero}})
|
||||
// 首次获得英雄 则推送
|
||||
if len(firstGet) > 0 {
|
||||
session.SendMsg("hero", "firstget", &pb.HeroFirstGetPush{
|
||||
HeroId: firstGet,
|
||||
})
|
||||
for _, v := range atno {
|
||||
if v.A == "hero" && v.N == 1 {
|
||||
changeList = append(changeList, hero)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if len(changeList) > 0 {
|
||||
session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeList})
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ func (this *apiComp) ShopBuy(session comm.IUserSession, req *pb.MainlineShopBuyR
|
||||
shopConf *cfg.GameMainShopItemData
|
||||
bUnlock bool
|
||||
atno []*pb.UserAtno
|
||||
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
|
||||
)
|
||||
bUnlock = true
|
||||
errdata = this.ShopBuyCheck(session, req)
|
||||
@ -87,5 +88,10 @@ func (this *apiComp) ShopBuy(session comm.IUserSession, req *pb.MainlineShopBuyR
|
||||
Info: info,
|
||||
Item: atno,
|
||||
})
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype236, shopConf.Shopid, 1))
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
@ -360,6 +360,8 @@ func (this *configureComp) GetBuffGroupDataByLottery(lotteryId int32, addType in
|
||||
}
|
||||
if v, ok := this.buffLottery[lotteryId]; ok {
|
||||
for i := 1; ; i++ {
|
||||
szW = make([]int32, 0) // 数组初始化
|
||||
sz = make([]*cfg.GameBufflotteryData, 0)
|
||||
for k, v1 := range v { // k buffID v1 cfg.GameBufflotteryData
|
||||
curWt = 0
|
||||
if _, ok := ownerbuff[k]; !ok {
|
||||
|
Loading…
Reference in New Issue
Block a user