Commit 7730252333f715ea47a398576ec585b2ea0a5b3e
1 parent
7898054a
任务
Showing
3 changed files
with
27 additions
and
15 deletions
Show diff stats
src/GlobalVar.lua
| @@ -120,6 +120,8 @@ AdvScoreType = { | @@ -120,6 +120,8 @@ AdvScoreType = { | ||
| 120 | DinerTask = { | 120 | DinerTask = { |
| 121 | SellDish = 1, | 121 | SellDish = 1, |
| 122 | DishWithGold = 2, | 122 | DishWithGold = 2, |
| 123 | - UseMaterial = 3, | ||
| 124 | - AddDish = 4, | 123 | + SellDishType = 3, |
| 124 | + DishWithGoldType = 4, | ||
| 125 | + SellDishRare = 5, | ||
| 126 | + DishWithGoldRare = 6, | ||
| 125 | } | 127 | } |
| 126 | \ No newline at end of file | 128 | \ No newline at end of file |
src/actions/DinerAction.lua
| @@ -56,18 +56,10 @@ function _M.addSellRpc( agent, data ) | @@ -56,18 +56,10 @@ function _M.addSellRpc( agent, data ) | ||
| 56 | role:costItems(cost) | 56 | role:costItems(cost) |
| 57 | role.dinerData:updateSell(slot) | 57 | role.dinerData:updateSell(slot) |
| 58 | 58 | ||
| 59 | - local dirty = false | ||
| 60 | - for id, value in pairs(cost) do | ||
| 61 | - if role.dinerData:checkDinerTask(DinerTask.UseMaterial, value, id, nil, true) then | ||
| 62 | - dirty = true | ||
| 63 | - end | ||
| 64 | - end | ||
| 65 | - if role.dinerData:checkDinerTask(DinerTask.AddDish, count, dish, nil, true) then | ||
| 66 | - dirty = true | ||
| 67 | - end | ||
| 68 | - if dirty then | ||
| 69 | - role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) | ||
| 70 | - end | 59 | + -- local dirty = false |
| 60 | + -- if dirty then | ||
| 61 | + -- role.dinerData:notifyUpdateProperty("order", role.dinerData:getProperty("order")) | ||
| 62 | + -- end | ||
| 71 | 63 | ||
| 72 | sells = json.decode(role.dinerData:getProperty("sells")) | 64 | sells = json.decode(role.dinerData:getProperty("sells")) |
| 73 | if not sells[slot] then | 65 | if not sells[slot] then |
| @@ -141,11 +133,18 @@ function _M.getSellRewardRpc( agent, data ) | @@ -141,11 +133,18 @@ function _M.getSellRewardRpc( agent, data ) | ||
| 141 | for k,v in pairs(rewards) do | 133 | for k,v in pairs(rewards) do |
| 142 | reward = reward:incrv(k, v) | 134 | reward = reward:incrv(k, v) |
| 143 | end | 135 | end |
| 144 | - | 136 | + |
| 145 | if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then | 137 | if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then |
| 146 | if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then | 138 | if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then |
| 147 | dirty = true | 139 | dirty = true |
| 148 | end | 140 | end |
| 141 | + if role.dinerData:checkDinerTask(DinerTask.DishWithGoldType, rewards[ItemId.Gold], math.ceil(sell.dish / 100), nil, true) then | ||
| 142 | + dirty = true | ||
| 143 | + end | ||
| 144 | + local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] | ||
| 145 | + if role.dinerData:checkDinerTask(DinerTask.DishWithGoldRare, rewards[ItemId.Gold], dishData.rarity, nil, true) then | ||
| 146 | + dirty = true | ||
| 147 | + end | ||
| 149 | end | 148 | end |
| 150 | sells[slot].reward = "" | 149 | sells[slot].reward = "" |
| 151 | end | 150 | end |
| @@ -198,6 +197,13 @@ function _M.expediteSellRpc( agent, data ) | @@ -198,6 +197,13 @@ function _M.expediteSellRpc( agent, data ) | ||
| 198 | if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then | 197 | if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then |
| 199 | dirty = true | 198 | dirty = true |
| 200 | end | 199 | end |
| 200 | + if role.dinerData:checkDinerTask(DinerTask.DishWithGoldType, rewards[ItemId.Gold], math.ceil(sell.dish / 100), nil, true) then | ||
| 201 | + dirty = true | ||
| 202 | + end | ||
| 203 | + local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] | ||
| 204 | + if role.dinerData:checkDinerTask(DinerTask.DishWithGoldRare, rewards[ItemId.Gold], dishData.rarity, nil, true) then | ||
| 205 | + dirty = true | ||
| 206 | + end | ||
| 201 | end | 207 | end |
| 202 | end | 208 | end |
| 203 | end | 209 | end |
src/models/Diner.lua
| @@ -172,6 +172,8 @@ function Diner:updateSell(slot, calOnly) | @@ -172,6 +172,8 @@ function Diner:updateSell(slot, calOnly) | ||
| 172 | self:setProperty("sells", json.encode(sells)) | 172 | self:setProperty("sells", json.encode(sells)) |
| 173 | self:updateProperty({field = "popular", delta = popular}) | 173 | self:updateProperty({field = "popular", delta = popular}) |
| 174 | self:checkDinerTask(DinerTask.SellDish, deltaCount, sell.dish) | 174 | self:checkDinerTask(DinerTask.SellDish, deltaCount, sell.dish) |
| 175 | + self:checkDinerTask(DinerTask.SellDishType, deltaCount, math.ceil(sell.dish / 100)) | ||
| 176 | + self:checkDinerTask(DinerTask.SellDishRare, deltaCount, dishData.rarity) | ||
| 175 | end | 177 | end |
| 176 | return { | 178 | return { |
| 177 | deltaCount = deltaCount, | 179 | deltaCount = deltaCount, |
| @@ -203,6 +205,8 @@ function Diner:expediteSell(slot) | @@ -203,6 +205,8 @@ function Diner:expediteSell(slot) | ||
| 203 | self:setProperty("sells", json.encode(sells)) | 205 | self:setProperty("sells", json.encode(sells)) |
| 204 | self:updateProperty({field = "popular", delta = popular}) | 206 | self:updateProperty({field = "popular", delta = popular}) |
| 205 | self:checkDinerTask(DinerTask.SellDish, expediteCount, sell.dish) | 207 | self:checkDinerTask(DinerTask.SellDish, expediteCount, sell.dish) |
| 208 | + self:checkDinerTask(DinerTask.SellDishType, expediteCount, math.ceil(sell.dish / 100)) | ||
| 209 | + self:checkDinerTask(DinerTask.SellDishRare, expediteCount, dishData.rarity) | ||
| 206 | end | 210 | end |
| 207 | return { | 211 | return { |
| 208 | expediteCount = expediteCount, | 212 | expediteCount = expediteCount, |