diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index 373b710..b372acd 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -471,7 +471,7 @@ function _M.quickRpc(agent , data) local role = agent.role local hangInfo = role:getProperty("hangInfo") - if not hangInfo.carbonId then return end + if not hangInfo.carbonId then return 1 end local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] --local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] local expCarbonData = hangInfo.expData or {} @@ -480,7 +480,8 @@ function _M.quickRpc(agent , data) local curT = curCount * (globalCsv.idle_quickproduce_time / 3600) local costCount = table.findMinKeyByItem(globalCsv.idle_quickproduce_cost, curT) - if not role:checkItemEnough({[ItemId.Jade] = costCount}) then return end + + if not role:checkItemEnough({[ItemId.Jade] = costCount}) then return 2 end role:costItems({[ItemId.Jade] = costCount}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) role.dailyData:updateProperty({field = "hangQC", value = curCount}) diff --git a/src/shared/functions.lua b/src/shared/functions.lua index 9799ddd..8219ccf 100644 --- a/src/shared/functions.lua +++ b/src/shared/functions.lua @@ -867,14 +867,14 @@ end function table.findMinKeyByItem(t, item) if not t[item] then + local max = table.maxkey(t) + if item > max then return t[max] end + local tk = {} for k, v in pairs(t) do table.insert(tk, k) end if next(tk) then - local max = table.maxkey(tk) - if item > max then return t[max] end - table.insert(tk, item) table.sort(tk) local index = 0 -- libgit2 0.21.2