订单优化+ 道具使用类型
This commit is contained in:
parent
b9b4cb0909
commit
4078349cc9
@ -707,3 +707,8 @@ const (
|
|||||||
MainStarType2 = 1 //死亡人数不超过{0}人
|
MainStarType2 = 1 //死亡人数不超过{0}人
|
||||||
MainStarType3 = 1 //不超过{0}回合通关
|
MainStarType3 = 1 //不超过{0}回合通关
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
UseType1 int32 = 1 //英雄碎片
|
||||||
|
UseType8 int32 = 8 //觉醒材料合成
|
||||||
|
)
|
||||||
|
@ -87,13 +87,8 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet)
|
|||||||
|
|
||||||
// 有订单在做
|
// 有订单在做
|
||||||
zeroTime = utils.GetTodayZeroTime(configure.Now().Unix())
|
zeroTime = utils.GetTodayZeroTime(configure.Now().Unix())
|
||||||
for {
|
|
||||||
if gourmet.CookingFood != nil {
|
if (gourmet.CookingFood != nil && gourmet.CookingFood.ETime >= configure.Now().Unix()) || gourmet.CookingFood == nil {
|
||||||
if configure.Now().Unix() < gourmet.CookingFood.ETime {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bRet := false
|
|
||||||
for _, order := range gourmet.Foods {
|
for _, order := range gourmet.Foods {
|
||||||
_gourmetcfg := this.module.configure.GetGourmetConfigData(order.FoodType, gourmet.Skill[order.FoodType]) // 美食家配置表
|
_gourmetcfg := this.module.configure.GetGourmetConfigData(order.FoodType, gourmet.Skill[order.FoodType]) // 美食家配置表
|
||||||
if order.FoodCount > 0 {
|
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.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Propsgroup, gourmet.Items) // 获取掉落奖励
|
||||||
// 记录下订单时间
|
// 记录下订单时间
|
||||||
gourmet.Ctime = gourmet.CookingFood.ETime
|
gourmet.Ctime = gourmet.CookingFood.ETime
|
||||||
mapData["ctime"] = gourmet.Ctime
|
|
||||||
bRet = true
|
|
||||||
gourmet.TotalTime += szTime[order.FoodType]
|
gourmet.TotalTime += szTime[order.FoodType]
|
||||||
mapData["totalTime"] = gourmet.TotalTime
|
|
||||||
//break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !bRet { // 没有订单可以做
|
|
||||||
if gourmet.CookingFood != nil {
|
if gourmet.CookingFood != nil && gourmet.CookingFood.ETime <= configure.Now().Unix() {
|
||||||
if gourmet.CookingFood.ETime <= configure.Now().Unix() {
|
_gourmetcfg := this.module.configure.GetGourmetConfigData(gourmet.CookingFood.FoodType, gourmet.Skill[gourmet.CookingFood.FoodType])
|
||||||
_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.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Propsgroup, gourmet.Items)
|
gourmet.CookingFood = nil
|
||||||
gourmet.CookingFood = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,9 +144,9 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet)
|
|||||||
mapData["foods"] = gourmet.Foods
|
mapData["foods"] = gourmet.Foods
|
||||||
mapData["orderCostTime"] = gourmet.OrderCostTime
|
mapData["orderCostTime"] = gourmet.OrderCostTime
|
||||||
mapData["cookingFood"] = gourmet.CookingFood // 正在做的
|
mapData["cookingFood"] = gourmet.CookingFood // 正在做的
|
||||||
|
mapData["totalTime"] = gourmet.TotalTime
|
||||||
|
mapData["ctime"] = gourmet.Ctime
|
||||||
this.module.ModifyGourmetData(uid, mapData) // 同步数据
|
this.module.ModifyGourmetData(uid, mapData) // 同步数据
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 技能等级提高了 重新计算订单时间(只对订单中数据有影响)
|
// 技能等级提高了 重新计算订单时间(只对订单中数据有影响)
|
||||||
|
@ -114,7 +114,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
|||||||
// 狩猎副本掉落觉醒材料
|
// 狩猎副本掉落觉醒材料
|
||||||
for _, v := range reward {
|
for _, v := range reward {
|
||||||
if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil {
|
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)
|
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 {
|
if newChallenge && bWin {
|
||||||
for _, v := range cfgHunting.Firstprize {
|
for _, v := range cfgHunting.Firstprize {
|
||||||
if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil {
|
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)
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype154, v.N)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch itemcf.Usetype {
|
switch itemcf.Usetype {
|
||||||
case 1: //英雄碎片
|
case comm.UseType1: //英雄碎片
|
||||||
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
@ -122,7 +122,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 8: //觉醒材料合成
|
case comm.UseType8: //觉醒材料合成
|
||||||
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
|
@ -78,18 +78,13 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) {
|
|||||||
|
|
||||||
// 有订单在做
|
// 有订单在做
|
||||||
zeroTime = utils.GetTodayZeroTime(configure.Now().Unix())
|
zeroTime = utils.GetTodayZeroTime(configure.Now().Unix())
|
||||||
for {
|
|
||||||
if smithy.Clang != nil {
|
if (smithy.Clang != nil && smithy.Clang.ETime >= configure.Now().Unix()) || smithy.Clang == nil {
|
||||||
if configure.Now().Unix() < smithy.Clang.ETime {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bRet := false
|
|
||||||
for _, order := range smithy.Orders {
|
for _, order := range smithy.Orders {
|
||||||
_gourmetcfg := this.module.configure.GetSmithyConfigData(order.DeskType, smithy.Skill[order.DeskType]) // 美食家配置表
|
_gourmetcfg := this.module.configure.GetSmithyConfigData(order.DeskType, smithy.Skill[order.DeskType]) // 美食家配置表
|
||||||
|
|
||||||
if order.Count > 0 {
|
if order.Count > 0 {
|
||||||
if smithy.Clang.ETime > configure.Now().Unix() {
|
if smithy.Clang != nil && smithy.Clang.ETime > configure.Now().Unix() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
order.Count--
|
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.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Drop, smithy.Items) // 获取掉落奖励
|
||||||
// 记录下订单时间
|
// 记录下订单时间
|
||||||
smithy.Ctime = smithy.Clang.ETime
|
smithy.Ctime = smithy.Clang.ETime
|
||||||
mapData["ctime"] = smithy.Ctime
|
|
||||||
bRet = true
|
|
||||||
smithy.TotalTime += szTime[order.DeskType]
|
smithy.TotalTime += szTime[order.DeskType]
|
||||||
mapData["totalTime"] = smithy.TotalTime
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !bRet { // 没有订单可以做
|
|
||||||
if smithy.Clang != nil {
|
if smithy.Clang != nil && smithy.Clang.ETime <= configure.Now().Unix() {
|
||||||
if smithy.Clang.ETime <= configure.Now().Unix() {
|
_gourmetcfg := this.module.configure.GetSmithyConfigData(smithy.Clang.DeskType, smithy.Skill[smithy.Clang.DeskType])
|
||||||
_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.Items = this.module.configure.GetMultipleDropReward(_gourmetcfg.Using, _gourmetcfg.Drop, smithy.Items)
|
smithy.Clang = nil
|
||||||
smithy.Clang = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清除数量为0 的订单
|
// 清除数量为0 的订单
|
||||||
pos := 0
|
pos := 0
|
||||||
for _, order := range smithy.Orders {
|
for _, order := range smithy.Orders {
|
||||||
@ -154,7 +143,8 @@ func (this *modelSmithy) CalculationSmithy(uid string, smithy *pb.DBSmithy) {
|
|||||||
mapData["orders"] = smithy.Orders
|
mapData["orders"] = smithy.Orders
|
||||||
mapData["orderCostTime"] = smithy.OrderCostTime
|
mapData["orderCostTime"] = smithy.OrderCostTime
|
||||||
mapData["clang"] = smithy.Clang // 正在做的
|
mapData["clang"] = smithy.Clang // 正在做的
|
||||||
|
mapData["ctime"] = smithy.Ctime
|
||||||
|
mapData["totalTime"] = smithy.TotalTime
|
||||||
this.module.ModifySmithyData(uid, mapData) // 同步数据
|
this.module.ModifySmithyData(uid, mapData) // 同步数据
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user