diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index d851e16..cce459f 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -120,6 +120,8 @@ AdvScoreType = { DinerTask = { SellDish = 1, DishWithGold = 2, - UseMaterial = 3, - AddDish = 4, + SellDishType = 3, + DishWithGoldType = 4, + SellDishRare = 5, + DishWithGoldRare = 6, } \ No newline at end of file diff --git a/src/actions/DinerAction.lua b/src/actions/DinerAction.lua index 5155795..6488987 100644 --- a/src/actions/DinerAction.lua +++ b/src/actions/DinerAction.lua @@ -56,18 +56,10 @@ function _M.addSellRpc( agent, data ) role:costItems(cost) role.dinerData:updateSell(slot) - local dirty = false - for id, value in pairs(cost) do - if role.dinerData:checkDinerTask(DinerTask.UseMaterial, value, id, nil, true) then - dirty = true - end - end - if role.dinerData:checkDinerTask(DinerTask.AddDish, count, dish, nil, true) then - dirty = true - end - if dirty then - role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) - end + -- local dirty = false + -- if dirty then + -- role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) + -- end sells = json.decode(role.dinerData:getProperty("sells")) if not sells[slot] then @@ -141,11 +133,18 @@ function _M.getSellRewardRpc( agent, data ) for k,v in pairs(rewards) do reward = reward:incrv(k, v) end - + if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then dirty = true end + if role.dinerData:checkDinerTask(DinerTask.DishWithGoldType, rewards[ItemId.Gold], math.ceil(sell.dish / 100), nil, true) then + dirty = true + end + local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] + if role.dinerData:checkDinerTask(DinerTask.DishWithGoldRare, rewards[ItemId.Gold], dishData.rarity, nil, true) then + dirty = true + end end sells[slot].reward = "" end @@ -198,6 +197,13 @@ function _M.expediteSellRpc( agent, data ) if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then dirty = true end + if role.dinerData:checkDinerTask(DinerTask.DishWithGoldType, rewards[ItemId.Gold], math.ceil(sell.dish / 100), nil, true) then + dirty = true + end + local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] + if role.dinerData:checkDinerTask(DinerTask.DishWithGoldRare, rewards[ItemId.Gold], dishData.rarity, nil, true) then + dirty = true + end end end end diff --git a/src/models/Diner.lua b/src/models/Diner.lua index 672f359..14f82e7 100644 --- a/src/models/Diner.lua +++ b/src/models/Diner.lua @@ -172,6 +172,8 @@ function Diner:updateSell(slot, calOnly) self:setProperty("sells", json.encode(sells)) self:updateProperty({field = "popular", delta = popular}) self:checkDinerTask(DinerTask.SellDish, deltaCount, sell.dish) + self:checkDinerTask(DinerTask.SellDishType, deltaCount, math.ceil(sell.dish / 100)) + self:checkDinerTask(DinerTask.SellDishRare, deltaCount, dishData.rarity) end return { deltaCount = deltaCount, @@ -203,6 +205,8 @@ function Diner:expediteSell(slot) self:setProperty("sells", json.encode(sells)) self:updateProperty({field = "popular", delta = popular}) self:checkDinerTask(DinerTask.SellDish, expediteCount, sell.dish) + self:checkDinerTask(DinerTask.SellDishType, expediteCount, math.ceil(sell.dish / 100)) + self:checkDinerTask(DinerTask.SellDishRare, expediteCount, dishData.rarity) end return { expediteCount = expediteCount, -- libgit2 0.21.2