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 | 100 | if not sell then |
101 | 101 | return 2 |
102 | 102 | end |
103 | - role.dinerData:updateSell(slot) | |
104 | - | |
105 | 103 | local dish = sell.dish |
106 | 104 | local dishSet = csvdb["diner_dishCsv"][dish] |
107 | 105 | if not dishSet then |
... | ... | @@ -116,6 +114,7 @@ function _M.removeSellRpc( agent, data ) |
116 | 114 | return 5 |
117 | 115 | end |
118 | 116 | |
117 | + role.dinerData:updateSell(slot) | |
119 | 118 | local reward = {} |
120 | 119 | local cost = dishData.material:toNumMap() |
121 | 120 | for k, n in pairs(cost) do |
... | ... | @@ -123,7 +122,6 @@ function _M.removeSellRpc( agent, data ) |
123 | 122 | role:addItem({itemId = k,count = sum}) |
124 | 123 | reward[k] = sum |
125 | 124 | end |
126 | - | |
127 | 125 | sells[slot].count = 0 |
128 | 126 | role.dinerData:updateProperty({field = "sells", value = json.encode(sells)}) |
129 | 127 | SendPacket(actionCodes.Diner_removeSellRpc, MsgPack.pack({reward = reward})) |
... | ... | @@ -187,15 +185,17 @@ function _M.expediteSellRpc( agent, data ) |
187 | 185 | sells = json.decode(role.dinerData:getProperty("sells")) |
188 | 186 | for slot, sell in pairs(sells) do |
189 | 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 | 199 | end |
200 | 200 | end |
201 | 201 | end |
... | ... | @@ -304,7 +304,7 @@ function _M.talentUpRpc( agent, data ) |
304 | 304 | end |
305 | 305 | sells = json.decode(role.dinerData:getProperty("sells")) |
306 | 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 | 308 | return 7 |
309 | 309 | end |
310 | 310 | end | ... | ... |