Commit e825af8c75e55c2ed24d98d06f340bfa1104d4af
Merge branch 'cn/develop' into cn/publish/release
# Conflicts: # src/agent.lua # src/csvdata
Showing
19 changed files
with
560 additions
and
208 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
| @@ -133,7 +133,7 @@ ItemStartId = { | @@ -133,7 +133,7 @@ ItemStartId = { | ||
| 133 | --常用的物品id的枚举 | 133 | --常用的物品id的枚举 |
| 134 | ItemId = { | 134 | ItemId = { |
| 135 | Gold = 1, -- 金币 | 135 | Gold = 1, -- 金币 |
| 136 | - Exp = 2, -- 经验 | 136 | + Exp = 2, -- 能量饮料 |
| 137 | Jade = 3, -- 虹光玉 | 137 | Jade = 3, -- 虹光玉 |
| 138 | PlayerExp = 4, -- 突破材料 | 138 | PlayerExp = 4, -- 突破材料 |
| 139 | FriendPoint = 5, -- 友情点 | 139 | FriendPoint = 5, -- 友情点 |
| @@ -371,6 +371,8 @@ MailId = { | @@ -371,6 +371,8 @@ MailId = { | ||
| 371 | CBBackAward2 = 244, | 371 | CBBackAward2 = 244, |
| 372 | ActivityPoolRet = 280, | 372 | ActivityPoolRet = 280, |
| 373 | MyCardBuy = 300, | 373 | MyCardBuy = 300, |
| 374 | + | ||
| 375 | + RechargeBack = 3001, | ||
| 374 | } | 376 | } |
| 375 | 377 | ||
| 376 | TriggerEventType = { | 378 | TriggerEventType = { |
| @@ -388,6 +390,8 @@ TriggerEventType = { | @@ -388,6 +390,8 @@ TriggerEventType = { | ||
| 388 | FoodSell = 11, -- 循环卖菜 | 390 | FoodSell = 11, -- 循环卖菜 |
| 389 | RuneUp = 12, -- 循环强化符文 | 391 | RuneUp = 12, -- 循环强化符文 |
| 390 | CostDiamond = 13, -- 循环消耗钻石 | 392 | CostDiamond = 13, -- 循环消耗钻石 |
| 393 | + BuyLimitPack = 14, --购买指定id礼包 触发 | ||
| 394 | + HeroTalent = 15, --英雄精进 触发礼包 | ||
| 391 | } | 395 | } |
| 392 | 396 | ||
| 393 | DrawCardType = { | 397 | DrawCardType = { |
| @@ -429,6 +433,8 @@ SystemBnousType = { | @@ -429,6 +433,8 @@ SystemBnousType = { | ||
| 429 | UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 | 433 | UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 |
| 430 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 | 434 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 |
| 431 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, | 435 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, |
| 436 | + ExtraProp = 18, -- 每次探索加速额外获得道具 | ||
| 437 | + AccountLevel = 19, -- 账号等级提升角色等级上限 | ||
| 432 | } | 438 | } |
| 433 | 439 | ||
| 434 | -- 开箱物品类型 | 440 | -- 开箱物品类型 |
| @@ -440,4 +446,12 @@ ItemOccupy = { | @@ -440,4 +446,12 @@ ItemOccupy = { | ||
| 440 | Spark = 5, --火花 | 446 | Spark = 5, --火花 |
| 441 | Other = 6, | 447 | Other = 6, |
| 442 | CanUsed = 7, --可使用 | 448 | CanUsed = 7, --可使用 |
| 449 | +} | ||
| 450 | + | ||
| 451 | +-- 世界变动积分 | ||
| 452 | +ItemWorldLine = { | ||
| 453 | + RouletteCount = 1, --抽轮盘次数 | ||
| 454 | + Points = 2, --积分 | ||
| 455 | + CostDiamond = 3, --消耗钻石 | ||
| 456 | + CostJade = 4, --消耗红光玉 | ||
| 443 | } | 457 | } |
| 444 | \ No newline at end of file | 458 | \ 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_worldLineRoulette = 146, --世界线抽轮盘 | ||
| 66 | + Role_worldLineReward = 147, -- 世界线一键领取奖励 | ||
| 63 | 67 | ||
| 64 | Adv_startAdvRpc = 151, | 68 | Adv_startAdvRpc = 151, |
| 65 | Adv_startHangRpc = 152, | 69 | Adv_startHangRpc = 152, |
| @@ -225,6 +229,7 @@ actionCodes = { | @@ -225,6 +229,7 @@ actionCodes = { | ||
| 225 | Store_getExploreCommandRewardRpc = 563, --探索指令 | 229 | Store_getExploreCommandRewardRpc = 563, --探索指令 |
| 226 | Store_getTotalRechargeAwardRpc = 564, -- 累计充值 | 230 | Store_getTotalRechargeAwardRpc = 564, -- 累计充值 |
| 227 | Store_monthCardRewardRpc = 565, --每日月卡+特刊奖励 | 231 | Store_monthCardRewardRpc = 565, --每日月卡+特刊奖励 |
| 232 | + Store_dyhxAndroidRechargeRpc = 566, -- 东银河充值 | ||
| 228 | 233 | ||
| 229 | Store_biliCloudRechargeRpc = 596, | 234 | Store_biliCloudRechargeRpc = 596, |
| 230 | Store_biliAndroidRechargeRpc = 597, | 235 | Store_biliAndroidRechargeRpc = 597, |
| @@ -245,7 +250,7 @@ actionCodes = { | @@ -245,7 +250,7 @@ actionCodes = { | ||
| 245 | Activity_actCalendaTaskRpc = 655, | 250 | Activity_actCalendaTaskRpc = 655, |
| 246 | Activity_actPaySignRpc = 656, | 251 | Activity_actPaySignRpc = 656, |
| 247 | Activity_exchangeRpc = 657, | 252 | Activity_exchangeRpc = 657, |
| 248 | - Activity_gachakonRpc = 658, | 253 | + Activity_gachakonRpc = 658, --狩猎祭 抽扭蛋机 |
| 249 | Activity_hangDropRpc = 659, | 254 | Activity_hangDropRpc = 659, |
| 250 | Activity_startBattleRpc = 660, | 255 | Activity_startBattleRpc = 660, |
| 251 | Activity_endBattleRpc = 661, | 256 | Activity_endBattleRpc = 661, |
| @@ -263,6 +268,7 @@ actionCodes = { | @@ -263,6 +268,7 @@ actionCodes = { | ||
| 263 | Activity_returnerTaskRpc = 673, | 268 | Activity_returnerTaskRpc = 673, |
| 264 | Activity_actNewUserTaskRpc = 674, | 269 | Activity_actNewUserTaskRpc = 674, |
| 265 | Activity_buyBattleTicketRpc = 675, | 270 | Activity_buyBattleTicketRpc = 675, |
| 271 | + Activity_resetGachakonRpc = 676, --狩猎祭,重制扭蛋机 | ||
| 266 | 272 | ||
| 267 | Radio_startQuestRpc = 700, | 273 | Radio_startQuestRpc = 700, |
| 268 | Radio_finishQuestRpc = 701, | 274 | Radio_finishQuestRpc = 701, |
src/actions/ActivityAction.lua
| @@ -315,7 +315,27 @@ function _M.actBattleCommandTaskRpc(agent, data) | @@ -315,7 +315,27 @@ 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 | + 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 | role:log("activity", { | 340 | role:log("activity", { |
| 321 | activity_id = taskId, -- 活动ID(或活动指定任务的ID) | 341 | activity_id = taskId, -- 活动ID(或活动指定任务的ID) |
| @@ -479,6 +499,20 @@ function _M.gachakonRpc(agent, data) | @@ -479,6 +499,20 @@ function _M.gachakonRpc(agent, data) | ||
| 479 | return true | 499 | return true |
| 480 | end | 500 | end |
| 481 | 501 | ||
| 502 | +function _M.resetGachakonRpc(agent, data) | ||
| 503 | + local role = agent.role | ||
| 504 | + local msg = MsgPack.unpack(data) | ||
| 505 | + local actid = msg.actid | ||
| 506 | + | ||
| 507 | + if not role.activity:isOpenById(actid, "Gachakon") then return 1 end | ||
| 508 | + | ||
| 509 | + if role.activity:isResetById(actid, "Gachakon") then return 2 end | ||
| 510 | + role.activity:resetActDataById(actid) | ||
| 511 | + | ||
| 512 | + SendPacket(actionCodes.Activity_resetGachakonRpc, MsgPack.pack({})) | ||
| 513 | + return true | ||
| 514 | +end | ||
| 515 | + | ||
| 482 | function _M.hangDropRpc(agent, data) | 516 | function _M.hangDropRpc(agent, data) |
| 483 | local role = agent.role | 517 | local role = agent.role |
| 484 | local msg = MsgPack.unpack(data) | 518 | local msg = MsgPack.unpack(data) |
| @@ -645,7 +679,7 @@ function _M.startBattleRpc(agent, data) | @@ -645,7 +679,7 @@ function _M.startBattleRpc(agent, data) | ||
| 645 | award[k] = v * count | 679 | award[k] = v * count |
| 646 | end | 680 | end |
| 647 | local reward, change = role:award(award, {log = {desc = "actBattle", int1 = actid, int2 = count or 0}}) | 681 | local reward, change = role:award(award, {log = {desc = "actBattle", int1 = actid, int2 = count or 0}}) |
| 648 | - SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change))) | 682 | + |
| 649 | changeFlag = true | 683 | changeFlag = true |
| 650 | actData["ticket"] = ticket - num | 684 | actData["ticket"] = ticket - num |
| 651 | 685 | ||
| @@ -665,11 +699,15 @@ function _M.startBattleRpc(agent, data) | @@ -665,11 +699,15 @@ function _M.startBattleRpc(agent, data) | ||
| 665 | end | 699 | end |
| 666 | role:updateRankCommon(RANK_TYPE.ActBattleBoss, rankVal) | 700 | role:updateRankCommon(RANK_TYPE.ActBattleBoss, rankVal) |
| 667 | end | 701 | end |
| 702 | + role.activity:updateActData("ChallengeLevel", actData) | ||
| 668 | 703 | ||
| 704 | + SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change))) | ||
| 705 | + | ||
| 706 | + return true | ||
| 669 | end | 707 | end |
| 670 | - if changeFlag then | ||
| 671 | - role.activity:updateActData("ChallengeLevel", actData) | ||
| 672 | - end | 708 | + --if changeFlag then |
| 709 | + -- role.activity:updateActData("ChallengeLevel", actData) | ||
| 710 | + --end | ||
| 673 | 711 | ||
| 674 | return true | 712 | return true |
| 675 | end | 713 | end |
| @@ -1341,8 +1379,8 @@ function _M.buyBattleCommandLvlRpc(agent, data) | @@ -1341,8 +1379,8 @@ function _M.buyBattleCommandLvlRpc(agent, data) | ||
| 1341 | end | 1379 | end |
| 1342 | if cost == 0 then return 5 end | 1380 | if cost == 0 then return 5 end |
| 1343 | 1381 | ||
| 1344 | - if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 6 end | ||
| 1345 | - role:costItems({[ItemId.Jade] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}}) | 1382 | + if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return 6 end |
| 1383 | + role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}}) | ||
| 1346 | actData["lvl"] = nextLvl | 1384 | actData["lvl"] = nextLvl |
| 1347 | role.activity:updateActData("BattleCommand", actData) | 1385 | role.activity:updateActData("BattleCommand", actData) |
| 1348 | role:mylog("act_action", {desc="buyBcLvl", int1=count, int2=nextLvl}) | 1386 | role:mylog("act_action", {desc="buyBcLvl", int1=count, int2=nextLvl}) |
src/actions/GmAction.lua
| @@ -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
| @@ -528,16 +528,20 @@ function _M.quickRpc(agent , data) | @@ -528,16 +528,20 @@ function _M.quickRpc(agent , data) | ||
| 528 | end | 528 | end |
| 529 | 529 | ||
| 530 | --宝藏加速 | 530 | --宝藏加速 |
| 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 | 531 | + local treasureList = role.dailyData:quickTreasureList(hangInfo.carbonId, time) or {} |
| 532 | + for id, val in pairs(treasureList) do | ||
| 533 | + local award = val.award:toNumMap() | ||
| 534 | + for k,v in pairs(award) do | ||
| 535 | + reward[k] = (reward[k] or 0) + v | ||
| 538 | end | 536 | end |
| 539 | end | 537 | end |
| 540 | 538 | ||
| 539 | + --等级 额外奖励 | ||
| 540 | + local levelReward = role:getExtraProp() | ||
| 541 | + for k, v in pairs(levelReward or {}) do | ||
| 542 | + reward[k] = (reward[k] or 0) + v | ||
| 543 | + end | ||
| 544 | + | ||
| 541 | local change | 545 | local change |
| 542 | reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | 546 | reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) |
| 543 | if reward[ItemId.Gold] then | 547 | if reward[ItemId.Gold] then |
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 |
src/actions/HttpAction.lua
| @@ -143,7 +143,7 @@ function _M.gm_action(query) | @@ -143,7 +143,7 @@ function _M.gm_action(query) | ||
| 143 | role:startActionUcode() | 143 | role:startActionUcode() |
| 144 | local status = gmFuncs[query.cmd](role, query) | 144 | local status = gmFuncs[query.cmd](role, query) |
| 145 | role:endActionUcode() | 145 | role:endActionUcode() |
| 146 | - role:update() | 146 | + role:saveRoleData() |
| 147 | 147 | ||
| 148 | return status | 148 | return status |
| 149 | end | 149 | end |
| @@ -174,6 +174,7 @@ function _M.pay_action(query) | @@ -174,6 +174,7 @@ function _M.pay_action(query) | ||
| 174 | role:startActionUcode() | 174 | role:startActionUcode() |
| 175 | local status = gmFuncs[query.cmd](role, query) | 175 | local status = gmFuncs[query.cmd](role, query) |
| 176 | role:endActionUcode() | 176 | role:endActionUcode() |
| 177 | + role:saveRoleData() | ||
| 177 | 178 | ||
| 178 | return status | 179 | return status |
| 179 | end | 180 | end |
src/actions/RoleAction.lua
| @@ -1712,36 +1712,112 @@ function _M.setBgRpc(agent, data) | @@ -1712,36 +1712,112 @@ function _M.setBgRpc(agent, data) | ||
| 1712 | return true | 1712 | return true |
| 1713 | end | 1713 | end |
| 1714 | 1714 | ||
| 1715 | -function _M.itemConvertMonthCardRpc(agent, data) | 1715 | +function _M.itemConvertSpecialRpc(agent, data) |
| 1716 | local role = agent.role | 1716 | local role = agent.role |
| 1717 | local msg = MsgPack.unpack(data) | 1717 | local msg = MsgPack.unpack(data) |
| 1718 | local itemId = msg.item_id | 1718 | local itemId = msg.item_id |
| 1719 | - local typ = msg.typ | ||
| 1720 | - local count = msg.count | ||
| 1721 | - local exchangeId = msg.change_id | ||
| 1722 | - | ||
| 1723 | - if not ItemId[itemId] then return 1 end | 1719 | + local exchangeId = tonumber(msg.exchange_id) |
| 1724 | 1720 | ||
| 1725 | - if not role:checkItemEnough({[itemId] = count}) then return 2 end | ||
| 1726 | - role:costItems({[itemId] = count}, {log = {desc = "itemConvertmonthCard", int1 = count, int2 = count}}) | 1721 | + local itemData = csvdb["itemCsv"][itemId] |
| 1722 | + if not itemData then return 1 end | ||
| 1727 | 1723 | ||
| 1728 | local rechargeData = csvdb["shop_rechargeCsv"][exchangeId] | 1724 | local rechargeData = csvdb["shop_rechargeCsv"][exchangeId] |
| 1729 | if not rechargeData then | 1725 | if not rechargeData then |
| 1730 | skynet.error("[recharge] recharge id not exist", exchangeId) | 1726 | skynet.error("[recharge] recharge id not exist", exchangeId) |
| 1731 | - return 3 | 1727 | + return 2 |
| 1732 | end | 1728 | end |
| 1733 | - local reward = {} | ||
| 1734 | - for i = 1, count do | ||
| 1735 | - local tmpreward, _ = role.storeData:onBuyCard(rechargeData.type, rechargeData.id , rechargeData.activity_id) | 1729 | + |
| 1730 | + if not role:checkItemEnough({[itemId] = 1}) then return 3 end | ||
| 1731 | + | ||
| 1732 | + local reward = {} | ||
| 1733 | + | ||
| 1734 | + if not role.storeData:checkRechargeRecord(rechargeData.limit, exchangeId)then | ||
| 1735 | + return 5 | ||
| 1736 | + end | ||
| 1737 | + | ||
| 1738 | + if rechargeData.type == CardType.ActBattleCommandCard then | ||
| 1739 | + if role.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then | ||
| 1740 | + local tmpreward, _ = role.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) | ||
| 1741 | + if tmpreward then | ||
| 1742 | + table.rewardMerge(reward, tmpreward) | ||
| 1743 | + end | ||
| 1744 | + else | ||
| 1745 | + skynet.error("not open id: ".. rechargeData.id .. "; actid: " .. rechargeData.activity_id) | ||
| 1746 | + SendPacket(actionCodes.Role_itemConvertSpecialRpc, MsgPack.pack({result = 4})) | ||
| 1747 | + return true | ||
| 1748 | + end | ||
| 1749 | + else | ||
| 1750 | + local tmpreward, _ = role.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) | ||
| 1736 | if tmpreward then | 1751 | if tmpreward then |
| 1737 | table.rewardMerge(reward, tmpreward) | 1752 | table.rewardMerge(reward, tmpreward) |
| 1738 | - else | ||
| 1739 | - return | ||
| 1740 | end | 1753 | end |
| 1741 | end | 1754 | end |
| 1742 | 1755 | ||
| 1743 | - SendPacket(actionCodes.Role_itemConvertMonthCardRpc, MsgPack.pack(role:packReward(reward))) | ||
| 1744 | - return status | 1756 | + role:costItems({[itemId] = 1}, {log = {desc = "itemConvertSpecial", int1 = itemId, int2 = itemData.type}}) |
| 1757 | + | ||
| 1758 | + SendPacket(actionCodes.Role_itemConvertSpecialRpc, MsgPack.pack(role:packReward(reward))) | ||
| 1759 | + return true | ||
| 1760 | +end | ||
| 1761 | + | ||
| 1762 | +function _M.worldLineRoulette(agent, data) | ||
| 1763 | + local role = agent.role | ||
| 1764 | + | ||
| 1765 | + local worldChangePoints = role:getProperty("worldChangePoints") or {} | ||
| 1766 | + local rouletteCount = worldChangePoints[ItemWorldLine.RouletteCount] or 0 | ||
| 1767 | + if rouletteCount == 0 then return 1 end | ||
| 1768 | + | ||
| 1769 | + local worldline_gift_base_10, worldline_gift_base_1, worldline_gift_magnification_1, worldline_gift_magnification_0 = {}, {}, {}, {} | ||
| 1770 | + for k, v in pairs(globalCsv.worldline_gift_base_10) do | ||
| 1771 | + worldline_gift_base_10[k] = {v} | ||
| 1772 | + end | ||
| 1773 | + for k, v in pairs(globalCsv.worldline_gift_base_1) do | ||
| 1774 | + worldline_gift_base_1[k] = {v} | ||
| 1775 | + end | ||
| 1776 | + for k, v in pairs(globalCsv.worldline_gift_magnification_1) do | ||
| 1777 | + worldline_gift_magnification_1[k] = {v} | ||
| 1778 | + end | ||
| 1779 | + for k, v in pairs(globalCsv.worldline_gift_magnification_0) do | ||
| 1780 | + worldline_gift_magnification_0[k] = {v} | ||
| 1781 | + end | ||
| 1782 | + | ||
| 1783 | + local gift_base_10 = (math.randWeight(worldline_gift_base_10, 1) or 0) * 10 | ||
| 1784 | + local gift_base_1 = math.randWeight(worldline_gift_base_1, 1) or 0 | ||
| 1785 | + | ||
| 1786 | + local gift_magnification_1 = math.randWeight(worldline_gift_magnification_1, 1) or 0 | ||
| 1787 | + local gift_magnification_0 = (math.randWeight(worldline_gift_magnification_0, 1) or 0) * (0.1) | ||
| 1788 | + | ||
| 1789 | + local points = math.floor((gift_base_10 + gift_base_1) * (gift_magnification_1 + gift_magnification_0)) | ||
| 1790 | + worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1 | ||
| 1791 | + worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + points | ||
| 1792 | + role:updateProperty({field = "worldChangePoints", value = worldChangePoints}) | ||
| 1793 | + | ||
| 1794 | + SendPacket(actionCodes.Role_worldLineRoulette, MsgPack.pack(worldChangePoints)) | ||
| 1795 | + return true | ||
| 1796 | +end | ||
| 1797 | + | ||
| 1798 | +function _M.worldLineReward(agent, data) | ||
| 1799 | + local role = agent.role | ||
| 1800 | + local worldLineReward = role:getProperty("worldLineReward") or {} | ||
| 1801 | + local worldChangePoints = role:getProperty("worldChangePoints") or {} | ||
| 1802 | + local points = worldChangePoints[ItemWorldLine.Points] or 0 | ||
| 1803 | + | ||
| 1804 | + local reward, change = {} | ||
| 1805 | + for key, val in pairs(csvdb["worldline_rewardCsv"]) do | ||
| 1806 | + if points >= key and not worldLineReward[key] then | ||
| 1807 | + for k, v in pairs(val.award:toNumMap()) do | ||
| 1808 | + reward[k] = (reward[k] or 0) + v | ||
| 1809 | + end | ||
| 1810 | + worldLineReward[key] = 1 | ||
| 1811 | + end | ||
| 1812 | + end | ||
| 1813 | + | ||
| 1814 | + role:updateProperty({field = "worldLineReward", value = worldLineReward}) | ||
| 1815 | + | ||
| 1816 | + if next(reward) then | ||
| 1817 | + reward, change = role:award(reward, {log = {desc = "worldLine", int1 = role:getProperty("id")}}) | ||
| 1818 | + end | ||
| 1819 | + SendPacket(actionCodes.Role_worldLineReward, MsgPack.pack(role:packReward(reward, change))) | ||
| 1820 | + return true | ||
| 1745 | end | 1821 | end |
| 1746 | 1822 | ||
| 1747 | return _M | 1823 | return _M |
| 1748 | \ No newline at end of file | 1824 | \ No newline at end of file |
src/actions/StoreAction.lua
| @@ -53,6 +53,19 @@ local function signPms(params, secret_key) | @@ -53,6 +53,19 @@ local function signPms(params, secret_key) | ||
| 53 | return md5.sumhexa(urlCode .. secret_key):lower() | 53 | return md5.sumhexa(urlCode .. secret_key):lower() |
| 54 | end | 54 | end |
| 55 | 55 | ||
| 56 | +local function signDyhPms(params, secret_key) | ||
| 57 | + local keys = table_keys(params) | ||
| 58 | + table.sort(keys) | ||
| 59 | + local str2Sign = "" | ||
| 60 | + for index, key in ipairs(keys) do | ||
| 61 | + if str2Sign ~= "" then | ||
| 62 | + str2Sign = str2Sign .. '&' | ||
| 63 | + end | ||
| 64 | + str2Sign = str2Sign .. string.format("%s=%s", key, params[key]) | ||
| 65 | + end | ||
| 66 | + return md5.sumhexa(str2Sign .. secret_key):lower() | ||
| 67 | +end | ||
| 68 | + | ||
| 56 | -- bili android 充值 入口 | 69 | -- bili android 充值 入口 |
| 57 | function _M.biliAndroidRechargeRpc(agent, data) | 70 | function _M.biliAndroidRechargeRpc(agent, data) |
| 58 | local role = agent.role | 71 | local role = agent.role |
| @@ -227,7 +240,7 @@ function _M.iosRechargeRpc(agent, data) | @@ -227,7 +240,7 @@ function _M.iosRechargeRpc(agent, data) | ||
| 227 | --创建订单号 | 240 | --创建订单号 |
| 228 | local partnerOrderId = role:getPurchaseOrder(id,nil,choose) | 241 | local partnerOrderId = role:getPurchaseOrder(id,nil,choose) |
| 229 | -- 签名 | 242 | -- 签名 |
| 230 | - local secret_key = "1916d62251dd4a8aa5e452121eefc9a1" | 243 | + local secret_key = "2b2036e1f44640a59168c92462714870" |
| 231 | local need = { | 244 | local need = { |
| 232 | out_trade_no = partnerOrderId, | 245 | out_trade_no = partnerOrderId, |
| 233 | money = dataSet.rmb * 100, | 246 | money = dataSet.rmb * 100, |
| @@ -235,12 +248,40 @@ function _M.iosRechargeRpc(agent, data) | @@ -235,12 +248,40 @@ function _M.iosRechargeRpc(agent, data) | ||
| 235 | product_id = dataSet.iap_product_id, | 248 | product_id = dataSet.iap_product_id, |
| 236 | notify_url = msg.notifyUrl | 249 | notify_url = msg.notifyUrl |
| 237 | } | 250 | } |
| 238 | - local sign = signPms(need, secret_key) | 251 | + local sign = signDyhPms(need, secret_key) |
| 239 | 252 | ||
| 240 | SendPacket(actionCodes.Store_iosRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign})) | 253 | SendPacket(actionCodes.Store_iosRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign})) |
| 241 | return true | 254 | return true |
| 242 | end | 255 | end |
| 243 | 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 | + | ||
| 244 | function _M.purchaseOrderResult(agent, data) | 285 | function _M.purchaseOrderResult(agent, data) |
| 245 | local role = agent.role | 286 | local role = agent.role |
| 246 | 287 |
src/agent.lua
| @@ -36,7 +36,7 @@ local function handle_timeout() | @@ -36,7 +36,7 @@ local function handle_timeout() | ||
| 36 | end | 36 | end |
| 37 | 37 | ||
| 38 | local function handle_gc() | 38 | local function handle_gc() |
| 39 | - if agentInfo.open_timer then return end | 39 | + if not agentInfo.open_timer then return end |
| 40 | collectgarbage("collect") | 40 | collectgarbage("collect") |
| 41 | skynet.timeout(6000, handle_gc) | 41 | skynet.timeout(6000, handle_gc) |
| 42 | end | 42 | end |
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) |
| @@ -497,6 +519,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | @@ -497,6 +519,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | ||
| 497 | --role:checkTaskEnter("HangPass", {id = 0}) | 519 | --role:checkTaskEnter("HangPass", {id = 0}) |
| 498 | role:checkCalendaTask(true, 15, 3) | 520 | role:checkCalendaTask(true, 15, 3) |
| 499 | role:checkTaskEnter("HeroStarCollect", {}) | 521 | role:checkTaskEnter("HeroStarCollect", {}) |
| 522 | + role:checkTaskEnter("HeroStartSum", {}) | ||
| 500 | role:checkTaskEnter("RuneQualityCollect", {}) | 523 | role:checkTaskEnter("RuneQualityCollect", {}) |
| 501 | 524 | ||
| 502 | end, | 525 | end, |
| @@ -565,6 +588,7 @@ activityFunc[Activity.ActivityType.BattleCommandTask] = { | @@ -565,6 +588,7 @@ activityFunc[Activity.ActivityType.BattleCommandTask] = { | ||
| 565 | --role:checkTaskEnter("HangPass", {id = 0}) | 588 | --role:checkTaskEnter("HangPass", {id = 0}) |
| 566 | role:checkCalendaTask(true, 15, 3) | 589 | role:checkCalendaTask(true, 15, 3) |
| 567 | role:checkTaskEnter("HeroStarCollect", {}) | 590 | role:checkTaskEnter("HeroStarCollect", {}) |
| 591 | + role:checkTaskEnter("HeroStartSum", {}) | ||
| 568 | role:checkTaskEnter("RuneQualityCollect", {}) | 592 | role:checkTaskEnter("RuneQualityCollect", {}) |
| 569 | 593 | ||
| 570 | end, | 594 | end, |
| @@ -669,6 +693,7 @@ activityFunc[Activity.ActivityType.NewUserTask] = { | @@ -669,6 +693,7 @@ activityFunc[Activity.ActivityType.NewUserTask] = { | ||
| 669 | --role:checkTaskEnter("HangPass", {id = 0}) | 693 | --role:checkTaskEnter("HangPass", {id = 0}) |
| 670 | role:checkCalendaTask(true, 15, 3) | 694 | role:checkCalendaTask(true, 15, 3) |
| 671 | role:checkTaskEnter("HeroStarCollect", {}) | 695 | role:checkTaskEnter("HeroStarCollect", {}) |
| 696 | + role:checkTaskEnter("HeroStartSum", {}) | ||
| 672 | role:checkTaskEnter("RuneQualityCollect", {}) | 697 | role:checkTaskEnter("RuneQualityCollect", {}) |
| 673 | 698 | ||
| 674 | end, | 699 | end, |
| @@ -753,8 +778,14 @@ activityFunc[Activity.ActivityType.Gachakon] = { | @@ -753,8 +778,14 @@ activityFunc[Activity.ActivityType.Gachakon] = { | ||
| 753 | self:updateActData(actType, {}, not notify) | 778 | self:updateActData(actType, {}, not notify) |
| 754 | end, | 779 | end, |
| 755 | ["crossDay"] = function(self, actType, notify) | 780 | ["crossDay"] = function(self, actType, notify) |
| 756 | - self:updateActData(actType, {}, not notify) | 781 | + self:updateResetData(actType, 1) |
| 782 | + --self:updateActData(actType, {}, not notify) | ||
| 757 | 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 | ||
| 758 | } | 789 | } |
| 759 | 790 | ||
| 760 | -- 活动卡池 | 791 | -- 活动卡池 |
| @@ -862,6 +893,15 @@ function Activity:refreshWeekData(notify) | @@ -862,6 +893,15 @@ function Activity:refreshWeekData(notify) | ||
| 862 | end | 893 | end |
| 863 | end | 894 | end |
| 864 | 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 | + | ||
| 865 | function Activity:checkActivity(notNotify, activityType, ...) | 905 | function Activity:checkActivity(notNotify, activityType, ...) |
| 866 | if not activityType then return end | 906 | if not activityType then return end |
| 867 | if not self:isOpen(activityType) then return end | 907 | if not self:isOpen(activityType) then return end |
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
| @@ -168,6 +168,9 @@ RoleCross.bind = function (Role) | @@ -168,6 +168,9 @@ RoleCross.bind = function (Role) | ||
| 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("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 | ||
| 171 | 174 | ||
| 172 | end | 175 | end |
| 173 | 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, -- 挂机战斗 |
| @@ -163,6 +165,8 @@ local ItemReason = { | @@ -163,6 +165,8 @@ local ItemReason = { | ||
| 163 | CapsuleReward = 1411, --扭蛋机奖励 | 165 | CapsuleReward = 1411, --扭蛋机奖励 |
| 164 | CapsuleConvert = 1412, --扭蛋机 消耗票 兑换 | 166 | CapsuleConvert = 1412, --扭蛋机 消耗票 兑换 |
| 165 | CapsuleCoinCost = 1413, --抽扭蛋机消耗 | 167 | CapsuleCoinCost = 1413, --抽扭蛋机消耗 |
| 168 | + | ||
| 169 | + worldLine = 1500, --世界线积分 | ||
| 166 | } | 170 | } |
| 167 | 171 | ||
| 168 | 172 |
src/models/RolePlugin.lua
| @@ -32,6 +32,8 @@ function RolePlugin.bind(Role) | @@ -32,6 +32,8 @@ function RolePlugin.bind(Role) | ||
| 32 | function Role:onOfflineEvent() | 32 | function Role:onOfflineEvent() |
| 33 | -- 设置最新的登录时间 | 33 | -- 设置最新的登录时间 |
| 34 | self:setProperty("ltime", skynet.timex()) | 34 | self:setProperty("ltime", skynet.timex()) |
| 35 | + | ||
| 36 | + self:saveRoleData() | ||
| 35 | end | 37 | end |
| 36 | 38 | ||
| 37 | local function checkItemCount(self, itemId, count) | 39 | local function checkItemCount(self, itemId, count) |
| @@ -572,12 +574,14 @@ function RolePlugin.bind(Role) | @@ -572,12 +574,14 @@ function RolePlugin.bind(Role) | ||
| 572 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) | 574 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
| 573 | 575 | ||
| 574 | self:checkTaskEnter("CostDiamond", {count = count}) | 576 | self:checkTaskEnter("CostDiamond", {count = count}) |
| 577 | + self:checkWorldChangePoints({[ItemWorldLine.CostDiamond]=count}) | ||
| 575 | return true | 578 | return true |
| 576 | end | 579 | end |
| 577 | 580 | ||
| 578 | function Role:costJade(param) | 581 | function Role:costJade(param) |
| 579 | self:addItem(param) | 582 | self:addItem(param) |
| 580 | self:checkTaskEnter("CostJade", {count = - param.count}) | 583 | self:checkTaskEnter("CostJade", {count = - param.count}) |
| 584 | + self:checkWorldChangePoints({[ItemWorldLine.CostJade]= -param.count}) | ||
| 581 | end | 585 | end |
| 582 | 586 | ||
| 583 | function Role:increBy(field, val) | 587 | function Role:increBy(field, val) |
| @@ -606,6 +610,7 @@ function RolePlugin.bind(Role) | @@ -606,6 +610,7 @@ function RolePlugin.bind(Role) | ||
| 606 | } | 610 | } |
| 607 | if heroInfo.wakeL == 3 then | 611 | if heroInfo.wakeL == 3 then |
| 608 | self:checkTaskEnter("WakeCG", {heroType = heroType}) | 612 | self:checkTaskEnter("WakeCG", {heroType = heroType}) |
| 613 | + self:checkTaskEnter("WakeCGSum", {count = 1}) | ||
| 609 | end | 614 | end |
| 610 | local newHero = require("models.Hero").new(heroInfo) | 615 | local newHero = require("models.Hero").new(heroInfo) |
| 611 | newHero:create() | 616 | newHero:create() |
| @@ -618,6 +623,8 @@ function RolePlugin.bind(Role) | @@ -618,6 +623,8 @@ function RolePlugin.bind(Role) | ||
| 618 | end | 623 | end |
| 619 | 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) |
| 620 | self:checkTaskEnter("HeroQualityCollect", {}) | 625 | self:checkTaskEnter("HeroQualityCollect", {}) |
| 626 | + self:checkTaskEnter("HeroStartSum", {}) | ||
| 627 | + | ||
| 621 | if not params.notNotify then | 628 | if not params.notNotify then |
| 622 | local heroResponse = {} | 629 | local heroResponse = {} |
| 623 | table.insert(heroResponse, newHero:data()) | 630 | table.insert(heroResponse, newHero:data()) |
| @@ -2051,10 +2058,10 @@ function RolePlugin.bind(Role) | @@ -2051,10 +2058,10 @@ function RolePlugin.bind(Role) | ||
| 2051 | 2058 | ||
| 2052 | local SAVE_DATA_INTERVAL = 3 | 2059 | local SAVE_DATA_INTERVAL = 3 |
| 2053 | function Role:saveRoleData(now) | 2060 | function Role:saveRoleData(now) |
| 2054 | - if now - self._lastSaveTs < SAVE_DATA_INTERVAL then | 2061 | + if now and (now - self._lastSaveTs < SAVE_DATA_INTERVAL) then |
| 2055 | return | 2062 | return |
| 2056 | end | 2063 | end |
| 2057 | - self._lastSaveTs = now | 2064 | + self._lastSaveTs = now or skynet.timex() |
| 2058 | self:update() | 2065 | self:update() |
| 2059 | local objs = {self.activity, self.dailyData, self.dinerData, self.storeData, self.roleIncre} | 2066 | local objs = {self.activity, self.dailyData, self.dinerData, self.storeData, self.roleIncre} |
| 2060 | for _, info in ipairs(objs) do | 2067 | for _, info in ipairs(objs) do |
| @@ -2428,7 +2435,7 @@ function RolePlugin.bind(Role) | @@ -2428,7 +2435,7 @@ function RolePlugin.bind(Role) | ||
| 2428 | return 1 | 2435 | return 1 |
| 2429 | end | 2436 | end |
| 2430 | 2437 | ||
| 2431 | - if not self.storeData:checkRechargeRecord(rechargeData.limit, id) and rechargeData.shop ~= 2 then | 2438 | + if not self.storeData:checkRechargeRecord(rechargeData.limit, id)then |
| 2432 | return 2 | 2439 | return 2 |
| 2433 | end | 2440 | end |
| 2434 | 2441 | ||
| @@ -2443,6 +2450,12 @@ function RolePlugin.bind(Role) | @@ -2443,6 +2450,12 @@ function RolePlugin.bind(Role) | ||
| 2443 | self:updateProperty({field = "rechargeF", value = rechargeF}) | 2450 | self:updateProperty({field = "rechargeF", value = rechargeF}) |
| 2444 | end | 2451 | end |
| 2445 | 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 | + | ||
| 2446 | elseif rechargeData.shop == 2 then --通行证商店 | 2459 | elseif rechargeData.shop == 2 then --通行证商店 |
| 2447 | --签收 + 订阅奖励 | 2460 | --签收 + 订阅奖励 |
| 2448 | 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) |
| @@ -2452,10 +2465,7 @@ function RolePlugin.bind(Role) | @@ -2452,10 +2465,7 @@ function RolePlugin.bind(Role) | ||
| 2452 | elseif rechargeData.shop == 3 then -- 礼包商店 | 2465 | elseif rechargeData.shop == 3 then -- 礼包商店 |
| 2453 | 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}}) |
| 2454 | 2467 | ||
| 2455 | - --增加购买记录 | ||
| 2456 | - local buyRecord = self.storeData:getProperty("buyR") or {} | ||
| 2457 | - buyRecord[id] = (buyRecord[id] or 0) + 1 | ||
| 2458 | - self.storeData:updateProperty({field = "buyR", value = buyRecord}) | 2468 | + self:checkTaskEnter("BuyLimitPack", {id = id}) |
| 2459 | else | 2469 | else |
| 2460 | skynet.error("[recharge] invalid recharge shop type " .. id) | 2470 | skynet.error("[recharge] invalid recharge shop type " .. id) |
| 2461 | return 3 | 2471 | return 3 |
| @@ -3010,6 +3020,22 @@ function RolePlugin.bind(Role) | @@ -3010,6 +3020,22 @@ function RolePlugin.bind(Role) | ||
| 3010 | return levelBnous[SystemBnousType.ChangeBuyCount] or 0 | 3020 | return levelBnous[SystemBnousType.ChangeBuyCount] or 0 |
| 3011 | end | 3021 | end |
| 3012 | 3022 | ||
| 3023 | + function Role:getExtraProp() | ||
| 3024 | + local levelBnous = self:getLevelBnous() | ||
| 3025 | + local extraPropReward = levelBnous[SystemBnousType.ExtraProp] or {} | ||
| 3026 | + local reward = {} | ||
| 3027 | + for k, v in pairs(extraPropReward) do | ||
| 3028 | + reward[k] = (reward[k] or 0) + v | ||
| 3029 | + end | ||
| 3030 | + return reward | ||
| 3031 | + end | ||
| 3032 | + | ||
| 3033 | + function Role:getAccountLevel() | ||
| 3034 | + local levelBnous = self:getLevelBnous() | ||
| 3035 | + dump(levelBnous) | ||
| 3036 | + return levelBnous[SystemBnousType.AccountLevel] or 0 | ||
| 3037 | + end | ||
| 3038 | + | ||
| 3013 | function Role:getLevelBnous() | 3039 | function Role:getLevelBnous() |
| 3014 | local levelBnous = {} | 3040 | local levelBnous = {} |
| 3015 | local curLevel = self:getProperty("level") | 3041 | local curLevel = self:getProperty("level") |
| @@ -3038,6 +3064,11 @@ function RolePlugin.bind(Role) | @@ -3038,6 +3064,11 @@ function RolePlugin.bind(Role) | ||
| 3038 | levelBnous[pm1] = 0 | 3064 | levelBnous[pm1] = 0 |
| 3039 | end | 3065 | end |
| 3040 | levelBnous[pm1] = levelBnous[pm1] + pm2 | 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) | ||
| 3041 | else | 3072 | else |
| 3042 | levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 | 3073 | levelBnous[pm1][pm2] = (levelBnous[pm1][pm2] or 0) + pm3 |
| 3043 | end | 3074 | end |
| @@ -3260,6 +3291,24 @@ function RolePlugin.bind(Role) | @@ -3260,6 +3291,24 @@ function RolePlugin.bind(Role) | ||
| 3260 | 3291 | ||
| 3261 | return capsule:getSpecialNotify(roleId) | 3292 | return capsule:getSpecialNotify(roleId) |
| 3262 | end | 3293 | end |
| 3294 | + | ||
| 3295 | + function Role:checkWorldChangePoints(param) | ||
| 3296 | + local worldChangePoints = self:getProperty("worldChangePoints") or {} | ||
| 3297 | + if param[ItemWorldLine.CostJade] then | ||
| 3298 | + worldChangePoints[ItemWorldLine.CostJade] = (worldChangePoints[ItemWorldLine.CostJade] or 0) + param[ItemWorldLine.CostJade] | ||
| 3299 | + local cost = math.floor(worldChangePoints[ItemWorldLine.CostJade] / globalCsv.worldline_gift) | ||
| 3300 | + worldChangePoints[ItemWorldLine.CostJade] = worldChangePoints[ItemWorldLine.CostJade] - cost * globalCsv.worldline_gift | ||
| 3301 | + worldChangePoints[ItemWorldLine.RouletteCount] = (worldChangePoints[ItemWorldLine.RouletteCount] or 0) + cost | ||
| 3302 | + end | ||
| 3303 | + | ||
| 3304 | + if param[ItemWorldLine.CostDiamond] then | ||
| 3305 | + worldChangePoints[ItemWorldLine.CostDiamond] = (worldChangePoints[ItemWorldLine.CostDiamond] or 0) + param[ItemWorldLine.CostDiamond] | ||
| 3306 | + local cost = math.floor(worldChangePoints[ItemWorldLine.CostDiamond] / globalCsv.worldline_count_currency) | ||
| 3307 | + worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost * globalCsv.worldline_count_currency | ||
| 3308 | + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + cost | ||
| 3309 | + end | ||
| 3310 | + self:setProperty("worldChangePoints", worldChangePoints) | ||
| 3311 | + end | ||
| 3263 | end | 3312 | end |
| 3264 | 3313 | ||
| 3265 | return RolePlugin | 3314 | return RolePlugin |
| 3266 | \ No newline at end of file | 3315 | \ No newline at end of file |
src/models/RoleTask.lua
| @@ -17,6 +17,9 @@ local TaskType = { | @@ -17,6 +17,9 @@ local TaskType = { | ||
| 17 | HeroStarCollect = 12, -- 英雄星级收集进度 | 17 | HeroStarCollect = 12, -- 英雄星级收集进度 |
| 18 | DrawHeroNotFriend = 13, -- 非友情招募 -- count | 18 | DrawHeroNotFriend = 13, -- 非友情招募 -- count |
| 19 | DrawHeroLimitPack = 14, -- 抽卡限时礼貌 -- count | 19 | DrawHeroLimitPack = 14, -- 抽卡限时礼貌 -- count |
| 20 | + HeroStartSum = 15, -- 英雄星级总数 | ||
| 21 | + WakeCGSum = 16, -- 累计解锁xx张CG | ||
| 22 | + | ||
| 20 | 23 | ||
| 21 | --装备相关 | 24 | --装备相关 |
| 22 | AddEquip = 101, -- 获得装备 - equipId rarity | 25 | AddEquip = 101, -- 获得装备 - equipId rarity |
| @@ -113,6 +116,7 @@ local TaskType = { | @@ -113,6 +116,7 @@ local TaskType = { | ||
| 113 | Appoint = 912, -- 触发限时礼包,指定id | 116 | Appoint = 912, -- 触发限时礼包,指定id |
| 114 | Rename = 913, -- 重命名 | 117 | Rename = 913, -- 重命名 |
| 115 | CostJade = 914, -- 消耗虹光玉 | 118 | CostJade = 914, -- 消耗虹光玉 |
| 119 | + BuyLimitPack = 915, -- 购买指定id礼包触发 | ||
| 116 | 120 | ||
| 117 | --功能未实现 todo | 121 | --功能未实现 todo |
| 118 | AdvShop = 1002, -- 冒险商城 | 122 | AdvShop = 1002, -- 冒险商城 |
| @@ -277,6 +281,8 @@ local StoreListener = { | @@ -277,6 +281,8 @@ local StoreListener = { | ||
| 277 | [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, | 281 | [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, |
| 278 | [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, | 282 | [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, |
| 279 | [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")}}, | ||
| 280 | } | 286 | } |
| 281 | } | 287 | } |
| 282 | 288 | ||
| @@ -325,6 +331,8 @@ local CalendaTaskListener = { | @@ -325,6 +331,8 @@ local CalendaTaskListener = { | ||
| 325 | [TaskType.ActBattlePass] = {{40, 3, f("chapterId")}}, | 331 | [TaskType.ActBattlePass] = {{40, 3, f("chapterId")}}, |
| 326 | [TaskType.AdvPass] = {{41, 3, f("id")}}, | 332 | [TaskType.AdvPass] = {{41, 3, f("id")}}, |
| 327 | [TaskType.CostJade] = {{43, 1, f("count")}}, | 333 | [TaskType.CostJade] = {{43, 1, f("count")}}, |
| 334 | + [TaskType.HeroStartSum] = {{44, 3}}, | ||
| 335 | + [TaskType.WakeCGSum] = {{45, 1, f("count")}}, | ||
| 328 | } | 336 | } |
| 329 | } | 337 | } |
| 330 | 338 | ||
| @@ -745,7 +753,7 @@ function RoleTask.bind(Role) | @@ -745,7 +753,7 @@ function RoleTask.bind(Role) | ||
| 745 | for _,uid in pairs(hero:getRunes()) do | 753 | for _,uid in pairs(hero:getRunes()) do |
| 746 | if uid > 0 then | 754 | if uid > 0 then |
| 747 | local runeData = self.runeBag[uid] | 755 | local runeData = self.runeBag[uid] |
| 748 | - if runeData then | 756 | + if runeData then |
| 749 | local csvData = csvdb["runeCsv"][runeData:getProperty("type")][runeData:getProperty("id")] | 757 | local csvData = csvdb["runeCsv"][runeData:getProperty("type")][runeData:getProperty("id")] |
| 750 | 758 | ||
| 751 | if csvData and cfg.condition2 <= csvData.rarity then | 759 | if csvData and cfg.condition2 <= csvData.rarity then |
| @@ -765,9 +773,9 @@ function RoleTask.bind(Role) | @@ -765,9 +773,9 @@ function RoleTask.bind(Role) | ||
| 765 | end | 773 | end |
| 766 | elseif cfg.type == 15 then -- 通关关卡 | 774 | elseif cfg.type == 15 then -- 通关关卡 |
| 767 | if (calTask[id] or 0) == 0 then | 775 | if (calTask[id] or 0) == 0 then |
| 768 | - if self:checkHangPass(cfg.condition2) then | 776 | + if self:checkHangPass(cfg.condition2) then |
| 769 | calTask[id] = 1 | 777 | calTask[id] = 1 |
| 770 | - end | 778 | + end |
| 771 | --local hangPass = self:getProperty("hangPass") | 779 | --local hangPass = self:getProperty("hangPass") |
| 772 | --local diff = math.floor(cfg.condition2 / 10000) | 780 | --local diff = math.floor(cfg.condition2 / 10000) |
| 773 | --if (hangPass[diff] or 0) >= cfg.condition2 then | 781 | --if (hangPass[diff] or 0) >= cfg.condition2 then |
| @@ -798,7 +806,7 @@ function RoleTask.bind(Role) | @@ -798,7 +806,7 @@ function RoleTask.bind(Role) | ||
| 798 | elseif cfg.type == 37 then -- 拾荒使用道具 | 806 | elseif cfg.type == 37 then -- 拾荒使用道具 |
| 799 | if cfg.condition2 == param1 then | 807 | if cfg.condition2 == param1 then |
| 800 | calTask[id] = (calTask[id] or 0) + (param2 or 0) | 808 | calTask[id] = (calTask[id] or 0) + (param2 or 0) |
| 801 | - end | 809 | + end |
| 802 | elseif cfg.type == 38 then -- 和指定建筑交互 | 810 | elseif cfg.type == 38 then -- 和指定建筑交互 |
| 803 | local condArr = cfg.condition3:toArray(true, "=") | 811 | local condArr = cfg.condition3:toArray(true, "=") |
| 804 | for i = 0, #condArr do | 812 | for i = 0, #condArr do |
| @@ -827,6 +835,14 @@ function RoleTask.bind(Role) | @@ -827,6 +835,14 @@ function RoleTask.bind(Role) | ||
| 827 | if cfg.condition2 <= param1 and param2 == 1 then | 835 | if cfg.condition2 <= param1 and param2 == 1 then |
| 828 | calTask[id] = (calTask[id] or 0) + 1 | 836 | calTask[id] = (calTask[id] or 0) + 1 |
| 829 | end | 837 | end |
| 838 | + elseif cfg.type == 44 then --玩家拥有拾荒者总星级达到xxx | ||
| 839 | + local count = 0 | ||
| 840 | + for _, hero in pairs(self.heros) do | ||
| 841 | + count = count + hero:getProperty("wakeL") | ||
| 842 | + end | ||
| 843 | + if (calTask[id] or 0) < count then | ||
| 844 | + calTask[id] = count | ||
| 845 | + end | ||
| 830 | end | 846 | end |
| 831 | end | 847 | end |
| 832 | end | 848 | end |
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/shared/ModelBaseMysql.lua
| @@ -510,6 +510,11 @@ function ModelBaseMysql:updateFields(fields) | @@ -510,6 +510,11 @@ function ModelBaseMysql:updateFields(fields) | ||
| 510 | skynet.error("error sql:"..sql) | 510 | skynet.error("error sql:"..sql) |
| 511 | skynet.error("error str:"..res["err"]) | 511 | skynet.error("error str:"..res["err"]) |
| 512 | return false | 512 | return false |
| 513 | + else | ||
| 514 | + if (res["affected_rows"] or -1) == 0 then | ||
| 515 | + skynet.error("affected row = 0") | ||
| 516 | + skynet.error("error sql:"..sql) | ||
| 517 | + end | ||
| 513 | end | 518 | end |
| 514 | end | 519 | end |
| 515 | return true | 520 | return true |