Commit 9f8192cc46d1c9ecce7abbd3dd2740abb82e44da

Authored by zhouhaihai
2 parents 763ecaff f854f3a3

Merge branch 'tr/bugfix' into tr/publish/release

* tr/bugfix:
  电波塔对贩卖食材的金币加成计算错误
  电波塔对贩卖食材金币的加成作用于金币总收益,不是对金币价格
  电波塔加成错误
  bug修复:电波塔排行榜协议报错
  电波塔对食材的加成计算错误
  物资危机 增加消耗体力 类型
  电波塔战斗激活消息bug
  diner 加速错误
  电波塔加成算法解析字段方法修正
  电波塔bug
  电波塔分塔开放条件读表
  再改一波电波塔整容相关信息
  电波塔激活加成效果后对各个系统的加成
  tower GM参数值修正
  计算电波塔层数的加成效果
  电波塔属性塔功能部分功能草稿

# Conflicts:
#	src/csvdata
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
... ... @@ -278,6 +278,7 @@ function _M.startHangRpc(agent, data)
278 278 end
279 279 adv_idle_time = adv_idle_time * 60
280 280  
  281 +
281 282 local advHang = role:getProperty("advHang")
282 283 if advHang[chapterId] then return 3 end --正在挂机
283 284  
... ... @@ -463,6 +464,15 @@ function _M.endHangRpc(agent, data)
463 464 for itemId, count in pairs(idleReward) do
464 465 idleReward[itemId] = count * adv_idle_reward_coef
465 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 476 reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}})
467 477 else
468 478 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
... ... @@ -487,13 +487,25 @@ function _M.advit(role, pms)
487 487 end
488 488  
489 489  
490   -table.insert(helpDes, {"爬塔到指定层", "tower", "层数"})
  490 +table.insert(helpDes, {"爬塔到指定层", "tower", "塔id", "层数"})
491 491 function _M.tower(role, pms)
492   - local level = tonum(pms.pm1, 1)
  492 + local tType = tonum(pms.pm1, 1)
  493 + local level = tonum(pms.pm2, 1)
  494 + local layer = (tType - 1) * 10000 + level
493 495 if not csvdb["tower_battleCsv"][level] then return "不存在" end
494   - role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}})
495   -
496   - role:mylog("gm_action", {desc = "tower", int1 = level, key1 = pms.sender})
  496 + local values = role:getProperty("towerInfo")
  497 + if tType == 1 then
  498 + values.l = layer
  499 + elseif tType == 2 then
  500 + values.l1 = layer
  501 + elseif tType == 3 then
  502 + values.l2 = layer
  503 + elseif tType == 4 then
  504 + values.l3 = layer
  505 + end
  506 + role:updateProperty({field = "towerInfo", value = values})
  507 +
  508 + role:mylog("gm_action", {desc = "tower", int1 = tType, int2 = layer, key1 = pms.sender})
497 509  
498 510 return "成功"
499 511 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
... ... @@ -376,8 +381,9 @@ function _M.getRewardRpc(agent , data)
376 381 table.clear(items)
377 382 local hangInfo = role:getProperty("hangInfo")
378 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 387 hangInfo.coinTime = nowTime
382 388 hangInfo.itemTime = nowTime
383 389 role:updateProperty({field = "hangBag", value = items})
... ... @@ -508,7 +514,7 @@ function _M.buyBonusCountRpc(agent, data)
508 514 return true
509 515 end
510 516  
511   -local function bonusWinReward(role, bonusData, rewardType, count)
  517 +local function bonusWinReward(role, bonusData, rewardType, count, sweep)
512 518 count = count or 1
513 519  
514 520 local reward, change = {}
... ... @@ -548,6 +554,13 @@ local function bonusWinReward(role, bonusData, rewardType, count)
548 554 end
549 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 564 reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = bonusData.id}})
552 565 role:checkTaskEnter("BonusPass", {id = bonusData.id, count = count})
553 566 return reward, change
... ... @@ -589,7 +602,7 @@ function _M.startBonusBattleRpc(agent, data)
589 602 bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count
590 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 606 SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change}))
594 607  
595 608 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  
... ...
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
... ... @@ -179,8 +179,13 @@ function Diner:checkDinerTask(typ, count, param1, param2, notNotify)
179 179 return dirty
180 180 end
181 181  
182   -function Diner:calSellReward(sell, delta, dishData)
  182 +function Diner:calSellReward(sell, delta, dishData, isExpedite)
183 183 local reward = sell.reward or ""
  184 +
  185 + if isExpedite then
  186 + reward = ""
  187 + end
  188 +
184 189 local popular = 0
185 190 if delta <= 0 then
186 191 return reward, popular
... ... @@ -225,10 +230,16 @@ function Diner:calSellReward(sell, delta, dishData)
225 230 end
226 231 upValue[-1] = (upValue[-1] or 0) + collectAdd
227 232  
  233 + -- 电波塔加成
  234 + local goldCount = self.owner:getBnousDiner(4,addReward[ItemId.Gold])
  235 +
228 236 for id, count in pairs(addReward) do
229 237 addReward[id] = math.floor(count * (1 + (upValue[id] or 0) / 100))
230 238 reward = reward:incrv(id, addReward[id])
231 239 end
  240 +
  241 + reward = reward:incrv(ItemId.Gold, goldCount)
  242 +
232 243 popular = math.floor(popular * (1 + (upValue[-1] or 0) / 100))
233 244  
234 245 return reward, popular
... ... @@ -245,7 +256,7 @@ function Diner:updateSell(slot, calOnly)
245 256 local deltaTime = 0
246 257 local deltaCount = 0
247 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 261 deltaCount = math.floor(timePass / sellTime)
251 262 if deltaCount < sell.count then
... ... @@ -284,11 +295,11 @@ function Diner:expediteSell(slot)
284 295 local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level]
285 296 local expediteCount = 0
286 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 299 expediteCount = math.floor(expediteTime / sellTime)
289 300 expediteCount = math.min(expediteCount, sell.count)
290 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 303 local deltaTime = math.floor(expediteTime - sellTime * expediteCount)
293 304 if expediteCount > 0 then
294 305 sells[slot].time = sell.time - deltaTime
... ...
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,110 @@ 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 + if data then
  2195 + local effects = data.effect:toTableArraySec()
  2196 + for _, effect in pairs(effects) do
  2197 + local pm1, pm2, pm3, pm4 = tonumber(effect[1]), tonumber(effect[2]), tonumber(effect[3]), tonumber(effect[4])
  2198 + if not self.towerBnousActive[pm1] then
  2199 + self.towerBnousActive[pm1] = {}
  2200 + end
  2201 + if pm1 == SystemBnousType.TowerBuff then
  2202 + if not self.towerBnousActive[pm1][pm2] then
  2203 + self.towerBnousActive[pm1][pm2] = {}
  2204 + end
  2205 + table.insert(self.towerBnousActive[pm1][pm2],pm3)
  2206 + elseif pm1 == SystemBnousType.Adv then
  2207 + if not self.towerBnousActive[pm1][pm4] then
  2208 + self.towerBnousActive[pm1][pm4] = {}
  2209 + end
  2210 + self.towerBnousActive[pm1][pm4][pm2] = (self.towerBnousActive[pm1][pm4][pm2] or 0) + pm3
  2211 + elseif pm1 == SystemBnousType.HangTime then
  2212 + if type(self.towerBnousActive[pm1]) == "table" then
  2213 + self.towerBnousActive[pm1] = 0
  2214 + end
  2215 + self.towerBnousActive[pm1] = self.towerBnousActive[pm1] + pm2
  2216 + else
  2217 + self.towerBnousActive[pm1][pm2] = (self.towerBnousActive[pm1][pm2] or 0) + pm3
  2218 + end
  2219 + end
  2220 + end
  2221 + end
  2222 + end
  2223 +
  2224 + return self.towerBnousActive
  2225 + end
  2226 +
  2227 + function Role:getDeltaValue(result, value)
  2228 + if not result then return 0 end
  2229 + local delta = 0
  2230 + if result[1] and value then
  2231 + delta = math.floor(value * result[1] / 100)
  2232 + end
  2233 + if result[0] then
  2234 + delta = delta + result[0]
  2235 + end
  2236 + return delta
  2237 + end
  2238 +
  2239 + function Role:getBnousBattleBuff()
  2240 + local towerBnous = self:getTowerBnousActive()
  2241 + return towerBnous[SystemBnousType.TowerBuff]
  2242 + end
  2243 +
  2244 + function Role:getBnousCrusade(value)
  2245 + local towerBnous = self:getTowerBnousActive()
  2246 + return self:getDeltaValue(towerBnous[SystemBnousType.CrusadeTask], value)
  2247 + end
  2248 +
  2249 + function Role:getBnousDiner(type, value)
  2250 + local towerBnous = self:getTowerBnousActive()
  2251 + type = type or 1
  2252 + local result
  2253 + if type == 1 then
  2254 + result = towerBnous[SystemBnousType.DinerGet]
  2255 + elseif type == 2 then
  2256 + result = towerBnous[SystemBnousType.DinerLimit]
  2257 + elseif type == 3 then
  2258 + result = towerBnous[SystemBnousType.DinerSell]
  2259 + elseif type == 4 then
  2260 + result = towerBnous[SystemBnousType.DinerPrice]
  2261 + end
  2262 + return self:getDeltaValue(result, value)
  2263 + end
  2264 +
  2265 + function Role:getBnousAdv()
  2266 + local towerBnous = self:getTowerBnousActive()
  2267 + return towerBnous[SystemBnousType.Adv] or {}
  2268 + end
  2269 +
  2270 + function Role:getBnousHangTime()
  2271 + local towerBnous = self:getTowerBnousActive()
  2272 + return towerBnous[SystemBnousType.HangTime] or 0
  2273 + end
  2274 +
  2275 + function Role:getBnousPvpTicket()
  2276 + local towerBnous = self:getTowerBnousActive()
  2277 + return towerBnous[SystemBnousType.PvpTicket] or {}
  2278 + end
  2279 +
  2280 + function Role:getBnousSweep()
  2281 + local towerBnous = self:getTowerBnousActive()
  2282 + return towerBnous[SystemBnousType.SweepReward] or {}
  2283 + end
  2284 +
2155 2285 end
2156 2286  
2157 2287 return RolePlugin
2158 2288 \ 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  
... ...