Commit 9a9a9bd636292007f049e9af1e1f3c097b90c744
Merge branch 'bugfix' into tr/qa
Showing
15 changed files
with
303 additions
and
98 deletions
Show diff stats
src/GlobalVar.lua
| ... | ... | @@ -134,7 +134,6 @@ ItemId = { |
| 134 | 134 | RuneFragment = 24, |
| 135 | 135 | HeroFC = {700, 701, 702, 703}, --通用角色碎片 |
| 136 | 136 | AdvKey = 80, -- 冒险钥匙 |
| 137 | - BoxKey = 60, -- 拆解工具 | |
| 138 | 137 | AdvPower = 4701, -- 拾荒体力 |
| 139 | 138 | CrisisScore = 8010, -- 积分 |
| 140 | 139 | } |
| ... | ... | @@ -323,6 +322,8 @@ MailId = { |
| 323 | 322 | |
| 324 | 323 | PaySignAward = 241, |
| 325 | 324 | PayBackAward = 242, |
| 325 | + CBBackAward = 243, | |
| 326 | + CBBackAward2 = 244, | |
| 326 | 327 | } |
| 327 | 328 | |
| 328 | 329 | TriggerEventType = { | ... | ... |
src/actions/ActivityAction.lua
| ... | ... | @@ -192,13 +192,13 @@ function _M.actPaySignRpc(agent, data) |
| 192 | 192 | local open, actId = role.activity:isOpen("PaySignIn") |
| 193 | 193 | if not open then return 2 end |
| 194 | 194 | |
| 195 | - local diffDay = diffFromTs(ts) + 1 | |
| 195 | + --local diffDay = diffFromTs(ts) + 1 | |
| 196 | 196 | |
| 197 | 197 | local curData = role.activity:getActData("PaySignIn") |
| 198 | 198 | if not curData then return 3 end |
| 199 | 199 | local reward, change = {} |
| 200 | 200 | for day, csvData in ipairs(csvdb["pay_signInCsv"]) do |
| 201 | - if day <= diffDay and day == dayIndex then | |
| 201 | + if day <= (curData[0] or 0) and day == dayIndex then | |
| 202 | 202 | if not curData[day] then |
| 203 | 203 | curData[day] = 1 |
| 204 | 204 | -- 奖励 |
| ... | ... | @@ -525,6 +525,10 @@ function _M.startBattleRpc(agent, data) |
| 525 | 525 | local reward, change = role:award(award, {log = {desc = "actBattle", int1 = actid, int2 = count or 0}}) |
| 526 | 526 | SendPacket(actionCodes.Activity_startBattleRpc, MsgPack.pack(role:packReward(reward, change))) |
| 527 | 527 | |
| 528 | + if battleCfg.worldBoss_award ~= 0 and (bi["maxP"] or 0) > 0 then | |
| 529 | + bi["bossP"] = (bi["bossP"] or 0) + bi["maxP"] | |
| 530 | + end | |
| 531 | + | |
| 528 | 532 | bi["sum"] = bi["sum"] + bi["top"] |
| 529 | 533 | actData["ticket"] = ticket - num |
| 530 | 534 | actData[id] = bi |
| ... | ... | @@ -656,7 +660,7 @@ function _M.endBattleRpc(agent, data) |
| 656 | 660 | battleInfo["star"] = curStar |
| 657 | 661 | end |
| 658 | 662 | |
| 659 | - if battleCfg.rank ~= 0 then | |
| 663 | + if battleCfg.rank ~= 0 and isWin then | |
| 660 | 664 | -- 消耗门票 |
| 661 | 665 | role.activity:getBattleTicket(actid) |
| 662 | 666 | local num = battleCfg.type:toArray(true, "=")[3] |
| ... | ... | @@ -675,8 +679,6 @@ function _M.endBattleRpc(agent, data) |
| 675 | 679 | role:updateRankCommon(RANK_TYPE.ActBattleBoss, rankVal) |
| 676 | 680 | end |
| 677 | 681 | end |
| 678 | - actData[id] = battleInfo | |
| 679 | - role.activity:updateActData("ChallengeLevel", actData) | |
| 680 | 682 | |
| 681 | 683 | if (oldStarNum == 0 and newStarNum > 0) or battleCfg.rank ~= 0 then |
| 682 | 684 | reward = battleCfg.item_clear:toNumMap() |
| ... | ... | @@ -703,6 +705,13 @@ function _M.endBattleRpc(agent, data) |
| 703 | 705 | role:checkStoryStatus(false, 5, id) |
| 704 | 706 | end |
| 705 | 707 | |
| 708 | + if battleCfg.worldBoss_award ~= 0 and msg.point then | |
| 709 | + battleInfo["bossP"] = (battleInfo["bossP"] or 0) + msg.point | |
| 710 | + battleInfo["maxP"] = math.max(msg.point, (battleInfo["maxP"] or 0)) | |
| 711 | + end | |
| 712 | + actData[id] = battleInfo | |
| 713 | + role.activity:updateActData("ChallengeLevel", actData) | |
| 714 | + | |
| 706 | 715 | reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}}) |
| 707 | 716 | |
| 708 | 717 | SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({ |
| ... | ... | @@ -793,8 +802,8 @@ function _M.crisisMilestoneRpc(agent, data) |
| 793 | 802 | end |
| 794 | 803 | actData.score[id] = -1 |
| 795 | 804 | role.activity:updateActData("Crisis", actData) |
| 796 | - | |
| 797 | - local reward, change = role:award(curCsv.award, {log = {desc = "actMilecrisis", int1 = actid}}) | |
| 805 | + | |
| 806 | + local reward, change = role:award(curCsv.reward, {log = {desc = "actMilecrisis", int1 = actid}}) | |
| 798 | 807 | SendPacket(actionCodes.Activity_crisisMilestoneRpc, MsgPack.pack(role:packReward(reward, change))) |
| 799 | 808 | return true |
| 800 | 809 | end |
| ... | ... | @@ -815,11 +824,47 @@ function _M.bossRewardRpc(agent, data) |
| 815 | 824 | local battleCfg = actCfg[id] |
| 816 | 825 | if not battleCfg then return 3 end |
| 817 | 826 | |
| 818 | - if battleCfg.boss_reward_id == 0 then return 4 end | |
| 827 | + if battleCfg.worldBoss_award == 0 then return 4 end | |
| 828 | + | |
| 829 | + actCfg = csvdb["activity_wordboss_awardCsv"][battleCfg.worldBoss_award] | |
| 830 | + if not actCfg then return 5 end | |
| 831 | + local awardCfg = actCfg[index] | |
| 832 | + if not awardCfg then return 6 end | |
| 833 | + | |
| 834 | + local preList = awardCfg.condition1:toArray(true, "=") | |
| 835 | + | |
| 836 | + local actData = role.activity:getActData("ChallengeLevel") or {} | |
| 837 | + local battleInfo = actData[id] or {} | |
| 838 | + local bossPoint = battleInfo["bossP"] or 0 | |
| 839 | + if bossPoint < 1 then return 7 end | |
| 840 | + | |
| 841 | + local bossRecord = battleInfo["bossR"] or "" | |
| 842 | + local r = string.char(string.getbit(bossRecord, index)) | |
| 843 | + if r == "1" then | |
| 844 | + return 9 | |
| 845 | + end | |
| 846 | + local ok = false | |
| 847 | + if #preList == 0 then | |
| 848 | + ok = true | |
| 849 | + else | |
| 850 | + for _, i in ipairs(preList) do | |
| 851 | + local flag = string.char(string.getbit(bossRecord, i)) | |
| 852 | + if flag == "1" then | |
| 853 | + ok = true | |
| 854 | + break | |
| 855 | + end | |
| 856 | + end | |
| 857 | + end | |
| 858 | + if not ok then return 8 end | |
| 859 | + | |
| 860 | + battleInfo["bossR"] = string.setbit(bossRecord, index) | |
| 861 | + battleInfo["bossP"] = bossPoint - 1 | |
| 862 | + actData[id] = battleInfo | |
| 863 | + role.activity:updateActData("ChallengeLevel", actData) | |
| 819 | 864 | |
| 820 | - --local award = mileCfg.reward:toNumMap() | |
| 821 | - --local reward, change = role:award(award, {log = {desc = "actMilestone", int1 = actid, int2 = index}}) | |
| 822 | - --SendPacket(actionCodes.Activity_battleMilestoneRpc, MsgPack.pack(role:packReward(reward, change))) | |
| 865 | + local award = awardCfg.reward:toNumMap() | |
| 866 | + local reward, change = role:award(award, {log = {desc = "worldBossReward", int1 = actid, int2 = index}}) | |
| 867 | + SendPacket(actionCodes.Activity_bossRewardRpc, MsgPack.pack(role:packReward(reward, change))) | |
| 823 | 868 | return true |
| 824 | 869 | end |
| 825 | 870 | ... | ... |
src/actions/HangAction.lua
| ... | ... | @@ -560,10 +560,10 @@ function _M.startBonusBattleRpc(agent, data) |
| 560 | 560 | end |
| 561 | 561 | |
| 562 | 562 | if not bonusData then return 3 end |
| 563 | - if not role:checkHangPass(bonusData.unlock) then return 4 end | |
| 563 | + local bonusStar = role:getProperty("bonusStar") | |
| 564 | 564 | |
| 565 | + if not bonusStar[bonusData.unlock] or bonusStar[bonusData.unlock] == 0 then return 4 end | |
| 565 | 566 | |
| 566 | - local bonusStar = role:getProperty("bonusStar") | |
| 567 | 567 | if bonusStar[id] and bonusStar[id] >= (1 << #bonusData.sweep_condition:toTableArray(true)) - 1 then |
| 568 | 568 | local bonusC = role.dailyData:getProperty("bonusC") |
| 569 | 569 | bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -724,10 +724,13 @@ function _M.drawHeroRpc(agent, data) |
| 724 | 724 | subType = 1 |
| 725 | 725 | if btype == 4 and role:getProperty("newerDraw") >= 10 then |
| 726 | 726 | subType = 2 |
| 727 | + if(role:getProperty("newerDraw") >= 30) then | |
| 728 | + return 30 | |
| 729 | + end | |
| 727 | 730 | end |
| 728 | 731 | end |
| 729 | 732 | |
| 730 | - -- 活动卡池 | |
| 733 | + -- 另开活动卡池 | |
| 731 | 734 | if actid then |
| 732 | 735 | if not role.activity:isOpenById(actid, "ActHeroPool") then return end |
| 733 | 736 | local cfg = csvdb["activity_ctrlCsv"][actid] |
| ... | ... | @@ -761,7 +764,7 @@ function _M.drawHeroRpc(agent, data) |
| 761 | 764 | local drawCount = {1, 10} -- 抽取次数 |
| 762 | 765 | if not drawCount[drawType] then return 3 end |
| 763 | 766 | |
| 764 | - local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | |
| 767 | + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] or 10 | |
| 765 | 768 | local floorHeroCount = role:getProperty("floorHero")[btype] or 0 |
| 766 | 769 | |
| 767 | 770 | -- 计算抽卡消耗品 |
| ... | ... | @@ -974,11 +977,16 @@ function _M.drawHeroRpc(agent, data) |
| 974 | 977 | }) |
| 975 | 978 | SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 |
| 976 | 979 | |
| 977 | - if (buildTypeData["can_feedback"] or 0) == 1 then | |
| 980 | + local feedbackId = buildTypeData["can_feedback"] or 0 | |
| 981 | + if feedbackId ~= 0 then | |
| 978 | 982 | -- 达到一定次数,给响应奖励 |
| 979 | 983 | local oldVal = role:getProperty("repayHero") or 0 |
| 984 | + if actid then | |
| 985 | + local actData = role.activity:getActData("ActHeroPool") | |
| 986 | + oldVal = actData[btype] or 0 | |
| 987 | + end | |
| 980 | 988 | local newVal = oldVal + drawCount[drawType] |
| 981 | - local drawCardReward, val = role:getDrawCardExtraReward(oldVal, newVal) | |
| 989 | + local drawCardReward, val = role:getDrawCardExtraReward(feedbackId, oldVal, newVal) | |
| 982 | 990 | -- 空字符穿代表直接给英雄 走以前repayHeroRpc |
| 983 | 991 | if drawCardReward == "" then |
| 984 | 992 | local repayHeroMaxCount = role:getProperty("repayMaxC") or 0 |
| ... | ... | @@ -988,11 +996,11 @@ function _M.drawHeroRpc(agent, data) |
| 988 | 996 | local even = repayHeroMaxCount % 2 |
| 989 | 997 | local id = 0 |
| 990 | 998 | if even == 1 then |
| 991 | - id = math.randWeight(csvdb["build_giftCsv"], "pool_1") | |
| 999 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | |
| 992 | 1000 | else |
| 993 | 1001 | local giftHeroSet = {} |
| 994 | 1002 | for gid, cfg in pairs(csvdb["build_giftCsv"]) do |
| 995 | - if cfg["pool_1"] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then | |
| 1003 | + if cfg["pool_"..feedbackId] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then | |
| 996 | 1004 | giftHeroSet[gid] = {1} |
| 997 | 1005 | end |
| 998 | 1006 | end |
| ... | ... | @@ -1001,7 +1009,7 @@ function _M.drawHeroRpc(agent, data) |
| 1001 | 1009 | end |
| 1002 | 1010 | end |
| 1003 | 1011 | if id == 0 then |
| 1004 | - id = math.randWeight(csvdb["build_giftCsv"], "pool_1") | |
| 1012 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_"..feedbackId) | |
| 1005 | 1013 | end |
| 1006 | 1014 | |
| 1007 | 1015 | local r,change = {} |
| ... | ... | @@ -1021,7 +1029,13 @@ function _M.drawHeroRpc(agent, data) |
| 1021 | 1029 | r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) |
| 1022 | 1030 | SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) |
| 1023 | 1031 | end |
| 1024 | - role:updateProperty({field = "repayHero", value = val}) | |
| 1032 | + if not actid then | |
| 1033 | + role:updateProperty({field = "repayHero", value = val}) | |
| 1034 | + else | |
| 1035 | + local actData = role.activity:getActData("ActHeroPool") | |
| 1036 | + actData[btype] = val | |
| 1037 | + role.activity:updateActData("ActHeroPool", actData) | |
| 1038 | + end | |
| 1025 | 1039 | end |
| 1026 | 1040 | return true |
| 1027 | 1041 | end | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -300,6 +300,7 @@ function _M.loginRpc( agent, data ) |
| 300 | 300 | if msg.newdevice then |
| 301 | 301 | role:mylog("newdevice", {key1 = agent.ip:toArray(false, ":")[1]}) |
| 302 | 302 | end |
| 303 | + | |
| 303 | 304 | return true |
| 304 | 305 | end |
| 305 | 306 | |
| ... | ... | @@ -372,6 +373,38 @@ function _M.createRpc(agent, data) |
| 372 | 373 | end |
| 373 | 374 | |
| 374 | 375 | SendPacket(actionCodes.Role_createRpc, MsgPack.pack(response)) |
| 376 | + | |
| 377 | + -- cb付费返利 | |
| 378 | + skynet.timeout(0, function() | |
| 379 | + local cbbackd = cluster.query("center", "cbbackd") | |
| 380 | + local uid = newRole:getProperty("uid") | |
| 381 | + local start = uid:find("_") | |
| 382 | + if start then | |
| 383 | + uid = uid:sub(start + 1) | |
| 384 | + end | |
| 385 | + if cbbackd then | |
| 386 | + local status, back = pcall(cluster.call, "center", cbbackd, "getCbBack", {uid = uid, id = roleId}) | |
| 387 | + if status then | |
| 388 | + if back and next(back) and back.reward and next(back.reward) then | |
| 389 | + local reward = "" | |
| 390 | + for itemId, count in pairs(back.reward) do | |
| 391 | + reward = reward:setv(itemId, count) | |
| 392 | + end | |
| 393 | + if back.reward[70] then | |
| 394 | + redisproxy:insertEmail({roleId = roleId, emailId = MailId.CBBackAward2, contentPms = {back.money}, createtime = skynet.timex(), attachments = reward}) | |
| 395 | + else | |
| 396 | + redisproxy:insertEmail({roleId = roleId, emailId = MailId.CBBackAward, contentPms = {back.money}, createtime = skynet.timex(), attachments = reward}) | |
| 397 | + end | |
| 398 | + newRole:mylog("cbback", {key1 = uid, int2 = roleId}) | |
| 399 | + end | |
| 400 | + else | |
| 401 | + skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId) | |
| 402 | + end | |
| 403 | + else | |
| 404 | + skynet.error("[ERROR] cbbackd cant call center uid: " .. uid .. " roleId:" .. roleId) | |
| 405 | + end | |
| 406 | + end) | |
| 407 | + | |
| 375 | 408 | return true |
| 376 | 409 | end |
| 377 | 410 | |
| ... | ... | @@ -537,82 +570,131 @@ function _M.openTimeBoxRpc(agent, data) |
| 537 | 570 | local slot = msg.slot -- 位置 1 - 6 |
| 538 | 571 | |
| 539 | 572 | -- 特权卡时间箱额外栏位 |
| 540 | - local privExtraCnt = role.storeData:getTimeBoxSlotExtraCount() | |
| 541 | - if oper == 1 then | |
| 542 | - if math.illegalNum(slot, 1, role:getFuncLv(FuncOpenType.TimeBoxSlot) + privExtraCnt) then return end | |
| 543 | - end | |
| 573 | + -- local privExtraCnt = role.storeData:getTimeBoxSlotExtraCount() | |
| 574 | + -- if oper == 1 then | |
| 575 | + -- if math.illegalNum(slot, 1, role:getFuncLv(FuncOpenType.TimeBoxSlot) + privExtraCnt) then return end | |
| 576 | + -- end | |
| 544 | 577 | |
| 545 | 578 | local boxL = role:getProperty("boxL") |
| 546 | - local reward, change = {} | |
| 547 | - if oper == 1 then -- 打开 | |
| 579 | + local reward, change | |
| 580 | + if oper == 1 then -- 构建开始(包括切换构建的id) | |
| 548 | 581 | local itemId = msg.itemId |
| 549 | - if role:getItemCount(itemId) < 1 then return end | |
| 550 | 582 | local itemData = csvdb["itemCsv"][itemId] |
| 551 | - local randomData = csvdb["item_randomCsv"][itemId] | |
| 552 | - if not itemData or not randomData or randomData.openTime <= 0 then return end | |
| 553 | - | |
| 554 | - if boxL[slot] then return end | |
| 555 | - role:costItems({[itemId] = 1}, {log = {desc = "openTimeBox"}}) | |
| 556 | - boxL[slot] = {id = itemId, time = skynet.timex() + randomData.openTime} | |
| 557 | - role:pushMsg({type = "box", slot = slot, time = randomData.openTime}) | |
| 558 | - elseif oper == 2 then -- 领取 | |
| 583 | + if not itemData then return 1 end | |
| 584 | + if not boxL[slot] then | |
| 585 | + boxL[slot] = {} | |
| 586 | + else | |
| 587 | + local oldId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time | |
| 588 | + local unitTime = globalCsv.box_key_time[oldId] * 60 | |
| 589 | + local doneCnt = math.floor((process + skynet.timex() - time) / unitTime) | |
| 590 | + if doneCnt > 0 then | |
| 591 | + reward = role:award({[oldId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}}) | |
| 592 | + end | |
| 593 | + end | |
| 594 | + local limit = globalCsv.box_key_max[itemId] or 5 | |
| 595 | + if role:getItemCount(itemId) >= limit then return 3 end | |
| 596 | + | |
| 597 | + boxL[slot] = {id = itemId, process = 0, time = skynet.timex()} | |
| 598 | + role:pushMsg({type = "box", slot = slot, time = skynet.timex() + globalCsv.box_productLine_time * 3600}) | |
| 599 | + elseif oper == 2 then -- 重置运行时间(可以使用加速) | |
| 559 | 600 | local quick = msg.quick |
| 560 | - if not boxL[slot] then return end | |
| 561 | - local costKey = 0 | |
| 562 | - if boxL[slot].time > skynet.timex() then -- 没开完 | |
| 563 | - if not quick then return end | |
| 601 | + if not boxL[slot] then return 4 end | |
| 602 | + | |
| 603 | + local itemId, process, time = boxL[slot].id, boxL[slot].process, boxL[slot].time | |
| 604 | + local nowTime = skynet.timex() | |
| 605 | + local stopTime = nowTime | |
| 606 | + local itemData = csvdb["itemCsv"][itemId] | |
| 607 | + local unitTime = globalCsv.box_key_time[itemId] * 60 | |
| 608 | + if quick then | |
| 609 | + stopTime = time + globalCsv.box_productLine_time * 3600 | |
| 564 | 610 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") |
| 565 | - costKey = math.ceil((boxL[slot].time - skynet.timex()) / (cost_pre[1] * 60)) * cost_pre[2] | |
| 566 | - if not role:checkItemEnough({[ItemId.BoxKey] = costKey}) then return end | |
| 567 | - role:costItems({[ItemId.BoxKey] = costKey}, {log = {desc = "openTimeBox"}}) | |
| 568 | - role:pushCancel({type = "box", slot = slot}) | |
| 611 | + local costKey = math.ceil((stopTime - nowTime) / (cost_pre[1] * 60)) * cost_pre[2] | |
| 612 | + if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end | |
| 613 | + role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot}}) | |
| 614 | + else | |
| 615 | + stopTime = math.min(nowTime,time + globalCsv.box_productLine_time * 3600) | |
| 616 | + end | |
| 617 | + role:pushCancel({type = "box", slot = slot}) | |
| 618 | + | |
| 619 | + local doneCnt = math.floor((process + stopTime - time) / unitTime) | |
| 620 | + if doneCnt > 0 then | |
| 621 | + reward = role:award({[itemId] = doneCnt}, {log = {desc = "openTimeBox", int1 = slot}}) | |
| 622 | + end | |
| 623 | + if role:getItemCount(itemId) >= globalCsv.box_key_max[itemId] then | |
| 624 | + nowTime = 0 | |
| 569 | 625 | end |
| 570 | - local boxId = boxL[slot].id | |
| 571 | - local itemData = csvdb["itemCsv"][boxId] | |
| 572 | - local randomData = csvdb["item_randomCsv"][itemData.id] | |
| 573 | - local costTime = skynet.timex() - (boxL[slot].time - randomData.openTime) | |
| 574 | - -- 随机奖励 | |
| 626 | + | |
| 627 | + boxL[slot] = {id = itemId, process = (process + stopTime - time) % unitTime, time = nowTime} | |
| 628 | + role:pushMsg({type = "box", slot = slot, time = nowTime + globalCsv.box_productLine_time * 3600}) | |
| 629 | + elseif oper == 3 then -- 开箱子 | |
| 630 | + local costId = msg.costId | |
| 631 | + local costs = (msg.costs or ""):toNumMap() | |
| 632 | + if not costId or not csvdb["itemCsv"][costId] or not next(costs) then return 6 end | |
| 633 | + | |
| 634 | + local costIdData = csvdb["itemCsv"][costId] | |
| 635 | + local count = 0 | |
| 636 | + for itemId, num in pairs(costs) do | |
| 637 | + local itemIdData = csvdb["itemCsv"][itemId] | |
| 638 | + if not itemIdData or not csvdb["item_randomCsv"][itemId] or costIdData.quality ~= itemIdData.quality then return 7 end | |
| 639 | + count = count + num | |
| 640 | + end | |
| 641 | + | |
| 642 | + if role:getItemCount(costId) < count then return 8 end | |
| 643 | + | |
| 644 | + role:costItems({[costId] = count}, {log = {desc = "openTimeBox"}}) | |
| 645 | + | |
| 575 | 646 | reward = {} |
| 576 | - for i = 1, 10 do | |
| 577 | - local num = randomData["num" .. i] | |
| 578 | - local gift = randomData["gift" .. i] | |
| 579 | - if num and gift and num > 0 and gift ~= "" then | |
| 580 | - local pool = {} | |
| 581 | - for _, temp in ipairs(gift:toArray()) do | |
| 582 | - local set = temp:toArray(true, "=") | |
| 583 | - table.insert(pool, set) | |
| 647 | + for itemId, value in pairs(costs) do | |
| 648 | + local tempReward = {} | |
| 649 | + local randomData = csvdb["item_randomCsv"][itemId] | |
| 650 | + local itemData = csvdb["itemCsv"][itemId] | |
| 651 | + role:costItems({[itemId] = value}, {log = {desc = "openTimeBox"}}) | |
| 652 | + for _ = 1, value do | |
| 653 | + for i = 1, 10 do | |
| 654 | + local num = randomData["num" .. i] | |
| 655 | + local gift = randomData["gift" .. i] | |
| 656 | + if num and gift and num > 0 and gift ~= "" then | |
| 657 | + local pool = {} | |
| 658 | + for _, temp in ipairs(gift:toArray()) do | |
| 659 | + local set = temp:toArray(true, "=") | |
| 660 | + table.insert(pool, set) | |
| 661 | + end | |
| 662 | + | |
| 663 | + local needCount = math.min(#pool, num) | |
| 664 | + for j = 1, needCount do | |
| 665 | + local idx = math.randWeight(pool, 3) | |
| 666 | + tempReward[pool[idx][1]] = (tempReward[pool[idx][1]] or 0) + pool[idx][2] | |
| 667 | + table.remove(pool, idx) | |
| 668 | + end | |
| 669 | + end | |
| 584 | 670 | end |
| 671 | + end | |
| 672 | + tempReward[0] = nil | |
| 673 | + role:checkTaskEnter("OpenBox", {id = itemId, count=value, quality=itemData.quality}) | |
| 674 | + role:log("carriage_dismantle", { | |
| 675 | + item_id = itemId, -- 道具id | |
| 676 | + item_type = itemData.type, -- 道具类型,具体见枚举表中道具类型枚举表 | |
| 677 | + item_level = 0, -- 道具等级 | |
| 678 | + item_number = 1, -- 道具变化数量的绝对值 | |
| 679 | + carriage_dismantle_type = 1, -- 拆解方式,时间到期:0,钥匙开启:1 | |
| 680 | + carriage_dismantle_time = 0, -- 拆解耗时,填写实际耗时 | |
| 681 | + carriage_dismantle_cost = value, -- 拆解花费钥匙数量,未使用填写0 | |
| 682 | + carriage_dismantle_rwd = tempReward, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..} | |
| 683 | + }) | |
| 585 | 684 | |
| 586 | - local needCount = math.min(#pool, num) | |
| 587 | - for j = 1, needCount do | |
| 588 | - local idx = math.randWeight(pool, 3) | |
| 589 | - reward[pool[idx][1]] = (reward[pool[idx][1]] or 0) + pool[idx][2] | |
| 590 | - table.remove(pool, idx) | |
| 591 | - end | |
| 685 | + for id, num in pairs(tempReward) do | |
| 686 | + reward[id] = (reward[id] or 0) + num | |
| 592 | 687 | end |
| 593 | 688 | end |
| 594 | - reward[0] = nil | |
| 595 | - | |
| 596 | - boxL[slot] = nil | |
| 597 | - reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) | |
| 598 | - role:checkTaskEnter("OpenBox", {id = boxId, count=1, quality=itemData.quality}) | |
| 599 | - | |
| 600 | - role:log("carriage_dismantle", { | |
| 601 | - item_id = boxId, -- 道具id | |
| 602 | - item_type = itemData.type, -- 道具类型,具体见枚举表中道具类型枚举表 | |
| 603 | - item_level = 0, -- 道具等级 | |
| 604 | - item_number = 1, -- 道具变化数量的绝对值 | |
| 605 | - carriage_dismantle_type = quick and 1 or 0, -- 拆解方式,时间到期:0,钥匙开启:1 | |
| 606 | - carriage_dismantle_time = costTime, -- 拆解耗时,填写实际耗时 | |
| 607 | - carriage_dismantle_cost = costKey, -- 拆解花费钥匙数量,未使用填写0 | |
| 608 | - carriage_dismantle_rwd = reward, -- 拆解获得物资,json格式记录,{'itemid1':2,'itemid2':3,…………..} | |
| 609 | - }) | |
| 689 | + reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = costId}}) | |
| 610 | 690 | else |
| 611 | 691 | return |
| 612 | 692 | end |
| 613 | 693 | |
| 614 | - role:setProperty("boxL") --刷新 | |
| 615 | - role:changeUpdates({{type = "boxL", field = slot, value = boxL[slot], isOnlyToC = true}}) -- 通知客户端 | |
| 694 | + role:setProperty("boxL",boxL) --刷新 | |
| 695 | + if slot then | |
| 696 | + role:changeUpdates({{type = "boxL", field = slot, value = boxL[slot], isOnlyToC = true}}) -- 通知客户端 | |
| 697 | + end | |
| 616 | 698 | SendPacket(actionCodes.Role_openTimeBoxRpc, MsgPack.pack(role:packReward(reward, change))) |
| 617 | 699 | return true |
| 618 | 700 | end | ... | ... |
src/actions/StoreAction.lua
| ... | ... | @@ -13,6 +13,9 @@ function _M.rechargeRpc(agent , data) |
| 13 | 13 | |
| 14 | 14 | --创建订单号 |
| 15 | 15 | local partnerOrderId = role:getPurchaseOrder(id) |
| 16 | + if partnerOrderId == "" then | |
| 17 | + return 1 | |
| 18 | + end | |
| 16 | 19 | SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId })) |
| 17 | 20 | |
| 18 | 21 | ... | ... |
src/agent.lua
| ... | ... | @@ -15,6 +15,7 @@ redisproxy = require "shared.redisproxy" |
| 15 | 15 | datacenter = require "skynet.datacenter" |
| 16 | 16 | mcast_util = require "services/mcast_util" |
| 17 | 17 | csvdb = require "shared.csvdata" |
| 18 | +cluster = require "skynet.cluster" | |
| 18 | 19 | |
| 19 | 20 | local CMD = {} |
| 20 | 21 | local agentInfo = {} -- { client_fd, role, gate_serv, open_timer} | ... | ... |
src/models/Activity.lua
| ... | ... | @@ -58,7 +58,7 @@ Activity.schema = { |
| 58 | 58 | actime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} |
| 59 | 59 | round = {"table", {}}, -- 记录活动到了第几轮 {id = roundnum} |
| 60 | 60 | act4 = {"table", {}}, -- {0 = day, 1= -1, 2 = -1} == 签到活动 |
| 61 | - act6 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 | |
| 61 | + act6 = {"table", {}}, -- {0 = day, 1 = 1, 2 = 1} == 付费签到活动 | |
| 62 | 62 | act8 = {"number", 0}, -- 充值返利 |
| 63 | 63 | |
| 64 | 64 | act11 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励 |
| ... | ... | @@ -71,6 +71,7 @@ Activity.schema = { |
| 71 | 71 | act19 = {"number", 0}, -- {挂机信息} |
| 72 | 72 | act20 = {"table", {}}, -- {id=扭蛋抽出数量} |
| 73 | 73 | |
| 74 | + act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} | |
| 74 | 75 | act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} |
| 75 | 76 | } |
| 76 | 77 | |
| ... | ... | @@ -90,6 +91,7 @@ function Activity:data() |
| 90 | 91 | act18 = self:getProperty("act18"), |
| 91 | 92 | act19 = self:getProperty("act19"), |
| 92 | 93 | act20 = self:getProperty("act20"), |
| 94 | + act26 = self:getProperty("act26"), | |
| 93 | 95 | } |
| 94 | 96 | end |
| 95 | 97 | |
| ... | ... | @@ -384,6 +386,11 @@ activityFunc[Activity.ActivityType.PaySignIn] = { |
| 384 | 386 | ["init"] = function(self, actType, isCrossDay, notify) |
| 385 | 387 | self:updateActData(actType, {}, not notify) |
| 386 | 388 | end, |
| 389 | + ["crossDay"] = function(self, actType, notify) | |
| 390 | + local curData = self:getActData(actType) | |
| 391 | + curData[0] = (curData[0] or 0) + 1 | |
| 392 | + self:updateActData(actType, curData, not notify) | |
| 393 | + end, | |
| 387 | 394 | ["close"] = function(self, actType, notify) |
| 388 | 395 | self.owner.storeData:SetActGoodsFlag("paySignIn", 0) |
| 389 | 396 | |
| ... | ... | @@ -492,6 +499,19 @@ activityFunc[Activity.ActivityType.Gachakon] = { |
| 492 | 499 | end, |
| 493 | 500 | } |
| 494 | 501 | |
| 502 | +-- 活动卡池 | |
| 503 | +activityFunc[Activity.ActivityType.ActHeroPool] = { | |
| 504 | + ["init"] = function(self, actType, isCrossDay, notify, actId) | |
| 505 | + end, | |
| 506 | + ["close"] = function(self, actType, notify, actId) | |
| 507 | + local actData = self:getActData(actType) | |
| 508 | + local cfg = csvdb["activity_ctrlCsv"][actId] | |
| 509 | + if not cfg then return end | |
| 510 | + actData[cfg.condition] = nil | |
| 511 | + self:updateActData(actType, actData, not notify) | |
| 512 | + end, | |
| 513 | +} | |
| 514 | + | |
| 495 | 515 | -- 挂机掉落 |
| 496 | 516 | activityFunc[Activity.ActivityType.HangDrop] = { |
| 497 | 517 | ["init"] = function(self, actType, isCrossDay, notify, actId) |
| ... | ... | @@ -543,7 +563,9 @@ function Activity:closeActivity(actId, notify, notUpdateAct) |
| 543 | 563 | self:recycleActItem(actId) |
| 544 | 564 | end |
| 545 | 565 | if Activity.schema["act".. actType] then |
| 546 | - self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct) | |
| 566 | + if not Activity.schema["act" .. actType][3] then | |
| 567 | + self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct) | |
| 568 | + end | |
| 547 | 569 | end |
| 548 | 570 | end |
| 549 | 571 | |
| ... | ... | @@ -731,7 +753,7 @@ activityFunc[Activity.ActivityType.Crisis] = { |
| 731 | 753 | local actData = self:getActData(actType) or {} |
| 732 | 754 | actData.task = actData.task or {} |
| 733 | 755 | local change = false |
| 734 | - local actCsv = csvData["activity_crisisCsv"][actId] | |
| 756 | + local actCsv = csvdb["activity_crisisCsv"][actId] | |
| 735 | 757 | for id, actSet in pairs(actCsv) do |
| 736 | 758 | if actSet.type == atype then |
| 737 | 759 | local status = actData.task[id] or 0 |
| ... | ... | @@ -740,7 +762,7 @@ activityFunc[Activity.ActivityType.Crisis] = { |
| 740 | 762 | local reward |
| 741 | 763 | if actSet.loop == 1 then |
| 742 | 764 | local rcount = math.floor(status / actSet.condition1) |
| 743 | - local reward = actSet.reward:toNumMap() | |
| 765 | + reward = actSet.reward:toNumMap() | |
| 744 | 766 | for itemId, itemC in pairs(reward) do |
| 745 | 767 | reward[itemId] = itemC * rcount |
| 746 | 768 | end |
| ... | ... | @@ -749,6 +771,7 @@ activityFunc[Activity.ActivityType.Crisis] = { |
| 749 | 771 | reward = actSet.reward |
| 750 | 772 | status = -1 |
| 751 | 773 | end |
| 774 | + | |
| 752 | 775 | self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) |
| 753 | 776 | end |
| 754 | 777 | actData.task[id] = status | ... | ... |
src/models/Email.lua
| ... | ... | @@ -62,7 +62,11 @@ function Email:data() |
| 62 | 62 | end |
| 63 | 63 | |
| 64 | 64 | if attachments == "" and emailData.attachment ~= "" then |
| 65 | - attachments = emailData.attachment:format(table.unpack(rewardPms)) | |
| 65 | + if next(rewardPms) then | |
| 66 | + attachments = emailData.attachment:format(table.unpack(rewardPms)) | |
| 67 | + else | |
| 68 | + attachments = emailData.attachment | |
| 69 | + end | |
| 66 | 70 | end |
| 67 | 71 | end |
| 68 | 72 | ... | ... |
src/models/RoleLog.lua
| ... | ... | @@ -50,6 +50,7 @@ local ItemReason = { |
| 50 | 50 | actHangDrop = 134, -- 掉落活动奖励 |
| 51 | 51 | actBattle = 135, -- 活动关卡 |
| 52 | 52 | actMilestone = 136, -- 活动关卡boss伤害里程碑 |
| 53 | + worldBossReward = 137, -- 世界boss翻牌奖励 | |
| 53 | 54 | |
| 54 | 55 | |
| 55 | 56 | advHang = 301, -- 拾荒挂机 |
| ... | ... | @@ -90,6 +91,7 @@ local ItemReason = { |
| 90 | 91 | actSign = 1007, -- 活动签到 |
| 91 | 92 | actPaySign = 1008, -- 活动付费签到 |
| 92 | 93 | calendaTask = 1009, -- 英雄帖 |
| 94 | + actMilecrisis = 1010, -- 物资危机 | |
| 93 | 95 | |
| 94 | 96 | -- 餐厅 |
| 95 | 97 | greenHourse = 1101, -- 食材获得 |
| ... | ... | @@ -581,6 +583,7 @@ local LogType = { |
| 581 | 583 | logout = "common", |
| 582 | 584 | guide = "common", |
| 583 | 585 | newdevice = "common", |
| 586 | + cbback = "common", | |
| 584 | 587 | |
| 585 | 588 | in_item = "common", |
| 586 | 589 | out_item = "common", | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -362,10 +362,34 @@ function RolePlugin.bind(Role) |
| 362 | 362 | pms.itemId = itemId |
| 363 | 363 | pms.count = - count |
| 364 | 364 | self:addItem(pms) |
| 365 | + self:itemDeltaEvent(pms) | |
| 365 | 366 | end |
| 366 | 367 | return true |
| 367 | 368 | end |
| 368 | 369 | |
| 370 | + function Role:itemDeltaEvent(pms) | |
| 371 | + self:eventBoxL(pms) | |
| 372 | + end | |
| 373 | + | |
| 374 | + -- 拆解室的生产线启动 | |
| 375 | + function Role:eventBoxL(pms) | |
| 376 | + local limit = globalCsv.box_key_max[pms.itemId] | |
| 377 | + if not limit then return end | |
| 378 | + | |
| 379 | + local update = false | |
| 380 | + local boxL = self:getProperty("boxL") or {} | |
| 381 | + for slot, data in pairs(boxL) do | |
| 382 | + if data.time == 0 and data.id == pms.itemId and self:getItemCount(pms.itemId) < limit then | |
| 383 | + update = true | |
| 384 | + data.time = skynet.timex() | |
| 385 | + end | |
| 386 | + end | |
| 387 | + | |
| 388 | + if update then | |
| 389 | + self:updateProperty({field = "boxL", value = boxL}) | |
| 390 | + end | |
| 391 | + end | |
| 392 | + | |
| 369 | 393 | function Role:getItemCount(itemId) |
| 370 | 394 | if itemId == ItemId.Diamond then |
| 371 | 395 | return self:getAllDiamond() |
| ... | ... | @@ -1580,15 +1604,17 @@ function RolePlugin.bind(Role) |
| 1580 | 1604 | return "" |
| 1581 | 1605 | end |
| 1582 | 1606 | local limit = rechargeData.limit |
| 1583 | - local rechargeRecord = self:getProperty("payR") or {} | |
| 1607 | + local rechargeRecord = self.storeData:getProperty("payR") or {} | |
| 1584 | 1608 | if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then |
| 1585 | 1609 | return "" |
| 1586 | 1610 | end |
| 1587 | 1611 | |
| 1588 | 1612 | --判断是否是活动商品 |
| 1589 | - local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id] | |
| 1590 | - if not actCfg then return "" end | |
| 1591 | - if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end | |
| 1613 | + if rechargeData.activity_id ~= 0 then | |
| 1614 | + local actCfg = csvdb["activity_ctrlCsv"][rechargeData.activity_id] | |
| 1615 | + if not actCfg then return "" end | |
| 1616 | + if not self.activity:isOpenById(rechargeData.activity_id, "ActShopGoods") then return "" end | |
| 1617 | + end | |
| 1592 | 1618 | |
| 1593 | 1619 | local orderId = redisproxy:hget(string.format(R_ORDERS, roleId), rechargeId) |
| 1594 | 1620 | if orderId then |
| ... | ... | @@ -1835,10 +1861,10 @@ function RolePlugin.bind(Role) |
| 1835 | 1861 | end |
| 1836 | 1862 | |
| 1837 | 1863 | -- 抽卡阶段奖励 |
| 1838 | - function Role:getDrawCardExtraReward(oldVal, newVal) | |
| 1864 | + function Role:getDrawCardExtraReward(feedbackId, oldVal, newVal) | |
| 1839 | 1865 | local reward = nil |
| 1840 | 1866 | local maxCount = 0 |
| 1841 | - for k, v in pairs(csvdb["build_extraRewardCsv"]) do | |
| 1867 | + for k, v in pairs(csvdb["build_extraRewardCsv"][feedbackId]) do | |
| 1842 | 1868 | if oldVal < k and newVal >= k then |
| 1843 | 1869 | reward = v["reward"] or "" |
| 1844 | 1870 | end | ... | ... |
src/models/RoleTask.lua
| ... | ... | @@ -148,7 +148,7 @@ local CommonListener = { |
| 148 | 148 | [TaskType.AdvStartSelf] = {{24}}, |
| 149 | 149 | [TaskType.ShopAll] = {{25, f("count")}}, |
| 150 | 150 | [TaskType.RuneUp] = {{26}}, |
| 151 | - [TaskType.OpenBox] = {{27, 1, f("id")}}, | |
| 151 | + [TaskType.OpenBox] = {{27, f("count"), f("id")}}, | |
| 152 | 152 | [TaskType.AdvDraw] = {{28, f("count"), f("ptype")}}, |
| 153 | 153 | [TaskType.PotionMake] = {{29, f("count"), f("id")}}, |
| 154 | 154 | } |
| ... | ... | @@ -174,7 +174,7 @@ local AchievListener = { |
| 174 | 174 | [TaskType.FoodSellGold] = {{15, f("count")}}, |
| 175 | 175 | [TaskType.DinerPopular] = {{16, f("count")}}, |
| 176 | 176 | [TaskType.TowerPass] = {{17, f("level")}}, |
| 177 | - [TaskType.OpenBox] = {{18}}, | |
| 177 | + [TaskType.OpenBox] = {{18, f("count")}}, | |
| 178 | 178 | [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}}, |
| 179 | 179 | [TaskType.DinerTalentUp] = {{20, 1, f("type")}}, |
| 180 | 180 | [TaskType.HangGetGold] = {{21, f("count")}}, |
| ... | ... | @@ -211,7 +211,7 @@ local SudokuListener = { |
| 211 | 211 | [TaskType.AdvDraw] = {{10, f("count")}}, |
| 212 | 212 | [TaskType.DinerLevelUp] = {{11, f("level"), f("type")}}, |
| 213 | 213 | [TaskType.FoodSell] = {{12, f("count")}}, |
| 214 | - [TaskType.OpenBox] = {{13, 1}}, | |
| 214 | + [TaskType.OpenBox] = {{13, f("count")}}, | |
| 215 | 215 | [TaskType.TowerPass] = {{14, f("level")}}, |
| 216 | 216 | [TaskType.PvpWin] = {{15, 1}}, |
| 217 | 217 | [TaskType.DinerTalentUp] = {{16, f("level"), f("type")}}, | ... | ... |
src/models/Store.lua
| ... | ... | @@ -392,6 +392,9 @@ function Store:onBuyPaySignCard(dur) |
| 392 | 392 | curTs = getServerOpenTs() |
| 393 | 393 | |
| 394 | 394 | self:SetActGoodsFlag("paySignIn", curTs) |
| 395 | + local actData = self.owner.activity:getActData("PaySignIn") | |
| 396 | + actData[0] = 1 | |
| 397 | + self.owner.activity:updateActData("PaySignIn", actData) | |
| 395 | 398 | |
| 396 | 399 | --local actGoodsFlag = self:getProperty("actGoodsFlag") or {} |
| 397 | 400 | --local goodsIndex = GetActGoodsIndex("paySignIn") | ... | ... |