Commit fd494c0b2bb265d948c1fc8860fa3eb51ede7345

Authored by 熊润斐
2 parents c60a8b9b 664e0e07

Merge branch 'tr/develop' into tr/bugfix-qa

src/GlobalVar.lua
... ... @@ -372,7 +372,20 @@ DrawCardType = {
372 372 TeamSystemType = {
373 373 Hang = 1,
374 374 BonusBattle = 2,
375   - Tower = 3,
376 375 Dinner = 4,
377 376 FriendBattle = 5,
378   -}
379 377 \ No newline at end of file
  378 +}
  379 +
  380 +-- 某个功能对其他系统功能的加成类型
  381 +SystemBnousType = {
  382 + TowerBuff = 1, -- 电波塔内战斗开始时获得buff
  383 + CrusadeTask = 2, -- 讨伐电台任务加速
  384 + DinerGet = 3, -- 食材供应商获取速度
  385 + DinerLimit = 4, -- 食材供应商上限
  386 + DinerSell = 5, -- 料理贩卖速度
  387 + DinerPrice = 6, -- 齿轮价格
  388 + Adv = 7, -- 代理拾荒获得额外道具
  389 + HangTime = 8, -- 挂机时间上限
  390 + PvpTicket = 9, -- 每周额外获得竞技场门票数量
  391 + SweepReward = 10, -- 奖励关卡每次扫荡额外获得道具
  392 +}
... ...
src/ProtocolCode.lua
... ... @@ -145,6 +145,7 @@ actionCodes = {
145 145 Tower_rankRpc = 353,
146 146 Tower_bugCountRpc = 354,
147 147 Tower_rankInfoRpc = 355,
  148 + Tower_activeTowerBonusRpc = 356,
148 149  
149 150 Car_makePotionRpc = 400,
150 151 Car_equipUpRpc = 401,
... ...
src/RedisKeys.lua
... ... @@ -26,6 +26,15 @@ RANK_TYPE = {
26 26 RANK_TOWER = "rank:tower"
27 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 38 -- adv
30 39 RANK_ADV = {"rank:adv1", "rank:adv2"}
31 40 RANK_ADV_INFO = "rank:adv:info"
... ...
src/actions/AdvAction.lua
... ... @@ -276,7 +276,9 @@ function _M.startHangRpc(agent, data)
276 276 if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then
277 277 return 2
278 278 end
279   - adv_idle_time = adv_idle_time * 60
  279 + local timeAdd = role:getBnousHangTime()
  280 + adv_idle_time = adv_idle_time * 60 + timeAdd
  281 +
280 282  
281 283 local advHang = role:getProperty("advHang")
282 284 if advHang[chapterId] then return 3 end --正在挂机
... ... @@ -416,7 +418,8 @@ function _M.endHangRpc(agent, data)
416 418 if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then
417 419 return 2
418 420 end
419   - adv_idle_time = adv_idle_time * 60
  421 + local timeAdd = role:getBnousHangTime()
  422 + adv_idle_time = adv_idle_time * 60 + timeAdd
420 423  
421 424 local reward, isFull, change, heroFaithMap
422 425 local heroCnt = 0
... ... @@ -463,6 +466,15 @@ function _M.endHangRpc(agent, data)
463 466 for itemId, count in pairs(idleReward) do
464 467 idleReward[itemId] = count * adv_idle_reward_coef
465 468 end
  469 +
  470 + local bnousReward = role:getBnousAdv()
  471 + for time, set in pairs(bnousReward) do
  472 + local delta = math.floor(adv_idle_time / time)
  473 + for key, value in pairs(set) do
  474 + idleReward[key] = (idleReward[key] or 0) + value * delta
  475 + end
  476 + end
  477 +
466 478 reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}})
467 479 else
468 480 if cancel then
... ...
src/actions/DinerAction.lua
... ... @@ -75,7 +75,8 @@ function _M.addSellRpc( agent, data )
75 75 sells[slot].count = count
76 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 80 role:pushMsg({type = "food", slot = slot, time = needTime})
80 81  
81 82 -- 检查解锁的顾客
... ... @@ -742,11 +743,15 @@ function _M.getGreenhouseRpc( agent, data )
742 743 local now = skynet.timex()
743 744 local gfood = role.dinerData:getProperty("gfood")
744 745 if not next(gfood) then return end
  746 +
  747 + local timeAdd = role:getBnousDiner(2,globalCsv.diner_get_food_time_max)
  748 +
745 749 for k , v in pairs(gfood) do
746 750 local itemId = v.id
747 751 local st = v.st
748 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 755 local endTime2 = math.min(now, endTime)
751 756 reward[itemId] = math.floor((endTime2 - st) / speed)
752 757 if endTime2 == endTime then
... ...
src/actions/GmAction.lua
... ... @@ -483,13 +483,25 @@ function _M.advit(role, pms)
483 483 end
484 484  
485 485  
486   -table.insert(helpDes, {"爬塔到指定层", "tower", "层数"})
  486 +table.insert(helpDes, {"爬塔到指定层", "tower", "塔id", "层数"})
487 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 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 506 return "成功"
495 507 end
... ...
src/actions/HangAction.lua
... ... @@ -326,6 +326,7 @@ function _M.roleFormatRpc(agent , data)
326 326 local index = msg.index -- 阵容索引
327 327 local title = msg.title -- 阵容名称
328 328 local tactics = msg.tactics -- 战术
  329 + local tower = msg.tower
329 330 local team = {}
330 331 for slot, heroId in pairs(msg.heros) do
331 332 if not role.heros[heroId] then
... ... @@ -361,7 +362,11 @@ function _M.roleFormatRpc(agent , data)
361 362 team.tactics = msg.tactics
362 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 371 SendPacket(actionCodes.Hang_roleFormatRpc, '')
367 372 return true
... ... @@ -508,7 +513,7 @@ function _M.buyBonusCountRpc(agent, data)
508 513 return true
509 514 end
510 515  
511   -local function bonusWinReward(role, bonusData, rewardType, count)
  516 +local function bonusWinReward(role, bonusData, rewardType, count, sweep)
512 517 count = count or 1
513 518  
514 519 local reward, change = {}
... ... @@ -548,6 +553,13 @@ local function bonusWinReward(role, bonusData, rewardType, count)
548 553 end
549 554 end
550 555  
  556 + if sweep then
  557 + local bnousReward = role:getBnousSweep()
  558 + for key, value in pairs(bnousReward) do
  559 + reward[key] = (reward[key] or 0) + value * count
  560 + end
  561 + end
  562 +
551 563 reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = bonusData.id}})
552 564 role:checkTaskEnter("BonusPass", {id = bonusData.id, count = count})
553 565 return reward, change
... ... @@ -589,7 +601,7 @@ function _M.startBonusBattleRpc(agent, data)
589 601 bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count
590 602 role.dailyData:updateProperty({field = "bonusC", value = bonusC})
591 603  
592   - local reward, change = bonusWinReward(role, bonusData, 3, count)
  604 + local reward, change = bonusWinReward(role, bonusData, 3, count, true)
593 605 SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change}))
594 606  
595 607 role:checkTaskEnter("BonusQuick", {count = count})
... ...
src/actions/RadioAction.lua
... ... @@ -95,8 +95,9 @@ function _M.startQuestRpc(agent, data)
95 95 return 5
96 96 end
97 97 -- start quest, set finish time
  98 + local timeSub = role:getBnousCrusade(config.time)
98 99 local taskData = {}
99   - taskData["time"] = skynet.timex() + config.time
  100 + taskData["time"] = skynet.timex() + config.time + timeSub
100 101 taskData["heros"] = heros
101 102 radioTask[id] = taskData
102 103 role:updateProperty({field="radioTask", value=radioTask, notNotify=true})
... ...
src/actions/RoleAction.lua
... ... @@ -745,6 +745,7 @@ function _M.openSpeedUpBoxRpc(agent, data)
745 745 for k , v in pairs(gfood) do
746 746 local itemId = v.id
747 747 local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100
  748 + speed = speed + role:getBnousDiner(1,speed)
748 749 reward[itemId] = (reward[itemId] or 0) + math.floor((time / speed) * count)
749 750 end
750 751 else
... ...
src/actions/TowerAction.lua
... ... @@ -23,14 +23,32 @@ function _M.startBattleRpc(agent, data)
23 23 local role = agent.role
24 24 local msg = MsgPack.unpack(data)
25 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 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 52 local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t)
35 53 --if curCount < 1 then return end -- 没有次数返回
36 54  
... ... @@ -57,18 +75,24 @@ function _M.endBattleRpc(agent, data)
57 75 local key = msg.key
58 76 local passTime = msg.passTime
59 77  
  78 + local curTower = csvdb["tower_battleCsv"][id]
  79 + if not curTower then return 2 end
  80 +
60 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 87 SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1}))
63 88 return true
64 89 end
65   - local curTower = csvdb["tower_battleCsv"][id]
66   - if not curTower then return 2 end
67 90  
68 91 -- 防作弊
69 92 if not role:checkBattleCheat("tower", {
70 93 isWin = msg.starNum and msg.starNum > 0,
71   - info = msg.info
  94 + info = msg.info,
  95 + tower = towerType + 1
72 96 }) then
73 97 SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1}))
74 98 return true
... ... @@ -81,11 +105,21 @@ function _M.endBattleRpc(agent, data)
81 105 if msg.starNum and msg.starNum > 0 then --win
82 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 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 123 end
90 124  
91 125 towerInfo.c = curCount
... ... @@ -93,8 +127,9 @@ function _M.endBattleRpc(agent, data)
93 127 towerInfo.k = nil
94 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 133 if not rank then
99 134 rank = -1
100 135 else
... ... @@ -106,6 +141,7 @@ function _M.endBattleRpc(agent, data)
106 141 info = msg.info,
107 142 reward = reward,
108 143 rank = rank,
  144 + tower = towerType + 1
109 145 })
110 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 179  
144 180 function _M.rankRpc(agent , data)
145 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 185 return true
148 186 end
149 187  
... ... @@ -151,7 +189,43 @@ function _M.rankInfoRpc(agent , data)
151 189 local role = agent.role
152 190 local msg = MsgPack.unpack(data)
153 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 229 return true
156 230 end
157 231  
... ...
1   -Subproject commit f70c635c2f99d9800b629e41e13aa5115d5f69cd
  1 +Subproject commit 686b192263f5cc221e472e1b9a41d059d581da2d
... ...
src/models/Activity.lua
... ... @@ -489,7 +489,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = {
489 489 role:checkTaskEnter("RoleLevelUp", {level = rLevel})
490 490  
491 491 local towerInfo = role:getProperty("towerInfo")
492   - role:checkTaskEnter("TowerPass", {level = towerInfo.l})
  492 + role:checkTaskEnter("TowerPass", {count = towerInfo.l, type = 1})
493 493 --"PvpWin"
494 494 --role:checkTaskEnter("HangPass", {id = 0})
495 495 role:checkCalendaTask(true, 15, 3)
... ... @@ -557,7 +557,7 @@ activityFunc[Activity.ActivityType.BattleCommandTask] = {
557 557 role:checkTaskEnter("RoleLevelUp", {level = rLevel})
558 558  
559 559 local towerInfo = role:getProperty("towerInfo")
560   - role:checkTaskEnter("TowerPass", {level = towerInfo.l})
  560 + role:checkTaskEnter("TowerPass", {count = towerInfo.l, type = 1})
561 561 --"PvpWin"
562 562 --role:checkTaskEnter("HangPass", {id = 0})
563 563 role:checkCalendaTask(true, 15, 3)
... ...
src/models/Diner.lua
... ... @@ -193,6 +193,10 @@ function Diner:calSellReward(sell, delta, dishData, isExpedite)
193 193 local addReward = {}
194 194 for key, value in pairs(dishData.item_normal:toNumMap()) do
195 195 addReward[key] = (addReward[key] or 0) + value * delta
  196 + if key == ItemId.Gold then
  197 + local goldPriceAdd = self.owner:getBnousDiner(4,value)
  198 + addReward[key] = addReward[key] + goldPriceAdd * delta
  199 + end
196 200 end
197 201  
198 202 popular = dishData.famous_normal * delta
... ... @@ -250,7 +254,7 @@ function Diner:updateSell(slot, calOnly)
250 254 local deltaTime = 0
251 255 local deltaCount = 0
252 256 local timePass = skynet.timex() - sell.time
253   - local sellTime = dishData.sell_time
  257 + local sellTime = dishData.sell_time + self.owner:getBnousDiner(3, dishData.sell_time)
254 258  
255 259 deltaCount = math.floor(timePass / sellTime)
256 260 if deltaCount < sell.count then
... ... @@ -289,7 +293,7 @@ function Diner:expediteSell(slot)
289 293 local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level]
290 294 local expediteCount = 0
291 295 local expediteTime = globalCsv.diner_sell_expediteTime
292   - local sellTime = dishData.sell_time
  296 + local sellTime = dishData.sell_time + self.owner:getBnousDiner(3,dishData.sell_time)
293 297 expediteCount = math.floor(expediteTime / sellTime)
294 298 expediteCount = math.min(expediteCount, sell.count)
295 299 local lastCount = sell.count - expediteCount
... ...
src/models/Role.lua
... ... @@ -115,6 +115,7 @@ Role.schema = {
115 115 hangTeams = {"table", {}}, -- pve自选编队
116 116 teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType
117 117 advTeams = {"table", {}}, -- 拾荒自选编队
  118 + towerTeams = {"table", {}}, -- 四个电波塔的队伍
118 119  
119 120 bonusStar = {"table", {}}, -- 奖励关卡 通关星星 {[id] = 1} 三个二进制位 表示三个星 从低到高 (1 << 0) (1 << 1) (1 << 2) 满星 (1 << 3) - 1
120 121  
... ... @@ -146,7 +147,8 @@ Role.schema = {
146 147  
147 148 boxL = {"table", {}}, -- boxList 正开启的箱子 -- {[1] = {id = 1010, gem = 101, time = 1313}}
148 149  
149   - towerInfo = {"table", {c = globalCsv.tower_count_limit, l = 1}}, -- 当天爬塔消耗的次数 -- {t = time, c = count, l = layer, k = battleKey}
  150 + towerInfo = {"table", {c = globalCsv.tower_count_limit, l = 1, l1 = 10001, l2 = 20001, l3 = 30001}}, -- 当天爬塔消耗的次数 -- {t = time, c = count, l = layer, k = battleKey}
  151 + towerBnous = {"table", {}}, -- 电波塔加成 {[1] = {[1] = 1, [2] = 1}, [2] = {}, [3] = {}, [4] = {}}
150 152  
151 153 spTask = {"table", {}}, -- 特殊任务 -- {id = status}
152 154  
... ... @@ -368,6 +370,7 @@ function Role:data()
368 370 hangTeams = self:getProperty("hangTeams"),
369 371 teamIndex = self:getProperty("teamIndex"),
370 372 advTeams = self:getProperty("advTeams"),
  373 + towerTeams = self:getProperty("towerTeams"),
371 374  
372 375 bonusStar = self:getProperty("bonusStar"),
373 376  
... ... @@ -385,6 +388,7 @@ function Role:data()
385 388 equips = self:getProperty("equips"),
386 389 boxL = self:getProperty("boxL"),
387 390 towerInfo = self:getProperty("towerInfo"),
  391 + towerBnous = self:getProperty("towerBnous"),
388 392 spTask = self:getProperty("spTask"),
389 393 dTask = self:getProperty("dTask"),
390 394 wTask = self:getProperty("wTask"),
... ...
src/models/RoleBattle.lua
... ... @@ -104,7 +104,7 @@ function Role:checkBattleCheat(battleType, params)
104 104 -- enemyServer = packBattleEnemyCommon(carbonData)
105 105 end
106 106 cheat["tower"] = function()
107   - local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.Tower))
  107 + local team = self:getTeamBattleInfo(self:getTowerTeamFormat(params.tower))
108 108 for slot, hero in pairs(team.heros) do
109 109 local temp = {}
110 110 for arr, _ in pairs(checkCheatAttrs) do
... ... @@ -198,7 +198,7 @@ function Role:checkBattle(battleType, params)
198 198 end
199 199 end,
200 200 tower = function()
201   - local towerF = self:getTeamFormatByType(TeamSystemType.Tower)
  201 + local towerF = self:getTowerTeamFormat(params.tower)
202 202 for slot, hero in pairs(self:getTeamHerosInfo(towerF).heros) do
203 203 selflist[slot] = hero.type
204 204 end
... ...
src/models/RoleLog.lua
... ... @@ -57,6 +57,7 @@ local ItemReason = {
57 57 actBuyBpLevel = 141, -- 购买活动战令等级
58 58 newSign = 142,-- 新的活动签到
59 59 advLevelStage = 143, -- 拾荒活动阶段奖励
  60 + towerBnous = 144, -- 爬塔到一定层数对某些功能的奖励
60 61  
61 62  
62 63 advHang = 301, -- 拾荒挂机
... ...
src/models/RolePlugin.lua
... ... @@ -309,7 +309,6 @@ function RolePlugin.bind(Role)
309 309 end
310 310  
311 311 function Role:addPotion(params)
312   - dump(params)
313 312 local pId = globalCsv.adv_item_potion[params.id]
314 313 local potionBag = self:getProperty("potionBag")
315 314 local origin = potionBag[pId] or 0
... ... @@ -1276,11 +1275,21 @@ function RolePlugin.bind(Role)
1276 1275 end
1277 1276  
1278 1277 local StdTowerRankTime = toUnixtime("2019010100")
1279   - function Role:setTowerRank(level)
  1278 + local TowerRankInfo = {
  1279 + [1] = {rank = RANK_TOWER, rankInfo = RANK_TOWER_INFO},
  1280 + [2] = {rank = RANK_TOWER1, rankInfo = RANK_TOWER1_INFO},
  1281 + [3] = {rank = RANK_TOWER2, rankInfo = RANK_TOWER2_INFO},
  1282 + [4] = {rank = RANK_TOWER3, rankInfo = RANK_TOWER3_INFO},
  1283 + }
  1284 + function Role:setTowerRank(level,tType)
  1285 + tType = tType or 1
1280 1286 local now = skynet.timex()
1281 1287 local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年
1282 1288 local ct = 10000 - ct -- 越早的排名越靠前
1283   - local towerTeam = self:getTeamFormatByType(TeamSystemType.Tower)
  1289 +
  1290 +
  1291 + local info = TowerRankInfo[tType]
  1292 + local towerTeam = self:getTowerTeamFormat(tostring(tType))
1284 1293 local battleV = self:getTeamBattleValue(towerTeam.heros)
1285 1294 local score = (level * 10000 + ct) * 10000000 + battleV
1286 1295  
... ... @@ -1294,21 +1303,23 @@ function RolePlugin.bind(Role)
1294 1303 }
1295 1304 local roleId = self:getProperty("id")
1296 1305 redisproxy:pipelining(function (red)
1297   - red:zadd(RANK_TOWER, score, roleId) --更新分数
1298   - red:hset(RANK_TOWER_INFO, roleId, MsgPack.pack(curInfo))
  1306 + red:zadd(info.rank, score, roleId) --更新分数
  1307 + red:hset(info.rankInfo, roleId, MsgPack.pack(curInfo))
1299 1308 end)
1300 1309 end
1301 1310  
1302   - function Role:getTowerRank()
  1311 + function Role:getTowerRank(tType)
  1312 + tType = tType or 1
  1313 + local info = TowerRankInfo[tType]
1303 1314 local list = {}
1304   - local ids = redisproxy:zrevrange(RANK_TOWER, 0 , 99)
  1315 + local ids = redisproxy:zrevrange(Info.rank, 0 , 99)
1305 1316 local redret = {}
1306 1317 if ids and next(ids) then
1307 1318 redret = redisproxy:pipelining(function (red)
1308 1319 for i = 1, #ids do
1309 1320 local roleId = ids[i]
1310 1321 table.insert(list, {roleId = tonumber(roleId)})
1311   - red:hget(RANK_TOWER_INFO, roleId)
  1322 + red:hget(Info.rankInfo, roleId)
1312 1323 end
1313 1324 end)
1314 1325 end
... ... @@ -1317,7 +1328,7 @@ function RolePlugin.bind(Role)
1317 1328 player.format = nil
1318 1329 list[i].player = player
1319 1330 end
1320   - local rank = redisproxy:ZREVRANK(RANK_TOWER, self:getProperty("id"))
  1331 + local rank = redisproxy:ZREVRANK(Info.rank, self:getProperty("id"))
1321 1332 if not rank then
1322 1333 rank = -1
1323 1334 else
... ... @@ -1326,8 +1337,10 @@ function RolePlugin.bind(Role)
1326 1337 return {list = list, rank = rank}
1327 1338 end
1328 1339  
1329   - function Role:getTowerRankOneInfo(roleId)
1330   - local data = redisproxy:hget(RANK_TOWER_INFO, roleId)
  1340 + function Role:getTowerRankOneInfo(roleId,tType)
  1341 + tType = tType or 1
  1342 + local info = TowerRankInfo[tType]
  1343 + local data = redisproxy:hget(info.rankInfo, roleId)
1331 1344 if data then
1332 1345 local player = MsgPack.unpack(data)
1333 1346 return player.format
... ... @@ -1547,6 +1560,19 @@ function RolePlugin.bind(Role)
1547 1560 })
1548 1561 end
1549 1562  
  1563 + -- 设置电波塔阵容
  1564 + function Role:getTowerTeamFormat(teamIdx)
  1565 + local teams = self:getProperty("towerTeams") or {}
  1566 + local team = teams[tostring(teamIdx)] or {}
  1567 + return team
  1568 + end
  1569 +
  1570 + function Role:setTowerTeamFormat(teamIdx, team)
  1571 + local teams = self:getProperty("towerTeams") or {}
  1572 + teams[tostring(teamIdx)] = team
  1573 + self:updateProperty({field = "towerTeams", value = teams, notNotify = false})
  1574 + end
  1575 +
1550 1576 -- update
1551 1577 function Role:onRecoverTimer(now)
1552 1578 self:updateTimeReset(now, true)
... ... @@ -2152,6 +2178,108 @@ function RolePlugin.bind(Role)
2152 2178 return hero:getProperty("faith")
2153 2179 end
2154 2180  
  2181 + function Role:getTowerBnousActive(update)
  2182 + if not update and self.towerBnousActive then
  2183 + return self.towerBnousActive
  2184 + end
  2185 + local towerInfo = self:getProperty("towerInfo")
  2186 + local towerLevel = {towerInfo.l or 1, towerInfo.l1 or 10001, towerInfo.l2 or 20001, towerInfo.l3 or 30001}
  2187 + local towerBnous = self:getProperty("towerBnous")
  2188 + local bnousCsv = csvdb["tower_battle_additionCsv"]
  2189 + self.towerBnousActive = {}
  2190 +
  2191 + for towerIdx, Set in pairs(towerBnous) do
  2192 + for id, _ in pairs(Set) do
  2193 + local data = bnousCsv[towerIdx][id]
  2194 + local effects = data.effect:toTableArraySec()
  2195 + for _, effect in pairs(effects) do
  2196 + local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4])
  2197 + if not self.towerBnousActive[pm1] then
  2198 + self.towerBnousActive[pm1] = {}
  2199 + end
  2200 + if pm1 == SystemBnousType.TowerBuff then
  2201 + if not self.towerBnousActive[pm1][pm2] then
  2202 + self.towerBnousActive[pm1][pm2] = {}
  2203 + end
  2204 + table.insert(self.towerBnousActive[pm1][pm2],pm3)
  2205 + elseif pm1 == SystemBnousType.Adv then
  2206 + if not self.towerBnousActive[pm1][pm4] then
  2207 + self.towerBnousActive[pm1][pm4] = {}
  2208 + end
  2209 + self.towerBnousActive[pm1][pm4][pm2] = (self.towerBnousActive[pm1][pm4][pm2] or 0) + pm3
  2210 + elseif pm1 == SystemBnousType.HangTime then
  2211 + if type(self.towerBnousActive[pm1]) == "table" then
  2212 + self.towerBnousActive[pm1] = 0
  2213 + end
  2214 + self.towerBnousActive[pm1] = self.towerBnousActive[pm1] + pm2
  2215 + else
  2216 + self.towerBnousActive[pm1][pm2] = (self.towerBnousActive[pm1][pm2] or 0) + pm3
  2217 + end
  2218 + end
  2219 + end
  2220 + end
  2221 +
  2222 + return self.towerBnousActive
  2223 + end
  2224 +
  2225 + function Role:getDeltaValue(result, value)
  2226 + if not result then return 0 end
  2227 + local delta = 0
  2228 + if result[1] and value then
  2229 + delta = math.floor(value * result[1] / 100)
  2230 + end
  2231 + if result[0] then
  2232 + delta = delta + result[0]
  2233 + end
  2234 + return delta
  2235 + end
  2236 +
  2237 + function Role:getBnousBattleBuff()
  2238 + local towerBnous = self:getTowerBnousActive()
  2239 + return towerBnous[SystemBnousType.TowerBuff]
  2240 + end
  2241 +
  2242 + function Role:getBnousCrusade(value)
  2243 + local towerBnous = self:getTowerBnousActive()
  2244 + return self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value)
  2245 + end
  2246 +
  2247 + function Role:getBnousDiner(type, value)
  2248 + local towerBnous = self:getTowerBnousActive()
  2249 + type = type or 1
  2250 + local result
  2251 + if type == 1 then
  2252 + result = towerBnous[SystemBnousType.DinerGet]
  2253 + elseif type == 2 then
  2254 + result = towerBnous[SystemBnousType.DinerLimit]
  2255 + elseif type == 3 then
  2256 + result = towerBnous[SystemBnousType.DinerSell]
  2257 + elseif type == 4 then
  2258 + result = towerBnous[SystemBnousType.DinerPrice]
  2259 + end
  2260 + return self:getDeltaValue(result, value)
  2261 + end
  2262 +
  2263 + function Role:getBnousAdv()
  2264 + local towerBnous = self:getTowerBnousActive()
  2265 + return towerBnous[SystemBnousType.Adv] or {}
  2266 + end
  2267 +
  2268 + function Role:getBnousHangTime()
  2269 + local towerBnous = self:getTowerBnousActive()
  2270 + return towerBnous[SystemBnousType.HangTime] or 0
  2271 + end
  2272 +
  2273 + function Role:getBnousPvpTicket()
  2274 + local towerBnous = self:getTowerBnousActive()
  2275 + return towerBnous[SystemBnousType.PvpTicket] or {}
  2276 + end
  2277 +
  2278 + function Role:getBnousSweep()
  2279 + local towerBnous = self:getTowerBnousActive()
  2280 + return towerBnous[SystemBnousType.SweepReward] or {}
  2281 + end
  2282 +
2155 2283 end
2156 2284  
2157 2285 return RolePlugin
2158 2286 \ No newline at end of file
... ...
src/models/RoleTask.lua
... ... @@ -191,7 +191,7 @@ local AchievListener = {
191 191 [TaskType.OverOderTask] = {{14}},
192 192 [TaskType.FoodSellGold] = {{15, f("count")}},
193 193 [TaskType.DinerPopular] = {{16, f("count")}},
194   - [TaskType.TowerPass] = {{17, f("level")}},
  194 + [TaskType.TowerPass] = {{17, f("count"), f("type")}},
195 195 [TaskType.OpenBox] = {{18, f("count")}},
196 196 [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}},
197 197 [TaskType.DinerTalentUp] = {{20, 1, f("type")}},
... ... @@ -249,6 +249,7 @@ local ActivityListener = {
249 249 [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}},
250 250 [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}},
251 251 [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}},
  252 + [TaskType.AdvCostPower] = {{Activity.ActivityType.Crisis, 3, f("count")}},
252 253 [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}},
253 254 [TaskType.AddItem] = {{Activity.ActivityType.BattleCommand, f("id"), f("count")}},
254 255 }
... ... @@ -492,7 +493,6 @@ function RoleTask.bind(Role)
492 493 [6] = true,
493 494 [7] = true,
494 495 [16] = true,
495   - [17] = true,
496 496 [19] = true,
497 497 [22] = true,
498 498 [23] = true,
... ...
src/models/RoleTimeReset.lua
... ... @@ -48,6 +48,12 @@ ResetFunc[&quot;CrossWeek&quot;] = function(self, notify, response)
48 48 response.dinerS = {}
49 49  
50 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 57 end
52 58  
53 59  
... ...