From be697585cc6fc1c138a4865ea1671e6593e2443c Mon Sep 17 00:00:00 2001 From: liuzujun <307836273@qq.com> Date: Tue, 22 Dec 2020 15:38:56 +0800 Subject: [PATCH] 活动剧情解锁 --- src/ProtocolCode.lua | 1 + src/actions/ActivityAction.lua | 30 ++++++++++++++++++++++++++++++ src/actions/RoleAction.lua | 11 ++++++----- src/csvdata | 2 +- src/models/Activity.lua | 2 +- src/models/RoleTask.lua | 11 +++++++++++ 6 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/ProtocolCode.lua b/src/ProtocolCode.lua index 0b4be73..eefa756 100644 --- a/src/ProtocolCode.lua +++ b/src/ProtocolCode.lua @@ -227,6 +227,7 @@ actionCodes = { Activity_endBattleRpc = 661, Activity_battleRankRpc = 662, Activity_battleMilestoneRpc = 663, + Activity_bossRewardRpc = 664, Radio_startQuestRpc = 700, Radio_finishQuestRpc = 701, diff --git a/src/actions/ActivityAction.lua b/src/actions/ActivityAction.lua index 9efb684..d44a7c6 100644 --- a/src/actions/ActivityAction.lua +++ b/src/actions/ActivityAction.lua @@ -493,6 +493,8 @@ function _M.startBattleRpc(agent, data) end changeFlag = true end + -- 解锁活动剧情 + role:checkStoryStatus(false, 5, id) if not count then role.__actBattleCache = { @@ -696,6 +698,11 @@ function _M.endBattleRpc(agent, data) supports = support, }) + -- 解锁活动剧情 + if newStarNum >= 3 then + role:checkStoryStatus(false, 5, id) + end + reward, change = role:award(reward, {log = {desc = "actBattle", int1 = actid, int2 = newStarNum}}) SendPacket(actionCodes.Activity_endBattleRpc, MsgPack.pack({ @@ -758,4 +765,27 @@ function _M.battleMilestoneRpc(agent, data) return true end +function _M.bossRewardRpc(agent, data) + local role = agent.role + local msg = MsgPack.unpack(data) + local actid = msg.actid + local id = msg.id + local index = msg.index + + if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end + + local actCfg = csvdb["activity_battleCsv"][actid] + if not actCfg then return 2 end + + local battleCfg = actCfg[id] + if not battleCfg then return 3 end + + if battleCfg.boss_reward_id == 0 then return 4 end + + --local award = mileCfg.reward:toNumMap() + --local reward, change = role:award(award, {log = {desc = "actMilestone", int1 = actid, int2 = index}}) + --SendPacket(actionCodes.Activity_battleMilestoneRpc, MsgPack.pack(role:packReward(reward, change))) + return true +end + return _M \ No newline at end of file diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index 7936cfe..bc3996b 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -724,11 +724,12 @@ function _M.unLockStoryBookRpc(agent, data) local storyStatus = role:getProperty("storyB") if storyStatus[storyId] and storyStatus[storyId].s then return end --不需要解锁 - local cost = storyBookData.lockItem:toNumMap() - if not cost or not next(cost) then return end - if not role:checkItemEnough(cost) then return end -- 消耗品不足 - - role:costItems(cost, {log = {desc = "unlockStory", int1 = storyId}}) + if storyBookData.lockItem ~= "free" then + local cost = storyBookData.lockItem:toNumMap() + if not cost or not next(cost) then return end + if not role:checkItemEnough(cost) then return end -- 消耗品不足 + role:costItems(cost, {log = {desc = "unlockStory", int1 = storyId}}) + end -- 解锁 storyStatus[storyId] = storyStatus[storyId] or {} diff --git a/src/csvdata b/src/csvdata index 0cec957..591f2b4 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit 0cec95763804e1c8aca85f752732913423b8a18d +Subproject commit 591f2b4097214f9f5bf3b746f86ac704cbc9ea44 diff --git a/src/models/Activity.lua b/src/models/Activity.lua index 07302dd..4a659c8 100644 --- a/src/models/Activity.lua +++ b/src/models/Activity.lua @@ -168,7 +168,7 @@ function Activity:isOpenById(id, activityType) activityType = checkActivityType(activityType) local cfg = csvdb["activity_ctrlCsv"][id] if not cfg then return false end - if cfg.showType ~= activityType then return false end + if activityType ~= 0 and cfg.showType ~= activityType then return false end return self._isOpen[id] end diff --git a/src/models/RoleTask.lua b/src/models/RoleTask.lua index 1a67026..38561fc 100644 --- a/src/models/RoleTask.lua +++ b/src/models/RoleTask.lua @@ -358,11 +358,22 @@ function RoleTask.bind(Role) return true end + local function checkStoryStatusByActBattle(role, data, status, cond1) -- cond1 carbonId + local actid = data.sort + if not role.activity:isOpenById(actid) then return end + if cond1 and tonumber(data.unlockData) == cond1 then + status.s = 1 + return true + end + return + end + local checkstoryStatusFunc = { [1] = checkStoryStatusByHang, [2] = checkStoryStatusByLove, [3] = checkStoryStatusByMultStar, [4] = checkStoryStatusByAdv, + [5] = checkStoryStatusByActBattle, } function Role:checkStoryStatus(notNotify, stype, cond1, cond2, cond3) -- libgit2 0.21.2