Commit df622b85a5b7918c3de099fce0fa87fd3a93d83d
1 parent
9a6d3ed3
魔鬼训练营相关
Showing
9 changed files
with
254 additions
and
12 deletions
Show diff stats
src/ProtocolCode.lua
@@ -121,6 +121,10 @@ actionCodes = { | @@ -121,6 +121,10 @@ actionCodes = { | ||
121 | Hero_changeSparkRpc = 227, | 121 | Hero_changeSparkRpc = 227, |
122 | Hero_saveGeniusTreeRpc = 228, | 122 | Hero_saveGeniusTreeRpc = 228, |
123 | Hero_stickersConvertRpc = 229, --兑换英雄贴纸 | 123 | Hero_stickersConvertRpc = 229, --兑换英雄贴纸 |
124 | + Hero_trainStartRpc = 230, --开始魔鬼训练 | ||
125 | + Hero_trainFinishRpc = 231, | ||
126 | + Hero_trainTaskRewardRpc = 232, --领取魔鬼训练营任务 | ||
127 | + Hero_trainQuickRpc = 233, --魔鬼训练营加速 | ||
124 | 128 | ||
125 | Hang_startRpc = 251, | 129 | Hang_startRpc = 251, |
126 | Hang_checkRpc = 252, | 130 | Hang_checkRpc = 252, |
src/actions/GmAction.lua
@@ -688,19 +688,36 @@ function _M.test(role, pms) | @@ -688,19 +688,36 @@ function _M.test(role, pms) | ||
688 | if id > 100 then | 688 | if id > 100 then |
689 | actid = tonum(pms.pm2, 0) | 689 | actid = tonum(pms.pm2, 0) |
690 | end | 690 | end |
691 | - --local hero = require ("actions.HeroAction") | ||
692 | - --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) | 691 | + --if id == 1 then |
692 | + -- local hero = require ("actions.HeroAction") | ||
693 | + -- local ret = hero.trainStartRpc({role = role}, MsgPack.pack({id = 1})) | ||
694 | + -- if ret ~= true then | ||
695 | + -- return ret | ||
696 | + -- end | ||
697 | + --elseif id == 2 then | ||
698 | + -- local hero = require ("actions.HeroAction") | ||
699 | + -- local ret = hero.trainFinishRpc({role = role}, MsgPack.pack({id = 1})) | ||
700 | + -- if ret ~= true then | ||
701 | + -- return ret | ||
702 | + -- end | ||
703 | + --elseif id == 3 then | ||
704 | + -- local hero = require ("actions.HeroAction") | ||
705 | + -- local ret = hero.trainQuickRpc({role = role}, MsgPack.pack({id = 1})) | ||
706 | + -- if ret ~= true then | ||
707 | + -- return ret | ||
708 | + -- end | ||
709 | + --end | ||
693 | 710 | ||
694 | --role:sendMail(13, nil, "1=2", {111}) | 711 | --role:sendMail(13, nil, "1=2", {111}) |
695 | - local file = io.open("draw_hero_"..id..".csv", "a") | ||
696 | - for i=1, 10000 do | ||
697 | - local heroIds = _M.drawHero(role, id, actid) | ||
698 | - for k, v in ipairs(heroIds) do | ||
699 | - print((i - 1)* 10 + k, v) | ||
700 | - file:write(v.."\n") | ||
701 | - end | ||
702 | - end | ||
703 | - io.close(file) | 712 | + --local file = io.open("draw_hero_"..id..".csv", "a") |
713 | + --for i=1, 10000 do | ||
714 | + -- local heroIds = _M.drawHero(role, id, actid) | ||
715 | + -- for k, v in ipairs(heroIds) do | ||
716 | + -- print((i - 1)* 10 + k, v) | ||
717 | + -- file:write(v.."\n") | ||
718 | + -- end | ||
719 | + --end | ||
720 | + --io.close(file) | ||
704 | return "成功" | 721 | return "成功" |
705 | end | 722 | end |
706 | 723 |
src/actions/HeroAction.lua
@@ -117,6 +117,8 @@ function _M.wakeRpc(agent, data) | @@ -117,6 +117,8 @@ function _M.wakeRpc(agent, data) | ||
117 | local hero = role.heros[msg.id] | 117 | local hero = role.heros[msg.id] |
118 | if not hero then return 1 end | 118 | if not hero then return 1 end |
119 | if hero:getProperty("wakeL") >= #csvdb["unit_wakeCsv"] then return 2 end | 119 | if hero:getProperty("wakeL") >= #csvdb["unit_wakeCsv"] then return 2 end |
120 | + if hero:getProperty("trainTs") ~= 0 then return 9 end | ||
121 | + | ||
120 | local typ = hero:getProperty("type") | 122 | local typ = hero:getProperty("type") |
121 | local wakeData = csvdb["unit_wakeCsv"][hero:getProperty("wakeL")] | 123 | local wakeData = csvdb["unit_wakeCsv"][hero:getProperty("wakeL")] |
122 | if not wakeData then return 3 end | 124 | if not wakeData then return 3 end |
@@ -180,6 +182,8 @@ function _M.wakeRpc(agent, data) | @@ -180,6 +182,8 @@ function _M.wakeRpc(agent, data) | ||
180 | 182 | ||
181 | role:checkTaskEnter("HeroStarCollect", {}) | 183 | role:checkTaskEnter("HeroStarCollect", {}) |
182 | role:checkTaskEnter("HeroStartSum", {}) | 184 | role:checkTaskEnter("HeroStartSum", {}) |
185 | + role:checkTaskEnter("SSRHeroStarSum", {}) | ||
186 | + role:checkTaskEnter("SRHeroStarSum", {}) | ||
183 | return true | 187 | return true |
184 | end | 188 | end |
185 | 189 | ||
@@ -1435,4 +1439,149 @@ function _M.stickersConvertRpc(agent, data) | @@ -1435,4 +1439,149 @@ function _M.stickersConvertRpc(agent, data) | ||
1435 | return true | 1439 | return true |
1436 | end | 1440 | end |
1437 | 1441 | ||
1442 | +function _M.trainStartRpc(agent, data) | ||
1443 | + local role = agent.role | ||
1444 | + local msg = MsgPack.unpack(data) | ||
1445 | + local hero = role.heros[msg.id] | ||
1446 | + if not hero then return 1 end | ||
1447 | + local rare = hero:getRare() | ||
1448 | + if rare ~= HeroQuality.SSR and rare ~= HeroQuality.SR then return 2 end | ||
1449 | + local trainTimeCfg = (rare == HeroQuality.SSR and globalCsv.training_camp_ssr or globalCsv.training_camp_sr) | ||
1450 | + local trainCostCfg = (rare == HeroQuality.SSR and globalCsv.training_camp_ssr_cost or globalCsv.training_camp_sr_cost) | ||
1451 | + dump(trainTimeCfg) | ||
1452 | + dump(trainCostCfg) | ||
1453 | + | ||
1454 | + local curLevel = hero:getProperty("wakeL") | ||
1455 | + local trainTs = hero:getProperty("trainTs") | ||
1456 | + local sparkInfo = hero:getProperty("spark") | ||
1457 | + print(msg.id, rare, curLevel) | ||
1458 | + if trainTs ~= 0 then return 3 end | ||
1459 | + | ||
1460 | + local sec = trainTimeCfg[curLevel] or 0 | ||
1461 | + if sec == 0 then return 4 end | ||
1462 | + | ||
1463 | + if not trainCostCfg[curLevel] then return 10 end | ||
1464 | + | ||
1465 | + local costs = trainCostCfg[curLevel]:toNumMap() | ||
1466 | + | ||
1467 | + if not role:checkItemEnough(costs) then return 5 end | ||
1468 | + | ||
1469 | + -- 大于等于7的时候需要装备火花才能升 | ||
1470 | + if curLevel >= 7 then | ||
1471 | + if #sparkInfo == 0 then | ||
1472 | + return 6 | ||
1473 | + end | ||
1474 | + local ok = false | ||
1475 | + for _, info in ipairs(sparkInfo) do | ||
1476 | + local cfg = csvdb["sparkCsv"][info.cfg_id][info.level or 0] | ||
1477 | + if not cfg then return 7 end | ||
1478 | + if cfg.star == curLevel then | ||
1479 | + ok = true | ||
1480 | + break | ||
1481 | + end | ||
1482 | + end | ||
1483 | + if not ok then return 8 end | ||
1484 | + end | ||
1485 | + | ||
1486 | + if not role:costItems(costs, {log = {desc = "trainHero", int1 = hero:getProperty("type")}}) then return 9 end | ||
1487 | + | ||
1488 | + hero:updateProperty({field="trainTs", value = skynet.timex() + sec}) | ||
1489 | + | ||
1490 | + hero:mylog({desc = "trainHeroStart", int1 = hero:getProperty("type"), int2 = curLevel}) | ||
1491 | + | ||
1492 | + SendPacket(actionCodes.Hero_trainStartRpc, '') | ||
1493 | + | ||
1494 | + return true | ||
1495 | +end | ||
1496 | + | ||
1497 | +function _M.trainQuickRpc(agent, data) | ||
1498 | + local role = agent.role | ||
1499 | + local msg = MsgPack.unpack(data) | ||
1500 | + local hero = role.heros[msg.id] | ||
1501 | + if not hero then return 1 end | ||
1502 | + local trainTs = hero:getProperty("trainTs") | ||
1503 | + if trainTs == 0 then return 2 end | ||
1504 | + local timeNow = skynet.timex() | ||
1505 | + if timeNow >= trainTs then return 3 end | ||
1506 | + | ||
1507 | + local h = math.ceil((trainTs - timeNow)/3600) | ||
1508 | + | ||
1509 | + local cost = {[ItemId.Jade] = h * (globalCsv.training_camp_quick or 60)} | ||
1510 | + if not role:checkItemEnough(cost) then return 4 end | ||
1511 | + | ||
1512 | + if not role:costItems(cost, {log = {desc = "trainQuickHero", int1 = hero:getProperty("type")}}) then return 9 end | ||
1513 | + | ||
1514 | + hero:updateProperty({field="trainTs", value = skynet.timex()}) | ||
1515 | + | ||
1516 | + hero:mylog({desc = "trainQuick", int1 = hero:getProperty("type")}) | ||
1517 | + | ||
1518 | + SendPacket(actionCodes.Hero_trainQuickRpc, '') | ||
1519 | + | ||
1520 | + return true | ||
1521 | +end | ||
1522 | + | ||
1523 | + | ||
1524 | +function _M.trainFinishRpc(agent, data) | ||
1525 | + local role = agent.role | ||
1526 | + local msg = MsgPack.unpack(data) | ||
1527 | + local hero = role.heros[msg.id] | ||
1528 | + if not hero then return 1 end | ||
1529 | + | ||
1530 | + local curLevel = hero:getProperty("wakeL") | ||
1531 | + local trainTs = hero:getProperty("trainTs") | ||
1532 | + local typ = hero:getProperty("type") | ||
1533 | + if trainTs == 0 then return 2 end | ||
1534 | + if skynet.timex() < trainTs then return 3 end | ||
1535 | + | ||
1536 | + hero:updateProperty({field = "wakeL", delta = 1}) | ||
1537 | + hero:updateProperty({field = "trainTs", value = 0}) | ||
1538 | + | ||
1539 | + curLevel = curLevel + 1 | ||
1540 | + role:checkTaskEnter("Wake", {heroType = typ, wakeL = curLevel}) | ||
1541 | + if curLevel == 3 then -- 解锁cg | ||
1542 | + role:checkTaskEnter("WakeCG", {heroType = typ}) | ||
1543 | + role:checkTaskEnter("WakeCGSum", {count = 1}) | ||
1544 | + end | ||
1545 | + | ||
1546 | + if curLevel >= 4 then --自动觉醒技能 | ||
1547 | + local new = hero:increGeniusTree() | ||
1548 | + hero:updateProperty({field = "genius", value = new}) | ||
1549 | + end | ||
1550 | + hero:mylog({desc = "trainFinish", int1 = hero:getProperty("type")}) | ||
1551 | + | ||
1552 | + SendPacket(actionCodes.Hero_trainFinishRpc, '') | ||
1553 | + | ||
1554 | + role:checkTaskEnter("HeroStarCollect", {}) | ||
1555 | + role:checkTaskEnter("HeroStartSum", {}) | ||
1556 | + role:checkTaskEnter("SSRHeroStarSum", {}) | ||
1557 | + role:checkTaskEnter("SRHeroStarSum", {}) | ||
1558 | + | ||
1559 | + return true | ||
1560 | +end | ||
1561 | + | ||
1562 | +function _M.actCalendaTaskRpc(agent, data) | ||
1563 | + local role = agent.role | ||
1564 | + local msg = MsgPack.unpack(data) | ||
1565 | + local taskId = msg.id | ||
1566 | + local trainTask = role:getProperty("trainTask") or {} | ||
1567 | + local record = trainTask["r"] or {} | ||
1568 | + local flag = record[taskId] or 0 | ||
1569 | + if flag == 1 then return 1 end | ||
1570 | + local taskCfg = csvdb["training_camp_taskCsv"][taskId] | ||
1571 | + if not taskCfg then return 2 end | ||
1572 | + | ||
1573 | + if (trainTask[taskId] or 0) < taskCfg.condition1 then return 3 end | ||
1574 | + | ||
1575 | + record[taskId] = 1 | ||
1576 | + trainTask["r"] = record | ||
1577 | + | ||
1578 | + role:updateProperty({field = "trainTask", value = trainTask}) | ||
1579 | + | ||
1580 | + local reward, change = role:award(taskCfg.reward, {log = {desc = "trainTask"}}) | ||
1581 | + | ||
1582 | + SendPacket(actionCodes.Hero_trainTaskRewardRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1583 | + | ||
1584 | + return true | ||
1585 | +end | ||
1586 | + | ||
1438 | return _M | 1587 | return _M |
src/models/Hero.lua
@@ -19,6 +19,7 @@ Hero.schema = { | @@ -19,6 +19,7 @@ Hero.schema = { | ||
19 | faith = {"number", 0}, -- 信赖 | 19 | faith = {"number", 0}, -- 信赖 |
20 | spark = {"table", {}}, -- 火花属性 | 20 | spark = {"table", {}}, -- 火花属性 |
21 | genius = {"string", "" }, --天赋点 4=10201 5=10201 6=10203 7=10204 | 21 | genius = {"string", "" }, --天赋点 4=10201 5=10201 6=10203 7=10204 |
22 | + trainTs = {"number", 0}, -- 魔鬼训练营截止时间 0为未训练 | ||
22 | } | 23 | } |
23 | 24 | ||
24 | function Hero:ctor( properties ) | 25 | function Hero:ctor( properties ) |
@@ -113,6 +114,7 @@ function Hero:data() | @@ -113,6 +114,7 @@ function Hero:data() | ||
113 | faith = self:getProperty("faith"), | 114 | faith = self:getProperty("faith"), |
114 | spark = self:getProperty("spark"), | 115 | spark = self:getProperty("spark"), |
115 | genius = self:getProperty("genius"), | 116 | genius = self:getProperty("genius"), |
117 | + trainTs = self:getProperty("trainTs"), | ||
116 | } | 118 | } |
117 | end | 119 | end |
118 | 120 |
src/models/Role.lua
@@ -218,6 +218,7 @@ Role.schema = { | @@ -218,6 +218,7 @@ Role.schema = { | ||
218 | worldChangePoints = {"table", {}}, -- 世界变动积分 {[1]= 转盘抽取次数, [2]= 获得的积分, [3]=魔导石消耗, [4]= 虹光玉消耗} | 218 | worldChangePoints = {"table", {}}, -- 世界变动积分 {[1]= 转盘抽取次数, [2]= 获得的积分, [3]=魔导石消耗, [4]= 虹光玉消耗} |
219 | worldLineReward = {"table", {}}, -- 世界积分 领取记录 {[id] = 1} | 219 | worldLineReward = {"table", {}}, -- 世界积分 领取记录 {[id] = 1} |
220 | del = {"number", 0}, -- 标记删除 0=未删除,1=已删除 | 220 | del = {"number", 0}, -- 标记删除 0=未删除,1=已删除 |
221 | + trainTask = {"table", {}}, -- 训练营任务 | ||
221 | } | 222 | } |
222 | 223 | ||
223 | 224 | ||
@@ -463,6 +464,7 @@ function Role:data() | @@ -463,6 +464,7 @@ function Role:data() | ||
463 | bgId = self:getProperty("bgId"), | 464 | bgId = self:getProperty("bgId"), |
464 | worldChangePoints = self:getProperty("worldChangePoints"), | 465 | worldChangePoints = self:getProperty("worldChangePoints"), |
465 | worldLineReward = self:getProperty("worldLineReward"), | 466 | worldLineReward = self:getProperty("worldLineReward"), |
467 | + trainTask = self:getProperty("trainTask"), | ||
466 | } | 468 | } |
467 | end | 469 | end |
468 | 470 |
src/models/RoleLog.lua
@@ -74,6 +74,8 @@ local ItemReason = { | @@ -74,6 +74,8 @@ local ItemReason = { | ||
74 | regularWorldBossMilestone = 158, -- 常规世界boss伤害里程碑 | 74 | regularWorldBossMilestone = 158, -- 常规世界boss伤害里程碑 |
75 | regularWorldBossBattle = 159, -- 常规世界boss战斗奖励 | 75 | regularWorldBossBattle = 159, -- 常规世界boss战斗奖励 |
76 | itemConvertDevilTicket = 160, -- 兑换魔鬼训练营门票 | 76 | itemConvertDevilTicket = 160, -- 兑换魔鬼训练营门票 |
77 | + trainHero = 161, -- 魔鬼训练开始 | ||
78 | + trainQuickHero = 162, -- 魔鬼训练加速 | ||
77 | 79 | ||
78 | 80 | ||
79 | 81 |
src/models/RolePlugin.lua
@@ -185,6 +185,8 @@ function RolePlugin.bind(Role) | @@ -185,6 +185,8 @@ function RolePlugin.bind(Role) | ||
185 | itemType = itemCfg.type | 185 | itemType = itemCfg.type |
186 | end | 186 | end |
187 | self:checkTaskEnter("AddItem", {id = itemId, count = count, type = itemType}) | 187 | self:checkTaskEnter("AddItem", {id = itemId, count = count, type = itemType}) |
188 | + elseif count < 0 then | ||
189 | + self:checkTaskEnter("CostItem", {id = itemId, count = count}) | ||
188 | end | 190 | end |
189 | -- 对数量筛查 | 191 | -- 对数量筛查 |
190 | count = checkItemCount(self, itemId, count) | 192 | count = checkItemCount(self, itemId, count) |
@@ -647,6 +649,8 @@ function RolePlugin.bind(Role) | @@ -647,6 +649,8 @@ function RolePlugin.bind(Role) | ||
647 | self:checkTaskEnter("AddHero", {heroType = heroType, wakeL = newHero:getProperty("wakeL"), camp = unitData.camp, job = unitData.job, ssrCount = ssrCount}, params.notNotify) | 649 | self:checkTaskEnter("AddHero", {heroType = heroType, wakeL = newHero:getProperty("wakeL"), camp = unitData.camp, job = unitData.job, ssrCount = ssrCount}, params.notNotify) |
648 | self:checkTaskEnter("HeroQualityCollect", {}) | 650 | self:checkTaskEnter("HeroQualityCollect", {}) |
649 | self:checkTaskEnter("HeroStartSum", {}) | 651 | self:checkTaskEnter("HeroStartSum", {}) |
652 | + self:checkTaskEnter("SSRHeroStarSum", {}) | ||
653 | + self:checkTaskEnter("SRHeroStarSum", {}) | ||
650 | 654 | ||
651 | if not params.notNotify then | 655 | if not params.notNotify then |
652 | local heroResponse = {} | 656 | local heroResponse = {} |
src/models/RoleTask.lua
@@ -19,6 +19,8 @@ local TaskType = { | @@ -19,6 +19,8 @@ local TaskType = { | ||
19 | DrawHeroLimitPack = 14, -- 抽卡限时礼貌 -- count | 19 | DrawHeroLimitPack = 14, -- 抽卡限时礼貌 -- count |
20 | HeroStartSum = 15, -- 英雄星级总数 | 20 | HeroStartSum = 15, -- 英雄星级总数 |
21 | WakeCGSum = 16, -- 累计解锁xx张CG | 21 | WakeCGSum = 16, -- 累计解锁xx张CG |
22 | + SSRHeroStarSum = 17, -- SSR英雄星级总数 | ||
23 | + SRHeroStarSum = 18, -- SR英雄星级总数 | ||
22 | 24 | ||
23 | 25 | ||
24 | --装备相关 | 26 | --装备相关 |
@@ -117,6 +119,7 @@ local TaskType = { | @@ -117,6 +119,7 @@ local TaskType = { | ||
117 | Rename = 913, -- 重命名 | 119 | Rename = 913, -- 重命名 |
118 | CostJade = 914, -- 消耗虹光玉 | 120 | CostJade = 914, -- 消耗虹光玉 |
119 | BuyLimitPack = 915, -- 购买指定id礼包触发 | 121 | BuyLimitPack = 915, -- 购买指定id礼包触发 |
122 | + CostItem = 916, -- 消耗道具 | ||
120 | 123 | ||
121 | --功能未实现 todo | 124 | --功能未实现 todo |
122 | AdvShop = 1002, -- 冒险商城 | 125 | AdvShop = 1002, -- 冒险商城 |
@@ -351,6 +354,16 @@ local ReturnerTask = { | @@ -351,6 +354,16 @@ local ReturnerTask = { | ||
351 | listen = CalendaTaskListener["listen"] | 354 | listen = CalendaTaskListener["listen"] |
352 | } | 355 | } |
353 | 356 | ||
357 | +local TraningCampTask = { | ||
358 | + func = "checkTraingCampTask", | ||
359 | + listen = { | ||
360 | + [TaskType.HangPass]= {{1, 3}}, | ||
361 | + [TaskType.SSRHeroStarSum] = {{2, 3}}, | ||
362 | + [TaskType.SRHeroStarSum] = {{3, 3}}, | ||
363 | + [TaskType.CostItem] = {{4, 3, f("id"), f("count")}}, | ||
364 | + } | ||
365 | +} | ||
366 | + | ||
354 | local TaskListeners = { | 367 | local TaskListeners = { |
355 | StoryListener, | 368 | StoryListener, |
356 | CommonListener, | 369 | CommonListener, |
@@ -362,6 +375,7 @@ local TaskListeners = { | @@ -362,6 +375,7 @@ local TaskListeners = { | ||
362 | BattleCommandTaskListener, | 375 | BattleCommandTaskListener, |
363 | ReturnerTask, | 376 | ReturnerTask, |
364 | NewUserTaskListener, | 377 | NewUserTaskListener, |
378 | + TraningCampTask, | ||
365 | } | 379 | } |
366 | 380 | ||
367 | local RoleTask = {} | 381 | local RoleTask = {} |
@@ -900,6 +914,54 @@ function RoleTask.bind(Role) | @@ -900,6 +914,54 @@ function RoleTask.bind(Role) | ||
900 | self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) | 914 | self:checkActTask(notNotify, keyName, actData, mainType, subType, param1, param2) |
901 | end | 915 | end |
902 | 916 | ||
917 | + function Role:checkTraingCampTask(notNotify, mainType, subType, param1, param2) | ||
918 | + local trainTask = self:getProperty("trainTask") or {} | ||
919 | + param1 = param1 or 1 | ||
920 | + | ||
921 | + for id, cfg in pairs(csvdb["training_camp_taskCsv"]) do | ||
922 | + if cfg.type == mainType then | ||
923 | + if subType == 1 then -- 增加数值 | ||
924 | + trainTask[id] = (trainTask[id] or 0) + param1 | ||
925 | + elseif subType == 2 then -- 直接赋值 | ||
926 | + trainTask[id] = param1 | ||
927 | + elseif subType == 3 then -- 自定义类型 | ||
928 | + if cfg.type == 1 then -- 通关关卡 | ||
929 | + if (trainTask[id] or 0) == 0 then | ||
930 | + if self:checkHangPass(cfg.condition2) then | ||
931 | + trainTask[id] = 1 | ||
932 | + end | ||
933 | + end | ||
934 | + elseif cfg.type == 2 then --玩家拥有SR拾荒者总星级达到xxx | ||
935 | + local count = 0 | ||
936 | + for _, hero in pairs(self.heros) do | ||
937 | + if hero:getRare() == HeroQuality.SR then | ||
938 | + count = count + hero:getProperty("wakeL") | ||
939 | + end | ||
940 | + end | ||
941 | + if (trainTask[id] or 0) < count then | ||
942 | + trainTask[id] = count | ||
943 | + end | ||
944 | + elseif cfg.type == 3 then --玩家拥有SR拾荒者总星级达到xxx | ||
945 | + local count = 0 | ||
946 | + for _, hero in pairs(self.heros) do | ||
947 | + if hero:getRare() == HeroQuality.SSR then | ||
948 | + count = count + hero:getProperty("wakeL") | ||
949 | + end | ||
950 | + end | ||
951 | + if (trainTask[id] or 0) < count then | ||
952 | + trainTask[id] = count | ||
953 | + end | ||
954 | + elseif cfg.type == 4 then -- 消耗指定id道具多少个 | ||
955 | + if cfg.condition2 == param1 then | ||
956 | + trainTask[id] = (trainTask[id] or 0) + (param2 or 0) | ||
957 | + end | ||
958 | + end | ||
959 | + end | ||
960 | + end | ||
961 | + end | ||
962 | + self:updateProperty({field = "trainTask", value = trainTask, notNotify = notNotify}) | ||
963 | + end | ||
964 | + | ||
903 | end | 965 | end |
904 | 966 | ||
905 | return RoleTask | 967 | return RoleTask |