diff --git a/bin/json/game_initial.json b/bin/json/game_initial.json index 057bbd7da..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 } ] }, @@ -15,7 +15,7 @@ { "a": "attr", "t": "gold", - "n": 50000 + "n": 5000000 } ] }, @@ -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 } ] }, @@ -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 diff --git a/modules/modulebase.go b/modules/modulebase.go index 357de0361..b18d93145 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,21 @@ 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) } } + if len(hero) > 0 { + 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) }