Commit 83987977d497ff32680b4052edbcc5fce07cd12d

Authored by zhangqijia
1 parent 64dd7a6f

fix: 探索加速协议返回值加上错误码, 通用方法优化,

Showing 2 changed files with 6 additions and 5 deletions   Show diff stats
src/actions/HangAction.lua
... ... @@ -471,7 +471,7 @@ function _M.quickRpc(agent , data)
471 471 local role = agent.role
472 472  
473 473 local hangInfo = role:getProperty("hangInfo")
474   - if not hangInfo.carbonId then return end
  474 + if not hangInfo.carbonId then return 1 end
475 475 local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId]
476 476 --local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId]
477 477 local expCarbonData = hangInfo.expData or {}
... ... @@ -480,7 +480,8 @@ function _M.quickRpc(agent , data)
480 480 local curT = curCount * (globalCsv.idle_quickproduce_time / 3600)
481 481 local costCount = table.findMinKeyByItem(globalCsv.idle_quickproduce_cost, curT)
482 482  
483   - if not role:checkItemEnough({[ItemId.Jade] = costCount}) then return end
  483 +
  484 + if not role:checkItemEnough({[ItemId.Jade] = costCount}) then return 2 end
484 485 role:costItems({[ItemId.Jade] = costCount}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}})
485 486  
486 487 role.dailyData:updateProperty({field = "hangQC", value = curCount})
... ...
src/shared/functions.lua
... ... @@ -867,14 +867,14 @@ end
867 867  
868 868 function table.findMinKeyByItem(t, item)
869 869 if not t[item] then
  870 + local max = table.maxkey(t)
  871 + if item > max then return t[max] end
  872 +
870 873 local tk = {}
871 874 for k, v in pairs(t) do
872 875 table.insert(tk, k)
873 876 end
874 877 if next(tk) then
875   - local max = table.maxkey(tk)
876   - if item > max then return t[max] end
877   -
878 878 table.insert(tk, item)
879 879 table.sort(tk)
880 880 local index = 0
... ...