Commit a4e66edad36cff5a22921043a660d7804b196c83
1 parent
cac28f5f
餐厅协议
Showing
2 changed files
with
7 additions
and
5 deletions
Show diff stats
src/ProtocolCode.lua
| @@ -117,6 +117,7 @@ actionCodes = { | @@ -117,6 +117,7 @@ actionCodes = { | ||
| 117 | Diner_rankRpc = 315, | 117 | Diner_rankRpc = 315, |
| 118 | Diner_entrustRpc = 316, | 118 | Diner_entrustRpc = 316, |
| 119 | Diner_collectRpc = 317, | 119 | Diner_collectRpc = 317, |
| 120 | + Diner_comboRewardRpc = 318, | ||
| 120 | 121 | ||
| 121 | Tower_roleFormatRpc = 350, | 122 | Tower_roleFormatRpc = 350, |
| 122 | Tower_startBattleRpc = 351, | 123 | Tower_startBattleRpc = 351, |
src/actions/DinerAction.lua
| @@ -785,7 +785,8 @@ function _M.collectRpc(agent , data) | @@ -785,7 +785,8 @@ function _M.collectRpc(agent , data) | ||
| 785 | local msg = MsgPack.unpack(data) | 785 | local msg = MsgPack.unpack(data) |
| 786 | 786 | ||
| 787 | local id = msg.id | 787 | local id = msg.id |
| 788 | - if not id or not csvdb["diner_customerCsv"][id] then return end | 788 | + local customerData = csvdb["diner_customerCsv"][id] |
| 789 | + if not id or not customerData then return end | ||
| 789 | local customer = role.dinerData:getProperty("customer") | 790 | local customer = role.dinerData:getProperty("customer") |
| 790 | if customer[id] ~= 0 then | 791 | if customer[id] ~= 0 then |
| 791 | return | 792 | return |
| @@ -796,11 +797,11 @@ function _M.collectRpc(agent , data) | @@ -796,11 +797,11 @@ function _M.collectRpc(agent , data) | ||
| 796 | for slot, _ in pairs(sells) do | 797 | for slot, _ in pairs(sells) do |
| 797 | role.dinerData:updateSell(slot) | 798 | role.dinerData:updateSell(slot) |
| 798 | end | 799 | end |
| 799 | - | 800 | + local reward = role:award(customerData.reward) |
| 800 | customer[id] = 1 | 801 | customer[id] = 1 |
| 801 | role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了 | 802 | role.dinerData:updateProperty({field = "customer", value = customer}) -- 解锁了 |
| 802 | 803 | ||
| 803 | - SendPacket(actionCodes.Diner_collectRpc, '') | 804 | + SendPacket(actionCodes.Diner_collectRpc, MsgPack.pack({reward = reward})) |
| 804 | return true | 805 | return true |
| 805 | end | 806 | end |
| 806 | 807 | ||
| @@ -824,11 +825,11 @@ function _M.comboRewardRpc(agent , data) | @@ -824,11 +825,11 @@ function _M.comboRewardRpc(agent , data) | ||
| 824 | end | 825 | end |
| 825 | 826 | ||
| 826 | comboStatus[id] = 1 | 827 | comboStatus[id] = 1 |
| 827 | - role:award(comboData.reward) | 828 | + local reward = role:award(comboData.reward) |
| 828 | 829 | ||
| 829 | role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了 | 830 | role.dinerData:updateProperty({field = "comboStatus", value = comboStatus}) -- 解锁了 |
| 830 | 831 | ||
| 831 | - SendPacket(actionCodes.Diner_comboRewardRpc, '') | 832 | + SendPacket(actionCodes.Diner_comboRewardRpc, MsgPack.pack({reward = reward})) |
| 832 | return true | 833 | return true |
| 833 | end | 834 | end |
| 834 | 835 |