From 8b24855232653fe088e760b6e71f4b69a54aa434 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 8 Feb 2023 12:01:52 +0800 Subject: [PATCH] =?UTF-8?q?GM=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/comp_configure.go | 19 +++++++++++++++ modules/gm/module.go | 47 +++++++++++++++++++++++------------- modules/hero/api_drawCard.go | 5 ++-- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/modules/comp_configure.go b/modules/comp_configure.go index ee5bf526a..03eff39b1 100644 --- a/modules/comp_configure.go +++ b/modules/comp_configure.go @@ -354,3 +354,22 @@ func (this *MCompConfigure) GetEquipmentConfigureById(equipmentId string) (confi } return } +func (this *MCompConfigure) GetAllItemConfigure() (item []*cfg.GameItemData) { + if v, err := this.GetConfigure(game_item); err == nil { + for _, v1 := range v.(*cfg.GameItem).GetDataMap() { + item = append(item, v1) + } + } + return +} + +func (this *MCompConfigure) GetAllEquipmentConfigure(equipmentId string) (configure []*cfg.GameEquipData) { + + if v, err := this.GetConfigure(game_equip); err == nil { + for _, v1 := range v.(*cfg.GameEquip).GetDataMap() { + configure = append(configure, v1) + } + return + } + return +} diff --git a/modules/gm/module.go b/modules/gm/module.go index a5708bbeb..36aa43755 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -111,25 +111,38 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC var ( res []*cfg.Gameatn ) - if val, err := this.configure.GetYouDaddyConf(); err == nil { - for _, v := range val.GetDataList() { - res = append(res, v.Var...) + equip := this.configure.GetAllItemConfigure() + for _, v1 := range equip { + + res = append(res, &cfg.Gameatn{ + A: "equi", + T: v1.Id, + N: 1, + }) + } + data := this.configure.GetHeroConfigData() + for _, v := range data { + if v.Handbook != -1 { + res = append(res, &cfg.Gameatn{ + A: "hero", + T: v.Hid, + N: 1, + }) } - data := this.configure.GetHeroConfigData() - for _, v := range data { - if v.Handbook != -1 { - res = append(res, &cfg.Gameatn{ - A: "hero", - T: v.Hid, - N: 1, - }) - } - } - code = this.DispenseRes(session, res, true) - if code != pb.ErrorCode_Success { - this.Errorf("资源发放失败,%v", code) - } + } + // 发所有道具 + item := this.configure.GetAllItemConfigure() + for _, v := range item { + res = append(res, &cfg.Gameatn{ + A: "item", + T: v.Id, + N: 100, + }) + } + code = this.DispenseRes(session, res, true) + if code != pb.ErrorCode_Success { + this.Errorf("资源发放失败,%v", code) } this.Debug("使用bingo命令", log.Field{Key: "uid", Value: session.GetUserId()}, diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 086390902..0e7d3c05d 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -336,8 +336,9 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq N: 1, } if code, atno := this.module.DispenseAtno(session, []*cfg.Gameatn{res}, true); code == pb.ErrorCode_Success { - var list *pb.AtnoData - list.Atno = atno + + list := &pb.AtnoData{} + list.Atno = append(list.Atno, atno...) rsp.Data = append(rsp.Data, list) for _, v := range atno { if v.A == "hero" {