Commit 7898054adde56e4b217841a70cfc52e482426f96
1 parent
550ba7e7
新随机订单
Showing
1 changed file
with
7 additions
and
6 deletions
Show diff stats
src/actions/DinerAction.lua
... | ... | @@ -455,11 +455,12 @@ function _M.refreshTaskRpc( agent, data ) |
455 | 455 | local orders = json.decode(role.dinerData:getProperty("order")) |
456 | 456 | |
457 | 457 | local hadTask = {} |
458 | - local needCount = globalCsv.diner_task_count | |
458 | + local needCount = 0 | |
459 | 459 | for idx, temp in pairs(orders) do |
460 | - if temp.lock ~= 0 and temp.status ~= 0 then | |
460 | + if temp.lock ~= 0 or temp.status ~= 0 then | |
461 | 461 | hadTask[temp.id] = 1 |
462 | - needCount = needCount - 1 | |
462 | + else | |
463 | + needCount = needCount + 1 | |
463 | 464 | end |
464 | 465 | end |
465 | 466 | |
... | ... | @@ -489,9 +490,9 @@ function _M.refreshTaskRpc( agent, data ) |
489 | 490 | |
490 | 491 | role:costItems(cost) |
491 | 492 | |
492 | - for idx = 1, globalCsv.diner_task_count do | |
493 | - local order = orders[idx] | |
494 | - if not order or (order.lock == 0 and order.status == 0) then | |
493 | + | |
494 | + for idx, order in ipairs(orders) do | |
495 | + if (order.lock == 0 and order.status == 0) then | |
495 | 496 | if needCount > 0 then |
496 | 497 | local index = math.randWeight(pool, "chance") |
497 | 498 | local data = pool[index] | ... | ... |