From 34df1dbb357ea0497f19eafcc945cb4e9ab1faba Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 13 Jun 2023 12:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=8A=BD=E5=8D=A1?= =?UTF-8?q?=E8=8E=B7=E5=BE=97=E9=A1=BA=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_drawCard.go | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 9b54a0469..9607d0188 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -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)