Commit f9c6cac9328a688559a32961cf966c76f3ae8aca
1 parent
8c199cec
建筑升级增加 其他建筑物等级限制
Showing
1 changed file
with
14 additions
and
4 deletions
Show diff stats
src/actions/DinerAction.lua
... | ... | @@ -81,18 +81,28 @@ function _M.levelUpRpc( agent, data ) |
81 | 81 | local msg = MsgPack.unpack(data) |
82 | 82 | |
83 | 83 | local index = msg.index |
84 | - local buildingData = csvdb["diner_buildingCsv"][index] | |
85 | - if not buildingData then | |
84 | + local buildingSet = csvdb["diner_buildingCsv"][index] | |
85 | + if not buildingSet then | |
86 | 86 | return |
87 | 87 | end |
88 | 88 | |
89 | 89 | local buildL = role.dinerData:getProperty("buildL") |
90 | 90 | local curLevel = buildL:getv(index, 1) |
91 | - if curLevel >= #buildingData then | |
91 | + if curLevel >= #buildingSet then | |
92 | + return | |
93 | + end | |
94 | + local buildingData = buildingSet[curLevel] | |
95 | + if not buildingData then | |
92 | 96 | return |
93 | 97 | end |
98 | + if buildingData.upLimit ~= "" then | |
99 | + local id, level = buildingData.upLimit:math("(%d+)=(%d+)") | |
100 | + if buildL:getv(tonumber(id), 1) < tonumber(level) then | |
101 | + return | |
102 | + end | |
103 | + end | |
94 | 104 | |
95 | - local cost = buildingData[curLevel].starCost:toNumMap() | |
105 | + local cost = buildingData.starCost:toNumMap() | |
96 | 106 | if not role:checkItemEnough(cost) then |
97 | 107 | return |
98 | 108 | end | ... | ... |