Commit 7730252333f715ea47a398576ec585b2ea0a5b3e

Authored by zhouhaihai
1 parent 7898054a

任务

src/GlobalVar.lua
... ... @@ -120,6 +120,8 @@ AdvScoreType = {
120 120 DinerTask = {
121 121 SellDish = 1,
122 122 DishWithGold = 2,
123   - UseMaterial = 3,
124   - AddDish = 4,
  123 + SellDishType = 3,
  124 + DishWithGoldType = 4,
  125 + SellDishRare = 5,
  126 + DishWithGoldRare = 6,
125 127 }
126 128 \ No newline at end of file
... ...
src/actions/DinerAction.lua
... ... @@ -56,18 +56,10 @@ function _M.addSellRpc( agent, data )
56 56 role:costItems(cost)
57 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 64 sells = json.decode(role.dinerData:getProperty("sells"))
73 65 if not sells[slot] then
... ... @@ -141,11 +133,18 @@ function _M.getSellRewardRpc( agent, data )
141 133 for k,v in pairs(rewards) do
142 134 reward = reward:incrv(k, v)
143 135 end
144   -
  136 +
145 137 if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then
146 138 if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then
147 139 dirty = true
148 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 148 end
150 149 sells[slot].reward = ""
151 150 end
... ... @@ -198,6 +197,13 @@ function _M.expediteSellRpc( agent, data )
198 197 if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then
199 198 dirty = true
200 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 207 end
202 208 end
203 209 end
... ...
src/models/Diner.lua
... ... @@ -172,6 +172,8 @@ function Diner:updateSell(slot, calOnly)
172 172 self:setProperty("sells", json.encode(sells))
173 173 self:updateProperty({field = "popular", delta = popular})
174 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 177 end
176 178 return {
177 179 deltaCount = deltaCount,
... ... @@ -203,6 +205,8 @@ function Diner:expediteSell(slot)
203 205 self:setProperty("sells", json.encode(sells))
204 206 self:updateProperty({field = "popular", delta = popular})
205 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 210 end
207 211 return {
208 212 expediteCount = expediteCount,
... ...