From ed20f277907945616aac55eabd452f29a2d8e1d7 Mon Sep 17 00:00:00 2001 From: zhouhaihai Date: Thu, 23 Jul 2020 17:34:31 +0800 Subject: [PATCH] chatline 奖励 --- src/ProtocolCode.lua | 1 + src/actions/HangAction.lua | 25 +++++++++++++++++++++++++ src/models/Role.lua | 3 +++ 3 files changed, 29 insertions(+), 0 deletions(-) diff --git a/src/ProtocolCode.lua b/src/ProtocolCode.lua index 2cc7eb7..840bc87 100644 --- a/src/ProtocolCode.lua +++ b/src/ProtocolCode.lua @@ -101,6 +101,7 @@ actionCodes = { Hang_endBonusBattleRpc = 261, Hang_hangGiftRpc = 262, Hang_bagFieldRpc = 263, + Hang_chatLineRpc = 264, Diner_updateProperty = 300, Diner_addSellRpc = 301, diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index ce1d6ff..fc2ba13 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -559,4 +559,29 @@ function _M.bagFieldRpc(agent, data) return true end +function _M.chatLineRpc(agent, data) + local role = agent.role + local msg = MsgPack.unpack(data) + + local id = msg.id + + local idleData = csvdb["idle_battleCsv"][id] + if not idleData or idleData.chatline == 0 then + return + end + + local chatline = role:getProperty("chatline") + if chatline[id] then return end + + if not role:checkHangPass(id) then return end + + chatline[id] = skynet.timex() + role:updateProperty({field = "chatline", value = chatline}) + + local reward = role:award(idleData.chatline_reward, {log = {desc = "chatline", int1 = id}}) + + SendPacket(actionCodes.Hang_chatLineRpc, MsgPack.pack(reward)) + return true +end + return _M \ No newline at end of file diff --git a/src/models/Role.lua b/src/models/Role.lua index db76f8d..7434f0a 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -152,6 +152,8 @@ Role.schema = { sign = {"table", {}}, -- 签到记录 {[1] = 20181029} redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms } + + chatline = {"table", {}}, -- 奖励发放 id=时间 } @@ -364,6 +366,7 @@ function Role:data() sign = self:getProperty("sign"), redp = self:getProperty("redp"), + chatline = self:getProperty("chatline"), } end -- libgit2 0.21.2