Commit 044ba7e23fe1133ca3469585855c9d13d0a3e67a
Merge branch 'cn/develop' into cn/publish/ts
Showing
22 changed files
with
602 additions
and
242 deletions
Show diff stats
robot/robot.lua
@@ -136,6 +136,18 @@ function CMD.task() | @@ -136,6 +136,18 @@ function CMD.task() | ||
136 | startUnit() | 136 | startUnit() |
137 | end | 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 | function CMD.start(fd, id) | 152 | function CMD.start(fd, id) |
141 | client.fd = fd | 153 | client.fd = fd |
src/GlobalVar.lua
@@ -95,6 +95,7 @@ ItemType = { | @@ -95,6 +95,7 @@ ItemType = { | ||
95 | CommonPaster = 18, -- 万能贴纸 | 95 | CommonPaster = 18, -- 万能贴纸 |
96 | BossTicket = 20, -- boss挑战门票 | 96 | BossTicket = 20, -- boss挑战门票 |
97 | Spark = 21, -- 火花 | 97 | Spark = 21, -- 火花 |
98 | + Stick = 23, -- 贴纸 | ||
98 | } | 99 | } |
99 | 100 | ||
100 | --在这个里面的会记录的是功能开放 对应类型open 而不是 ID | 101 | --在这个里面的会记录的是功能开放 对应类型open 而不是 ID |
@@ -133,7 +134,7 @@ ItemStartId = { | @@ -133,7 +134,7 @@ ItemStartId = { | ||
133 | --常用的物品id的枚举 | 134 | --常用的物品id的枚举 |
134 | ItemId = { | 135 | ItemId = { |
135 | Gold = 1, -- 金币 | 136 | Gold = 1, -- 金币 |
136 | - Exp = 2, -- 经验 | 137 | + Exp = 2, -- 能量饮料 |
137 | Jade = 3, -- 虹光玉 | 138 | Jade = 3, -- 虹光玉 |
138 | PlayerExp = 4, -- 突破材料 | 139 | PlayerExp = 4, -- 突破材料 |
139 | FriendPoint = 5, -- 友情点 | 140 | FriendPoint = 5, -- 友情点 |
@@ -371,6 +372,8 @@ MailId = { | @@ -371,6 +372,8 @@ MailId = { | ||
371 | CBBackAward2 = 244, | 372 | CBBackAward2 = 244, |
372 | ActivityPoolRet = 280, | 373 | ActivityPoolRet = 280, |
373 | MyCardBuy = 300, | 374 | MyCardBuy = 300, |
375 | + | ||
376 | + RechargeBack = 3001, | ||
374 | } | 377 | } |
375 | 378 | ||
376 | TriggerEventType = { | 379 | TriggerEventType = { |
@@ -388,6 +391,8 @@ TriggerEventType = { | @@ -388,6 +391,8 @@ TriggerEventType = { | ||
388 | FoodSell = 11, -- 循环卖菜 | 391 | FoodSell = 11, -- 循环卖菜 |
389 | RuneUp = 12, -- 循环强化符文 | 392 | RuneUp = 12, -- 循环强化符文 |
390 | CostDiamond = 13, -- 循环消耗钻石 | 393 | CostDiamond = 13, -- 循环消耗钻石 |
394 | + BuyLimitPack = 14, --购买指定id礼包 触发 | ||
395 | + HeroTalent = 15, --英雄精进 触发礼包 | ||
391 | } | 396 | } |
392 | 397 | ||
393 | DrawCardType = { | 398 | DrawCardType = { |
@@ -429,6 +434,8 @@ SystemBnousType = { | @@ -429,6 +434,8 @@ SystemBnousType = { | ||
429 | UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 | 434 | UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 |
430 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 | 435 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 |
431 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, | 436 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, |
437 | + ExtraProps= 18, -- 每次探索加速额外获得道具 | ||
438 | + AccountLevel = 19, -- 账号等级提升角色等级上限 | ||
432 | } | 439 | } |
433 | 440 | ||
434 | -- 开箱物品类型 | 441 | -- 开箱物品类型 |
@@ -440,4 +447,12 @@ ItemOccupy = { | @@ -440,4 +447,12 @@ ItemOccupy = { | ||
440 | Spark = 5, --火花 | 447 | Spark = 5, --火花 |
441 | Other = 6, | 448 | Other = 6, |
442 | CanUsed = 7, --可使用 | 449 | CanUsed = 7, --可使用 |
450 | +} | ||
451 | + | ||
452 | +-- 世界变动积分 | ||
453 | +ItemWorldLine = { | ||
454 | + RouletteCount = 1, --抽轮盘次数 | ||
455 | + Points = 2, --积分 | ||
456 | + CostDiamond = 3, --消耗钻石 | ||
457 | + CostJade = 4, --消耗红光玉 | ||
443 | } | 458 | } |
444 | \ No newline at end of file | 459 | \ No newline at end of file |
src/ProtocolCode.lua
@@ -13,6 +13,8 @@ actionCodes = { | @@ -13,6 +13,8 @@ actionCodes = { | ||
13 | Gm_clientRequest = 20, | 13 | Gm_clientRequest = 20, |
14 | Gm_receiveResponse = 21, | 14 | Gm_receiveResponse = 21, |
15 | Gm_helpRpc = 22, | 15 | Gm_helpRpc = 22, |
16 | + Gm_clientLuaCommandNtf = 23, | ||
17 | + Gm_clientUploadLuaResult = 24, | ||
16 | 18 | ||
17 | Role_notifyNewEvent = 100, | 19 | Role_notifyNewEvent = 100, |
18 | Role_queryLoginRpc = 101, | 20 | Role_queryLoginRpc = 101, |
@@ -59,7 +61,9 @@ actionCodes = { | @@ -59,7 +61,9 @@ actionCodes = { | ||
59 | Role_runeBuyRpc = 142, -- 铭文购买 | 61 | Role_runeBuyRpc = 142, -- 铭文购买 |
60 | Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 | 62 | Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 |
61 | Role_setBgRpc = 144, -- 设置看板娘 | 63 | Role_setBgRpc = 144, -- 设置看板娘 |
62 | - Role_itemConvertMonthCardRpc = 145, -- 兑换月卡道具 | 64 | + Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具 |
65 | + Role_worldLineRouletteRpc = 146, --世界线抽轮盘 | ||
66 | + Role_worldLineRewardRpc = 147, -- 世界线一键领取奖励 | ||
63 | 67 | ||
64 | Adv_startAdvRpc = 151, | 68 | Adv_startAdvRpc = 151, |
65 | Adv_startHangRpc = 152, | 69 | Adv_startHangRpc = 152, |
@@ -113,6 +117,7 @@ actionCodes = { | @@ -113,6 +117,7 @@ actionCodes = { | ||
113 | Hero_setWishPoolRpc = 226, | 117 | Hero_setWishPoolRpc = 226, |
114 | Hero_changeSparkRpc = 227, | 118 | Hero_changeSparkRpc = 227, |
115 | Hero_saveGeniusTreeRpc = 228, | 119 | Hero_saveGeniusTreeRpc = 228, |
120 | + Hero_stickersConvertRpc = 229, --兑换英雄贴纸 | ||
116 | 121 | ||
117 | Hang_startRpc = 251, | 122 | Hang_startRpc = 251, |
118 | Hang_checkRpc = 252, | 123 | Hang_checkRpc = 252, |
@@ -225,6 +230,7 @@ actionCodes = { | @@ -225,6 +230,7 @@ actionCodes = { | ||
225 | Store_getExploreCommandRewardRpc = 563, --探索指令 | 230 | Store_getExploreCommandRewardRpc = 563, --探索指令 |
226 | Store_getTotalRechargeAwardRpc = 564, -- 累计充值 | 231 | Store_getTotalRechargeAwardRpc = 564, -- 累计充值 |
227 | Store_monthCardRewardRpc = 565, --每日月卡+特刊奖励 | 232 | Store_monthCardRewardRpc = 565, --每日月卡+特刊奖励 |
233 | + Store_dyhxAndroidRechargeRpc = 566, -- 东银河充值 | ||
228 | 234 | ||
229 | Store_biliCloudRechargeRpc = 596, | 235 | Store_biliCloudRechargeRpc = 596, |
230 | Store_biliAndroidRechargeRpc = 597, | 236 | Store_biliAndroidRechargeRpc = 597, |
@@ -245,7 +251,7 @@ actionCodes = { | @@ -245,7 +251,7 @@ actionCodes = { | ||
245 | Activity_actCalendaTaskRpc = 655, | 251 | Activity_actCalendaTaskRpc = 655, |
246 | Activity_actPaySignRpc = 656, | 252 | Activity_actPaySignRpc = 656, |
247 | Activity_exchangeRpc = 657, | 253 | Activity_exchangeRpc = 657, |
248 | - Activity_gachakonRpc = 658, | 254 | + Activity_gachakonRpc = 658, --狩猎祭 抽扭蛋机 |
249 | Activity_hangDropRpc = 659, | 255 | Activity_hangDropRpc = 659, |
250 | Activity_startBattleRpc = 660, | 256 | Activity_startBattleRpc = 660, |
251 | Activity_endBattleRpc = 661, | 257 | Activity_endBattleRpc = 661, |
@@ -263,6 +269,7 @@ actionCodes = { | @@ -263,6 +269,7 @@ actionCodes = { | ||
263 | Activity_returnerTaskRpc = 673, | 269 | Activity_returnerTaskRpc = 673, |
264 | Activity_actNewUserTaskRpc = 674, | 270 | Activity_actNewUserTaskRpc = 674, |
265 | Activity_buyBattleTicketRpc = 675, | 271 | Activity_buyBattleTicketRpc = 675, |
272 | + Activity_resetGachakonRpc = 676, --狩猎祭,重制扭蛋机 | ||
266 | 273 | ||
267 | Radio_startQuestRpc = 700, | 274 | Radio_startQuestRpc = 700, |
268 | Radio_finishQuestRpc = 701, | 275 | Radio_finishQuestRpc = 701, |
src/actions/ActivityAction.lua
@@ -315,7 +315,31 @@ function _M.actBattleCommandTaskRpc(agent, data) | @@ -315,7 +315,31 @@ function _M.actBattleCommandTaskRpc(agent, data) | ||
315 | 315 | ||
316 | role:updateProperty({field = "bcTask", value = calTask}) | 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 | + -- recordFlag = true时,taskCfg.reward 只会有经验奖励 | ||
333 | + taskReward = {} | ||
334 | + for k, v in pairs(taskCfg.reward:toNumMap()) do | ||
335 | + taskReward[k] = (taskReward[k] or 0) + v + taskCfg.battlepass_reward | ||
336 | + break | ||
337 | + end | ||
338 | + else | ||
339 | + taskReward = taskCfg.reward | ||
340 | + end | ||
341 | + | ||
342 | + local reward, change = role:award(taskReward, {log = {desc = "battleCommandTask"}}) | ||
319 | 343 | ||
320 | role:log("activity", { | 344 | role:log("activity", { |
321 | activity_id = taskId, -- 活动ID(或活动指定任务的ID) | 345 | activity_id = taskId, -- 活动ID(或活动指定任务的ID) |
@@ -479,6 +503,20 @@ function _M.gachakonRpc(agent, data) | @@ -479,6 +503,20 @@ function _M.gachakonRpc(agent, data) | ||
479 | return true | 503 | return true |
480 | end | 504 | end |
481 | 505 | ||
506 | +function _M.resetGachakonRpc(agent, data) | ||
507 | + local role = agent.role | ||
508 | + local msg = MsgPack.unpack(data) | ||
509 | + local actid = msg.actid | ||
510 | + | ||
511 | + if not role.activity:isOpenById(actid, "Gachakon") then return 1 end | ||
512 | + | ||
513 | + if role.activity:isResetById(actid, "Gachakon") then return 2 end | ||
514 | + role.activity:resetActDataById(actid) | ||
515 | + | ||
516 | + SendPacket(actionCodes.Activity_resetGachakonRpc, MsgPack.pack({})) | ||
517 | + return true | ||
518 | +end | ||
519 | + | ||
482 | function _M.hangDropRpc(agent, data) | 520 | function _M.hangDropRpc(agent, data) |
483 | local role = agent.role | 521 | local role = agent.role |
484 | local msg = MsgPack.unpack(data) | 522 | local msg = MsgPack.unpack(data) |
src/actions/AdvAction.lua
@@ -506,14 +506,15 @@ function _M.buyAdvCountRpc(agent , data) | @@ -506,14 +506,15 @@ function _M.buyAdvCountRpc(agent , data) | ||
506 | local msg = MsgPack.unpack(data) | 506 | local msg = MsgPack.unpack(data) |
507 | 507 | ||
508 | local count = msg.count --购买次数 | 508 | local count = msg.count --购买次数 |
509 | - local isEl = msg.isEl -- 是否是无尽模式 | 509 | + local isEl = msg.isEl -- 是否是无尽模式 国服没有 |
510 | local cost | 510 | local cost |
511 | if isEl then | 511 | if isEl then |
512 | if math.illegalNum(count, 1, globalCsv.adv_endless_daily_buy_count - role.dailyData:getProperty("advElBC")) then return end | 512 | if math.illegalNum(count, 1, globalCsv.adv_endless_daily_buy_count - role.dailyData:getProperty("advElBC")) then return end |
513 | cost = {[ItemId.Jade] = count * globalCsv.adv_endless_daily_buy_cost} | 513 | cost = {[ItemId.Jade] = count * globalCsv.adv_endless_daily_buy_cost} |
514 | else | 514 | else |
515 | - if math.illegalNum(count, 1, globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC")) then return end | ||
516 | - cost = {[ItemId.Jade] = count * globalCsv.adv_daily_buy_cost} | 515 | + --if math.illegalNum(count, 1, globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC")) then return end |
516 | + local advCount = (role.dailyData:getProperty("advBC") + count ) * globalCsv.adv_daily_buy_num | ||
517 | + cost = {[ItemId.Jade] = table.findMinKeyByIndex(globalCsv.adv_buy_cost, advCount, globalCsv.adv_daily_buy_num)} | ||
517 | end | 518 | end |
518 | 519 | ||
519 | 520 |
src/actions/GmAction.lua
@@ -66,7 +66,7 @@ end | @@ -66,7 +66,7 @@ end | ||
66 | 66 | ||
67 | function _M.silent(role, pms) | 67 | function _M.silent(role, pms) |
68 | local pm1 = tonum(pms.pm1, 0) | 68 | local pm1 = tonum(pms.pm1, 0) |
69 | - dump(pms, pm1) | 69 | + --dump(pms, pm1) |
70 | if pm1 < 1 then | 70 | if pm1 < 1 then |
71 | role:updateProperty({field = "silent", value = 0}) | 71 | role:updateProperty({field = "silent", value = 0}) |
72 | role:setProperty("silentType", 0) | 72 | role:setProperty("silentType", 0) |
@@ -675,6 +675,13 @@ function _M.helpRpc(agent, data) | @@ -675,6 +675,13 @@ function _M.helpRpc(agent, data) | ||
675 | return true | 675 | return true |
676 | end | 676 | end |
677 | 677 | ||
678 | +function _M.clientUploadLuaResult(agent, data) | ||
679 | + local role = agent.role | ||
680 | + local msg = MsgPack.unpack(data) | ||
681 | + role:mylog("gm_action", {desc = "upload_lua", int1 = id, key1 = msg.result}) | ||
682 | + return true | ||
683 | +end | ||
684 | + | ||
678 | function _M.test(role, pms) | 685 | function _M.test(role, pms) |
679 | local id = tonum(pms.pm1, 0) | 686 | local id = tonum(pms.pm1, 0) |
680 | local actid = nil | 687 | local actid = nil |
@@ -722,6 +729,8 @@ function _M.cz(role, pms) | @@ -722,6 +729,8 @@ function _M.cz(role, pms) | ||
722 | pay_time = skynet.timex(), | 729 | pay_time = skynet.timex(), |
723 | sid = sid == 1 and IOS_SID or 0, | 730 | sid = sid == 1 and IOS_SID or 0, |
724 | }) | 731 | }) |
732 | + -- 补发邮件 | ||
733 | + role:sendMail(MailId.RechargeBack) | ||
725 | role:mylog("gm_action", {desc = "recharge", int1 = id, key1 = pms.sender}) | 734 | role:mylog("gm_action", {desc = "recharge", int1 = id, key1 = pms.sender}) |
726 | return "指令成功" | 735 | return "指令成功" |
727 | end | 736 | end |
@@ -1086,4 +1095,10 @@ function _M.reset_capsule(role, pms, capsule_serv) | @@ -1086,4 +1095,10 @@ function _M.reset_capsule(role, pms, capsule_serv) | ||
1086 | return "成功" | 1095 | return "成功" |
1087 | end | 1096 | end |
1088 | 1097 | ||
1098 | +function _M.do_lua(role, pms) | ||
1099 | + local luaStr = pms.pm1 | ||
1100 | + SendPacket(actionCodes.Gm_clientLuaCommandNtf, MsgPack.pack({lua = luaStr})) | ||
1101 | + return "成功" | ||
1102 | +end | ||
1103 | + | ||
1089 | return _M | 1104 | return _M |
1090 | \ No newline at end of file | 1105 | \ No newline at end of file |
src/actions/HangAction.lua
@@ -128,12 +128,10 @@ local function checkReward(role, isTreasure, carbonId) | @@ -128,12 +128,10 @@ local function checkReward(role, isTreasure, carbonId) | ||
128 | --挂机得到的宝藏加入到挂机奖励 | 128 | --挂机得到的宝藏加入到挂机奖励 |
129 | if isTreasure or false == true then | 129 | if isTreasure or false == true then |
130 | local treasureList= role.dailyData:checkTreasureList(carbonId or hangInfo.carbonId) or {} | 130 | local treasureList= role.dailyData:checkTreasureList(carbonId or hangInfo.carbonId) or {} |
131 | - if next(treasureList) then | ||
132 | - for _, val in pairs(treasureList) do | ||
133 | - local award = val.award:toNumMap() | ||
134 | - for k,v in pairs(award) do | ||
135 | - items[k] = (items[k] or 0) + v | ||
136 | - end | 131 | + for _, val in pairs(treasureList) do |
132 | + local award = val.award:toNumMap() | ||
133 | + for k,v in pairs(award) do | ||
134 | + items[k] = (items[k] or 0) + v | ||
137 | end | 135 | end |
138 | end | 136 | end |
139 | end | 137 | end |
@@ -473,30 +471,17 @@ function _M.quickRpc(agent , data) | @@ -473,30 +471,17 @@ function _M.quickRpc(agent , data) | ||
473 | local role = agent.role | 471 | local role = agent.role |
474 | 472 | ||
475 | local hangInfo = role:getProperty("hangInfo") | 473 | local hangInfo = role:getProperty("hangInfo") |
476 | - if not hangInfo.carbonId then return end | 474 | + if not hangInfo.carbonId then return 1 end |
477 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] | 475 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
478 | --local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] | 476 | --local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] |
479 | local expCarbonData = hangInfo.expData or {} | 477 | local expCarbonData = hangInfo.expData or {} |
480 | 478 | ||
479 | + local change = globalCsv.idle_quickproduce_time / 3600 | ||
481 | local curCount = role.dailyData:getProperty("hangQC") + 1 | 480 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
482 | - local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") | ||
483 | - | ||
484 | - -- 增加今日探索加速次数 | ||
485 | - local maxIdx = #costs | ||
486 | - local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.ExplorationUpSpeed) | ||
487 | - if curCount > maxCount then return end | 481 | + local costCount = table.findMinKeyByIndex(globalCsv.idle_quickproduce_cost, curCount * change, change) |
488 | 482 | ||
489 | - if curCount > maxIdx then | ||
490 | - for idx = maxIdx+1, curCount do | ||
491 | - costs[idx] = costs[maxIdx] | ||
492 | - end | ||
493 | - end | ||
494 | - | ||
495 | - if not costs[curCount] then return end | ||
496 | - if costs[curCount] > 0 then | ||
497 | - if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end | ||
498 | - role:costItems({[ItemId.Jade] = costs[curCount]}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | ||
499 | - end | 483 | + if not role:checkItemEnough({[ItemId.Jade] = costCount}) then return 2 end |
484 | + role:costItems({[ItemId.Jade] = costCount}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | ||
500 | 485 | ||
501 | role.dailyData:updateProperty({field = "hangQC", value = curCount}) | 486 | role.dailyData:updateProperty({field = "hangQC", value = curCount}) |
502 | 487 | ||
@@ -528,16 +513,20 @@ function _M.quickRpc(agent , data) | @@ -528,16 +513,20 @@ function _M.quickRpc(agent , data) | ||
528 | end | 513 | end |
529 | 514 | ||
530 | --宝藏加速 | 515 | --宝藏加速 |
531 | - local treasureList= role.dailyData:quickTreasureList(hangInfo.carbonId, time) or {} | ||
532 | - if next(treasureList) then | ||
533 | - for id, val in pairs(treasureList) do | ||
534 | - local award = val.award:toNumMap() | ||
535 | - for k,v in pairs(award) do | ||
536 | - reward[k] = (reward[k] or 0) + v | ||
537 | - end | 516 | + local treasureList = role.dailyData:quickTreasureList(hangInfo.carbonId, time) or {} |
517 | + for id, val in pairs(treasureList) do | ||
518 | + local award = val.award:toNumMap() | ||
519 | + for k,v in pairs(award) do | ||
520 | + reward[k] = (reward[k] or 0) + v | ||
538 | end | 521 | end |
539 | end | 522 | end |
540 | 523 | ||
524 | + --等级 每次探索加速额外获得道具 | ||
525 | + local levelReward = role:getBnousExtraProps() | ||
526 | + for k, v in pairs(levelReward or {}) do | ||
527 | + reward[k] = (reward[k] or 0) + v | ||
528 | + end | ||
529 | + | ||
541 | local change | 530 | local change |
542 | reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | 531 | reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) |
543 | if reward[ItemId.Gold] then | 532 | if reward[ItemId.Gold] then |
@@ -582,13 +571,16 @@ function _M.buyBonusCountRpc(agent, data) | @@ -582,13 +571,16 @@ function _M.buyBonusCountRpc(agent, data) | ||
582 | local bonusC = role.dailyData:getProperty("bonusC") | 571 | local bonusC = role.dailyData:getProperty("bonusC") |
583 | local extraCnt = role.storeData:getBonusExtraFightCount() | 572 | local extraCnt = role.storeData:getBonusExtraFightCount() |
584 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} | 573 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} |
585 | - local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] | ||
586 | - if math.illegalNum(count, 1, lastCount) then return 1 end | 574 | + --local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] |
575 | + --if math.illegalNum(count, 1, lastCount) then return 1 end | ||
576 | + | ||
577 | + local costCount = bonusC[btype]["b"] + count | ||
578 | + local cost = table.findMinKeyByIndex(globalCsv.bonus_buy_cost, costCount, 1) | ||
587 | 579 | ||
588 | - if not role:checkItemEnough({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}) then return 2 end | 580 | + if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 2 end |
589 | 581 | ||
590 | - role:costItems({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) | ||
591 | - bonusC[btype]["b"] = bonusC[btype]["b"] + count | 582 | + role:costItems({[ItemId.Jade] = cost}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) |
583 | + bonusC[btype]["b"] = costCount | ||
592 | bonusC[btype]["c"] = bonusC[btype]["c"] - count | 584 | bonusC[btype]["c"] = bonusC[btype]["c"] - count |
593 | 585 | ||
594 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 586 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
src/actions/HeroAction.lua
@@ -42,10 +42,14 @@ function _M.levelUpRpc( agent, data ) | @@ -42,10 +42,14 @@ function _M.levelUpRpc( agent, data ) | ||
42 | if not role:checkItemEnough(cost) then return 3 end | 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 | role:costItems(cost, {log = {desc = "heroLevelUp", int1 = msg.id, int2 = hero:getProperty("type")}}) | 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,10 +90,10 @@ function _M.breakRpc( agent, data ) | ||
86 | if not role:checkItemEnough(cost) then return 4 end | 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 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) | 98 | role:costItems(cost, {log = {desc = "heroBreak", int1 = msg.id, int2 = hero:getProperty("type")}}) |
95 | local oldAttr = hero:getTotalAttrs() | 99 | local oldAttr = hero:getTotalAttrs() |
@@ -147,9 +151,11 @@ function _M.wakeRpc(agent, data) | @@ -147,9 +151,11 @@ function _M.wakeRpc(agent, data) | ||
147 | local oldBattleV = hero:getProperty("battleV") | 151 | local oldBattleV = hero:getProperty("battleV") |
148 | hero:updateProperty({field = "wakeL", delta = 1}) | 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 | if curLevel == 3 then -- 解锁cg | 156 | if curLevel == 3 then -- 解锁cg |
152 | role:checkTaskEnter("WakeCG", {heroType = typ}) | 157 | role:checkTaskEnter("WakeCG", {heroType = typ}) |
158 | + role:checkTaskEnter("WakeCGSum", {count = 1}) | ||
153 | end | 159 | end |
154 | 160 | ||
155 | if curLevel >= 4 then --自动觉醒技能 | 161 | if curLevel >= 4 then --自动觉醒技能 |
@@ -173,6 +179,7 @@ function _M.wakeRpc(agent, data) | @@ -173,6 +179,7 @@ function _M.wakeRpc(agent, data) | ||
173 | SendPacket(actionCodes.Hero_wakeRpc, '') | 179 | SendPacket(actionCodes.Hero_wakeRpc, '') |
174 | 180 | ||
175 | role:checkTaskEnter("HeroStarCollect", {}) | 181 | role:checkTaskEnter("HeroStarCollect", {}) |
182 | + role:checkTaskEnter("HeroStartSum", {}) | ||
176 | return true | 183 | return true |
177 | end | 184 | end |
178 | 185 | ||
@@ -212,7 +219,7 @@ function _M.talentRpc(agent, data) | @@ -212,7 +219,7 @@ function _M.talentRpc(agent, data) | ||
212 | talent = talent:setv(1, curLevel + 1) | 219 | talent = talent:setv(1, curLevel + 1) |
213 | end | 220 | end |
214 | curStage = talent:getv(0, 1) | 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 | hero:updateProperty({field = "talent", value = talent}) | 224 | hero:updateProperty({field = "talent", value = talent}) |
218 | 225 | ||
@@ -1382,4 +1389,27 @@ function _M.saveGeniusTreeRpc(agent, data) | @@ -1382,4 +1389,27 @@ function _M.saveGeniusTreeRpc(agent, data) | ||
1382 | return true | 1389 | return true |
1383 | end | 1390 | end |
1384 | 1391 | ||
1392 | +function _M.stickersConvertRpc(agent, data) | ||
1393 | + local role = agent.role | ||
1394 | + local msg = MsgPack.unpack(data) | ||
1395 | + local itemId = msg.itemId | ||
1396 | + local heroType = msg.heroType -- heroId-300 举例 [泡泡]= {[heroType] = 120, [heroId]= 420} | ||
1397 | + | ||
1398 | + local itemData = csvdb["itemCsv"][itemId] | ||
1399 | + if not itemData then return 1 end | ||
1400 | + | ||
1401 | + local useEffect = itemData["use_effect"]:toNumMap() | ||
1402 | + if not useEffect[heroType] then return 2 end | ||
1403 | + | ||
1404 | + if not role:isHaveHero(heroType) then return 3 end | ||
1405 | + | ||
1406 | + local cost = {[itemId] = 1} | ||
1407 | + if not role:checkItemEnough(cost) then return 4 end | ||
1408 | + role:costItems({[heroType] = cost}, {log = {desc = "heroStickers"}}) | ||
1409 | + local reward, change = role:award({[heroType] = 1}, {log = {desc = "heroStickers"}}) | ||
1410 | + | ||
1411 | + SendPacket(actionCodes.Hero_stickersConvertRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1412 | + return true | ||
1413 | +end | ||
1414 | + | ||
1385 | return _M | 1415 | return _M |
src/actions/RoleAction.lua
@@ -335,8 +335,14 @@ function _M.loginRpc( agent, data ) | @@ -335,8 +335,14 @@ function _M.loginRpc( agent, data ) | ||
335 | 335 | ||
336 | local hangPass = role:getProperty("hangPass") | 336 | local hangPass = role:getProperty("hangPass") |
337 | role:mylog("login", {key1 = agent.ip:toArray(false, ":")[1], int1 = hangPass[1] or 0}) | 337 | role:mylog("login", {key1 = agent.ip:toArray(false, ":")[1], int1 = hangPass[1] or 0}) |
338 | - if msg.newdevice then | ||
339 | - role:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) | 338 | + |
339 | + -- 是否是新设备 | ||
340 | + local deviced = cluster.query("center", "deviced") | ||
341 | + if deviced then | ||
342 | + local status, back = pcall(cluster.call, "center", deviced, "isNewDevice", {device = msg.device}) | ||
343 | + if status and back then | ||
344 | + role:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) | ||
345 | + end | ||
340 | end | 346 | end |
341 | 347 | ||
342 | return true | 348 | return true |
@@ -614,11 +620,11 @@ function _M.openItemRpc(agent, data) | @@ -614,11 +620,11 @@ function _M.openItemRpc(agent, data) | ||
614 | local msg = MsgPack.unpack(data) | 620 | local msg = MsgPack.unpack(data) |
615 | local itemId = msg.itemId | 621 | local itemId = msg.itemId |
616 | local count = msg.count | 622 | local count = msg.count |
617 | - if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end | 623 | + if math.illegalNum(count, 1, role:getItemCount(itemId)) then return 1 end |
618 | local itemData = csvdb["itemCsv"][itemId] | 624 | local itemData = csvdb["itemCsv"][itemId] |
619 | - if itemData.use_type ~= 2 then return end | 625 | + if itemData.use_type ~= 2 then return 2 end |
620 | local randomData = csvdb["item_randomCsv"][tonumber(itemData.use_effect)] | 626 | local randomData = csvdb["item_randomCsv"][tonumber(itemData.use_effect)] |
621 | - if not randomData or randomData.openTime > 0 then return end | 627 | + if not randomData or randomData.openTime > 0 then return 3 end |
622 | 628 | ||
623 | local reward = {} | 629 | local reward = {} |
624 | for _i = 1, count do | 630 | for _i = 1, count do |
@@ -1282,10 +1288,13 @@ function _M.chatRpc(agent, data) | @@ -1282,10 +1288,13 @@ function _M.chatRpc(agent, data) | ||
1282 | red:rpush(CHAT_OFFLINE:format(objectId), bin) | 1288 | red:rpush(CHAT_OFFLINE:format(objectId), bin) |
1283 | red:ltrim(CHAT_OFFLINE:format(objectId), -200, -1) | 1289 | red:ltrim(CHAT_OFFLINE:format(objectId), -200, -1) |
1284 | end) | 1290 | end) |
1285 | - -- 若在线,实时发送聊天信息 | ||
1286 | - local agent = datacenter.get("agent", objectId) | ||
1287 | - if agent then | ||
1288 | - SendPacket(actionCodes.Role_chat, bin, agent.fd) | 1291 | + |
1292 | + if role:getProperty("silent") < now then --禁言 | ||
1293 | + -- 若在线,实时发送聊天信息 | ||
1294 | + local agent = datacenter.get("agent", objectId) | ||
1295 | + if agent then | ||
1296 | + SendPacket(actionCodes.Role_chat, bin, agent.fd) | ||
1297 | + end | ||
1289 | end | 1298 | end |
1290 | end | 1299 | end |
1291 | SendPacket(actionCodes.Role_chat, bin) | 1300 | SendPacket(actionCodes.Role_chat, bin) |
@@ -1549,9 +1558,11 @@ function _M.diamondConvertRpc(agent, data) | @@ -1549,9 +1558,11 @@ function _M.diamondConvertRpc(agent, data) | ||
1549 | local allReward = {} | 1558 | local allReward = {} |
1550 | if remain > old then | 1559 | if remain > old then |
1551 | allReward[ItemId.Jade] = remain - old | 1560 | allReward[ItemId.Jade] = remain - old |
1561 | + role:checkWorldChangePoints({[ItemWorldLine.CostJade]= quan * globalCsv.recruit_cost}) | ||
1552 | elseif remain == old then | 1562 | elseif remain == old then |
1553 | else | 1563 | else |
1554 | role:costItems({[ItemId.Jade] = old - remain}, {log = {desc = "convert", short1=oper}}) | 1564 | role:costItems({[ItemId.Jade] = old - remain}, {log = {desc = "convert", short1=oper}}) |
1565 | + role:checkWorldChangePoints({[ItemWorldLine.CostJade]= quan * globalCsv.recruit_cost - (old - remain)}) | ||
1555 | end | 1566 | end |
1556 | 1567 | ||
1557 | if quan > 0 then | 1568 | if quan > 0 then |
@@ -1598,7 +1609,7 @@ function _M.useSelectItemRpc(agent, data) | @@ -1598,7 +1609,7 @@ function _M.useSelectItemRpc(agent, data) | ||
1598 | local count = msg.count | 1609 | local count = msg.count |
1599 | if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end | 1610 | if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end |
1600 | local itemData = csvdb["itemCsv"][itemId] | 1611 | local itemData = csvdb["itemCsv"][itemId] |
1601 | - if not (itemData.type == ItemType.SelectItemBox or itemData.type == ItemType.CommonPaster) then return end | 1612 | + if not (itemData.type == ItemType.SelectItemBox or itemData.type == ItemType.CommonPaster or itemData.type == ItemType.Stick) then return end |
1602 | local itemMap = itemData.use_effect:toNumMap() | 1613 | local itemMap = itemData.use_effect:toNumMap() |
1603 | local reward, change = {} | 1614 | local reward, change = {} |
1604 | for k, v in pairs(itemMap) do | 1615 | for k, v in pairs(itemMap) do |
@@ -1712,36 +1723,112 @@ function _M.setBgRpc(agent, data) | @@ -1712,36 +1723,112 @@ function _M.setBgRpc(agent, data) | ||
1712 | return true | 1723 | return true |
1713 | end | 1724 | end |
1714 | 1725 | ||
1715 | -function _M.itemConvertMonthCardRpc(agent, data) | 1726 | +function _M.itemConvertSpecialRpc(agent, data) |
1716 | local role = agent.role | 1727 | local role = agent.role |
1717 | local msg = MsgPack.unpack(data) | 1728 | local msg = MsgPack.unpack(data) |
1718 | local itemId = msg.item_id | 1729 | local itemId = msg.item_id |
1719 | - local typ = msg.typ | ||
1720 | - local count = msg.count | ||
1721 | - local exchangeId = msg.change_id | 1730 | + local exchangeId = tonumber(msg.exchange_id) |
1722 | 1731 | ||
1723 | - if not ItemId[itemId] then return 1 end | ||
1724 | - | ||
1725 | - if not role:checkItemEnough({[itemId] = count}) then return 2 end | ||
1726 | - role:costItems({[itemId] = count}, {log = {desc = "itemConvertmonthCard", int1 = count, int2 = count}}) | 1732 | + local itemData = csvdb["itemCsv"][itemId] |
1733 | + if not itemData then return 1 end | ||
1727 | 1734 | ||
1728 | local rechargeData = csvdb["shop_rechargeCsv"][exchangeId] | 1735 | local rechargeData = csvdb["shop_rechargeCsv"][exchangeId] |
1729 | if not rechargeData then | 1736 | if not rechargeData then |
1730 | skynet.error("[recharge] recharge id not exist", exchangeId) | 1737 | skynet.error("[recharge] recharge id not exist", exchangeId) |
1731 | - return 3 | 1738 | + return 2 |
1732 | end | 1739 | end |
1733 | - local reward = {} | ||
1734 | - for i = 1, count do | ||
1735 | - local tmpreward, _ = role.storeData:onBuyCard(rechargeData.type, rechargeData.id , rechargeData.activity_id) | 1740 | + |
1741 | + if not role:checkItemEnough({[itemId] = 1}) then return 3 end | ||
1742 | + | ||
1743 | + local reward = {} | ||
1744 | + | ||
1745 | + if not role.storeData:checkRechargeRecord(rechargeData.limit, exchangeId)then | ||
1746 | + return 5 | ||
1747 | + end | ||
1748 | + | ||
1749 | + if rechargeData.type == CardType.ActBattleCommandCard then | ||
1750 | + if role.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then | ||
1751 | + local tmpreward, _ = role.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) | ||
1752 | + if tmpreward then | ||
1753 | + table.rewardMerge(reward, tmpreward) | ||
1754 | + end | ||
1755 | + else | ||
1756 | + skynet.error("not open id: ".. rechargeData.id .. "; actid: " .. rechargeData.activity_id) | ||
1757 | + SendPacket(actionCodes.Role_itemConvertSpecialRpc, MsgPack.pack({result = 4})) | ||
1758 | + return true | ||
1759 | + end | ||
1760 | + else | ||
1761 | + local tmpreward, _ = role.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) | ||
1736 | if tmpreward then | 1762 | if tmpreward then |
1737 | table.rewardMerge(reward, tmpreward) | 1763 | table.rewardMerge(reward, tmpreward) |
1738 | - else | ||
1739 | - return | ||
1740 | end | 1764 | end |
1741 | end | 1765 | end |
1742 | 1766 | ||
1743 | - SendPacket(actionCodes.Role_itemConvertMonthCardRpc, MsgPack.pack(role:packReward(reward))) | ||
1744 | - return status | 1767 | + role:costItems({[itemId] = 1}, {log = {desc = "itemConvertSpecial", int1 = itemId, int2 = itemData.type}}) |
1768 | + | ||
1769 | + SendPacket(actionCodes.Role_itemConvertSpecialRpc, MsgPack.pack(role:packReward(reward))) | ||
1770 | + return true | ||
1771 | +end | ||
1772 | + | ||
1773 | +function _M.worldLineRouletteRpc(agent, data) | ||
1774 | + local role = agent.role | ||
1775 | + | ||
1776 | + local worldChangePoints = role:getProperty("worldChangePoints") or {} | ||
1777 | + local rouletteCount = worldChangePoints[ItemWorldLine.RouletteCount] or 0 | ||
1778 | + if rouletteCount == 0 then return 1 end | ||
1779 | + | ||
1780 | + local worldline_gift_base_10, worldline_gift_base_1, worldline_gift_magnification_1, worldline_gift_magnification_0 = {}, {}, {}, {} | ||
1781 | + for k, v in pairs(globalCsv.worldline_gift_base_10) do | ||
1782 | + worldline_gift_base_10[k] = {v} | ||
1783 | + end | ||
1784 | + for k, v in pairs(globalCsv.worldline_gift_base_1) do | ||
1785 | + worldline_gift_base_1[k] = {v} | ||
1786 | + end | ||
1787 | + for k, v in pairs(globalCsv.worldline_gift_magnification_1) do | ||
1788 | + worldline_gift_magnification_1[k] = {v} | ||
1789 | + end | ||
1790 | + for k, v in pairs(globalCsv["worldline_gift_magnification_0.1"]) do | ||
1791 | + worldline_gift_magnification_0[k] = {v} | ||
1792 | + end | ||
1793 | + | ||
1794 | + local gift_base_10 = (math.randWeight(worldline_gift_base_10, 1) or 0) * 10 | ||
1795 | + local gift_base_1 = math.randWeight(worldline_gift_base_1, 1) or 0 | ||
1796 | + | ||
1797 | + local gift_magnification_1 = math.randWeight(worldline_gift_magnification_1, 1) or 0 | ||
1798 | + local gift_magnification_0 = (math.randWeight(worldline_gift_magnification_0, 1) or 0) * (0.1) | ||
1799 | + | ||
1800 | + local points = math.floor((gift_base_10 + gift_base_1) * (gift_magnification_1 + gift_magnification_0)) | ||
1801 | + worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1 | ||
1802 | + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + points | ||
1803 | + role:updateProperty({field = "worldChangePoints", value = worldChangePoints}) | ||
1804 | + | ||
1805 | + SendPacket(actionCodes.Role_worldLineRouletteRpc, MsgPack.pack({base_10 = gift_base_10, base_1 = gift_base_1, magnification_1 = gift_magnification_1, magnification_0 = gift_magnification_0})) | ||
1806 | + return true | ||
1807 | +end | ||
1808 | + | ||
1809 | +function _M.worldLineRewardRpc(agent, data) | ||
1810 | + local role = agent.role | ||
1811 | + local worldLineReward = role:getProperty("worldLineReward") or {} | ||
1812 | + local worldChangePoints = role:getProperty("worldChangePoints") or {} | ||
1813 | + local points = worldChangePoints[ItemWorldLine.Points] or 0 | ||
1814 | + | ||
1815 | + local reward, change = {} | ||
1816 | + for key, val in pairs(csvdb["worldline_awardCsv"]) do | ||
1817 | + if points >= key and not worldLineReward[key] then | ||
1818 | + for k, v in pairs(val.award:toNumMap()) do | ||
1819 | + reward[k] = (reward[k] or 0) + v | ||
1820 | + end | ||
1821 | + worldLineReward[key] = 1 | ||
1822 | + end | ||
1823 | + end | ||
1824 | + | ||
1825 | + role:updateProperty({field = "worldLineReward", value = worldLineReward}) | ||
1826 | + | ||
1827 | + if next(reward) then | ||
1828 | + reward, change = role:award(reward, {log = {desc = "worldLine", int1 = role:getProperty("id")}}) | ||
1829 | + end | ||
1830 | + SendPacket(actionCodes.Role_worldLineRewardRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1831 | + return true | ||
1745 | end | 1832 | end |
1746 | 1833 | ||
1747 | return _M | 1834 | return _M |
1748 | \ No newline at end of file | 1835 | \ No newline at end of file |
src/actions/StoreAction.lua
@@ -254,6 +254,34 @@ function _M.iosRechargeRpc(agent, data) | @@ -254,6 +254,34 @@ function _M.iosRechargeRpc(agent, data) | ||
254 | return true | 254 | return true |
255 | end | 255 | end |
256 | 256 | ||
257 | +-- dyh android 充值 入口 | ||
258 | +function _M.dyhxAndroidRechargeRpc(agent, data) | ||
259 | + local role = agent.role | ||
260 | + local msg = MsgPack.unpack(data) | ||
261 | + local id = msg.id | ||
262 | + local choose = msg.choose or "" | ||
263 | + local dataSet = csvdb["shop_rechargeCsv"][id] | ||
264 | + if not dataSet then return end | ||
265 | + local roleId = role:getProperty("id") | ||
266 | + | ||
267 | + role.ignoreHeartbeat = true | ||
268 | + --创建订单号 | ||
269 | + local partnerOrderId = role:getPurchaseOrder(id,nil,choose) | ||
270 | + -- 签名 | ||
271 | + local secret_key = "51ba4398c69d4d229d5402295dc38b50" | ||
272 | + local need = { | ||
273 | + out_trade_no = partnerOrderId, | ||
274 | + money = dataSet.rmb * 100, | ||
275 | + game_money = dataSet.diamond, | ||
276 | + notify_url = msg.notifyUrl | ||
277 | + } | ||
278 | + local sign = signDyhPms(need, secret_key) | ||
279 | + | ||
280 | + SendPacket(actionCodes.Store_dyhxAndroidRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign})) | ||
281 | + return true | ||
282 | +end | ||
283 | + | ||
284 | + | ||
257 | function _M.purchaseOrderResult(agent, data) | 285 | function _M.purchaseOrderResult(agent, data) |
258 | local role = agent.role | 286 | local role = agent.role |
259 | 287 | ||
@@ -507,8 +535,16 @@ function _M.getExploreCommandRewardRpc(agent, data) | @@ -507,8 +535,16 @@ function _M.getExploreCommandRewardRpc(agent, data) | ||
507 | return 3 | 535 | return 3 |
508 | end | 536 | end |
509 | 537 | ||
510 | - if not role:checkHangPass(config.level) then | ||
511 | - return 4 | 538 | + for k, level in pairs(config.level:toNumMap()) do |
539 | + if k == 1 then | ||
540 | + if not role:checkHangPass(level) then | ||
541 | + return 4 | ||
542 | + end | ||
543 | + elseif k == 2 then | ||
544 | + if not role:checkAdvChapterPass(level) then | ||
545 | + return 4 | ||
546 | + end | ||
547 | + end | ||
512 | end | 548 | end |
513 | 549 | ||
514 | local gift = "" | 550 | local gift = "" |
src/agent.lua
@@ -35,10 +35,17 @@ local function handle_timeout() | @@ -35,10 +35,17 @@ local function handle_timeout() | ||
35 | skynet.timeout(100, handle_timeout) | 35 | skynet.timeout(100, handle_timeout) |
36 | end | 36 | end |
37 | 37 | ||
38 | +local function handle_gc() | ||
39 | + if not agentInfo.open_timer then return end | ||
40 | + collectgarbage("collect") | ||
41 | + skynet.timeout(6000, handle_gc) | ||
42 | +end | ||
43 | + | ||
38 | function start_agent_timer() | 44 | function start_agent_timer() |
39 | if agentInfo.open_timer then return end | 45 | if agentInfo.open_timer then return end |
40 | agentInfo.open_timer = true | 46 | agentInfo.open_timer = true |
41 | skynet.timeout(150, handle_timeout) | 47 | skynet.timeout(150, handle_timeout) |
48 | + skynet.timeout(6000, handle_gc) | ||
42 | end | 49 | end |
43 | 50 | ||
44 | function cancel_agent_timer() | 51 | function cancel_agent_timer() |
src/models/Activity.lua
@@ -93,6 +93,8 @@ Activity.schema = { | @@ -93,6 +93,8 @@ Activity.schema = { | ||
93 | 93 | ||
94 | act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100} | 94 | act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100} |
95 | act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} | 95 | act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} |
96 | + | ||
97 | + reset20 = {"number", 1}, -- 重置扭蛋机 | ||
96 | } | 98 | } |
97 | 99 | ||
98 | function Activity:data() | 100 | function Activity:data() |
@@ -121,6 +123,8 @@ function Activity:data() | @@ -121,6 +123,8 @@ function Activity:data() | ||
121 | 123 | ||
122 | act34 = self:getProperty("act34"), | 124 | act34 = self:getProperty("act34"), |
123 | act36 = self:getProperty("act36"), | 125 | act36 = self:getProperty("act36"), |
126 | + | ||
127 | + reset20 = self:getProperty("reset20") | ||
124 | } | 128 | } |
125 | end | 129 | end |
126 | 130 | ||
@@ -207,6 +211,24 @@ function Activity:isOpenById(id, activityType) | @@ -207,6 +211,24 @@ function Activity:isOpenById(id, activityType) | ||
207 | return self._isOpen[id] | 211 | return self._isOpen[id] |
208 | end | 212 | end |
209 | 213 | ||
214 | +function Activity:isResetById(id, activityType) | ||
215 | + activityType = checkActivityType(activityType) | ||
216 | + local cfg = csvdb["activity_ctrlCsv"][id] | ||
217 | + if not cfg then return false end | ||
218 | + if activityType ~= 0 and cfg.showType ~= activityType then return false end | ||
219 | + return self:getResetData(activityType) == 0 | ||
220 | +end | ||
221 | + | ||
222 | +function Activity:getResetData(actType) | ||
223 | + actType = checkActivityType(actType) | ||
224 | + return self:getProperty("reset" .. actType) | ||
225 | +end | ||
226 | + | ||
227 | +function Activity:updateResetData(actType, reset) | ||
228 | + actType = checkActivityType(actType) | ||
229 | + self:updateProperty({field = "reset" .. actType, value = reset}) | ||
230 | +end | ||
231 | + | ||
210 | function Activity:getActData(actType) | 232 | function Activity:getActData(actType) |
211 | actType = checkActivityType(actType) | 233 | actType = checkActivityType(actType) |
212 | return self:getProperty("act" .. actType) | 234 | return self:getProperty("act" .. actType) |
@@ -756,8 +778,14 @@ activityFunc[Activity.ActivityType.Gachakon] = { | @@ -756,8 +778,14 @@ activityFunc[Activity.ActivityType.Gachakon] = { | ||
756 | self:updateActData(actType, {}, not notify) | 778 | self:updateActData(actType, {}, not notify) |
757 | end, | 779 | end, |
758 | ["crossDay"] = function(self, actType, notify) | 780 | ["crossDay"] = function(self, actType, notify) |
759 | - self:updateActData(actType, {}, not notify) | 781 | + self:updateResetData(actType, 1) |
782 | + --self:updateActData(actType, {}, not notify) | ||
760 | end, | 783 | end, |
784 | + ["reset"] = function(self, actType) | ||
785 | + if self:getResetData(actType) == 0 then return end | ||
786 | + self:updateResetData(actType, 0) | ||
787 | + self:updateActData(actType, {}) | ||
788 | + end | ||
761 | } | 789 | } |
762 | 790 | ||
763 | -- 活动卡池 | 791 | -- 活动卡池 |
@@ -865,6 +893,15 @@ function Activity:refreshWeekData(notify) | @@ -865,6 +893,15 @@ function Activity:refreshWeekData(notify) | ||
865 | end | 893 | end |
866 | end | 894 | end |
867 | 895 | ||
896 | +function Activity:resetActDataById(actId) | ||
897 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
898 | + if not actData then return end | ||
899 | + local actType = actData.showType | ||
900 | + if activityFunc[actType] and activityFunc[actType]['reset'] then | ||
901 | + activityFunc[actType]["reset"](self, actType) | ||
902 | + end | ||
903 | +end | ||
904 | + | ||
868 | function Activity:checkActivity(notNotify, activityType, ...) | 905 | function Activity:checkActivity(notNotify, activityType, ...) |
869 | if not activityType then return end | 906 | if not activityType then return end |
870 | if not self:isOpen(activityType) then return end | 907 | if not self:isOpen(activityType) then return end |
src/models/Email.lua
@@ -10,7 +10,7 @@ Email.schema = { | @@ -10,7 +10,7 @@ Email.schema = { | ||
10 | emailId = {"number", 0}, -- 邮件csv ID | 10 | emailId = {"number", 0}, -- 邮件csv ID |
11 | title = {"string", ""}, -- 邮件标题 | 11 | title = {"string", ""}, -- 邮件标题 |
12 | stitle = {"string", ""}, -- 小标题 | 12 | stitle = {"string", ""}, -- 小标题 |
13 | - content = {"string", ""}, -- 邮件正文 | 13 | + content = {"string", "", 2048}, -- 邮件正文 |
14 | attachments = {"string", "", 512}, | 14 | attachments = {"string", "", 512}, |
15 | status = {"number", 0}, -- 邮件状态: 未读, 已读, 已领取 | 15 | status = {"number", 0}, -- 邮件状态: 未读, 已读, 已领取 |
16 | createtime = {"number", skynet.timex()}, | 16 | createtime = {"number", skynet.timex()}, |
src/models/Role.lua
@@ -214,6 +214,9 @@ Role.schema = { | @@ -214,6 +214,9 @@ Role.schema = { | ||
214 | heroCnt = {"number", 0}, -- 英雄数量 | 214 | heroCnt = {"number", 0}, -- 英雄数量 |
215 | friendTeam = {"table", {}}, -- 好友切磋队伍信息 {bInfo = {}, team = {}, v = 0} | 215 | friendTeam = {"table", {}}, -- 好友切磋队伍信息 {bInfo = {}, team = {}, v = 0} |
216 | bgId = {"number", 0}, -- 看板娘id | 216 | bgId = {"number", 0}, -- 看板娘id |
217 | + | ||
218 | + worldChangePoints = {"table", {}}, -- 世界变动积分 {[1]= 转盘抽取次数, [2]= 获得的积分, [3]=魔导石消耗, [4]= 虹光玉消耗} | ||
219 | + worldLineReward = {"table", {}}, -- 世界积分 领取记录 {[id] = 1} | ||
217 | } | 220 | } |
218 | 221 | ||
219 | 222 | ||
@@ -457,6 +460,8 @@ function Role:data() | @@ -457,6 +460,8 @@ function Role:data() | ||
457 | unlockChap = self:getProperty("unlockChap"), -- 解锁的章节 | 460 | unlockChap = self:getProperty("unlockChap"), -- 解锁的章节 |
458 | friendTeam = self:getProperty("friendTeam"), | 461 | friendTeam = self:getProperty("friendTeam"), |
459 | bgId = self:getProperty("bgId"), | 462 | bgId = self:getProperty("bgId"), |
463 | + worldChangePoints = self:getProperty("worldChangePoints"), | ||
464 | + worldLineReward = self:getProperty("worldLineReward"), | ||
460 | } | 465 | } |
461 | end | 466 | end |
462 | 467 |
src/models/RoleCross.lua
@@ -167,8 +167,10 @@ RoleCross.bind = function (Role) | @@ -167,8 +167,10 @@ RoleCross.bind = function (Role) | ||
167 | }) | 167 | }) |
168 | self:checkTaskEnter("Wake", {heroType = heroId, wakeL = initData.heros.wakeL}) | 168 | self:checkTaskEnter("Wake", {heroType = heroId, wakeL = initData.heros.wakeL}) |
169 | self:checkTaskEnter("WakeCG", {heroType = heroId}) | 169 | self:checkTaskEnter("WakeCG", {heroType = heroId}) |
170 | - self:checkTaskEnter("WakeCGSum", {count = 1}) | ||
171 | self:checkTaskEnter("HeroTalent", {heroType = heroId, alv = aheadLevel}) | 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 | end | 175 | end |
174 | end | 176 | end |
src/models/RoleLog.lua
@@ -66,8 +66,10 @@ local ItemReason = { | @@ -66,8 +66,10 @@ local ItemReason = { | ||
66 | shopBuy = 150, -- 商店购买 | 66 | shopBuy = 150, -- 商店购买 |
67 | monthCardReward = 151, --月卡奖励 | 67 | monthCardReward = 151, --月卡奖励 |
68 | smonthCardReward = 152, --特刊奖励 | 68 | smonthCardReward = 152, --特刊奖励 |
69 | - itemConvertmonthCard = 153, --兑换月卡 | ||
70 | - itemConvertsmonthCard = 154, --兑换特刊 | 69 | + itemConvertSpecial = 153, --兑换月卡/战令/探索指令 特殊道具 |
70 | + buyDiamondCardReward = 154, --购买钻石额外赠送奖励 | ||
71 | + firstMonthCardReward = 155, --首次订阅月卡奖励 | ||
72 | + firstSMonthCardReward = 156, --首次订阅特刊奖励 | ||
71 | 73 | ||
72 | advHang = 301, -- 拾荒挂机 | 74 | advHang = 301, -- 拾荒挂机 |
73 | hangBattle = 302, -- 挂机战斗 | 75 | hangBattle = 302, -- 挂机战斗 |
@@ -144,6 +146,7 @@ local ItemReason = { | @@ -144,6 +146,7 @@ local ItemReason = { | ||
144 | sparkLvlUp = 1214, -- 火花强化 | 146 | sparkLvlUp = 1214, -- 火花强化 |
145 | sparkQualityUp = 1215, -- 火花升华 | 147 | sparkQualityUp = 1215, -- 火花升华 |
146 | heroGenius = 1216, -- 英雄天赋点 | 148 | heroGenius = 1216, -- 英雄天赋点 |
149 | + heroStickers = 1217, -- 英雄贴纸 | ||
147 | 150 | ||
148 | -- pvp | 151 | -- pvp |
149 | pvpCHead = 1301, -- pvp 跨服竞技场头像 | 152 | pvpCHead = 1301, -- pvp 跨服竞技场头像 |
@@ -163,6 +166,8 @@ local ItemReason = { | @@ -163,6 +166,8 @@ local ItemReason = { | ||
163 | CapsuleReward = 1411, --扭蛋机奖励 | 166 | CapsuleReward = 1411, --扭蛋机奖励 |
164 | CapsuleConvert = 1412, --扭蛋机 消耗票 兑换 | 167 | CapsuleConvert = 1412, --扭蛋机 消耗票 兑换 |
165 | CapsuleCoinCost = 1413, --抽扭蛋机消耗 | 168 | CapsuleCoinCost = 1413, --抽扭蛋机消耗 |
169 | + | ||
170 | + worldLine = 1500, --世界线积分 | ||
166 | } | 171 | } |
167 | 172 | ||
168 | 173 |
src/models/RolePlugin.lua
@@ -494,7 +494,7 @@ function RolePlugin.bind(Role) | @@ -494,7 +494,7 @@ function RolePlugin.bind(Role) | ||
494 | local originr = self:getProperty("sid") == IOS_SID and self:getProperty("reDiamondIos") or self:getProperty("reDiamond") | 494 | local originr = self:getProperty("sid") == IOS_SID and self:getProperty("reDiamondIos") or self:getProperty("reDiamond") |
495 | local origin = origind + originr | 495 | local origin = origind + originr |
496 | --if params.isRecharge then | 496 | --if params.isRecharge then |
497 | - if params.sid == IOS_SID then | 497 | + if self:getProperty("sid") == IOS_SID then |
498 | self:incrProperty("reDiamondIos", count) | 498 | self:incrProperty("reDiamondIos", count) |
499 | else | 499 | else |
500 | self:incrProperty("reDiamond", count) | 500 | self:incrProperty("reDiamond", count) |
@@ -574,12 +574,14 @@ function RolePlugin.bind(Role) | @@ -574,12 +574,14 @@ function RolePlugin.bind(Role) | ||
574 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) | 574 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
575 | 575 | ||
576 | self:checkTaskEnter("CostDiamond", {count = count}) | 576 | self:checkTaskEnter("CostDiamond", {count = count}) |
577 | + self:checkWorldChangePoints({[ItemWorldLine.CostDiamond]=count}) | ||
577 | return true | 578 | return true |
578 | end | 579 | end |
579 | 580 | ||
580 | function Role:costJade(param) | 581 | function Role:costJade(param) |
581 | self:addItem(param) | 582 | self:addItem(param) |
582 | self:checkTaskEnter("CostJade", {count = - param.count}) | 583 | self:checkTaskEnter("CostJade", {count = - param.count}) |
584 | + self:checkWorldChangePoints({[ItemWorldLine.CostJade]= -param.count}) | ||
583 | end | 585 | end |
584 | 586 | ||
585 | function Role:increBy(field, val) | 587 | function Role:increBy(field, val) |
@@ -621,6 +623,8 @@ function RolePlugin.bind(Role) | @@ -621,6 +623,8 @@ function RolePlugin.bind(Role) | ||
621 | end | 623 | end |
622 | self:checkTaskEnter("AddHero", {heroType = heroType, wakeL = newHero:getProperty("wakeL"), camp = unitData.camp, job = unitData.job, ssrCount = ssrCount}, params.notNotify) | 624 | self:checkTaskEnter("AddHero", {heroType = heroType, wakeL = newHero:getProperty("wakeL"), camp = unitData.camp, job = unitData.job, ssrCount = ssrCount}, params.notNotify) |
623 | self:checkTaskEnter("HeroQualityCollect", {}) | 625 | self:checkTaskEnter("HeroQualityCollect", {}) |
626 | + self:checkTaskEnter("HeroStartSum", {}) | ||
627 | + | ||
624 | if not params.notNotify then | 628 | if not params.notNotify then |
625 | local heroResponse = {} | 629 | local heroResponse = {} |
626 | table.insert(heroResponse, newHero:data()) | 630 | table.insert(heroResponse, newHero:data()) |
@@ -2431,7 +2435,7 @@ function RolePlugin.bind(Role) | @@ -2431,7 +2435,7 @@ function RolePlugin.bind(Role) | ||
2431 | return 1 | 2435 | return 1 |
2432 | end | 2436 | end |
2433 | 2437 | ||
2434 | - if not self.storeData:checkRechargeRecord(rechargeData.limit, id) and rechargeData.shop ~= 2 then | 2438 | + if not self.storeData:checkRechargeRecord(rechargeData.limit, id)then |
2435 | return 2 | 2439 | return 2 |
2436 | end | 2440 | end |
2437 | 2441 | ||
@@ -2446,6 +2450,12 @@ function RolePlugin.bind(Role) | @@ -2446,6 +2450,12 @@ function RolePlugin.bind(Role) | ||
2446 | self:updateProperty({field = "rechargeF", value = rechargeF}) | 2450 | self:updateProperty({field = "rechargeF", value = rechargeF}) |
2447 | end | 2451 | end |
2448 | self:gainDiamond({count = diamondCount, isRecharge = true, sid = params.sid, log = {desc = "recharge", int1 = id}}) | 2452 | self:gainDiamond({count = diamondCount, isRecharge = true, sid = params.sid, log = {desc = "recharge", int1 = id}}) |
2453 | + | ||
2454 | + --已购月卡 购买魔导石 赠送cardReward | ||
2455 | + if not self.storeData:isMonthCardExpire() then | ||
2456 | + reward, _ = self:award(rechargeData.cardReward, {isRecharge = true, log = {desc = "buyDiamondCardReward", int1 = id}}) | ||
2457 | + end | ||
2458 | + | ||
2449 | elseif rechargeData.shop == 2 then --通行证商店 | 2459 | elseif rechargeData.shop == 2 then --通行证商店 |
2450 | --签收 + 订阅奖励 | 2460 | --签收 + 订阅奖励 |
2451 | local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) | 2461 | local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) |
@@ -2455,10 +2465,7 @@ function RolePlugin.bind(Role) | @@ -2455,10 +2465,7 @@ function RolePlugin.bind(Role) | ||
2455 | elseif rechargeData.shop == 3 then -- 礼包商店 | 2465 | elseif rechargeData.shop == 3 then -- 礼包商店 |
2456 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | 2466 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
2457 | 2467 | ||
2458 | - --增加购买记录 | ||
2459 | - local buyRecord = self.storeData:getProperty("buyR") or {} | ||
2460 | - buyRecord[id] = (buyRecord[id] or 0) + 1 | ||
2461 | - self.storeData:updateProperty({field = "buyR", value = buyRecord}) | 2468 | + self:checkTaskEnter("BuyLimitPack", {id = id}) |
2462 | else | 2469 | else |
2463 | skynet.error("[recharge] invalid recharge shop type " .. id) | 2470 | skynet.error("[recharge] invalid recharge shop type " .. id) |
2464 | return 3 | 2471 | return 3 |
@@ -3013,6 +3020,16 @@ function RolePlugin.bind(Role) | @@ -3013,6 +3020,16 @@ function RolePlugin.bind(Role) | ||
3013 | return levelBnous[SystemBnousType.ChangeBuyCount] or 0 | 3020 | return levelBnous[SystemBnousType.ChangeBuyCount] or 0 |
3014 | end | 3021 | end |
3015 | 3022 | ||
3023 | + function Role:getBnousExtraProps() | ||
3024 | + local levelBnous = self:getLevelBnous() | ||
3025 | + return levelBnous[SystemBnousType.ExtraProps] or {} | ||
3026 | + end | ||
3027 | + | ||
3028 | + function Role:getAccountLevel() | ||
3029 | + local levelBnous = self:getLevelBnous() | ||
3030 | + return levelBnous[SystemBnousType.AccountLevel] or 0 | ||
3031 | + end | ||
3032 | + | ||
3016 | function Role:getLevelBnous() | 3033 | function Role:getLevelBnous() |
3017 | local levelBnous = {} | 3034 | local levelBnous = {} |
3018 | local curLevel = self:getProperty("level") | 3035 | local curLevel = self:getProperty("level") |
@@ -3041,6 +3058,11 @@ function RolePlugin.bind(Role) | @@ -3041,6 +3058,11 @@ function RolePlugin.bind(Role) | ||
3041 | levelBnous[pm1] = 0 | 3058 | levelBnous[pm1] = 0 |
3042 | end | 3059 | end |
3043 | levelBnous[pm1] = levelBnous[pm1] + pm2 | 3060 | levelBnous[pm1] = levelBnous[pm1] + pm2 |
3061 | + elseif pm1 == SystemBnousType.AccountLevel then | ||
3062 | + if type(levelBnous[pm1]) == "table" then | ||
3063 | + levelBnous[pm1] = 0 | ||
3064 | + end | ||
3065 | + levelBnous[pm1] = math.max(levelBnous[pm1], pm2) | ||
3044 | else | 3066 | else |
3045 | levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 | 3067 | levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 |
3046 | end | 3068 | end |
@@ -3263,6 +3285,24 @@ function RolePlugin.bind(Role) | @@ -3263,6 +3285,24 @@ function RolePlugin.bind(Role) | ||
3263 | 3285 | ||
3264 | return capsule:getSpecialNotify(roleId) | 3286 | return capsule:getSpecialNotify(roleId) |
3265 | end | 3287 | end |
3288 | + | ||
3289 | + function Role:checkWorldChangePoints(param) | ||
3290 | + local worldChangePoints = self:getProperty("worldChangePoints") or {} | ||
3291 | + if param[ItemWorldLine.CostJade] then | ||
3292 | + worldChangePoints[ItemWorldLine.CostJade] = (worldChangePoints[ItemWorldLine.CostJade] or 0) + param[ItemWorldLine.CostJade] | ||
3293 | + local cost = math.floor(worldChangePoints[ItemWorldLine.CostJade] / globalCsv.worldline_gift) | ||
3294 | + worldChangePoints[ItemWorldLine.CostJade] = worldChangePoints[ItemWorldLine.CostJade] - cost * globalCsv.worldline_gift | ||
3295 | + worldChangePoints[ItemWorldLine.RouletteCount] = (worldChangePoints[ItemWorldLine.RouletteCount] or 0) + cost | ||
3296 | + end | ||
3297 | + | ||
3298 | + if param[ItemWorldLine.CostDiamond] then | ||
3299 | + worldChangePoints[ItemWorldLine.CostDiamond] = (worldChangePoints[ItemWorldLine.CostDiamond] or 0) + param[ItemWorldLine.CostDiamond] | ||
3300 | + local cost = math.floor(worldChangePoints[ItemWorldLine.CostDiamond] / globalCsv.worldline_count_currency) | ||
3301 | + worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost * globalCsv.worldline_count_currency | ||
3302 | + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + cost | ||
3303 | + end | ||
3304 | + self:updateProperty({field = "worldChangePoints", value = worldChangePoints}) | ||
3305 | + end | ||
3266 | end | 3306 | end |
3267 | 3307 | ||
3268 | return RolePlugin | 3308 | return RolePlugin |
3269 | \ No newline at end of file | 3309 | \ No newline at end of file |
src/models/RoleTask.lua
@@ -116,6 +116,7 @@ local TaskType = { | @@ -116,6 +116,7 @@ local TaskType = { | ||
116 | Appoint = 912, -- 触发限时礼包,指定id | 116 | Appoint = 912, -- 触发限时礼包,指定id |
117 | Rename = 913, -- 重命名 | 117 | Rename = 913, -- 重命名 |
118 | CostJade = 914, -- 消耗虹光玉 | 118 | CostJade = 914, -- 消耗虹光玉 |
119 | + BuyLimitPack = 915, -- 购买指定id礼包触发 | ||
119 | 120 | ||
120 | --功能未实现 todo | 121 | --功能未实现 todo |
121 | AdvShop = 1002, -- 冒险商城 | 122 | AdvShop = 1002, -- 冒险商城 |
@@ -280,6 +281,8 @@ local StoreListener = { | @@ -280,6 +281,8 @@ local StoreListener = { | ||
280 | [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, | 281 | [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, |
281 | [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, | 282 | [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, |
282 | [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, | 283 | [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, |
284 | + [TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}}, | ||
285 | + [TaskType.HeroTalent] = {{TriggerEventType.HeroTalent, f("count")}}, | ||
283 | } | 286 | } |
284 | } | 287 | } |
285 | 288 |
src/models/Store.lua
@@ -30,11 +30,12 @@ Store.schema = { | @@ -30,11 +30,12 @@ Store.schema = { | ||
30 | 30 | ||
31 | monthCardEx = {"number", 0}, -- 期数 | 31 | monthCardEx = {"number", 0}, -- 期数 |
32 | monthCardId = {"number", 0}, -- 月卡id | 32 | monthCardId = {"number", 0}, -- 月卡id |
33 | - firstMonthCard = {"number", 1}, -- 首次订阅月卡 | 33 | + firstMonthCard = {"number", 0}, -- 首次订阅月卡 |
34 | monthCardReceive = {"number", 0}, -- 月卡奖励领取记录 当天 0-未领取, 1-已经领取 | 34 | monthCardReceive = {"number", 0}, -- 月卡奖励领取记录 当天 0-未领取, 1-已经领取 |
35 | 35 | ||
36 | smonthCards = {"table", {}}, --特刊信息 {[id]={["buyCount"]=0, ["periods"]=0}} buyCount: 购买次数,periods: 剩余期数, | 36 | smonthCards = {"table", {}}, --特刊信息 {[id]={["buyCount"]=0, ["periods"]=0}} buyCount: 购买次数,periods: 剩余期数, |
37 | smonthCardReceive = {"number", 0}, -- 特刊奖励领取记录 当天 0-未领取, 1-已经领取 | 37 | smonthCardReceive = {"number", 0}, -- 特刊奖励领取记录 当天 0-未领取, 1-已经领取 |
38 | + firstSMonthCard = {"table", {}}, -- 首次订阅当期特刊 | ||
38 | 39 | ||
39 | battleCard = {"number", 0}, -- 赛季卡 | 40 | battleCard = {"number", 0}, -- 赛季卡 |
40 | battleFR = {"string", ""}, -- 免费赛季卡领取记录 | 41 | battleFR = {"string", ""}, -- 免费赛季卡领取记录 |
@@ -95,100 +96,15 @@ function Store:refreshWeekData(notify) | @@ -95,100 +96,15 @@ function Store:refreshWeekData(notify) | ||
95 | self:flushWeekShop() | 96 | self:flushWeekShop() |
96 | end | 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 | local smonthCards = self:getProperty("smonthCards") or {} | 101 | local smonthCards = self:getProperty("smonthCards") or {} |
181 | local smonthCard = smonthCards[id] or {} | 102 | local smonthCard = smonthCards[id] or {} |
182 | return smonthCard["periods"] or 0 | 103 | return smonthCard["periods"] or 0 |
183 | end | 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 | if cur_ex == 0 then return nil, nil end | 108 | if cur_ex == 0 then return nil, nil end |
193 | cur_ex = cur_ex - 1 | 109 | cur_ex = cur_ex - 1 |
194 | 110 | ||
@@ -203,7 +119,7 @@ SuperMonthCard["itemDaily"] = function(self, id) | @@ -203,7 +119,7 @@ SuperMonthCard["itemDaily"] = function(self, id) | ||
203 | return reward, change, cur_ex | 119 | return reward, change, cur_ex |
204 | end | 120 | end |
205 | 121 | ||
206 | -SuperMonthCard["itemFirst"] = function(self, id) | 122 | +local function getCardItemFirstReward(self, id) |
207 | local card = csvdb["shop_cardCsv"][id] or {} | 123 | local card = csvdb["shop_cardCsv"][id] or {} |
208 | local reward, _ = self.owner:award(card["itemFirst"], {isRecharge = true, log = {desc = "recharge", int1 = id}}) | 124 | local reward, _ = self.owner:award(card["itemFirst"], {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
209 | return reward | 125 | return reward |
@@ -384,8 +300,8 @@ end | @@ -384,8 +300,8 @@ end | ||
384 | function Store:getSMonthCardDailyReward(id) | 300 | function Store:getSMonthCardDailyReward(id) |
385 | if not id then return nil end | 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 | self:updateProperty({field = "smonthCardReceive", value = 1}) | 307 | self:updateProperty({field = "smonthCardReceive", value = 1}) |
@@ -402,14 +318,110 @@ function Store:getSMonthCardDailyReward(id) | @@ -402,14 +318,110 @@ function Store:getSMonthCardDailyReward(id) | ||
402 | end | 318 | end |
403 | 319 | ||
404 | function Store:firstBuyMonthCard(id) | 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}) | ||
407 | local card = csvdb["shop_cardCsv"][id] or {} | 323 | local card = csvdb["shop_cardCsv"][id] or {} |
408 | - return self.owner:award(card["itemOnce"], {log = {desc = "monthCardReward", int1 = id, int2 = 30}}) | 324 | + return self.owner:award(card["itemOnce"], {log = {desc = "firstMonthCardReward", int1 = id}}) |
409 | end | 325 | end |
410 | return nil | 326 | return nil |
411 | end | 327 | end |
412 | 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}) | ||
334 | + local card = csvdb["shop_cardCsv"][id] or {} | ||
335 | + return self.owner:award(card["itemOnce"], {log = {desc = "firstSMonthCardReward", int1 = id}}) | ||
336 | + end | ||
337 | + return nil | ||
338 | +end | ||
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 | function Store:onBuyCard(type, duration, id, actid) | 426 | function Store:onBuyCard(type, duration, id, actid) |
415 | local timeNow = skynet.timex() | 427 | local timeNow = skynet.timex() |
@@ -420,20 +432,23 @@ function Store:onBuyCard(type, duration, id, actid) | @@ -420,20 +432,23 @@ function Store:onBuyCard(type, duration, id, actid) | ||
420 | self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + 30}) | 432 | self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + 30}) |
421 | 433 | ||
422 | local reward = {} | 434 | local reward = {} |
423 | - --初回特典 仅首次购买月卡时赠送SSR级角色"拉塔托娅" | ||
424 | - local tmpreward, _ = self:firstBuyMonthCard(id) | 435 | + local tmpreward, _ = self:firstBuyMonthCard(id) --初回特典 仅首次购买月卡 |
425 | if tmpreward then table.rewardMerge(reward, tmpreward) end | 436 | if tmpreward then table.rewardMerge(reward, tmpreward) end |
426 | 437 | ||
427 | - --订阅奖励 | ||
428 | - tmpreward = SuperMonthCard["itemFirst"](self, id) | 438 | + tmpreward = getCardItemFirstReward(self, id) --订阅奖励 |
429 | if next(tmpreward) then table.rewardMerge(reward, tmpreward) end | 439 | if next(tmpreward) then table.rewardMerge(reward, tmpreward) end |
430 | 440 | ||
431 | return reward | 441 | return reward |
432 | elseif type == CardType.SuperMonthCard then | 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 | end | 449 | end |
450 | + | ||
451 | + skynet.error("特刊购买失败:"..id) | ||
437 | return nil | 452 | return nil |
438 | elseif type == CardType.NormalMonthCardLevelUp then | 453 | elseif type == CardType.NormalMonthCardLevelUp then |
439 | if self:isMonthCardExpire() then | 454 | if self:isMonthCardExpire() then |
@@ -610,56 +625,56 @@ function Store:OnTriggerLimitTimePack(eventType, param) | @@ -610,56 +625,56 @@ function Store:OnTriggerLimitTimePack(eventType, param) | ||
610 | break | 625 | break |
611 | end | 626 | end |
612 | end | 627 | end |
613 | - if config ~= nil then | ||
614 | - -- 每日循环弹窗 | ||
615 | - local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1} | ||
616 | - if typeMap[eventType] then | ||
617 | - local dayInfo = self:getProperty("dayLimitInfo") | ||
618 | - local info = dayInfo[eventType] or {} | ||
619 | - local count = (info["count"] or 0) + param | ||
620 | - local triggerCount = info["trigger"] or 0 | ||
621 | - local flag = nil | ||
622 | - if count >= config.condition then | ||
623 | - if triggerCount < config.triggerLimit then | ||
624 | - info["trigger"] = triggerCount + 1 | ||
625 | - info["count"] = 0 | ||
626 | - flag = true | ||
627 | - else | ||
628 | - info["count"] = config.condition - 1 | ||
629 | - end | 628 | + if not config then return end |
629 | + | ||
630 | + -- 每日循环弹窗 | ||
631 | + local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1, [TriggerEventType.HeroTalent] = 1} | ||
632 | + if typeMap[eventType] then | ||
633 | + local dayInfo = self:getProperty("dayLimitInfo") | ||
634 | + local info = dayInfo[eventType] or {} | ||
635 | + local count = (info["count"] or 0) + param | ||
636 | + local triggerCount = info["trigger"] or 0 | ||
637 | + local flag = nil | ||
638 | + if count >= config.condition then | ||
639 | + if triggerCount < config.triggerLimit then | ||
640 | + info["trigger"] = triggerCount + 1 | ||
641 | + info["count"] = 0 | ||
642 | + flag = true | ||
630 | else | 643 | else |
631 | - info["count"] = count | ||
632 | - end | ||
633 | - dayInfo[eventType] = info | ||
634 | - self:updateProperty({field = "dayLimitInfo", value = dayInfo}) | ||
635 | - if not flag then | ||
636 | - return | 644 | + info["count"] = config.condition - 1 |
637 | end | 645 | end |
646 | + else | ||
647 | + info["count"] = count | ||
638 | end | 648 | end |
639 | - local rechargeCfg = csvdb["shop_normalCsv"][config.packId] | ||
640 | - if rechargeCfg then | ||
641 | - limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} | ||
642 | - self.owner:log("push_gift", { | ||
643 | - gift_id = rechargeCfg.id, --礼包ID | ||
644 | - gift_name = rechargeCfg.descId, --礼包名称 | ||
645 | - }) | ||
646 | - if config.isLoop ~= 0 then | ||
647 | - local payR = self:getProperty("payR") | ||
648 | - if payR[rechargeCfg.id] then | ||
649 | - payR[rechargeCfg.id] = nil | ||
650 | - self:updateProperty({field = "payR", value = payR}) | ||
651 | - end | 649 | + dayInfo[eventType] = info |
650 | + self:updateProperty({field = "dayLimitInfo", value = dayInfo}) | ||
651 | + if not flag then | ||
652 | + return | ||
653 | + end | ||
654 | + end | ||
655 | + local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId] | ||
656 | + if rechargeCfg then | ||
657 | + limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} | ||
658 | + self.owner:log("push_gift", { | ||
659 | + gift_id = rechargeCfg.id, --礼包ID | ||
660 | + gift_name = rechargeCfg.descId, --礼包名称 | ||
661 | + }) | ||
662 | + if config.isLoop ~= 0 then | ||
663 | + local payR = self:getProperty("payR") | ||
664 | + if payR[rechargeCfg.id] then | ||
665 | + payR[rechargeCfg.id] = nil | ||
666 | + self:updateProperty({field = "payR", value = payR}) | ||
652 | end | 667 | end |
653 | - -- 每日抽卡限时礼包 触发重置 | ||
654 | - --if eventType == TriggerEventType.DrawHeroCnt then | ||
655 | - -- local payR = self:getProperty("buyR") | ||
656 | - -- if payR[rechargeCfg.id] then | ||
657 | - -- payR[rechargeCfg.id] = nil | ||
658 | - -- self:updateProperty({field = "buyR", value = payR}) | ||
659 | - -- end | ||
660 | - --end | ||
661 | - self:updateProperty({field = "limitTPack", value = limitPack}) | ||
662 | end | 668 | end |
669 | + -- 每日抽卡限时礼包 触发重置 | ||
670 | + --if eventType == TriggerEventType.DrawHeroCnt then | ||
671 | + -- local payR = self:getProperty("buyR") | ||
672 | + -- if payR[rechargeCfg.id] then | ||
673 | + -- payR[rechargeCfg.id] = nil | ||
674 | + -- self:updateProperty({field = "buyR", value = payR}) | ||
675 | + -- end | ||
676 | + --end | ||
677 | + self:updateProperty({field = "limitTPack", value = limitPack}) | ||
663 | end | 678 | end |
664 | --if next(result) then | 679 | --if next(result) then |
665 | -- self:updateProperty({field = "packTrigger", value = triggerRecord}) | 680 | -- self:updateProperty({field = "packTrigger", value = triggerRecord}) |
@@ -852,6 +867,7 @@ function Store:data() | @@ -852,6 +867,7 @@ function Store:data() | ||
852 | totalRR = self:getProperty("totalRR"), | 867 | totalRR = self:getProperty("totalRR"), |
853 | monthCardId = self:getProperty("monthCardId"), | 868 | monthCardId = self:getProperty("monthCardId"), |
854 | firstMonthCard = self:getProperty("firstMonthCard"), | 869 | firstMonthCard = self:getProperty("firstMonthCard"), |
870 | + firstsMonthCard = self:getProperty("firstsMonthCard"), | ||
855 | monthCardReceive = self:getProperty("monthCardReceive"), | 871 | monthCardReceive = self:getProperty("monthCardReceive"), |
856 | smonthCards = self:getProperty("smonthCards"), | 872 | smonthCards = self:getProperty("smonthCards"), |
857 | smonthCardReceive = self:getProperty("smonthCardReceive"), | 873 | smonthCardReceive = self:getProperty("smonthCardReceive"), |
src/services/dbseed.lua
@@ -266,7 +266,10 @@ local function doUpdateSql() | @@ -266,7 +266,10 @@ local function doUpdateSql() | ||
266 | }, | 266 | }, |
267 | [2] = { | 267 | [2] = { |
268 | "ALTER TABLE `Rune` MODIFY COLUMN `refer` bigint;" | 268 | "ALTER TABLE `Rune` MODIFY COLUMN `refer` bigint;" |
269 | - } | 269 | + }, |
270 | + [3] = { | ||
271 | + "ALTER TABLE `Email` MODIFY COLUMN `refer` VARCHAR(2048);" | ||
272 | + }, | ||
270 | } | 273 | } |
271 | -- 更新记录表 | 274 | -- 更新记录表 |
272 | local res = mysqlproxy:query("SELECT `value` FROM `autoincrement_set` WHERE `key` = 'db_ver';") | 275 | local res = mysqlproxy:query("SELECT `value` FROM `autoincrement_set` WHERE `key` = 'db_ver';") |
src/shared/functions.lua
@@ -865,6 +865,15 @@ function table.array2Table(arr) | @@ -865,6 +865,15 @@ function table.array2Table(arr) | ||
865 | return ret | 865 | return ret |
866 | end | 866 | end |
867 | 867 | ||
868 | +function table.findMinKeyByIndex(t, index, change) | ||
869 | + if not next(t or {}) then return nil end | ||
870 | + if not t[index] then | ||
871 | + index = index - change | ||
872 | + return table.findMinKeyByIndex(t, index, change) | ||
873 | + else | ||
874 | + return t[index] | ||
875 | + end | ||
876 | +end | ||
868 | 877 | ||
869 | function table.rewardMerge(dest, src) | 878 | function table.rewardMerge(dest, src) |
870 | for k, v in pairs(src) do | 879 | for k, v in pairs(src) do |