diff --git a/comm/const.go b/comm/const.go index 11076b185..7c3aff126 100644 --- a/comm/const.go +++ b/comm/const.go @@ -707,3 +707,8 @@ const ( MainStarType2 = 1 //死亡人数不超过{0}人 MainStarType3 = 1 //不超过{0}回合通关 ) + +const ( + UseType1 int32 = 1 //英雄碎片 + UseType8 int32 = 8 //觉醒材料合成 +) diff --git a/modules/gourmet/model_gourmet.go b/modules/gourmet/model_gourmet.go index c544d8e73..06dce9310 100644 --- a/modules/gourmet/model_gourmet.go +++ b/modules/gourmet/model_gourmet.go @@ -87,13 +87,8 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet) // 有订单在做 zeroTime = utils.GetTodayZeroTime(configure.Now().Unix()) - for { - if gourmet.CookingFood != nil { - if configure.Now().Unix() < gourmet.CookingFood.ETime { - break - } - } - bRet := false + + if (gourmet.CookingFood != nil && gourmet.CookingFood.ETime >= configure.Now().Unix()) || gourmet.CookingFood == nil { for _, order := range gourmet.Foods { _gourmetcfg := this.module.configure.GetGourmetConfigData(order.FoodType, gourmet.Skill[order.FoodType]) // 美食家配置表 if order.FoodCount > 0 { @@ -133,22 +128,14 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet) gourmet.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Propsgroup, gourmet.Items) // 获取掉落奖励 // 记录下订单时间 gourmet.Ctime = gourmet.CookingFood.ETime - mapData["ctime"] = gourmet.Ctime - bRet = true gourmet.TotalTime += szTime[order.FoodType] - mapData["totalTime"] = gourmet.TotalTime - //break } } - if !bRet { // 没有订单可以做 - if gourmet.CookingFood != nil { - if gourmet.CookingFood.ETime <= configure.Now().Unix() { - _gourmetcfg := this.module.configure.GetGourmetConfigData(gourmet.CookingFood.FoodType, gourmet.Skill[gourmet.CookingFood.FoodType]) - gourmet.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Propsgroup, gourmet.Items) - gourmet.CookingFood = nil - } - } - break + + if gourmet.CookingFood != nil && gourmet.CookingFood.ETime <= configure.Now().Unix() { + _gourmetcfg := this.module.configure.GetGourmetConfigData(gourmet.CookingFood.FoodType, gourmet.Skill[gourmet.CookingFood.FoodType]) + gourmet.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Propsgroup, gourmet.Items) + gourmet.CookingFood = nil } } @@ -157,9 +144,9 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet) mapData["foods"] = gourmet.Foods mapData["orderCostTime"] = gourmet.OrderCostTime mapData["cookingFood"] = gourmet.CookingFood // 正在做的 - + mapData["totalTime"] = gourmet.TotalTime + mapData["ctime"] = gourmet.Ctime this.module.ModifyGourmetData(uid, mapData) // 同步数据 - } // 技能等级提高了 重新计算订单时间(只对订单中数据有影响) diff --git a/modules/hunting/api_challengeover.go b/modules/hunting/api_challengeover.go index 4b79fd0ad..7c28a040f 100644 --- a/modules/hunting/api_challengeover.go +++ b/modules/hunting/api_challengeover.go @@ -114,7 +114,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha // 狩猎副本掉落觉醒材料 for _, v := range reward { if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil { - if _conf.Usetype == 8 { + if _conf.Usetype == comm.UseType8 { this.module.ModuleRtask.SendToRtask(session, comm.Rtype154, v.N) } } @@ -122,7 +122,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha if newChallenge && bWin { for _, v := range cfgHunting.Firstprize { if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil { - if _conf.Usetype == 8 { + if _conf.Usetype == comm.UseType8 { this.module.ModuleRtask.SendToRtask(session, comm.Rtype154, v.N) } } diff --git a/modules/items/api_useItem.go b/modules/items/api_useItem.go index db6356281..f39d7f3f0 100644 --- a/modules/items/api_useItem.go +++ b/modules/items/api_useItem.go @@ -37,7 +37,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq) return } switch itemcf.Usetype { - case 1: //英雄碎片 + case comm.UseType1: //英雄碎片 if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil { code = pb.ErrorCode_ConfigNoFound return @@ -122,7 +122,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq) return } break - case 8: //觉醒材料合成 + case comm.UseType8: //觉醒材料合成 if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil { code = pb.ErrorCode_ConfigNoFound return diff --git a/modules/smithy/model_smithy.go b/modules/smithy/model_smithy.go index d021e146b..728863f21 100644 --- a/modules/smithy/model_smithy.go +++ b/modules/smithy/model_smithy.go @@ -78,18 +78,13 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) { // 有订单在做 zeroTime = utils.GetTodayZeroTime(configure.Now().Unix()) - for { - if smithy.Clang != nil { - if configure.Now().Unix() < smithy.Clang.ETime { - break - } - } - bRet := false + + if (smithy.Clang != nil && smithy.Clang.ETime >= configure.Now().Unix()) || smithy.Clang == nil { for _, order := range smithy.Orders { _gourmetcfg := this.module.configure.GetSmithyConfigData(order.DeskType, smithy.Skill[order.DeskType]) // 美食家配置表 if order.Count > 0 { - if smithy.Clang.ETime > configure.Now().Unix() { + if smithy.Clang != nil && smithy.Clang.ETime > configure.Now().Unix() { break } order.Count-- @@ -124,23 +119,17 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) { smithy.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Drop, smithy.Items) // 获取掉落奖励 // 记录下订单时间 smithy.Ctime = smithy.Clang.ETime - mapData["ctime"] = smithy.Ctime - bRet = true smithy.TotalTime += szTime[order.DeskType] - mapData["totalTime"] = smithy.TotalTime } } - if !bRet { // 没有订单可以做 - if smithy.Clang != nil { - if smithy.Clang.ETime <= configure.Now().Unix() { - _gourmetcfg := this.module.configure.GetSmithyConfigData(smithy.Clang.DeskType, smithy.Skill[smithy.Clang.DeskType]) - smithy.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Drop, smithy.Items) - smithy.Clang = nil - } - } - break + + if smithy.Clang != nil && smithy.Clang.ETime <= configure.Now().Unix() { + _gourmetcfg := this.module.configure.GetSmithyConfigData(smithy.Clang.DeskType, smithy.Skill[smithy.Clang.DeskType]) + smithy.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Drop, smithy.Items) + smithy.Clang = nil } } + // 清除数量为0 的订单 pos := 0 for _, order := range smithy.Orders { @@ -154,7 +143,8 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) { mapData["orders"] = smithy.Orders mapData["orderCostTime"] = smithy.OrderCostTime mapData["clang"] = smithy.Clang // 正在做的 - + mapData["ctime"] = smithy.Ctime + mapData["totalTime"] = smithy.TotalTime this.module.ModifySmithyData(uid, mapData) // 同步数据 }