Commit 161c50cc12d52e5d8baba5be1fbdaa664e5ccb41
1 parent
1ce3adac
宝藏怪活动
Showing
7 changed files
with
92 additions
and
7 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
@@ -717,10 +717,15 @@ function _M.battleRankRpc(agent, data) | @@ -717,10 +717,15 @@ function _M.battleRankRpc(agent, data) | ||
717 | local role = agent.role | 717 | local role = agent.role |
718 | local msg = MsgPack.unpack(data) | 718 | local msg = MsgPack.unpack(data) |
719 | local actid = msg.actid | 719 | local actid = msg.actid |
720 | - if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end | ||
721 | - | ||
722 | - local rankInfo = role:getRankInfoCommon(RANK_TYPE.ActBattleBoss) | ||
723 | - | 720 | + local cfg = csvdb["activity_ctrlCsv"][actid] |
721 | + if not cfg then return 1 end | ||
722 | + if not role.activity:isOpen(cfg.showType) then return 2 end | ||
723 | + local actTypeToRank = { | ||
724 | + [role.activity.ActivityType.ChallengeLevel] = RANK_TYPE.ActBattleBoss, | ||
725 | + [role.activity.ActivityType.Crisis] = RANK_TYPE.ActCrisis, | ||
726 | + } | ||
727 | + if not actTypeToRank[cfg.showType] then return end | ||
728 | + local rankInfo = role:getRankInfoCommon(actTypeToRank[cfg.showType]) | ||
724 | SendPacket(actionCodes.Activity_battleRankRpc, MsgPack.pack(rankInfo)) | 729 | SendPacket(actionCodes.Activity_battleRankRpc, MsgPack.pack(rankInfo)) |
725 | return true | 730 | return true |
726 | end | 731 | end |
@@ -765,6 +770,36 @@ function _M.battleMilestoneRpc(agent, data) | @@ -765,6 +770,36 @@ function _M.battleMilestoneRpc(agent, data) | ||
765 | return true | 770 | return true |
766 | end | 771 | end |
767 | 772 | ||
773 | +function _M.crisisMilestoneRpc(agent, data) | ||
774 | + local role = agent.role | ||
775 | + local msg = MsgPack.unpack(data) | ||
776 | + local actid = msg.actid | ||
777 | + local id = msg.id | ||
778 | + if not role.activity:isOpenById(actid, "Crisis") then return 1 end | ||
779 | + local actCfg = csvdb["activity_mileageCsv"][actid] | ||
780 | + if not actCfg then return 3 end | ||
781 | + | ||
782 | + local curCsv = actCfg[id] | ||
783 | + if not curCsv then return 4 end | ||
784 | + | ||
785 | + if role:getItemCount(ItemId.CrisisScore) < curCsv.condition then | ||
786 | + return 5 | ||
787 | + end | ||
788 | + | ||
789 | + local actData = role.activity:getActData("Crisis") or {} | ||
790 | + actData.score = actData.score or {} | ||
791 | + if actData.score[id] then | ||
792 | + return 6 | ||
793 | + end | ||
794 | + actData.score[id] = -1 | ||
795 | + role.activity:updateActData("Crisis", actData) | ||
796 | + | ||
797 | + local reward, change = role:award(curCsv.award, {log = {desc = "actMilecrisis", int1 = actid}}) | ||
798 | + SendPacket(actionCodes.Activity_crisisMilestoneRpc, MsgPack.pack(role:packReward(reward, change))) | ||
799 | + return true | ||
800 | +end | ||
801 | + | ||
802 | + | ||
768 | function _M.bossRewardRpc(agent, data) | 803 | function _M.bossRewardRpc(agent, data) |
769 | local role = agent.role | 804 | local role = agent.role |
770 | local msg = MsgPack.unpack(data) | 805 | local msg = MsgPack.unpack(data) |
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 |
@@ -69,6 +70,8 @@ Activity.schema = { | @@ -69,6 +70,8 @@ Activity.schema = { | ||
69 | act18 = {"table", {}, true}, -- {id=兑换数量} | 70 | act18 = {"table", {}, true}, -- {id=兑换数量} |
70 | act19 = {"number", 0}, -- {挂机信息} | 71 | act19 = {"number", 0}, -- {挂机信息} |
71 | act20 = {"table", {}}, -- {id=扭蛋抽出数量} | 72 | act20 = {"table", {}}, -- {id=扭蛋抽出数量} |
73 | + | ||
74 | + act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} | ||
72 | } | 75 | } |
73 | 76 | ||
74 | function Activity:data() | 77 | function Activity:data() |
@@ -720,4 +723,44 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { | @@ -720,4 +723,44 @@ activityFunc[Activity.ActivityType.ActShopGoods] = { | ||
720 | } | 723 | } |
721 | 724 | ||
722 | 725 | ||
726 | + | ||
727 | +activityFunc[Activity.ActivityType.Crisis] = { | ||
728 | + ["check"] = function(self, actType, notify, atype, count) -- 检查 | ||
729 | + count = count or 1 | ||
730 | + local isOpen, actId = self:isOpen(actType) | ||
731 | + local actData = self:getActData(actType) or {} | ||
732 | + actData.task = actData.task or {} | ||
733 | + local change = false | ||
734 | + local actCsv = csvData["activity_crisisCsv"][actId] | ||
735 | + for id, actSet in pairs(actCsv) do | ||
736 | + if actSet.type == atype then | ||
737 | + local status = actData.task[id] or 0 | ||
738 | + status = status + count | ||
739 | + if status >= actSet.condition1 then | ||
740 | + local reward | ||
741 | + if actSet.loop == 1 then | ||
742 | + local rcount = math.floor(status / actSet.condition1) | ||
743 | + local reward = actSet.reward:toNumMap() | ||
744 | + for itemId, itemC in pairs(reward) do | ||
745 | + reward[itemId] = itemC * rcount | ||
746 | + end | ||
747 | + status = status % actSet.condition1 | ||
748 | + else | ||
749 | + reward = actSet.reward | ||
750 | + status = -1 | ||
751 | + end | ||
752 | + self.owner:award(reward, {log = {desc = "activity_crisis"}, notNotify = not notify}) | ||
753 | + end | ||
754 | + actData.task[id] = status | ||
755 | + change = true | ||
756 | + end | ||
757 | + end | ||
758 | + if change then | ||
759 | + -- 更新下排行榜 | ||
760 | + self.owner:updateRankCommon(RANK_TYPE.ActCrisis, self.owner:getItemCount(ItemId.CrisisScore)) | ||
761 | + self:updateActData(actType, actData) | ||
762 | + end | ||
763 | + end, | ||
764 | +} | ||
765 | + | ||
723 | return Activity | 766 | return Activity |
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, |