Commit 4f7cffe51af3895b46bdef58e9affef9c4e19802

Authored by liuzujun
1 parent 782c178b

多队挂机任务取消功能,累充奖励

src/ProtocolCode.lua
... ... @@ -204,6 +204,7 @@ actionCodes = {
204 204 Store_getGrowFundRewardRpc = 561, --成长助力奖励
205 205 Store_getBattlePassRewardRpc = 562, --赛季卡奖励
206 206 Store_getExploreCommandRewardRpc = 563, --探索指令
  207 + Store_getTotalRechargeAwardRpc = 564, -- 累计充值
207 208  
208 209  
209 210 Email_listRpc = 600,
... ... @@ -223,6 +224,7 @@ actionCodes = {
223 224  
224 225 Radio_startQuestRpc = 700,
225 226 Radio_finishQuestRpc = 701,
  227 + Radio_cancelQuestRpc = 702,
226 228 }
227 229  
228 230 rpcResponseBegin = 10000
... ...
src/actions/RadioAction.lua
... ... @@ -122,7 +122,7 @@ function _M.finishQuestRpc(agent, data)
122 122 -- get heros
123 123 local totalCoef = 0
124 124 local exp = config.time / 60
125   - heroFaithMap = {}
  125 + local heroFaithMap = {}
126 126 for _, heroId in ipairs(task.heros) do
127 127 local hero = role.heros[heroId]
128 128 if hero then
... ... @@ -162,4 +162,20 @@ function _M.finishQuestRpc(agent, data)
162 162 return true
163 163 end
164 164  
  165 +function _M.cancelQuestRpc(agent, data)
  166 + local role = agent.role
  167 + local msg = MsgPack.unpack(data)
  168 + local id = msg.id
  169 + -- check finish time
  170 + local radioTask = role:getProperty("radioTask")
  171 + local task = radioTask[id]
  172 + if not task then return 1 end
  173 + if skynet.timex() > task.time then return 2 end
  174 + radioTask[id] = nil
  175 + role:updateProperty({field="radioTask", value=radioTask, notNotify = true})
  176 +
  177 + SendPacket(actionCodes.Radio_cancelQuestRpc, MsgPack.pack({id = id}))
  178 + return true
  179 +end
  180 +
165 181 return _M
166 182 \ No newline at end of file
... ...
src/actions/StoreAction.lua
... ... @@ -396,4 +396,24 @@ function _M.getExploreCommandRewardRpc(agent, data)
396 396 return true
397 397 end
398 398  
  399 +-- 累充奖励
  400 +function _M.getTotalRechargeAwardRpc(agent, data)
  401 + local role = agent.role
  402 + local msg = MsgPack.unpack(data)
  403 + local index = msg.index -- 领取的索引id
  404 + local totalRechargeRecord = role.storeData:getProperty("totalRR")
  405 + local flag = string.char(string.getbit(totalRechargeRecord, index))
  406 + if flag == "1" then
  407 + return 1
  408 + end
  409 + totalRechargeRecord = string.setbit(totalRechargeRecord, index)
  410 + role.storeData:updateProperty({field = "totalRR", value = totalRechargeRecord})
  411 + local cfg = csvdb["Csv"][index]
  412 + if not cfg then return 2 end
  413 +
  414 + local reward, _ = role:award(cfg.reward, {log = {desc = "totalRecharge", int1 = index}})
  415 + SendPacket(actionCodes.Store_getTotalRechargeAwardRpc, MsgPack.pack({reward = reward}))
  416 + return true
  417 +end
  418 +
399 419 return _M
400 420 \ No newline at end of file
... ...
src/models/RoleLog.lua
... ... @@ -45,6 +45,7 @@ local ItemReason = {
45 45 actRecycle = 130, -- 活动道具回收
46 46 actExchange = 131, -- 兑换活动
47 47 actGachakon = 132, -- 扭蛋活动
  48 + totalRecharge = 133, -- 累计充值奖励
48 49  
49 50  
50 51 advHang = 301, -- 拾荒挂机
... ...
src/models/Store.lua
... ... @@ -33,6 +33,8 @@ Store.schema = {
33 33 actGoodsFlag = {"table", {}}, -- ActGoodsType 1购买,0未购买
34 34  
35 35 bpInfo = {"table", {}}, -- battle pass 探索指令 1={flag=0 为1表示买了,br=""付费领取记录, fr=""免费领取记录},2,3,4
  36 +
  37 + totalRR = {"string", ""}, -- 累计充值奖励领取记录
36 38 }
37 39  
38 40 function Store:updateProperty(params)
... ... @@ -464,6 +466,7 @@ function Store:data()
464 466 --packTrigger = self:getProperty("packTrigger"),
465 467 actGoodsFlag = self:getProperty("actGoodsFlag"),
466 468 bpInfo = self:getProperty("bpInfo"),
  469 + totalRR = self:getProperty("totalRR"),
467 470 }
468 471 end
469 472  
... ...