Commit c4d8e9d2b01ef54927ce6f583c478a1f2c36f3aa
Merge branch 'cn/develop' into cn/publish/preview
# Conflicts: # src/csvdata
Showing
13 changed files
with
203 additions
and
119 deletions
Show diff stats
robot/robot.lua
... | ... | @@ -136,6 +136,18 @@ function CMD.task() |
136 | 136 | startUnit() |
137 | 137 | end |
138 | 138 | |
139 | +function randomName() | |
140 | + local str = "1234567890abcdefghijklmnopqrstuvwxyz" | |
141 | + local len = #str | |
142 | + local result = "" | |
143 | + for i=1,10 do | |
144 | + local idx = math.random(1, len) | |
145 | + result = result .. string.sub(str, idx, idx) | |
146 | + end | |
147 | + | |
148 | + return result | |
149 | +end | |
150 | + | |
139 | 151 | -- 开始登录 |
140 | 152 | function CMD.start(fd, id) |
141 | 153 | client.fd = fd | ... | ... |
src/GlobalVar.lua
... | ... | @@ -133,7 +133,7 @@ ItemStartId = { |
133 | 133 | --常用的物品id的枚举 |
134 | 134 | ItemId = { |
135 | 135 | Gold = 1, -- 金币 |
136 | - Exp = 2, -- 经验 | |
136 | + Exp = 2, -- 能量饮料 | |
137 | 137 | Jade = 3, -- 虹光玉 |
138 | 138 | PlayerExp = 4, -- 突破材料 |
139 | 139 | FriendPoint = 5, -- 友情点 |
... | ... | @@ -371,6 +371,8 @@ MailId = { |
371 | 371 | CBBackAward2 = 244, |
372 | 372 | ActivityPoolRet = 280, |
373 | 373 | MyCardBuy = 300, |
374 | + | |
375 | + RechargeBack = 3001, | |
374 | 376 | } |
375 | 377 | |
376 | 378 | TriggerEventType = { |
... | ... | @@ -389,6 +391,7 @@ TriggerEventType = { |
389 | 391 | RuneUp = 12, -- 循环强化符文 |
390 | 392 | CostDiamond = 13, -- 循环消耗钻石 |
391 | 393 | BuyLimitPack = 14, --购买指定id礼包 触发 |
394 | + HeroTalent = 15, --英雄精进 触发礼包 | |
392 | 395 | } |
393 | 396 | |
394 | 397 | DrawCardType = { |
... | ... | @@ -431,6 +434,7 @@ SystemBnousType = { |
431 | 434 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 |
432 | 435 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, |
433 | 436 | ExtraProp = 18, -- 每次探索加速额外获得道具 |
437 | + AccountLevel = 19, -- 账号等级提升角色等级上限 | |
434 | 438 | } |
435 | 439 | |
436 | 440 | -- 开箱物品类型 | ... | ... |
src/actions/ActivityAction.lua
... | ... | @@ -315,7 +315,27 @@ function _M.actBattleCommandTaskRpc(agent, data) |
315 | 315 | |
316 | 316 | role:updateProperty({field = "bcTask", value = calTask}) |
317 | 317 | |
318 | - local reward, change = role:award(taskCfg.reward, {log = {desc = "battleCommandTask"}}) | |
318 | + local rechargeRecord = role.storeData:getProperty("payR") or {} | |
319 | + local recordFlag = false | |
320 | + for _, id in ipairs(taskCfg.battlepass_id:toArray(true, "=")) do | |
321 | + if rechargeRecord[id] then | |
322 | + local cfg = csvdb["shop_rechargeCsv"][id] | |
323 | + if cfg and cfg.shop == 2 and cfg.type == CardType.ActBattleCommandCard then | |
324 | + recordFlag = true | |
325 | + break | |
326 | + end | |
327 | + end | |
328 | + end | |
329 | + | |
330 | + local taskReward = {} | |
331 | + if recordFlag then | |
332 | + for k, v in pairs(taskCfg.reward:toNumMap()) do | |
333 | + taskReward[k] = (taskReward[k] or 0) + v + taskCfg.battlepass_reward | |
334 | + break | |
335 | + end | |
336 | + end | |
337 | + | |
338 | + local reward, change = role:award(taskReward, {log = {desc = "battleCommandTask"}}) | |
319 | 339 | |
320 | 340 | role:log("activity", { |
321 | 341 | activity_id = taskId, -- 活动ID(或活动指定任务的ID) | ... | ... |
src/actions/GmAction.lua
... | ... | @@ -729,6 +729,8 @@ function _M.cz(role, pms) |
729 | 729 | pay_time = skynet.timex(), |
730 | 730 | sid = sid == 1 and IOS_SID or 0, |
731 | 731 | }) |
732 | + -- 补发邮件 | |
733 | + role:sendMail(MailId.RechargeBack) | |
732 | 734 | role:mylog("gm_action", {desc = "recharge", int1 = id, key1 = pms.sender}) |
733 | 735 | return "指令成功" |
734 | 736 | end | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -42,10 +42,14 @@ function _M.levelUpRpc( agent, data ) |
42 | 42 | if not role:checkItemEnough(cost) then return 3 end |
43 | 43 | |
44 | 44 | -- 通过指定关卡后才能升级英雄等级 |
45 | - local pass = globalCsv.unit_exp_level_pass[level + 1] | |
46 | - if pass then | |
47 | - if not role:checkHangPass(pass) then return 4 end | |
48 | - end | |
45 | + --local pass = globalCsv.unit_exp_level_pass[level + 1] | |
46 | + --if pass then | |
47 | + -- if not role:checkHangPass(pass) then return 4 end | |
48 | + --end | |
49 | + | |
50 | + --账号等级提升角色等级上限 | |
51 | + local accountLevel = role:getAccountLevel() | |
52 | + if level >= accountLevel then return 4 end | |
49 | 53 | |
50 | 54 | role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) |
51 | 55 | |
... | ... | @@ -86,10 +90,10 @@ function _M.breakRpc( agent, data ) |
86 | 90 | if not role:checkItemEnough(cost) then return 4 end |
87 | 91 | |
88 | 92 | -- 通过指定关卡后才能突破英雄 |
89 | - local pass = globalCsv.unit_break_level_pass[breakL + 1] | |
90 | - if pass then | |
91 | - if not role:checkHangPass(pass) then return 4 end | |
92 | - end | |
93 | + --local pass = globalCsv.unit_break_level_pass[breakL + 1] | |
94 | + --if pass then | |
95 | + -- if not role:checkHangPass(pass) then return 4 end | |
96 | + --end | |
93 | 97 | |
94 | 98 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) |
95 | 99 | local oldAttr = hero:getTotalAttrs() |
... | ... | @@ -147,9 +151,11 @@ function _M.wakeRpc(agent, data) |
147 | 151 | local oldBattleV = hero:getProperty("battleV") |
148 | 152 | hero:updateProperty({field = "wakeL", delta = 1}) |
149 | 153 | |
150 | - role:checkTaskEnter("Wake", {heroType = typ, wakeL = curLevel + 1}) | |
154 | + curLevel = curLevel + 1 | |
155 | + role:checkTaskEnter("Wake", {heroType = typ, wakeL = curLevel}) | |
151 | 156 | if curLevel == 3 then -- 解锁cg |
152 | 157 | role:checkTaskEnter("WakeCG", {heroType = typ}) |
158 | + role:checkTaskEnter("WakeCGSum", {count = 1}) | |
153 | 159 | end |
154 | 160 | |
155 | 161 | if curLevel >= 4 then --自动觉醒技能 |
... | ... | @@ -173,6 +179,7 @@ function _M.wakeRpc(agent, data) |
173 | 179 | SendPacket(actionCodes.Hero_wakeRpc, '') |
174 | 180 | |
175 | 181 | role:checkTaskEnter("HeroStarCollect", {}) |
182 | + role:checkTaskEnter("HeroStartSum", {}) | |
176 | 183 | return true |
177 | 184 | end |
178 | 185 | |
... | ... | @@ -212,7 +219,7 @@ function _M.talentRpc(agent, data) |
212 | 219 | talent = talent:setv(1, curLevel + 1) |
213 | 220 | end |
214 | 221 | curStage = talent:getv(0, 1) |
215 | - role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = curStage}) | |
222 | + role:checkTaskEnter("HeroTalent", {heroType = hero:getProperty("type"), alv = curStage, count = 1}) | |
216 | 223 | |
217 | 224 | hero:updateProperty({field = "talent", value = talent}) |
218 | 225 | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -1730,6 +1730,11 @@ function _M.itemConvertSpecialRpc(agent, data) |
1730 | 1730 | if not role:checkItemEnough({[itemId] = 1}) then return 3 end |
1731 | 1731 | |
1732 | 1732 | local reward = {} |
1733 | + | |
1734 | + if not role.storeData:checkRechargeRecord(rechargeData.limit, exchangeId)then | |
1735 | + return 5 | |
1736 | + end | |
1737 | + | |
1733 | 1738 | if rechargeData.type == CardType.ActBattleCommandCard then |
1734 | 1739 | if role.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then |
1735 | 1740 | local tmpreward, _ = role.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) | ... | ... |
src/agent.lua
src/models/Activity.lua
... | ... | @@ -779,7 +779,7 @@ activityFunc[Activity.ActivityType.Gachakon] = { |
779 | 779 | end, |
780 | 780 | ["crossDay"] = function(self, actType, notify) |
781 | 781 | self:updateResetData(actType, 1) |
782 | - self:updateActData(actType, {}, not notify) | |
782 | + --self:updateActData(actType, {}, not notify) | |
783 | 783 | end, |
784 | 784 | ["reset"] = function(self, actType) |
785 | 785 | if self:getResetData(actType) == 0 then return end | ... | ... |
src/models/RoleCross.lua
... | ... | @@ -167,8 +167,10 @@ RoleCross.bind = function (Role) |
167 | 167 | }) |
168 | 168 | self:checkTaskEnter("Wake", {heroType = heroId, wakeL = initData.heros.wakeL}) |
169 | 169 | self:checkTaskEnter("WakeCG", {heroType = heroId}) |
170 | - self:checkTaskEnter("WakeCGSum", {count = 1}) | |
171 | 170 | self:checkTaskEnter("HeroTalent", {heroType = heroId, alv = aheadLevel}) |
171 | + if initData.heros.wakeL == 3 then | |
172 | + self:checkTaskEnter("WakeCGSum", {count = 1}) | |
173 | + end | |
172 | 174 | |
173 | 175 | end |
174 | 176 | end | ... | ... |
src/models/RoleLog.lua
... | ... | @@ -68,6 +68,8 @@ local ItemReason = { |
68 | 68 | smonthCardReward = 152, --特刊奖励 |
69 | 69 | itemConvertSpecial = 153, --兑换月卡/战令/探索指令 特殊道具 |
70 | 70 | buyDiamondCardReward = 154, --购买钻石额外赠送奖励 |
71 | + firstMonthCardReward = 155, --首次订阅月卡奖励 | |
72 | + firstSMonthCardReward = 156, --首次订阅特刊奖励 | |
71 | 73 | |
72 | 74 | advHang = 301, -- 拾荒挂机 |
73 | 75 | hangBattle = 302, -- 挂机战斗 | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -623,6 +623,8 @@ function RolePlugin.bind(Role) |
623 | 623 | end |
624 | 624 | self:checkTaskEnter("AddHero", {heroType = heroType, wakeL = newHero:getProperty("wakeL"), camp = unitData.camp, job = unitData.job, ssrCount = ssrCount}, params.notNotify) |
625 | 625 | self:checkTaskEnter("HeroQualityCollect", {}) |
626 | + self:checkTaskEnter("HeroStartSum", {}) | |
627 | + | |
626 | 628 | if not params.notNotify then |
627 | 629 | local heroResponse = {} |
628 | 630 | table.insert(heroResponse, newHero:data()) |
... | ... | @@ -2433,7 +2435,7 @@ function RolePlugin.bind(Role) |
2433 | 2435 | return 1 |
2434 | 2436 | end |
2435 | 2437 | |
2436 | - if not self.storeData:checkRechargeRecord(rechargeData.limit, id) and rechargeData.shop ~= 2 then | |
2438 | + if not self.storeData:checkRechargeRecord(rechargeData.limit, id)then | |
2437 | 2439 | return 2 |
2438 | 2440 | end |
2439 | 2441 | |
... | ... | @@ -3028,6 +3030,12 @@ function RolePlugin.bind(Role) |
3028 | 3030 | return reward |
3029 | 3031 | end |
3030 | 3032 | |
3033 | + function Role:getAccountLevel() | |
3034 | + local levelBnous = self:getLevelBnous() | |
3035 | + dump(levelBnous) | |
3036 | + return levelBnous[SystemBnousType.AccountLevel] or 0 | |
3037 | + end | |
3038 | + | |
3031 | 3039 | function Role:getLevelBnous() |
3032 | 3040 | local levelBnous = {} |
3033 | 3041 | local curLevel = self:getProperty("level") |
... | ... | @@ -3056,6 +3064,11 @@ function RolePlugin.bind(Role) |
3056 | 3064 | levelBnous[pm1] = 0 |
3057 | 3065 | end |
3058 | 3066 | levelBnous[pm1] = levelBnous[pm1] + pm2 |
3067 | + elseif pm1 == SystemBnousType.AccountLevel then | |
3068 | + if type(levelBnous[pm1]) == "table" then | |
3069 | + levelBnous[pm1] = 0 | |
3070 | + end | |
3071 | + levelBnous[pm1] = math.max(levelBnous[pm1], pm2) | |
3059 | 3072 | else |
3060 | 3073 | levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 |
3061 | 3074 | end | ... | ... |
src/models/RoleTask.lua
... | ... | @@ -282,6 +282,7 @@ local StoreListener = { |
282 | 282 | [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, |
283 | 283 | [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, |
284 | 284 | [TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}}, |
285 | + [TaskType.HeroTalent] = {{TriggerEventType.HeroTalent, f("count")}}, | |
285 | 286 | } |
286 | 287 | } |
287 | 288 | ... | ... |
src/models/Store.lua
... | ... | @@ -30,11 +30,12 @@ Store.schema = { |
30 | 30 | |
31 | 31 | monthCardEx = {"number", 0}, -- 期数 |
32 | 32 | monthCardId = {"number", 0}, -- 月卡id |
33 | - firstMonthCard = {"number", 1}, -- 首次订阅月卡 | |
33 | + firstMonthCard = {"number", 0}, -- 首次订阅月卡 | |
34 | 34 | monthCardReceive = {"number", 0}, -- 月卡奖励领取记录 当天 0-未领取, 1-已经领取 |
35 | 35 | |
36 | 36 | smonthCards = {"table", {}}, --特刊信息 {[id]={["buyCount"]=0, ["periods"]=0}} buyCount: 购买次数,periods: 剩余期数, |
37 | 37 | smonthCardReceive = {"number", 0}, -- 特刊奖励领取记录 当天 0-未领取, 1-已经领取 |
38 | + firstSMonthCard = {"table", {}}, -- 首次订阅当期特刊 | |
38 | 39 | |
39 | 40 | battleCard = {"number", 0}, -- 赛季卡 |
40 | 41 | battleFR = {"string", ""}, -- 免费赛季卡领取记录 |
... | ... | @@ -95,100 +96,15 @@ function Store:refreshWeekData(notify) |
95 | 96 | self:flushWeekShop() |
96 | 97 | end |
97 | 98 | |
98 | -local SuperMonthCard = {} | |
99 | 99 | |
100 | -SuperMonthCard["buy"] = function(self, id) | |
101 | - local smonthCards = self:getProperty("smonthCards") or {} | |
102 | - | |
103 | - local buyLimitFunc = function(buylimit) | |
104 | - for k, v in pairs(buylimit) do | |
105 | - if k == 1 then | |
106 | - if v == 101 then | |
107 | - if self:isMonthCardExpire() then | |
108 | - skynet.error("月卡过期") | |
109 | - return false | |
110 | - end | |
111 | - else | |
112 | - if smonthCards[v] == nil then | |
113 | - skynet.error("没有购买增刊里的条件, %d", v) | |
114 | - return false | |
115 | - end | |
116 | - end | |
117 | - elseif k == 2 then | |
118 | - if smonthCards[v] == nil and v ~= 101 then | |
119 | - skynet.error("没有购买增刊里的条件, %d", v) | |
120 | - return false | |
121 | - end | |
122 | - if SuperMonthCard["isExpired"](self, v) == false and v ~= 101 then | |
123 | - skynet.error("上期特刊奖励没有领取完") | |
124 | - return false | |
125 | - end | |
126 | - end | |
127 | - end | |
128 | - return true | |
129 | - end | |
130 | - | |
131 | - local BuyMonthCard = {} | |
132 | - BuyMonthCard["renewal"]= function() | |
133 | - --续刊 | |
134 | - local card = csvdb["shop_cardCsv"][id] or {} | |
135 | - if card["buyLimit"] and card["buyLimit"] ~= "" then | |
136 | - if buyLimitFunc(card["buyLimit"]:toNumMap()) == false then | |
137 | - skynet.error("不满足购买条件") | |
138 | - return false | |
139 | - end | |
140 | - end | |
141 | - | |
142 | - local smonthCard = smonthCards[id] or {} | |
143 | - if next(smonthCard) then | |
144 | - smonthCard["buyCount"] = (smonthCard["buyCount"] or 0) + 1 | |
145 | - local periods = SuperMonthCard["periods"](self, id) + (card["amount"] or 30) | |
146 | - smonthCard["periods"] = periods | |
147 | - | |
148 | - self:updateProperty({field = "smonthCards", value = smonthCards}) | |
149 | - return true | |
150 | - end | |
151 | - end | |
152 | - BuyMonthCard["order"] = function() | |
153 | - --增刊条件 | |
154 | - local card = csvdb["shop_cardCsv"][id] or {} | |
155 | - if card["buyLimit"] and card["buyLimit"] ~= "" then | |
156 | - if buyLimitFunc(card["buyLimit"]:toNumMap()) == false then | |
157 | - skynet.error("不满足增刊条件") | |
158 | - return false | |
159 | - end | |
160 | - end | |
161 | - smonthCards[id] = {["periods"] = (card["amount"] or 30), ["buyCount"] = 1} | |
162 | - | |
163 | - self:updateProperty({field= "smonthCards", value = smonthCards}) | |
164 | - return true | |
165 | - end | |
166 | - | |
167 | - if SuperMonthCard["isExpired"](self, id) then | |
168 | - local smonthCard = smonthCards[id] or {} | |
169 | - if next(smonthCard) then | |
170 | - return BuyMonthCard["renewal"]() | |
171 | - else | |
172 | - return BuyMonthCard["order"]() | |
173 | - end | |
174 | - else | |
175 | - return BuyMonthCard["renewal"]() | |
176 | - end | |
177 | -end | |
178 | - | |
179 | -SuperMonthCard["periods"] = function(self, id) | |
100 | +local function getSMonthCardPeriods(self, id) | |
180 | 101 | local smonthCards = self:getProperty("smonthCards") or {} |
181 | 102 | local smonthCard = smonthCards[id] or {} |
182 | 103 | return smonthCard["periods"] or 0 |
183 | 104 | end |
184 | 105 | |
185 | -SuperMonthCard["isExpired"] = function (self, id) | |
186 | - local periods = SuperMonthCard["periods"](self, id) | |
187 | - return periods == 0 | |
188 | -end | |
189 | - | |
190 | -SuperMonthCard["itemDaily"] = function(self, id) | |
191 | - local cur_ex = SuperMonthCard["periods"](self, id) | |
106 | +local function getCardItemDailyReward(self, id) | |
107 | + local cur_ex = getSMonthCardPeriods(self, id) | |
192 | 108 | if cur_ex == 0 then return nil, nil end |
193 | 109 | cur_ex = cur_ex - 1 |
194 | 110 | |
... | ... | @@ -203,7 +119,7 @@ SuperMonthCard["itemDaily"] = function(self, id) |
203 | 119 | return reward, change, cur_ex |
204 | 120 | end |
205 | 121 | |
206 | -SuperMonthCard["itemFirst"] = function(self, id) | |
122 | +local function getCardItemFirstReward(self, id) | |
207 | 123 | local card = csvdb["shop_cardCsv"][id] or {} |
208 | 124 | local reward, _ = self.owner:award(card["itemFirst"], {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
209 | 125 | return reward |
... | ... | @@ -384,8 +300,8 @@ end |
384 | 300 | function Store:getSMonthCardDailyReward(id) |
385 | 301 | if not id then return nil end |
386 | 302 | |
387 | - local before_ex = SuperMonthCard["periods"](self, id) | |
388 | - local reward, change, cur_ex= SuperMonthCard["itemDaily"](self, id) | |
303 | + local before_ex = getSMonthCardPeriods(self, id) | |
304 | + local reward, change, cur_ex= getCardItemDailyReward(self, id) | |
389 | 305 | |
390 | 306 | --今日特刊奖励已经领取 |
391 | 307 | self:updateProperty({field = "smonthCardReceive", value = 1}) |
... | ... | @@ -402,14 +318,110 @@ function Store:getSMonthCardDailyReward(id) |
402 | 318 | end |
403 | 319 | |
404 | 320 | function Store:firstBuyMonthCard(id) |
405 | - if self:getProperty("firstMonthCard") == 1 then | |
406 | - self:updateProperty({field = "firstMonthCard", value = 0}) | |
321 | + if self:getProperty("firstMonthCard") == 0 then | |
322 | + self:updateProperty({field = "firstMonthCard", value = 1}) | |
323 | + local card = csvdb["shop_cardCsv"][id] or {} | |
324 | + return self.owner:award(card["itemOnce"], {log = {desc = "firstMonthCardReward", int1 = id}}) | |
325 | + end | |
326 | + return nil | |
327 | +end | |
328 | + | |
329 | +function Store:firstBuySMonthCard(id) | |
330 | + local firstSMonthCard = self:getProperty("firstSMonthCard") or {} | |
331 | + if not firstSMonthCard[id] or firstSMonthCard[id] == 0 then | |
332 | + firstSMonthCard[id] = 1 | |
333 | + self:updateProperty({field = "firstSMonthCard", value = firstSMonthCard}) | |
407 | 334 | local card = csvdb["shop_cardCsv"][id] or {} |
408 | - return self.owner:award(card["itemOnce"], {log = {desc = "monthCardReward", int1 = id, int2 = 30}}) | |
335 | + return self.owner:award(card["itemOnce"], {log = {desc = "firstSMonthCardReward", int1 = id}}) | |
409 | 336 | end |
410 | 337 | return nil |
411 | 338 | end |
412 | 339 | |
340 | +function Store:isSMonthCardExpired(id) | |
341 | + return getSMonthCardPeriods(self, id) == 0 | |
342 | +end | |
343 | + | |
344 | +function Store:buySMonthCardLimit(buylimit) | |
345 | + local smonthCards = self:getProperty("smonthCards") or {} | |
346 | + for k, v in pairs(buylimit) do | |
347 | + if k == 1 then | |
348 | + if v == 101 then | |
349 | + if self:isMonthCardExpire() then | |
350 | + skynet.error("月卡过期") | |
351 | + return false | |
352 | + end | |
353 | + else | |
354 | + if smonthCards[v] == nil then | |
355 | + skynet.error("没有购买增刊里的条件, %d", v) | |
356 | + return false | |
357 | + end | |
358 | + end | |
359 | + elseif k == 2 then | |
360 | + if smonthCards[v] == nil and v ~= 101 then | |
361 | + skynet.error("没有购买增刊条件里的特刊, %d", v) | |
362 | + return false | |
363 | + end | |
364 | + if self:isSMonthCardExpired(v) == false and v ~= 101 then | |
365 | + skynet.error("上期特刊奖励没领完") --策划yc+hbw 没领完上期特刊,新一期特刊不展示,不允许购买 | |
366 | + return false | |
367 | + end | |
368 | + end | |
369 | + end | |
370 | + return true | |
371 | +end | |
372 | + | |
373 | +function Store:buySMonthCard(id) | |
374 | + local smonthCards = self:getProperty("smonthCards") or {} | |
375 | + | |
376 | + local BuyMonthCard = {} | |
377 | + BuyMonthCard["renewal"]= function() | |
378 | + --续刊 | |
379 | + local card = csvdb["shop_cardCsv"][id] or {} | |
380 | + if card["buyLimit"] and card["buyLimit"] ~= "" then | |
381 | + if self:buySMonthCardLimit(card["buyLimit"]:toNumMap()) == false then | |
382 | + skynet.error("不满足购买条件") | |
383 | + return false | |
384 | + end | |
385 | + end | |
386 | + | |
387 | + local smonthCard = smonthCards[id] or {} | |
388 | + if next(smonthCard) then | |
389 | + smonthCard["buyCount"] = (smonthCard["buyCount"] or 0) + 1 | |
390 | + local periods = (smonthCard["periods"] or 0) + (card["amount"] or 30) | |
391 | + smonthCard["periods"] = periods | |
392 | + | |
393 | + self:updateProperty({field = "smonthCards", value = smonthCards}) | |
394 | + return true | |
395 | + end | |
396 | + end | |
397 | + | |
398 | + BuyMonthCard["order"] = function() | |
399 | + --增刊 | |
400 | + local card = csvdb["shop_cardCsv"][id] or {} | |
401 | + if card["buyLimit"] and card["buyLimit"] ~= "" then | |
402 | + if self:buySMonthCardLimit(card["buyLimit"]:toNumMap()) == false then | |
403 | + skynet.error("不满足增刊条件") | |
404 | + return false | |
405 | + end | |
406 | + end | |
407 | + | |
408 | + smonthCards[id] = {["periods"] = (card["amount"] or 30), ["buyCount"] = 1} | |
409 | + self:updateProperty({field= "smonthCards", value = smonthCards}) | |
410 | + return true | |
411 | + end | |
412 | + | |
413 | + if self:isSMonthCardExpired(id) then | |
414 | + local smonthCard = smonthCards[id] or {} | |
415 | + if next(smonthCard) then | |
416 | + return BuyMonthCard["renewal"]() | |
417 | + else | |
418 | + return BuyMonthCard["order"]() | |
419 | + end | |
420 | + else | |
421 | + return BuyMonthCard["renewal"]() | |
422 | + end | |
423 | +end | |
424 | + | |
413 | 425 | -- 购买通行证 |
414 | 426 | function Store:onBuyCard(type, duration, id, actid) |
415 | 427 | local timeNow = skynet.timex() |
... | ... | @@ -420,20 +432,23 @@ function Store:onBuyCard(type, duration, id, actid) |
420 | 432 | self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + 30}) |
421 | 433 | |
422 | 434 | local reward = {} |
423 | - --初回特典 仅首次购买月卡时赠送SSR级角色"拉塔托娅" | |
424 | - local tmpreward, _ = self:firstBuyMonthCard(id) | |
435 | + local tmpreward, _ = self:firstBuyMonthCard(id) --初回特典 仅首次购买月卡 | |
425 | 436 | if tmpreward then table.rewardMerge(reward, tmpreward) end |
426 | 437 | |
427 | - --订阅奖励 | |
428 | - tmpreward = SuperMonthCard["itemFirst"](self, id) | |
438 | + tmpreward = getCardItemFirstReward(self, id) --订阅奖励 | |
429 | 439 | if next(tmpreward) then table.rewardMerge(reward, tmpreward) end |
430 | 440 | |
431 | 441 | return reward |
432 | 442 | elseif type == CardType.SuperMonthCard then |
433 | - if SuperMonthCard["buy"](self, id) then | |
434 | - skynet.error("特刊购买成功:"..id) | |
435 | - return SuperMonthCard["itemFirst"](self, id) | |
443 | + if self:buySMonthCard(id) then | |
444 | + local reward = getCardItemFirstReward(self, id) or {} | |
445 | + local tmpreward, _ = self:firstBuySMonthCard(id) | |
446 | + if tmpreward then table.rewardMerge(reward, tmpreward) end | |
447 | + | |
448 | + return reward | |
436 | 449 | end |
450 | + | |
451 | + skynet.error("特刊购买失败:"..id) | |
437 | 452 | return nil |
438 | 453 | elseif type == CardType.NormalMonthCardLevelUp then |
439 | 454 | if self:isMonthCardExpire() then |
... | ... | @@ -613,7 +628,7 @@ function Store:OnTriggerLimitTimePack(eventType, param) |
613 | 628 | if not config then return end |
614 | 629 | |
615 | 630 | -- 每日循环弹窗 |
616 | - local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1} | |
631 | + local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1, [TriggerEventType.HeroTalent] = 1} | |
617 | 632 | if typeMap[eventType] then |
618 | 633 | local dayInfo = self:getProperty("dayLimitInfo") |
619 | 634 | local info = dayInfo[eventType] or {} |
... | ... | @@ -852,6 +867,7 @@ function Store:data() |
852 | 867 | totalRR = self:getProperty("totalRR"), |
853 | 868 | monthCardId = self:getProperty("monthCardId"), |
854 | 869 | firstMonthCard = self:getProperty("firstMonthCard"), |
870 | + firstsMonthCard = self:getProperty("firstsMonthCard"), | |
855 | 871 | monthCardReceive = self:getProperty("monthCardReceive"), |
856 | 872 | smonthCards = self:getProperty("smonthCards"), |
857 | 873 | smonthCardReceive = self:getProperty("smonthCardReceive"), | ... | ... |