优化 抽卡获得顺序问题

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{
Data: []*pb.AtnoData{},
}
var addRes []*cfg.Gameatn
for _, heroId := range szCards {
addRes = append(addRes, &cfg.Gameatn{
if errdata, atno = this.module.DispenseAtno(session, []*cfg.Gameatn{{
A: "hero",
T: heroId,
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 {
if v.A == "hero" && v.N == 1 {
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // 广播 首次获得英雄
this.chat.SendSysChatToWorld(comm.ChatSystem13, nil, 0, 0, user.Name, v.T)
rsp.Data = append(rsp.Data, &pb.AtnoData{Atno: atno})
for _, v := range atno {
if v.A == "hero" && v.N == 1 {
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)