PushHeroProperty

This commit is contained in:
meixiongfeng 2022-11-04 15:12:38 +08:00
parent e4a1df0700
commit 8a234acafe
6 changed files with 18 additions and 7 deletions

View File

@ -4,20 +4,20 @@
"name": "右屏商人",
"information": "这是一位熊猫商人",
"ico": "action_11001",
"time": 10
"time": 300
},
{
"id": 2,
"name": "上屏商人",
"information": "这是一位波比商人再此",
"ico": "action_11003",
"time": 10
"time": 300
},
{
"id": 3,
"name": "左屏商人",
"information": "这是一位滑板鞋王子",
"ico": "ytx_js_14007",
"time": 10
"time": 300
}
]

View File

@ -61,6 +61,8 @@ type (
QueryCrossHeroinfo(oid string) (hero *pb.DBHero, err error)
GetHeroListByUse(uid string) []*pb.DBHero // 非初始状态的英雄列表
// 推送属性变化
PushHeroProperty(session IUserSession, heros []*pb.DBHero) (err error)
}
//玩家

View File

@ -380,3 +380,9 @@ func (this *Hero) GetHeroListByUse(uid string) []*pb.DBHero {
}
return tmp
}
func (this *Hero) PushHeroProperty(session comm.IUserSession, heros []*pb.DBHero) (err error) {
err = session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: heros})
return
}

View File

@ -35,6 +35,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
return
}
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
for k, v := range req.Items {
if v == 0 { // 过滤数量为0 的消息
@ -48,7 +49,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
if !bSell {
bSell = true
trolltrain.SellCount += 1 // 交易次数+1
if trolltrain.SellCount > dayMaxCount {
if trolltrain.SellCount > aiMaxCount-dayMaxCount {
code = pb.ErrorCode_TrollMaxSellCount // 达到最大交易次数 直接返回
return
}

View File

@ -32,9 +32,9 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
code = pb.ErrorCode_DBError
return
}
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
aiCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
if trolltrain.AiCount <= aiCount { // 小于离线挂机次数可执行
if trolltrain.AiCount <= aiCount-dayMaxCount { // 小于离线挂机次数可执行
this.module.TrollAI(session, trolltrain, aiCount)
}

View File

@ -71,6 +71,7 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
sellPrice = make(map[int32]int32)
now := time.Now().Unix()
trainNum := this.configure.GetTrollMaxTraintNum()
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
maxCoefficient := this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
if maxCoefficient == 0 {
code = pb.ErrorCode_ConfigNoFound
@ -121,7 +122,8 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
this.SeTrollRankList(troll.TotalEarn, session.GetUserId()) // 设置排行数据
troll.AiCount++
if troll.AiCount > aiCount { //达到最大交易次数
if troll.AiCount > aiCount-dayMaxCount { //达到最大交易次数
break
}
}