Commit 3cf0ef0e43e6c8257be5ed1ae9e15dd36af494d7
Merge branch 'tr/bugfix-qa' into tr/publish/qa-out
Showing
19 changed files
with
363 additions
and
53 deletions
Show diff stats
src/GlobalVar.lua
@@ -372,7 +372,20 @@ DrawCardType = { | @@ -372,7 +372,20 @@ DrawCardType = { | ||
372 | TeamSystemType = { | 372 | TeamSystemType = { |
373 | Hang = 1, | 373 | Hang = 1, |
374 | BonusBattle = 2, | 374 | BonusBattle = 2, |
375 | - Tower = 3, | ||
376 | Dinner = 4, | 375 | Dinner = 4, |
377 | FriendBattle = 5, | 376 | FriendBattle = 5, |
378 | -} | ||
379 | \ No newline at end of file | 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,6 +145,7 @@ actionCodes = { | ||
145 | Tower_rankRpc = 353, | 145 | Tower_rankRpc = 353, |
146 | Tower_bugCountRpc = 354, | 146 | Tower_bugCountRpc = 354, |
147 | Tower_rankInfoRpc = 355, | 147 | Tower_rankInfoRpc = 355, |
148 | + Tower_activeTowerBonusRpc = 356, | ||
148 | 149 | ||
149 | Car_makePotionRpc = 400, | 150 | Car_makePotionRpc = 400, |
150 | Car_equipUpRpc = 401, | 151 | Car_equipUpRpc = 401, |
src/RedisKeys.lua
@@ -26,6 +26,15 @@ RANK_TYPE = { | @@ -26,6 +26,15 @@ RANK_TYPE = { | ||
26 | RANK_TOWER = "rank:tower" | 26 | RANK_TOWER = "rank:tower" |
27 | RANK_TOWER_INFO = "rank:tower:info" | 27 | RANK_TOWER_INFO = "rank:tower:info" |
28 | 28 | ||
29 | +RANK_TOWER1 = "rank:tower1" | ||
30 | +RANK_TOWER1_INFO = "rank:tower1:info" | ||
31 | + | ||
32 | +RANK_TOWER2 = "rank:tower2" | ||
33 | +RANK_TOWER2_INFO = "rank:tower2:info" | ||
34 | + | ||
35 | +RANK_TOWER3 = "rank:tower3" | ||
36 | +RANK_TOWER3_INFO = "rank:tower3:info" | ||
37 | + | ||
29 | -- adv | 38 | -- adv |
30 | RANK_ADV = {"rank:adv1", "rank:adv2"} | 39 | RANK_ADV = {"rank:adv1", "rank:adv2"} |
31 | RANK_ADV_INFO = "rank:adv:info" | 40 | RANK_ADV_INFO = "rank:adv:info" |
src/actions/AdvAction.lua
@@ -276,7 +276,9 @@ function _M.startHangRpc(agent, data) | @@ -276,7 +276,9 @@ function _M.startHangRpc(agent, data) | ||
276 | if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then | 276 | if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then |
277 | return 2 | 277 | return 2 |
278 | end | 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 | local advHang = role:getProperty("advHang") | 283 | local advHang = role:getProperty("advHang") |
282 | if advHang[chapterId] then return 3 end --正在挂机 | 284 | if advHang[chapterId] then return 3 end --正在挂机 |
@@ -416,7 +418,8 @@ function _M.endHangRpc(agent, data) | @@ -416,7 +418,8 @@ function _M.endHangRpc(agent, data) | ||
416 | if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then | 418 | if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then |
417 | return 2 | 419 | return 2 |
418 | end | 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 | local reward, isFull, change, heroFaithMap | 424 | local reward, isFull, change, heroFaithMap |
422 | local heroCnt = 0 | 425 | local heroCnt = 0 |
@@ -463,6 +466,15 @@ function _M.endHangRpc(agent, data) | @@ -463,6 +466,15 @@ function _M.endHangRpc(agent, data) | ||
463 | for itemId, count in pairs(idleReward) do | 466 | for itemId, count in pairs(idleReward) do |
464 | idleReward[itemId] = count * adv_idle_reward_coef | 467 | idleReward[itemId] = count * adv_idle_reward_coef |
465 | end | 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 | reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) | 478 | reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) |
467 | else | 479 | else |
468 | if cancel then | 480 | if cancel then |
src/actions/DinerAction.lua
@@ -75,7 +75,8 @@ function _M.addSellRpc( agent, data ) | @@ -75,7 +75,8 @@ function _M.addSellRpc( agent, data ) | ||
75 | sells[slot].count = count | 75 | sells[slot].count = count |
76 | sells[slot].time = skynet.timex() - calSell.deltaTime | 76 | sells[slot].time = skynet.timex() - calSell.deltaTime |
77 | 77 | ||
78 | - local needTime = sells[slot].count * dishData.sell_time + sells[slot].time - skynet.timex() | 78 | + local timeSub = role:getBnousDiner(3,dishData.sell_time) |
79 | + local needTime = sells[slot].count * (dishData.sell_time + timeSub) + sells[slot].time - skynet.timex() | ||
79 | role:pushMsg({type = "food", slot = slot, time = needTime}) | 80 | role:pushMsg({type = "food", slot = slot, time = needTime}) |
80 | 81 | ||
81 | -- 检查解锁的顾客 | 82 | -- 检查解锁的顾客 |
@@ -742,11 +743,15 @@ function _M.getGreenhouseRpc( agent, data ) | @@ -742,11 +743,15 @@ function _M.getGreenhouseRpc( agent, data ) | ||
742 | local now = skynet.timex() | 743 | local now = skynet.timex() |
743 | local gfood = role.dinerData:getProperty("gfood") | 744 | local gfood = role.dinerData:getProperty("gfood") |
744 | if not next(gfood) then return end | 745 | if not next(gfood) then return end |
746 | + | ||
747 | + local timeAdd = role:getBnousDiner(2,globalCsv.diner_get_food_time_max) | ||
748 | + | ||
745 | for k , v in pairs(gfood) do | 749 | for k , v in pairs(gfood) do |
746 | local itemId = v.id | 750 | local itemId = v.id |
747 | local st = v.st | 751 | local st = v.st |
748 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 | 752 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 |
749 | - local endTime = st + globalCsv.diner_get_food_time_max | 753 | + speed = speed + role:getBnousDiner(1,speed) |
754 | + local endTime = st + globalCsv.diner_get_food_time_max + timeAdd | ||
750 | local endTime2 = math.min(now, endTime) | 755 | local endTime2 = math.min(now, endTime) |
751 | reward[itemId] = math.floor((endTime2 - st) / speed) | 756 | reward[itemId] = math.floor((endTime2 - st) / speed) |
752 | if endTime2 == endTime then | 757 | if endTime2 == endTime then |
src/actions/GmAction.lua
@@ -483,13 +483,25 @@ function _M.advit(role, pms) | @@ -483,13 +483,25 @@ function _M.advit(role, pms) | ||
483 | end | 483 | end |
484 | 484 | ||
485 | 485 | ||
486 | -table.insert(helpDes, {"爬塔到指定层", "tower", "层数"}) | 486 | +table.insert(helpDes, {"爬塔到指定层", "tower", "塔id", "层数"}) |
487 | function _M.tower(role, pms) | 487 | function _M.tower(role, pms) |
488 | - local level = tonum(pms.pm1, 1) | 488 | + local tType = tonum(pms.pm1, 1) |
489 | + local level = tonum(pms.pm2, 1) | ||
490 | + local layer = (tType - 1) * 10000 + level | ||
489 | if not csvdb["tower_battleCsv"][level] then return "不存在" end | 491 | if not csvdb["tower_battleCsv"][level] then return "不存在" end |
490 | - role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}}) | ||
491 | - | ||
492 | - role:mylog("gm_action", {desc = "tower", int1 = level, key1 = pms.sender}) | 492 | + local values = role:getProperty("towerInfo") |
493 | + if tType == 1 then | ||
494 | + values.l = layer | ||
495 | + elseif tType == 2 then | ||
496 | + values.l1 = layer | ||
497 | + elseif tType == 3 then | ||
498 | + values.l2 = layer | ||
499 | + elseif tType == 4 then | ||
500 | + values.l3 = layer | ||
501 | + end | ||
502 | + role:updateProperty({field = "towerInfo", value = values}) | ||
503 | + | ||
504 | + role:mylog("gm_action", {desc = "tower", int1 = tType, int2 = layer, key1 = pms.sender}) | ||
493 | 505 | ||
494 | return "成功" | 506 | return "成功" |
495 | end | 507 | end |
src/actions/HangAction.lua
@@ -326,6 +326,7 @@ function _M.roleFormatRpc(agent , data) | @@ -326,6 +326,7 @@ function _M.roleFormatRpc(agent , data) | ||
326 | local index = msg.index -- 阵容索引 | 326 | local index = msg.index -- 阵容索引 |
327 | local title = msg.title -- 阵容名称 | 327 | local title = msg.title -- 阵容名称 |
328 | local tactics = msg.tactics -- 战术 | 328 | local tactics = msg.tactics -- 战术 |
329 | + local tower = msg.tower | ||
329 | local team = {} | 330 | local team = {} |
330 | for slot, heroId in pairs(msg.heros) do | 331 | for slot, heroId in pairs(msg.heros) do |
331 | if not role.heros[heroId] then | 332 | if not role.heros[heroId] then |
@@ -361,7 +362,11 @@ function _M.roleFormatRpc(agent , data) | @@ -361,7 +362,11 @@ function _M.roleFormatRpc(agent , data) | ||
361 | team.tactics = msg.tactics | 362 | team.tactics = msg.tactics |
362 | end | 363 | end |
363 | 364 | ||
364 | - role:setTeamFormat(index, team) | 365 | + if tower then |
366 | + role:setTowerTeamFormat(index, team) | ||
367 | + else | ||
368 | + role:setTeamFormat(index, team) | ||
369 | + end | ||
365 | 370 | ||
366 | SendPacket(actionCodes.Hang_roleFormatRpc, '') | 371 | SendPacket(actionCodes.Hang_roleFormatRpc, '') |
367 | return true | 372 | return true |
@@ -508,7 +513,7 @@ function _M.buyBonusCountRpc(agent, data) | @@ -508,7 +513,7 @@ function _M.buyBonusCountRpc(agent, data) | ||
508 | return true | 513 | return true |
509 | end | 514 | end |
510 | 515 | ||
511 | -local function bonusWinReward(role, bonusData, rewardType, count) | 516 | +local function bonusWinReward(role, bonusData, rewardType, count, sweep) |
512 | count = count or 1 | 517 | count = count or 1 |
513 | 518 | ||
514 | local reward, change = {} | 519 | local reward, change = {} |
@@ -548,6 +553,13 @@ local function bonusWinReward(role, bonusData, rewardType, count) | @@ -548,6 +553,13 @@ local function bonusWinReward(role, bonusData, rewardType, count) | ||
548 | end | 553 | end |
549 | end | 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 | reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = bonusData.id}}) | 563 | reward, change = role:award(reward, {log = {desc = "bonusBattle", int1 = bonusData.id}}) |
552 | role:checkTaskEnter("BonusPass", {id = bonusData.id, count = count}) | 564 | role:checkTaskEnter("BonusPass", {id = bonusData.id, count = count}) |
553 | return reward, change | 565 | return reward, change |
@@ -589,7 +601,7 @@ function _M.startBonusBattleRpc(agent, data) | @@ -589,7 +601,7 @@ function _M.startBonusBattleRpc(agent, data) | ||
589 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count | 601 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + count |
590 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | 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 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) | 605 | SendPacket(actionCodes.Hang_startBonusBattleRpc, MsgPack.pack({reward = reward, change = change})) |
594 | 606 | ||
595 | role:checkTaskEnter("BonusQuick", {count = count}) | 607 | role:checkTaskEnter("BonusQuick", {count = count}) |
src/actions/RadioAction.lua
@@ -95,8 +95,9 @@ function _M.startQuestRpc(agent, data) | @@ -95,8 +95,9 @@ function _M.startQuestRpc(agent, data) | ||
95 | return 5 | 95 | return 5 |
96 | end | 96 | end |
97 | -- start quest, set finish time | 97 | -- start quest, set finish time |
98 | + local timeSub = role:getBnousCrusade(config.time) | ||
98 | local taskData = {} | 99 | local taskData = {} |
99 | - taskData["time"] = skynet.timex() + config.time | 100 | + taskData["time"] = skynet.timex() + config.time + timeSub |
100 | taskData["heros"] = heros | 101 | taskData["heros"] = heros |
101 | radioTask[id] = taskData | 102 | radioTask[id] = taskData |
102 | role:updateProperty({field="radioTask", value=radioTask, notNotify=true}) | 103 | role:updateProperty({field="radioTask", value=radioTask, notNotify=true}) |
src/actions/RoleAction.lua
@@ -745,6 +745,7 @@ function _M.openSpeedUpBoxRpc(agent, data) | @@ -745,6 +745,7 @@ function _M.openSpeedUpBoxRpc(agent, data) | ||
745 | for k , v in pairs(gfood) do | 745 | for k , v in pairs(gfood) do |
746 | local itemId = v.id | 746 | local itemId = v.id |
747 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 | 747 | local speed = globalCsv.diner_get_food_speed[csvdb["itemCsv"][itemId].quality] * buildingData.speed / 100 |
748 | + speed = speed + role:getBnousDiner(1,speed) | ||
748 | reward[itemId] = (reward[itemId] or 0) + math.floor((time / speed) * count) | 749 | reward[itemId] = (reward[itemId] or 0) + math.floor((time / speed) * count) |
749 | end | 750 | end |
750 | else | 751 | else |
src/actions/TowerAction.lua
@@ -23,14 +23,32 @@ function _M.startBattleRpc(agent, data) | @@ -23,14 +23,32 @@ function _M.startBattleRpc(agent, data) | ||
23 | local role = agent.role | 23 | local role = agent.role |
24 | local msg = MsgPack.unpack(data) | 24 | local msg = MsgPack.unpack(data) |
25 | local id = msg.id | 25 | local id = msg.id |
26 | - | ||
27 | - if not role:isFuncUnlock(FuncUnlock.Tower) then return end | 26 | + local towerType = math.floor(id / 10000) |
27 | + | ||
28 | + if not id or towerType < 0 or towerType > 3 then return 0 end | ||
29 | + if not role:isFuncUnlock(FuncUnlock.Tower) then return 1 end | ||
28 | 30 | ||
29 | local towerInfo = role:getProperty("towerInfo") | 31 | local towerInfo = role:getProperty("towerInfo") |
30 | 32 | ||
31 | - if towerInfo.l ~= id then return end -- 层数不对 | 33 | + if towerType == 0 and (towerInfo.l or 1) ~= id then return 2 end -- 层数不对 |
34 | + if towerType == 1 and ((towerInfo.l1 or 10001) ~= id or (towerInfo.l or 1) <= globalCsv.tower_open[towerType]) then return 2 end -- 层数不对 | ||
35 | + if towerType == 2 and ((towerInfo.l2 or 20001) ~= id or (towerInfo.l or 1) <= globalCsv.tower_open[towerType]) then return 2 end -- 层数不对 | ||
36 | + if towerType == 3 and ((towerInfo.l3 or 30001) ~= id or (towerInfo.l or 1) <= globalCsv.tower_open[towerType]) then return 2 end -- 层数不对 | ||
37 | + | ||
38 | + if not csvdb["tower_battleCsv"][id] then return 4 end | ||
39 | + | ||
40 | + local teams = role:getTowerTeamFormat(towerType + 1) | ||
41 | + if not next(teams) then return 5 end | ||
42 | + | ||
43 | + if towerType ~= 0 then | ||
44 | + for _, heroId in pairs(teams.heros) do | ||
45 | + local hero = role.heros[heroId] | ||
46 | + if not hero then return 6 end | ||
47 | + local unit = csvdb["unitCsv"][hero:getProperty("type")] | ||
48 | + if unit.camp ~= towerType then return 7 end | ||
49 | + end | ||
50 | + end | ||
32 | 51 | ||
33 | - if not csvdb["tower_battleCsv"][id] then return end | ||
34 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) | 52 | local curCount, nextTime = getUpdateTime(towerInfo.c, towerInfo.t) |
35 | --if curCount < 1 then return end -- 没有次数返回 | 53 | --if curCount < 1 then return end -- 没有次数返回 |
36 | 54 | ||
@@ -57,18 +75,24 @@ function _M.endBattleRpc(agent, data) | @@ -57,18 +75,24 @@ function _M.endBattleRpc(agent, data) | ||
57 | local key = msg.key | 75 | local key = msg.key |
58 | local passTime = msg.passTime | 76 | local passTime = msg.passTime |
59 | 77 | ||
78 | + local curTower = csvdb["tower_battleCsv"][id] | ||
79 | + if not curTower then return 2 end | ||
80 | + | ||
60 | local towerInfo = role:getProperty("towerInfo") | 81 | local towerInfo = role:getProperty("towerInfo") |
61 | - if towerInfo.l ~= id or not towerInfo.k or towerInfo.k ~= key then | 82 | + local towerType = math.floor(id / 10000) |
83 | + local towerLevel = {[0] = (towerInfo.l or 1), [1] = (towerInfo.l1 or 10001), [2] = (towerInfo.l2 or 20001), [3] = (towerInfo.l3 or 30001)} | ||
84 | + local curLevel = towerLevel[towerType] | ||
85 | + | ||
86 | + if curLevel ~= id or not towerInfo.k or towerInfo.k ~= key then | ||
62 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) | 87 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) |
63 | return true | 88 | return true |
64 | end | 89 | end |
65 | - local curTower = csvdb["tower_battleCsv"][id] | ||
66 | - if not curTower then return 2 end | ||
67 | 90 | ||
68 | -- 防作弊 | 91 | -- 防作弊 |
69 | if not role:checkBattleCheat("tower", { | 92 | if not role:checkBattleCheat("tower", { |
70 | isWin = msg.starNum and msg.starNum > 0, | 93 | isWin = msg.starNum and msg.starNum > 0, |
71 | - info = msg.info | 94 | + info = msg.info, |
95 | + tower = towerType + 1 | ||
72 | }) then | 96 | }) then |
73 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) | 97 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({errorCode = 1})) |
74 | return true | 98 | return true |
@@ -81,11 +105,21 @@ function _M.endBattleRpc(agent, data) | @@ -81,11 +105,21 @@ function _M.endBattleRpc(agent, data) | ||
81 | if msg.starNum and msg.starNum > 0 then --win | 105 | if msg.starNum and msg.starNum > 0 then --win |
82 | curCount = math.min(curCount + 1, globalCsv.tower_count_limit) -- 返还次数 | 106 | curCount = math.min(curCount + 1, globalCsv.tower_count_limit) -- 返还次数 |
83 | --排行榜 | 107 | --排行榜 |
84 | - role:setTowerRank(towerInfo.l) | 108 | + role:setTowerRank(curLevel % 10000, towerType + 1) |
85 | 109 | ||
86 | - towerInfo.l = towerInfo.l + 1 | 110 | + curLevel = curLevel + 1 |
87 | reward, change = role:award(curTower.reward, {log = {desc = "towerBattle", int1 = id}}) | 111 | reward, change = role:award(curTower.reward, {log = {desc = "towerBattle", int1 = id}}) |
88 | - role:checkTaskEnter("TowerPass", {level = towerInfo.l - 1}) | 112 | + role:checkTaskEnter("TowerPass", {count = 1, type = towerType + 1}) |
113 | + end | ||
114 | + | ||
115 | + if towerType == 0 then | ||
116 | + towerInfo.l = curLevel | ||
117 | + elseif towerType == 1 then | ||
118 | + towerInfo.l1 = curLevel | ||
119 | + elseif towerType == 2 then | ||
120 | + towerInfo.l2 = curLevel | ||
121 | + elseif towerType == 3 then | ||
122 | + towerInfo.l3 = curLevel | ||
89 | end | 123 | end |
90 | 124 | ||
91 | towerInfo.c = curCount | 125 | towerInfo.c = curCount |
@@ -93,8 +127,9 @@ function _M.endBattleRpc(agent, data) | @@ -93,8 +127,9 @@ function _M.endBattleRpc(agent, data) | ||
93 | towerInfo.k = nil | 127 | towerInfo.k = nil |
94 | role:updateProperty({field = "towerInfo", value = towerInfo}) | 128 | role:updateProperty({field = "towerInfo", value = towerInfo}) |
95 | 129 | ||
96 | - | ||
97 | - local rank = redisproxy:ZREVRANK(RANK_TOWER, role:getProperty("id")) | 130 | + local RankTower = {[0] = RANK_TOWER,[1] = RANK_TOWER1,[2] = RANK_TOWER2,[3] = RANK_TOWER3} |
131 | + local rankName = RankTower[towerType] | ||
132 | + local rank = redisproxy:ZREVRANK(rankName, role:getProperty("id")) | ||
98 | if not rank then | 133 | if not rank then |
99 | rank = -1 | 134 | rank = -1 |
100 | else | 135 | else |
@@ -106,6 +141,7 @@ function _M.endBattleRpc(agent, data) | @@ -106,6 +141,7 @@ function _M.endBattleRpc(agent, data) | ||
106 | info = msg.info, | 141 | info = msg.info, |
107 | reward = reward, | 142 | reward = reward, |
108 | rank = rank, | 143 | rank = rank, |
144 | + tower = towerType + 1 | ||
109 | }) | 145 | }) |
110 | role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) | 146 | role:mylog("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) |
111 | 147 | ||
@@ -143,7 +179,9 @@ end | @@ -143,7 +179,9 @@ end | ||
143 | 179 | ||
144 | function _M.rankRpc(agent , data) | 180 | function _M.rankRpc(agent , data) |
145 | local role = agent.role | 181 | local role = agent.role |
146 | - SendPacket(actionCodes.Tower_rankRpc, MsgPack.pack(role:getTowerRank())) | 182 | + local msg = MsgPack.unpack(data) |
183 | + local towerType = msg.tower or 1 | ||
184 | + SendPacket(actionCodes.Tower_rankRpc, MsgPack.pack(role:getTowerRank(towerType))) | ||
147 | return true | 185 | return true |
148 | end | 186 | end |
149 | 187 | ||
@@ -151,7 +189,43 @@ function _M.rankInfoRpc(agent , data) | @@ -151,7 +189,43 @@ function _M.rankInfoRpc(agent , data) | ||
151 | local role = agent.role | 189 | local role = agent.role |
152 | local msg = MsgPack.unpack(data) | 190 | local msg = MsgPack.unpack(data) |
153 | local roleId = msg.roleId | 191 | local roleId = msg.roleId |
154 | - SendPacket(actionCodes.Tower_rankInfoRpc, MsgPack.pack({format = role:getTowerRankOneInfo(roleId)})) | 192 | + local towerType = msg.tower or 1 |
193 | + SendPacket(actionCodes.Tower_rankInfoRpc, MsgPack.pack({format = role:getTowerRankOneInfo(roleId, towerType)})) | ||
194 | + return true | ||
195 | +end | ||
196 | + | ||
197 | +function _M.activeTowerBonusRpc(agent, data) | ||
198 | + local role = agent.role | ||
199 | + local msg = MsgPack.unpack(data) | ||
200 | + local tType = msg.tower | ||
201 | + local id = msg.id | ||
202 | + | ||
203 | + local bnousCsv = csvdb["tower_battle_additionCsv"] | ||
204 | + | ||
205 | + if not tType or not id or not bnousCsv[tType] then return 0 end | ||
206 | + local bnousData = bnousCsv[tType][id] | ||
207 | + if not bnousData then return 1 end | ||
208 | + | ||
209 | + local towerInfo = role:getProperty("towerInfo") | ||
210 | + local towerBnous = role:getProperty("towerBnous") | ||
211 | + | ||
212 | + if towerBnous[tType] and towerBnous[tType][id] then return 2 end | ||
213 | + local towerLevel = {[1] = (towerInfo.l or 1), [2] = (towerInfo.l1 or 10001), [3] = (towerInfo.l2 or 20001), [4] = (towerInfo.l3 or 30001)} | ||
214 | + local curLevel = towerLevel[tType] | ||
215 | + | ||
216 | + if tType ~= 1 then | ||
217 | + if curLevel <= globalCsv.tower_open[tType - 1] then return 4 end | ||
218 | + end | ||
219 | + | ||
220 | + if (curLevel % 10000) <= bnousData.floor then return 3 end | ||
221 | + | ||
222 | + if not towerBnous[tType] then | ||
223 | + towerBnous[tType] = {} | ||
224 | + end | ||
225 | + towerBnous[tType][id] = 1 | ||
226 | + role:updateProperty({field = "towerBnous", value = towerBnous}) | ||
227 | + role:getTowerBnousActive(true) | ||
228 | + SendPacket(actionCodes.Tower_activeTowerBonusRpc, '') | ||
155 | return true | 229 | return true |
156 | end | 230 | end |
157 | 231 |
src/models/Activity.lua
@@ -489,7 +489,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | @@ -489,7 +489,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = { | ||
489 | role:checkTaskEnter("RoleLevelUp", {level = rLevel}) | 489 | role:checkTaskEnter("RoleLevelUp", {level = rLevel}) |
490 | 490 | ||
491 | local towerInfo = role:getProperty("towerInfo") | 491 | local towerInfo = role:getProperty("towerInfo") |
492 | - role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | 492 | + role:checkTaskEnter("TowerPass", {count = towerInfo.l, type = 1}) |
493 | --"PvpWin" | 493 | --"PvpWin" |
494 | --role:checkTaskEnter("HangPass", {id = 0}) | 494 | --role:checkTaskEnter("HangPass", {id = 0}) |
495 | role:checkCalendaTask(true, 15, 3) | 495 | role:checkCalendaTask(true, 15, 3) |
@@ -557,7 +557,7 @@ activityFunc[Activity.ActivityType.BattleCommandTask] = { | @@ -557,7 +557,7 @@ activityFunc[Activity.ActivityType.BattleCommandTask] = { | ||
557 | role:checkTaskEnter("RoleLevelUp", {level = rLevel}) | 557 | role:checkTaskEnter("RoleLevelUp", {level = rLevel}) |
558 | 558 | ||
559 | local towerInfo = role:getProperty("towerInfo") | 559 | local towerInfo = role:getProperty("towerInfo") |
560 | - role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | 560 | + role:checkTaskEnter("TowerPass", {count = towerInfo.l, type = 1}) |
561 | --"PvpWin" | 561 | --"PvpWin" |
562 | --role:checkTaskEnter("HangPass", {id = 0}) | 562 | --role:checkTaskEnter("HangPass", {id = 0}) |
563 | role:checkCalendaTask(true, 15, 3) | 563 | role:checkCalendaTask(true, 15, 3) |
src/models/Diner.lua
@@ -179,8 +179,13 @@ function Diner:checkDinerTask(typ, count, param1, param2, notNotify) | @@ -179,8 +179,13 @@ function Diner:checkDinerTask(typ, count, param1, param2, notNotify) | ||
179 | return dirty | 179 | return dirty |
180 | end | 180 | end |
181 | 181 | ||
182 | -function Diner:calSellReward(sell, delta, dishData) | 182 | +function Diner:calSellReward(sell, delta, dishData, isExpedite) |
183 | local reward = sell.reward or "" | 183 | local reward = sell.reward or "" |
184 | + | ||
185 | + if isExpedite then | ||
186 | + reward = "" | ||
187 | + end | ||
188 | + | ||
184 | local popular = 0 | 189 | local popular = 0 |
185 | if delta <= 0 then | 190 | if delta <= 0 then |
186 | return reward, popular | 191 | return reward, popular |
@@ -188,6 +193,10 @@ function Diner:calSellReward(sell, delta, dishData) | @@ -188,6 +193,10 @@ function Diner:calSellReward(sell, delta, dishData) | ||
188 | local addReward = {} | 193 | local addReward = {} |
189 | for key, value in pairs(dishData.item_normal:toNumMap()) do | 194 | for key, value in pairs(dishData.item_normal:toNumMap()) do |
190 | addReward[key] = (addReward[key] or 0) + value * delta | 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 | ||
191 | end | 200 | end |
192 | 201 | ||
193 | popular = dishData.famous_normal * delta | 202 | popular = dishData.famous_normal * delta |
@@ -245,7 +254,7 @@ function Diner:updateSell(slot, calOnly) | @@ -245,7 +254,7 @@ function Diner:updateSell(slot, calOnly) | ||
245 | local deltaTime = 0 | 254 | local deltaTime = 0 |
246 | local deltaCount = 0 | 255 | local deltaCount = 0 |
247 | local timePass = skynet.timex() - sell.time | 256 | local timePass = skynet.timex() - sell.time |
248 | - local sellTime = dishData.sell_time | 257 | + local sellTime = dishData.sell_time + self.owner:getBnousDiner(3, dishData.sell_time) |
249 | 258 | ||
250 | deltaCount = math.floor(timePass / sellTime) | 259 | deltaCount = math.floor(timePass / sellTime) |
251 | if deltaCount < sell.count then | 260 | if deltaCount < sell.count then |
@@ -284,11 +293,11 @@ function Diner:expediteSell(slot) | @@ -284,11 +293,11 @@ function Diner:expediteSell(slot) | ||
284 | local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] | 293 | local dishData = csvdb["diner_dishCsv"][sell.dish][sell.level] |
285 | local expediteCount = 0 | 294 | local expediteCount = 0 |
286 | local expediteTime = globalCsv.diner_sell_expediteTime | 295 | local expediteTime = globalCsv.diner_sell_expediteTime |
287 | - local sellTime = dishData.sell_time | 296 | + local sellTime = dishData.sell_time + self.owner:getBnousDiner(3,dishData.sell_time) |
288 | expediteCount = math.floor(expediteTime / sellTime) | 297 | expediteCount = math.floor(expediteTime / sellTime) |
289 | expediteCount = math.min(expediteCount, sell.count) | 298 | expediteCount = math.min(expediteCount, sell.count) |
290 | local lastCount = sell.count - expediteCount | 299 | local lastCount = sell.count - expediteCount |
291 | - local reward, popular = self:calSellReward(sell, expediteCount, dishData) | 300 | + local reward, popular = self:calSellReward(sell, expediteCount, dishData, true) |
292 | local deltaTime = math.floor(expediteTime - sellTime * expediteCount) | 301 | local deltaTime = math.floor(expediteTime - sellTime * expediteCount) |
293 | if expediteCount > 0 then | 302 | if expediteCount > 0 then |
294 | sells[slot].time = sell.time - deltaTime | 303 | sells[slot].time = sell.time - deltaTime |
src/models/Role.lua
@@ -115,6 +115,7 @@ Role.schema = { | @@ -115,6 +115,7 @@ Role.schema = { | ||
115 | hangTeams = {"table", {}}, -- pve自选编队 | 115 | hangTeams = {"table", {}}, -- pve自选编队 |
116 | teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType | 116 | teamIndex = {"table", {}}, -- 各个系统使用的编队索引 type->index 见TeamSystemType |
117 | advTeams = {"table", {}}, -- 拾荒自选编队 | 117 | advTeams = {"table", {}}, -- 拾荒自选编队 |
118 | + towerTeams = {"table", {}}, -- 四个电波塔的队伍 | ||
118 | 119 | ||
119 | bonusStar = {"table", {}}, -- 奖励关卡 通关星星 {[id] = 1} 三个二进制位 表示三个星 从低到高 (1 << 0) (1 << 1) (1 << 2) 满星 (1 << 3) - 1 | 120 | bonusStar = {"table", {}}, -- 奖励关卡 通关星星 {[id] = 1} 三个二进制位 表示三个星 从低到高 (1 << 0) (1 << 1) (1 << 2) 满星 (1 << 3) - 1 |
120 | 121 | ||
@@ -146,7 +147,8 @@ Role.schema = { | @@ -146,7 +147,8 @@ Role.schema = { | ||
146 | 147 | ||
147 | boxL = {"table", {}}, -- boxList 正开启的箱子 -- {[1] = {id = 1010, gem = 101, time = 1313}} | 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 | spTask = {"table", {}}, -- 特殊任务 -- {id = status} | 153 | spTask = {"table", {}}, -- 特殊任务 -- {id = status} |
152 | 154 | ||
@@ -368,6 +370,7 @@ function Role:data() | @@ -368,6 +370,7 @@ function Role:data() | ||
368 | hangTeams = self:getProperty("hangTeams"), | 370 | hangTeams = self:getProperty("hangTeams"), |
369 | teamIndex = self:getProperty("teamIndex"), | 371 | teamIndex = self:getProperty("teamIndex"), |
370 | advTeams = self:getProperty("advTeams"), | 372 | advTeams = self:getProperty("advTeams"), |
373 | + towerTeams = self:getProperty("towerTeams"), | ||
371 | 374 | ||
372 | bonusStar = self:getProperty("bonusStar"), | 375 | bonusStar = self:getProperty("bonusStar"), |
373 | 376 | ||
@@ -385,6 +388,7 @@ function Role:data() | @@ -385,6 +388,7 @@ function Role:data() | ||
385 | equips = self:getProperty("equips"), | 388 | equips = self:getProperty("equips"), |
386 | boxL = self:getProperty("boxL"), | 389 | boxL = self:getProperty("boxL"), |
387 | towerInfo = self:getProperty("towerInfo"), | 390 | towerInfo = self:getProperty("towerInfo"), |
391 | + towerBnous = self:getProperty("towerBnous"), | ||
388 | spTask = self:getProperty("spTask"), | 392 | spTask = self:getProperty("spTask"), |
389 | dTask = self:getProperty("dTask"), | 393 | dTask = self:getProperty("dTask"), |
390 | wTask = self:getProperty("wTask"), | 394 | wTask = self:getProperty("wTask"), |
src/models/RoleBattle.lua
@@ -104,7 +104,7 @@ function Role:checkBattleCheat(battleType, params) | @@ -104,7 +104,7 @@ function Role:checkBattleCheat(battleType, params) | ||
104 | -- enemyServer = packBattleEnemyCommon(carbonData) | 104 | -- enemyServer = packBattleEnemyCommon(carbonData) |
105 | end | 105 | end |
106 | cheat["tower"] = function() | 106 | cheat["tower"] = function() |
107 | - local team = self:getTeamBattleInfo(self:getTeamFormatByType(TeamSystemType.Tower)) | 107 | + local team = self:getTeamBattleInfo(self:getTowerTeamFormat(params.tower)) |
108 | for slot, hero in pairs(team.heros) do | 108 | for slot, hero in pairs(team.heros) do |
109 | local temp = {} | 109 | local temp = {} |
110 | for arr, _ in pairs(checkCheatAttrs) do | 110 | for arr, _ in pairs(checkCheatAttrs) do |
@@ -198,7 +198,7 @@ function Role:checkBattle(battleType, params) | @@ -198,7 +198,7 @@ function Role:checkBattle(battleType, params) | ||
198 | end | 198 | end |
199 | end, | 199 | end, |
200 | tower = function() | 200 | tower = function() |
201 | - local towerF = self:getTeamFormatByType(TeamSystemType.Tower) | 201 | + local towerF = self:getTowerTeamFormat(params.tower) |
202 | for slot, hero in pairs(self:getTeamHerosInfo(towerF).heros) do | 202 | for slot, hero in pairs(self:getTeamHerosInfo(towerF).heros) do |
203 | selflist[slot] = hero.type | 203 | selflist[slot] = hero.type |
204 | end | 204 | end |
src/models/RoleLog.lua
@@ -57,6 +57,7 @@ local ItemReason = { | @@ -57,6 +57,7 @@ local ItemReason = { | ||
57 | actBuyBpLevel = 141, -- 购买活动战令等级 | 57 | actBuyBpLevel = 141, -- 购买活动战令等级 |
58 | newSign = 142,-- 新的活动签到 | 58 | newSign = 142,-- 新的活动签到 |
59 | advLevelStage = 143, -- 拾荒活动阶段奖励 | 59 | advLevelStage = 143, -- 拾荒活动阶段奖励 |
60 | + towerBnous = 144, -- 爬塔到一定层数对某些功能的奖励 | ||
60 | 61 | ||
61 | 62 | ||
62 | advHang = 301, -- 拾荒挂机 | 63 | advHang = 301, -- 拾荒挂机 |
src/models/RolePlugin.lua
@@ -309,7 +309,6 @@ function RolePlugin.bind(Role) | @@ -309,7 +309,6 @@ function RolePlugin.bind(Role) | ||
309 | end | 309 | end |
310 | 310 | ||
311 | function Role:addPotion(params) | 311 | function Role:addPotion(params) |
312 | - dump(params) | ||
313 | local pId = globalCsv.adv_item_potion[params.id] | 312 | local pId = globalCsv.adv_item_potion[params.id] |
314 | local potionBag = self:getProperty("potionBag") | 313 | local potionBag = self:getProperty("potionBag") |
315 | local origin = potionBag[pId] or 0 | 314 | local origin = potionBag[pId] or 0 |
@@ -1276,11 +1275,21 @@ function RolePlugin.bind(Role) | @@ -1276,11 +1275,21 @@ function RolePlugin.bind(Role) | ||
1276 | end | 1275 | end |
1277 | 1276 | ||
1278 | local StdTowerRankTime = toUnixtime("2019010100") | 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 | local now = skynet.timex() | 1286 | local now = skynet.timex() |
1281 | local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年 | 1287 | local ct = math.ceil((now - StdTowerRankTime) / 86400) --按天计算 365 * 27 < 10000 可以维持 27 年 |
1282 | local ct = 10000 - ct -- 越早的排名越靠前 | 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 | local battleV = self:getTeamBattleValue(towerTeam.heros) | 1293 | local battleV = self:getTeamBattleValue(towerTeam.heros) |
1285 | local score = (level * 10000 + ct) * 10000000 + battleV | 1294 | local score = (level * 10000 + ct) * 10000000 + battleV |
1286 | 1295 | ||
@@ -1294,21 +1303,23 @@ function RolePlugin.bind(Role) | @@ -1294,21 +1303,23 @@ function RolePlugin.bind(Role) | ||
1294 | } | 1303 | } |
1295 | local roleId = self:getProperty("id") | 1304 | local roleId = self:getProperty("id") |
1296 | redisproxy:pipelining(function (red) | 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 | end) | 1308 | end) |
1300 | end | 1309 | end |
1301 | 1310 | ||
1302 | - function Role:getTowerRank() | 1311 | + function Role:getTowerRank(tType) |
1312 | + tType = tType or 1 | ||
1313 | + local info = TowerRankInfo[tType] | ||
1303 | local list = {} | 1314 | local list = {} |
1304 | - local ids = redisproxy:zrevrange(RANK_TOWER, 0 , 99) | 1315 | + local ids = redisproxy:zrevrange(Info.rank, 0 , 99) |
1305 | local redret = {} | 1316 | local redret = {} |
1306 | if ids and next(ids) then | 1317 | if ids and next(ids) then |
1307 | redret = redisproxy:pipelining(function (red) | 1318 | redret = redisproxy:pipelining(function (red) |
1308 | for i = 1, #ids do | 1319 | for i = 1, #ids do |
1309 | local roleId = ids[i] | 1320 | local roleId = ids[i] |
1310 | table.insert(list, {roleId = tonumber(roleId)}) | 1321 | table.insert(list, {roleId = tonumber(roleId)}) |
1311 | - red:hget(RANK_TOWER_INFO, roleId) | 1322 | + red:hget(Info.rankInfo, roleId) |
1312 | end | 1323 | end |
1313 | end) | 1324 | end) |
1314 | end | 1325 | end |
@@ -1317,7 +1328,7 @@ function RolePlugin.bind(Role) | @@ -1317,7 +1328,7 @@ function RolePlugin.bind(Role) | ||
1317 | player.format = nil | 1328 | player.format = nil |
1318 | list[i].player = player | 1329 | list[i].player = player |
1319 | end | 1330 | end |
1320 | - local rank = redisproxy:ZREVRANK(RANK_TOWER, self:getProperty("id")) | 1331 | + local rank = redisproxy:ZREVRANK(Info.rank, self:getProperty("id")) |
1321 | if not rank then | 1332 | if not rank then |
1322 | rank = -1 | 1333 | rank = -1 |
1323 | else | 1334 | else |
@@ -1326,8 +1337,10 @@ function RolePlugin.bind(Role) | @@ -1326,8 +1337,10 @@ function RolePlugin.bind(Role) | ||
1326 | return {list = list, rank = rank} | 1337 | return {list = list, rank = rank} |
1327 | end | 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 | if data then | 1344 | if data then |
1332 | local player = MsgPack.unpack(data) | 1345 | local player = MsgPack.unpack(data) |
1333 | return player.format | 1346 | return player.format |
@@ -1547,6 +1560,19 @@ function RolePlugin.bind(Role) | @@ -1547,6 +1560,19 @@ function RolePlugin.bind(Role) | ||
1547 | }) | 1560 | }) |
1548 | end | 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 | -- update | 1576 | -- update |
1551 | function Role:onRecoverTimer(now) | 1577 | function Role:onRecoverTimer(now) |
1552 | self:updateTimeReset(now, true) | 1578 | self:updateTimeReset(now, true) |
@@ -2152,6 +2178,108 @@ function RolePlugin.bind(Role) | @@ -2152,6 +2178,108 @@ function RolePlugin.bind(Role) | ||
2152 | return hero:getProperty("faith") | 2178 | return hero:getProperty("faith") |
2153 | end | 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 | end | 2283 | end |
2156 | 2284 | ||
2157 | return RolePlugin | 2285 | return RolePlugin |
2158 | \ No newline at end of file | 2286 | \ No newline at end of file |
src/models/RoleTask.lua
@@ -191,7 +191,7 @@ local AchievListener = { | @@ -191,7 +191,7 @@ local AchievListener = { | ||
191 | [TaskType.OverOderTask] = {{14}}, | 191 | [TaskType.OverOderTask] = {{14}}, |
192 | [TaskType.FoodSellGold] = {{15, f("count")}}, | 192 | [TaskType.FoodSellGold] = {{15, f("count")}}, |
193 | [TaskType.DinerPopular] = {{16, f("count")}}, | 193 | [TaskType.DinerPopular] = {{16, f("count")}}, |
194 | - [TaskType.TowerPass] = {{17, f("level")}}, | 194 | + [TaskType.TowerPass] = {{17, f("count"), f("type")}}, |
195 | [TaskType.OpenBox] = {{18, f("count")}}, | 195 | [TaskType.OpenBox] = {{18, f("count")}}, |
196 | [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}}, | 196 | [TaskType.DinerLevelUp] = {{19, f("level"), f("type")}}, |
197 | [TaskType.DinerTalentUp] = {{20, 1, f("type")}}, | 197 | [TaskType.DinerTalentUp] = {{20, 1, f("type")}}, |
@@ -249,6 +249,7 @@ local ActivityListener = { | @@ -249,6 +249,7 @@ local ActivityListener = { | ||
249 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, | 249 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, |
250 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, | 250 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, |
251 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, | 251 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, |
252 | + [TaskType.AdvCostPower] = {{Activity.ActivityType.Crisis, 3, f("count")}}, | ||
252 | [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}}, | 253 | [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}}, |
253 | [TaskType.AddItem] = {{Activity.ActivityType.BattleCommand, f("id"), f("count")}}, | 254 | [TaskType.AddItem] = {{Activity.ActivityType.BattleCommand, f("id"), f("count")}}, |
254 | } | 255 | } |
@@ -492,7 +493,6 @@ function RoleTask.bind(Role) | @@ -492,7 +493,6 @@ function RoleTask.bind(Role) | ||
492 | [6] = true, | 493 | [6] = true, |
493 | [7] = true, | 494 | [7] = true, |
494 | [16] = true, | 495 | [16] = true, |
495 | - [17] = true, | ||
496 | [19] = true, | 496 | [19] = true, |
497 | [22] = true, | 497 | [22] = true, |
498 | [23] = true, | 498 | [23] = true, |
src/models/RoleTimeReset.lua
@@ -48,6 +48,12 @@ ResetFunc["CrossWeek"] = function(self, notify, response) | @@ -48,6 +48,12 @@ ResetFunc["CrossWeek"] = function(self, notify, response) | ||
48 | response.dinerS = {} | 48 | response.dinerS = {} |
49 | 49 | ||
50 | self.activity:refreshWeekData(notify) | 50 | self.activity:refreshWeekData(notify) |
51 | + | ||
52 | + -- 跨周送一些道具 | ||
53 | + local BnousReward = self:getBnousPvpTicket() | ||
54 | + if next(BnousReward) then | ||
55 | + local reward, change = self:award(BnousReward, {log = {desc = "towerBnous"}}) | ||
56 | + end | ||
51 | end | 57 | end |
52 | 58 | ||
53 | 59 |
src/models/Store.lua
@@ -3,7 +3,29 @@ | @@ -3,7 +3,29 @@ | ||
3 | local Store = class("Store", require("shared.ModelBase")) | 3 | local Store = class("Store", require("shared.ModelBase")) |
4 | 4 | ||
5 | function Store:ctor(properties) | 5 | function Store:ctor(properties) |
6 | - Store.super.ctor(self, properties) | 6 | + Store.super.ctor(self, properties) |
7 | +end | ||
8 | + | ||
9 | +function Store:onLoad() | ||
10 | + local monEx = self:getProperty("monthCardEx") | ||
11 | + local smonEx = self:getProperty("smonthCardEx") | ||
12 | + local monId = self:getProperty("monthCardId") | ||
13 | + local smonId = self:getProperty("smonthCardId") | ||
14 | + local timeNow = skynet.timex() | ||
15 | + local flag = false | ||
16 | + if monEx > timeNow and monId == 0 then | ||
17 | + self:updateProperty({field = "monthCardId", value = 101}) | ||
18 | + self:updateProperty({field = "getMailT1", value = 0}) | ||
19 | + flag = true | ||
20 | + end | ||
21 | + if smonEx > timeNow and smonId == 0 then | ||
22 | + self:updateProperty({field = "smonthCardId", value = 102}) | ||
23 | + self:updateProperty({field = "getMailT2", value = 0}) | ||
24 | + flag = true | ||
25 | + end | ||
26 | + if flag then | ||
27 | + self:sendMonthCardEmail() | ||
28 | + end | ||
7 | end | 29 | end |
8 | 30 | ||
9 | ActGoodsType = { | 31 | ActGoodsType = { |