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 | 375 | TeamSystemType = { |
376 | 376 | Hang = 1, |
377 | 377 | BonusBattle = 2, |
378 | - Tower = 3, | |
379 | 378 | Dinner = 4, |
380 | 379 | FriendBattle = 5, |
381 | -} | |
382 | 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
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
... | ... | @@ -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 |
... | ... | @@ -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
... | ... | @@ -116,6 +116,7 @@ Role.schema = { |
116 | 116 | hangTeams = {"table", {}}, -- pve自选编队 |
117 | 117 | teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType |
118 | 118 | advTeams = {"table", {}}, -- 拾荒自选编队 |
119 | + towerTeams = {"table", {}}, -- 四个电波塔的队伍 | |
119 | 120 | |
120 | 121 | bonusStar = {"table", {}}, -- 奖励关卡 通关星星 {[id] = 1} 三个二进制位 表示三个星 从低到高 (1 << 0) (1 << 1) (1 << 2) 满星 (1 << 3) - 1 |
121 | 122 | |
... | ... | @@ -147,7 +148,8 @@ Role.schema = { |
147 | 148 | |
148 | 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 | 154 | spTask = {"table", {}}, -- 特殊任务 -- {id = status} |
153 | 155 | |
... | ... | @@ -369,6 +371,7 @@ function Role:data() |
369 | 371 | hangTeams = self:getProperty("hangTeams"), |
370 | 372 | teamIndex = self:getProperty("teamIndex"), |
371 | 373 | advTeams = self:getProperty("advTeams"), |
374 | + towerTeams = self:getProperty("towerTeams"), | |
372 | 375 | |
373 | 376 | bonusStar = self:getProperty("bonusStar"), |
374 | 377 | |
... | ... | @@ -386,6 +389,7 @@ function Role:data() |
386 | 389 | equips = self:getProperty("equips"), |
387 | 390 | boxL = self:getProperty("boxL"), |
388 | 391 | towerInfo = self:getProperty("towerInfo"), |
392 | + towerBnous = self:getProperty("towerBnous"), | |
389 | 393 | spTask = self:getProperty("spTask"), |
390 | 394 | dTask = self:getProperty("dTask"), |
391 | 395 | 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
src/models/RolePlugin.lua
... | ... | @@ -312,7 +312,6 @@ function RolePlugin.bind(Role) |
312 | 312 | end |
313 | 313 | |
314 | 314 | function Role:addPotion(params) |
315 | - dump(params) | |
316 | 315 | local pId = globalCsv.adv_item_potion[params.id] |
317 | 316 | local potionBag = self:getProperty("potionBag") |
318 | 317 | local origin = potionBag[pId] or 0 |
... | ... | @@ -1285,11 +1284,21 @@ function RolePlugin.bind(Role) |
1285 | 1284 | end |
1286 | 1285 | |
1287 | 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 | 1295 | local now = skynet.timex() |
1290 | 1296 | local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年 |
1291 | 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 | 1302 | local battleV = self:getTeamBattleValue(towerTeam.heros) |
1294 | 1303 | local score = (level * 10000 + ct) * 10000000 + battleV |
1295 | 1304 | |
... | ... | @@ -1303,21 +1312,23 @@ function RolePlugin.bind(Role) |
1303 | 1312 | } |
1304 | 1313 | local roleId = self:getProperty("id") |
1305 | 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 | 1317 | end) |
1309 | 1318 | end |
1310 | 1319 | |
1311 | - function Role:getTowerRank() | |
1320 | + function Role:getTowerRank(tType) | |
1321 | + tType = tType or 1 | |
1322 | + local info = TowerRankInfo[tType] | |
1312 | 1323 | local list = {} |
1313 | - local ids = redisproxy:zrevrange(RANK_TOWER, 0 , 99) | |
1324 | + local ids = redisproxy:zrevrange(info.rank, 0 , 99) | |
1314 | 1325 | local redret = {} |
1315 | 1326 | if ids and next(ids) then |
1316 | 1327 | redret = redisproxy:pipelining(function (red) |
1317 | 1328 | for i = 1, #ids do |
1318 | 1329 | local roleId = ids[i] |
1319 | 1330 | table.insert(list, {roleId = tonumber(roleId)}) |
1320 | - red:hget(RANK_TOWER_INFO, roleId) | |
1331 | + red:hget(info.rankInfo, roleId) | |
1321 | 1332 | end |
1322 | 1333 | end) |
1323 | 1334 | end |
... | ... | @@ -1326,7 +1337,7 @@ function RolePlugin.bind(Role) |
1326 | 1337 | player.format = nil |
1327 | 1338 | list[i].player = player |
1328 | 1339 | end |
1329 | - local rank = redisproxy:ZREVRANK(RANK_TOWER, self:getProperty("id")) | |
1340 | + local rank = redisproxy:ZREVRANK(info.rank, self:getProperty("id")) | |
1330 | 1341 | if not rank then |
1331 | 1342 | rank = -1 |
1332 | 1343 | else |
... | ... | @@ -1335,8 +1346,10 @@ function RolePlugin.bind(Role) |
1335 | 1346 | return {list = list, rank = rank} |
1336 | 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 | 1353 | if data then |
1341 | 1354 | local player = MsgPack.unpack(data) |
1342 | 1355 | return player.format |
... | ... | @@ -1556,6 +1569,19 @@ function RolePlugin.bind(Role) |
1556 | 1569 | }) |
1557 | 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 | 1585 | -- update |
1560 | 1586 | function Role:onRecoverTimer(now) |
1561 | 1587 | self:updateTimeReset(now, true) |
... | ... | @@ -2264,6 +2290,110 @@ function RolePlugin.bind(Role) |
2264 | 2290 | end |
2265 | 2291 | return result.data.content |
2266 | 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 | 2398 | end |
2269 | 2399 | ... | ... |
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["CrossWeek"] = 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 | ... | ... |