diff --git a/comm/imodule.go b/comm/imodule.go index a60cd1c97..a6d95b127 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -85,6 +85,9 @@ type ( CheckJuexingHeroNum(uid string, juexingLv int32, star int32) int32 //拥有共鸣至N级的英雄 Rtype124 CheckResonaceHeroNum(uid string, resonaceLv int32) int32 + + // 获取所有满星满级满觉醒的英雄 + GetAllMaxHero(session IUserSession) (code pb.ErrorCode) } //玩家 diff --git a/modules/gm/api_cmd.go b/modules/gm/api_cmd.go index 1c785161b..4cadbf4eb 100644 --- a/modules/gm/api_cmd.go +++ b/modules/gm/api_cmd.go @@ -20,6 +20,7 @@ import ( 5、跳过随机任务 bingo:worldtask,1,1001 6、bingo:Iamyoudad 7、bingo:vip,yueka_1,1 // 月卡类型 +8、bingo:manhero */ //参数校验 func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) { diff --git a/modules/gm/module.go b/modules/gm/module.go index 4869d730a..f17951eb6 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -146,7 +146,14 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC this.Error("bingo 世界任务", log.Fields{"params": datas, "err": err.Error()}) } } + } else if len(datas) == 2 && (datas[0] == "manhero") { // 获取满星、等级、觉醒、共鸣技能 + module1, err := this.service.GetModule(comm.ModuleHero) + if err != nil { + return + } + code = module1.(comm.IHero).GetAllMaxHero(session) + this.Debug("使用bingo命令:uid = %s ", log.Fields{"uid": session.GetUserId(), "0": datas[1]}) } } diff --git a/modules/hero/configure_comp.go b/modules/hero/configure_comp.go index 06447c9eb..a980ed335 100644 --- a/modules/hero/configure_comp.go +++ b/modules/hero/configure_comp.go @@ -486,3 +486,15 @@ func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb } return } +func (this *configureComp) GetHeroStargrowConfigByStar(star int32) int32 { + + if v, err := this.GetConfigure(hero_stargrow); err == nil { + if configure, ok := v.(*cfg.GameHeroStargrow); ok { + return configure.Get(star).Maxlevel + } + } else { + err = fmt.Errorf("%T no is *cfg.GameHero", v) + } + + return 1 +} diff --git a/modules/hero/module.go b/modules/hero/module.go index e333180c3..29f041819 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -603,3 +603,74 @@ func (this *Hero) CheckResonaceHeroNum(uid string, resonaceLv int32) int32 { } return int32(len(tmp)) } + +// 获取所有满星满级满觉醒的英雄 +func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) { + data := this.modelHero.moduleHero.configure.GetHeroConfigData() + for _, v := range data { + if v.Handbook != -1 { + cid := v.Hid + maxStar := v.Star + starConf := this.configure.GetHeroStarupConfig(cid, v.Star) + if starConf == nil { + continue // 走到这里说明配置表没有配置数据 + } + // 获取最大星级 + for i := 1; ; i++ { + starConf := this.configure.GetHeroStarupConfig(cid, v.Star+int32(i)) + if starConf == nil { + break + } + if starConf != nil && starConf.Gold == 0 { + maxStar = v.Star + int32(i) + break + } + } + + maxLv := this.configure.GetHeroStargrowConfigByStar(maxStar) // 最大等级 + + maxJux := 1 // 最大觉醒等级 + for i := 1; ; i++ { + data := this.configure.GetHeroAwakenConfig(cid, int32(i)) + if data == nil { + maxJux = i + break + } + } + var maxGongm int32 + conf := this.configure.GetHeroResonanceConfig(cid, v.Star) + if conf != nil { + maxGongm = int32(conf.Maxnum) + } + this.modelHero.moduleHero.Debugf("%d", maxStar, maxLv, maxJux, maxGongm) + // 开始创建英雄 + hero, err := this.modelHero.createOneHero(session.GetUserId(), v.Hid) + if err != nil { + return pb.ErrorCode_HeroCreate + } + hero.Lv = maxLv + hero.Star = maxStar + hero.JuexingLv = int32(maxJux) + hero.ResonateNum = maxGongm + hero.SameCount = 1 + _heroMap := map[string]interface{}{ + "lv": hero.Lv, + "star": hero.Star, + "juexingLv": hero.JuexingLv, + "resonateNum": hero.ResonateNum, + "isOverlying": false, + "sameCount": 1, + } + // 保存数据 + err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap) + if err != nil { + log.Errorf("GetSpecified failed:%v", err) + return + } + this.modelHero.PropertyCompute(hero) // 重新计算属性 + } + } + + return + +} diff --git a/modules/troll/api.go b/modules/troll/api.go index 96ce2fa82..5c61312f0 100644 --- a/modules/troll/api.go +++ b/modules/troll/api.go @@ -6,15 +6,12 @@ import ( ) const ( - TrollGetListResp = "getlist" - TrollBuyOrSellResp = "buyorsell" - GourmetCreateOrderResp = "createorder" - GourmetSkillLvResp = "skilllv" - TrollNpcRewardResp = "npcreward" - GourmetGetRandUserResp = "getranduser" - TrollRankListResp = "ranklist" - TrollRecordListResp = "recordlist" - TrollAfkSetResp = "afkset" + TrollGetListResp = "getlist" + TrollBuyOrSellResp = "buyorsell" + TrollNpcRewardResp = "npcreward" + TrollRankListResp = "ranklist" + TrollRecordListResp = "recordlist" + TrollAfkSetResp = "afkset" ) type apiComp struct { diff --git a/stress/robot/robot.go b/stress/robot/robot.go index 80d28fb46..56fbc4456 100644 --- a/stress/robot/robot.go +++ b/stress/robot/robot.go @@ -349,7 +349,7 @@ func (r Robot) AddGrormetItem() bool { msg := &pb.UserMessage{MainType: mainType, SubType: subType} rsp := &pb.GMCmdReq{ - Cmod: "bingo:item,50001,100", + Cmod: "bingo:item,10002,100", } msg.Sec = r.BuildSecStr() if comm.ProtoMarshal(rsp, msg) { diff --git a/stress/server/dispose.go b/stress/server/dispose.go index 836c97ca3..ed5bc6ac6 100644 --- a/stress/server/dispose.go +++ b/stress/server/dispose.go @@ -4,6 +4,7 @@ package server import ( "context" "fmt" + "go_dreamfactory/pb" "go_dreamfactory/stress/model" "go_dreamfactory/stress/robot" "strconv" @@ -55,6 +56,10 @@ func Dispose(ctx context.Context, concurrency, totalNumber uint64, request *mode // 连接以后再启动协程 r := robot.NewRobot(request.URL) r.SetAccount("00000" + strconv.Itoa(int(i))) + head := &pb.UserMessage{MainType: "user", SubType: "login"} + // 先登录 + r.SendToClient(head, &pb.UserLoginReq{}) + r.AddGrormetItem() go golink.WebSocket(ctx, i, ch, totalNumber, &wg, request, r) case 2: // 并发建立长链接 diff --git a/stress/server/golink/websocket_link.go b/stress/server/golink/websocket_link.go index 9708833fc..3254d21be 100644 --- a/stress/server/golink/websocket_link.go +++ b/stress/server/golink/websocket_link.go @@ -80,20 +80,6 @@ func webSocketRequest(chanID uint64, ch chan<- *model.RequestResults, i uint64, byteLen int64 // 协议传输字节数 ) - // 需要发送的数据 - head := &pb.UserMessage{MainType: "user", SubType: "login"} - - r.SendToClient(head, &pb.UserLoginReq{}) - // 美食馆增加道具 - //time.Sleep(1 * time.Millisecond) - // for { - // if b, len := r.MessageRsp("user", "login"); b { - // byteLen += len - // isSucceed = true - // //errCode, isSucceed = request.GetVerifyWebSocket()(request, "webSocket.pb", r.GetMessagedata()) - // break - // } - // } startTime := time.Now() //r.Create() //isSucceed = r.AddGrormetItem()