Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
222a70f553
@ -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)
|
||||
}
|
||||
|
||||
//玩家
|
||||
|
@ -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) {
|
||||
|
@ -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]})
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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:
|
||||
// 并发建立长链接
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user