Commit ca232abde628f3765bbd5a2cf7b191c9b0d1197d
1 parent
fdb86cad
fix diner task refresh
Showing
1 changed file
with
8 additions
and
17 deletions
Show diff stats
src/actions/DinerAction.lua
@@ -310,9 +310,6 @@ end | @@ -310,9 +310,6 @@ end | ||
310 | function _M.updateTaskRpc( agent, data ) | 310 | function _M.updateTaskRpc( agent, data ) |
311 | local role = agent.role | 311 | local role = agent.role |
312 | local msg = MsgPack.unpack(data) | 312 | local msg = MsgPack.unpack(data) |
313 | - for k,v in pairs(msg) do | ||
314 | - echoInfo(k,v) | ||
315 | - end | ||
316 | local index = msg.index | 313 | local index = msg.index |
317 | -- 0 放弃已接受任务,1 接受任务,2 完成已接受任务 | 314 | -- 0 放弃已接受任务,1 接受任务,2 完成已接受任务 |
318 | local cmd = msg.cmd | 315 | local cmd = msg.cmd |
@@ -386,25 +383,19 @@ function _M.refreshTaskRpc( agent, data ) | @@ -386,25 +383,19 @@ function _M.refreshTaskRpc( agent, data ) | ||
386 | if not taskData then | 383 | if not taskData then |
387 | return 3 | 384 | return 3 |
388 | end | 385 | end |
389 | - local taskPool = {} | ||
390 | - for _, data in pairs(taskData) do | ||
391 | - if data.rarity >= 3 then | ||
392 | - table.inser(taskPool, data) | ||
393 | - end | ||
394 | - end | ||
395 | - if #taskPool == 0 then | ||
396 | - return 4 | ||
397 | - end | ||
398 | 386 | ||
399 | role:costItems(cost) | 387 | role:costItems(cost) |
400 | 388 | ||
401 | - local index = math.randWeight(taskPool, "chance") | ||
402 | - local data = taskPool[index] | ||
403 | - | ||
404 | - table.insert(orders, {lv = taskLevel, id = data.id, n = 0, lock = 0,status = 0}) | 389 | + for k,v in pairs(orders) do |
390 | + if v.lock == 0 then | ||
391 | + local index = math.randWeight(taskData, "chance") | ||
392 | + local t = taskData[index] | ||
393 | + orders[k] = {lv = taskLevel, id = t.id, n = 0, lock = 0,status = 0} | ||
394 | + end | ||
395 | + end | ||
405 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) | 396 | role.dinerData:updateProperty({field = "order", value = json.encode(orders)}) |
406 | 397 | ||
407 | - SendPacket(actionCodes.Diner_getSpecialTaskRpc, '') | 398 | + SendPacket(actionCodes.Diner_refreshTaskRpc, '') |
408 | return true | 399 | return true |
409 | end | 400 | end |
410 | 401 |