Commit af973e45ed66cc64c0e557f2ae4a35ec8fe7b8df

Authored by jiyue
2 parents b7d38179 27acaa11

Merge branch 'cn/develop' into cn/publish/release

src/ProtocolCode.lua
... ... @@ -64,6 +64,7 @@ actionCodes = {
64 64 Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具
65 65 Role_worldLineRouletteRpc = 146, --世界线抽轮盘
66 66 Role_worldLineRewardRpc = 147, -- 世界线一键领取奖励
  67 + Role_itemConvertDevilTicketRpc = 148, -- 兑换魔鬼训练营门票
67 68  
68 69 Adv_startAdvRpc = 151,
69 70 Adv_startHangRpc = 152,
... ...
src/actions/RadioAction.lua
... ... @@ -113,14 +113,35 @@ function _M.startQuestRpc(agent, data)
113 113 local msg = MsgPack.unpack(data)
114 114 local id = msg.id
115 115 local heros = msg.heros
116   - local result = {}
117   - local radioTask = role:getProperty("radioTask")
118   - if table.numbers(radioTask) >= getQuestMax(role) then
119   - return 1
120   - end
  116 +
121 117 -- check id
122 118 local config = csvdb["crusadeCsv"][id]
123   - if not config then return 2 end
  119 + if not config then return 1 end
  120 +
  121 + local radioTask = role:getProperty("radioTask")
  122 +
  123 + local getActIDs = function ()
  124 + local actids = {}
  125 + for _, v in pairs(radioTask or {}) do
  126 + actids[v.actid] = (actids[v.actid] or 0) + 1
  127 + end
  128 + return actids
  129 + end
  130 +
  131 + local actids = getActIDs()
  132 + if config.activity_ctrl_id == 0 then
  133 + --非活动 判断数量
  134 + if (actids[config.activity_ctrl_id] or 0) >= getQuestMax(role) then
  135 + return 2
  136 + end
  137 +
  138 + else
  139 + --活动 同时只能有一个存在
  140 + if (actids[config.activity_ctrl_id] or 0) >= 1 then
  141 + return 5
  142 + end
  143 + end
  144 +
124 145 if not role:checkHangPass(config.unlock) then return 3 end
125 146 if radioTask[id] then return 4 end
126 147 -- check hero
... ... @@ -172,6 +193,7 @@ function _M.startQuestRpc(agent, data)
172 193 local taskData = {}
173 194 taskData["time"] = skynet.timex() + config.time + timeSub
174 195 taskData["heros"] = heros
  196 + taskData["actid"] = config.activity_ctrl_id
175 197 radioTask[id] = taskData
176 198 role:updateProperty({field="radioTask", value=radioTask, notNotify=true})
177 199  
... ...
src/actions/RoleAction.lua
... ... @@ -1820,4 +1820,24 @@ function _M.worldLineRewardRpc(agent, data)
1820 1820 return true
1821 1821 end
1822 1822  
  1823 +function _M.itemConvertDevilTicketRpc(agent, data)
  1824 + local role = agent.role
  1825 + local msg = MsgPack.unpack(data)
  1826 + local itemId = msg.itemId --道具id
  1827 + local count = msg.count or 1 --兑换生成的数量
  1828 + local itemData = csvdb["itemCsv"][itemId]
  1829 + if itemData.use_type ~= 11 then return 2 end
  1830 +
  1831 + local createCost = globalCsv.moguixunlianying_create_cost[itemId]:toArray(true, "=")
  1832 + if not next(createCost) then return 3 end
  1833 +
  1834 + local cost = {[itemId] = createCost[1] * count}
  1835 + if not role:checkItemEnough(cost) then return 4 end
  1836 + role:costItems({cost}, {log = {desc = "itemConvertDevilTicket"}})
  1837 + local reward, change = role:award({[createCost[2]] = count}, {log = {desc = "itemConvertDevilTicket", int1 = itemId, int2 = cost[itemId]}})
  1838 +
  1839 + SendPacket(actionCodes.Role_itemConvertDevilTicketRpc, MsgPack.pack(role:packReward(reward, change)))
  1840 + return true
  1841 +end
  1842 +
1823 1843 return _M
1824 1844 \ No newline at end of file
... ...
src/models/Activity.lua
... ... @@ -1484,7 +1484,7 @@ activityFunc[Activity.ActivityType.RadioTask] = {
1484 1484 -- check id
1485 1485 local config = csvdb["crusadeCsv"][id]
1486 1486 if config then
1487   - if config.actid == actid then
  1487 + if config.activity_ctrl_id == actid then
1488 1488 radioTask[id] = nil
1489 1489  
1490 1490 if not task then return 4 end
... ...
src/models/RoleLog.lua
... ... @@ -73,6 +73,7 @@ local ItemReason = {
73 73 regularWorldBossReward = 157, -- 常规世界boss
74 74 regularWorldBossMilestone = 158, -- 常规世界boss伤害里程碑
75 75 regularWorldBossBattle = 159, -- 常规世界boss战斗奖励
  76 + itemConvertDevilTicket = 160, -- 兑换魔鬼训练营门票
76 77  
77 78  
78 79  
... ...
src/models/RolePlugin.lua
... ... @@ -2177,6 +2177,16 @@ function RolePlugin.bind(Role)
2177 2177 return (hangPass[diff] or 0) >= carbonId
2178 2178 end
2179 2179  
  2180 + function Role:checkActivityBattlePass(battleId)
  2181 + local isOpen, actId = self.activity:isOpen("ChallengeLevel")
  2182 + if not isOpen then return end
  2183 +
  2184 + local actData = self.activity:getActData("ChallengeLevel") or {}
  2185 + local battleInfo = actData[battleId] or {}
  2186 +
  2187 + return battleInfo["star"] ~= nil
  2188 + end
  2189 +
2180 2190 function Role:checkAdvChapterPass(chapterId)
2181 2191 local chapterData = csvdb["adv_chapterCsv"][chapterId]
2182 2192 local advPass = self:getProperty("advPass") or {}
... ...