From 9060dc34bc5724bf07a1b54324d761216aa9dfd8 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 22 Jul 2022 21:16:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_initial.json | 42 +++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/bin/json/game_initial.json b/bin/json/game_initial.json index 057bbd7da..b5f6143bf 100644 --- a/bin/json/game_initial.json +++ b/bin/json/game_initial.json @@ -15,7 +15,7 @@ { "a": "attr", "t": "gold", - "n": 50000 + "n": 5000000 } ] }, @@ -118,5 +118,45 @@ "n": 1 } ] + }, + { + "index": "13", + "var": [ + { + "a": "hero", + "t": "42911", + "n": 10 + } + ] + }, + { + "index": "14", + "var": [ + { + "a": "hero", + "t": "43911", + "n": 10 + } + ] + }, + { + "index": "15", + "var": [ + { + "a": "hero", + "t": "44911", + "n": 10 + } + ] + }, + { + "index": "16", + "var": [ + { + "a": "hero", + "t": "43901", + "n": 10 + } + ] } ] \ No newline at end of file From bc8ecfde114a2169a85269185cd981841219f302 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 22 Jul 2022 21:26:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_initial.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/json/game_initial.json b/bin/json/game_initial.json index b5f6143bf..1ad3a3394 100644 --- a/bin/json/game_initial.json +++ b/bin/json/game_initial.json @@ -5,7 +5,7 @@ { "a": "hero", "t": "25001", - "n": 1 + "n": 5 } ] }, @@ -25,7 +25,7 @@ { "a": "hero", "t": "24003", - "n": 1 + "n": 5 } ] }, @@ -35,7 +35,7 @@ { "a": "hero", "t": "25004", - "n": 1 + "n": 5 } ] }, @@ -45,7 +45,7 @@ { "a": "hero", "t": "35002", - "n": 1 + "n": 5 } ] }, From dc2ba181959a36a2c370c457bf62fd76773419c3 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 22 Jul 2022 21:59:05 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=9B=E8=A7=92=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E8=8B=B1=E9=9B=84=E7=9A=84=E6=95=B0=E6=8D=AE=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/modulebase.go | 7 ++++--- modules/user/api_create.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/modulebase.go b/modules/modulebase.go index 357de0361..a85f178b0 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -258,6 +258,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Game_at func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Game_atn, bPush bool) (code pb.ErrorCode) { var ( resID int + hero []*pb.DBHero ) source := &comm.ModuleCallSource{ Module: string(this.module.GetType()), @@ -275,18 +276,18 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Game_a code = this.ModuleItems.AddItem(source, session, int32(resID), v.N, bPush) } else if v.A == comm.HeroType { //卡片资源 resID, _ = strconv.Atoi(v.T) - hero, err := this.ModuleHero.CreateRepeatHero(session.GetUserId(), int32(resID), v.N) + _hero, err := this.ModuleHero.CreateRepeatHero(session.GetUserId(), int32(resID), v.N) if err != nil { code = pb.ErrorCode_HeroMaxCount return } - - session.SendMsg("hero", "change", &pb.HeroChangePush{List: []*pb.DBHero{hero}}) + hero = append(hero, _hero) } else if v.A == comm.EquipmentType { resID, _ = strconv.Atoi(v.T) code = this.ModuleEquipment.AddNewEquipments(source, session, map[int32]uint32{int32(resID): uint32(v.N)}, bPush) } } + session.SendMsg("hero", "change", &pb.HeroChangePush{List: hero}) return } diff --git a/modules/user/api_create.go b/modules/user/api_create.go index ce63016bf..4420c3b65 100644 --- a/modules/user/api_create.go +++ b/modules/user/api_create.go @@ -71,7 +71,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c if val, err := this.module.configure.GetGlobalInitConf(); err == nil { for _, v := range val.GetDataList() { - code = this.module.DispenseRes(session, v.Var, false) + code = this.module.DispenseRes(session, v.Var, true) if code != pb.ErrorCode_Success { this.module.Errorf("资源发放失败,%v", code) } From 1f6222e2bd943e266b6e4a275ec0eecb336c9bcb Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 22 Jul 2022 22:04:32 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E5=8F=91=E6=94=BE=20=E6=9C=89=E6=95=B0=E6=8D=AE=E6=89=8D?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/modulebase.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/modulebase.go b/modules/modulebase.go index a85f178b0..b18d93145 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -287,7 +287,10 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Game_a code = this.ModuleEquipment.AddNewEquipments(source, session, map[int32]uint32{int32(resID): uint32(v.N)}, bPush) } } - session.SendMsg("hero", "change", &pb.HeroChangePush{List: hero}) + if len(hero) > 0 { + session.SendMsg("hero", "change", &pb.HeroChangePush{List: hero}) + } + return }