diff --git a/src/ProtocolCode.lua b/src/ProtocolCode.lua index 5f9e0d0..b8a4871 100644 --- a/src/ProtocolCode.lua +++ b/src/ProtocolCode.lua @@ -204,6 +204,7 @@ actionCodes = { Store_getGrowFundRewardRpc = 561, --成长助力奖励 Store_getBattlePassRewardRpc = 562, --赛季卡奖励 Store_getExploreCommandRewardRpc = 563, --探索指令 + Store_getTotalRechargeAwardRpc = 564, -- 累计充值 Email_listRpc = 600, @@ -223,6 +224,7 @@ actionCodes = { Radio_startQuestRpc = 700, Radio_finishQuestRpc = 701, + Radio_cancelQuestRpc = 702, } rpcResponseBegin = 10000 diff --git a/src/actions/RadioAction.lua b/src/actions/RadioAction.lua index dfb0beb..273f55f 100644 --- a/src/actions/RadioAction.lua +++ b/src/actions/RadioAction.lua @@ -122,7 +122,7 @@ function _M.finishQuestRpc(agent, data) -- get heros local totalCoef = 0 local exp = config.time / 60 - heroFaithMap = {} + local heroFaithMap = {} for _, heroId in ipairs(task.heros) do local hero = role.heros[heroId] if hero then @@ -162,4 +162,20 @@ function _M.finishQuestRpc(agent, data) return true end +function _M.cancelQuestRpc(agent, data) + local role = agent.role + local msg = MsgPack.unpack(data) + local id = msg.id + -- check finish time + local radioTask = role:getProperty("radioTask") + local task = radioTask[id] + if not task then return 1 end + if skynet.timex() > task.time then return 2 end + radioTask[id] = nil + role:updateProperty({field="radioTask", value=radioTask, notNotify = true}) + + SendPacket(actionCodes.Radio_cancelQuestRpc, MsgPack.pack({id = id})) + return true +end + return _M \ No newline at end of file diff --git a/src/actions/StoreAction.lua b/src/actions/StoreAction.lua index 4e63acc..117020a 100644 --- a/src/actions/StoreAction.lua +++ b/src/actions/StoreAction.lua @@ -396,4 +396,24 @@ function _M.getExploreCommandRewardRpc(agent, data) return true end +-- 累充奖励 +function _M.getTotalRechargeAwardRpc(agent, data) + local role = agent.role + local msg = MsgPack.unpack(data) + local index = msg.index -- 领取的索引id + local totalRechargeRecord = role.storeData:getProperty("totalRR") + local flag = string.char(string.getbit(totalRechargeRecord, index)) + if flag == "1" then + return 1 + end + totalRechargeRecord = string.setbit(totalRechargeRecord, index) + role.storeData:updateProperty({field = "totalRR", value = totalRechargeRecord}) + local cfg = csvdb["Csv"][index] + if not cfg then return 2 end + + local reward, _ = role:award(cfg.reward, {log = {desc = "totalRecharge", int1 = index}}) + SendPacket(actionCodes.Store_getTotalRechargeAwardRpc, MsgPack.pack({reward = reward})) + return true +end + return _M \ No newline at end of file diff --git a/src/models/RoleLog.lua b/src/models/RoleLog.lua index 17bbec1..bbf7bc8 100644 --- a/src/models/RoleLog.lua +++ b/src/models/RoleLog.lua @@ -45,6 +45,7 @@ local ItemReason = { actRecycle = 130, -- 活动道具回收 actExchange = 131, -- 兑换活动 actGachakon = 132, -- 扭蛋活动 + totalRecharge = 133, -- 累计充值奖励 advHang = 301, -- 拾荒挂机 diff --git a/src/models/Store.lua b/src/models/Store.lua index 0363ecb..92e32ee 100644 --- a/src/models/Store.lua +++ b/src/models/Store.lua @@ -33,6 +33,8 @@ Store.schema = { actGoodsFlag = {"table", {}}, -- ActGoodsType 1购买,0未购买 bpInfo = {"table", {}}, -- battle pass 探索指令 1={flag=0 为1表示买了,br=""付费领取记录, fr=""免费领取记录},2,3,4 + + totalRR = {"string", ""}, -- 累计充值奖励领取记录 } function Store:updateProperty(params) @@ -464,6 +466,7 @@ function Store:data() --packTrigger = self:getProperty("packTrigger"), actGoodsFlag = self:getProperty("actGoodsFlag"), bpInfo = self:getProperty("bpInfo"), + totalRR = self:getProperty("totalRR"), } end -- libgit2 0.21.2