From f9c6cac9328a688559a32961cf966c76f3ae8aca Mon Sep 17 00:00:00 2001 From: zhengshouren <448949750@qq.com> Date: Tue, 14 May 2019 15:06:34 +0800 Subject: [PATCH] 建筑升级增加 其他建筑物等级限制 --- src/actions/DinerAction.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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