diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index 7007aa6..d7c6494 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -111,8 +111,8 @@ AdvScoreType = { } DinerTask = { - UseMaterial = 1, - AddDish = 2, - SellDish = 3, - DishWithGold = 4, + SellDish = 1, + DishWithGold = 2, + UseMaterial = 3, + AddDish = 4, } \ No newline at end of file diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index bbe0e5a..b164e8a 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -53,8 +53,8 @@ function _M.addSellRpc( agent, data ) role.dinerData:updateSell(slot) local dirty = false - for type, value in pairs(cost) do - if role.dinerData:checkDinerTask(DinerTask.UseMaterial, value, type, nil, true) then + for id, value in pairs(cost) do + if role.dinerData:checkDinerTask(DinerTask.UseMaterial, value, id, nil, true) then dirty = true end end @@ -345,16 +345,16 @@ function _M.updateTaskRpc( agent, data ) orders[index].status = 0 orders[index].lock = 0 elseif cmd == 2 then - if order.status ~= 2 then + if order.status ~= 1 then return 32 end - if order.n <= taskData.value then + if order.n < taskData.value then return 6 end for typ, count in pairs(taskData.reward:toNumMap()) do role:addItem({itemId = typ, count = count}) end - orders[index] = nil + table.remove(orders,index) else return 33 end diff --git a/src/csvdata b/src/csvdata index 9f5e58a..dcdc185 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit 9f5e58a4fe6e6d10741caad1078a25f014a45de8 +Subproject commit dcdc185e5426a77fad2c43030897edab06d45468 diff --git a/src/models/Diner.lua b/src/models/Diner.lua index 5b1fb65..754411e 100644 --- a/src/models/Diner.lua +++ b/src/models/Diner.lua @@ -45,7 +45,7 @@ function Diner:refreshDailyData(notify) end -- 特殊订单 - local orders = {} + local orders = json.decode(self:getProperty("order")) -- 等级由订单板等级决定 local taskLevel = self:getProperty("buildL"):getv(5, 1) local taskData = csvdb["diner_questCsv"][taskLevel] @@ -55,8 +55,14 @@ function Diner:refreshDailyData(notify) for n = 1, 6 do local index = math.randWeight(taskPool, "chance") local data = taskPool[index] - table.insert(orders, {lv = taskLevel, id = data.id, n = 0, lock = 0,status = 0}) - table.remove(taskPool, index) + local order = orders[n] + if order then + if order.lock == 0 then + orders[n] = {lv = taskLevel, id = data.id, n = 0, lock = 0,status = 0} + end + else + orders[n] = {lv = taskLevel, id = data.id, n = 0, lock = 0,status = 0} + end end end end @@ -91,15 +97,15 @@ function Diner:notifyUpdateProperty(field, newValue, oldValue) SendPacket(actionCodes.Diner_updateProperty, MsgPack.pack(datas)) end -function Diner:checkDinerTask(type, count, param1, param2, notNotify) +function Diner:checkDinerTask(typ, count, param1, param2, notNotify) local orders = json.decode(self:getProperty("order")) local dirty = false - for _, order in ipairs(orders) do + for k, order in ipairs(orders) do local taskSet = csvdb["diner_questCsv"][order.lv] if taskSet and taskSet[order.id] then local data = taskSet[order.id] - if data.type == type and data.condition1 == param1 and order.status == 1 then - data.n = data.n + count + if data.type == typ and data.condition1 == param1 and order.status == 1 then + orders[k].n = orders[k].n + count dirty = true end end -- libgit2 0.21.2