Commit 761b3ea86e0ead6c693edc764761cc028d7bffe3

Authored by chenyueqi
1 parent 40b19300

再改一波电波塔整容相关信息

src/GlobalVar.lua
... ... @@ -369,13 +369,8 @@ DrawCardType = {
369 369 TeamSystemType = {
370 370 Hang = 1,
371 371 BonusBattle = 2,
372   - Tower = 3,
373 372 Dinner = 4,
374 373 FriendBattle = 5,
375   - Adv = 6,
376   - Tower1 = 7,
377   - Tower2 = 8,
378   - Tower3 = 9,
379 374 }
380 375  
381 376 -- 某个功能对其他系统功能的加成类型
... ...
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
... ...
src/actions/TowerAction.lua
... ... @@ -25,7 +25,7 @@ function _M.startBattleRpc(agent, data)
25 25 local id = msg.id
26 26 local towerType = math.floor(id / 10000)
27 27  
28   - if not id or not towerType or towerType < 0 or towerType > 3 then return 0 end
  28 + if not id or towerType < 0 or towerType > 3 then return 0 end
29 29 if not role:isFuncUnlock(FuncUnlock.Tower) then return 1 end
30 30  
31 31 local towerInfo = role:getProperty("towerInfo")
... ... @@ -35,7 +35,20 @@ function _M.startBattleRpc(agent, data)
35 35 if towerType == 2 and ((towerInfo.l2 or 20001) ~= id or (towerInfo.l or 1) < 10) then return 2 end -- 层数不对
36 36 if towerType == 3 and ((towerInfo.l3 or 30001) ~= id or (towerInfo.l or 1) < 10) then return 2 end -- 层数不对
37 37  
38   - if not csvdb["tower_battleCsv"][id] then return end
  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
  51 +
39 52 local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t)
40 53 --if curCount < 1 then return end -- 没有次数返回
41 54  
... ... @@ -78,7 +91,8 @@ function _M.endBattleRpc(agent, data)
78 91 -- 防作弊
79 92 if not role:checkBattleCheat("tower", {
80 93 isWin = msg.starNum and msg.starNum > 0,
81   - info = msg.info
  94 + info = msg.info,
  95 + tower = towerType + 1
82 96 }) then
83 97 SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1}))
84 98 return true
... ... @@ -127,6 +141,7 @@ function _M.endBattleRpc(agent, data)
127 141 info = msg.info,
128 142 reward = reward,
129 143 rank = rank,
  144 + tower = towerType + 1
130 145 })
131 146 role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id})
132 147  
... ...
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  
... ... @@ -369,6 +370,7 @@ function Role:data()
369 370 hangTeams = self:getProperty("hangTeams"),
370 371 teamIndex = self:getProperty("teamIndex"),
371 372 advTeams = self:getProperty("advTeams"),
  373 + towerTeams = self:getProperty("towerTeams"),
372 374  
373 375 bonusStar = self:getProperty("bonusStar"),
374 376  
... ...
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/RolePlugin.lua
... ... @@ -1270,10 +1270,10 @@ function RolePlugin.bind(Role)
1270 1270  
1271 1271 local StdTowerRankTime = toUnixtime("2019010100")
1272 1272 local TowerRankInfo = {
1273   - [1] = {teamType = TeamSystemType.Tower, rank = RANK_TOWER, rankInfo = RANK_TOWER_INFO},
1274   - [2] = {teamType = TeamSystemType.Tower1, rank = RANK_TOWER1, rankInfo = RANK_TOWER1_INFO},
1275   - [3] = {teamType = TeamSystemType.Tower2, rank = RANK_TOWER2, rankInfo = RANK_TOWER2_INFO},
1276   - [4] = {teamType = TeamSystemType.Tower3, rank = RANK_TOWER3, rankInfo = RANK_TOWER3_INFO},
  1273 + [1] = {rank = RANK_TOWER, rankInfo = RANK_TOWER_INFO},
  1274 + [2] = {rank = RANK_TOWER1, rankInfo = RANK_TOWER1_INFO},
  1275 + [3] = {rank = RANK_TOWER2, rankInfo = RANK_TOWER2_INFO},
  1276 + [4] = {rank = RANK_TOWER3, rankInfo = RANK_TOWER3_INFO},
1277 1277 }
1278 1278 function Role:setTowerRank(level,tType)
1279 1279 tType = tType or 1
... ... @@ -1283,7 +1283,7 @@ function RolePlugin.bind(Role)
1283 1283  
1284 1284  
1285 1285 local info = TowerRankInfo[tType]
1286   - local towerTeam = self:getTeamFormatByType(info.teamType)
  1286 + local towerTeam = self:getTowerTeamFormat(tostring(tType))
1287 1287 local battleV = self:getTeamBattleValue(towerTeam.heros)
1288 1288 local score = (level * 10000 + ct) * 10000000 + battleV
1289 1289  
... ... @@ -1554,6 +1554,19 @@ function RolePlugin.bind(Role)
1554 1554 })
1555 1555 end
1556 1556  
  1557 + -- 设置电波塔阵容
  1558 + function Role:getTowerTeamFormat(teamIdx)
  1559 + local teams = self:getProperty("towerTeams") or {}
  1560 + local team = teams[tostring(teamIdx)] or {}
  1561 + return team
  1562 + end
  1563 +
  1564 + function Role:setTowerTeamFormat(teamIdx, team)
  1565 + local teams = self:getProperty("towerTeams") or {}
  1566 + teams[tostring(teamIdx)] = team
  1567 + self:updateProperty({field = "towerTeams", value = teams, notNotify = false})
  1568 + end
  1569 +
1557 1570 -- update
1558 1571 function Role:onRecoverTimer(now)
1559 1572 self:updateTimeReset(now, true)
... ...