Commit ed20f277907945616aac55eabd452f29a2d8e1d7

Authored by zhouhaihai
1 parent a7c0f779

chatline 奖励

src/ProtocolCode.lua
... ... @@ -101,6 +101,7 @@ actionCodes = {
101 101 Hang_endBonusBattleRpc = 261,
102 102 Hang_hangGiftRpc = 262,
103 103 Hang_bagFieldRpc = 263,
  104 + Hang_chatLineRpc = 264,
104 105  
105 106 Diner_updateProperty = 300,
106 107 Diner_addSellRpc = 301,
... ...
src/actions/HangAction.lua
... ... @@ -559,4 +559,29 @@ function _M.bagFieldRpc(agent, data)
559 559 return true
560 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 587 return _M
563 588 \ No newline at end of file
... ...
src/models/Role.lua
... ... @@ -152,6 +152,8 @@ Role.schema = {
152 152 sign = {"table", {}}, -- 签到记录 {[1] = 20181029}
153 153  
154 154 redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms }
  155 +
  156 + chatline = {"table", {}}, -- 奖励发放 id=时间
155 157 }
156 158  
157 159  
... ... @@ -364,6 +366,7 @@ function Role:data()
364 366 sign = self:getProperty("sign"),
365 367  
366 368 redp = self:getProperty("redp"),
  369 + chatline = self:getProperty("chatline"),
367 370 }
368 371 end
369 372  
... ...