diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index 7ea7d4a..efb8083 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -81,18 +81,28 @@ function _M.levelUpRpc( agent, data ) local msg = MsgPack.unpack(data) local index = msg.index - local buildingData = csvdb["diner_buildingCsv"][index] - if not buildingData then + local buildingSet = csvdb["diner_buildingCsv"][index] + if not buildingSet then return end local buildL = role.dinerData:getProperty("buildL") local curLevel = buildL:getv(index, 1) - if curLevel >= #buildingData then + if curLevel >= #buildingSet then + return + end + local buildingData = buildingSet[curLevel] + if not buildingData then return end + if buildingData.upLimit ~= "" then + local id, level = buildingData.upLimit:math("(%d+)=(%d+)") + if buildL:getv(tonumber(id), 1) < tonumber(level) then + return + end + end - local cost = buildingData[curLevel].starCost:toNumMap() + local cost = buildingData.starCost:toNumMap() if not role:checkItemEnough(cost) then return end -- libgit2 0.21.2