Commit fdddc1884f9e5e497b65815cbdc2aea7af6c45ce
Merge branch 'tr/bugfix' into tr/publish/preview
* tr/bugfix: (28 commits) 拾荒随机 错误 金额使用 乘以 100 的方式 mycard twd 反回 的是twd 战令-一次性领取超出周上限的战令经验应该只领取到达周上限的那一部分 战令奖励错位 战令活动购买等级扣除钻石bug 代理拾荒出勤人数计数错误, 代理拾荒没有统计进拾荒体力消耗 httpweb 活动任务数据重置 战令每周积分判空 战令任务活动 拾荒增加选择类型 拆解术式,可以自主选择加速多长时间 查询角色 去除preLoad时间偏移 去除调试日志 拾荒活动关卡开启时间检测 活动拾荒活动结束重置数据 拾荒活动 ...
Showing
18 changed files
with
1200 additions
and
224 deletions
Show diff stats
src/GlobalVar.lua
... | ... | @@ -224,6 +224,7 @@ AdvBackEventType = { |
224 | 224 | LinkChooseOver = 26, -- 连锁事件结束 |
225 | 225 | BuffEffect = 27, -- buff 效果 |
226 | 226 | PassiveEffect = 28, -- 被动 效果 |
227 | + ChooseDice = 29, -- 选择点随机效果 | |
227 | 228 | } |
228 | 229 | |
229 | 230 | AdvScoreType = { |
... | ... | @@ -290,6 +291,7 @@ CardType = { |
290 | 291 | BattleCard = 5, --赛季卡 |
291 | 292 | PaySignCard = 6, -- 付费签到卡 |
292 | 293 | BattlePassCard = 7, -- 探索指令 |
294 | + ActBattleCommandCard = 8, -- 战令活动卡 | |
293 | 295 | } |
294 | 296 | |
295 | 297 | ShopPackType = { | ... | ... |
src/ProtocolCode.lua
... | ... | @@ -231,6 +231,11 @@ actionCodes = { |
231 | 231 | Activity_crisisMilestoneRpc = 665, |
232 | 232 | Activity_commonSignRpc = 666, |
233 | 233 | Activity_friendHelpRpc = 667, |
234 | + Activity_battleCommandRpc = 668, | |
235 | + Activity_actBattleCommandTaskRpc = 669, | |
236 | + Activity_newSignRpc = 670, | |
237 | + Activity_advLevelRpc = 671, | |
238 | + Activity_buyBattleCommandLvlRpc = 672, | |
234 | 239 | |
235 | 240 | Radio_startQuestRpc = 700, |
236 | 241 | Radio_finishQuestRpc = 701, |
... | ... | @@ -248,4 +253,4 @@ for key, value in pairs(actionCodes) do |
248 | 253 | actionHandlers[value + rpcResponseBegin] = handlerName .. "Response" |
249 | 254 | end |
250 | 255 | actionHandlers[value] = string.gsub(key, "_", ".") |
251 | -end | |
252 | 256 | \ No newline at end of file |
257 | +end | ... | ... |
src/actions/ActivityAction.lua
... | ... | @@ -266,6 +266,53 @@ function _M.actCalendaTaskRpc(agent, data) |
266 | 266 | return true |
267 | 267 | end |
268 | 268 | |
269 | +function _M.actBattleCommandTaskRpc(agent, data) | |
270 | + local role = agent.role | |
271 | + local msg = MsgPack.unpack(data) | |
272 | + local taskId = msg.id | |
273 | + local calTask = role:getProperty("bcTask") or {} | |
274 | + local record = calTask["r"] or {} | |
275 | + local flag = record[taskId] or 0 | |
276 | + if flag == 1 then return 1 end | |
277 | + local open, actId = role.activity:isOpen("BattleCommandTask") | |
278 | + local actData = csvdb["activity_ctrlCsv"][actId] | |
279 | + if not open then return 2 end | |
280 | + if not actData then return 3 end | |
281 | + | |
282 | + local taskList = csvdb["activity_taskCsv"][actData.condition] | |
283 | + if not taskList then return 4 end | |
284 | + local taskCfg = taskList[taskId] | |
285 | + if not taskCfg then return 5 end | |
286 | + if taskCfg.key ~= actData.condition then return 6 end | |
287 | + | |
288 | + if (calTask[taskId] or 0) < taskCfg.condition1 then return 7 end | |
289 | + | |
290 | + local open, actId = role.activity:isOpen("BattleCommand") | |
291 | + local actData = csvdb["activity_ctrlCsv"][actId] | |
292 | + if not open then return 2 end | |
293 | + if not actData then return 3 end | |
294 | + | |
295 | + | |
296 | + record[taskId] = 1 | |
297 | + calTask["r"] = record | |
298 | + | |
299 | + role:updateProperty({field = "bcTask", value = calTask}) | |
300 | + | |
301 | + local reward, change = role:award(taskCfg.reward, {log = {desc = "battleCommandTask"}}) | |
302 | + | |
303 | + role:log("activity", { | |
304 | + activity_id = taskId, -- 活动ID(或活动指定任务的ID) | |
305 | + activity_type = role.activity.ActivityType.BattleCommandTask, -- 活动类型,见活动类型枚举表 | |
306 | + activity_reward = reward, -- 活动奖励,json格式记录,{'itemid1':123,'itemid2':456,………...} | |
307 | + }) | |
308 | + | |
309 | + role:checkTaskEnter("FinishSpeTask", {taskId = taskId, actId = actId}) | |
310 | + | |
311 | + SendPacket(actionCodes.Activity_actBattleCommandTaskRpc, MsgPack.pack(role:packReward(reward, change))) | |
312 | + | |
313 | + return true | |
314 | +end | |
315 | + | |
269 | 316 | function _M.exchangeRpc(agent, data) |
270 | 317 | local role = agent.role |
271 | 318 | local msg = MsgPack.unpack(data) |
... | ... | @@ -1113,11 +1160,212 @@ function _M.friendHelpRpc(agent, data) |
1113 | 1160 | |
1114 | 1161 | local reward, change |
1115 | 1162 | if next(award) then |
1116 | - reward, change = role:award(award, {log = {desc = "actFriendHelp", int1 = actid, int2 = level}}) | |
1163 | + reward, change = role:award(award, {log = {desc = "actFriendHelp", int1 = actid}}) | |
1117 | 1164 | end |
1118 | 1165 | role.activity:updateActData("FriendEnergy", actData) |
1119 | 1166 | SendPacket(actionCodes.Activity_friendHelpRpc, MsgPack.pack({result = result, reward = reward})) |
1120 | 1167 | return true |
1121 | 1168 | end |
1122 | 1169 | |
1123 | -return _M | |
1124 | 1170 | \ No newline at end of file |
1171 | +-- 战令活动奖励 | |
1172 | +function _M.battleCommandRpc(agent, data) | |
1173 | + local role = agent.role | |
1174 | + local msg = MsgPack.unpack(data) | |
1175 | + local actid = msg.actid -- 活动id | |
1176 | + local index = msg.index -- 领取的阶段id | |
1177 | + local pay = msg.pay -- 是否是超级奖励 | |
1178 | + | |
1179 | + if not role.activity:isOpenById(actid, "BattleCommand") then return 1 end | |
1180 | + local actCtrlData = csvdb["activity_ctrlCsv"][actid] | |
1181 | + | |
1182 | + if not actCtrlData then return end | |
1183 | + | |
1184 | + local actData = role.activity:getActData("BattleCommand") or {} | |
1185 | + if pay and not actData["unlock"] then return 2 end | |
1186 | + | |
1187 | + local bpCfg = csvdb["activity_battlepass_rewardCsv"][actid] | |
1188 | + if not bpCfg then return 3 end | |
1189 | + | |
1190 | + local unlock = actData["unlock"] or 0 | |
1191 | + local award = {} | |
1192 | + if not index then -- 一键领取 | |
1193 | + for i = 1, #bpCfg do | |
1194 | + local cfg = bpCfg[i] | |
1195 | + if not cfg then return 4 end | |
1196 | + | |
1197 | + if (actData["lvl"] or 0) < cfg["type"] then break end | |
1198 | + local records = {{"freeR", "rewardNormal"}, {"payR", "rewardHigh"}} | |
1199 | + | |
1200 | + for _, info in ipairs(records) do | |
1201 | + local typeKey, rewardKey = info[1], info[2] | |
1202 | + if typeKey == "payR" and unlock == 0 then | |
1203 | + break | |
1204 | + end | |
1205 | + local record = actData[typeKey] or "" | |
1206 | + local flag = string.char(string.getbit(record, i)) | |
1207 | + if flag == "0" then | |
1208 | + record = string.setbit(record, i) | |
1209 | + local awd = cfg[rewardKey] | |
1210 | + for k, v in pairs(awd:toNumMap()) do | |
1211 | + award[k] = (award[k] or 0) + v | |
1212 | + end | |
1213 | + end | |
1214 | + actData[typeKey] = record | |
1215 | + | |
1216 | + end | |
1217 | + end | |
1218 | + else | |
1219 | + bpCfg = bpCfg[index] | |
1220 | + if not bpCfg then return 4 end | |
1221 | + | |
1222 | + if (actData["lvl"] or 0) < bpCfg["type"] then return 5 end | |
1223 | + | |
1224 | + local record = "" | |
1225 | + if pay then | |
1226 | + record = actData["payR"] or "" | |
1227 | + else | |
1228 | + record = actData["freeR"] or "" | |
1229 | + end | |
1230 | + | |
1231 | + local flag = string.char(string.getbit(record, index)) | |
1232 | + | |
1233 | + if flag == "1" then | |
1234 | + return 6 | |
1235 | + end | |
1236 | + | |
1237 | + record = string.setbit(record, index) | |
1238 | + local awd = "" | |
1239 | + if pay then | |
1240 | + actData["payR"] = record | |
1241 | + awd = bpCfg["rewardHigh"] | |
1242 | + else | |
1243 | + actData["freeR"] = record | |
1244 | + awd = bpCfg["rewardNormal"] | |
1245 | + end | |
1246 | + for k, v in pairs(awd:toNumMap()) do | |
1247 | + award[k] = (award[k] or 0) + v | |
1248 | + end | |
1249 | + end | |
1250 | + | |
1251 | + role.activity:updateActData("BattleCommand", actData) | |
1252 | + | |
1253 | + local reward, change = role:award(award, {log = {desc = "actBattleCommand", int1 = actid, int2 = index}}) | |
1254 | + | |
1255 | + SendPacket(actionCodes.Activity_battleCommandRpc, MsgPack.pack(role:packReward(reward, change))) | |
1256 | + return true | |
1257 | +end | |
1258 | + | |
1259 | +function _M.buyBattleCommandLvlRpc(agent, data) | |
1260 | + local role = agent.role | |
1261 | + local msg = MsgPack.unpack(data) | |
1262 | + local actid = msg.actid -- 活动id | |
1263 | + local count = msg.count | |
1264 | + | |
1265 | + if not role.activity:isOpenById(actid, "BattleCommand") then return 1 end | |
1266 | + local actCtrlData = csvdb["activity_ctrlCsv"][actid] | |
1267 | + | |
1268 | + if not actCtrlData then return 2 end | |
1269 | + | |
1270 | + local bpCfg = csvdb["activity_battlepass_rewardCsv"][actid] | |
1271 | + if not bpCfg then return 3 end | |
1272 | + | |
1273 | + local actData = role.activity:getActData("BattleCommand") or {} | |
1274 | + | |
1275 | + local curLvl = actData["lvl"] or 0 | |
1276 | + local nextLvl = curLvl + count | |
1277 | + if curLvl >= bpCfg[#bpCfg]["type"] then return 4 end | |
1278 | + local cost = 0 | |
1279 | + for i = 1, #bpCfg do | |
1280 | + local cfg = bpCfg[i] | |
1281 | + if cfg["type"] > curLvl and cfg["type"] <= nextLvl then | |
1282 | + cost = cost + cfg["cost"] | |
1283 | + elseif cfg["type"] > nextLvl then | |
1284 | + break | |
1285 | + end | |
1286 | + end | |
1287 | + if cost == 0 then return 5 end | |
1288 | + | |
1289 | + if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return 6 end | |
1290 | + role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}}) | |
1291 | + actData["lvl"] = nextLvl | |
1292 | + role.activity:updateActData("BattleCommand", actData) | |
1293 | + | |
1294 | + SendPacket(actionCodes.Activity_buyBattleCommandLvlRpc, MsgPack.pack({})) | |
1295 | + return true | |
1296 | +end | |
1297 | + | |
1298 | +function _M.newSignRpc(agent, data) | |
1299 | + local role = agent.role | |
1300 | + local msg = MsgPack.unpack(data) | |
1301 | + | |
1302 | + local open, actId = role.activity:isOpen("NewSign") | |
1303 | + if not open then return 1 end | |
1304 | + | |
1305 | + local actData = role.activity:getActData("NewSign") | |
1306 | + if actData[actData[0] or 0] then | |
1307 | + return 2 | |
1308 | + end | |
1309 | + | |
1310 | + local actCfg = csvdb["activity_signInCsv"][actId] | |
1311 | + if not actCfg then return 4 end | |
1312 | + | |
1313 | + local sumDay = actData[0] or 0 | |
1314 | + local award = {} | |
1315 | + for k, data in pairs(actCfg) do | |
1316 | + if not actData[data.day] and data.day <= sumDay then | |
1317 | + for id, value in pairs(data.reward:toNumMap()) do | |
1318 | + award[id] = (award[id] or 0) + value | |
1319 | + end | |
1320 | + actData[data.day] = 1 | |
1321 | + end | |
1322 | + end | |
1323 | + | |
1324 | + local reward, change | |
1325 | + if next(award) then | |
1326 | + role.activity:updateActData("NewSign", actData) | |
1327 | + reward, change = role:award(award, {log = {desc = "newSign", int1 = actId, int2 = sumDay}}) | |
1328 | + end | |
1329 | + | |
1330 | + SendPacket(actionCodes.Activity_newSignRpc, MsgPack.pack(role:packReward(reward, change))) | |
1331 | + return true | |
1332 | +end | |
1333 | + | |
1334 | +-- 活动拾荒领取阶段奖励 | |
1335 | +function _M.advLevelRpc(agent, data) | |
1336 | + local role = agent.role | |
1337 | + local msg = MsgPack.unpack(data) | |
1338 | + local actid = msg.actid | |
1339 | + local index = msg.index | |
1340 | + | |
1341 | + if not role.activity:isOpenById(actid, "AdvLevel") then return 1 end | |
1342 | + | |
1343 | + local actCfg = csvdb["activity_stagesAwardCsv"][actid] | |
1344 | + if not actCfg then return 2 end | |
1345 | + actCfg = actCfg[index] | |
1346 | + if not actCfg then return 3 end | |
1347 | + | |
1348 | + local actData = role.activity:getActData("AdvLevel") or {} | |
1349 | + local record = actData["r"] or "" | |
1350 | + local flag = string.char(string.getbit(record, index)) | |
1351 | + | |
1352 | + if flag == "1" then return 4 end | |
1353 | + | |
1354 | + local chapters = actCfg["condition2"]:toArray(true, "=") | |
1355 | + local totalVal = 0 | |
1356 | + for i = 1, #chapters do | |
1357 | + local cid = chapters[i] | |
1358 | + local info = actData[cid] or {} | |
1359 | + totalVal = totalVal + (info["max"] or 0) | |
1360 | + end | |
1361 | + if totalVal < actCfg["condition1"] then return 5 end | |
1362 | + | |
1363 | + actData["r"] = string.setbit(record, index) | |
1364 | + role.activity:updateActData("AdvLevel", actData) | |
1365 | + | |
1366 | + local reward, change = role:award(actCfg.reward, {log = {desc = "advLevelStage", int1 = actid, int2 = index}}) | |
1367 | + | |
1368 | + SendPacket(actionCodes.Activity_advLevelRpc, MsgPack.pack(role:packReward(reward, change))) | |
1369 | + return true | |
1370 | +end | |
1371 | + | |
1372 | +return _M | ... | ... |
src/actions/AdvAction.lua
... | ... | @@ -95,16 +95,49 @@ function _M.startAdvRpc( agent, data ) |
95 | 95 | local role = agent.role |
96 | 96 | local msg = MsgPack.unpack(data) |
97 | 97 | local chapterId = msg.chapterId --关卡id |
98 | + local actid = msg.actid --活动id | |
98 | 99 | local layer = msg.layer or 1 --选择层数 |
99 | 100 | --local format = msg.format --编队 |
100 | 101 | local supportIdx = msg.supportIdx --选择的支援效果 |
101 | 102 | if not role:isFuncUnlock(FuncUnlock.Adv) then return end |
102 | - | |
103 | + | |
103 | 104 | --上一个关卡结束才可以开始新的关卡 |
104 | 105 | if role:getAdvData():isRunning() then return 8 end |
105 | 106 | local advHang = role:getProperty("advHang") |
106 | 107 | -- if advHang[chapterId] then return 9 end --正在挂机 |
107 | 108 | |
109 | + -- 检查活动正确性 | |
110 | + if actid then | |
111 | + if not role.activity:isOpenById(actid, "AdvLevel") then | |
112 | + return 20 | |
113 | + end | |
114 | + local actCfg = csvdb["activity_adv_chapterCsv"][actid] | |
115 | + if not actCfg then return 21 end | |
116 | + actCfg = actCfg[chapterId] | |
117 | + if not actCfg then return 22 end | |
118 | + | |
119 | + if actCfg["unlockTime"] ~= 0 then | |
120 | + local st = toUnixtime(actCfg["unlockTime"]..string_format("%02x", RESET_TIME)) | |
121 | + if st > skynet.timex() then return 23 end | |
122 | + end | |
123 | + | |
124 | + if actCfg["prepose"] ~= "" then | |
125 | + local type, cid = actCfg["prepose"]:toArray(true, "=") | |
126 | + if type == 1 then | |
127 | + local actData = role.activity:getActData("ChallengeLevel") | |
128 | + local battleInfo = actData[cid] or {} | |
129 | + if (battleInfo["star"] or 0) == 0 then | |
130 | + return 24 | |
131 | + end | |
132 | + elseif type == 2 then | |
133 | + local actData = role.activity:getActData("AdvLevel") | |
134 | + local advInfo = actData[cid] or {} | |
135 | + if not advInfo["pass"] then | |
136 | + return 25 | |
137 | + end | |
138 | + end | |
139 | + end | |
140 | + end | |
108 | 141 | |
109 | 142 | local chapterData = csvdb["adv_chapterCsv"][chapterId] |
110 | 143 | if not chapterData or layer < 1 then return 1 end |
... | ... | @@ -113,6 +146,7 @@ function _M.startAdvRpc( agent, data ) |
113 | 146 | |
114 | 147 | if not checkFormat(role) then return 7 end |
115 | 148 | |
149 | + local cost = 0 | |
116 | 150 | if AdvCommon.isEndless(chapterId) then -- 无尽模式判断 |
117 | 151 | |
118 | 152 | if chapterId ~= role.advElChapter then return end -- 不是当前进行的章节 |
... | ... | @@ -131,6 +165,7 @@ function _M.startAdvRpc( agent, data ) |
131 | 165 | end |
132 | 166 | |
133 | 167 | role.dailyData:updateProperty({field = "advElC", delta = 1}) |
168 | + cost = 1 | |
134 | 169 | else -- 普通模式判断 |
135 | 170 | if layer >= chapterData.limitlevel then return 4 end |
136 | 171 | |
... | ... | @@ -145,7 +180,9 @@ function _M.startAdvRpc( agent, data ) |
145 | 180 | if not role:advChapterIsOpen(chapterId) then return 5 end |
146 | 181 | |
147 | 182 | role:changeAdvCount(relayData.supply) |
183 | + cost = relayData.supply | |
148 | 184 | end |
185 | + role:checkTaskEnter("AdvCostPower", {count = cost}) | |
149 | 186 | |
150 | 187 | local support = {} -- 支援效果 |
151 | 188 | if AdvCommon.isEndless(chapterId) then |
... | ... | @@ -173,6 +210,7 @@ function _M.startAdvRpc( agent, data ) |
173 | 210 | isRelay = layer ~= 1, |
174 | 211 | isEnter = true, |
175 | 212 | support = support, |
213 | + actid = actid | |
176 | 214 | }) |
177 | 215 | |
178 | 216 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
... | ... | @@ -191,6 +229,40 @@ function _M.startHangRpc(agent, data) |
191 | 229 | local campId = msg.campId or 2 --营地id |
192 | 230 | local format = msg.format --编队 |
193 | 231 | local index = msg.index or 1--时间索引id |
232 | + local actid = msg.actid | |
233 | + | |
234 | + -- 检查活动正确性 | |
235 | + if actid then | |
236 | + if not role.activity:isOpenById(actid, "AdvLevel") then | |
237 | + return 20 | |
238 | + end | |
239 | + local actCfg = csvdb["activity_adv_chapterCsv"][actid] | |
240 | + if not actCfg then return 21 end | |
241 | + actCfg = actCfg[chapterId] | |
242 | + if not actCfg then return 22 end | |
243 | + | |
244 | + if actCfg["unlockTime"] ~= 0 then | |
245 | + local st = toUnixtime(actCfg["unlockTime"]..string_format("%02x", RESET_TIME)) | |
246 | + if st > skynet.timex() then return 23 end | |
247 | + end | |
248 | + | |
249 | + if actCfg["prepose"] ~= "" then | |
250 | + local type, cid = actCfg["prepose"]:toArray(true, "=") | |
251 | + if type == 1 then | |
252 | + local actData = role.activity:getActData("ChallengeLevel") | |
253 | + local battleInfo = actData[cid] or {} | |
254 | + if (battleInfo["star"] or 0) == 0 then | |
255 | + return 24 | |
256 | + end | |
257 | + elseif type == 2 then | |
258 | + local actData = role.activity:getActData("AdvLevel") | |
259 | + local advInfo = actData[cid] or {} | |
260 | + if not advInfo["pass"] then | |
261 | + return 25 | |
262 | + end | |
263 | + end | |
264 | + end | |
265 | + end | |
194 | 266 | |
195 | 267 | local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] |
196 | 268 | if not chapterData then return 1 end |
... | ... | @@ -219,6 +291,8 @@ function _M.startHangRpc(agent, data) |
219 | 291 | |
220 | 292 | if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 |
221 | 293 | |
294 | + role:checkTaskEnter("AdvCostPower", {count = adv_idle_energy}) | |
295 | + | |
222 | 296 | if not checkFormat(role, format, role:getAdvData():isRunning()) then return 8 end --编队是否正确 |
223 | 297 | |
224 | 298 | local player = {} | ... | ... |
src/actions/GmAction.lua
... | ... | @@ -390,6 +390,7 @@ function _M.advt(role, pms) |
390 | 390 | local chapterId = tonum(pms.pm1) |
391 | 391 | local layer = tonum(pms.pm2) |
392 | 392 | local mapId = tonum(pms.pm3) |
393 | + local actid = tonum(pms.pm4) | |
393 | 394 | local advCsv = csvdb["adv_chapterCsv"][chapterId] |
394 | 395 | if not advCsv then return "不存在的章节" end |
395 | 396 | |
... | ... | @@ -406,6 +407,7 @@ function _M.advt(role, pms) |
406 | 407 | level = layer, |
407 | 408 | isEnter = true, |
408 | 409 | debugMapId = mapId, |
410 | + actid = actid, | |
409 | 411 | }) |
410 | 412 | role:mylog("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender}) |
411 | 413 | return "成功" |
... | ... | @@ -704,15 +706,18 @@ function _M.drawHero(role, t, act) |
704 | 706 | elseif values[1] == HeroQuality.SSR then |
705 | 707 | weight = unitPool["up_ssr_weight"] |
706 | 708 | up_pool = unitPool["up_ssr_id"] |
709 | + if btype == 5 then | |
710 | + weight = 3 * weight | |
711 | + end | |
707 | 712 | end |
708 | 713 | --print(poolId, rand_v, weight, up_pool, values[1]) |
709 | 714 | if rand_v < weight and up_pool then |
710 | 715 | up_pool = up_pool:toArray(true, "=") |
711 | 716 | if btype == 5 then -- 爱心卡池,使用玩家设置的备选池子 |
712 | 717 | up_pool = role:getProperty("wishPool") |
713 | - up_pool[1] = 606 | |
714 | - up_pool[2] = 607 | |
715 | - up_pool[3] = 608 | |
718 | + up_pool[1] = 408 | |
719 | + up_pool[2] = 409 | |
720 | + up_pool[3] = 410 | |
716 | 721 | end |
717 | 722 | for k, v in ipairs(up_pool) do |
718 | 723 | resultPool[v] = {1} |
... | ... | @@ -733,6 +738,14 @@ function _M.drawHero(role, t, act) |
733 | 738 | if heroData[field] ~= values[idx] then ok = false break end |
734 | 739 | end |
735 | 740 | end |
741 | + if up_pool then | |
742 | + for k, v in ipairs(up_pool) do | |
743 | + if v == itemData.id then | |
744 | + ok = false | |
745 | + break | |
746 | + end | |
747 | + end | |
748 | + end | |
736 | 749 | if not ok then break end |
737 | 750 | if oneData[pool_str] > 0 then |
738 | 751 | resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -617,7 +617,7 @@ function _M.getResetRewardRpc(agent, data) |
617 | 617 | if level <= 1 and talent == "" then return end |
618 | 618 | |
619 | 619 | local pay = true |
620 | - if level <= 60 then | |
620 | + if level <= 60 or role.activity:isOpen("HeroBackFree") then | |
621 | 621 | pay = false |
622 | 622 | end |
623 | 623 | |
... | ... | @@ -976,6 +976,9 @@ function _M.drawHeroRpc(agent, data) |
976 | 976 | end |
977 | 977 | |
978 | 978 | role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) |
979 | + if btype ~= 3 then | |
980 | + role:checkTaskEnter("DrawHeroNotFriend", {pool = btype, count = drawCount[drawType]}) | |
981 | + end | |
979 | 982 | if ssrCount > 0 then |
980 | 983 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) |
981 | 984 | end | ... | ... |
src/actions/HttpAction.lua
... | ... | @@ -151,7 +151,7 @@ function _M.query_role(query) |
151 | 151 | if not query.uid then return "not found" end |
152 | 152 | local user = redisproxy:get(string.format("uid:%s", query.uid)) |
153 | 153 | if not user then return "not found" end |
154 | - local roleId = redisproxy:get(string_format("user:%s", string.upper(user))) | |
154 | + local roleId = redisproxy:get(string.format("user:%s", string.upper(user))) | |
155 | 155 | if not roleId then return "not found" end |
156 | 156 | return json.encode({roleId, user}) |
157 | 157 | end | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -166,6 +166,7 @@ function _M.loginRpc( agent, data ) |
166 | 166 | role.activity:checkActivityStatus(now, false, false) |
167 | 167 | role:log("onLogin") |
168 | 168 | end |
169 | + role:checkTaskEnter("Login", {}) | |
169 | 170 | |
170 | 171 | redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) |
171 | 172 | |
... | ... | @@ -607,9 +608,9 @@ function _M.openTimeBoxRpc(agent, data) |
607 | 608 | local itemData = csvdb["itemCsv"][itemId] |
608 | 609 | local unitTime = globalCsv.box_key_time[itemId] * 60 |
609 | 610 | if quick then |
610 | - stopTime = time + globalCsv.box_productLine_time * 3600 | |
611 | + stopTime = nowTime + quick | |
611 | 612 | local cost_pre = globalCsv.box_timeOpen_diamond:toArray(true, "=") |
612 | - local costKey = math.ceil((stopTime - nowTime) / (cost_pre[1] * 60)) * cost_pre[2] | |
613 | + local costKey = math.ceil(quick / (cost_pre[1] * 60)) * cost_pre[2] | |
613 | 614 | if not role:checkItemEnough({[ItemId.Diamond] = costKey}) then return 5 end |
614 | 615 | role:costItems({[ItemId.Diamond] = costKey}, {log = {desc = "openTimeBox", int1 = slot, int2 = oper}}) |
615 | 616 | else |
... | ... | @@ -851,6 +852,8 @@ function _M.taskRpc(agent, data) |
851 | 852 | -- 日常活动完成 |
852 | 853 | if taskType == 1 then |
853 | 854 | role:checkTaskEnter("DailyTask", {pre = (taskStatus["a"] or 0), cur = active}) |
855 | + else | |
856 | + role:checkTaskEnter("WeekTask", {pre = (taskStatus["a"] or 0), cur = active}) | |
854 | 857 | end |
855 | 858 | |
856 | 859 | role:changeUpdates({ |
... | ... | @@ -913,62 +916,96 @@ function _M.achiveRpc(agent, data) |
913 | 916 | local taskId = msg.id --任务id |
914 | 917 | |
915 | 918 | if not role:isFuncUnlock(FuncUnlock.TaskAchiv) then return end |
916 | - | |
917 | - local achiveTask = csvdb["achievementCsv"][taskId] | |
918 | - if not achiveTask then return 1 end | |
919 | - | |
920 | 919 | local achiveT = role:getProperty("achiveT") |
921 | 920 | local achiveV = role:getProperty("achiveV") |
921 | + local fuxRecord = role:getProperty("fuxR") or 0 | |
922 | + | |
923 | + local groups = {} | |
924 | + | |
925 | + if not taskId then | |
926 | + local awards = {} | |
927 | + for id, cfg in pairs(csvdb["achievementCsv"]) do | |
928 | + -- 没领过 | |
929 | + if not achiveV[id] then | |
930 | + if (achiveT[cfg.type] or 0) >= cfg.condition1 then | |
931 | + local award = cfg.reward:toNumMap() | |
932 | + for k, v in pairs(award) do | |
933 | + awards[k] = (awards[k] or 0) + v | |
934 | + end | |
935 | + achiveV[id] = skynet.timex() | |
936 | + groups[cfg.group] = 1 | |
937 | + | |
938 | + role:log("achievement", { | |
939 | + achievement_id = cfg.id, -- 成就id | |
940 | + achievement_type = cfg.type, -- 成就类型,具体枚举表中成就类型枚举表 | |
941 | + achievement_reward = award, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
942 | + }) | |
943 | + end | |
944 | + end | |
945 | + end | |
946 | + if not next(awards) then | |
947 | + return 5 | |
948 | + end | |
949 | + local reward, change = role:award(awards, {log = {desc = "finishAchive", int1 = 0}}) | |
950 | + role:updateProperty({field = "achiveV", value = achiveV}) | |
922 | 951 | |
923 | - if achiveV[taskId] then return 2 end | |
952 | + SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) | |
953 | + else | |
954 | + local achiveTask = csvdb["achievementCsv"][taskId] | |
955 | + if not achiveTask then return 1 end | |
924 | 956 | |
925 | - local curStatus = achiveT[achiveTask.type] or 0 | |
926 | - local maxc = achiveTask.condition1 | |
957 | + if achiveV[taskId] then return 2 end | |
927 | 958 | |
928 | - if maxc > curStatus then | |
929 | - return 3 | |
930 | - end | |
959 | + local curStatus = achiveT[achiveTask.type] or 0 | |
960 | + local maxc = achiveTask.condition1 | |
931 | 961 | |
932 | - local reward, change = role:award(achiveTask.reward, {log = {desc = "finishAchive", int1 = taskId}}) | |
933 | - role:changeUpdates({ | |
934 | - { type = "achiveV", field = taskId, value = skynet.timex() } | |
935 | - }) | |
962 | + if maxc > curStatus then | |
963 | + return 3 | |
964 | + end | |
936 | 965 | |
937 | - -- 复兴奖励 | |
938 | - if csvdb["achievement_groupCsv"][achiveTask.group].bookmark == 3 then | |
939 | - local overCount = 0 | |
940 | - for tId, status in pairs(achiveV) do | |
941 | - local tData = csvdb["achievementCsv"][tId] | |
942 | - if tData then | |
943 | - local groupData = csvdb["achievement_groupCsv"][tData.group] | |
944 | - if groupData.bookmark == 3 then | |
945 | - overCount = overCount + 1 | |
966 | + local reward, change = role:award(achiveTask.reward, {log = {desc = "finishAchive", int1 = taskId}}) | |
967 | + role:changeUpdates({ | |
968 | + { type = "achiveV", field = taskId, value = skynet.timex() } | |
969 | + }) | |
970 | + groups[achiveTask.group] = 1 | |
971 | + | |
972 | + role:log("achievement", { | |
973 | + achievement_id = taskId, -- 成就id | |
974 | + achievement_type = achiveTask.type, -- 成就类型,具体枚举表中成就类型枚举表 | |
975 | + achievement_reward = reward, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
976 | + }) | |
977 | + | |
978 | + SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) | |
979 | + end | |
980 | + | |
981 | + for group, _ in pairs(groups) do | |
982 | + -- 复兴奖励 | |
983 | + if csvdb["achievement_groupCsv"][group].bookmark == 3 then | |
984 | + local overCount = 0 | |
985 | + local preMaxCount = fuxRecord or 0 | |
986 | + for tId, status in pairs(achiveV) do | |
987 | + local tData = csvdb["achievementCsv"][tId] | |
988 | + if tData then | |
989 | + local groupData = csvdb["achievement_groupCsv"][tData.group] | |
990 | + if groupData.bookmark == 3 then | |
991 | + overCount = overCount + 1 | |
992 | + end | |
946 | 993 | end |
947 | 994 | end |
948 | - end | |
949 | - | |
950 | - for level, pData in pairs(csvdb["achievement_rewardCsv"]) do | |
951 | - if pData.request == overCount then | |
952 | - -- 发放奖励 | |
953 | - redisproxy:insertEmail({ | |
954 | - roleId = role:getProperty("id"), | |
955 | - emailId = 101, | |
956 | - attachments = pData.reward, | |
957 | - contentPms = {pData.level}, | |
958 | - }) | |
959 | - elseif pData.request > overCount then | |
960 | - break | |
995 | + local flag = false | |
996 | + for level, pData in pairs(csvdb["achievement_rewardCsv"]) do | |
997 | + if preMaxCount < pData.request and overCount >= pData.request then | |
998 | + role:sendMail(101, skynet.timex(), pData.reward, {pData.level}) | |
999 | + flag = true | |
1000 | + end | |
1001 | + end | |
1002 | + if flag then | |
1003 | + role:updateProperty({field = "fuxR", value = overCount, notNotify = true}) | |
961 | 1004 | end |
1005 | + break | |
962 | 1006 | end |
963 | 1007 | end |
964 | - | |
965 | - role:log("achievement", { | |
966 | - achievement_id = taskId, -- 成就id | |
967 | - achievement_type = achiveTask.type, -- 成就类型,具体枚举表中成就类型枚举表 | |
968 | - achievement_reward = reward, -- 达成成就奖励,json格式记录,{"itemid1":123,"itemid2":12,……….} | |
969 | - }) | |
970 | 1008 | |
971 | - SendPacket(actionCodes.Role_achiveRpc, MsgPack.pack(role:packReward(reward, change))) | |
972 | 1009 | return true |
973 | 1010 | end |
974 | 1011 | ... | ... |
src/adv/Adv.lua
... | ... | @@ -40,6 +40,7 @@ function Adv:initByInfo() |
40 | 40 | |
41 | 41 | self.chapterId = advInfo.chapterId |
42 | 42 | self.level = advInfo.level or 1 |
43 | + self.actid = advInfo.actid | |
43 | 44 | self.round = advInfo.round or 0 |
44 | 45 | self.score = advInfo.score or {} |
45 | 46 | self.isRelay = advInfo.isRelay |
... | ... | @@ -84,6 +85,7 @@ function Adv:initByChapter(params) |
84 | 85 | local isEnter = params.isEnter |
85 | 86 | local support = params.support |
86 | 87 | local debugMapId = params.debugMapId |
88 | + local actid = params.actid | |
87 | 89 | |
88 | 90 | if not self.chapterId then -- 开始新的章节 |
89 | 91 | self.chapterId = chapterId |
... | ... | @@ -94,6 +96,7 @@ function Adv:initByChapter(params) |
94 | 96 | |
95 | 97 | self.level = level or 1 |
96 | 98 | self.round = 0 |
99 | + self.actid = self.actid or actid | |
97 | 100 | self.score = self.score or {} |
98 | 101 | self.lastEnemyId = 1 |
99 | 102 | self.mapStack = {1} -- 最后一个为当前的地图 |
... | ... | @@ -183,6 +186,7 @@ end |
183 | 186 | function Adv:clear() |
184 | 187 | self.chapterId = nil |
185 | 188 | self.level = nil |
189 | + self.actid = nil | |
186 | 190 | self.score = {} |
187 | 191 | self.round = 0 |
188 | 192 | self.lastEnemyId = 1 |
... | ... | @@ -205,6 +209,7 @@ function Adv:saveDB(notNotify) |
205 | 209 | advInfo.level = self.level |
206 | 210 | advInfo.round = self.round |
207 | 211 | advInfo.score = self.score |
212 | + advInfo.actid = self.actid | |
208 | 213 | advInfo.isRelay = self.isRelay |
209 | 214 | advInfo.lastEId = self.lastEnemyId |
210 | 215 | advInfo.mstack = self.mapStack |
... | ... | @@ -771,6 +776,10 @@ function Adv:isEndless() |
771 | 776 | return AdvCommon.isEndless(self.chapterId) |
772 | 777 | end |
773 | 778 | |
779 | +function Adv:isActivity() | |
780 | + return self.actid ~= nil | |
781 | +end | |
782 | + | |
774 | 783 | function Adv:getCurFloorData() |
775 | 784 | local chapter = self.chapterId % 100 |
776 | 785 | return (csvdb["adv_chapter_floorCsv"][self.chapterId] or {})[self.level] |
... | ... | @@ -800,9 +809,57 @@ function Adv:over(success, rewardRatio, overType) |
800 | 809 | |
801 | 810 | local score = self.owner:fixAdvScoreChange(self:getScore()) |
802 | 811 | local scoreInfo = self.score |
812 | + | |
813 | + local scoreCoef = chapterData.scoreAward | |
814 | + local itemId = ItemId.OldCoin | |
815 | + -- 拾荒活动关卡相关处理 | |
816 | + if self.actid then | |
817 | + while true do | |
818 | + if not self.owner.activity:isOpenById(self.actid, "AdvLevel") then | |
819 | + break | |
820 | + end | |
821 | + local actCfg = csvdb["activity_adv_chapterCsv"][self.actid] | |
822 | + if not actCfg then break end | |
823 | + actCfg = actCfg[self.chapterId] | |
824 | + if not actCfg then break end | |
825 | + local arr = actCfg["transform"]:toArray(true, "=") | |
826 | + itemId, scoreCoef = arr[1], arr[2] | |
827 | + local actData = self.owner.activity:getActData("AdvLevel") | |
828 | + | |
829 | + -- 计算活动积分up | |
830 | + local upMap = actCfg["upCharacter"] | |
831 | + local team = self.owner:getProperty("advTeam") | |
832 | + local format = self.owner:getTeamHerosInfo(team).heros | |
833 | + local upVal = 0 | |
834 | + for _, hero in pairs(format) do | |
835 | + local heroId = hero["type"] | |
836 | + upVal = upVal + (upMap[heroId] or 0) | |
837 | + end | |
838 | + score = math.floor(score * (1 + upVal / 100)) | |
839 | + | |
840 | + local advInfo = actData[self.chapterId] or {} | |
841 | + --print("upVal", upVal, score, advInfo["max"], itemId, scoreCoef) | |
842 | + local maxScore = advInfo["max"] or 0 | |
843 | + local flag = false | |
844 | + if success then | |
845 | + advInfo["pass"] = 1 | |
846 | + flag = true | |
847 | + end | |
848 | + -- 更新活动最大积分 | |
849 | + if score > maxScore then | |
850 | + advInfo["max"] = score | |
851 | + actData[self.chapterId] = advInfo | |
852 | + flag = true | |
853 | + end | |
854 | + if flag then | |
855 | + self.owner.activity:updateActData("AdvLevel", actData) | |
856 | + end | |
857 | + break | |
858 | + end | |
859 | + end | |
803 | 860 | |
804 | - local scoreReward = math.floor(score / chapterData.scoreAward) | |
805 | - self.owner:award({[ItemId.OldCoin] = scoreReward}, {log = {desc = "advOver", int1 = self.chapterId}}) | |
861 | + local scoreReward = math.floor(score / scoreCoef) | |
862 | + self.owner:award({[itemId] = scoreReward}, {log = {desc = "advOver", int1 = self.chapterId}}) | |
806 | 863 | |
807 | 864 | -- 被动技会影响奖励 |
808 | 865 | self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) |
... | ... | @@ -836,9 +893,10 @@ function Adv:over(success, rewardRatio, overType) |
836 | 893 | end |
837 | 894 | end |
838 | 895 | |
896 | + | |
839 | 897 | local roleId = self.owner:getProperty("id") |
840 | 898 | local oldMaxScore = tonum(redisproxy:zscore(self.owner:getAdvRankKey(), roleId)) |
841 | - if score > oldMaxScore then | |
899 | + if score > oldMaxScore and not self.actid then | |
842 | 900 | local team = self.owner:getProperty("advTeam") |
843 | 901 | local curInfo = { |
844 | 902 | name = self.owner:getProperty("name"), |
... | ... | @@ -906,6 +964,7 @@ function Adv:over(success, rewardRatio, overType) |
906 | 964 | }) |
907 | 965 | |
908 | 966 | local chapterId = self.chapterId |
967 | + local actid = self.actid | |
909 | 968 | self:clear() |
910 | 969 | self.owner:checkTaskEnter("AdvScore", {score = score}) |
911 | 970 | |
... | ... | @@ -924,6 +983,7 @@ function Adv:over(success, rewardRatio, overType) |
924 | 983 | scoreAward = scoreReward, |
925 | 984 | chapterId = chapterId, |
926 | 985 | backAdvCount = backAdvCount, |
986 | + actid = actid | |
927 | 987 | }) |
928 | 988 | end |
929 | 989 | |
... | ... | @@ -1233,24 +1293,22 @@ local function clickMonster(self, room, block, params) |
1233 | 1293 | return true |
1234 | 1294 | end |
1235 | 1295 | |
1236 | -local function chooseCommon(self, room, block, chooseData, choose, tag) | |
1237 | - if not choose then return end | |
1238 | - if not chooseData or not chooseData["button".. choose .."cond"] then return end | |
1239 | 1296 | |
1240 | - local conds = chooseData["button".. choose .."cond"]:toTableArray(true) | |
1297 | +local function checkChooseCondFunc(self, condStr, room, block, tag, chooseData) | |
1298 | + chooseData = chooseData or {} | |
1241 | 1299 | local checkCond = { |
1242 | 1300 | -- 没有条件 |
1243 | 1301 | [0] = function() |
1244 | 1302 | return true |
1245 | 1303 | end, |
1246 | 1304 | -- 拥有道具 |
1247 | - [1] = function(_, itemId, count) | |
1305 | + [1] = function(itemId, count) | |
1248 | 1306 | if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, true) then |
1249 | 1307 | return true |
1250 | 1308 | end |
1251 | 1309 | end, |
1252 | 1310 | -- xx角色(todo 队长) |
1253 | - [2] = function(_, heroType) | |
1311 | + [2] = function(heroType) | |
1254 | 1312 | for slot, heroId in pairs(self.owner:getProperty("advTeam").heros) do |
1255 | 1313 | local hero = self.owner.heros[heroId] |
1256 | 1314 | if hero and hero:getProperty("type") == heroType then |
... | ... | @@ -1270,38 +1328,38 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) |
1270 | 1328 | return true |
1271 | 1329 | end, |
1272 | 1330 | --制定属性 |
1273 | - [4] = function(_, attrType, value) | |
1331 | + [4] = function(attrType, value) | |
1274 | 1332 | if (self.battle.player[AttsEnumEx[attrType]] or 0) >= value then |
1275 | 1333 | return true |
1276 | 1334 | end |
1277 | 1335 | end, |
1278 | 1336 | -- 提交一个物品 |
1279 | - [5] = function (_, itemId, count) | |
1337 | + [5] = function (itemId, count) | |
1280 | 1338 | if self:cost({[itemId] = count}, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}) then |
1281 | 1339 | self:backCost({[itemId] = count}) |
1282 | 1340 | return true |
1283 | 1341 | end |
1284 | 1342 | end, |
1285 | 1343 | -- sp 到达指定值 |
1286 | - [6] = function(_, value) | |
1344 | + [6] = function(value) | |
1287 | 1345 | if self.battle.player.sp >= value then |
1288 | 1346 | self.battle.player:changeSp(-value) |
1289 | 1347 | return true |
1290 | 1348 | end |
1291 | 1349 | end, |
1292 | 1350 | --7=拥有指定buff指定层数 |
1293 | - [7] = function(_, buffId, layer) | |
1351 | + [7] = function(buffId, layer) | |
1294 | 1352 | local buff = self.battle.player:getBuffById(buffId) |
1295 | 1353 | if buff and buff:getLayer() >= layer then |
1296 | 1354 | return true |
1297 | 1355 | end |
1298 | 1356 | end, |
1299 | 1357 | --8=拥有x神器 |
1300 | - [8] = function(_, artifactId) | |
1358 | + [8] = function(artifactId) | |
1301 | 1359 | return self:isHaveArtifact(artifactId) |
1302 | 1360 | end, |
1303 | 1361 | -- 9 = 生命值大于x% |
1304 | - [9] = function (_, value) | |
1362 | + [9] = function (value) | |
1305 | 1363 | local cost = value / 100 * self.battle.player.hpMax |
1306 | 1364 | if self.battle.player.hp > cost then |
1307 | 1365 | self.battle.player:hurt(cost, nil, {hurtType = 6, buffId = -1}) |
... | ... | @@ -1309,16 +1367,27 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) |
1309 | 1367 | end |
1310 | 1368 | end, |
1311 | 1369 | -- 10 = 未获得x神器 |
1312 | - [10] = function(_, artifactId) | |
1370 | + [10] = function(artifactId) | |
1313 | 1371 | return not self:isHaveArtifact(artifactId) |
1314 | 1372 | end, |
1315 | 1373 | -- 11 = 地图上没有指定id 的怪 |
1316 | - [11] = function(_, monsterId) | |
1317 | - for _, room in pairs(self:getCurMap().rooms) do | |
1318 | - for _, block in pairs(room.blocks) do | |
1319 | - if block:isMonster() then | |
1374 | + [11] = function(monsterId, size) | |
1375 | + if not size or size == 0 then | |
1376 | + for _, room in pairs(self:getCurMap().rooms) do | |
1377 | + for _, block in pairs(room.blocks) do | |
1378 | + if block:isMonster() then | |
1379 | + if not monsterId then return false end | |
1380 | + if block.event.id == monsterId then | |
1381 | + return false | |
1382 | + end | |
1383 | + end | |
1384 | + end | |
1385 | + end | |
1386 | + else | |
1387 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | |
1388 | + if cblock:isMonster() then | |
1320 | 1389 | if not monsterId then return false end |
1321 | - if block.event.id == monsterId then | |
1390 | + if cblock.event.id == monsterId then | |
1322 | 1391 | return false |
1323 | 1392 | end |
1324 | 1393 | end |
... | ... | @@ -1327,12 +1396,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) |
1327 | 1396 | return true |
1328 | 1397 | end, |
1329 | 1398 | -- 12 = 地图上没有指定id 的建筑 |
1330 | - [12] = function(_, buildId) | |
1331 | - for _, room in pairs(self:getCurMap().rooms) do | |
1332 | - for _, block in pairs(room.blocks) do | |
1333 | - if block:isBuild() then | |
1399 | + [12] = function(buildId, size) | |
1400 | + if not size or size == 0 then | |
1401 | + for _, room in pairs(self:getCurMap().rooms) do | |
1402 | + for _, block in pairs(room.blocks) do | |
1403 | + if block:isBuild() then | |
1404 | + if not buildId then return false end | |
1405 | + if block.event.id == buildId then | |
1406 | + return false | |
1407 | + end | |
1408 | + end | |
1409 | + end | |
1410 | + end | |
1411 | + else | |
1412 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | |
1413 | + if cblock:isBuild() then | |
1334 | 1414 | if not buildId then return false end |
1335 | - if block.event.id == buildId then | |
1415 | + if cblock.event.id == buildId then | |
1336 | 1416 | return false |
1337 | 1417 | end |
1338 | 1418 | end |
... | ... | @@ -1341,12 +1421,23 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) |
1341 | 1421 | return true |
1342 | 1422 | end, |
1343 | 1423 | -- 13 = 地图上没有指定的 选择点 |
1344 | - [13] = function(_, chooseId) | |
1345 | - for _, room in pairs(self:getCurMap().rooms) do | |
1346 | - for _, block in pairs(room.blocks) do | |
1347 | - if block:isChoose() then | |
1424 | + [13] = function(chooseId, size) | |
1425 | + if not size or size == 0 then | |
1426 | + for _, room in pairs(self:getCurMap().rooms) do | |
1427 | + for _, block in pairs(room.blocks) do | |
1428 | + if block:isChoose() then | |
1429 | + if not chooseId then return false end | |
1430 | + if block.event.id == chooseId then | |
1431 | + return false | |
1432 | + end | |
1433 | + end | |
1434 | + end | |
1435 | + end | |
1436 | + else | |
1437 | + for _, cblock in ipairs(self:getCurMap():getBlocksBySize(room.roomId, block.blockId, size)) do | |
1438 | + if cblock:isChoose() then | |
1348 | 1439 | if not chooseId then return false end |
1349 | - if block.event.id == chooseId then | |
1440 | + if cblock.event.id == chooseId then | |
1350 | 1441 | return false |
1351 | 1442 | end |
1352 | 1443 | end |
... | ... | @@ -1355,138 +1446,175 @@ local function chooseCommon(self, room, block, chooseData, choose, tag) |
1355 | 1446 | return true |
1356 | 1447 | end, |
1357 | 1448 | } |
1358 | - for _, cond in ipairs(conds) do | |
1449 | + | |
1450 | + local status, count = true, 0 | |
1451 | + for _, cond in ipairs(condStr:toTableArray(true)) do | |
1359 | 1452 | assert(not cond[1] or checkCond[cond[1]], "error cond, event_" .. (tag or "choose") .. "Csv id :" .. block.event.id) |
1360 | - if cond[1] and not checkCond[cond[1]](table.unpack(cond)) then return end | |
1453 | + if not checkCond[cond[1]](select(2, table.unpack(cond))) then | |
1454 | + status = false | |
1455 | + else | |
1456 | + count = count + 1 | |
1457 | + end | |
1361 | 1458 | end |
1362 | - | |
1363 | - local clearBlock = chooseData.keep ~= 1 | |
1364 | - local effects = chooseData["button".. choose .."effect"]:toTableArray(true) | |
1365 | - for _, effect in ipairs(effects) do | |
1366 | - local doEffect = { | |
1367 | - [1] = function() -- 获得某道具N个 | |
1368 | - local count = effect[3] or 1 | |
1369 | - local reward = {} | |
1370 | - for i = 1, count do | |
1371 | - local dropData = csvdb["event_dropCsv"][effect[2]] | |
1372 | - if dropData then | |
1373 | - local item = dropData["range"]:randWeight(true) | |
1374 | - reward[item[1]] = (reward[item[1]] or 0) + item[2] | |
1375 | - else | |
1376 | - skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", effect[2], tag, chooseData.id)) | |
1377 | - end | |
1378 | - end | |
1379 | - self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, {roomId = room.roomId, blockId = block.blockId}) | |
1380 | - end, | |
1381 | - [2] = function() --获得冒险buff | |
1382 | - local layer = effect[3] or 1 | |
1383 | - for i = 1, layer do | |
1384 | - self.battle.player:addBuff(effect[2]) | |
1385 | - end | |
1386 | - end, | |
1387 | - [3] = function() --发现怪物 | |
1388 | - self:getCurMap():addNewMonsterRand(effect[2], {room, block}) | |
1389 | - self:pushBackEvent(AdvBackEventType.Monster, {id = effect[2]}) | |
1390 | - clearBlock = false | |
1391 | - end, | |
1392 | - [4] = function() --无事发生 | |
1393 | - end, | |
1394 | - [5] = function() --5=属性枚举=数值;直接增加玩家属性 | |
1395 | - local attr | |
1396 | - if effect[3] == 0 then | |
1397 | - attr = "sp" | |
1459 | + return status, count | |
1460 | +end | |
1461 | + | |
1462 | +local function doChooseEffect(self, effectStr, room, block, tag, chooseData) | |
1463 | + chooseData = chooseData or {} | |
1464 | + local clearBlock = true | |
1465 | + local doEffect = { | |
1466 | + [1] = function(dropId, count) -- 获得某道具N个 | |
1467 | + count = count or 1 | |
1468 | + local reward = {} | |
1469 | + for i = 1, count do | |
1470 | + local dropData = csvdb["event_dropCsv"][dropId] | |
1471 | + if dropData then | |
1472 | + local item = dropData["range"]:randWeight(true) | |
1473 | + reward[item[1]] = (reward[item[1]] or 0) + item[2] | |
1398 | 1474 | else |
1399 | - attr = AttsEnumEx[effect[3]] | |
1400 | - if not AdvAttsEnum[attr] then return end | |
1475 | + skynet.error(string.format("[ERROR]: event_dropCsv no id %s in %s id: %s", dropId, tag, chooseData.id)) | |
1401 | 1476 | end |
1402 | - self.battle.player:addBaseAttr(attr, effect[4], effect[2]) | |
1403 | - end, | |
1404 | - [6] = function() -- 商店 | |
1405 | - block:updateEvent({ | |
1406 | - etype = AdvEventType.Trader, | |
1407 | - id = effect[2] | |
1408 | - }) | |
1409 | - self:pushBackEvent(AdvBackEventType.Trader, {id = effect[2]}) | |
1410 | - clearBlock = false | |
1411 | - end, | |
1412 | - [7] = function() -- 建筑 | |
1413 | - block:updateEvent({ | |
1414 | - etype = AdvEventType.Build, | |
1415 | - id = effect[2] | |
1416 | - }) | |
1417 | - clearBlock = false | |
1418 | - end, | |
1419 | - [8] = function() -- 选择 | |
1420 | - block:updateEvent({ | |
1421 | - etype = AdvEventType.Choose, | |
1422 | - id = effect[2] | |
1423 | - }) | |
1424 | - clearBlock = false | |
1425 | - end, | |
1426 | - [9] = function() -- click | |
1427 | - block:updateEvent({ | |
1428 | - etype = AdvEventType.Click, | |
1429 | - id = effect[2] | |
1430 | - }) | |
1431 | - clearBlock = false | |
1432 | - end, | |
1433 | - [10] = function() -- 陷阱 | |
1434 | - block:updateEvent({ | |
1435 | - etype = AdvEventType.Trap, | |
1436 | - id = effect[2] | |
1437 | - }) | |
1438 | - clearBlock = false | |
1439 | - end, | |
1440 | - [11] = function() -- 获得神器 | |
1441 | - self:waitChooseArtifact() --等待获取神器 | |
1442 | - end, | |
1443 | - [12] = function() | |
1444 | - -- buffId | |
1445 | - local targers = self.battle.player:getTeam(2, nil, nil, true) | |
1446 | - for _, target in pairs(targers) do | |
1447 | - target:addBuff(effect[2]) | |
1477 | + end | |
1478 | + self:award(reward, {log = {desc = "chooseEvent", key1 = tag, int1 = chooseData.id}}, {roomId = room.roomId, blockId = block.blockId}) | |
1479 | + end, | |
1480 | + [2] = function(buffId, layer) --获得冒险buff | |
1481 | + self.battle.player:addBuff(buffId, nil, layer or 1) | |
1482 | + end, | |
1483 | + [3] = function(id) --发现怪物 | |
1484 | + self:getCurMap():addNewMonsterRand(id, {room, block}) | |
1485 | + self:pushBackEvent(AdvBackEventType.Monster, {id = id}) | |
1486 | + clearBlock = false | |
1487 | + end, | |
1488 | + [4] = function() --无事发生 | |
1489 | + end, | |
1490 | + [5] = function(addType, attrType, value) --5=属性枚举=数值;直接增加玩家属性 | |
1491 | + local attr | |
1492 | + if attrType == 0 then | |
1493 | + attr = "sp" | |
1494 | + else | |
1495 | + attr = AttsEnumEx[attrType] | |
1496 | + if not AdvAttsEnum[attr] then return end | |
1497 | + end | |
1498 | + self.battle.player:addBaseAttr(attr, value, addType) | |
1499 | + end, | |
1500 | + [6] = function(id) -- 商店 | |
1501 | + block:updateEvent({ | |
1502 | + etype = AdvEventType.Trader, | |
1503 | + id = id | |
1504 | + }) | |
1505 | + self:pushBackEvent(AdvBackEventType.Trader, {id = id}) | |
1506 | + clearBlock = false | |
1507 | + end, | |
1508 | + [7] = function(id) -- 建筑 | |
1509 | + block:updateEvent({ | |
1510 | + etype = AdvEventType.Build, | |
1511 | + id = id | |
1512 | + }) | |
1513 | + clearBlock = false | |
1514 | + end, | |
1515 | + [8] = function(id) -- 选择 | |
1516 | + block:updateEvent({ | |
1517 | + etype = AdvEventType.Choose, | |
1518 | + id = id | |
1519 | + }) | |
1520 | + clearBlock = false | |
1521 | + end, | |
1522 | + [9] = function(id) -- click | |
1523 | + block:updateEvent({ | |
1524 | + etype = AdvEventType.Click, | |
1525 | + id = id | |
1526 | + }) | |
1527 | + clearBlock = false | |
1528 | + end, | |
1529 | + [10] = function(id) -- 陷阱 | |
1530 | + block:updateEvent({ | |
1531 | + etype = AdvEventType.Trap, | |
1532 | + id = id | |
1533 | + }) | |
1534 | + clearBlock = false | |
1535 | + end, | |
1536 | + [11] = function() -- 获得神器 | |
1537 | + self:waitChooseArtifact() --等待获取神器 | |
1538 | + end, | |
1539 | + [12] = function(id) | |
1540 | + -- buffId | |
1541 | + local targers = self.battle.player:getTeam(2, nil, nil, true) | |
1542 | + for _, target in pairs(targers) do | |
1543 | + target:addBuff(id) | |
1544 | + end | |
1545 | + end, | |
1546 | + [13] = function() -- 显示地图 | |
1547 | + self:getCurMap():showMap() | |
1548 | + self:backMapShow() | |
1549 | + end, | |
1550 | + [14] = function(eventType, eventId, count, stage) -- 指定地块召唤 指定类型的id | |
1551 | + local change = self:getCurMap():layEventToStage(eventType, eventId, count, stage) | |
1552 | + for _, one in ipairs(change) do | |
1553 | + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | |
1554 | + clearBlock = false | |
1555 | + else | |
1556 | + self:backBlockChange(one[1].roomId, one[2].blockId) | |
1448 | 1557 | end |
1449 | - end, | |
1450 | - [13] = function() -- 显示地图 | |
1451 | - self:getCurMap():showMap() | |
1452 | - self:backMapShow() | |
1453 | - end, | |
1454 | - [14] = function() -- 指定地块召唤 指定类型的id | |
1455 | - local change = self:getCurMap():layEventToStage(effect[2], effect[3], effect[4], effect[5]) | |
1456 | - for _, one in ipairs(change) do | |
1457 | - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | |
1458 | - clearBlock = false | |
1459 | - else | |
1460 | - self:backBlockChange(one[1].roomId, one[2].blockId) | |
1461 | - end | |
1558 | + end | |
1559 | + end, | |
1560 | + [15] = function(eventType, eventId, count) -- 移除指定事件 | |
1561 | + local change = self:getCurMap():clearEventById(eventType, eventId, count) | |
1562 | + for _, one in ipairs(change) do | |
1563 | + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | |
1564 | + clearBlock = false | |
1565 | + else | |
1566 | + self:backBlockChange(one[1].roomId, one[2].blockId) | |
1462 | 1567 | end |
1463 | - end, | |
1464 | - [15] = function() -- 移除指定事件 | |
1465 | - local change = self:getCurMap():clearEventById(effect[2], effect[3], effect[4]) | |
1466 | - for _, one in ipairs(change) do | |
1467 | - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | |
1468 | - clearBlock = false | |
1469 | - else | |
1470 | - self:backBlockChange(one[1].roomId, one[2].blockId) | |
1471 | - end | |
1568 | + end | |
1569 | + end, | |
1570 | + [16] = function(eventTypeF, eventIdF, eventTypeT, eventIdT, count) -- 指定事件转移 | |
1571 | + local change = self:getCurMap():eventChangeToOther(eventTypeF, eventIdF, eventTypeT, eventIdT, count) | |
1572 | + for _, one in ipairs(change) do | |
1573 | + if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | |
1574 | + clearBlock = false | |
1575 | + else | |
1576 | + self:backBlockChange(one[1].roomId, one[2].blockId) | |
1472 | 1577 | end |
1473 | - end, | |
1474 | - [16] = function() -- 指定事件转移 | |
1475 | - local change = self:getCurMap():eventChangeToOther(effect[2], effect[3], effect[4], effect[5], effect[6]) | |
1476 | - for _, one in ipairs(change) do | |
1477 | - if one[1].roomId == room.roomId and one[2].blockId == block.blockId then | |
1478 | - clearBlock = false | |
1479 | - else | |
1480 | - self:backBlockChange(one[1].roomId, one[2].blockId) | |
1481 | - end | |
1578 | + end | |
1579 | + end, | |
1580 | + [17] = function(eventId) | |
1581 | + local diceCsv = csvdb["event_choose_diceCsv"][eventId] | |
1582 | + if not diceCsv then return end | |
1583 | + local weight = math.randomInt(1, 12) | |
1584 | + local sum = 0 | |
1585 | + local needEffect = nil | |
1586 | + local pool = {} | |
1587 | + for _, v in ipairs(diceCsv) do | |
1588 | + local status, okCount = checkChooseCondFunc(self, v.cond, room, block, tag .. " dice", chooseData) | |
1589 | + pool[#pool + 1] = v.weight + okCount * v.weightUp | |
1590 | + sum = sum + pool[#pool] | |
1591 | + if sum >= weight and not needEffect then | |
1592 | + -- 达成效果 | |
1593 | + needEffect = v.effect | |
1482 | 1594 | end |
1483 | - end, | |
1484 | - } | |
1595 | + end | |
1596 | + if needEffect then | |
1597 | + self:pushBackEvent(AdvBackEventType.ChooseDice, {id = eventId, pool = pool, result = weight}) | |
1598 | + clearBlock = doChooseEffect(self, needEffect, room, block, tag .. " dice", chooseData) | |
1599 | + end | |
1600 | + end, | |
1601 | + } | |
1602 | + | |
1603 | + for _, effect in ipairs(effectStr:toTableArray(true)) do | |
1485 | 1604 | assert(doEffect[effect[1]], "error effect, event_" .. (tag or "choose") .. "Csv id :" .. (block.event and block.event.id or 0) .. "effect " .. effect[1]) |
1486 | - doEffect[effect[1]]() | |
1605 | + doEffect[effect[1]](select(2, table.unpack(effect))) | |
1487 | 1606 | end |
1488 | - self:scoreChange(AdvScoreType.Event, chooseData.advScore) --增加加分 | |
1607 | + return clearBlock | |
1608 | +end | |
1489 | 1609 | |
1610 | + | |
1611 | +local function chooseCommon(self, room, block, chooseData, choose, tag) | |
1612 | + if not choose then return end | |
1613 | + if not chooseData or not chooseData["button".. choose .."cond"] then return end | |
1614 | + if not checkChooseCondFunc(self, chooseData["button".. choose .."cond"], room, block, tag, chooseData) then return end | |
1615 | + local clearBlock = chooseData.keep ~= 1 | |
1616 | + clearBlock = clearBlock and doChooseEffect(self, chooseData["button".. choose .."effect"], room, block, tag, chooseData) | |
1617 | + self:scoreChange(AdvScoreType.Event, chooseData.advScore) --增加加分 | |
1490 | 1618 | return true, clearBlock |
1491 | 1619 | end |
1492 | 1620 | ... | ... |
src/models/Activity.lua
... | ... | @@ -33,6 +33,12 @@ Activity.ActivityType = { |
33 | 33 | |
34 | 34 | CommonSignIn = 28, --通用签到 |
35 | 35 | FriendEnergy = 30, -- 好友互赠能量活动 |
36 | + AdvLevel = 33, -- 拾荒关卡 | |
37 | + BattleCommand = 34, -- 战令活动 | |
38 | + NewSign = 36, -- 活动签到,单独的签到界面 | |
39 | + HeroBackFree = 37, -- 无损耗归还 | |
40 | + | |
41 | + BattleCommandTask = 38, -- 战令任务活动 | |
36 | 42 | } |
37 | 43 | |
38 | 44 | local function checkActivityType(activityType) |
... | ... | @@ -79,6 +85,11 @@ Activity.schema = { |
79 | 85 | |
80 | 86 | act28 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} |
81 | 87 | act30 = {"table", {}}, -- {magic = 0, limit = 0, reward = {id = 1, id = 1}, giveAE = {}, getAE = {}} 奖励字段1表示领取过奖励 |
88 | + | |
89 | + act33 = {"table", {}}, -- 拾荒关卡活动 {id={max=最大积分, pass=1}, r=""} | |
90 | + | |
91 | + act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100} | |
92 | + act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} | |
82 | 93 | } |
83 | 94 | |
84 | 95 | function Activity:data() |
... | ... | @@ -102,6 +113,11 @@ function Activity:data() |
102 | 113 | |
103 | 114 | act28 = self:getProperty("act28"), |
104 | 115 | act30 = self:getProperty("act30"), |
116 | + | |
117 | + act33 = self:getProperty("act33"), | |
118 | + | |
119 | + act34 = self:getProperty("act34"), | |
120 | + act36 = self:getProperty("act36"), | |
105 | 121 | } |
106 | 122 | end |
107 | 123 | |
... | ... | @@ -457,6 +473,7 @@ activityFunc[Activity.ActivityType.CalendaTask] = { |
457 | 473 | ["init"] = function(self, actType, isCrossDay, notify) |
458 | 474 | local calTask = self.owner:getProperty("calTask") |
459 | 475 | calTask = {} |
476 | + self.owner:updateProperty({field="calTask", value=calTask}) | |
460 | 477 | local role = self.owner |
461 | 478 | local buildL = role.dinerData:getProperty("buildL") |
462 | 479 | local curLevel = buildL:getv(1, 1) |
... | ... | @@ -480,11 +497,113 @@ activityFunc[Activity.ActivityType.CalendaTask] = { |
480 | 497 | role:checkTaskEnter("RuneQualityCollect", {}) |
481 | 498 | |
482 | 499 | end, |
500 | + ["crossDay"] = function(self, actType, notify, actId) | |
501 | + local actData = self.owner:getProperty("calTask") or {} | |
502 | + local record = actData["r"] or {} | |
503 | + local actCfg = csvdb["activity_taskCsv"][actId] | |
504 | + if not actCfg then return end | |
505 | + local change = false | |
506 | + for taskId, cfg in pairs(actCfg) do | |
507 | + if cfg["resetType"] == 1 then -- 每日重置 | |
508 | + record[taskId] = nil | |
509 | + actData[taskId] = nil | |
510 | + change = true | |
511 | + end | |
512 | + end | |
513 | + if change then | |
514 | + self.owner:updateProperty({field="calTask", value=actData}) | |
515 | + end | |
516 | + end, | |
517 | + ["crossWeek"] = function(self, actType, notify, actId) | |
518 | + local actData = self.owner:getProperty("calTask") or {} | |
519 | + local record = actData["r"] or {} | |
520 | + local actCfg = csvdb["activity_taskCsv"][actId] | |
521 | + if not actCfg then return end | |
522 | + local change = false | |
523 | + for taskId, cfg in pairs(actCfg) do | |
524 | + if cfg["resetType"] == 2 then -- 每周重置 | |
525 | + record[taskId] = nil | |
526 | + actData[taskId] = nil | |
527 | + change = true | |
528 | + end | |
529 | + end | |
530 | + if change then | |
531 | + self.owner:updateProperty({field="calTask", value=actData}) | |
532 | + end | |
533 | + end, | |
483 | 534 | ["close"] = function(self, actType, notify) |
484 | 535 | self.owner:updateProperty({field="calTask", value={}}) |
485 | 536 | end, |
486 | 537 | } |
487 | 538 | |
539 | +-- 活动任务 仅供春节活动使用 防冲突 | |
540 | +activityFunc[Activity.ActivityType.BattleCommandTask] = { | |
541 | + ["init"] = function(self, actType, isCrossDay, notify) | |
542 | + local bcTask = self.owner:getProperty("bcTask") | |
543 | + bcTask = {} | |
544 | + self.owner:updateProperty({field="bcTask", value=bcTask}) | |
545 | + local role = self.owner | |
546 | + local buildL = role.dinerData:getProperty("buildL") | |
547 | + local curLevel = buildL:getv(1, 1) | |
548 | + role:checkTaskEnter("DinerLevelUp", {level = curLevel}) | |
549 | + | |
550 | + role:checkTaskEnter("HeroLvlCollect", {}) | |
551 | + role:checkTaskEnter("HeroQualityCollect", {}) | |
552 | + | |
553 | + local curPopular = role.dinerData:getProperty("popular") | |
554 | + role:checkTaskEnter("DinerPopular", {count = curPopular}) | |
555 | + | |
556 | + local rLevel = role:getProperty("level") | |
557 | + role:checkTaskEnter("RoleLevelUp", {level = rLevel}) | |
558 | + | |
559 | + local towerInfo = role:getProperty("towerInfo") | |
560 | + role:checkTaskEnter("TowerPass", {level = towerInfo.l}) | |
561 | + --"PvpWin" | |
562 | + --role:checkTaskEnter("HangPass", {id = 0}) | |
563 | + role:checkCalendaTask(true, 15, 3) | |
564 | + role:checkTaskEnter("HeroStarCollect", {}) | |
565 | + role:checkTaskEnter("RuneQualityCollect", {}) | |
566 | + | |
567 | + end, | |
568 | + ["crossDay"] = function(self, actType, notify, actId) | |
569 | + local actData = self.owner:getProperty("bcTask") or {} | |
570 | + local record = actData["r"] or {} | |
571 | + local actCfg = csvdb["activity_taskCsv"][actId] | |
572 | + if not actCfg then return end | |
573 | + local change = false | |
574 | + for taskId, cfg in pairs(actCfg) do | |
575 | + if cfg["resetType"] == 1 then -- 每日充值 | |
576 | + record[taskId] = nil | |
577 | + actData[taskId] = nil | |
578 | + change = true | |
579 | + end | |
580 | + end | |
581 | + if change then | |
582 | + self.owner:updateProperty({field="bcTask", value=actData}) | |
583 | + end | |
584 | + end, | |
585 | + ["crossWeek"] = function(self, actType, notify, actId) | |
586 | + local actData = self.owner:getProperty("bcTask") or {} | |
587 | + local record = actData["r"] or {} | |
588 | + local actCfg = csvdb["activity_taskCsv"][actId] | |
589 | + if not actCfg then return end | |
590 | + local change = false | |
591 | + for taskId, cfg in pairs(actCfg) do | |
592 | + if cfg["resetType"] == 2 then -- 每周重置 | |
593 | + record[taskId] = nil | |
594 | + actData[taskId] = nil | |
595 | + change = true | |
596 | + end | |
597 | + end | |
598 | + if change then | |
599 | + self.owner:updateProperty({field="bcTask", value=actData}) | |
600 | + end | |
601 | + end, | |
602 | + ["close"] = function(self, actType, notify) | |
603 | + self.owner:updateProperty({field="bcTask", value={}}) | |
604 | + end, | |
605 | +} | |
606 | + | |
488 | 607 | -- 兑换 |
489 | 608 | activityFunc[Activity.ActivityType.Exchange] = { |
490 | 609 | ["init"] = function(self, actType, isCrossDay, notify, actId) |
... | ... | @@ -619,6 +738,18 @@ function Activity:refreshDailyData(notify) |
619 | 738 | end |
620 | 739 | end |
621 | 740 | |
741 | +function Activity:refreshWeekData(notify) | |
742 | + for actId, status in pairs(self._isOpen) do | |
743 | + local actData = csvdb["activity_ctrlCsv"][actId] | |
744 | + if status and actData then | |
745 | + local actType = actData.showType | |
746 | + if activityFunc[actType] and activityFunc[actType]['crossWeek'] then | |
747 | + activityFunc[actType]["crossWeek"](self, actType, notify, actId) | |
748 | + end | |
749 | + end | |
750 | + end | |
751 | +end | |
752 | + | |
622 | 753 | function Activity:checkActivity(notNotify, activityType, ...) |
623 | 754 | if not activityType then return end |
624 | 755 | if not self:isOpen(activityType) then return end |
... | ... | @@ -888,7 +1019,7 @@ activityFunc[Activity.ActivityType.CommonSignIn] = { |
888 | 1019 | local actData = self:getActData(actType) or {} |
889 | 1020 | local actCfg = csvdb["activity_ctrlCsv"][actId] |
890 | 1021 | if not actCfg then return end |
891 | - local conArr = actCfg.condition2:toArray("true", "=") | |
1022 | + local conArr = actCfg.condition2:toArray(true, "=") | |
892 | 1023 | -- 0 登录即可, 1 达到指定活跃度 |
893 | 1024 | if conArr[1] ~= 1 then |
894 | 1025 | return |
... | ... | @@ -901,4 +1032,149 @@ activityFunc[Activity.ActivityType.CommonSignIn] = { |
901 | 1032 | end, |
902 | 1033 | } |
903 | 1034 | |
1035 | +activityFunc[Activity.ActivityType.BattleCommand] = { | |
1036 | + ["init"] = function (self, actType, isCrossDay, notify, actId) | |
1037 | + local data = {unlock = 0, freeR = "", payR = "", lvl = 0, sum = 0, week = 0} | |
1038 | + self:updateActData(actType, data, not notify) | |
1039 | + end, | |
1040 | + ["check"] = function(self, actType, notify, id, count) -- 检查 itemid, count | |
1041 | + local isOpen, actId = self:isOpen(actType) | |
1042 | + local actData = self:getActData(actType) or {} | |
1043 | + local actCfg = csvdb["activity_ctrlCsv"][actId] | |
1044 | + if not actCfg then return end | |
1045 | + if actCfg.condition1 == "" then return end | |
1046 | + local arr = actCfg.condition2:toArray(true, "=") | |
1047 | + local itemIdWeek, itemIdNormal, limit = arr[1], arr[2], arr[3] | |
1048 | + if (itemIdWeek == id or itemIdNormal == id) and count > 0 then | |
1049 | + if itemIdWeek == id then | |
1050 | + if (actData["week"] or 0) >= limit then | |
1051 | + return | |
1052 | + end | |
1053 | + local old = actData["week"] or 0 | |
1054 | + actData["week"] = math.min(old + count, limit) | |
1055 | + count = actData["week"] - old | |
1056 | + end | |
1057 | + local total = actData["sum"] + count | |
1058 | + local curLvl = actData["lvl"] or 0 | |
1059 | + if actCfg.condition == 1 then -- 代表sum需要转换为等级 | |
1060 | + local bpCfg = csvdb["activity_battlepass_rewardCsv"][actId] | |
1061 | + if not bpCfg then return end | |
1062 | + for i = 1, #bpCfg do | |
1063 | + local cfg = bpCfg[i] | |
1064 | + if cfg["type"] > curLvl then | |
1065 | + if total < cfg["condition"] then break end | |
1066 | + total = total - cfg["condition"] | |
1067 | + curLvl = curLvl + 1 | |
1068 | + end | |
1069 | + end | |
1070 | + actData["lvl"] = curLvl | |
1071 | + actData["sum"] = total | |
1072 | + end | |
1073 | + | |
1074 | + self:updateActData(actType, actData) | |
1075 | + end | |
1076 | + end, | |
1077 | + ["crossWeek"] = function(self, actType, notify, actId) | |
1078 | + local actData = self:getActData(actType) or {} | |
1079 | + actData["week"] = 0 | |
1080 | + self:updateActData(actType, actData, true) | |
1081 | + end, | |
1082 | +} | |
1083 | + | |
1084 | + | |
1085 | +activityFunc[Activity.ActivityType.NewSign] = { | |
1086 | + -- ["check"] = function(self, actType, notify) -- 检查 | |
1087 | + -- end, | |
1088 | + ["init"] = function(self, actType, isCrossDay, notify) | |
1089 | + if not isCrossDay then | |
1090 | + activityFunc[Activity.ActivityType.NewSign]["crossDay"](self, actType, notify) | |
1091 | + end | |
1092 | + end, | |
1093 | + -- ["close"] = function(self, actType, notify) | |
1094 | + -- end, | |
1095 | + ["crossDay"] = function(self, actType, notify) | |
1096 | + local curData = self:getActData(actType) | |
1097 | + curData[0] = (curData[0] or 0) + 1 | |
1098 | + local actData = csvdb["activity_signInCsv"][48] or {} | |
1099 | + if curData[0] > #actData then return end -- 满了就忽略了 | |
1100 | + | |
1101 | + -- 没满更新一下 | |
1102 | + self:updateActData(actType, curData, not notify) | |
1103 | + end, | |
1104 | +} | |
1105 | + | |
1106 | +local function closeActAdvHang(role, chapterId) | |
1107 | + local advHang = role:getProperty("advHang") | |
1108 | + local info = advHang[chapterId] | |
1109 | + if not info then return end | |
1110 | + | |
1111 | + local index = info.index or 1 | |
1112 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
1113 | + if not chapterData then return end | |
1114 | + local campSiteData = chapterData[info.campId or 2] | |
1115 | + if not campSiteData then return 1 end | |
1116 | + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机 | |
1117 | + | |
1118 | + local adv_idle_time = globalCsv.adv_idle_time[index] | |
1119 | + local adv_idle_energy = globalCsv.adv_idle_energy[index] | |
1120 | + local adv_idle_reward_coef = globalCsv.adv_idle_reward[index] | |
1121 | + if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then | |
1122 | + return 2 | |
1123 | + end | |
1124 | + adv_idle_time = adv_idle_time * 60 | |
1125 | + | |
1126 | + local reward, isFull, change, heroFaithMap | |
1127 | + local heroCnt = 0 | |
1128 | + if skynet.timex() >= info.time then | |
1129 | + -- 增加英雄信赖 | |
1130 | + local exp = info.duration / 60 | |
1131 | + heroFaithMap = {} | |
1132 | + for _, heroId in pairs(info.format.heros) do | |
1133 | + local curFaith = role:addHeroFaith(heroId, exp) | |
1134 | + heroFaithMap[heroId] = curFaith | |
1135 | + heroCnt = heroCnt + 1 | |
1136 | + end | |
1137 | + | |
1138 | + local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 | |
1139 | + | |
1140 | + local idleReward = totalReward:toNumMap() | |
1141 | + for itemId, count in pairs(idleReward) do | |
1142 | + idleReward[itemId] = count * adv_idle_reward_coef | |
1143 | + end | |
1144 | + reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) | |
1145 | + end | |
1146 | + | |
1147 | + role:changeUpdates({{type = "advHang", field = chapterId, value = nil}}) | |
1148 | + | |
1149 | + role:mylog("adv_action", {desc = "endHang", int1 = chapterId, short1 = 2}) | |
1150 | + | |
1151 | + role:checkTaskEnter("AdvHang", {}) | |
1152 | + role:checkTaskEnter("AdvHangHeroCnt", {count = heroCnt}) | |
1153 | +end | |
1154 | + | |
1155 | +activityFunc[Activity.ActivityType.AdvLevel] = { | |
1156 | + -- ["check"] = function(self, actType, notify) -- 检查 | |
1157 | + -- end, | |
1158 | + ["init"] = function(self, actType, isCrossDay, notify) | |
1159 | + end, | |
1160 | + ["close"] = function(self, actType, notify, actid) | |
1161 | + local actCfg = csvdb["activity_adv_chapterCsv"][actid] | |
1162 | + if not actCfg then return end | |
1163 | + for chapterId, _ in ipairs(actCfg) do | |
1164 | + local advPass = self.owner:getProperty("advPass") | |
1165 | + advPass[chapterId] = nil | |
1166 | + self.owner:updateProperty({field="advPass", value=advPass}) | |
1167 | + | |
1168 | + -- 关闭活动代理拾荒 | |
1169 | + closeActAdvHang(chapterId) | |
1170 | + end | |
1171 | + -- 强制关闭活动拾荒关卡 | |
1172 | + local adv = self.owner:getAdvData() | |
1173 | + if adv:isRunning() and adv:isActivity() then | |
1174 | + adv:forceOver() | |
1175 | + end | |
1176 | + | |
1177 | + end, | |
1178 | +} | |
1179 | + | |
904 | 1180 | return Activity | ... | ... |
src/models/Role.lua
... | ... | @@ -155,6 +155,7 @@ Role.schema = { |
155 | 155 | |
156 | 156 | achiveT = {"table", {}}, -- 成就计数统计 achivement_type {id = status} |
157 | 157 | achiveV = {"table", {}}, -- 成就领奖统计 achivement {id = status} |
158 | + fuxR = {"number", 0}, -- 复兴成就最大完成数量 | |
158 | 159 | |
159 | 160 | rechargeF = {"table", {}}, -- 是否首次充值某一项 -- —{[id] = 1} -- 不存在就是没有充值过 |
160 | 161 | dinerS = {"table", {}}, -- 美食币商城 购买记录 {[id] = count} |
... | ... | @@ -183,6 +184,7 @@ Role.schema = { |
183 | 184 | feedback = {"table", {}}, -- 反馈相关信息 {flag = false, count = 0} flag是否评论过,count 提示次数 |
184 | 185 | |
185 | 186 | calTask = {"table", {}}, -- 英雄令活动 日历任务活动 |
187 | + bcTask = {"table", {}}, -- 英雄令活动 日历任务活动 临时使用 | |
186 | 188 | radioTask = {"table", {}}, -- 电台任务 {id = {time=end_ts,heros=heros}} 表crusadeCsv |
187 | 189 | } |
188 | 190 | |
... | ... | @@ -410,6 +412,7 @@ function Role:data() |
410 | 412 | feedback = self:getProperty("feedback"), |
411 | 413 | ctime = self:getProperty("ctime"), |
412 | 414 | calTask = self:getProperty("calTask"), |
415 | + bcTask = self:getProperty("bcTask"), | |
413 | 416 | radioTask = self:getProperty("radioTask"), |
414 | 417 | } |
415 | 418 | end | ... | ... |
src/models/RoleLog.lua
... | ... | @@ -53,6 +53,10 @@ local ItemReason = { |
53 | 53 | worldBossReward = 137, -- 世界boss翻牌奖励 |
54 | 54 | commonSign = 138, -- 每日活跃签到 |
55 | 55 | actFriendHelp = 139,-- 好友能量互助活动 |
56 | + actBattleCommand = 140, -- 活动战令 | |
57 | + actBuyBpLevel = 141, -- 购买活动战令等级 | |
58 | + newSign = 142,-- 新的活动签到 | |
59 | + advLevelStage = 143, -- 拾荒活动阶段奖励 | |
56 | 60 | |
57 | 61 | |
58 | 62 | advHang = 301, -- 拾荒挂机 |
... | ... | @@ -94,6 +98,7 @@ local ItemReason = { |
94 | 98 | actPaySign = 1008, -- 活动付费签到 |
95 | 99 | calendaTask = 1009, -- 英雄帖 |
96 | 100 | actMilecrisis = 1010, -- 物资危机 |
101 | + battleCommandTask = 1011, -- 将军令任务 | |
97 | 102 | |
98 | 103 | -- 餐厅 |
99 | 104 | greenHourse = 1101, -- 食材获得 |
... | ... | @@ -879,4 +884,4 @@ function RoleLog.bind(Role) |
879 | 884 | |
880 | 885 | |
881 | 886 | end |
882 | -return RoleLog | |
883 | 887 | \ No newline at end of file |
888 | +return RoleLog | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -135,6 +135,15 @@ function RolePlugin.bind(Role) |
135 | 135 | self:addPotion({id = itemId, count = count, notNotify = pms.notNotify, log = pms.log}) |
136 | 136 | end, |
137 | 137 | } |
138 | + | |
139 | + if count > 0 then | |
140 | + local itemCfg = csvdb["itemCsv"][itemId] | |
141 | + local itemType = 0 | |
142 | + if itemCfg then | |
143 | + itemType = itemCfg.type | |
144 | + end | |
145 | + self:checkTaskEnter("AddItem", {id = itemId, count = count, type = itemType}) | |
146 | + end | |
138 | 147 | -- 对数量筛查 |
139 | 148 | count = checkItemCount(self, itemId, count) |
140 | 149 | if count ~= 0 then |
... | ... | @@ -515,6 +524,8 @@ function RolePlugin.bind(Role) |
515 | 524 | end |
516 | 525 | |
517 | 526 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
527 | + | |
528 | + self:checkTaskEnter("CostDiamond", {count = count}) | |
518 | 529 | return true |
519 | 530 | end |
520 | 531 | |
... | ... | @@ -1687,7 +1698,7 @@ function RolePlugin.bind(Role) |
1687 | 1698 | for k , v in pairs(csvdb["shop_rechargeCsv"]) do |
1688 | 1699 | if not v[pidField] then return "no product" end |
1689 | 1700 | if v[pidField] == params.product_id then |
1690 | - if v.rmb ~= params.money then | |
1701 | + if v.twd * 100 ~= tonumber(params.money) then | |
1691 | 1702 | return "error money" |
1692 | 1703 | end |
1693 | 1704 | -- 发现需要的id |
... | ... | @@ -1812,12 +1823,13 @@ function RolePlugin.bind(Role) |
1812 | 1823 | -- 充值 -- |
1813 | 1824 | --[[ |
1814 | 1825 | request.order = data.out_trade_no |
1815 | - request.amount = data.money / 100 | |
1826 | + request.amount = data.money | |
1816 | 1827 | request.game_money = data.game_money |
1817 | 1828 | request.product_id = data.product_id |
1818 | 1829 | request.pay_time = data.pay_time |
1819 | 1830 | request.transactionId = data.order_no |
1820 | 1831 | request.extension_info = data.extension_info |
1832 | + request.is_mycard = 1 | |
1821 | 1833 | ]] |
1822 | 1834 | function Role:handlePurchase(params) |
1823 | 1835 | local roleId = self:getProperty("id") |
... | ... | @@ -1833,7 +1845,7 @@ function RolePlugin.bind(Role) |
1833 | 1845 | end |
1834 | 1846 | local rechargeId = back |
1835 | 1847 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] |
1836 | - if rechargeData.rmb ~= tonumber(params.amount) then | |
1848 | + if (params.is_mycard and rechargeData.twd * 100 ~= tonumber(params.amount)) or (not params.is_mycard and rechargeData.rmb * 100 ~= tonumber(params.amount)) then | |
1837 | 1849 | skynet.error(string.format("[recharge] fake order: %s, roleId: %d, order: %s, rmb %s, get %s", |
1838 | 1850 | params.transactionId, roleId, partnerOrderStr, rechargeData.rmb, params.amount |
1839 | 1851 | )) |
... | ... | @@ -1885,7 +1897,7 @@ function RolePlugin.bind(Role) |
1885 | 1897 | self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) |
1886 | 1898 | elseif rechargeData.shop == 2 then --通行证商店 |
1887 | 1899 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
1888 | - self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id) | |
1900 | + self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) | |
1889 | 1901 | elseif rechargeData.shop == 3 then -- 礼包商店 |
1890 | 1902 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
1891 | 1903 | else |
... | ... | @@ -2125,6 +2137,15 @@ function RolePlugin.bind(Role) |
2125 | 2137 | return {list = list, rank = rank} |
2126 | 2138 | end |
2127 | 2139 | |
2140 | + function Role:addHeroFaith(heroId, exp) | |
2141 | + local hero = self.heros[heroId] | |
2142 | + if not hero then | |
2143 | + return | |
2144 | + end | |
2145 | + | |
2146 | + hero:addHeroFaith(exp) | |
2147 | + return hero:getProperty("faith") | |
2148 | + end | |
2128 | 2149 | |
2129 | 2150 | end |
2130 | 2151 | ... | ... |
src/models/RoleTask.lua
... | ... | @@ -15,6 +15,7 @@ local TaskType = { |
15 | 15 | HeroLvlCollect = 10, -- 英雄等级收集进度 |
16 | 16 | HeroQualityCollect = 11, -- 英雄品质收集进度 |
17 | 17 | HeroStarCollect = 12, -- 英雄星级收集进度 |
18 | + DrawHeroNotFriend = 13, -- 非友情招募 -- count | |
18 | 19 | |
19 | 20 | --装备相关 |
20 | 21 | AddEquip = 101, -- 获得装备 - equipId rarity |
... | ... | @@ -53,7 +54,8 @@ local TaskType = { |
53 | 54 | AdvMineLayer = 414, -- 宝藏洞激活 |
54 | 55 | AdvKillBoss = 415, -- 拾荒击杀boss |
55 | 56 | AdvHangHeroCnt = 416, -- 拾荒人数 |
56 | - AdvPassFirst = 417, -- 冒险首次通关 - id | |
57 | + AdvCostPower = 417, -- 消耗体力 | |
58 | + AdvPassFirst = 418, -- 冒险首次通关 - id | |
57 | 59 | |
58 | 60 | --爬塔相关 |
59 | 61 | TowerPass = 501, -- 爬塔通关 - level |
... | ... | @@ -98,6 +100,10 @@ local TaskType = { |
98 | 100 | DailyTask = 904, -- 完成每日活跃任务 |
99 | 101 | RadioTaskStart = 905, -- 电台任务开始 |
100 | 102 | FinishSpeTask = 906, -- 指定任务完成 |
103 | + AddItem = 907, -- 获得道具 | |
104 | + Login = 908, -- 登入 | |
105 | + CostDiamond = 909, -- 消耗钻石 | |
106 | + WeekTask = 910, -- 完成每周活跃任务 | |
101 | 107 | |
102 | 108 | --功能未实现 todo |
103 | 109 | AdvShop = 1002, -- 冒险商城 |
... | ... | @@ -239,6 +245,7 @@ local ActivityListener = { |
239 | 245 | [TaskType.AdvMineKill] = {{Activity.ActivityType.Crisis, 1}}, |
240 | 246 | [TaskType.AdvMineLayer] = {{Activity.ActivityType.Crisis, 2}}, |
241 | 247 | [TaskType.DailyTask] = {{Activity.ActivityType.CommonSignIn, f("pre"), f("cur")}}, |
248 | + [TaskType.AddItem] = {{Activity.ActivityType.BattleCommand, f("id"), f("count")}}, | |
242 | 249 | } |
243 | 250 | } |
244 | 251 | |
... | ... | @@ -278,15 +285,27 @@ local CalendaTaskListener = { |
278 | 285 | [TaskType.OpenBox]= {{20, 3, f("count"), f("quality")}}, |
279 | 286 | [TaskType.RadioTaskStart] = {{21, 1}, {22, 3, f("heroCnt")}}, |
280 | 287 | [TaskType.BonusQuick] = {{23, 1, f("count")}}, |
281 | - [TaskType.AdvHangHeroCnt] = {{24, 3, f("HeroCnt")}}, | |
288 | + [TaskType.AdvHangHeroCnt] = {{24, 3, f("count")}}, | |
282 | 289 | [TaskType.AdvKillBoss] = {{25, 1}}, |
283 | 290 | [TaskType.AdvMineKill] = {{26, 1}}, |
284 | 291 | [TaskType.PvpBattle] = {{27, 1}}, |
285 | 292 | [TaskType.FinishSpeTask] = {{28, 3, f("taskId"), f("actId")}}, |
286 | - | |
293 | + [TaskType.Login] = {{29, 1}}, | |
294 | + [TaskType.DailyTask] = {{30, 2, f("cur")}}, | |
295 | + [TaskType.WeekTask] = {{31, 2, f("cur")}}, | |
296 | + [TaskType.MakeFood] = {{32, 1, f("count")}}, | |
297 | + [TaskType.AddItem] = {{33, 3, f("type"), f("count")}}, | |
298 | + [TaskType.CostDiamond] = {{34, 1, f("count")}}, | |
299 | + [TaskType.DrawHeroNotFriend] = {{35, 1, f("count")}}, | |
300 | + [TaskType.AdvCostPower] = {{36, 1, f("count")}}, | |
287 | 301 | } |
288 | 302 | } |
289 | 303 | |
304 | +local BattleCommandTaskListener = { | |
305 | + func = "checkBattleCommandTask", | |
306 | + listen = CalendaTaskListener["listen"] | |
307 | +} | |
308 | + | |
290 | 309 | local TaskListeners = { |
291 | 310 | StoryListener, |
292 | 311 | CommonListener, |
... | ... | @@ -295,6 +314,7 @@ local TaskListeners = { |
295 | 314 | ActivityListener, |
296 | 315 | StoreListener, |
297 | 316 | CalendaTaskListener, |
317 | + BattleCommandTaskListener, | |
298 | 318 | } |
299 | 319 | |
300 | 320 | local RoleTask = {} |
... | ... | @@ -623,15 +643,136 @@ function RoleTask.bind(Role) |
623 | 643 | end |
624 | 644 | |
625 | 645 | function Role:checkCalendaTask(notNotify, mainType, subType, param1, param2) |
626 | - --print("check calenda taskl", mainType, subType, param1, param2) | |
646 | + --print("check calenda task", mainType, subType, param1, param2) | |
647 | + local actEnum = "CalendaTask" | |
648 | + local keyName = "calTask" | |
649 | + if not self.activity then return end | |
650 | + local open, actId = self.activity:isOpen(actEnum) | |
651 | + local actData = csvdb["activity_ctrlCsv"][actId] | |
652 | + if not actData then return end | |
653 | + if not open then return end | |
654 | + | |
655 | + local change = false | |
656 | + local calTask = self:getProperty(keyName) or {} | |
657 | + param1 = param1 or 1 | |
658 | + | |
659 | + local cid = actData.condition | |
660 | + for k, taskList in pairs(csvdb["activity_taskCsv"]) do | |
661 | + if k == cid then | |
662 | + for id, cfg in pairs(taskList) do | |
663 | + if cfg.type == mainType then | |
664 | + if subType == 1 then -- 增加数值 | |
665 | + calTask[id] = (calTask[id] or 0) + param1 | |
666 | + elseif subType == 2 then -- 直接赋值 | |
667 | + calTask[id] = param1 | |
668 | + elseif subType == 3 then -- 自定义类型 | |
669 | + if cfg.type == 7 then -- 英雄品质收集进度 | |
670 | + local count = 0 | |
671 | + for _, hero in pairs(self.heros) do | |
672 | + local unitData = csvdb["unitCsv"][hero:getProperty("type")] | |
673 | + if unitData then | |
674 | + if cfg.condition2 <= unitData.rare then | |
675 | + count = count + 1 | |
676 | + end | |
677 | + end | |
678 | + end | |
679 | + if (calTask[id] or 0) < count then | |
680 | + calTask[id] = count | |
681 | + end | |
682 | + elseif cfg.type == 5 then -- 英雄等级收集进度 | |
683 | + local count = 0 | |
684 | + for _, hero in pairs(self.heros) do | |
685 | + if cfg.condition2 <= hero:getProperty("level") then | |
686 | + count = count + 1 | |
687 | + end | |
688 | + end | |
689 | + if (calTask[id] or 0) < count then | |
690 | + calTask[id] = count | |
691 | + end | |
692 | + elseif cfg.type == 16 then -- 英雄星级收集进度 | |
693 | + local count = 0 | |
694 | + for _, hero in pairs(self.heros) do | |
695 | + if cfg.condition2 <= hero:getProperty("wakeL") then | |
696 | + count = count + 1 | |
697 | + end | |
698 | + end | |
699 | + if (calTask[id] or 0) < count then | |
700 | + calTask[id] = count | |
701 | + end | |
702 | + elseif cfg.type == 18 then -- 挂机累计收获id,y个 | |
703 | + for rid, v in pairs(param1) do | |
704 | + if cfg.condition2 == rid then | |
705 | + calTask[id] = (calTask[id] or 0) + v | |
706 | + end | |
707 | + end | |
708 | + elseif cfg.type == 19 then -- x名英雄装备y品质以上符文套装 | |
709 | + local count = 0 | |
710 | + for _, hero in pairs(self.heros) do | |
711 | + local rcount = 0 | |
712 | + for _,uid in pairs(hero:getRunes()) do | |
713 | + if uid > 0 then | |
714 | + local runeData = self.runeBag[uid] | |
715 | + if runeData then | |
716 | + local csvData = csvdb["runeCsv"][runeData:getProperty("type")][runeData:getProperty("id")] | |
717 | + | |
718 | + if csvData and cfg.condition2 <= csvData.rarity then | |
719 | + rcount = rcount + 1 | |
720 | + end | |
721 | + end | |
722 | + end | |
723 | + end | |
724 | + if rcount == 6 then | |
725 | + count = count + 1 | |
726 | + end | |
727 | + end | |
728 | + calTask[id] = count | |
729 | + elseif cfg.type == 20 then -- 开启x品质时钟箱子 | |
730 | + if cfg.condition2 <= (param2 or 0) then | |
731 | + calTask[id] = (calTask[id] or 0) + param1 | |
732 | + end | |
733 | + elseif cfg.type == 15 then -- 通关关卡 | |
734 | + if (calTask[id] or 0) == 0 then | |
735 | + local hangPass = self:getProperty("hangPass") | |
736 | + local diff = math.floor(cfg.condition2 / 10000) | |
737 | + if (hangPass[diff] or 0) >= cfg.condition1 then | |
738 | + calTask[id] = 1 | |
739 | + end | |
740 | + end | |
741 | + elseif cfg.type == 22 then -- 电台任务出勤人数 | |
742 | + calTask[id] = (calTask[id] or 0) + (param1 or 0) | |
743 | + elseif cfg.type == 24 then -- 代理拾荒出勤人数 | |
744 | + calTask[id] = (calTask[id] or 0) + (param1 or 0) | |
745 | + elseif cfg.type == 28 then -- 完成指定任务 | |
746 | + --print(actId,param2, cfg.condition2, param1) | |
747 | + if actId == param2 and cfg.condition2 == param1 then | |
748 | + calTask[id] = (calTask[id] or 0) + 1 | |
749 | + end | |
750 | + elseif cfg.type == 33 then -- 获得指定类型道具多少个 | |
751 | + if cfg.condition2 == param1 then | |
752 | + calTask[id] = (calTask[id] or 0) + (param2 or 0) | |
753 | + end | |
754 | + end | |
755 | + end | |
756 | + end | |
757 | + end | |
758 | + end | |
759 | + end | |
760 | + self:updateProperty({field = keyName, value = calTask, notNotify = notNotify}) | |
761 | + --dump(calTask) | |
762 | + end | |
763 | + | |
764 | + function Role:checkBattleCommandTask(notNotify, mainType, subType, param1, param2) | |
765 | + --print("check battle command task", mainType, subType, param1, param2) | |
766 | + local actEnum = "BattleCommandTask" | |
767 | + local keyName = "bcTask" | |
627 | 768 | if not self.activity then return end |
628 | - local open, actId = self.activity:isOpen("CalendaTask") | |
769 | + local open, actId = self.activity:isOpen(actEnum) | |
629 | 770 | local actData = csvdb["activity_ctrlCsv"][actId] |
630 | 771 | if not actData then return end |
631 | 772 | if not open then return end |
632 | 773 | |
633 | 774 | local change = false |
634 | - local calTask = self:getProperty("calTask") or {} | |
775 | + local calTask = self:getProperty(keyName) or {} | |
635 | 776 | param1 = param1 or 1 |
636 | 777 | |
637 | 778 | local cid = actData.condition |
... | ... | @@ -721,17 +862,21 @@ function RoleTask.bind(Role) |
721 | 862 | elseif cfg.type == 24 then -- 代理拾荒出勤人数 |
722 | 863 | calTask[id] = (calTask[id] or 0) + (param1 or 0) |
723 | 864 | elseif cfg.type == 28 then -- 完成指定任务 |
724 | - print(actId,param2, cfg.condition2, param1) | |
865 | + --print(actId,param2, cfg.condition2, param1) | |
725 | 866 | if actId == param2 and cfg.condition2 == param1 then |
726 | 867 | calTask[id] = (calTask[id] or 0) + 1 |
727 | 868 | end |
869 | + elseif cfg.type == 33 then -- 获得指定类型道具多少个 | |
870 | + if cfg.condition2 == param1 then | |
871 | + calTask[id] = (calTask[id] or 0) + (param2 or 0) | |
872 | + end | |
728 | 873 | end |
729 | 874 | end |
730 | 875 | end |
731 | 876 | end |
732 | 877 | end |
733 | 878 | end |
734 | - self:updateProperty({field = "calTask", value = calTask, notNotify = notNotify}) | |
879 | + self:updateProperty({field = keyName, value = calTask, notNotify = notNotify}) | |
735 | 880 | --dump(calTask) |
736 | 881 | end |
737 | 882 | ... | ... |
src/models/RoleTimeReset.lua
src/models/Store.lua
... | ... | @@ -186,7 +186,7 @@ end |
186 | 186 | |
187 | 187 | |
188 | 188 | -- 购买通行证 |
189 | -function Store:onBuyCard(type, duration, id) | |
189 | +function Store:onBuyCard(type, duration, id, actid) | |
190 | 190 | local timeNow = skynet.timex() |
191 | 191 | if type == CardType.NormalMonthCard then |
192 | 192 | if self:isMonthCardExpire() then |
... | ... | @@ -221,6 +221,18 @@ function Store:onBuyCard(type, duration, id) |
221 | 221 | info["flag"] = 1 |
222 | 222 | bpInfo[index] = info |
223 | 223 | self:updateProperty({field = "bpInfo", value = bpInfo}) |
224 | + elseif type == CardType.ActBattleCommandCard then | |
225 | + if not self.owner.activity:isOpenById(actid, "ActShopGoods") then | |
226 | + return | |
227 | + end | |
228 | + local actCfg = csvdb["activity_ctrlCsv"][actid] | |
229 | + if not actCfg then return end | |
230 | + local actData = self.owner.activity:getActData("BattleCommand") or {} | |
231 | + actData["unlock"] = 1 | |
232 | + if actCfg.condition ~= 0 then | |
233 | + actData["lvl"] = (actData["lvl"] or 0) + actCfg.condition | |
234 | + end | |
235 | + self.owner.activity:updateActData("BattleCommand", actData) | |
224 | 236 | end |
225 | 237 | end |
226 | 238 | ... | ... |
src/services/httpweb.lua
... | ... | @@ -41,8 +41,10 @@ local port = ... |
41 | 41 | port = tonumber(port) |
42 | 42 | |
43 | 43 | local key = "zhaolu1234dangge" |
44 | -local function response(id, ...) | |
45 | - local ok, err = httpd.write_response(sockethelper.writefunc(id), ...) | |
44 | +local function response(id, code, body) | |
45 | + local ok, err = httpd.write_response(sockethelper.writefunc(id), code, body, { | |
46 | + ["Connection"] = "Close", | |
47 | + }) | |
46 | 48 | if not ok then |
47 | 49 | -- if err == sockethelper.socket_error , that means socket closed. |
48 | 50 | skynet.error(string.format("fd = %d, %s", id, err)) | ... | ... |