Commit edbc96d25f7a5a89f717a8d9526fa431891d9267
Merge branch 'tr/bugfix' into cn/develop
Showing
18 changed files
with
343 additions
and
52 deletions
Show diff stats
src/GlobalVar.lua
@@ -375,7 +375,20 @@ DrawCardType = { | @@ -375,7 +375,20 @@ DrawCardType = { | ||
375 | TeamSystemType = { | 375 | TeamSystemType = { |
376 | Hang = 1, | 376 | Hang = 1, |
377 | BonusBattle = 2, | 377 | BonusBattle = 2, |
378 | - Tower = 3, | ||
379 | Dinner = 4, | 378 | Dinner = 4, |
380 | FriendBattle = 5, | 379 | FriendBattle = 5, |
381 | -} | ||
382 | \ No newline at end of file | 380 | \ No newline at end of file |
381 | +} | ||
382 | + | ||
383 | +-- 某个功能对其他系统功能的加成类型 | ||
384 | +SystemBnousType = { | ||
385 | + TowerBuff = 1, -- 电波塔内战斗开始时获得buff | ||
386 | + CrusadeTask = 2, -- 讨伐电台任务加速 | ||
387 | + DinerGet = 3, -- 食材供应商获取速度 | ||
388 | + DinerLimit = 4, -- 食材供应商上限 | ||
389 | + DinerSell = 5, -- 料理贩卖速度 | ||
390 | + DinerPrice = 6, -- 齿轮价格 | ||
391 | + Adv = 7, -- 代理拾荒获得额外道具 | ||
392 | + HangTime = 8, -- 挂机时间上限 | ||
393 | + PvpTicket = 9, -- 每周额外获得竞技场门票数量 | ||
394 | + SweepReward = 10, -- 奖励关卡每次扫荡额外获得道具 | ||
395 | +} |
src/ProtocolCode.lua
@@ -145,6 +145,7 @@ actionCodes = { | @@ -145,6 +145,7 @@ actionCodes = { | ||
145 | Tower_rankRpc = 353, | 145 | Tower_rankRpc = 353, |
146 | Tower_bugCountRpc = 354, | 146 | Tower_bugCountRpc = 354, |
147 | Tower_rankInfoRpc = 355, | 147 | Tower_rankInfoRpc = 355, |
148 | + Tower_activeTowerBonusRpc = 356, | ||
148 | 149 | ||
149 | Car_makePotionRpc = 400, | 150 | Car_makePotionRpc = 400, |
150 | Car_equipUpRpc = 401, | 151 | Car_equipUpRpc = 401, |
src/RedisKeys.lua
@@ -26,6 +26,15 @@ RANK_TYPE = { | @@ -26,6 +26,15 @@ RANK_TYPE = { | ||
26 | RANK_TOWER = "rank:tower" | 26 | RANK_TOWER = "rank:tower" |
27 | RANK_TOWER_INFO = "rank:tower:info" | 27 | RANK_TOWER_INFO = "rank:tower:info" |
28 | 28 | ||
29 | +RANK_TOWER1 = "rank:tower1" | ||
30 | +RANK_TOWER1_INFO = "rank:tower1:info" | ||
31 | + | ||
32 | +RANK_TOWER2 = "rank:tower2" | ||
33 | +RANK_TOWER2_INFO = "rank:tower2:info" | ||
34 | + | ||
35 | +RANK_TOWER3 = "rank:tower3" | ||
36 | +RANK_TOWER3_INFO = "rank:tower3:info" | ||
37 | + | ||
29 | -- adv | 38 | -- adv |
30 | RANK_ADV = {"rank:adv1", "rank:adv2"} | 39 | RANK_ADV = {"rank:adv1", "rank:adv2"} |
31 | RANK_ADV_INFO = "rank:adv:info" | 40 | RANK_ADV_INFO = "rank:adv:info" |
src/actions/AdvAction.lua
@@ -278,6 +278,7 @@ function _M.startHangRpc(agent, data) | @@ -278,6 +278,7 @@ function _M.startHangRpc(agent, data) | ||
278 | end | 278 | end |
279 | adv_idle_time = adv_idle_time * 60 | 279 | adv_idle_time = adv_idle_time * 60 |
280 | 280 | ||
281 | + | ||
281 | local advHang = role:getProperty("advHang") | 282 | local advHang = role:getProperty("advHang") |
282 | if advHang[chapterId] then return 3 end --正在挂机 | 283 | if advHang[chapterId] then return 3 end --正在挂机 |
283 | 284 | ||
@@ -463,6 +464,15 @@ function _M.endHangRpc(agent, data) | @@ -463,6 +464,15 @@ function _M.endHangRpc(agent, data) | ||
463 | for itemId, count in pairs(idleReward) do | 464 | for itemId, count in pairs(idleReward) do |
464 | idleReward[itemId] = count * adv_idle_reward_coef | 465 | idleReward[itemId] = count * adv_idle_reward_coef |
465 | end | 466 | end |
467 | + | ||
468 | + local bnousReward = role:getBnousAdv() | ||
469 | + for time, set in pairs(bnousReward) do | ||
470 | + local delta = math.floor(adv_idle_time / time) | ||
471 | + for key, value in pairs(set) do | ||
472 | + idleReward[key] = (idleReward[key] or 0) + value * delta | ||
473 | + end | ||
474 | + end | ||
475 | + | ||
466 | reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) | 476 | reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) |
467 | else | 477 | else |
468 | if cancel then | 478 | if cancel then |
src/actions/DinerAction.lua
@@ -75,7 +75,8 @@ function _M.addSellRpc( agent, data ) | @@ -75,7 +75,8 @@ function _M.addSellRpc( agent, data ) | ||
75 | sells[slot].count = count | 75 | sells[slot].count = count |
76 | sells[slot].time = skynet.timex() - calSell.deltaTime | 76 | sells[slot].time = skynet.timex() - calSell.deltaTime |
77 | 77 | ||
78 | - local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex() | 78 | + local timeSub = role:getBnousDiner(3,dishData.sell_time) |
79 | + local needTime = sells[slot].count * (dishData.sell_time + timeSub) + sells[slot].time - skynet.timex() | ||
79 | role:pushMsg({type = "food", slot = slot, time = needTime}) | 80 | role:pushMsg({type = "food", slot = slot, time = needTime}) |
80 | 81 | ||
81 | -- 检查解锁的顾客 | 82 | -- 检查解锁的顾客 |
@@ -742,11 +743,15 @@ function _M.getGreenhouseRpc( agent, data ) | @@ -742,11 +743,15 @@ function _M.getGreenhouseRpc( agent, data ) | ||
742 | local now = skynet.timex() | 743 | local now = skynet.timex() |
743 | local gfood = role.dinerData:getProperty("gfood") | 744 | local gfood = role.dinerData:getProperty("gfood") |
744 | if not next(gfood) then return end | 745 | if not next(gfood) then return end |
746 | + | ||
747 | + local timeAdd = role:getBnousDiner(2,globalCsv.diner_get_food_time_max) | ||
748 | + | ||
745 | for k , v in pairs(gfood) do | 749 | for k , v in pairs(gfood) do |
746 | local itemId = v.id | 750 | local itemId = v.id |
747 | local st = v.st | 751 | local st = v.st |
748 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 | 752 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 |
749 | - local endTime = st + globalCsv.diner_get_food_time_max | 753 | + speed = speed + role:getBnousDiner(1,speed) |
754 | + local endTime = st + globalCsv.diner_get_food_time_max + timeAdd | ||
750 | local endTime2 = math.min(now, endTime) | 755 | local endTime2 = math.min(now, endTime) |
751 | reward[itemId] = math.floor((endTime2 - st) / speed) | 756 | reward[itemId] = math.floor((endTime2 - st) / speed) |
752 | if endTime2 == endTime then | 757 | if endTime2 == endTime then |
src/actions/GmAction.lua
@@ -483,13 +483,25 @@ function _M.advit(role, pms) | @@ -483,13 +483,25 @@ function _M.advit(role, pms) | ||
483 | end | 483 | end |
484 | 484 | ||
485 | 485 | ||
486 | -table.insert(helpDes, {"爬塔到指定层", "tower", "层数"}) | 486 | +table.insert(helpDes, {"爬塔到指定层", "tower", "塔id", "层数"}) |
487 | function _M.tower(role, pms) | 487 | function _M.tower(role, pms) |
488 | - local level = tonum(pms.pm1, 1) | 488 | + local tType = tonum(pms.pm1, 1) |
489 | + local level = tonum(pms.pm2, 1) | ||
490 | + local layer = (tType - 1) * 10000 + level | ||
489 | if not csvdb["tower_battleCsv"][level] then return "不存在" end | 491 | if not csvdb["tower_battleCsv"][level] then return "不存在" end |
490 | - role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}}) | ||
491 | - | ||
492 | - role:mylog("gm_action", {desc = "tower", int1 = level, key1 = pms.sender}) | 492 | + local values = role:getProperty("towerInfo") |
493 | + if tType == 1 then | ||
494 | + values.l = layer | ||
495 | + elseif tType == 2 then | ||
496 | + values.l1 = layer | ||
497 | + elseif tType == 3 then | ||
498 | + values.l2 = layer | ||
499 | + elseif tType == 4 then | ||
500 | + values.l3 = layer | ||
501 | + end | ||
502 | + role:updateProperty({field = "towerInfo", value = values}) | ||
503 | + | ||
504 | + role:mylog("gm_action", {desc = "tower", int1 = tType, int2 = layer, key1 = pms.sender}) | ||
493 | 505 | ||
494 | return "成功" | 506 | return "成功" |
495 | end | 507 | end |
src/actions/HangAction.lua
@@ -326,6 +326,7 @@ function _M.roleFormatRpc(agent , data) | @@ -326,6 +326,7 @@ function _M.roleFormatRpc(agent , data) | ||
326 | local index = msg.index -- 阵容索引 | 326 | local index = msg.index -- 阵容索引 |
327 | local title = msg.title -- 阵容名称 | 327 | local title = msg.title -- 阵容名称 |
328 | local tactics = msg.tactics -- 战术 | 328 | local tactics = msg.tactics -- 战术 |
329 | + local tower = msg.tower | ||
329 | local team = {} | 330 | local team = {} |
330 | for slot, heroId in pairs(msg.heros) do | 331 | for slot, heroId in pairs(msg.heros) do |
331 | if not role.heros[heroId] then | 332 | if not role.heros[heroId] then |
@@ -361,7 +362,11 @@ function _M.roleFormatRpc(agent , data) | @@ -361,7 +362,11 @@ function _M.roleFormatRpc(agent , data) | ||
361 | team.tactics = msg.tactics | 362 | team.tactics = msg.tactics |
362 | end | 363 | end |
363 | 364 | ||
364 | - role:setTeamFormat(index, team) | 365 | + if tower then |
366 | + role:setTowerTeamFormat(index, team) | ||
367 | + else | ||
368 | + role:setTeamFormat(index, team) | ||
369 | + end | ||
365 | 370 | ||
366 | SendPacket(actionCodes.Hang_roleFormatRpc, '') | 371 | SendPacket(actionCodes.Hang_roleFormatRpc, '') |
367 | return true | 372 | return true |
@@ -376,8 +381,9 @@ function _M.getRewardRpc(agent , data) | @@ -376,8 +381,9 @@ function _M.getRewardRpc(agent , data) | ||
376 | table.clear(items) | 381 | table.clear(items) |
377 | local hangInfo = role:getProperty("hangInfo") | 382 | local hangInfo = role:getProperty("hangInfo") |
378 | local nowTime = skynet.timex() | 383 | local nowTime = skynet.timex() |
379 | - hangInfo.endItemTime = nowTime + globalCsv.idle_producetime_max | ||
380 | - hangInfo.endCoinTime = nowTime + globalCsv.idle_producetime_max | 384 | + local timeAdd = role:getBnousHangTime() |
385 | + hangInfo.endItemTime = nowTime + globalCsv.idle_producetime_max + timeAdd | ||
386 | + hangInfo.endCoinTime = nowTime + globalCsv.idle_producetime_max + timeAdd | ||
381 | hangInfo.coinTime = nowTime | 387 | hangInfo.coinTime = nowTime |
382 | hangInfo.itemTime = nowTime | 388 | hangInfo.itemTime = nowTime |
383 | role:updateProperty({field = "hangBag", value = items}) | 389 | role:updateProperty({field = "hangBag", value = items}) |
@@ -508,7 +514,7 @@ function _M.buyBonusCountRpc(agent, data) | @@ -508,7 +514,7 @@ function _M.buyBonusCountRpc(agent, data) | ||
508 | return true | 514 | return true |
509 | end | 515 | end |
510 | 516 | ||
511 | -local function bonusWinReward(role, bonusData, rewardType, count) | 517 | +local function bonusWinReward(role, bonusData, rewardType, count, sweep) |
512 | count = count or 1 | 518 | count = count or 1 |
513 | 519 | ||
514 | local reward, change = {} | 520 | local reward, change = {} |
@@ -548,6 +554,13 @@ local function bonusWinReward(role, bonusData, rewardType, count) | @@ -548,6 +554,13 @@ local function bonusWinReward(role, bonusData, rewardType, count) | ||
548 | end | 554 | end |
549 | end | 555 | end |
550 | 556 | ||
557 | + if sweep then | ||
558 | + local bnousReward = role:getBnousSweep() | ||
559 | + for key, value in pairs(bnousReward) do | ||
560 | + reward[key] = (reward[key] or 0) + value * count | ||
561 | + end | ||
562 | + end | ||
563 | + | ||
551 | reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = bonusData.id}}) | 564 | reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = bonusData.id}}) |
552 | role:checkTaskEnter("BonusPass", {id = bonusData.id, count = count}) | 565 | role:checkTaskEnter("BonusPass", {id = bonusData.id, count = count}) |
553 | return reward, change | 566 | return reward, change |
@@ -589,7 +602,7 @@ function _M.startBonusBattleRpc(agent, data) | @@ -589,7 +602,7 @@ function _M.startBonusBattleRpc(agent, data) | ||
589 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count | 602 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count |
590 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 603 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
591 | 604 | ||
592 | - local reward, change = bonusWinReward(role, bonusData, 3, count) | 605 | + local reward, change = bonusWinReward(role, bonusData, 3, count, true) |
593 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) | 606 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) |
594 | 607 | ||
595 | role:checkTaskEnter("BonusQuick", {count = count}) | 608 | role:checkTaskEnter("BonusQuick", {count = count}) |
src/actions/RadioAction.lua
@@ -95,8 +95,9 @@ function _M.startQuestRpc(agent, data) | @@ -95,8 +95,9 @@ function _M.startQuestRpc(agent, data) | ||
95 | return 5 | 95 | return 5 |
96 | end | 96 | end |
97 | -- start quest, set finish time | 97 | -- start quest, set finish time |
98 | + local timeSub = role:getBnousCrusade(config.time) | ||
98 | local taskData = {} | 99 | local taskData = {} |
99 | - taskData["time"] = skynet.timex() + config.time | 100 | + taskData["time"] = skynet.timex() + config.time + timeSub |
100 | taskData["heros"] = heros | 101 | taskData["heros"] = heros |
101 | radioTask[id] = taskData | 102 | radioTask[id] = taskData |
102 | role:updateProperty({field="radioTask", value=radioTask, notNotify=true}) | 103 | role:updateProperty({field="radioTask", value=radioTask, notNotify=true}) |
src/actions/RoleAction.lua
@@ -745,6 +745,7 @@ function _M.openSpeedUpBoxRpc(agent, data) | @@ -745,6 +745,7 @@ function _M.openSpeedUpBoxRpc(agent, data) | ||
745 | for k , v in pairs(gfood) do | 745 | for k , v in pairs(gfood) do |
746 | local itemId = v.id | 746 | local itemId = v.id |
747 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 | 747 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 |
748 | + speed = speed + role:getBnousDiner(1,speed) | ||
748 | reward[itemId] = (reward[itemId] or 0) + math.floor((time / speed) * count) | 749 | reward[itemId] = (reward[itemId] or 0) + math.floor((time / speed) * count) |
749 | end | 750 | end |
750 | else | 751 | else |
src/actions/TowerAction.lua
@@ -23,14 +23,32 @@ function _M.startBattleRpc(agent, data) | @@ -23,14 +23,32 @@ function _M.startBattleRpc(agent, data) | ||
23 | local role = agent.role | 23 | local role = agent.role |
24 | local msg = MsgPack.unpack(data) | 24 | local msg = MsgPack.unpack(data) |
25 | local id = msg.id | 25 | local id = msg.id |
26 | - | ||
27 | - if not role:isFuncUnlock(FuncUnlock.Tower) then return end | 26 | + local towerType = math.floor(id / 10000) |
27 | + | ||
28 | + if not id or towerType < 0 or towerType > 3 then return 0 end | ||
29 | + if not role:isFuncUnlock(FuncUnlock.Tower) then return 1 end | ||
28 | 30 | ||
29 | local towerInfo = role:getProperty("towerInfo") | 31 | local towerInfo = role:getProperty("towerInfo") |
30 | 32 | ||
31 | - if towerInfo.l ~= id then return end -- 层数不对 | 33 | + if towerType == 0 and (towerInfo.l or 1) ~= id then return 2 end -- 层数不对 |
34 | + if towerType == 1 and ((towerInfo.l1 or 10001) ~= id or (towerInfo.l or 1) <= globalCsv.tower_open[towerType]) then return 2 end -- 层数不对 | ||
35 | + if towerType == 2 and ((towerInfo.l2 or 20001) ~= id or (towerInfo.l or 1) <= globalCsv.tower_open[towerType]) then return 2 end -- 层数不对 | ||
36 | + if towerType == 3 and ((towerInfo.l3 or 30001) ~= id or (towerInfo.l or 1) <= globalCsv.tower_open[towerType]) then return 2 end -- 层数不对 | ||
37 | + | ||
38 | + if not csvdb["tower_battleCsv"][id] then return 4 end | ||
39 | + | ||
40 | + local teams = role:getTowerTeamFormat(towerType + 1) | ||
41 | + if not next(teams) then return 5 end | ||
42 | + | ||
43 | + if towerType ~= 0 then | ||
44 | + for _, heroId in pairs(teams.heros) do | ||
45 | + local hero = role.heros[heroId] | ||
46 | + if not hero then return 6 end | ||
47 | + local unit = csvdb["unitCsv"][hero:getProperty("type")] | ||
48 | + if unit.camp ~= towerType then return 7 end | ||
49 | + end | ||
50 | + end | ||
32 | 51 | ||
33 | - if not csvdb["tower_battleCsv"][id] then return end | ||
34 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) | 52 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) |
35 | --if curCount < 1 then return end -- 没有次数返回 | 53 | --if curCount < 1 then return end -- 没有次数返回 |
36 | 54 | ||
@@ -57,18 +75,24 @@ function _M.endBattleRpc(agent, data) | @@ -57,18 +75,24 @@ function _M.endBattleRpc(agent, data) | ||
57 | local key = msg.key | 75 | local key = msg.key |
58 | local passTime = msg.passTime | 76 | local passTime = msg.passTime |
59 | 77 | ||
78 | + local curTower = csvdb["tower_battleCsv"][id] | ||
79 | + if not curTower then return 2 end | ||
80 | + | ||
60 | local towerInfo = role:getProperty("towerInfo") | 81 | local towerInfo = role:getProperty("towerInfo") |
61 | - if towerInfo.l ~= id or not towerInfo.k or towerInfo.k ~= key then | 82 | + local towerType = math.floor(id / 10000) |
83 | + local towerLevel = {[0] = (towerInfo.l or 1), [1] = (towerInfo.l1 or 10001), [2] = (towerInfo.l2 or 20001), [3] = (towerInfo.l3 or 30001)} | ||
84 | + local curLevel = towerLevel[towerType] | ||
85 | + | ||
86 | + if curLevel ~= id or not towerInfo.k or towerInfo.k ~= key then | ||
62 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) | 87 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) |
63 | return true | 88 | return true |
64 | end | 89 | end |
65 | - local curTower = csvdb["tower_battleCsv"][id] | ||
66 | - if not curTower then return 2 end | ||
67 | 90 | ||
68 | -- 防作弊 | 91 | -- 防作弊 |
69 | if not role:checkBattleCheat("tower", { | 92 | if not role:checkBattleCheat("tower", { |
70 | isWin = msg.starNum and msg.starNum > 0, | 93 | isWin = msg.starNum and msg.starNum > 0, |
71 | - info = msg.info | 94 | + info = msg.info, |
95 | + tower = towerType + 1 | ||
72 | }) then | 96 | }) then |
73 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) | 97 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) |
74 | return true | 98 | return true |
@@ -81,11 +105,21 @@ function _M.endBattleRpc(agent, data) | @@ -81,11 +105,21 @@ function _M.endBattleRpc(agent, data) | ||
81 | if msg.starNum and msg.starNum > 0 then --win | 105 | if msg.starNum and msg.starNum > 0 then --win |
82 | curCount = math.min(curCount + 1, globalCsv.tower_count_limit) -- 返还次数 | 106 | curCount = math.min(curCount + 1, globalCsv.tower_count_limit) -- 返还次数 |
83 | --排行榜 | 107 | --排行榜 |
84 | - role:setTowerRank(towerInfo.l) | 108 | + role:setTowerRank(curLevel % 10000, towerType + 1) |
85 | 109 | ||
86 | - towerInfo.l = towerInfo.l + 1 | 110 | + curLevel = curLevel + 1 |
87 | reward, change = role:award(curTower.reward, {log = {desc = "towerBattle", int1 = id}}) | 111 | reward, change = role:award(curTower.reward, {log = {desc = "towerBattle", int1 = id}}) |
88 | - role:checkTaskEnter("TowerPass", {level = towerInfo.l - 1}) | 112 | + role:checkTaskEnter("TowerPass", {count = 1, type = towerType + 1}) |
113 | + end | ||
114 | + | ||
115 | + if towerType == 0 then | ||
116 | + towerInfo.l = curLevel | ||
117 | + elseif towerType == 1 then | ||
118 | + towerInfo.l1 = curLevel | ||
119 | + elseif towerType == 2 then | ||
120 | + towerInfo.l2 = curLevel | ||
121 | + elseif towerType == 3 then | ||
122 | + towerInfo.l3 = curLevel | ||
89 | end | 123 | end |
90 | 124 | ||
91 | towerInfo.c = curCount | 125 | towerInfo.c = curCount |
@@ -93,8 +127,9 @@ function _M.endBattleRpc(agent, data) | @@ -93,8 +127,9 @@ function _M.endBattleRpc(agent, data) | ||
93 | towerInfo.k = nil | 127 | towerInfo.k = nil |
94 | role:updateProperty({field = "towerInfo", value = towerInfo}) | 128 | role:updateProperty({field = "towerInfo", value = towerInfo}) |
95 | 129 | ||
96 | - | ||
97 | - local rank = redisproxy:ZREVRANK(RANK_TOWER, role:getProperty("id")) | 130 | + local RankTower = {[0] = RANK_TOWER,[1] = RANK_TOWER1,[2] = RANK_TOWER2,[3] = RANK_TOWER3} |
131 | + local rankName = RankTower[towerType] | ||
132 | + local rank = redisproxy:ZREVRANK(rankName, role:getProperty("id")) | ||
98 | if not rank then | 133 | if not rank then |
99 | rank = -1 | 134 | rank = -1 |
100 | else | 135 | else |
@@ -106,6 +141,7 @@ function _M.endBattleRpc(agent, data) | @@ -106,6 +141,7 @@ function _M.endBattleRpc(agent, data) | ||
106 | info = msg.info, | 141 | info = msg.info, |
107 | reward = reward, | 142 | reward = reward, |
108 | rank = rank, | 143 | rank = rank, |
144 | + tower = towerType + 1 | ||
109 | }) | 145 | }) |
110 | role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) | 146 | role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) |
111 | 147 | ||
@@ -143,7 +179,9 @@ end | @@ -143,7 +179,9 @@ end | ||
143 | 179 | ||
144 | function _M.rankRpc(agent , data) | 180 | function _M.rankRpc(agent , data) |
145 | local role = agent.role | 181 | local role = agent.role |
146 | - SendPacket(actionCodes.Tower_rankRpc, MsgPack.pack(role:getTowerRank())) | 182 | + local msg = MsgPack.unpack(data) |
183 | + local towerType = msg.tower or 1 | ||
184 | + SendPacket(actionCodes.Tower_rankRpc, MsgPack.pack(role:getTowerRank(towerType))) | ||
147 | return true | 185 | return true |
148 | end | 186 | end |
149 | 187 | ||
@@ -151,7 +189,43 @@ function _M.rankInfoRpc(agent , data) | @@ -151,7 +189,43 @@ function _M.rankInfoRpc(agent , data) | ||
151 | local role = agent.role | 189 | local role = agent.role |
152 | local msg = MsgPack.unpack(data) | 190 | local msg = MsgPack.unpack(data) |
153 | local roleId = msg.roleId | 191 | local roleId = msg.roleId |
154 | - SendPacket(actionCodes.Tower_rankInfoRpc, MsgPack.pack({format = role:getTowerRankOneInfo(roleId)})) | 192 | + local towerType = msg.tower or 1 |
193 | + SendPacket(actionCodes.Tower_rankInfoRpc, MsgPack.pack({format = role:getTowerRankOneInfo(roleId, towerType)})) | ||
194 | + return true | ||
195 | +end | ||
196 | + | ||
197 | +function _M.activeTowerBonusRpc(agent, data) | ||
198 | + local role = agent.role | ||
199 | + local msg = MsgPack.unpack(data) | ||
200 | + local tType = msg.tower | ||
201 | + local id = msg.id | ||
202 | + | ||
203 | + local bnousCsv = csvdb["tower_battle_additionCsv"] | ||
204 | + | ||
205 | + if not tType or not id or not bnousCsv[tType] then return 0 end | ||
206 | + local bnousData = bnousCsv[tType][id] | ||
207 | + if not bnousData then return 1 end | ||
208 | + | ||
209 | + local towerInfo = role:getProperty("towerInfo") | ||
210 | + local towerBnous = role:getProperty("towerBnous") | ||
211 | + | ||
212 | + if towerBnous[tType] and towerBnous[tType][id] then return 2 end | ||
213 | + local towerLevel = {[1] = (towerInfo.l or 1), [2] = (towerInfo.l1 or 10001), [3] = (towerInfo.l2 or 20001), [4] = (towerInfo.l3 or 30001)} | ||
214 | + local curLevel = towerLevel[tType] | ||
215 | + | ||
216 | + if tType ~= 1 then | ||
217 | + if curLevel <= globalCsv.tower_open[tType - 1] then return 4 end | ||
218 | + end | ||
219 | + | ||
220 | + if (curLevel % 10000) <= bnousData.floor then return 3 end | ||
221 | + | ||
222 | + if not towerBnous[tType] then | ||
223 | + towerBnous[tType] = {} | ||
224 | + end | ||
225 | + towerBnous[tType][id] = 1 | ||
226 | + role:updateProperty({field = "towerBnous", value = towerBnous}) | ||
227 | + role:getTowerBnousActive(true) | ||
228 | + SendPacket(actionCodes.Tower_activeTowerBonusRpc, '') | ||
155 | return true | 229 | return true |
156 | end | 230 | end |
157 | 231 |
src/models/Activity.lua
@@ -489,7 +489,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | @@ -489,7 +489,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | ||
489 | role:checkTaskEnter("RoleLevelUp", {level = rLevel}) | 489 | role:checkTaskEnter("RoleLevelUp", {level = rLevel}) |
490 | 490 | ||
491 | local towerInfo = role:getProperty("towerInfo") | 491 | local towerInfo = role:getProperty("towerInfo") |
492 | - role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | 492 | + role:checkTaskEnter("TowerPass", {count = towerInfo.l, type = 1}) |
493 | --"PvpWin" | 493 | --"PvpWin" |
494 | --role:checkTaskEnter("HangPass", {id = 0}) | 494 | --role:checkTaskEnter("HangPass", {id = 0}) |
495 | role:checkCalendaTask(true, 15, 3) | 495 | role:checkCalendaTask(true, 15, 3) |
@@ -557,7 +557,7 @@ activityFunc[Activity.ActivityType.BattleCommandTask] = { | @@ -557,7 +557,7 @@ activityFunc[Activity.ActivityType.BattleCommandTask] = { | ||
557 | role:checkTaskEnter("RoleLevelUp", {level = rLevel}) | 557 | role:checkTaskEnter("RoleLevelUp", {level = rLevel}) |
558 | 558 | ||
559 | local towerInfo = role:getProperty("towerInfo") | 559 | local towerInfo = role:getProperty("towerInfo") |
560 | - role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | 560 | + role:checkTaskEnter("TowerPass", {count = towerInfo.l, type = 1}) |
561 | --"PvpWin" | 561 | --"PvpWin" |
562 | --role:checkTaskEnter("HangPass", {id = 0}) | 562 | --role:checkTaskEnter("HangPass", {id = 0}) |
563 | role:checkCalendaTask(true, 15, 3) | 563 | role:checkCalendaTask(true, 15, 3) |
src/models/Diner.lua
@@ -179,8 +179,13 @@ function Diner:checkDinerTask(typ, count, param1, param2, notNotify) | @@ -179,8 +179,13 @@ function Diner:checkDinerTask(typ, count, param1, param2, notNotify) | ||
179 | return dirty | 179 | return dirty |
180 | end | 180 | end |
181 | 181 | ||
182 | -function Diner:calSellReward(sell, delta, dishData) | 182 | +function Diner:calSellReward(sell, delta, dishData, isExpedite) |
183 | local reward = sell.reward or "" | 183 | local reward = sell.reward or "" |
184 | + | ||
185 | + if isExpedite then | ||
186 | + reward = "" | ||
187 | + end | ||
188 | + | ||
184 | local popular = 0 | 189 | local popular = 0 |
185 | if delta <= 0 then | 190 | if delta <= 0 then |
186 | return reward, popular | 191 | return reward, popular |
@@ -225,10 +230,16 @@ function Diner:calSellReward(sell, delta, dishData) | @@ -225,10 +230,16 @@ function Diner:calSellReward(sell, delta, dishData) | ||
225 | end | 230 | end |
226 | upValue[-1] = (upValue[-1] or 0) + collectAdd | 231 | upValue[-1] = (upValue[-1] or 0) + collectAdd |
227 | 232 | ||
233 | + -- 电波塔加成 | ||
234 | + local goldCount = self.owner:getBnousDiner(4,addReward[ItemId.Gold]) | ||
235 | + | ||
228 | for id, count in pairs(addReward) do | 236 | for id, count in pairs(addReward) do |
229 | addReward[id] = math.floor(count * (1 + (upValue[id] or 0) / 100)) | 237 | addReward[id] = math.floor(count * (1 + (upValue[id] or 0) / 100)) |
230 | reward = reward:incrv(id, addReward[id]) | 238 | reward = reward:incrv(id, addReward[id]) |
231 | end | 239 | end |
240 | + | ||
241 | + reward = reward:incrv(ItemId.Gold, goldCount) | ||
242 | + | ||
232 | popular = math.floor(popular * (1 + (upValue[-1] or 0) / 100)) | 243 | popular = math.floor(popular * (1 + (upValue[-1] or 0) / 100)) |
233 | 244 | ||
234 | return reward, popular | 245 | return reward, popular |
@@ -245,7 +256,7 @@ function Diner:updateSell(slot, calOnly) | @@ -245,7 +256,7 @@ function Diner:updateSell(slot, calOnly) | ||
245 | local deltaTime = 0 | 256 | local deltaTime = 0 |
246 | local deltaCount = 0 | 257 | local deltaCount = 0 |
247 | local timePass = skynet.timex() - sell.time | 258 | local timePass = skynet.timex() - sell.time |
248 | - local sellTime = dishData.sell_time | 259 | + local sellTime = dishData.sell_time + self.owner:getBnousDiner(3, dishData.sell_time) |
249 | 260 | ||
250 | deltaCount = math.floor(timePass / sellTime) | 261 | deltaCount = math.floor(timePass / sellTime) |
251 | if deltaCount < sell.count then | 262 | if deltaCount < sell.count then |
@@ -284,11 +295,11 @@ function Diner:expediteSell(slot) | @@ -284,11 +295,11 @@ function Diner:expediteSell(slot) | ||
284 | local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] | 295 | local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] |
285 | local expediteCount = 0 | 296 | local expediteCount = 0 |
286 | local expediteTime = globalCsv.diner_sell_expediteTime | 297 | local expediteTime = globalCsv.diner_sell_expediteTime |
287 | - local sellTime = dishData.sell_time | 298 | + local sellTime = dishData.sell_time + self.owner:getBnousDiner(3,dishData.sell_time) |
288 | expediteCount = math.floor(expediteTime / sellTime) | 299 | expediteCount = math.floor(expediteTime / sellTime) |
289 | expediteCount = math.min(expediteCount, sell.count) | 300 | expediteCount = math.min(expediteCount, sell.count) |
290 | local lastCount = sell.count - expediteCount | 301 | local lastCount = sell.count - expediteCount |
291 | - local reward, popular = self:calSellReward(sell, expediteCount, dishData) | 302 | + local reward, popular = self:calSellReward(sell, expediteCount, dishData, true) |
292 | local deltaTime = math.floor(expediteTime - sellTime * expediteCount) | 303 | local deltaTime = math.floor(expediteTime - sellTime * expediteCount) |
293 | if expediteCount > 0 then | 304 | if expediteCount > 0 then |
294 | sells[slot].time = sell.time - deltaTime | 305 | sells[slot].time = sell.time - deltaTime |
src/models/Role.lua
@@ -116,6 +116,7 @@ Role.schema = { | @@ -116,6 +116,7 @@ Role.schema = { | ||
116 | hangTeams = {"table", {}}, -- pve自选编队 | 116 | hangTeams = {"table", {}}, -- pve自选编队 |
117 | teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType | 117 | teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType |
118 | advTeams = {"table", {}}, -- 拾荒自选编队 | 118 | advTeams = {"table", {}}, -- 拾荒自选编队 |
119 | + towerTeams = {"table", {}}, -- 四个电波塔的队伍 | ||
119 | 120 | ||
120 | bonusStar = {"table", {}}, -- 奖励关卡 通关星星 {[id] = 1} 三个二进制位 表示三个星 从低到高 (1 << 0) (1 << 1) (1 << 2) 满星 (1 << 3) - 1 | 121 | bonusStar = {"table", {}}, -- 奖励关卡 通关星星 {[id] = 1} 三个二进制位 表示三个星 从低到高 (1 << 0) (1 << 1) (1 << 2) 满星 (1 << 3) - 1 |
121 | 122 | ||
@@ -147,7 +148,8 @@ Role.schema = { | @@ -147,7 +148,8 @@ Role.schema = { | ||
147 | 148 | ||
148 | boxL = {"table", {}}, -- boxList 正开启的箱子 -- {[1] = {id = 1010, gem = 101, time = 1313}} | 149 | boxL = {"table", {}}, -- boxList 正开启的箱子 -- {[1] = {id = 1010, gem = 101, time = 1313}} |
149 | 150 | ||
150 | - towerInfo = {"table", {c = globalCsv.tower_count_limit, l = 1}}, -- 当天爬塔消耗的次数 -- {t = time, c = count, l = layer, k = battleKey} | 151 | + towerInfo = {"table", {c = globalCsv.tower_count_limit, l = 1, l1 = 10001, l2 = 20001, l3 = 30001}}, -- 当天爬塔消耗的次数 -- {t = time, c = count, l = layer, k = battleKey} |
152 | + towerBnous = {"table", {}}, -- 电波塔加成 {[1] = {[1] = 1, [2] = 1}, [2] = {}, [3] = {}, [4] = {}} | ||
151 | 153 | ||
152 | spTask = {"table", {}}, -- 特殊任务 -- {id = status} | 154 | spTask = {"table", {}}, -- 特殊任务 -- {id = status} |
153 | 155 | ||
@@ -369,6 +371,7 @@ function Role:data() | @@ -369,6 +371,7 @@ function Role:data() | ||
369 | hangTeams = self:getProperty("hangTeams"), | 371 | hangTeams = self:getProperty("hangTeams"), |
370 | teamIndex = self:getProperty("teamIndex"), | 372 | teamIndex = self:getProperty("teamIndex"), |
371 | advTeams = self:getProperty("advTeams"), | 373 | advTeams = self:getProperty("advTeams"), |
374 | + towerTeams = self:getProperty("towerTeams"), | ||
372 | 375 | ||
373 | bonusStar = self:getProperty("bonusStar"), | 376 | bonusStar = self:getProperty("bonusStar"), |
374 | 377 | ||
@@ -386,6 +389,7 @@ function Role:data() | @@ -386,6 +389,7 @@ function Role:data() | ||
386 | equips = self:getProperty("equips"), | 389 | equips = self:getProperty("equips"), |
387 | boxL = self:getProperty("boxL"), | 390 | boxL = self:getProperty("boxL"), |
388 | towerInfo = self:getProperty("towerInfo"), | 391 | towerInfo = self:getProperty("towerInfo"), |
392 | + towerBnous = self:getProperty("towerBnous"), | ||
389 | spTask = self:getProperty("spTask"), | 393 | spTask = self:getProperty("spTask"), |
390 | dTask = self:getProperty("dTask"), | 394 | dTask = self:getProperty("dTask"), |
391 | wTask = self:getProperty("wTask"), | 395 | wTask = self:getProperty("wTask"), |
src/models/RoleBattle.lua
@@ -104,7 +104,7 @@ function Role:checkBattleCheat(battleType, params) | @@ -104,7 +104,7 @@ function Role:checkBattleCheat(battleType, params) | ||
104 | -- enemyServer = packBattleEnemyCommon(carbonData) | 104 | -- enemyServer = packBattleEnemyCommon(carbonData) |
105 | end | 105 | end |
106 | cheat["tower"] = function() | 106 | cheat["tower"] = function() |
107 | - local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.Tower)) | 107 | + local team = self:getTeamBattleInfo(self:getTowerTeamFormat(params.tower)) |
108 | for slot, hero in pairs(team.heros) do | 108 | for slot, hero in pairs(team.heros) do |
109 | local temp = {} | 109 | local temp = {} |
110 | for arr, _ in pairs(checkCheatAttrs) do | 110 | for arr, _ in pairs(checkCheatAttrs) do |
@@ -198,7 +198,7 @@ function Role:checkBattle(battleType, params) | @@ -198,7 +198,7 @@ function Role:checkBattle(battleType, params) | ||
198 | end | 198 | end |
199 | end, | 199 | end, |
200 | tower = function() | 200 | tower = function() |
201 | - local towerF = self:getTeamFormatByType(TeamSystemType.Tower) | 201 | + local towerF = self:getTowerTeamFormat(params.tower) |
202 | for slot, hero in pairs(self:getTeamHerosInfo(towerF).heros) do | 202 | for slot, hero in pairs(self:getTeamHerosInfo(towerF).heros) do |
203 | selflist[slot] = hero.type | 203 | selflist[slot] = hero.type |
204 | end | 204 | end |
src/models/RoleLog.lua
@@ -57,6 +57,7 @@ local ItemReason = { | @@ -57,6 +57,7 @@ local ItemReason = { | ||
57 | actBuyBpLevel = 141, -- 购买活动战令等级 | 57 | actBuyBpLevel = 141, -- 购买活动战令等级 |
58 | newSign = 142,-- 新的活动签到 | 58 | newSign = 142,-- 新的活动签到 |
59 | advLevelStage = 143, -- 拾荒活动阶段奖励 | 59 | advLevelStage = 143, -- 拾荒活动阶段奖励 |
60 | + towerBnous = 144, -- 爬塔到一定层数对某些功能的奖励 | ||
60 | 61 | ||
61 | 62 | ||
62 | advHang = 301, -- 拾荒挂机 | 63 | advHang = 301, -- 拾荒挂机 |
src/models/RolePlugin.lua
@@ -312,7 +312,6 @@ function RolePlugin.bind(Role) | @@ -312,7 +312,6 @@ function RolePlugin.bind(Role) | ||
312 | end | 312 | end |
313 | 313 | ||
314 | function Role:addPotion(params) | 314 | function Role:addPotion(params) |
315 | - dump(params) | ||
316 | local pId = globalCsv.adv_item_potion[params.id] | 315 | local pId = globalCsv.adv_item_potion[params.id] |
317 | local potionBag = self:getProperty("potionBag") | 316 | local potionBag = self:getProperty("potionBag") |
318 | local origin = potionBag[pId] or 0 | 317 | local origin = potionBag[pId] or 0 |
@@ -1285,11 +1284,21 @@ function RolePlugin.bind(Role) | @@ -1285,11 +1284,21 @@ function RolePlugin.bind(Role) | ||
1285 | end | 1284 | end |
1286 | 1285 | ||
1287 | local StdTowerRankTime = toUnixtime("2019010100") | 1286 | local StdTowerRankTime = toUnixtime("2019010100") |
1288 | - function Role:setTowerRank(level) | 1287 | + local TowerRankInfo = { |
1288 | + [1] = {rank = RANK_TOWER, rankInfo = RANK_TOWER_INFO}, | ||
1289 | + [2] = {rank = RANK_TOWER1, rankInfo = RANK_TOWER1_INFO}, | ||
1290 | + [3] = {rank = RANK_TOWER2, rankInfo = RANK_TOWER2_INFO}, | ||
1291 | + [4] = {rank = RANK_TOWER3, rankInfo = RANK_TOWER3_INFO}, | ||
1292 | + } | ||
1293 | + function Role:setTowerRank(level,tType) | ||
1294 | + tType = tType or 1 | ||
1289 | local now = skynet.timex() | 1295 | local now = skynet.timex() |
1290 | local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年 | 1296 | local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年 |
1291 | local ct = 10000 - ct -- 越早的排名越靠前 | 1297 | local ct = 10000 - ct -- 越早的排名越靠前 |
1292 | - local towerTeam = self:getTeamFormatByType(TeamSystemType.Tower) | 1298 | + |
1299 | + | ||
1300 | + local info = TowerRankInfo[tType] | ||
1301 | + local towerTeam = self:getTowerTeamFormat(tostring(tType)) | ||
1293 | local battleV = self:getTeamBattleValue(towerTeam.heros) | 1302 | local battleV = self:getTeamBattleValue(towerTeam.heros) |
1294 | local score = (level * 10000 + ct) * 10000000 + battleV | 1303 | local score = (level * 10000 + ct) * 10000000 + battleV |
1295 | 1304 | ||
@@ -1303,21 +1312,23 @@ function RolePlugin.bind(Role) | @@ -1303,21 +1312,23 @@ function RolePlugin.bind(Role) | ||
1303 | } | 1312 | } |
1304 | local roleId = self:getProperty("id") | 1313 | local roleId = self:getProperty("id") |
1305 | redisproxy:pipelining(function (red) | 1314 | redisproxy:pipelining(function (red) |
1306 | - red:zadd(RANK_TOWER, score, roleId) --更新分数 | ||
1307 | - red:hset(RANK_TOWER_INFO, roleId, MsgPack.pack(curInfo)) | 1315 | + red:zadd(info.rank, score, roleId) --更新分数 |
1316 | + red:hset(info.rankInfo, roleId, MsgPack.pack(curInfo)) | ||
1308 | end) | 1317 | end) |
1309 | end | 1318 | end |
1310 | 1319 | ||
1311 | - function Role:getTowerRank() | 1320 | + function Role:getTowerRank(tType) |
1321 | + tType = tType or 1 | ||
1322 | + local info = TowerRankInfo[tType] | ||
1312 | local list = {} | 1323 | local list = {} |
1313 | - local ids = redisproxy:zrevrange(RANK_TOWER, 0 , 99) | 1324 | + local ids = redisproxy:zrevrange(info.rank, 0 , 99) |
1314 | local redret = {} | 1325 | local redret = {} |
1315 | if ids and next(ids) then | 1326 | if ids and next(ids) then |
1316 | redret = redisproxy:pipelining(function (red) | 1327 | redret = redisproxy:pipelining(function (red) |
1317 | for i = 1, #ids do | 1328 | for i = 1, #ids do |
1318 | local roleId = ids[i] | 1329 | local roleId = ids[i] |
1319 | table.insert(list, {roleId = tonumber(roleId)}) | 1330 | table.insert(list, {roleId = tonumber(roleId)}) |
1320 | - red:hget(RANK_TOWER_INFO, roleId) | 1331 | + red:hget(info.rankInfo, roleId) |
1321 | end | 1332 | end |
1322 | end) | 1333 | end) |
1323 | end | 1334 | end |
@@ -1326,7 +1337,7 @@ function RolePlugin.bind(Role) | @@ -1326,7 +1337,7 @@ function RolePlugin.bind(Role) | ||
1326 | player.format = nil | 1337 | player.format = nil |
1327 | list[i].player = player | 1338 | list[i].player = player |
1328 | end | 1339 | end |
1329 | - local rank = redisproxy:ZREVRANK(RANK_TOWER, self:getProperty("id")) | 1340 | + local rank = redisproxy:ZREVRANK(info.rank, self:getProperty("id")) |
1330 | if not rank then | 1341 | if not rank then |
1331 | rank = -1 | 1342 | rank = -1 |
1332 | else | 1343 | else |
@@ -1335,8 +1346,10 @@ function RolePlugin.bind(Role) | @@ -1335,8 +1346,10 @@ function RolePlugin.bind(Role) | ||
1335 | return {list = list, rank = rank} | 1346 | return {list = list, rank = rank} |
1336 | end | 1347 | end |
1337 | 1348 | ||
1338 | - function Role:getTowerRankOneInfo(roleId) | ||
1339 | - local data = redisproxy:hget(RANK_TOWER_INFO, roleId) | 1349 | + function Role:getTowerRankOneInfo(roleId,tType) |
1350 | + tType = tType or 1 | ||
1351 | + local info = TowerRankInfo[tType] | ||
1352 | + local data = redisproxy:hget(info.rankInfo, roleId) | ||
1340 | if data then | 1353 | if data then |
1341 | local player = MsgPack.unpack(data) | 1354 | local player = MsgPack.unpack(data) |
1342 | return player.format | 1355 | return player.format |
@@ -1556,6 +1569,19 @@ function RolePlugin.bind(Role) | @@ -1556,6 +1569,19 @@ function RolePlugin.bind(Role) | ||
1556 | }) | 1569 | }) |
1557 | end | 1570 | end |
1558 | 1571 | ||
1572 | + -- 设置电波塔阵容 | ||
1573 | + function Role:getTowerTeamFormat(teamIdx) | ||
1574 | + local teams = self:getProperty("towerTeams") or {} | ||
1575 | + local team = teams[tostring(teamIdx)] or {} | ||
1576 | + return team | ||
1577 | + end | ||
1578 | + | ||
1579 | + function Role:setTowerTeamFormat(teamIdx, team) | ||
1580 | + local teams = self:getProperty("towerTeams") or {} | ||
1581 | + teams[tostring(teamIdx)] = team | ||
1582 | + self:updateProperty({field = "towerTeams", value = teams, notNotify = false}) | ||
1583 | + end | ||
1584 | + | ||
1559 | -- update | 1585 | -- update |
1560 | function Role:onRecoverTimer(now) | 1586 | function Role:onRecoverTimer(now) |
1561 | self:updateTimeReset(now, true) | 1587 | self:updateTimeReset(now, true) |
@@ -2264,6 +2290,110 @@ function RolePlugin.bind(Role) | @@ -2264,6 +2290,110 @@ function RolePlugin.bind(Role) | ||
2264 | end | 2290 | end |
2265 | return result.data.content | 2291 | return result.data.content |
2266 | end | 2292 | end |
2293 | + | ||
2294 | + function Role:getTowerBnousActive(update) | ||
2295 | + if not update and self.towerBnousActive then | ||
2296 | + return self.towerBnousActive | ||
2297 | + end | ||
2298 | + local towerInfo = self:getProperty("towerInfo") | ||
2299 | + local towerLevel = {towerInfo.l or 1, towerInfo.l1 or 10001, towerInfo.l2 or 20001, towerInfo.l3 or 30001} | ||
2300 | + local towerBnous = self:getProperty("towerBnous") | ||
2301 | + local bnousCsv = csvdb["tower_battle_additionCsv"] | ||
2302 | + self.towerBnousActive = {} | ||
2303 | + | ||
2304 | + for towerIdx, Set in pairs(towerBnous) do | ||
2305 | + for id, _ in pairs(Set) do | ||
2306 | + local data = bnousCsv[towerIdx][id] | ||
2307 | + if data then | ||
2308 | + local effects = data.effect:toTableArraySec() | ||
2309 | + for _, effect in pairs(effects) do | ||
2310 | + local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4]) | ||
2311 | + if not self.towerBnousActive[pm1] then | ||
2312 | + self.towerBnousActive[pm1] = {} | ||
2313 | + end | ||
2314 | + if pm1 == SystemBnousType.TowerBuff then | ||
2315 | + if not self.towerBnousActive[pm1][pm2] then | ||
2316 | + self.towerBnousActive[pm1][pm2] = {} | ||
2317 | + end | ||
2318 | + table.insert(self.towerBnousActive[pm1][pm2],pm3) | ||
2319 | + elseif pm1 == SystemBnousType.Adv then | ||
2320 | + if not self.towerBnousActive[pm1][pm4] then | ||
2321 | + self.towerBnousActive[pm1][pm4] = {} | ||
2322 | + end | ||
2323 | + self.towerBnousActive[pm1][pm4][pm2] = (self.towerBnousActive[pm1][pm4][pm2] or 0) + pm3 | ||
2324 | + elseif pm1 == SystemBnousType.HangTime then | ||
2325 | + if type(self.towerBnousActive[pm1]) == "table" then | ||
2326 | + self.towerBnousActive[pm1] = 0 | ||
2327 | + end | ||
2328 | + self.towerBnousActive[pm1] = self.towerBnousActive[pm1] + pm2 | ||
2329 | + else | ||
2330 | + self.towerBnousActive[pm1][pm2] = (self.towerBnousActive[pm1][pm2] or 0) + pm3 | ||
2331 | + end | ||
2332 | + end | ||
2333 | + end | ||
2334 | + end | ||
2335 | + end | ||
2336 | + | ||
2337 | + return self.towerBnousActive | ||
2338 | + end | ||
2339 | + | ||
2340 | + function Role:getDeltaValue(result, value) | ||
2341 | + if not result then return 0 end | ||
2342 | + local delta = 0 | ||
2343 | + if result[1] and value then | ||
2344 | + delta = math.floor(value * result[1] / 100) | ||
2345 | + end | ||
2346 | + if result[0] then | ||
2347 | + delta = delta + result[0] | ||
2348 | + end | ||
2349 | + return delta | ||
2350 | + end | ||
2351 | + | ||
2352 | + function Role:getBnousBattleBuff() | ||
2353 | + local towerBnous = self:getTowerBnousActive() | ||
2354 | + return towerBnous[SystemBnousType.TowerBuff] | ||
2355 | + end | ||
2356 | + | ||
2357 | + function Role:getBnousCrusade(value) | ||
2358 | + local towerBnous = self:getTowerBnousActive() | ||
2359 | + return self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value) | ||
2360 | + end | ||
2361 | + | ||
2362 | + function Role:getBnousDiner(type, value) | ||
2363 | + local towerBnous = self:getTowerBnousActive() | ||
2364 | + type = type or 1 | ||
2365 | + local result | ||
2366 | + if type == 1 then | ||
2367 | + result = towerBnous[SystemBnousType.DinerGet] | ||
2368 | + elseif type == 2 then | ||
2369 | + result = towerBnous[SystemBnousType.DinerLimit] | ||
2370 | + elseif type == 3 then | ||
2371 | + result = towerBnous[SystemBnousType.DinerSell] | ||
2372 | + elseif type == 4 then | ||
2373 | + result = towerBnous[SystemBnousType.DinerPrice] | ||
2374 | + end | ||
2375 | + return self:getDeltaValue(result, value) | ||
2376 | + end | ||
2377 | + | ||
2378 | + function Role:getBnousAdv() | ||
2379 | + local towerBnous = self:getTowerBnousActive() | ||
2380 | + return towerBnous[SystemBnousType.Adv] or {} | ||
2381 | + end | ||
2382 | + | ||
2383 | + function Role:getBnousHangTime() | ||
2384 | + local towerBnous = self:getTowerBnousActive() | ||
2385 | + return towerBnous[SystemBnousType.HangTime] or 0 | ||
2386 | + end | ||
2387 | + | ||
2388 | + function Role:getBnousPvpTicket() | ||
2389 | + local towerBnous = self:getTowerBnousActive() | ||
2390 | + return towerBnous[SystemBnousType.PvpTicket] or {} | ||
2391 | + end | ||
2392 | + | ||
2393 | + function Role:getBnousSweep() | ||
2394 | + local towerBnous = self:getTowerBnousActive() | ||
2395 | + return towerBnous[SystemBnousType.SweepReward] or {} | ||
2396 | + end | ||
2267 | 2397 | ||
2268 | end | 2398 | end |
2269 | 2399 |
src/models/RoleTask.lua
@@ -191,7 +191,7 @@ local AchievListener = { | @@ -191,7 +191,7 @@ local AchievListener = { | ||
191 | [TaskType.OverOderTask] = {{14}}, | 191 | [TaskType.OverOderTask] = {{14}}, |
192 | [TaskType.FoodSellGold] = {{15, f("count")}}, | 192 | [TaskType.FoodSellGold] = {{15, f("count")}}, |
193 | [TaskType.DinerPopular] = {{16, f("count")}}, | 193 | [TaskType.DinerPopular] = {{16, f("count")}}, |
194 | - [TaskType.TowerPass] = {{17, f("level")}}, | 194 | + [TaskType.TowerPass] = {{17, f("count"), f("type")}}, |
195 | [TaskType.OpenBox] = {{18, f("count")}}, | 195 | [TaskType.OpenBox] = {{18, f("count")}}, |
196 | [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}}, | 196 | [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}}, |
197 | [TaskType.DinerTalentUp] = {{20, 1, f("type")}}, | 197 | [TaskType.DinerTalentUp] = {{20, 1, f("type")}}, |
@@ -249,6 +249,7 @@ local ActivityListener = { | @@ -249,6 +249,7 @@ local ActivityListener = { | ||
249 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, | 249 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, |
250 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, | 250 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, |
251 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, | 251 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, |
252 | + [TaskType.AdvCostPower] = {{Activity.ActivityType.Crisis, 3, f("count")}}, | ||
252 | [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}}, | 253 | [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}}, |
253 | [TaskType.AddItem] = {{Activity.ActivityType.BattleCommand, f("id"), f("count")}}, | 254 | [TaskType.AddItem] = {{Activity.ActivityType.BattleCommand, f("id"), f("count")}}, |
254 | } | 255 | } |
@@ -492,7 +493,6 @@ function RoleTask.bind(Role) | @@ -492,7 +493,6 @@ function RoleTask.bind(Role) | ||
492 | [6] = true, | 493 | [6] = true, |
493 | [7] = true, | 494 | [7] = true, |
494 | [16] = true, | 495 | [16] = true, |
495 | - [17] = true, | ||
496 | [19] = true, | 496 | [19] = true, |
497 | [22] = true, | 497 | [22] = true, |
498 | [23] = true, | 498 | [23] = true, |
src/models/RoleTimeReset.lua
@@ -48,6 +48,12 @@ ResetFunc["CrossWeek"] = function(self, notify, response) | @@ -48,6 +48,12 @@ ResetFunc["CrossWeek"] = function(self, notify, response) | ||
48 | response.dinerS = {} | 48 | response.dinerS = {} |
49 | 49 | ||
50 | self.activity:refreshWeekData(notify) | 50 | self.activity:refreshWeekData(notify) |
51 | + | ||
52 | + -- 跨周送一些道具 | ||
53 | + local BnousReward = self:getBnousPvpTicket() | ||
54 | + if next(BnousReward) then | ||
55 | + local reward, change = self:award(BnousReward, {log = {desc = "towerBnous"}}) | ||
56 | + end | ||
51 | end | 57 | end |
52 | 58 | ||
53 | 59 |