Commit 161c50cc12d52e5d8baba5be1fbdaa664e5ccb41
1 parent
1ce3adac
宝藏怪活动
Showing
7 changed files
with
92 additions
and
7 deletions
 
Show diff stats
src/GlobalVar.lua
src/ProtocolCode.lua
src/RedisKeys.lua
src/actions/ActivityAction.lua
| ... | ... | @@ -717,10 +717,15 @@ function _M.battleRankRpc(agent, data) | 
| 717 | 717 | local role = agent.role | 
| 718 | 718 | local msg = MsgPack.unpack(data) | 
| 719 | 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 | 729 | SendPacket(actionCodes.Activity_battleRankRpc, MsgPack.pack(rankInfo)) | 
| 725 | 730 | return true | 
| 726 | 731 | end | 
| ... | ... | @@ -765,6 +770,36 @@ function _M.battleMilestoneRpc(agent, data) | 
| 765 | 770 | return true | 
| 766 | 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 | 803 | function _M.bossRewardRpc(agent, data) | 
| 769 | 804 | local role = agent.role | 
| 770 | 805 | local msg = MsgPack.unpack(data) | ... | ... | 
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 | 
| ... | ... | @@ -69,6 +70,8 @@ Activity.schema = { | 
| 69 | 70 | act18 = {"table", {}, true}, -- {id=兑换数量} | 
| 70 | 71 | act19 = {"number", 0}, -- {挂机信息} | 
| 71 | 72 | act20 = {"table", {}}, -- {id=扭蛋抽出数量} | 
| 73 | + | |
| 74 | + act26 = {"table", {}}, -- {task = {id = count}, socre = {id = status}} | |
| 72 | 75 | } | 
| 73 | 76 | |
| 74 | 77 | function Activity:data() | 
| ... | ... | @@ -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 | 766 | return Activity | ... | ... | 
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, | ... | ... |