Commit 51d9d20b1fd0c47ce983fc8438d0d949c1873ce9
1 parent
ed20b43c
付费签到,应用市场反馈
Showing
14 changed files
with
283 additions
and
6 deletions
Show diff stats
src/GlobalVar.lua
@@ -274,6 +274,10 @@ CardType = { | @@ -274,6 +274,10 @@ CardType = { | ||
274 | PrivilegeCard = 3, --特权卡 | 274 | PrivilegeCard = 3, --特权卡 |
275 | GrowFund = 4, --成长助力 | 275 | GrowFund = 4, --成长助力 |
276 | BattleCard = 5, --赛季卡 | 276 | BattleCard = 5, --赛季卡 |
277 | + BattlePassCard_1 = 6, -- 探索指令1 | ||
278 | + BattlePassCard_2 = 7, -- 探索指令2 | ||
279 | + BattlePassCard_3 = 8, -- 探索指令3 | ||
280 | + BattlePassCard_4 = 9, -- 探索指令4 | ||
277 | } | 281 | } |
278 | 282 | ||
279 | HeroQuality = { | 283 | HeroQuality = { |
@@ -290,6 +294,8 @@ MailId = { | @@ -290,6 +294,8 @@ MailId = { | ||
290 | SuperMonthCardEx = 204, | 294 | SuperMonthCardEx = 204, |
291 | BattleCardAward = 210, | 295 | BattleCardAward = 210, |
292 | 296 | ||
297 | + PaySignAward = 222, | ||
298 | + | ||
293 | ActSellFood = 231, | 299 | ActSellFood = 231, |
294 | ActDrawCard = 232, | 300 | ActDrawCard = 232, |
295 | ActAdvDraw = 233, | 301 | ActAdvDraw = 233, |
src/ProtocolCode.lua
@@ -45,6 +45,7 @@ actionCodes = { | @@ -45,6 +45,7 @@ actionCodes = { | ||
45 | Role_getRandomNameRpc = 130, | 45 | Role_getRandomNameRpc = 130, |
46 | Role_goldBuyRpc = 131, | 46 | Role_goldBuyRpc = 131, |
47 | Role_getDownloadCvRewardRpc = 132, | 47 | Role_getDownloadCvRewardRpc = 132, |
48 | + Role_updateFeedbackInfoRpc = 133, | ||
48 | 49 | ||
49 | Adv_startAdvRpc = 151, | 50 | Adv_startAdvRpc = 151, |
50 | Adv_startHangRpc = 152, | 51 | Adv_startHangRpc = 152, |
@@ -191,6 +192,7 @@ actionCodes = { | @@ -191,6 +192,7 @@ actionCodes = { | ||
191 | Store_getFreeChestRpc = 560, | 192 | Store_getFreeChestRpc = 560, |
192 | Store_getGrowFundRewardRpc = 561, --成长助力奖励 | 193 | Store_getGrowFundRewardRpc = 561, --成长助力奖励 |
193 | Store_getBattlePassRewardRpc = 562, --赛季卡奖励 | 194 | Store_getBattlePassRewardRpc = 562, --赛季卡奖励 |
195 | + Store_getExploreCommandRewardRpc = 563, --探索指令 | ||
194 | 196 | ||
195 | 197 | ||
196 | Email_listRpc = 600, | 198 | Email_listRpc = 600, |
@@ -203,6 +205,7 @@ actionCodes = { | @@ -203,6 +205,7 @@ actionCodes = { | ||
203 | Activity_signRpc = 651, | 205 | Activity_signRpc = 651, |
204 | Activity_sudokuRewardRpc = 652, | 206 | Activity_sudokuRewardRpc = 652, |
205 | Activity_actSignRpc = 653, | 207 | Activity_actSignRpc = 653, |
208 | + Activity_actPaySignRewardNtf = 654, | ||
206 | } | 209 | } |
207 | 210 | ||
208 | rpcResponseBegin = 10000 | 211 | rpcResponseBegin = 10000 |
src/actions/ActivityAction.lua
@@ -178,5 +178,46 @@ function _M.actSignRpc(agent, data) | @@ -178,5 +178,46 @@ function _M.actSignRpc(agent, data) | ||
178 | end | 178 | end |
179 | 179 | ||
180 | 180 | ||
181 | +function _M.actPaySignRpc(agent, data) | ||
182 | + local role = agent.role | ||
183 | + local msg = MsgPack.unpack(data) | ||
184 | + local actGoodsFlag = role.storeData:getProperty("actGoodsFlag") | ||
185 | + local index = GetActGoodsIndex("paySignIn") | ||
186 | + local flag = actGoodsFlag[index] or 0 | ||
187 | + if flag == 0 then return 1 end | ||
188 | + | ||
189 | + if not role.activity:isOpen("PaySignIn") then return 2 end | ||
190 | + | ||
191 | + local diffDay = diffFromOpen() + 1 | ||
192 | + | ||
193 | + local curData = role.activity:getActData("PaySignIn") | ||
194 | + local reward, change = {} | ||
195 | + for day, csvData in ipairs(csvdb["pay_signInCsv"]) do | ||
196 | + if day <= diffDay then | ||
197 | + if not curData[day] then | ||
198 | + curData[day] = 1 | ||
199 | + -- 奖励 | ||
200 | + for itemId, count in pairs(csvData.reward:toNumMap()) do | ||
201 | + reward[itemId] = (reward[itemId] or 0) + count | ||
202 | + end | ||
203 | + end | ||
204 | + else | ||
205 | + break | ||
206 | + end | ||
207 | + end | ||
208 | + if next(reward) then | ||
209 | + role.activity:updateActData("PaySignIn", curData) | ||
210 | + reward, change = role:award(reward, {log = {desc = "actPaySign"}}) | ||
211 | + end | ||
212 | + | ||
213 | + role:log("activity", { | ||
214 | + activity_id = curData[0], -- 活动ID(或活动指定任务的ID) | ||
215 | + activity_type = role.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 | ||
216 | + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | ||
217 | + }) | ||
218 | + | ||
219 | + SendPacket(actionCodes.Activity_actPaySignRpc, MsgPack.pack(role:packReward(reward, change))) | ||
220 | + return true | ||
221 | +end | ||
181 | 222 | ||
182 | return _M | 223 | return _M |
183 | \ No newline at end of file | 224 | \ No newline at end of file |
src/actions/HeroAction.lua
@@ -941,7 +941,7 @@ function _M.unlockPoolRpc(agent, data) | @@ -941,7 +941,7 @@ function _M.unlockPoolRpc(agent, data) | ||
941 | return true | 941 | return true |
942 | end | 942 | end |
943 | 943 | ||
944 | -function _M.changeCrown(agnet, data) | 944 | +function _M.changeCrown(agent, data) |
945 | local role = agent.role | 945 | local role = agent.role |
946 | local msg = MsgPack.unpack(data) | 946 | local msg = MsgPack.unpack(data) |
947 | 947 |
src/actions/RoleAction.lua
@@ -173,6 +173,7 @@ function _M.loginRpc( agent, data ) | @@ -173,6 +173,7 @@ function _M.loginRpc( agent, data ) | ||
173 | response.role = role:data() | 173 | response.role = role:data() |
174 | response.result = "SUCCESS" | 174 | response.result = "SUCCESS" |
175 | response.serverTime = now | 175 | response.serverTime = now |
176 | + response.openTime = getServerOpenTs() | ||
176 | 177 | ||
177 | local modules = {} | 178 | local modules = {} |
178 | 179 | ||
@@ -1194,4 +1195,16 @@ function _M.getDownloadCvRewardRpc(agent, data) | @@ -1194,4 +1195,16 @@ function _M.getDownloadCvRewardRpc(agent, data) | ||
1194 | return true | 1195 | return true |
1195 | end | 1196 | end |
1196 | 1197 | ||
1198 | +function _M.updateFeedbackInfoRpc(agent, data) | ||
1199 | + local role = agent.role | ||
1200 | + local info = role:getProperty("feedback") or {} | ||
1201 | + local msg = MsgPack.unpack(data) | ||
1202 | + info["flag"] = msg.flag | ||
1203 | + info["count"] = msg.count | ||
1204 | + info["ts"] = skynet.timex() | ||
1205 | + role:updateProperty({field="feedback", value=info}) | ||
1206 | + SendPacket(actionCodes.Role_updateFeedbackInfoRpc, MsgPack.pack({})) | ||
1207 | + return true | ||
1208 | +end | ||
1209 | + | ||
1197 | return _M | 1210 | return _M |
1198 | \ No newline at end of file | 1211 | \ No newline at end of file |
src/actions/StoreAction.lua
@@ -322,6 +322,7 @@ function _M.getGrowFundRewardRpc(agent, data) | @@ -322,6 +322,7 @@ function _M.getGrowFundRewardRpc(agent, data) | ||
322 | return true | 322 | return true |
323 | end | 323 | end |
324 | 324 | ||
325 | +-- 赛季卡 | ||
325 | function _M.getBattlePassRewardRpc(agent, data) | 326 | function _M.getBattlePassRewardRpc(agent, data) |
326 | local role = agent.role | 327 | local role = agent.role |
327 | local msg = MsgPack.unpack(data) | 328 | local msg = MsgPack.unpack(data) |
@@ -376,4 +377,65 @@ function _M.getBattlePassRewardRpc(agent, data) | @@ -376,4 +377,65 @@ function _M.getBattlePassRewardRpc(agent, data) | ||
376 | return true | 377 | return true |
377 | end | 378 | end |
378 | 379 | ||
380 | +-- 探索指令奖励 | ||
381 | +function _M.getExploreCommandRewardRpc(agent, data) | ||
382 | + local role = agent.role | ||
383 | + local msg = MsgPack.unpack(data) | ||
384 | + local id = msg.id -- 探索id | ||
385 | + local subId = msg.subId -- 领取的阶段id | ||
386 | + | ||
387 | + local tab_name = "reward_battlepass_" .. id .. "Csv" | ||
388 | + local config = csvdb[tab_name][id] | ||
389 | + if not config then return end | ||
390 | + | ||
391 | + local bpInfo = role.storeData:getProperty("bpInfo") or {} | ||
392 | + local info = bpInfo[id] or {} | ||
393 | + local flag = info["flag"] or 0 | ||
394 | + if flag == 0 then return 1 end | ||
395 | + | ||
396 | + local freeRecord = info["fr"] or "" | ||
397 | + local buyRecord = info["br"] or "" | ||
398 | + | ||
399 | + local freeFlag = string.char(string.getbit(freeRecord, subId)) | ||
400 | + local limitFlag = string.char(string.getbit(buyRecord, subId)) | ||
401 | + | ||
402 | + if freeFlag == "1" and limitFlag == "1" then | ||
403 | + skynet.error("user already get explore command reward") | ||
404 | + return 2 | ||
405 | + end | ||
406 | + | ||
407 | + if flag == 1 and limitFlag == "1" then | ||
408 | + return 3 | ||
409 | + end | ||
410 | + | ||
411 | + if not role:checkHangPass(config.carbonId) then | ||
412 | + return 4 | ||
413 | + end | ||
414 | + | ||
415 | + local gift = "" | ||
416 | + if freeFlag == "0" then | ||
417 | + gift = config.giftFree | ||
418 | + | ||
419 | + freeRecord = string.setbit(freeRecord, id) | ||
420 | + info["fr"] = freeRecord | ||
421 | + end | ||
422 | + | ||
423 | + if flag == 1 and limitFlag == "0" then | ||
424 | + if gift ~= "" then | ||
425 | + gift = gift .. " " | ||
426 | + end | ||
427 | + gift = gift .. config.giftLimit | ||
428 | + | ||
429 | + buyRecord = string.setbit(buyRecord, id) | ||
430 | + info["br"] = buyRecord | ||
431 | + end | ||
432 | + | ||
433 | + role.storeData:updateProperty({field = "bpInfo", value = info}) | ||
434 | + | ||
435 | + local reward, _ = role:award(gift, {log = {desc = "exploreCommand", int1 = id, int2 = subId}}) | ||
436 | + | ||
437 | + SendPacket(actionCodes.Store_getExploreCommandRewardRpc, MsgPack.pack({reward = reward})) | ||
438 | + return true | ||
439 | +end | ||
440 | + | ||
379 | return _M | 441 | return _M |
380 | \ No newline at end of file | 442 | \ No newline at end of file |
src/agent.lua
@@ -53,6 +53,8 @@ end | @@ -53,6 +53,8 @@ end | ||
53 | 53 | ||
54 | local _pipelinings = {} --可同时多个序列 栈的形式保证嵌套不出错 | 54 | local _pipelinings = {} --可同时多个序列 栈的形式保证嵌套不出错 |
55 | function SendPacket(actionCode, bin, client_fd) | 55 | function SendPacket(actionCode, bin, client_fd) |
56 | + --print(actionHandlers[actionCode]) | ||
57 | + --dump(MsgPack.unpack(bin)) | ||
56 | -- 内部消息不扩散出去 | 58 | -- 内部消息不扩散出去 |
57 | if actionCode == actionCodes.Sys_endlessSeason then | 59 | if actionCode == actionCodes.Sys_endlessSeason then |
58 | if agentInfo.role then | 60 | if agentInfo.role then |
src/models/Activity.lua
@@ -8,6 +8,7 @@ Activity.ActivityType = { | @@ -8,6 +8,7 @@ Activity.ActivityType = { | ||
8 | DrawHero = 4, --抽卡周 招募 | 8 | DrawHero = 4, --抽卡周 招募 |
9 | AdvDraw = 5, --拾荒抽周 资助 | 9 | AdvDraw = 5, --拾荒抽周 资助 |
10 | OpenBox = 6, --拆解周 时钟箱 | 10 | OpenBox = 6, --拆解周 时钟箱 |
11 | + PaySignIn = 7, --付费签到 | ||
11 | 12 | ||
12 | SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 | 13 | SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 |
13 | } | 14 | } |
@@ -36,6 +37,7 @@ Activity.schema = { | @@ -36,6 +37,7 @@ Activity.schema = { | ||
36 | act4 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励 | 37 | act4 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励 |
37 | act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 | 38 | act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 |
38 | act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 | 39 | act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 |
40 | + act7 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 | ||
39 | } | 41 | } |
40 | 42 | ||
41 | function Activity:data() | 43 | function Activity:data() |
@@ -47,6 +49,7 @@ function Activity:data() | @@ -47,6 +49,7 @@ function Activity:data() | ||
47 | act4 = self:getProperty("act4"), | 49 | act4 = self:getProperty("act4"), |
48 | act5 = self:getProperty("act5"), | 50 | act5 = self:getProperty("act5"), |
49 | act6 = self:getProperty("act6"), | 51 | act6 = self:getProperty("act6"), |
52 | + act7 = self:getProperty("act7"), | ||
50 | } | 53 | } |
51 | end | 54 | end |
52 | 55 | ||
@@ -315,6 +318,15 @@ activityFunc[Activity.ActivityType.OpenBox] = { | @@ -315,6 +318,15 @@ activityFunc[Activity.ActivityType.OpenBox] = { | ||
315 | end, | 318 | end, |
316 | } | 319 | } |
317 | 320 | ||
321 | +-- 付费签到 | ||
322 | +activityFunc[Activity.ActivityType.PaySignIn] = { | ||
323 | + ["init"] = function(self, actType, isCrossDay, notify) | ||
324 | + self:updateActData(actType, {}, not notify) | ||
325 | + end, | ||
326 | + -- ["close"] = function(self, actType, notify) | ||
327 | + -- end, | ||
328 | +} | ||
329 | + | ||
318 | function Activity:initActivity(actType, isCrossDay, notify) | 330 | function Activity:initActivity(actType, isCrossDay, notify) |
319 | if activityFunc[actType] and activityFunc[actType]['close'] then | 331 | if activityFunc[actType] and activityFunc[actType]['close'] then |
320 | activityFunc[actType]["init"](self, actType, isCrossDay, notify) | 332 | activityFunc[actType]["init"](self, actType, isCrossDay, notify) |
@@ -384,5 +396,46 @@ function Activity:getActivityPool(mainType, subType) | @@ -384,5 +396,46 @@ function Activity:getActivityPool(mainType, subType) | ||
384 | return 0 | 396 | return 0 |
385 | end | 397 | end |
386 | 398 | ||
399 | +-- 付费签到可领奖励 | ||
400 | +function Activity:getPaySignReward() | ||
401 | + local actGoodsFlag = self.storeData:getProperty("actGoodsFlag") | ||
402 | + local index = GetActGoodsIndex("paySignIn") | ||
403 | + local flag = actGoodsFlag[index] or 0 | ||
404 | + if flag == 0 then return {} end | ||
405 | + | ||
406 | + if not self.owner.activity:isOpen("PaySignIn") then return {} end | ||
407 | + | ||
408 | + local diffDay = diffFromOpen() + 1 | ||
409 | + | ||
410 | + local curData = self.activity:getActData("PaySignIn") | ||
411 | + local reward, change = {} | ||
412 | + for day, csvData in ipairs(csvdb["pay_signInCsv"]) do | ||
413 | + if day <= diffDay then | ||
414 | + if not curData[day] then | ||
415 | + curData[day] = 1 | ||
416 | + -- 奖励 | ||
417 | + for itemId, count in pairs(csvData.reward:toNumMap()) do | ||
418 | + reward[itemId] = (reward[itemId] or 0) + count | ||
419 | + end | ||
420 | + end | ||
421 | + else | ||
422 | + break | ||
423 | + end | ||
424 | + end | ||
425 | + return reward, curData | ||
426 | + --if next(reward) then | ||
427 | + --role.activity:updateActData("PaySignIn", curData) | ||
428 | + --reward, change = role:award(reward, {log = {desc = "actPaySign"}}) | ||
429 | + --end | ||
430 | + | ||
431 | + --role:log("activity", { | ||
432 | + -- activity_id = curData[0], -- 活动ID(或活动指定任务的ID) | ||
433 | + -- activity_type = role.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 | ||
434 | + -- activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | ||
435 | + --}) | ||
436 | + | ||
437 | + --SendPacket(actionCodes.Activity_actPaySignRpc, MsgPack.pack(role:packReward(reward, change))) | ||
438 | +end | ||
439 | + | ||
387 | 440 | ||
388 | return Activity | 441 | return Activity |
src/models/Role.lua
@@ -165,6 +165,7 @@ Role.schema = { | @@ -165,6 +165,7 @@ Role.schema = { | ||
165 | chatline = {"table", {}}, -- 奖励发放 id=时间 | 165 | chatline = {"table", {}}, -- 奖励发放 id=时间 |
166 | 166 | ||
167 | downCvR = {"number", 0}, -- 下载cv扩展包奖励 | 167 | downCvR = {"number", 0}, -- 下载cv扩展包奖励 |
168 | + feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数 | ||
168 | } | 169 | } |
169 | 170 | ||
170 | 171 | ||
@@ -383,6 +384,7 @@ function Role:data() | @@ -383,6 +384,7 @@ function Role:data() | ||
383 | chatline = self:getProperty("chatline"), | 384 | chatline = self:getProperty("chatline"), |
384 | 385 | ||
385 | downCvR = self:getProperty("downCvR"), -- 下载cv扩展包奖励 | 386 | downCvR = self:getProperty("downCvR"), -- 下载cv扩展包奖励 |
387 | + feedback = self:getProperty("feedback") | ||
386 | } | 388 | } |
387 | end | 389 | end |
388 | 390 |
src/models/RoleLog.lua
@@ -38,6 +38,8 @@ local ItemReason = { | @@ -38,6 +38,8 @@ local ItemReason = { | ||
38 | startPvp = 124, -- 开始pvp | 38 | startPvp = 124, -- 开始pvp |
39 | unlockStory = 125, -- 解锁剧情 | 39 | unlockStory = 125, -- 解锁剧情 |
40 | towerCount = 126, -- 电波塔次数 | 40 | towerCount = 126, -- 电波塔次数 |
41 | + freeGift = 127, -- 免费礼包 | ||
42 | + exploreCommand = 128, -- 探索指令 | ||
41 | 43 | ||
42 | 44 | ||
43 | advHang = 301, -- 拾荒挂机 | 45 | advHang = 301, -- 拾荒挂机 |
@@ -75,6 +77,7 @@ local ItemReason = { | @@ -75,6 +77,7 @@ local ItemReason = { | ||
75 | friendPoint = 1005, -- 友情 | 77 | friendPoint = 1005, -- 友情 |
76 | birth = 1006, -- 出生奖励 | 78 | birth = 1006, -- 出生奖励 |
77 | actSign = 1007, -- 活动签到 | 79 | actSign = 1007, -- 活动签到 |
80 | + actPaySign = 1008, -- 活动付费签到 | ||
78 | 81 | ||
79 | -- 餐厅 | 82 | -- 餐厅 |
80 | greenHourse = 1101, -- 食材获得 | 83 | greenHourse = 1101, -- 食材获得 |
src/models/RolePlugin.lua
@@ -1454,6 +1454,9 @@ function RolePlugin.bind(Role) | @@ -1454,6 +1454,9 @@ function RolePlugin.bind(Role) | ||
1454 | self.storeData:onBuyCard(rechargeData.type, rechargeData.time) | 1454 | self.storeData:onBuyCard(rechargeData.type, rechargeData.time) |
1455 | elseif rechargeData.shop == 3 then -- 礼包商店 | 1455 | elseif rechargeData.shop == 3 then -- 礼包商店 |
1456 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | 1456 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
1457 | + elseif rechargeData.shop == 4 then -- 付费签到 | ||
1458 | + reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | ||
1459 | + self.storeData:onBuyPaySignCard(rechargeData.time) | ||
1457 | else | 1460 | else |
1458 | skynet.error("invalid recharge shop type " .. id) | 1461 | skynet.error("invalid recharge shop type " .. id) |
1459 | return 3 | 1462 | return 3 |
src/models/Store.lua
@@ -6,21 +6,33 @@ function Store:ctor(properties) | @@ -6,21 +6,33 @@ function Store:ctor(properties) | ||
6 | Store.super.ctor(self, properties) | 6 | Store.super.ctor(self, properties) |
7 | end | 7 | end |
8 | 8 | ||
9 | +ActGoodsType = { | ||
10 | + paySignIn = 1, -- 付费签到 | ||
11 | +} | ||
12 | + | ||
9 | Store.schema = { | 13 | Store.schema = { |
10 | buyR = {"table", {}}, -- 购买商品记录 {id=count} | 14 | buyR = {"table", {}}, -- 购买商品记录 {id=count} |
11 | payR = {"table", {}}, -- 充值记录 {id=count} | 15 | payR = {"table", {}}, -- 充值记录 {id=count} |
12 | growFund = {"number", 0}, -- 成长基金 | 16 | growFund = {"number", 0}, -- 成长基金 |
13 | - growFundR = {"string", ""}, -- 成长基金领取记录 | 17 | + growFundR = {"string", ""}, -- 成长基金领取记录 |
18 | + | ||
14 | monthCardEx = {"number", 0}, -- 月卡过期时间戳 | 19 | monthCardEx = {"number", 0}, -- 月卡过期时间戳 |
15 | - smonthCardEx = {"number", 0}, -- 超级月卡过期时间戳 | 20 | + smonthCardEx = {"number", 0}, -- 超级月卡过期时间戳 |
21 | + | ||
16 | battleCard = {"number", 0}, -- 赛季卡 | 22 | battleCard = {"number", 0}, -- 赛季卡 |
17 | battleFR = {"string", ""}, -- 免费赛季卡领取记录 | 23 | battleFR = {"string", ""}, -- 免费赛季卡领取记录 |
18 | battleLR = {"string", ""}, -- 付费赛季卡领取记录 | 24 | battleLR = {"string", ""}, -- 付费赛季卡领取记录 |
25 | + | ||
19 | limitTPack = {"table", {}}, -- 限时礼包 {id=expire_ts} | 26 | limitTPack = {"table", {}}, -- 限时礼包 {id=expire_ts} |
20 | privCardEx = {"number", 0}, -- 特权卡过期时间戳 | 27 | privCardEx = {"number", 0}, -- 特权卡过期时间戳 |
21 | getMailT1 = {"number",0}, -- 上次发送月卡福利邮件的时间 | 28 | getMailT1 = {"number",0}, -- 上次发送月卡福利邮件的时间 |
22 | getMailT2 = {"number",0}, -- 上次发送超级月卡福利邮件的时间 | 29 | getMailT2 = {"number",0}, -- 上次发送超级月卡福利邮件的时间 |
23 | - packTrigger = {"table", {}} -- 礼包触发记录 {关卡难度1={id, 通关关卡数,升级数,爬塔层数}, ...} | 30 | + packTrigger = {"table", {}}, -- 礼包触发记录 {关卡难度1={id, 通关关卡数,升级数,爬塔层数}, ...} |
31 | + | ||
32 | + -- 活动商品购买记录 | ||
33 | + actGoodsFlag = {"table", {}}, -- ActGoodsType 1购买,0未购买 | ||
34 | + | ||
35 | + bpInfo = {"table", {}}, -- battle pass 探索指令 1={flag=0 为1表示买了,br=""付费领取记录, fr=""免费领取记录},2,3,4 | ||
24 | } | 36 | } |
25 | 37 | ||
26 | function Store:updateProperty(params) | 38 | function Store:updateProperty(params) |
@@ -45,6 +57,7 @@ end | @@ -45,6 +57,7 @@ end | ||
45 | function Store:onCrossDay() | 57 | function Store:onCrossDay() |
46 | self:sendMonthCardEmail() | 58 | self:sendMonthCardEmail() |
47 | self:deleteExpireLimitGoods() | 59 | self:deleteExpireLimitGoods() |
60 | + self:checkPaySignReward() | ||
48 | end | 61 | end |
49 | 62 | ||
50 | -- 删除过期商品 | 63 | -- 删除过期商品 |
@@ -176,6 +189,14 @@ function Store:onBuyCard(type, duration) | @@ -176,6 +189,14 @@ function Store:onBuyCard(type, duration) | ||
176 | self:updateProperty({field = "growFund", value = 1}) | 189 | self:updateProperty({field = "growFund", value = 1}) |
177 | elseif type == CardType.BattleCard then | 190 | elseif type == CardType.BattleCard then |
178 | self:updateProperty({field = "battleCard", value = 1}) | 191 | self:updateProperty({field = "battleCard", value = 1}) |
192 | + elseif type == CardType.BattlePassCard_1 or type == CardType.BattlePassCard_2 or | ||
193 | + type == CardType.BattlePassCard_3 or type == CardType.BattlePassCard_4 then | ||
194 | + local index = type - CardType.BattlePassCard_1 + 1 | ||
195 | + local bpInfo = self:getProperty("bpInfo") or {} | ||
196 | + local info = bpInfo[index] or {} | ||
197 | + info["flag"] = 1 | ||
198 | + bpInfo[index] = info | ||
199 | + self:updateProperty({field = "bpInfo", value = bpInfo}) | ||
179 | end | 200 | end |
180 | end | 201 | end |
181 | 202 | ||
@@ -330,6 +351,47 @@ function Store:OnTriggerLimitTimePack(eventType, param) | @@ -330,6 +351,47 @@ function Store:OnTriggerLimitTimePack(eventType, param) | ||
330 | end | 351 | end |
331 | end | 352 | end |
332 | 353 | ||
354 | +function GetActGoodsIndex(goodsType) | ||
355 | + return ActGoodsType[goodsType] or 0 | ||
356 | +end | ||
357 | + | ||
358 | +-- 购买付费签到 按开服时间算奖励 | ||
359 | +function Store:onBuyPaySignCard(dur) | ||
360 | + local curTs = skynet.timex() | ||
361 | + local actGoodsFlag = self:getProperty("actGoodsFlag") or {} | ||
362 | + local goodsIndex = GetActGoodsIndex("paySignIn") | ||
363 | + if goodsIndex == 0 then | ||
364 | + print("get act goods index fail :paySignIn") | ||
365 | + return | ||
366 | + end | ||
367 | + actGoodsFlag[goodsIndex] = 1 | ||
368 | + -- 发钱 | ||
369 | + local change | ||
370 | + local reward, curData = self.owner.activity:getPaySignReward() | ||
371 | + if next(reward) then | ||
372 | + self.owner.activity:updateActData("PaySignIn", curData) | ||
373 | + reward, change = self.owner:award(reward, {log = {desc = "actPaySign"}}) | ||
374 | + end | ||
375 | + | ||
376 | + self.owner:log("activity", { | ||
377 | + activity_id = 0, -- 活动ID(或活动指定任务的ID) | ||
378 | + activity_type = self.onwer.activity.ActivityType.PaySignIn, -- 活动类型,见活动类型枚举表 | ||
379 | + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | ||
380 | + }) | ||
381 | + | ||
382 | + SendPacket(actionCodes.Activity_actPaySignRewardNtf, MsgPack.pack(self.owner:packReward(reward, change))) | ||
383 | + | ||
384 | + self.owner:updateProperty({field = "actGoodsFlag", value = actGoodsFlag}) | ||
385 | +end | ||
386 | + | ||
387 | +function Store:checkPaySignReward() | ||
388 | + local reward, curData = self.owner.activity:getPaySignReward() | ||
389 | + if next(reward) then | ||
390 | + self.owner.activity:updateActData("PaySignIn", curData) | ||
391 | + self.owner:sendMail(MailId.PaySignAward, nil, reward) | ||
392 | + end | ||
393 | +end | ||
394 | + | ||
333 | function Store:data() | 395 | function Store:data() |
334 | return { | 396 | return { |
335 | buyR = self:getProperty("buyR"), | 397 | buyR = self:getProperty("buyR"), |
@@ -343,7 +405,9 @@ function Store:data() | @@ -343,7 +405,9 @@ function Store:data() | ||
343 | battleLR = self:getProperty("battleLR"), | 405 | battleLR = self:getProperty("battleLR"), |
344 | limitTPack = self:getProperty("limitTPack"), | 406 | limitTPack = self:getProperty("limitTPack"), |
345 | privCardEx = self:getProperty("privCardEx"), | 407 | privCardEx = self:getProperty("privCardEx"), |
346 | - packTrigger = self:getProperty("packTrigger") | 408 | + packTrigger = self:getProperty("packTrigger"), |
409 | + actGoodsFlag = self:getProperty("actGoodsFlag"), | ||
410 | + bpInfo = self:getProperty("bpInfo"), | ||
347 | } | 411 | } |
348 | end | 412 | end |
349 | 413 |
src/utils/CommonFunc.lua
@@ -146,6 +146,31 @@ function crossDayFromOpen(now) | @@ -146,6 +146,31 @@ function crossDayFromOpen(now) | ||
146 | return crossDay(openTime, now) | 146 | return crossDay(openTime, now) |
147 | end | 147 | end |
148 | 148 | ||
149 | +function diffFromOpen() | ||
150 | + now = now or skynet.timex() | ||
151 | + local openTime = os.time{ | ||
152 | + year = tonum(SERV_OPEN:sub(1,4)), | ||
153 | + month = tonum(SERV_OPEN:sub(5,6)), | ||
154 | + day = tonum(SERV_OPEN:sub(7,8)), | ||
155 | + hour = RESET_TIME, | ||
156 | + } | ||
157 | + if now < openTime then | ||
158 | + return 0 | ||
159 | + end | ||
160 | + | ||
161 | + return math.floor((now - openTime) / DAY_SEC) | ||
162 | +end | ||
163 | + | ||
164 | +function getServerOpenTs() | ||
165 | + local openTime = os.time{ | ||
166 | + year = tonum(SERV_OPEN:sub(1,4)), | ||
167 | + month = tonum(SERV_OPEN:sub(5,6)), | ||
168 | + day = tonum(SERV_OPEN:sub(7,8)), | ||
169 | + hour = RESET_TIME, | ||
170 | + } | ||
171 | + return openTime | ||
172 | +end | ||
173 | + | ||
149 | -- 30*86400 = 2592000 | 174 | -- 30*86400 = 2592000 |
150 | function monthLater(now) | 175 | function monthLater(now) |
151 | now = now or skynet.timex() | 176 | now = now or skynet.timex() |