Commit 5fb0ac5f8479836986df73bdd5a79d373c482a5d
1 parent
ac57fc89
海港贸易相关bug修复
Showing
2 changed files
with
20 additions
and
16 deletions
Show diff stats
src/actions/SeaportAction.lua
@@ -26,10 +26,10 @@ function _M.donateRpc(agent, data) | @@ -26,10 +26,10 @@ function _M.donateRpc(agent, data) | ||
26 | if itemId == 0 or itemCount == 0 then return 0 end | 26 | if itemId == 0 or itemCount == 0 then return 0 end |
27 | if role:getItemCount(itemId) < itemCount then return 1 end | 27 | if role:getItemCount(itemId) < itemCount then return 1 end |
28 | local DonateCsv = csvdb["seaport_purchaseCsv"] | 28 | local DonateCsv = csvdb["seaport_purchaseCsv"] |
29 | - if DonateCsv[phase] or not DonateCsv[phase][id] then return 2 end | 29 | + if not DonateCsv[phase] or not DonateCsv[phase][id] then return 2 end |
30 | 30 | ||
31 | local data = DonateCsv[phase][id] | 31 | local data = DonateCsv[phase][id] |
32 | - local needs = data.need_item:toArray("=",true) | 32 | + local needs = data.need_item:toArray(true,"=") |
33 | if itemId ~= needs[1] then return 3 end | 33 | if itemId ~= needs[1] then return 3 end |
34 | if itemCount % needs[2] ~= 0 then return 4 end | 34 | if itemCount % needs[2] ~= 0 then return 4 end |
35 | 35 | ||
@@ -230,27 +230,31 @@ function _M.shopRpc(agent, data) | @@ -230,27 +230,31 @@ function _M.shopRpc(agent, data) | ||
230 | local id = msg.id or 0 | 230 | local id = msg.id or 0 |
231 | local count = msg.count or 1 | 231 | local count = msg.count or 1 |
232 | 232 | ||
233 | - local seaport = role:getProperty{"seaport"} | ||
234 | - local shop = seaport.shop or {} | ||
235 | - | ||
236 | - if (shop[id] or 0) >= data.limit then return 1 end | ||
237 | - | ||
238 | local shopCsv = {} | 233 | local shopCsv = {} |
239 | local dataSet = csvdb["shop_normalCsv"] | 234 | local dataSet = csvdb["shop_normalCsv"] |
240 | - for _, data in pairs(dataSet) do | ||
241 | - if data.shop == 5 then | ||
242 | - shopCsv[data.id] = data | 235 | + for _, datat in pairs(dataSet) do |
236 | + if datat.shop == 5 then | ||
237 | + shopCsv[datat.id] = datat | ||
243 | end | 238 | end |
244 | end | 239 | end |
240 | + local sdata = shopCsv[id] | ||
241 | + | ||
242 | + if not sdata then return 2 end | ||
245 | 243 | ||
246 | - local data = shopCsv[id] | ||
247 | - if not data then return 2 end | 244 | + local seaport = role:getProperty("seaport") |
245 | + local shop = seaport.shop or {} | ||
246 | + | ||
247 | + if (shop[id] or 0) >= sdata.limit then return 1 end | ||
248 | + | ||
249 | + | ||
250 | + | ||
251 | + | ||
248 | 252 | ||
249 | - if role:getItemCount(data.icon) < data.cost * count then return 3 end | 253 | + if role:getItemCount(sdata.icon) < sdata.cost * count then return 3 end |
250 | 254 | ||
251 | - role:costItems({[data.icon] = data.cost * count}, {log = {desc = "seaportShop", int1 = id, int2 = count}}) | 255 | + role:costItems({[sdata.icon] = sdata.cost * count}, {log = {desc = "seaportShop", int1 = id, int2 = count}}) |
252 | 256 | ||
253 | - local itemReward = data.gift:toNumMap() | 257 | + local itemReward = sdata.gift:toNumMap() |
254 | for itemId, value in pairs(itemReward) do | 258 | for itemId, value in pairs(itemReward) do |
255 | itemReward[itemId] = value * count | 259 | itemReward[itemId] = value * count |
256 | end | 260 | end |
src/models/RolePlugin.lua
@@ -1352,7 +1352,7 @@ function RolePlugin.bind(Role) | @@ -1352,7 +1352,7 @@ function RolePlugin.bind(Role) | ||
1352 | result[idx] = {} | 1352 | result[idx] = {} |
1353 | for i,v in ipairs(temp) do | 1353 | for i,v in ipairs(temp) do |
1354 | if v then | 1354 | if v then |
1355 | - result[idx][i] = v | 1355 | + result[idx][i] = tonumber(v) |
1356 | end | 1356 | end |
1357 | end | 1357 | end |
1358 | end | 1358 | end |