优化 抽卡获得顺序问题

This commit is contained in:
meixiongfeng 2023-06-13 12:27:42 +08:00
parent 0f8384554b
commit 34df1dbb35

View File

@ -321,27 +321,25 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
rsp := &pb.HeroDrawCardResp{ rsp := &pb.HeroDrawCardResp{
Data: []*pb.AtnoData{}, Data: []*pb.AtnoData{},
} }
var addRes []*cfg.Gameatn
for _, heroId := range szCards { for _, heroId := range szCards {
addRes = append(addRes, &cfg.Gameatn{
if errdata, atno = this.module.DispenseAtno(session, []*cfg.Gameatn{{
A: "hero", A: "hero",
T: heroId, T: heroId,
N: 1, N: 1,
}) }}, true); errdata == nil {
}
if errdata, atno = this.module.DispenseAtno(session, addRes, true); errdata == nil { rsp.Data = append(rsp.Data, &pb.AtnoData{Atno: atno})
for _, v := range atno {
rsp.Data = append(rsp.Data, &pb.AtnoData{Atno: atno}) if v.A == "hero" && v.N == 1 {
for _, v := range atno { if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄
if v.A == "hero" && v.N == 1 { this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, v.T)
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄 }
this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, v.T)
} }
} }
} else {
return
} }
} else {
return
} }
session.SendMsg(string(this.module.GetType()), DrawCard, rsp) session.SendMsg(string(this.module.GetType()), DrawCard, rsp)