Commit accf94c4ae4276ed7bd308117a59e979606e48d5
1 parent
d825d304
活动以类型标识,修改双倍活动bug
Showing
8 changed files
with
173 additions
and
65 deletions
Show diff stats
src/actions/DinerAction.lua
@@ -901,6 +901,7 @@ function _M.entrustRpc(agent , data) | @@ -901,6 +901,7 @@ function _M.entrustRpc(agent , data) | ||
901 | 901 | ||
902 | role:finishGuide(26) | 902 | role:finishGuide(26) |
903 | role:mylog("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId}) | 903 | role:mylog("diner_action", {desc = "entrus", short1 = ctype, int1 = entrustId}) |
904 | + role:checkTaskEnter("VillageApply", {}) | ||
904 | 905 | ||
905 | SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change})) | 906 | SendPacket(actionCodes.Diner_entrustRpc, MsgPack.pack({reward = reward, change = change})) |
906 | return true | 907 | return true |
src/actions/HangAction.lua
@@ -409,10 +409,9 @@ function _M.quickRpc(agent , data) | @@ -409,10 +409,9 @@ function _M.quickRpc(agent , data) | ||
409 | end | 409 | end |
410 | 410 | ||
411 | local doubleCoef = role.activity:isOpen("DoubleDrop") and 2 or 1 | 411 | local doubleCoef = role.activity:isOpen("DoubleDrop") and 2 or 1 |
412 | - | ||
413 | -- 特权卡获取加速获得额外道具 | 412 | -- 特权卡获取加速获得额外道具 |
414 | local coef = role.storeData:getProduceItemSpeedCoef() | 413 | local coef = role.storeData:getProduceItemSpeedCoef() |
415 | - if coef > 1 then | 414 | + if coef > 1 or doubleCoef > 1 then |
416 | for k, cnt in pairs(reward) do | 415 | for k, cnt in pairs(reward) do |
417 | reward[k] = math.floor(cnt * coef * doubleCoef) | 416 | reward[k] = math.floor(cnt * coef * doubleCoef) |
418 | end | 417 | end |
@@ -479,10 +478,15 @@ function _M.buyBonusCountRpc(agent, data) | @@ -479,10 +478,15 @@ function _M.buyBonusCountRpc(agent, data) | ||
479 | local btype = msg.type | 478 | local btype = msg.type |
480 | 479 | ||
481 | if not TimeReset["DailyBattle" .. btype] then return end | 480 | if not TimeReset["DailyBattle" .. btype] then return end |
481 | + local open, actId = role.activity:isOpen("BonusDouble") | ||
482 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
483 | + if not actData then return end | ||
484 | + | ||
485 | + local coef = open and tonumber(actData.condition2) or 1 | ||
482 | 486 | ||
483 | local bonusC = role.dailyData:getProperty("bonusC") | 487 | local bonusC = role.dailyData:getProperty("bonusC") |
484 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} | 488 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} |
485 | - local lastCount = globalCsv.bonus_daily_buy_count - bonusC[btype]["b"] | 489 | + local lastCount = globalCsv.bonus_daily_buy_count * coef - bonusC[btype]["b"] |
486 | if math.illegalNum(count, 1, lastCount) then return 1 end | 490 | if math.illegalNum(count, 1, lastCount) then return 1 end |
487 | 491 | ||
488 | if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return 2 end | 492 | if not role:checkItemEnough({[ItemId.Diamond] = globalCsv.bonus_buy_cost * count}) then return 2 end |
@@ -502,20 +506,30 @@ function _M.startBonusBattleRpc(agent, data) | @@ -502,20 +506,30 @@ function _M.startBonusBattleRpc(agent, data) | ||
502 | local msg = MsgPack.unpack(data) | 506 | local msg = MsgPack.unpack(data) |
503 | local id = msg.id | 507 | local id = msg.id |
504 | 508 | ||
505 | - if not role:isFuncUnlock(FuncUnlock.BonusBattle) then return end | 509 | + local open, actId = role.activity:isOpen("BonusDouble") |
510 | + | ||
511 | + if not role:isFuncUnlock(FuncUnlock.BonusBattle) then return 1 end | ||
506 | 512 | ||
507 | local bonusData = csvdb["bonus_battleCsv"][id] | 513 | local bonusData = csvdb["bonus_battleCsv"][id] |
508 | 514 | ||
509 | - if not role:isTimeResetOpen(TimeReset["DailyBattle" .. bonusData.type]) then return end | 515 | + if not open then |
516 | + if not role:isTimeResetOpen(TimeReset["DailyBattle" .. bonusData.type]) then return 2 end | ||
517 | + end | ||
510 | 518 | ||
511 | - if not bonusData then return 1 end | ||
512 | - if not role:checkHangPass(bonusData.unlock) then return 2 end | 519 | + if not bonusData then return 3 end |
520 | + if not role:checkHangPass(bonusData.unlock) then return 4 end | ||
513 | 521 | ||
514 | - if not next(role:getProperty("bTeam")) then return 3 end | 522 | + if not next(role:getProperty("bTeam")) then return 5 end |
515 | 523 | ||
516 | local bonusC = role.dailyData:getProperty("bonusC") | 524 | local bonusC = role.dailyData:getProperty("bonusC") |
517 | bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | 525 | bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} |
518 | - if globalCsv.bonus_daily_count - bonusC[bonusData.type]["c"] <= 0 then return 4 end | 526 | + |
527 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
528 | + if not actData then return 6 end | ||
529 | + | ||
530 | + local coef = open and tonumber(actData.condition2) or 1 | ||
531 | + | ||
532 | + if globalCsv.bonus_daily_count * coef - bonusC[bonusData.type]["c"] <= 0 then return 7 end | ||
519 | 533 | ||
520 | 534 | ||
521 | role.__bonusBattleCache = { | 535 | role.__bonusBattleCache = { |
@@ -533,6 +547,11 @@ function _M.endBonusBattleRpc(agent, data) | @@ -533,6 +547,11 @@ function _M.endBonusBattleRpc(agent, data) | ||
533 | local key = msg.key | 547 | local key = msg.key |
534 | local starNum = msg.starNum | 548 | local starNum = msg.starNum |
535 | if not role.__bonusBattleCache then return 1 end | 549 | if not role.__bonusBattleCache then return 1 end |
550 | + local open, actId = role.activity:isOpen("BonusDouble") | ||
551 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
552 | + if not actData then return end | ||
553 | + | ||
554 | + local coef = open and tonumber(actData.condition2) or 1 | ||
536 | 555 | ||
537 | if role.__bonusBattleCache.id ~= id or role.__bonusBattleCache.key ~= key then | 556 | if role.__bonusBattleCache.id ~= id or role.__bonusBattleCache.key ~= key then |
538 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) | 557 | SendPacket(actionCodes.Hang_endBonusBattleRpc, MsgPack.pack({errorCode = 1})) |
@@ -545,7 +564,7 @@ function _M.endBonusBattleRpc(agent, data) | @@ -545,7 +564,7 @@ function _M.endBonusBattleRpc(agent, data) | ||
545 | -- 胜利扣除次数 | 564 | -- 胜利扣除次数 |
546 | local bonusC = role.dailyData:getProperty("bonusC") | 565 | local bonusC = role.dailyData:getProperty("bonusC") |
547 | bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} | 566 | bonusC[bonusData.type] = bonusC[bonusData.type] or {c = 0, b = 0} |
548 | - if globalCsv.bonus_daily_count - bonusC[bonusData.type]["c"] <= 0 then return 3 end | 567 | + if globalCsv.bonus_daily_count * coef - bonusC[bonusData.type]["c"] <= 0 then return 3 end |
549 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1 | 568 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1 |
550 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 569 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
551 | 570 | ||
@@ -554,6 +573,9 @@ function _M.endBonusBattleRpc(agent, data) | @@ -554,6 +573,9 @@ function _M.endBonusBattleRpc(agent, data) | ||
554 | if chance[1] ~= 0 then | 573 | if chance[1] ~= 0 then |
555 | reward[chance[1]] = (reward[chance[1]] or 0) + chance[2] | 574 | reward[chance[1]] = (reward[chance[1]] or 0) + chance[2] |
556 | end | 575 | end |
576 | + for k, v in pairs(reward) do | ||
577 | + reward[k] = v * (coef > 1 and actData.condition or 1) | ||
578 | + end | ||
557 | reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}}) | 579 | reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = id}}) |
558 | role:checkTaskEnter("BonusPass", {id = id}) | 580 | role:checkTaskEnter("BonusPass", {id = id}) |
559 | end | 581 | end |
src/actions/HeroAction.lua
@@ -721,7 +721,7 @@ function _M.drawHeroRpc(agent, data) | @@ -721,7 +721,7 @@ function _M.drawHeroRpc(agent, data) | ||
721 | local role = agent.role | 721 | local role = agent.role |
722 | local msg = MsgPack.unpack(data) | 722 | local msg = MsgPack.unpack(data) |
723 | 723 | ||
724 | - if not role:isFuncUnlock(FuncUnlock.GetHero) then return end | 724 | + if not role:isFuncUnlock(FuncUnlock.GetHero) then return 1 end |
725 | local btype = msg.pool -- 1 2 3 卡池类型 | 725 | local btype = msg.pool -- 1 2 3 卡池类型 |
726 | local subType = msg.subType or 1-- 定向卡池需要传 子类型 | 726 | local subType = msg.subType or 1-- 定向卡池需要传 子类型 |
727 | local drawType = msg.type -- 1 单抽 2 十连 | 727 | local drawType = msg.type -- 1 单抽 2 十连 |
@@ -730,10 +730,10 @@ function _M.drawHeroRpc(agent, data) | @@ -730,10 +730,10 @@ function _M.drawHeroRpc(agent, data) | ||
730 | end | 730 | end |
731 | 731 | ||
732 | local buildTypeData = csvdb["build_typeCsv"][btype] | 732 | local buildTypeData = csvdb["build_typeCsv"][btype] |
733 | - if not buildTypeData then return 1 end | 733 | + if not buildTypeData then return 2 end |
734 | 734 | ||
735 | local drawCount = {1, 10} -- 抽取次数 | 735 | local drawCount = {1, 10} -- 抽取次数 |
736 | - if not drawCount[drawType] then return 2 end | 736 | + if not drawCount[drawType] then return 3 end |
737 | 737 | ||
738 | local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | 738 | local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] |
739 | local floorHeroCount = role:getProperty("floorHero")[btype] or 0 | 739 | local floorHeroCount = role:getProperty("floorHero")[btype] or 0 |
@@ -757,20 +757,20 @@ function _M.drawHeroRpc(agent, data) | @@ -757,20 +757,20 @@ function _M.drawHeroRpc(agent, data) | ||
757 | end | 757 | end |
758 | end | 758 | end |
759 | if lastCount > 0 then -- 钱不够 | 759 | if lastCount > 0 then -- 钱不够 |
760 | - return 3 | 760 | + return 4 |
761 | end | 761 | end |
762 | 762 | ||
763 | -- 抽取的池子 | 763 | -- 抽取的池子 |
764 | local poolMap = buildTypeData["pool"]:toNumMap() | 764 | local poolMap = buildTypeData["pool"]:toNumMap() |
765 | local poolId = poolMap[subType] | 765 | local poolId = poolMap[subType] |
766 | - if not poolId then return end | 766 | + if not poolId then return 5 end |
767 | 767 | ||
768 | --判断定向卡池是否开启 | 768 | --判断定向卡池是否开启 |
769 | if btype == 1 then | 769 | if btype == 1 then |
770 | if not role:isTimeResetOpen(TimeReset["DrawType" .. subType]) then | 770 | if not role:isTimeResetOpen(TimeReset["DrawType" .. subType]) then |
771 | local unlockPool = role.dailyData:getProperty("unlockPool") | 771 | local unlockPool = role.dailyData:getProperty("unlockPool") |
772 | if not unlockPool[subType] then | 772 | if not unlockPool[subType] then |
773 | - return 1 | 773 | + return 6 |
774 | end | 774 | end |
775 | end | 775 | end |
776 | end | 776 | end |
@@ -782,12 +782,12 @@ function _M.drawHeroRpc(agent, data) | @@ -782,12 +782,12 @@ function _M.drawHeroRpc(agent, data) | ||
782 | end | 782 | end |
783 | 783 | ||
784 | local unitPool = csvdb["build_unitCsv"][poolId] | 784 | local unitPool = csvdb["build_unitCsv"][poolId] |
785 | - if not unitPool then return 4 end | 785 | + if not unitPool then return 7 end |
786 | 786 | ||
787 | -- 开始抽 | 787 | -- 开始抽 |
788 | local resultPool = {} | 788 | local resultPool = {} |
789 | local function fillDrawPool(isFloorBack) | 789 | local function fillDrawPool(isFloorBack) |
790 | - local condition = {"rare", "camp"} | 790 | + local condition = {"rare"} |
791 | local values = {} | 791 | local values = {} |
792 | 792 | ||
793 | 793 | ||
@@ -848,7 +848,7 @@ function _M.drawHeroRpc(agent, data) | @@ -848,7 +848,7 @@ function _M.drawHeroRpc(agent, data) | ||
848 | fillDrawPool(isFloorBack) | 848 | fillDrawPool(isFloorBack) |
849 | if not next(resultPool) then | 849 | if not next(resultPool) then |
850 | skynet.error("random pool error, poolId:" .. poolId) | 850 | skynet.error("random pool error, poolId:" .. poolId) |
851 | - return | 851 | + return 8 |
852 | end | 852 | end |
853 | 853 | ||
854 | local itemId = math.randWeight(resultPool, 1) | 854 | local itemId = math.randWeight(resultPool, 1) |
src/actions/RoleAction.lua
@@ -584,7 +584,7 @@ function _M.openTimeBoxRpc(agent, data) | @@ -584,7 +584,7 @@ function _M.openTimeBoxRpc(agent, data) | ||
584 | 584 | ||
585 | boxL[slot] = nil | 585 | boxL[slot] = nil |
586 | reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) | 586 | reward, change = role:award(reward, {log = {desc = "openTimeBox", int1 = boxId}}) |
587 | - role:checkTaskEnter("OpenBox", {id = boxId, count=1}) | 587 | + role:checkTaskEnter("OpenBox", {id = boxId, count=1, quality=itemData.quality}) |
588 | 588 | ||
589 | role:log("carriage_dismantle", { | 589 | role:log("carriage_dismantle", { |
590 | item_id = boxId, -- 道具id | 590 | item_id = boxId, -- 道具id |
src/models/Activity.lua
1 | local Activity = class("Activity", require("shared.ModelBase")) | 1 | local Activity = class("Activity", require("shared.ModelBase")) |
2 | local string_format = string.format | 2 | local string_format = string.format |
3 | 3 | ||
4 | +-- activity_ctr showType | ||
4 | Activity.ActivityType = { | 5 | Activity.ActivityType = { |
5 | - Sign = 1, -- 签到 | 6 | + SsrUpPoolChange = 1, -- 特定英雄活动,切卡池 |
6 | DoubleDrop = 2, -- 双倍掉落 | 7 | DoubleDrop = 2, -- 双倍掉落 |
7 | - FoodSell = 3, --贩卖周 料理 | ||
8 | - DrawHero = 4, --抽卡周 招募 | ||
9 | - AdvDraw = 5, --拾荒抽周 资助 | ||
10 | - OpenBox = 6, --拆解周 时钟箱 | ||
11 | - PaySignIn = 7, --付费签到 | ||
12 | - PayBack = 9, --返利 | ||
13 | - | ||
14 | - SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 | 8 | + Sign = 4, -- 签到 |
9 | + ChangeCG = 5, -- 客户端使用,切换抽卡界面 | ||
10 | + PaySignIn = 6, --付费签到 | ||
11 | + ExploreCommand = 7, -- 探索指令 | ||
12 | + PayBack = 8, --返利 | ||
13 | + | ||
14 | + BonusDouble = 9, -- 奖励关卡翻倍 | ||
15 | + CalendaTask = 10, -- 日历任务 | ||
16 | + | ||
17 | + FoodSell = 11, --贩卖周 料理 | ||
18 | + DrawHero = 12, --抽卡周 招募 | ||
19 | + AdvDraw = 13, --拾荒抽周 资助 | ||
20 | + OpenBox = 14, --拆解周 时钟箱 | ||
15 | } | 21 | } |
16 | 22 | ||
17 | 23 | ||
@@ -33,26 +39,27 @@ end | @@ -33,26 +39,27 @@ end | ||
33 | Activity.schema = { | 39 | Activity.schema = { |
34 | actime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} | 40 | actime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} |
35 | round = {"table", {}}, -- 记录活动到了第几轮 {id = roundnum} | 41 | round = {"table", {}}, -- 记录活动到了第几轮 {id = roundnum} |
36 | - act1 = {"table", {}}, -- {0 = day, 1= -1, 2 = -1} == 签到活动 | ||
37 | - act3 = {"table", {}}, -- {0 = 抽卡次数, 1=1, 2=1} 抽卡周活动 1表示领取过该档位的奖励 | ||
38 | - act4 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励 | ||
39 | - act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 | ||
40 | - act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 | ||
41 | - act7 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 | ||
42 | - act9 = {"number", 0}, -- 充值返利 | 42 | + act4 = {"table", {}}, -- {0 = day, 1= -1, 2 = -1} == 签到活动 |
43 | + act6 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 | ||
44 | + act8 = {"number", 0}, -- 充值返利 | ||
45 | + | ||
46 | + act11 = {"table", {}}, -- {0 = 贩卖数量, 1=1, 2=1} 贩卖周活动 1表示领取过该档位的奖励 | ||
47 | + act12 = {"table", {}}, -- {0 = 抽卡次数, 1=1, 2=1} 抽卡周活动 1表示领取过该档位的奖励 | ||
48 | + act13 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 | ||
49 | + act14 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 | ||
43 | } | 50 | } |
44 | 51 | ||
45 | function Activity:data() | 52 | function Activity:data() |
46 | return { | 53 | return { |
47 | actime = self:getProperty("actime"), | 54 | actime = self:getProperty("actime"), |
48 | round = self:getProperty("round"), | 55 | round = self:getProperty("round"), |
49 | - act1 = self:getProperty("act1"), | ||
50 | - act3 = self:getProperty("act3"), | ||
51 | act4 = self:getProperty("act4"), | 56 | act4 = self:getProperty("act4"), |
52 | - act5 = self:getProperty("act5"), | ||
53 | act6 = self:getProperty("act6"), | 57 | act6 = self:getProperty("act6"), |
54 | - act7 = self:getProperty("act7"), | ||
55 | - act9 = self:getProperty("act9"), | 58 | + act8 = self:getProperty("act8"), |
59 | + act11 = self:getProperty("act11"), | ||
60 | + act12 = self:getProperty("act12"), | ||
61 | + act13 = self:getProperty("act13"), | ||
62 | + act14 = self:getProperty("act14"), | ||
56 | } | 63 | } |
57 | end | 64 | end |
58 | 65 | ||
@@ -77,10 +84,9 @@ function Activity:updateProperty(params) | @@ -77,10 +84,9 @@ function Activity:updateProperty(params) | ||
77 | return false | 84 | return false |
78 | end | 85 | end |
79 | 86 | ||
80 | - | ||
81 | -function Activity:isOpenRaw(activityType, now) | ||
82 | - activityType = checkActivityType(activityType) | ||
83 | - local actData = csvdb["activity_ctrlCsv"][activityType] | 87 | +function Activity:isOpenRaw(activityId, now) |
88 | + activityId = checkActivityType(activityId) | ||
89 | + local actData = csvdb["activity_ctrlCsv"][activityId] | ||
84 | if not actData then return end | 90 | if not actData then return end |
85 | 91 | ||
86 | if actData.time == "" then -- 关闭 | 92 | if actData.time == "" then -- 关闭 |
@@ -89,7 +95,7 @@ function Activity:isOpenRaw(activityType, now) | @@ -89,7 +95,7 @@ function Activity:isOpenRaw(activityType, now) | ||
89 | 95 | ||
90 | local st = 0 | 96 | local st = 0 |
91 | local et = 0 | 97 | local et = 0 |
92 | - local now = skynet.timex() | 98 | + --local now = skynet.timex() |
93 | 99 | ||
94 | if actData.ttype == 0 then -- 时间开放 | 100 | if actData.ttype == 0 then -- 时间开放 |
95 | local openTimes = actData.time:toArray(false, "=") | 101 | local openTimes = actData.time:toArray(false, "=") |
@@ -118,7 +124,17 @@ end | @@ -118,7 +124,17 @@ end | ||
118 | -- 缓存开放 | 124 | -- 缓存开放 |
119 | function Activity:isOpen(activityType) | 125 | function Activity:isOpen(activityType) |
120 | activityType = checkActivityType(activityType) | 126 | activityType = checkActivityType(activityType) |
121 | - return self._isOpen[activityType] | 127 | + --return self._isOpen[activityType] |
128 | + local open = false | ||
129 | + for id, data in pairs(csvdb["activity_ctrlCsv"]) do | ||
130 | + if data.showType == activityType then | ||
131 | + open = self._isOpen[data.id] | ||
132 | + if open then | ||
133 | + return true, data.id | ||
134 | + end | ||
135 | + end | ||
136 | + end | ||
137 | + return false | ||
122 | end | 138 | end |
123 | 139 | ||
124 | function Activity:getActData(actType) | 140 | function Activity:getActData(actType) |
@@ -137,22 +153,22 @@ function Activity:checkActivityStatus(now, isCrossDay, notify) | @@ -137,22 +153,22 @@ function Activity:checkActivityStatus(now, isCrossDay, notify) | ||
137 | self._isOpen = {} | 153 | self._isOpen = {} |
138 | local actime = self:getProperty("actime") | 154 | local actime = self:getProperty("actime") |
139 | local change = false | 155 | local change = false |
140 | - for actType, actData in pairs(csvdb["activity_ctrlCsv"]) do | ||
141 | - local isOpen, startTime = self:isOpenRaw(actType, now) | ||
142 | - self._isOpen[actType] = isOpen | 156 | + for actId, actData in pairs(csvdb["activity_ctrlCsv"]) do |
157 | + local isOpen, startTime = self:isOpenRaw(actId, now) | ||
158 | + self._isOpen[actId] = isOpen | ||
143 | 159 | ||
144 | if isOpen then | 160 | if isOpen then |
145 | - if actime[actType] and actime[actType] == startTime then -- 还是之前的状态 开放中 | 161 | + if actime[actId] and actime[actId] == startTime then -- 还是之前的状态 开放中 |
146 | else -- 重置 | 162 | else -- 重置 |
147 | - actime[actType] = startTime | ||
148 | - self:closeActivity(actType, notify, true) | ||
149 | - self:initActivity(actType, isCrossDay, notify) | 163 | + actime[actId] = startTime |
164 | + self:closeActivity(actId, notify, true) | ||
165 | + self:initActivity(actId, isCrossDay, notify) | ||
150 | change = true | 166 | change = true |
151 | end | 167 | end |
152 | else | 168 | else |
153 | - if actime[actType] then | ||
154 | - self:closeActivity(actType, notify) | ||
155 | - actime[actType] = nil | 169 | + if actime[actId] then |
170 | + self:closeActivity(actId, notify) | ||
171 | + actime[actId] = nil | ||
156 | change = true | 172 | change = true |
157 | end | 173 | end |
158 | end | 174 | end |
@@ -345,13 +361,19 @@ activityFunc[Activity.ActivityType.PayBack] = { | @@ -345,13 +361,19 @@ activityFunc[Activity.ActivityType.PayBack] = { | ||
345 | -- end, | 361 | -- end, |
346 | } | 362 | } |
347 | 363 | ||
348 | -function Activity:initActivity(actType, isCrossDay, notify) | 364 | +function Activity:initActivity(actId, isCrossDay, notify) |
365 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
366 | + if not actData then return end | ||
367 | + local actType = actData.showType | ||
349 | if activityFunc[actType] and activityFunc[actType]['close'] then | 368 | if activityFunc[actType] and activityFunc[actType]['close'] then |
350 | activityFunc[actType]["init"](self, actType, isCrossDay, notify) | 369 | activityFunc[actType]["init"](self, actType, isCrossDay, notify) |
351 | end | 370 | end |
352 | end | 371 | end |
353 | 372 | ||
354 | -function Activity:closeActivity(actType, notify, notUpdateAct) | 373 | +function Activity:closeActivity(actId, notify, notUpdateAct) |
374 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
375 | + if not actData then return end | ||
376 | + local actType = actData.showType | ||
355 | if activityFunc[actType] and activityFunc[actType]['close'] then | 377 | if activityFunc[actType] and activityFunc[actType]['close'] then |
356 | activityFunc[actType]["close"](self, actType, notify) | 378 | activityFunc[actType]["close"](self, actType, notify) |
357 | end | 379 | end |
@@ -361,8 +383,10 @@ function Activity:closeActivity(actType, notify, notUpdateAct) | @@ -361,8 +383,10 @@ function Activity:closeActivity(actType, notify, notUpdateAct) | ||
361 | end | 383 | end |
362 | 384 | ||
363 | function Activity:refreshDailyData(notify) | 385 | function Activity:refreshDailyData(notify) |
364 | - for actType, status in pairs(self._isOpen) do | ||
365 | - if status then | 386 | + for actId, status in pairs(self._isOpen) do |
387 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
388 | + if status and actData then | ||
389 | + local actType = actData.showType | ||
366 | if activityFunc[actType] and activityFunc[actType]['crossDay'] then | 390 | if activityFunc[actType] and activityFunc[actType]['crossDay'] then |
367 | activityFunc[actType]["crossDay"](self, actType, notify) | 391 | activityFunc[actType]["crossDay"](self, actType, notify) |
368 | end | 392 | end |
@@ -398,10 +422,12 @@ end | @@ -398,10 +422,12 @@ end | ||
398 | 422 | ||
399 | -- 获取活动卡池id | 423 | -- 获取活动卡池id |
400 | function Activity:getActivityPool(mainType, subType) | 424 | function Activity:getActivityPool(mainType, subType) |
401 | - if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then | 425 | + local open, actId = self:isOpen(Activity.ActivityType.SsrUpPoolChange) |
426 | + if not open then | ||
427 | + --if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then | ||
402 | return 0 | 428 | return 0 |
403 | end | 429 | end |
404 | - local actData = csvdb["activity_ctrlCsv"][Activity.ActivityType.SsrUpPoolChange] | 430 | + local actData = csvdb["activity_ctrlCsv"][actId] |
405 | if not actData then return 0 end | 431 | if not actData then return 0 end |
406 | 432 | ||
407 | local poolMap = actData.condition2:toMap(true, "=") | 433 | local poolMap = actData.condition2:toMap(true, "=") |
src/models/RoleTask.lua
@@ -12,6 +12,9 @@ local TaskType = { | @@ -12,6 +12,9 @@ local TaskType = { | ||
12 | WakeCG = 7, -- 觉醒到解锁CG - heroType | 12 | WakeCG = 7, -- 觉醒到解锁CG - heroType |
13 | HeroTalent = 8, -- 天赋升级 - heroType alv | 13 | HeroTalent = 8, -- 天赋升级 - heroType alv |
14 | DrawSSR = 9, -- 抽到SSR - count | 14 | DrawSSR = 9, -- 抽到SSR - count |
15 | + HeroLvlCollect = 10, -- 英雄等级收集进度 | ||
16 | + HeroQualityCollect = 11, -- 英雄品质收集进度 | ||
17 | + HeroStarCollect = 12, -- 英雄星级收集进度 | ||
15 | 18 | ||
16 | --装备相关 | 19 | --装备相关 |
17 | AddEquip = 101, -- 获得装备 - equipId rarity | 20 | AddEquip = 101, -- 获得装备 - equipId rarity |
@@ -44,6 +47,7 @@ local TaskType = { | @@ -44,6 +47,7 @@ local TaskType = { | ||
44 | AdvStartSelf = 409, -- 手动冒险 - id | 47 | AdvStartSelf = 409, -- 手动冒险 - id |
45 | AdvScore = 410, -- 冒险分数 - score | 48 | AdvScore = 410, -- 冒险分数 - score |
46 | AdvDraw = 411, -- 冒险资助 - count ptype | 49 | AdvDraw = 411, -- 冒险资助 - count ptype |
50 | + AdvHang = 412, -- 代理拾荒次数 | ||
47 | 51 | ||
48 | --爬塔相关 | 52 | --爬塔相关 |
49 | TowerPass = 501, -- 爬塔通关 - level | 53 | TowerPass = 501, -- 爬塔通关 - level |
@@ -60,6 +64,7 @@ local TaskType = { | @@ -60,6 +64,7 @@ local TaskType = { | ||
60 | DinerPopular = 608, -- 人气值 - count | 64 | DinerPopular = 608, -- 人气值 - count |
61 | DinerLevelUp = 609, -- 餐厅升级 - level type | 65 | DinerLevelUp = 609, -- 餐厅升级 - level type |
62 | DinerTalentUp = 610, -- 天赋升级 - type level | 66 | DinerTalentUp = 610, -- 天赋升级 - type level |
67 | + VillageApply = 611, -- 餐厅委托个数 | ||
63 | 68 | ||
64 | -- 车厢相关 | 69 | -- 车厢相关 |
65 | PotionMake = 701, -- 营养剂制作 - id count | 70 | PotionMake = 701, -- 营养剂制作 - id count |
@@ -78,6 +83,7 @@ local TaskType = { | @@ -78,6 +83,7 @@ local TaskType = { | ||
78 | 83 | ||
79 | -- 角色相关 | 84 | -- 角色相关 |
80 | RoleLevelUp = 901, -- 角色升级 - curlevel | 85 | RoleLevelUp = 901, -- 角色升级 - curlevel |
86 | + RuneQualityCollect = 902, -- 铭文品质收集进度 | ||
81 | 87 | ||
82 | --功能未实现 todo | 88 | --功能未实现 todo |
83 | AdvShop = 1002, -- 冒险商城 | 89 | AdvShop = 1002, -- 冒险商城 |
@@ -230,6 +236,32 @@ local StoreListener = { | @@ -230,6 +236,32 @@ local StoreListener = { | ||
230 | } | 236 | } |
231 | } | 237 | } |
232 | 238 | ||
239 | +local CalendaTaskListener = { | ||
240 | + func = "checkCalendaTask", | ||
241 | + listen = { | ||
242 | + [TaskType.DrawHero] = {{1, 1, f("count")}}, | ||
243 | + [TaskType.BonusPass]= {{2, 1}}, | ||
244 | + [TaskType.AdvPass]= {{3, 1}}, | ||
245 | + [TaskType.DinerLevelUp]= {{4, 2, f("level")}}, | ||
246 | + [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄 | ||
247 | + [TaskType.AdvHang]= {{6, 1}}, ---- | ||
248 | + [TaskType.HeroQualityCollect]= {{7, 3}}, | ||
249 | + [TaskType.OverOderTask]= {{8, 1}}, | ||
250 | + [TaskType.VillageApply]= {{9, 1}}, | ||
251 | + [TaskType.PvpWin]= {{10, 2, f("score")}}, | ||
252 | + [TaskType.DinerPopular]= {{11, 2, f("count")}}, | ||
253 | + [TaskType.RoleLevelUp]= {{12, 2, f("level")}}, | ||
254 | + [TaskType.TowerPass]= {{13, 2, f("level")}}, | ||
255 | + [TaskType.HeroTalent]= {{14, 1}}, | ||
256 | + [TaskType.HangPass]= {{15, 2, f("id")}}, | ||
257 | + [TaskType.HeroStarCollect]= {{16, 3}}, | ||
258 | + [TaskType.FoodSell]= {{17, 1, f("count")}}, | ||
259 | + [TaskType.HangGet]= {{18, 3, f("reward")}}, | ||
260 | + [TaskType.RuneQualityCollect]= {{19, 3, f("id")}}, | ||
261 | + [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}}, | ||
262 | + } | ||
263 | +} | ||
264 | + | ||
233 | 265 | ||
234 | local TaskListeners = { | 266 | local TaskListeners = { |
235 | StoryListener, | 267 | StoryListener, |
@@ -552,6 +584,33 @@ function RoleTask.bind(Role) | @@ -552,6 +584,33 @@ function RoleTask.bind(Role) | ||
552 | self.storeData:OnTriggerLimitTimePack(triggerType, param) | 584 | self.storeData:OnTriggerLimitTimePack(triggerType, param) |
553 | end | 585 | end |
554 | 586 | ||
587 | + function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) | ||
588 | + local open, actId = self.activity:isOpen("CalendaTask") | ||
589 | + local actData = csvdb["activity_ctrlCsv"][actId] | ||
590 | + if not actData then return end | ||
591 | + if not open then return end | ||
592 | + | ||
593 | + local change = false | ||
594 | + local calTask = self:getProperty("calTask") or {} | ||
595 | + param1 = param1 or 1 | ||
596 | + | ||
597 | + local cid = actData.condition | ||
598 | + for k, taskList in pairs(csvdb["activity_taskCsv"]) do | ||
599 | + if k == cid then | ||
600 | + for id, cfg in pairs(taskList) do | ||
601 | + if cfg.type == mainType then | ||
602 | + if subType == 1 then -- 增加数值 | ||
603 | + calTask[id] = (calTask[id] or 0) + param1 | ||
604 | + elseif subType == 2 then -- 直接赋值 | ||
605 | + calTask[id] = param1 | ||
606 | + elseif subType == 3 then -- 自定义类型 | ||
607 | + end | ||
608 | + end | ||
609 | + end | ||
610 | + end | ||
611 | + end | ||
612 | + end | ||
613 | + | ||
555 | end | 614 | end |
556 | 615 | ||
557 | return RoleTask | 616 | return RoleTask |
558 | \ No newline at end of file | 617 | \ No newline at end of file |
src/utils/CommonFunc.lua
@@ -155,7 +155,7 @@ function diffFromOpen() | @@ -155,7 +155,7 @@ function diffFromOpen() | ||
155 | hour = RESET_TIME, | 155 | hour = RESET_TIME, |
156 | } | 156 | } |
157 | if now < openTime then | 157 | if now < openTime then |
158 | - return 0 | 158 | + return -1 |
159 | end | 159 | end |
160 | 160 | ||
161 | return math.floor((now - openTime) / DAY_SEC) | 161 | return math.floor((now - openTime) / DAY_SEC) |