Commit 59a25ac73c594da2b58cc2b8eaad4972ea72d802
fix conflict
Showing
10 changed files
with
112 additions
and
22 deletions
Show diff stats
src/GlobalVar.lua
src/ProtocolCode.lua
src/RedisKeys.lua
src/actions/ActivityAction.lua
| ... | ... | @@ -721,10 +721,15 @@ function _M.battleRankRpc(agent, data) |
| 721 | 721 | local role = agent.role |
| 722 | 722 | local msg = MsgPack.unpack(data) |
| 723 | 723 | local actid = msg.actid |
| 724 | - if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end | |
| 725 | - | |
| 726 | - local rankInfo = role:getRankInfoCommon(RANK_TYPE.ActBattleBoss) | |
| 727 | - | |
| 724 | + local cfg = csvdb["activity_ctrlCsv"][actid] | |
| 725 | + if not cfg then return 1 end | |
| 726 | + if not role.activity:isOpen(cfg.showType) then return 2 end | |
| 727 | + local actTypeToRank = { | |
| 728 | + [role.activity.ActivityType.ChallengeLevel] = RANK_TYPE.ActBattleBoss, | |
| 729 | + [role.activity.ActivityType.Crisis] = RANK_TYPE.ActCrisis, | |
| 730 | + } | |
| 731 | + if not actTypeToRank[cfg.showType] then return end | |
| 732 | + local rankInfo = role:getRankInfoCommon(actTypeToRank[cfg.showType]) | |
| 728 | 733 | SendPacket(actionCodes.Activity_battleRankRpc, MsgPack.pack(rankInfo)) |
| 729 | 734 | return true |
| 730 | 735 | end |
| ... | ... | @@ -769,6 +774,36 @@ function _M.battleMilestoneRpc(agent, data) |
| 769 | 774 | return true |
| 770 | 775 | end |
| 771 | 776 | |
| 777 | +function _M.crisisMilestoneRpc(agent, data) | |
| 778 | + local role = agent.role | |
| 779 | + local msg = MsgPack.unpack(data) | |
| 780 | + local actid = msg.actid | |
| 781 | + local id = msg.id | |
| 782 | + if not role.activity:isOpenById(actid, "Crisis") then return 1 end | |
| 783 | + local actCfg = csvdb["activity_mileageCsv"][actid] | |
| 784 | + if not actCfg then return 3 end | |
| 785 | + | |
| 786 | + local curCsv = actCfg[id] | |
| 787 | + if not curCsv then return 4 end | |
| 788 | + | |
| 789 | + if role:getItemCount(ItemId.CrisisScore) < curCsv.condition then | |
| 790 | + return 5 | |
| 791 | + end | |
| 792 | + | |
| 793 | + local actData = role.activity:getActData("Crisis") or {} | |
| 794 | + actData.score = actData.score or {} | |
| 795 | + if actData.score[id] then | |
| 796 | + return 6 | |
| 797 | + end | |
| 798 | + actData.score[id] = -1 | |
| 799 | + role.activity:updateActData("Crisis", actData) | |
| 800 | + | |
| 801 | + local reward, change = role:award(curCsv.reward, {log = {desc = "actMilecrisis", int1 = actid}}) | |
| 802 | + SendPacket(actionCodes.Activity_crisisMilestoneRpc, MsgPack.pack(role:packReward(reward, change))) | |
| 803 | + return true | |
| 804 | +end | |
| 805 | + | |
| 806 | + | |
| 772 | 807 | function _M.bossRewardRpc(agent, data) |
| 773 | 808 | local role = agent.role |
| 774 | 809 | local msg = MsgPack.unpack(data) | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -149,25 +149,15 @@ function Adv:initByChapter(params) |
| 149 | 149 | self.maps = {} |
| 150 | 150 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) |
| 151 | 151 | |
| 152 | - self:initBattle(nil) | |
| 152 | + self:initBattle(nil, isToNext) | |
| 153 | 153 | |
| 154 | 154 | self:initLayerTask() |
| 155 | 155 | |
| 156 | - -- 支援效果生效一些 | |
| 157 | - self:activeSomeSupport() | |
| 156 | + | |
| 158 | 157 | |
| 159 | 158 | self:checkTask(Adv.TaskType.Arrive) |
| 160 | 159 | self:checkAdvUnlock(1, self.level) |
| 161 | 160 | |
| 162 | - if isToNext then | |
| 163 | - self.battle.player:afterLayer() -- 玩家的buff 清理一下 | |
| 164 | - end | |
| 165 | - | |
| 166 | - -- 不是中继层 加上 层 和 地图的buff和被动 | |
| 167 | - if not self.isRelay then | |
| 168 | - self.battle:initMapEffect() | |
| 169 | - end | |
| 170 | - | |
| 171 | 161 | -- 中继进入奖励 |
| 172 | 162 | if relayData and isEnter then |
| 173 | 163 | self:awardRelay(relayData, notNotify) |
| ... | ... | @@ -456,8 +446,20 @@ function Adv:clearAdvUnlockCache() |
| 456 | 446 | self.cacheUnlock = {} |
| 457 | 447 | end |
| 458 | 448 | |
| 459 | -function Adv:initBattle(info) | |
| 449 | +function Adv:initBattle(info, isToNext) | |
| 460 | 450 | self.battle = require("adv.AdvBattle").new(self) |
| 451 | + -- 支援效果生效一些 | |
| 452 | + self:activeSomeSupport() | |
| 453 | + | |
| 454 | + -- 不是中继层 加上 层 和 地图的buff和被动 | |
| 455 | + if not self.isRelay then | |
| 456 | + self.battle:initMapEffect() | |
| 457 | + end | |
| 458 | + | |
| 459 | + if isToNext then | |
| 460 | + self.battle.player:afterLayer() -- 玩家的buff 清理一下 | |
| 461 | + end | |
| 462 | + | |
| 461 | 463 | for _, passiveC in ipairs(self.cachePassiveEvent or {}) do |
| 462 | 464 | self.battle:triggerPassive(passiveC[1], passiveC[2]) |
| 463 | 465 | end |
| ... | ... | @@ -468,7 +470,7 @@ function Adv:initBattle(info) |
| 468 | 470 | map:initBattleAfter() |
| 469 | 471 | end |
| 470 | 472 | --下层 |
| 471 | - if not info and self.level ~= 1 then | |
| 473 | + if not info and isToNext then | |
| 472 | 474 | self.battle.player:attrChangeCondBuffCheck(1) |
| 473 | 475 | end |
| 474 | 476 | |
| ... | ... | @@ -1553,6 +1555,7 @@ local function clickBuild(self, room, block, params) |
| 1553 | 1555 | end |
| 1554 | 1556 | advMine[2].co = mineCo2 |
| 1555 | 1557 | self.owner:setProperty("advMine", advMine) |
| 1558 | + self.owner:checkTaskEnter("AdvMineLayer") | |
| 1556 | 1559 | end |
| 1557 | 1560 | |
| 1558 | 1561 | self:checkTask(Adv.TaskType.Build, 1, oldId) |
| ... | ... | @@ -2050,6 +2053,7 @@ function Adv:enemyDead(enemy, escape) |
| 2050 | 2053 | advMine[2].co = mineCo2 |
| 2051 | 2054 | advMine[2].ch = mineCh |
| 2052 | 2055 | self.owner:setProperty("advMine", advMine) |
| 2056 | + self.owner:checkTaskEnter("AdvMineKill") | |
| 2053 | 2057 | else |
| 2054 | 2058 | local toClick = enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) |
| 2055 | 2059 | if toClick then | ... | ... |
src/adv/AdvBuff.lua
| ... | ... | @@ -35,7 +35,7 @@ Buff.Buff_NO_PASSIVE_MONSTER = 31 -- 地图被动刷新不出来怪物 |
| 35 | 35 | Buff.SNEAK = 32 --潜行 |
| 36 | 36 | Buff.DROP_BUFF_BY_ENEMY = 33 -- 怪物掉落加成 -- 怪物使用 |
| 37 | 37 | Buff.GET_PASSIVE = 34 -- 获得 passive -- 结束失效 |
| 38 | -Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变 -- 怪物使用 0 - 1 | |
| 38 | +Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变 -- 怪物使用 2 - 1 | |
| 39 | 39 | Buff.DISABLE_AURA = 36 -- 禁用光环 |
| 40 | 40 | Buff.GET_AURA = 37 -- 获得光环 |
| 41 | 41 | ... | ... |
src/adv/AdvPlayer.lua
| ... | ... | @@ -662,7 +662,7 @@ end |
| 662 | 662 | |
| 663 | 663 | function Enemy:getObstacle() |
| 664 | 664 | local obstacle = csvdb["event_monsterCsv"][self.monsterId].obstacle |
| 665 | - if obstacle == 0 and self:hadBuff(Buff.OBSTACLE_CHANGE) then | |
| 665 | + if obstacle == 2 and self:hadBuff(Buff.OBSTACLE_CHANGE) then | |
| 666 | 666 | obstacle = 1 |
| 667 | 667 | end |
| 668 | 668 | return obstacle | ... | ... |
src/models/Activity.lua
| ... | ... | @@ -28,8 +28,9 @@ Activity.ActivityType = { |
| 28 | 28 | WishHeroPool = 23, -- 心愿卡池 |
| 29 | 29 | ActHeroPool = 24, -- 活动卡池 |
| 30 | 30 | ActShopGoods = 25, -- 活动商品 |
| 31 | -} | |
| 32 | 31 | |
| 32 | + Crisis = 26, -- 宝藏怪活动 | |
| 33 | +} | |
| 33 | 34 | |
| 34 | 35 | local function checkActivityType(activityType) |
| 35 | 36 | if type(activityType) == "string" then |
| ... | ... | @@ -71,6 +72,7 @@ Activity.schema = { |
| 71 | 72 | act20 = {"table", {}}, -- {id=扭蛋抽出数量} |
| 72 | 73 | |
| 73 | 74 | act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} |
| 75 | + act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} | |
| 74 | 76 | } |
| 75 | 77 | |
| 76 | 78 | function Activity:data() |
| ... | ... | @@ -89,6 +91,7 @@ function Activity:data() |
| 89 | 91 | act18 = self:getProperty("act18"), |
| 90 | 92 | act19 = self:getProperty("act19"), |
| 91 | 93 | act20 = self:getProperty("act20"), |
| 94 | + act26 = self:getProperty("act26"), | |
| 92 | 95 | } |
| 93 | 96 | end |
| 94 | 97 | |
| ... | ... | @@ -737,4 +740,44 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { |
| 737 | 740 | } |
| 738 | 741 | |
| 739 | 742 | |
| 743 | + | |
| 744 | +activityFunc[Activity.ActivityType.Crisis] = { | |
| 745 | + ["check"] = function(self, actType, notify, atype, count) -- 检查 | |
| 746 | + count = count or 1 | |
| 747 | + local isOpen, actId = self:isOpen(actType) | |
| 748 | + local actData = self:getActData(actType) or {} | |
| 749 | + actData.task = actData.task or {} | |
| 750 | + local change = false | |
| 751 | + local actCsv = csvdb["activity_crisisCsv"][actId] | |
| 752 | + for id, actSet in pairs(actCsv) do | |
| 753 | + if actSet.type == atype then | |
| 754 | + local status = actData.task[id] or 0 | |
| 755 | + status = status + count | |
| 756 | + if status >= actSet.condition1 then | |
| 757 | + local reward | |
| 758 | + if actSet.loop == 1 then | |
| 759 | + local rcount = math.floor(status / actSet.condition1) | |
| 760 | + local reward = actSet.reward:toNumMap() | |
| 761 | + for itemId, itemC in pairs(reward) do | |
| 762 | + reward[itemId] = itemC * rcount | |
| 763 | + end | |
| 764 | + status = status % actSet.condition1 | |
| 765 | + else | |
| 766 | + reward = actSet.reward | |
| 767 | + status = -1 | |
| 768 | + end | |
| 769 | + self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) | |
| 770 | + end | |
| 771 | + actData.task[id] = status | |
| 772 | + change = true | |
| 773 | + end | |
| 774 | + end | |
| 775 | + if change then | |
| 776 | + -- 更新下排行榜 | |
| 777 | + self.owner:updateRankCommon(RANK_TYPE.ActCrisis, self.owner:getItemCount(ItemId.CrisisScore)) | |
| 778 | + self:updateActData(actType, actData) | |
| 779 | + end | |
| 780 | + end, | |
| 781 | +} | |
| 782 | + | |
| 740 | 783 | return Activity | ... | ... |
src/models/RoleLog.lua
src/models/RoleTask.lua
| ... | ... | @@ -48,6 +48,8 @@ local TaskType = { |
| 48 | 48 | AdvScore = 410, -- 冒险分数 - score |
| 49 | 49 | AdvDraw = 411, -- 冒险资助 - count ptype |
| 50 | 50 | AdvHang = 412, -- 代理拾荒次数 |
| 51 | + AdvMineKill = 413, -- 宝藏怪击杀 | |
| 52 | + AdvMineLayer = 414, -- 宝藏洞激活 | |
| 51 | 53 | |
| 52 | 54 | --爬塔相关 |
| 53 | 55 | TowerPass = 501, -- 爬塔通关 - level |
| ... | ... | @@ -218,6 +220,7 @@ local SudokuListener = { |
| 218 | 220 | } |
| 219 | 221 | |
| 220 | 222 | local Activity = require("models.Activity") |
| 223 | + | |
| 221 | 224 | local ActivityListener = { |
| 222 | 225 | func = "checkActivityTask", |
| 223 | 226 | listen = { |
| ... | ... | @@ -226,6 +229,8 @@ local ActivityListener = { |
| 226 | 229 | [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, |
| 227 | 230 | [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, |
| 228 | 231 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, |
| 232 | + [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, | |
| 233 | + [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, | |
| 229 | 234 | } |
| 230 | 235 | } |
| 231 | 236 | |
| ... | ... | @@ -266,7 +271,6 @@ local CalendaTaskListener = { |
| 266 | 271 | } |
| 267 | 272 | } |
| 268 | 273 | |
| 269 | - | |
| 270 | 274 | local TaskListeners = { |
| 271 | 275 | StoryListener, |
| 272 | 276 | CommonListener, | ... | ... |