diff --git a/bin/json/game_trolltrain.json b/bin/json/game_trolltrain.json index d776fd32f..f0b1873b5 100644 --- a/bin/json/game_trolltrain.json +++ b/bin/json/game_trolltrain.json @@ -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 } ] \ No newline at end of file diff --git a/comm/imodule.go b/comm/imodule.go index ab3b6ca78..9d3fcbaa3 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -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) } //玩家 diff --git a/modules/hero/module.go b/modules/hero/module.go index 00dbaa26d..7585ae760 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -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 +} diff --git a/modules/troll/api_buyorsell.go b/modules/troll/api_buyorsell.go index e365b7952..269796638 100644 --- a/modules/troll/api_buyorsell.go +++ b/modules/troll/api_buyorsell.go @@ -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 } diff --git a/modules/troll/api_getlist.go b/modules/troll/api_getlist.go index 7841ed68f..366ac92cc 100644 --- a/modules/troll/api_getlist.go +++ b/modules/troll/api_getlist.go @@ -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) } diff --git a/modules/troll/module.go b/modules/troll/module.go index 68b447ad4..1b0731213 100644 --- a/modules/troll/module.go +++ b/modules/troll/module.go @@ -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 } }