Commit 7b570ef2f680be5560bdb3bee5199da027ed95d3
1 parent
ff7cd89e
新春活动任务
Showing
9 changed files
with
84 additions
and
126 deletions
Show diff stats
src/GlobalVar.lua
src/actions/ActivityAction.lua
| ... | ... | @@ -723,7 +723,9 @@ function _M.endBattleRpc(agent, data) |
| 723 | 723 | if check[cond[1]] and check[cond[1]](table.unpack(cond)) then |
| 724 | 724 | curStar = curStar + (1 << (i - 1)) |
| 725 | 725 | end |
| 726 | - end | |
| 726 | + end | |
| 727 | + | |
| 728 | + role:checkTaskEnter("ActBattlePass", {chapterId = id}) | |
| 727 | 729 | else |
| 728 | 730 | curStar = 0 |
| 729 | 731 | if battleCfg.rank ~= 0 then | ... | ... |
src/actions/AdvAction.lua
| ... | ... | @@ -334,7 +334,7 @@ function _M.startHangRpc(agent, data) |
| 334 | 334 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
| 335 | 335 | |
| 336 | 336 | role:changeAdvCount(adv_idle_energy) |
| 337 | - role:checkTaskEnter("AdvStart", {id = chapterId}) | |
| 337 | + role:checkTaskEnter("AdvStart", {id = chapterId, actid = actid}) | |
| 338 | 338 | role:mylog("adv_action", {desc = "startHang", int1 = chapterId}) |
| 339 | 339 | |
| 340 | 340 | SendPacket(actionCodes.Adv_startHangRpc, '') | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -976,6 +976,12 @@ function _M.drawHeroRpc(agent, data) |
| 976 | 976 | role:updateProperty({field="newerDraw", value = newCount + drawCount[drawType]}) |
| 977 | 977 | end |
| 978 | 978 | |
| 979 | + -- 限时礼包 | |
| 980 | + local dailyDrawCnt = role.dailyData:getProperty("drawHeroCnt") or 0 | |
| 981 | + dailyDrawCnt = dailyDrawCnt + drawCount[drawType] | |
| 982 | + role.dailyData:setProperty("drawHeroCnt", dailyDrawCnt) | |
| 983 | + role:checkTaskEnter("DrawHeroLimitPack", {count = dailyDrawCnt}) | |
| 984 | + | |
| 979 | 985 | role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) |
| 980 | 986 | if btype ~= 3 then |
| 981 | 987 | role:checkTaskEnter("DrawHeroNotFriend", {pool = btype, count = drawCount[drawType]}) | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -1133,6 +1133,7 @@ function Adv:useItem(itemId, count, target) |
| 1133 | 1133 | end |
| 1134 | 1134 | |
| 1135 | 1135 | self:checkAchievement(self.AchievType.UseItem, count, itemId) |
| 1136 | + self.owner:checkTaskEnter("AdvUseItem", {itemId = itemId, count = count}) | |
| 1136 | 1137 | self:mylog({desc = "useItem", int1 = itemId, int2 = count}) |
| 1137 | 1138 | |
| 1138 | 1139 | self.owner:log("mission_pick_use", { |
| ... | ... | @@ -1760,6 +1761,7 @@ local function clickBuild(self, room, block, params) |
| 1760 | 1761 | self:checkTask(Adv.TaskType.Build, 1, oldId) |
| 1761 | 1762 | self:checkAchievement(Adv.AchievType.Build, 1, oldId) |
| 1762 | 1763 | self:checkAchievement(Adv.AchievType.BuildBySelect, 1, oldId, choose) |
| 1764 | + self.owner:checkTaskEnter("AdvBuild", {buildId = oldId}) | |
| 1763 | 1765 | |
| 1764 | 1766 | if clearBlock then |
| 1765 | 1767 | block:clear() |
| ... | ... | @@ -2338,6 +2340,8 @@ function Adv:enemyDead(enemy, escape) |
| 2338 | 2340 | self:checkAchievement(Adv.AchievType.Kill, 1, enemyId) |
| 2339 | 2341 | self:checkAchievement(Adv.AchievType.KillHadBuff, 1, enemy) |
| 2340 | 2342 | |
| 2343 | + self.onwer:checkTaskEnter("AdvKill", {chapterId = self.chapterId}) | |
| 2344 | + | |
| 2341 | 2345 | self:checkAchievement(Adv.AchievType.KillWithBuff, 1) |
| 2342 | 2346 | self:checkAchievement(Adv.AchievType.KillNoBuff, 1) |
| 2343 | 2347 | self:checkAchievement(Adv.AchievType.KillWithMWeapon, 1) | ... | ... |
src/models/Daily.lua
src/models/RoleTask.lua
| ... | ... | @@ -16,6 +16,7 @@ local TaskType = { |
| 16 | 16 | HeroQualityCollect = 11, -- 英雄品质收集进度 |
| 17 | 17 | HeroStarCollect = 12, -- 英雄星级收集进度 |
| 18 | 18 | DrawHeroNotFriend = 13, -- 非友情招募 -- count |
| 19 | + DrawHeroLimitPack = 14, -- 抽卡限时礼貌 -- count | |
| 19 | 20 | |
| 20 | 21 | --装备相关 |
| 21 | 22 | AddEquip = 101, -- 获得装备 - equipId rarity |
| ... | ... | @@ -56,6 +57,9 @@ local TaskType = { |
| 56 | 57 | AdvHangHeroCnt = 416, -- 拾荒人数 |
| 57 | 58 | AdvCostPower = 417, -- 消耗体力 |
| 58 | 59 | AdvPassFirst = 418, -- 冒险首次通关 - id |
| 60 | + AdvUseItem = 419, -- 使用道具 - itemId count | |
| 61 | + AdvBuild = 420, -- 建筑交互 - buildId | |
| 62 | + AdvKill = 421, -- 拾荒击败敌人 | |
| 59 | 63 | |
| 60 | 64 | --爬塔相关 |
| 61 | 65 | TowerPass = 501, -- 爬塔通关 - level |
| ... | ... | @@ -104,6 +108,7 @@ local TaskType = { |
| 104 | 108 | Login = 908, -- 登入 |
| 105 | 109 | CostDiamond = 909, -- 消耗钻石 |
| 106 | 110 | WeekTask = 910, -- 完成每周活跃任务 |
| 111 | + ActBattlePass = 911, -- 活动关卡通关 -- chapterId | |
| 107 | 112 | |
| 108 | 113 | --功能未实现 todo |
| 109 | 114 | AdvShop = 1002, -- 冒险商城 |
| ... | ... | @@ -257,6 +262,7 @@ local StoreListener = { |
| 257 | 262 | [TaskType.TowerPass] = {{TriggerEventType.TowerPass, f("level")}}, |
| 258 | 263 | [TaskType.AdvPassFirst] = {{TriggerEventType.AdvPass, f("id")}}, |
| 259 | 264 | [TaskType.AddHero] = {{TriggerEventType.AddNewHero, f("heroType")}, {TriggerEventType.SSRCount, f("ssrCount")}}, |
| 265 | + [TaskType.DrawHeroLimitPack] = {{TriggerEventType.DrawHeroLimitPack, f("count")}}, | |
| 260 | 266 | } |
| 261 | 267 | } |
| 262 | 268 | |
| ... | ... | @@ -268,7 +274,7 @@ local CalendaTaskListener = { |
| 268 | 274 | [TaskType.AdvStart]= {{3, 1}}, |
| 269 | 275 | [TaskType.DinerLevelUp]= {{4, 2, f("level")}}, |
| 270 | 276 | [TaskType.HeroLvlCollect]= {{5, 3}}, -- x名y级英雄 |
| 271 | - [TaskType.AdvHang]= {{6, 1}}, ---- | |
| 277 | + [TaskType.AdvHang]= {{6, 3, f("actid")}}, ---- | |
| 272 | 278 | [TaskType.HeroQualityCollect]= {{7, 3}}, |
| 273 | 279 | [TaskType.OverOderTask]= {{8, 1}}, |
| 274 | 280 | [TaskType.VillageApply]= {{9, 1}}, |
| ... | ... | @@ -294,10 +300,16 @@ local CalendaTaskListener = { |
| 294 | 300 | [TaskType.DailyTask] = {{30, 2, f("cur")}}, |
| 295 | 301 | [TaskType.WeekTask] = {{31, 2, f("cur")}}, |
| 296 | 302 | [TaskType.MakeFood] = {{32, 1, f("count")}}, |
| 297 | - [TaskType.AddItem] = {{33, 3, f("type"), f("count")}}, | |
| 303 | + [TaskType.AddItem] = {{33, 3, f("type"), f("count")}, {42, 3, f("id"), f("count")}}, | |
| 298 | 304 | [TaskType.CostDiamond] = {{34, 1, f("count")}}, |
| 299 | 305 | [TaskType.DrawHeroNotFriend] = {{35, 1, f("count")}}, |
| 300 | 306 | [TaskType.AdvCostPower] = {{36, 1, f("count")}}, |
| 307 | + | |
| 308 | + [TaskType.AdvUseItem] = {{37, 3, f("itemId"), f("count")}}, | |
| 309 | + [TaskType.AdvBuild] = {{38, 3, f("buildId")}}, | |
| 310 | + [TaskType.AdvKill] = {{39, 1, f("chapterId")}}, | |
| 311 | + [TaskType.ActBattlePass] = {{40, 3, f("chapterId")}}, | |
| 312 | + [TaskType.AdvPass] = {{41, 3, f("id")}}, | |
| 301 | 313 | } |
| 302 | 314 | } |
| 303 | 315 | |
| ... | ... | @@ -642,17 +654,7 @@ function RoleTask.bind(Role) |
| 642 | 654 | self.storeData:OnTriggerLimitTimePack(triggerType, param) |
| 643 | 655 | end |
| 644 | 656 | |
| 645 | - function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) | |
| 646 | - --print("check calenda task", mainType, subType, param1, param2) | |
| 647 | - local actEnum = "CalendaTask" | |
| 648 | - local keyName = "calTask" | |
| 649 | - if not self.activity then return end | |
| 650 | - local open, actId = self.activity:isOpen(actEnum) | |
| 651 | - local actData = csvdb["activity_ctrlCsv"][actId] | |
| 652 | - if not actData then return end | |
| 653 | - if not open then return end | |
| 654 | - | |
| 655 | - local change = false | |
| 657 | + function Role:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) | |
| 656 | 658 | local calTask = self:getProperty(keyName) or {} |
| 657 | 659 | param1 = param1 or 1 |
| 658 | 660 | |
| ... | ... | @@ -744,13 +746,49 @@ function RoleTask.bind(Role) |
| 744 | 746 | calTask[id] = (calTask[id] or 0) + (param1 or 0) |
| 745 | 747 | elseif cfg.type == 28 then -- 完成指定任务 |
| 746 | 748 | --print(actId,param2, cfg.condition2, param1) |
| 747 | - if actId == param2 and cfg.condition2 == param1 then | |
| 749 | + if actData.id == param2 and cfg.condition2 == param1 then | |
| 748 | 750 | calTask[id] = (calTask[id] or 0) + 1 |
| 749 | 751 | end |
| 750 | 752 | elseif cfg.type == 33 then -- 获得指定类型道具多少个 |
| 751 | 753 | if cfg.condition2 == param1 then |
| 752 | 754 | calTask[id] = (calTask[id] or 0) + (param2 or 0) |
| 753 | 755 | end |
| 756 | + elseif cfg.type == 42 then -- 获得指定id道具多少个 | |
| 757 | + if cfg.condition2 == param1 then | |
| 758 | + calTask[id] = (calTask[id] or 0) + (param2 or 0) | |
| 759 | + end | |
| 760 | + elseif cfg.type == 6 then -- 代理拾荒次数 | |
| 761 | + if cfg.condition2 == 0 or (cfg.condition2 == 1 and param1) then | |
| 762 | + calTask[id] = (calTask[id] or 0) + 1 | |
| 763 | + end | |
| 764 | + elseif cfg.type == 37 then -- 拾荒使用道具 | |
| 765 | + if cfg.condition2 == param1 then | |
| 766 | + calTask[id] = (calTask[id] or 0) + (param2 or 0) | |
| 767 | + end | |
| 768 | + elseif cfg.type == 38 then -- 和指定建筑交互 | |
| 769 | + local condArr = cfg.condition3:toArray(true, "=") | |
| 770 | + for i = 0, #condArr do | |
| 771 | + if condArr[i] == param1 then | |
| 772 | + calTask[id] = (calTask[id] or 0) + 1 | |
| 773 | + break | |
| 774 | + end | |
| 775 | + end | |
| 776 | + elseif cfg.type == 39 then -- 拾荒特定章节消灭敌人 | |
| 777 | + local condArr = cfg.condition3:toArray(true, "=") | |
| 778 | + for i = 0, #condArr do | |
| 779 | + if condArr[i] == param1 then | |
| 780 | + calTask[id] = (calTask[id] or 0) + 1 | |
| 781 | + break | |
| 782 | + end | |
| 783 | + end | |
| 784 | + elseif cfg.type == 40 then -- 指定活动关卡通关 | |
| 785 | + if cfg.condition2 == param1 then | |
| 786 | + calTask[id] = (calTask[id] or 0) + 1 | |
| 787 | + end | |
| 788 | + elseif cfg.type == 41 then -- 通关拾荒指定关卡 | |
| 789 | + if cfg.condition2 == param1 then | |
| 790 | + calTask[id] = (calTask[id] or 0) + 1 | |
| 791 | + end | |
| 754 | 792 | end |
| 755 | 793 | end |
| 756 | 794 | end |
| ... | ... | @@ -758,7 +796,19 @@ function RoleTask.bind(Role) |
| 758 | 796 | end |
| 759 | 797 | end |
| 760 | 798 | self:updateProperty({field = keyName, value = calTask, notNotify = notNotify}) |
| 761 | - --dump(calTask) | |
| 799 | + end | |
| 800 | + | |
| 801 | + function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) | |
| 802 | + --print("check calenda task", mainType, subType, param1, param2) | |
| 803 | + local actEnum = "CalendaTask" | |
| 804 | + local keyName = "calTask" | |
| 805 | + if not self.activity then return end | |
| 806 | + local open, actId = self.activity:isOpen(actEnum) | |
| 807 | + local actData = csvdb["activity_ctrlCsv"][actId] | |
| 808 | + if not actData then return end | |
| 809 | + if not open then return end | |
| 810 | + | |
| 811 | + self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) | |
| 762 | 812 | end |
| 763 | 813 | |
| 764 | 814 | function Role:checkBattleCommandTask(notNotify, mainType, subType, param1, param2) |
| ... | ... | @@ -771,113 +821,7 @@ function RoleTask.bind(Role) |
| 771 | 821 | if not actData then return end |
| 772 | 822 | if not open then return end |
| 773 | 823 | |
| 774 | - local change = false | |
| 775 | - local calTask = self:getProperty(keyName) or {} | |
| 776 | - param1 = param1 or 1 | |
| 777 | - | |
| 778 | - local cid = actData.condition | |
| 779 | - for k, taskList in pairs(csvdb["activity_taskCsv"]) do | |
| 780 | - if k == cid then | |
| 781 | - for id, cfg in pairs(taskList) do | |
| 782 | - if cfg.type == mainType then | |
| 783 | - if subType == 1 then -- 增加数值 | |
| 784 | - calTask[id] = (calTask[id] or 0) + param1 | |
| 785 | - elseif subType == 2 then -- 直接赋值 | |
| 786 | - calTask[id] = param1 | |
| 787 | - elseif subType == 3 then -- 自定义类型 | |
| 788 | - if cfg.type == 7 then -- 英雄品质收集进度 | |
| 789 | - local count = 0 | |
| 790 | - for _, hero in pairs(self.heros) do | |
| 791 | - local unitData = csvdb["unitCsv"][hero:getProperty("type")] | |
| 792 | - if unitData then | |
| 793 | - if cfg.condition2 <= unitData.rare then | |
| 794 | - count = count + 1 | |
| 795 | - end | |
| 796 | - end | |
| 797 | - end | |
| 798 | - if (calTask[id] or 0) < count then | |
| 799 | - calTask[id] = count | |
| 800 | - end | |
| 801 | - elseif cfg.type == 5 then -- 英雄等级收集进度 | |
| 802 | - local count = 0 | |
| 803 | - for _, hero in pairs(self.heros) do | |
| 804 | - if cfg.condition2 <= hero:getProperty("level") then | |
| 805 | - count = count + 1 | |
| 806 | - end | |
| 807 | - end | |
| 808 | - if (calTask[id] or 0) < count then | |
| 809 | - calTask[id] = count | |
| 810 | - end | |
| 811 | - elseif cfg.type == 16 then -- 英雄星级收集进度 | |
| 812 | - local count = 0 | |
| 813 | - for _, hero in pairs(self.heros) do | |
| 814 | - if cfg.condition2 <= hero:getProperty("wakeL") then | |
| 815 | - count = count + 1 | |
| 816 | - end | |
| 817 | - end | |
| 818 | - if (calTask[id] or 0) < count then | |
| 819 | - calTask[id] = count | |
| 820 | - end | |
| 821 | - elseif cfg.type == 18 then -- 挂机累计收获id,y个 | |
| 822 | - for rid, v in pairs(param1) do | |
| 823 | - if cfg.condition2 == rid then | |
| 824 | - calTask[id] = (calTask[id] or 0) + v | |
| 825 | - end | |
| 826 | - end | |
| 827 | - elseif cfg.type == 19 then -- x名英雄装备y品质以上符文套装 | |
| 828 | - local count = 0 | |
| 829 | - for _, hero in pairs(self.heros) do | |
| 830 | - local rcount = 0 | |
| 831 | - for _,uid in pairs(hero:getRunes()) do | |
| 832 | - if uid > 0 then | |
| 833 | - local runeData = self.runeBag[uid] | |
| 834 | - if runeData then | |
| 835 | - local csvData = csvdb["runeCsv"][runeData:getProperty("type")][runeData:getProperty("id")] | |
| 836 | - | |
| 837 | - if csvData and cfg.condition2 <= csvData.rarity then | |
| 838 | - rcount = rcount + 1 | |
| 839 | - end | |
| 840 | - end | |
| 841 | - end | |
| 842 | - end | |
| 843 | - if rcount == 6 then | |
| 844 | - count = count + 1 | |
| 845 | - end | |
| 846 | - end | |
| 847 | - calTask[id] = count | |
| 848 | - elseif cfg.type == 20 then -- 开启x品质时钟箱子 | |
| 849 | - if cfg.condition2 <= (param2 or 0) then | |
| 850 | - calTask[id] = (calTask[id] or 0) + param1 | |
| 851 | - end | |
| 852 | - elseif cfg.type == 15 then -- 通关关卡 | |
| 853 | - if (calTask[id] or 0) == 0 then | |
| 854 | - local hangPass = self:getProperty("hangPass") | |
| 855 | - local diff = math.floor(cfg.condition2 / 10000) | |
| 856 | - if (hangPass[diff] or 0) >= cfg.condition1 then | |
| 857 | - calTask[id] = 1 | |
| 858 | - end | |
| 859 | - end | |
| 860 | - elseif cfg.type == 22 then -- 电台任务出勤人数 | |
| 861 | - calTask[id] = (calTask[id] or 0) + (param1 or 0) | |
| 862 | - elseif cfg.type == 24 then -- 代理拾荒出勤人数 | |
| 863 | - calTask[id] = (calTask[id] or 0) + (param1 or 0) | |
| 864 | - elseif cfg.type == 28 then -- 完成指定任务 | |
| 865 | - --print(actId,param2, cfg.condition2, param1) | |
| 866 | - if actId == param2 and cfg.condition2 == param1 then | |
| 867 | - calTask[id] = (calTask[id] or 0) + 1 | |
| 868 | - end | |
| 869 | - elseif cfg.type == 33 then -- 获得指定类型道具多少个 | |
| 870 | - if cfg.condition2 == param1 then | |
| 871 | - calTask[id] = (calTask[id] or 0) + (param2 or 0) | |
| 872 | - end | |
| 873 | - end | |
| 874 | - end | |
| 875 | - end | |
| 876 | - end | |
| 877 | - end | |
| 878 | - end | |
| 879 | - self:updateProperty({field = keyName, value = calTask, notNotify = notNotify}) | |
| 880 | - --dump(calTask) | |
| 824 | + self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) | |
| 881 | 825 | end |
| 882 | 826 | |
| 883 | 827 | end | ... | ... |