Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
6a92fe74da
@ -31,12 +31,13 @@ func (this *apiComp) Sweep(session comm.IUserSession, req *pb.VikingSweepReq) (e
|
|||||||
vikingCfg *cfg.GameVikingBossData
|
vikingCfg *cfg.GameVikingBossData
|
||||||
user *pb.DBUser
|
user *pb.DBUser
|
||||||
bWin bool // 战斗是否胜利
|
bWin bool // 战斗是否胜利
|
||||||
atno []*pb.UserAtno // atno 类型
|
rewardatno []*pb.UserAtno // atno 类型
|
||||||
atns []*pb.UserAssets //消耗
|
consumeatns []*pb.UserAssets // 消耗
|
||||||
changExp map[string]int32
|
changExp map[string]int32
|
||||||
heroupaward []*cfg.Gameatn
|
heroupaward []*cfg.Gameatn
|
||||||
reward []*cfg.Gameatn
|
reward []*cfg.Gameatn
|
||||||
consume []*cfg.Gameatn
|
consume []*cfg.Gameatn
|
||||||
|
allconsume []*cfg.Gameatn
|
||||||
|
|
||||||
err error
|
err error
|
||||||
result []*pb.VikingSweepResult
|
result []*pb.VikingSweepResult
|
||||||
@ -137,21 +138,28 @@ func (this *apiComp) Sweep(session comm.IUserSession, req *pb.VikingSweepReq) (e
|
|||||||
}
|
}
|
||||||
if !bWin { // 战斗失败了 直接返回
|
if !bWin { // 战斗失败了 直接返回
|
||||||
consume = append(consume, conf.LoseCost...)
|
consume = append(consume, conf.LoseCost...)
|
||||||
consume = append(consume, this.module.ModuleUser.PsConvertExp(ps))
|
reward = append(reward, this.module.ModuleUser.PsConvertExp(ps))
|
||||||
for _, v := range consume {
|
for _, v := range consume {
|
||||||
atns = append(atns, &pb.UserAssets{
|
consumeatns = append(consumeatns, &pb.UserAssets{
|
||||||
A: v.A,
|
A: v.A,
|
||||||
T: v.T,
|
T: v.T,
|
||||||
N: v.N,
|
N: v.N,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//发放资源
|
||||||
|
if errdata, rewardatno = this.module.DispenseAtno(session, reward, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
result = append(result, &pb.VikingSweepResult{
|
result = append(result, &pb.VikingSweepResult{
|
||||||
Battleid: v.Info.Id,
|
Battleid: v.Info.Id,
|
||||||
Iswin: false,
|
Iswin: false,
|
||||||
Consume: atns,
|
Consume: consumeatns,
|
||||||
Rounds: v.Round,
|
Rounds: v.Round,
|
||||||
|
Award: rewardatno,
|
||||||
})
|
})
|
||||||
totalps += ps
|
totalps += ps
|
||||||
|
allconsume = append(allconsume, consume...)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
for _, v := range vikingCfg.PsConsume {
|
for _, v := range vikingCfg.PsConsume {
|
||||||
@ -189,40 +197,38 @@ func (this *apiComp) Sweep(session comm.IUserSession, req *pb.VikingSweepReq) (e
|
|||||||
}
|
}
|
||||||
reward = append(reward, heroupaward...)
|
reward = append(reward, heroupaward...)
|
||||||
}
|
}
|
||||||
//消耗资源
|
|
||||||
if errdata = this.module.ConsumeRes(session, consume, true); errdata != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
//发放资源
|
//发放资源
|
||||||
if errdata, atno = this.module.DispenseAtno(session, reward, true); errdata != nil {
|
if errdata, rewardatno = this.module.DispenseAtno(session, reward, true); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype73, 1, req.BossId, req.Difficulty))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype73, 1, req.BossId, req.Difficulty))
|
||||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype78, req.BossId, v.Costtime, req.Difficulty))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype78, req.BossId, v.Costtime, req.Difficulty))
|
||||||
|
|
||||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype76, 1, req.BossId))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype76, 1, req.BossId))
|
||||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype77, 1, req.BossId, req.Difficulty))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype77, 1, req.BossId, req.Difficulty))
|
||||||
|
|
||||||
for _, v := range consume {
|
for _, v := range consume {
|
||||||
atns = append(atns, &pb.UserAssets{
|
consumeatns = append(consumeatns, &pb.UserAssets{
|
||||||
A: v.A,
|
A: v.A,
|
||||||
T: v.T,
|
T: v.T,
|
||||||
N: v.N,
|
N: v.N,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
result = append(result, &pb.VikingSweepResult{
|
result = append(result, &pb.VikingSweepResult{
|
||||||
Battleid: v.Info.Id,
|
Battleid: v.Info.Id,
|
||||||
Iswin: true,
|
Iswin: true,
|
||||||
Rounds: v.Round,
|
Rounds: v.Round,
|
||||||
Consume: atns,
|
Consume: consumeatns,
|
||||||
Award: atno,
|
Award: rewardatno,
|
||||||
Heroexp: changExp,
|
Heroexp: changExp,
|
||||||
})
|
})
|
||||||
|
allconsume = append(allconsume, consume...)
|
||||||
}
|
}
|
||||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype248, totalps, vikingCfg.Copytype))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype248, totalps, vikingCfg.Copytype))
|
||||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype237, totalps))
|
|
||||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype201, totalps))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype201, totalps))
|
||||||
|
//消耗资源
|
||||||
|
if errdata = this.module.ConsumeRes(session, allconsume, true); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingSweepResp{
|
session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingSweepResp{
|
||||||
Result: result,
|
Result: result,
|
||||||
})
|
})
|
||||||
@ -230,7 +236,7 @@ func (this *apiComp) Sweep(session comm.IUserSession, req *pb.VikingSweepReq) (e
|
|||||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem14, nil, req.BossId, req.Difficulty, user.Name)
|
this.chat.SendSysChatToWorld(session, comm.ChatSystem14, nil, req.BossId, req.Difficulty, user.Name)
|
||||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "VikingChallengeOverReq", atno)
|
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "VikingChallengeOverReq", rewardatno)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user