Commit 59a25ac73c594da2b58cc2b8eaad4972ea72d802
fix conflict
Showing
10 changed files
with
112 additions
and
22 deletions
Show diff stats
src/GlobalVar.lua
@@ -136,6 +136,7 @@ ItemId = { | @@ -136,6 +136,7 @@ ItemId = { | ||
136 | AdvKey = 80, -- 冒险钥匙 | 136 | AdvKey = 80, -- 冒险钥匙 |
137 | BoxKey = 60, -- 拆解工具 | 137 | BoxKey = 60, -- 拆解工具 |
138 | AdvPower = 4701, -- 拾荒体力 | 138 | AdvPower = 4701, -- 拾荒体力 |
139 | + CrisisScore = 8010, -- 积分 | ||
139 | } | 140 | } |
140 | 141 | ||
141 | TimeReset = { | 142 | TimeReset = { |
src/ProtocolCode.lua
@@ -228,6 +228,7 @@ actionCodes = { | @@ -228,6 +228,7 @@ actionCodes = { | ||
228 | Activity_battleRankRpc = 662, | 228 | Activity_battleRankRpc = 662, |
229 | Activity_battleMilestoneRpc = 663, | 229 | Activity_battleMilestoneRpc = 663, |
230 | Activity_bossRewardRpc = 664, | 230 | Activity_bossRewardRpc = 664, |
231 | + Activity_crisisMilestoneRpc = 665, | ||
231 | 232 | ||
232 | Radio_startQuestRpc = 700, | 233 | Radio_startQuestRpc = 700, |
233 | Radio_finishQuestRpc = 701, | 234 | Radio_finishQuestRpc = 701, |
src/RedisKeys.lua
@@ -19,6 +19,7 @@ R_ORDER = "order:%d:%d" | @@ -19,6 +19,7 @@ R_ORDER = "order:%d:%d" | ||
19 | RANK_COMMON = "rank:common:" | 19 | RANK_COMMON = "rank:common:" |
20 | RANK_TYPE = { | 20 | RANK_TYPE = { |
21 | ActBattleBoss = "act_battle_boss", | 21 | ActBattleBoss = "act_battle_boss", |
22 | + ActCrisis = "crisis", | ||
22 | } | 23 | } |
23 | 24 | ||
24 | -- rank | 25 | -- rank |
src/actions/ActivityAction.lua
@@ -721,10 +721,15 @@ function _M.battleRankRpc(agent, data) | @@ -721,10 +721,15 @@ function _M.battleRankRpc(agent, data) | ||
721 | local role = agent.role | 721 | local role = agent.role |
722 | local msg = MsgPack.unpack(data) | 722 | local msg = MsgPack.unpack(data) |
723 | local actid = msg.actid | 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 | SendPacket(actionCodes.Activity_battleRankRpc, MsgPack.pack(rankInfo)) | 733 | SendPacket(actionCodes.Activity_battleRankRpc, MsgPack.pack(rankInfo)) |
729 | return true | 734 | return true |
730 | end | 735 | end |
@@ -769,6 +774,36 @@ function _M.battleMilestoneRpc(agent, data) | @@ -769,6 +774,36 @@ function _M.battleMilestoneRpc(agent, data) | ||
769 | return true | 774 | return true |
770 | end | 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 | function _M.bossRewardRpc(agent, data) | 807 | function _M.bossRewardRpc(agent, data) |
773 | local role = agent.role | 808 | local role = agent.role |
774 | local msg = MsgPack.unpack(data) | 809 | local msg = MsgPack.unpack(data) |
src/adv/Adv.lua
@@ -149,25 +149,15 @@ function Adv:initByChapter(params) | @@ -149,25 +149,15 @@ function Adv:initByChapter(params) | ||
149 | self.maps = {} | 149 | self.maps = {} |
150 | self.maps[1] = AdvMap.new(self, 1, mapId, isEnter, isNewRelay) | 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 | self:initLayerTask() | 154 | self:initLayerTask() |
155 | 155 | ||
156 | - -- 支援效果生效一些 | ||
157 | - self:activeSomeSupport() | 156 | + |
158 | 157 | ||
159 | self:checkTask(Adv.TaskType.Arrive) | 158 | self:checkTask(Adv.TaskType.Arrive) |
160 | self:checkAdvUnlock(1, self.level) | 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 | if relayData and isEnter then | 162 | if relayData and isEnter then |
173 | self:awardRelay(relayData, notNotify) | 163 | self:awardRelay(relayData, notNotify) |
@@ -456,8 +446,20 @@ function Adv:clearAdvUnlockCache() | @@ -456,8 +446,20 @@ function Adv:clearAdvUnlockCache() | ||
456 | self.cacheUnlock = {} | 446 | self.cacheUnlock = {} |
457 | end | 447 | end |
458 | 448 | ||
459 | -function Adv:initBattle(info) | 449 | +function Adv:initBattle(info, isToNext) |
460 | self.battle = require("adv.AdvBattle").new(self) | 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 | for _, passiveC in ipairs(self.cachePassiveEvent or {}) do | 463 | for _, passiveC in ipairs(self.cachePassiveEvent or {}) do |
462 | self.battle:triggerPassive(passiveC[1], passiveC[2]) | 464 | self.battle:triggerPassive(passiveC[1], passiveC[2]) |
463 | end | 465 | end |
@@ -468,7 +470,7 @@ function Adv:initBattle(info) | @@ -468,7 +470,7 @@ function Adv:initBattle(info) | ||
468 | map:initBattleAfter() | 470 | map:initBattleAfter() |
469 | end | 471 | end |
470 | --下层 | 472 | --下层 |
471 | - if not info and self.level ~= 1 then | 473 | + if not info and isToNext then |
472 | self.battle.player:attrChangeCondBuffCheck(1) | 474 | self.battle.player:attrChangeCondBuffCheck(1) |
473 | end | 475 | end |
474 | 476 | ||
@@ -1553,6 +1555,7 @@ local function clickBuild(self, room, block, params) | @@ -1553,6 +1555,7 @@ local function clickBuild(self, room, block, params) | ||
1553 | end | 1555 | end |
1554 | advMine[2].co = mineCo2 | 1556 | advMine[2].co = mineCo2 |
1555 | self.owner:setProperty("advMine", advMine) | 1557 | self.owner:setProperty("advMine", advMine) |
1558 | + self.owner:checkTaskEnter("AdvMineLayer") | ||
1556 | end | 1559 | end |
1557 | 1560 | ||
1558 | self:checkTask(Adv.TaskType.Build, 1, oldId) | 1561 | self:checkTask(Adv.TaskType.Build, 1, oldId) |
@@ -2050,6 +2053,7 @@ function Adv:enemyDead(enemy, escape) | @@ -2050,6 +2053,7 @@ function Adv:enemyDead(enemy, escape) | ||
2050 | advMine[2].co = mineCo2 | 2053 | advMine[2].co = mineCo2 |
2051 | advMine[2].ch = mineCh | 2054 | advMine[2].ch = mineCh |
2052 | self.owner:setProperty("advMine", advMine) | 2055 | self.owner:setProperty("advMine", advMine) |
2056 | + self.owner:checkTaskEnter("AdvMineKill") | ||
2053 | else | 2057 | else |
2054 | local toClick = enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) | 2058 | local toClick = enemy:hadBuff(Buff.CHANGE_DROP_TO_CLICK) |
2055 | if toClick then | 2059 | if toClick then |
src/adv/AdvBuff.lua
@@ -35,7 +35,7 @@ Buff.Buff_NO_PASSIVE_MONSTER = 31 -- 地图被动刷新不出来怪物 | @@ -35,7 +35,7 @@ Buff.Buff_NO_PASSIVE_MONSTER = 31 -- 地图被动刷新不出来怪物 | ||
35 | Buff.SNEAK = 32 --潜行 | 35 | Buff.SNEAK = 32 --潜行 |
36 | Buff.DROP_BUFF_BY_ENEMY = 33 -- 怪物掉落加成 -- 怪物使用 | 36 | Buff.DROP_BUFF_BY_ENEMY = 33 -- 怪物掉落加成 -- 怪物使用 |
37 | Buff.GET_PASSIVE = 34 -- 获得 passive -- 结束失效 | 37 | Buff.GET_PASSIVE = 34 -- 获得 passive -- 结束失效 |
38 | -Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变 -- 怪物使用 0 - 1 | 38 | +Buff.OBSTACLE_CHANGE = 35 -- 看守类型改变 -- 怪物使用 2 - 1 |
39 | Buff.DISABLE_AURA = 36 -- 禁用光环 | 39 | Buff.DISABLE_AURA = 36 -- 禁用光环 |
40 | Buff.GET_AURA = 37 -- 获得光环 | 40 | Buff.GET_AURA = 37 -- 获得光环 |
41 | 41 |
src/adv/AdvPlayer.lua
@@ -662,7 +662,7 @@ end | @@ -662,7 +662,7 @@ end | ||
662 | 662 | ||
663 | function Enemy:getObstacle() | 663 | function Enemy:getObstacle() |
664 | local obstacle = csvdb["event_monsterCsv"][self.monsterId].obstacle | 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 | obstacle = 1 | 666 | obstacle = 1 |
667 | end | 667 | end |
668 | return obstacle | 668 | return obstacle |
src/models/Activity.lua
@@ -28,8 +28,9 @@ Activity.ActivityType = { | @@ -28,8 +28,9 @@ Activity.ActivityType = { | ||
28 | WishHeroPool = 23, -- 心愿卡池 | 28 | WishHeroPool = 23, -- 心愿卡池 |
29 | ActHeroPool = 24, -- 活动卡池 | 29 | ActHeroPool = 24, -- 活动卡池 |
30 | ActShopGoods = 25, -- 活动商品 | 30 | ActShopGoods = 25, -- 活动商品 |
31 | -} | ||
32 | 31 | ||
32 | + Crisis = 26, -- 宝藏怪活动 | ||
33 | +} | ||
33 | 34 | ||
34 | local function checkActivityType(activityType) | 35 | local function checkActivityType(activityType) |
35 | if type(activityType) == "string" then | 36 | if type(activityType) == "string" then |
@@ -71,6 +72,7 @@ Activity.schema = { | @@ -71,6 +72,7 @@ Activity.schema = { | ||
71 | act20 = {"table", {}}, -- {id=扭蛋抽出数量} | 72 | act20 = {"table", {}}, -- {id=扭蛋抽出数量} |
72 | 73 | ||
73 | act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} | 74 | act24 = {"table", {}, true}, -- 活动卡池 {id=repaynum} |
75 | + act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} | ||
74 | } | 76 | } |
75 | 77 | ||
76 | function Activity:data() | 78 | function Activity:data() |
@@ -89,6 +91,7 @@ function Activity:data() | @@ -89,6 +91,7 @@ function Activity:data() | ||
89 | act18 = self:getProperty("act18"), | 91 | act18 = self:getProperty("act18"), |
90 | act19 = self:getProperty("act19"), | 92 | act19 = self:getProperty("act19"), |
91 | act20 = self:getProperty("act20"), | 93 | act20 = self:getProperty("act20"), |
94 | + act26 = self:getProperty("act26"), | ||
92 | } | 95 | } |
93 | end | 96 | end |
94 | 97 | ||
@@ -737,4 +740,44 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { | @@ -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 | return Activity | 783 | return Activity |
src/models/RoleLog.lua
@@ -91,6 +91,7 @@ local ItemReason = { | @@ -91,6 +91,7 @@ local ItemReason = { | ||
91 | actSign = 1007, -- 活动签到 | 91 | actSign = 1007, -- 活动签到 |
92 | actPaySign = 1008, -- 活动付费签到 | 92 | actPaySign = 1008, -- 活动付费签到 |
93 | calendaTask = 1009, -- 英雄帖 | 93 | calendaTask = 1009, -- 英雄帖 |
94 | + actMilecrisis = 1010, -- 物资危机 | ||
94 | 95 | ||
95 | -- 餐厅 | 96 | -- 餐厅 |
96 | greenHourse = 1101, -- 食材获得 | 97 | greenHourse = 1101, -- 食材获得 |
src/models/RoleTask.lua
@@ -48,6 +48,8 @@ local TaskType = { | @@ -48,6 +48,8 @@ local TaskType = { | ||
48 | AdvScore = 410, -- 冒险分数 - score | 48 | AdvScore = 410, -- 冒险分数 - score |
49 | AdvDraw = 411, -- 冒险资助 - count ptype | 49 | AdvDraw = 411, -- 冒险资助 - count ptype |
50 | AdvHang = 412, -- 代理拾荒次数 | 50 | AdvHang = 412, -- 代理拾荒次数 |
51 | + AdvMineKill = 413, -- 宝藏怪击杀 | ||
52 | + AdvMineLayer = 414, -- 宝藏洞激活 | ||
51 | 53 | ||
52 | --爬塔相关 | 54 | --爬塔相关 |
53 | TowerPass = 501, -- 爬塔通关 - level | 55 | TowerPass = 501, -- 爬塔通关 - level |
@@ -218,6 +220,7 @@ local SudokuListener = { | @@ -218,6 +220,7 @@ local SudokuListener = { | ||
218 | } | 220 | } |
219 | 221 | ||
220 | local Activity = require("models.Activity") | 222 | local Activity = require("models.Activity") |
223 | + | ||
221 | local ActivityListener = { | 224 | local ActivityListener = { |
222 | func = "checkActivityTask", | 225 | func = "checkActivityTask", |
223 | listen = { | 226 | listen = { |
@@ -226,6 +229,8 @@ local ActivityListener = { | @@ -226,6 +229,8 @@ local ActivityListener = { | ||
226 | [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, | 229 | [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, |
227 | [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, | 230 | [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, |
228 | [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, | 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,7 +271,6 @@ local CalendaTaskListener = { | ||
266 | } | 271 | } |
267 | } | 272 | } |
268 | 273 | ||
269 | - | ||
270 | local TaskListeners = { | 274 | local TaskListeners = { |
271 | StoryListener, | 275 | StoryListener, |
272 | CommonListener, | 276 | CommonListener, |