Commit 6991df1b431762e2996460e7b2d79a4ccbc1b44b
1 parent
9c525cf9
fix bug
Showing
1 changed file
with
12 additions
and
12 deletions
Show diff stats
src/actions/DinerAction.lua
@@ -100,8 +100,6 @@ function _M.removeSellRpc( agent, data ) | @@ -100,8 +100,6 @@ function _M.removeSellRpc( agent, data ) | ||
100 | if not sell then | 100 | if not sell then |
101 | return 2 | 101 | return 2 |
102 | end | 102 | end |
103 | - role.dinerData:updateSell(slot) | ||
104 | - | ||
105 | local dish = sell.dish | 103 | local dish = sell.dish |
106 | local dishSet = csvdb["diner_dishCsv"][dish] | 104 | local dishSet = csvdb["diner_dishCsv"][dish] |
107 | if not dishSet then | 105 | if not dishSet then |
@@ -116,6 +114,7 @@ function _M.removeSellRpc( agent, data ) | @@ -116,6 +114,7 @@ function _M.removeSellRpc( agent, data ) | ||
116 | return 5 | 114 | return 5 |
117 | end | 115 | end |
118 | 116 | ||
117 | + role.dinerData:updateSell(slot) | ||
119 | local reward = {} | 118 | local reward = {} |
120 | local cost = dishData.material:toNumMap() | 119 | local cost = dishData.material:toNumMap() |
121 | for k, n in pairs(cost) do | 120 | for k, n in pairs(cost) do |
@@ -123,7 +122,6 @@ function _M.removeSellRpc( agent, data ) | @@ -123,7 +122,6 @@ function _M.removeSellRpc( agent, data ) | ||
123 | role:addItem({itemId = k,count = sum}) | 122 | role:addItem({itemId = k,count = sum}) |
124 | reward[k] = sum | 123 | reward[k] = sum |
125 | end | 124 | end |
126 | - | ||
127 | sells[slot].count = 0 | 125 | sells[slot].count = 0 |
128 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) | 126 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) |
129 | SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward})) | 127 | SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward})) |
@@ -187,15 +185,17 @@ function _M.expediteSellRpc( agent, data ) | @@ -187,15 +185,17 @@ function _M.expediteSellRpc( agent, data ) | ||
187 | sells = json.decode(role.dinerData:getProperty("sells")) | 185 | sells = json.decode(role.dinerData:getProperty("sells")) |
188 | for slot, sell in pairs(sells) do | 186 | for slot, sell in pairs(sells) do |
189 | local result = role.dinerData:expediteSell(slot) | 187 | local result = role.dinerData:expediteSell(slot) |
190 | - local rewards = result.reward:toNumMap() | ||
191 | - for k,v in pairs(result.reward:toNumMap()) do | ||
192 | - reward = reward:incrv(k,v) | ||
193 | - end | ||
194 | - popular = popular + result.popular | 188 | + if result then |
189 | + local rewards = result.reward:toNumMap() | ||
190 | + for k,v in pairs(result.reward:toNumMap()) do | ||
191 | + reward = reward:incrv(k,v) | ||
192 | + end | ||
193 | + popular = popular + result.popular | ||
195 | 194 | ||
196 | - if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then | ||
197 | - if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then | ||
198 | - dirty = true | 195 | + if rewards[ItemId.Gold] and rewards[ItemId.Gold] > 0 then |
196 | + if role.dinerData:checkDinerTask(DinerTask.DishWithGold, rewards[ItemId.Gold], sell.dish, nil, true) then | ||
197 | + dirty = true | ||
198 | + end | ||
199 | end | 199 | end |
200 | end | 200 | end |
201 | end | 201 | end |
@@ -304,7 +304,7 @@ function _M.talentUpRpc( agent, data ) | @@ -304,7 +304,7 @@ function _M.talentUpRpc( agent, data ) | ||
304 | end | 304 | end |
305 | sells = json.decode(role.dinerData:getProperty("sells")) | 305 | sells = json.decode(role.dinerData:getProperty("sells")) |
306 | for _, sell in pairs(sells) do | 306 | for _, sell in pairs(sells) do |
307 | - if sell.dish == msg.dish then | 307 | + if sell.dish == msg.dish and sell.count > 0 then |
308 | return 7 | 308 | return 7 |
309 | end | 309 | end |
310 | end | 310 | end |