Commit ed20f277907945616aac55eabd452f29a2d8e1d7
1 parent
a7c0f779
chatline 奖励
Showing
3 changed files
with
29 additions
and
0 deletions
Show diff stats
src/ProtocolCode.lua
| @@ -101,6 +101,7 @@ actionCodes = { | @@ -101,6 +101,7 @@ actionCodes = { | ||
| 101 | Hang_endBonusBattleRpc = 261, | 101 | Hang_endBonusBattleRpc = 261, |
| 102 | Hang_hangGiftRpc = 262, | 102 | Hang_hangGiftRpc = 262, |
| 103 | Hang_bagFieldRpc = 263, | 103 | Hang_bagFieldRpc = 263, |
| 104 | + Hang_chatLineRpc = 264, | ||
| 104 | 105 | ||
| 105 | Diner_updateProperty = 300, | 106 | Diner_updateProperty = 300, |
| 106 | Diner_addSellRpc = 301, | 107 | Diner_addSellRpc = 301, |
src/actions/HangAction.lua
| @@ -559,4 +559,29 @@ function _M.bagFieldRpc(agent, data) | @@ -559,4 +559,29 @@ function _M.bagFieldRpc(agent, data) | ||
| 559 | return true | 559 | return true |
| 560 | end | 560 | end |
| 561 | 561 | ||
| 562 | +function _M.chatLineRpc(agent, data) | ||
| 563 | + local role = agent.role | ||
| 564 | + local msg = MsgPack.unpack(data) | ||
| 565 | + | ||
| 566 | + local id = msg.id | ||
| 567 | + | ||
| 568 | + local idleData = csvdb["idle_battleCsv"][id] | ||
| 569 | + if not idleData or idleData.chatline == 0 then | ||
| 570 | + return | ||
| 571 | + end | ||
| 572 | + | ||
| 573 | + local chatline = role:getProperty("chatline") | ||
| 574 | + if chatline[id] then return end | ||
| 575 | + | ||
| 576 | + if not role:checkHangPass(id) then return end | ||
| 577 | + | ||
| 578 | + chatline[id] = skynet.timex() | ||
| 579 | + role:updateProperty({field = "chatline", value = chatline}) | ||
| 580 | + | ||
| 581 | + local reward = role:award(idleData.chatline_reward, {log = {desc = "chatline", int1 = id}}) | ||
| 582 | + | ||
| 583 | + SendPacket(actionCodes.Hang_chatLineRpc, MsgPack.pack(reward)) | ||
| 584 | + return true | ||
| 585 | +end | ||
| 586 | + | ||
| 562 | return _M | 587 | return _M |
| 563 | \ No newline at end of file | 588 | \ No newline at end of file |
src/models/Role.lua
| @@ -152,6 +152,8 @@ Role.schema = { | @@ -152,6 +152,8 @@ Role.schema = { | ||
| 152 | sign = {"table", {}}, -- 签到记录 {[1] = 20181029} | 152 | sign = {"table", {}}, -- 签到记录 {[1] = 20181029} |
| 153 | 153 | ||
| 154 | redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms } | 154 | redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms } |
| 155 | + | ||
| 156 | + chatline = {"table", {}}, -- 奖励发放 id=时间 | ||
| 155 | } | 157 | } |
| 156 | 158 | ||
| 157 | 159 | ||
| @@ -364,6 +366,7 @@ function Role:data() | @@ -364,6 +366,7 @@ function Role:data() | ||
| 364 | sign = self:getProperty("sign"), | 366 | sign = self:getProperty("sign"), |
| 365 | 367 | ||
| 366 | redp = self:getProperty("redp"), | 368 | redp = self:getProperty("redp"), |
| 369 | + chatline = self:getProperty("chatline"), | ||
| 367 | } | 370 | } |
| 368 | end | 371 | end |
| 369 | 372 |