Commit 452d614647f603c22834b7c3d2be9a0409619383

Authored by gaofengduan
1 parent ca232abd

fix diner task

@@ -111,8 +111,8 @@ AdvScoreType = { @@ -111,8 +111,8 @@ AdvScoreType = {
111 } 111 }
112 112
113 DinerTask = { 113 DinerTask = {
114 - UseMaterial = 1,  
115 - AddDish = 2,  
116 - SellDish = 3,  
117 - DishWithGold = 4, 114 + SellDish = 1,
  115 + DishWithGold = 2,
  116 + UseMaterial = 3,
  117 + AddDish = 4,
118 } 118 }
119 \ No newline at end of file 119 \ No newline at end of file
src/actions/DinerAction.lua
@@ -53,8 +53,8 @@ function _M.addSellRpc( agent, data ) @@ -53,8 +53,8 @@ function _M.addSellRpc( agent, data )
53 role.dinerData:updateSell(slot) 53 role.dinerData:updateSell(slot)
54 54
55 local dirty = false 55 local dirty = false
56 - for type, value in pairs(cost) do  
57 - if role.dinerData:checkDinerTask(DinerTask.UseMaterial, value, type, nil, true) then 56 + for id, value in pairs(cost) do
  57 + if role.dinerData:checkDinerTask(DinerTask.UseMaterial, value, id, nil, true) then
58 dirty = true 58 dirty = true
59 end 59 end
60 end 60 end
@@ -345,16 +345,16 @@ function _M.updateTaskRpc( agent, data ) @@ -345,16 +345,16 @@ function _M.updateTaskRpc( agent, data )
345 orders[index].status = 0 345 orders[index].status = 0
346 orders[index].lock = 0 346 orders[index].lock = 0
347 elseif cmd == 2 then 347 elseif cmd == 2 then
348 - if order.status ~= 2 then 348 + if order.status ~= 1 then
349 return 32 349 return 32
350 end 350 end
351 - if order.n <= taskData.value then 351 + if order.n < taskData.value then
352 return 6 352 return 6
353 end 353 end
354 for typ, count in pairs(taskData.reward:toNumMap()) do 354 for typ, count in pairs(taskData.reward:toNumMap()) do
355 role:addItem({itemId = typ, count = count}) 355 role:addItem({itemId = typ, count = count})
356 end 356 end
357 - orders[index] = nil 357 + table.remove(orders,index)
358 else 358 else
359 return 33 359 return 33
360 end 360 end
1 -Subproject commit 9f5e58a4fe6e6d10741caad1078a25f014a45de8 1 +Subproject commit dcdc185e5426a77fad2c43030897edab06d45468
src/models/Diner.lua
@@ -45,7 +45,7 @@ function Diner:refreshDailyData(notify) @@ -45,7 +45,7 @@ function Diner:refreshDailyData(notify)
45 end 45 end
46 46
47 -- 特殊订单 47 -- 特殊订单
48 - local orders = {} 48 + local orders = json.decode(self:getProperty("order"))
49 -- 等级由订单板等级决定 49 -- 等级由订单板等级决定
50 local taskLevel = self:getProperty("buildL"):getv(5, 1) 50 local taskLevel = self:getProperty("buildL"):getv(5, 1)
51 local taskData = csvdb["diner_questCsv"][taskLevel] 51 local taskData = csvdb["diner_questCsv"][taskLevel]
@@ -55,8 +55,14 @@ function Diner:refreshDailyData(notify) @@ -55,8 +55,14 @@ function Diner:refreshDailyData(notify)
55 for n = 1, 6 do 55 for n = 1, 6 do
56 local index = math.randWeight(taskPool, "chance") 56 local index = math.randWeight(taskPool, "chance")
57 local data = taskPool[index] 57 local data = taskPool[index]
58 - table.insert(orders, {lv = taskLevel, id = data.id, n = 0, lock = 0,status = 0})  
59 - table.remove(taskPool, index) 58 + local order = orders[n]
  59 + if order then
  60 + if order.lock == 0 then
  61 + orders[n] = {lv = taskLevel, id = data.id, n = 0, lock = 0,status = 0}
  62 + end
  63 + else
  64 + orders[n] = {lv = taskLevel, id = data.id, n = 0, lock = 0,status = 0}
  65 + end
60 end 66 end
61 end 67 end
62 end 68 end
@@ -91,15 +97,15 @@ function Diner:notifyUpdateProperty(field, newValue, oldValue) @@ -91,15 +97,15 @@ function Diner:notifyUpdateProperty(field, newValue, oldValue)
91 SendPacket(actionCodes.Diner_updateProperty, MsgPack.pack(datas)) 97 SendPacket(actionCodes.Diner_updateProperty, MsgPack.pack(datas))
92 end 98 end
93 99
94 -function Diner:checkDinerTask(type, count, param1, param2, notNotify) 100 +function Diner:checkDinerTask(typ, count, param1, param2, notNotify)
95 local orders = json.decode(self:getProperty("order")) 101 local orders = json.decode(self:getProperty("order"))
96 local dirty = false 102 local dirty = false
97 - for _, order in ipairs(orders) do 103 + for k, order in ipairs(orders) do
98 local taskSet = csvdb["diner_questCsv"][order.lv] 104 local taskSet = csvdb["diner_questCsv"][order.lv]
99 if taskSet and taskSet[order.id] then 105 if taskSet and taskSet[order.id] then
100 local data = taskSet[order.id] 106 local data = taskSet[order.id]
101 - if data.type == type and data.condition1 == param1 and order.status == 1 then  
102 - data.n = data.n + count 107 + if data.type == typ and data.condition1 == param1 and order.status == 1 then
  108 + orders[k].n = orders[k].n + count
103 dirty = true 109 dirty = true
104 end 110 end
105 end 111 end