ComboTest.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. -- 连击试炼副本
  2. ComboTest = {}
  3. local this = {}
  4. --- 小红点id
  5. this.RedId = 101
  6. local MONSTER_ID_KEY = "COMBO_MONSTER"
  7. local REP_ID_KEY = "COMBO_ID"
  8. local COMBO_ADD_COUNT = "T$COMBO_ADD_COUNT"
  9. local MAX_LEVEL = "T$_COMBO_TEST_MAX_LEVEL"
  10. -- 连击技能面板
  11. function ComboTest.ReqComboTestPanelInfo(actor)
  12. local totalCount = 0
  13. local numberAdd = ConfigDataManager.getTableValue("cfg_activity_rule", "numberAdd", "id", DuplicateType.COMBO_TEST)
  14. if not string.isNullOrEmpty(numberAdd) then
  15. local activeCount = string.split(numberAdd, "#")
  16. totalCount = totalCount + tonumber(activeCount[1])
  17. end
  18. local addCountInfo = getplaydef(actor, COMBO_ADD_COUNT)
  19. if not table.isNullOrEmpty(addCountInfo) then
  20. totalCount = totalCount + tonumber(addCountInfo.addCount)
  21. end
  22. local privilegeOpen, comboNum = PrivilegeMonth.hasPrivilege(actor, PrivilegeMonth.PrivilegeType.COMBO_NUM)
  23. if privilegeOpen then
  24. totalCount = totalCount + tonumber(comboNum)
  25. end
  26. local maxLevel = getplaydef(actor, MAX_LEVEL)
  27. if string.isNullOrEmpty(maxLevel) then
  28. local res = {
  29. id = 0,
  30. level = 0,
  31. count = totalCount
  32. }
  33. sendluamsg(actor, LuaMessageIdToClient.COMBO_TEST_PANEL_INFO, res)
  34. return
  35. end
  36. local id = tonumber(ComboTest.level2ConfigId(maxLevel))
  37. local res = {
  38. id = id,
  39. level = maxLevel,
  40. count = totalCount
  41. }
  42. sendluamsg(actor, LuaMessageIdToClient.COMBO_TEST_PANEL_INFO, res)
  43. end
  44. -- 进入连击试炼
  45. function ComboTest.ReqEnterComboTest(actor, configId)
  46. --个人进入
  47. if DuplicateCommon.CheckEnterConditonCommon(actor, configId) ~= EnterLimitResultConst.ALLOW then
  48. return
  49. end
  50. if not ComboTest.CheckEnterCondition(actor, configId) then
  51. return
  52. end
  53. local maxHP = getattrinfo(actor, "maxHP")
  54. local maxMP = getattrinfo(actor, "maxMP")
  55. sethp(actor, maxHP)
  56. setmp(actor, maxMP)
  57. --寻找是否有可进入的副本,如果没有创建副本
  58. local mapId = DuplicateCommon.CreateDupMapCommon(actor, configId, true)
  59. local x, y = DuplicateCommon.GetEnterPointXYCommon(configId)
  60. --回蓝回血
  61. DuplicateCommon.RecoverHPMP(actor)
  62. --进入副本
  63. enterduplicate(actor, mapId, x, y)
  64. end
  65. -- 校验连击技能等级是否可以进入
  66. function ComboTest.CheckEnterCondition(actor, configId)
  67. local repLevel = ConfigDataManager.getTableValue("cfg_rep", "repLevel", "id", configId)
  68. local maxLevel = getplaydef(actor, MAX_LEVEL)
  69. repLevel = tonumber(repLevel)
  70. if (maxLevel == nil and repLevel > 1) or (maxLevel ~= nil and (tonumber(repLevel) - 1) > maxLevel) then
  71. tipinfo(actor, "请先挑战前边没有挑战过的关卡")
  72. return false
  73. end
  74. local skill = ConfigDataManager.getTableValue("cfg_rep", "skill", "id", configId)
  75. local comboSkill = getrolefield(actor, "role.roleskill.comboskill")
  76. local skillLv = comboSkill.skillLv
  77. local skillCfgId = comboSkill.skillCfgId
  78. if not string.isNullOrEmpty(skill) then
  79. local skillCfg = string.split(skill, "|")
  80. for index, skillInfo in pairs(skillCfg) do
  81. local skillDetail = string.split(skillInfo, "#")
  82. if tonumber(skillDetail[2]) == skillCfgId and tonumber(skillDetail[3]) <= skillLv then
  83. return true
  84. end
  85. end
  86. else
  87. return true
  88. end
  89. tipinfo(actor, "连击技能等级不够")
  90. return false
  91. end
  92. -- @description 初始化副本数据
  93. -- @param 副本地图id;cfg_rep的id
  94. -- @return
  95. function ComboTest.InitComboTest(mapId, configId)
  96. --当前任务信息
  97. local taskId = ConfigDataManager.getTableValue("cfg_rep", "repTarget", "id", configId)
  98. local taskInfo = DuplicateCommon.GenDupTaskInfoCommon(taskId)
  99. taskInfo[5] = 0
  100. setenvirvar(mapId, DuplicateVarConst.COMBO_TEST_TASK_INFO, taskInfo)
  101. end
  102. -- @description 任务阶段更新响应
  103. -- @param 玩家对象;地图唯一id
  104. -- @return
  105. function ComboTest.ResTaskPhaseUpdate(actor, mapId)
  106. local taskInfo = getenvirvar(mapId, DuplicateVarConst.COMBO_TEST_TASK_INFO)
  107. if table.isNullOrEmpty(taskInfo) then
  108. return
  109. end
  110. local nowPhase = taskInfo[1]
  111. local taskId = taskInfo[2]
  112. local totalCount = taskInfo[3]
  113. local nowCount = taskInfo[4]
  114. local response = {}
  115. response["phase"] = nowPhase
  116. response["taskId"] = taskId
  117. response["nowCount"] = nowCount
  118. response["totalCount"] = totalCount
  119. -- 协议
  120. sendluamsg(actor, LuaMessageIdToClient.RES_COMBO_TES_TASK_UPDATE, response)
  121. end
  122. -- @description 通知地图玩家任务阶段更新响应
  123. -- @param 玩家对象;地图唯一id
  124. -- @return
  125. function ComboTest.ResAllTaskPhaseUpdate(mapId)
  126. local dupInfo = getduplicate(mapId)
  127. local players = dupInfo["players"]
  128. for index, actor in ipairs(players) do
  129. ComboTest.ResTaskPhaseUpdate(actor, mapId)
  130. end
  131. end
  132. -- 连击试炼红点
  133. function ComboTest.CheckEnter(actor)
  134. local leftCount = getleftcountofactivity(actor, DuplicateType.COMBO_TEST)
  135. if leftCount <= 0 then
  136. return false
  137. else
  138. return true
  139. end
  140. end
  141. function ComboTest.refreshRedDot(actor)
  142. RedPoint.sendOneRedPoint(actor, this.RedId, ComboTest.CheckEnter(actor) or false)
  143. end
  144. function ComboTest.loginRedDot(red_data, actor)
  145. if ComboTest.CheckEnter(actor) then
  146. red_data[this.RedId] = true
  147. end
  148. end
  149. function ComboTest.ComboStateUpdate(system, id, state, nextStateStartTime, configId)
  150. if state == DuplicateState.PREPARE then
  151. ComboTest.InitComboTest(id, configId)
  152. elseif state == DuplicateState.FIGHT then
  153. --战斗阶段,刷怪
  154. local monsterId = ConfigDataManager.getTableValue("cfg_rep", "monster", "id", configId)
  155. --jprint("【连击试炼】战斗阶段开始刷怪",configId,id,state)
  156. DuplicateCommon.DupGenMonsterCommon(id, monsterId)
  157. --记录当前是那波怪物
  158. setenvirvar(id, MONSTER_ID_KEY, monsterId)
  159. --把副本的配置ID保存起来
  160. setenvirvar(id, REP_ID_KEY, configId)
  161. -- setenvirvar(id, REWARD, false)
  162. ComboTest.resCurrencyStateInfo(state, id)
  163. elseif state == DuplicateState.FINISH then
  164. local dupInfo = getduplicate(id)
  165. local players = table.getValue(dupInfo, "players")
  166. for _, actor in ipairs(players) do
  167. ComboTest.ResTaskPhaseUpdate(actor, id)
  168. end
  169. local taskInfo = getenvirvar(id, DuplicateVarConst.COMBO_TEST_TASK_INFO)
  170. if taskInfo[3] ~= taskInfo[4] then
  171. local configId = getenvirvar(id, REP_ID_KEY)
  172. for _, actor in ipairs(players) do
  173. this.lowestRewardByLevel(actor, configId)
  174. DuplicateCommon.ReqQuitDuplicate(actor)
  175. this.deleteTicket(actor, configId, 1)
  176. end
  177. return
  178. end
  179. ComboTest.resCurrencyStateInfo(state, id)
  180. elseif state == DuplicateState.CLOSED then
  181. --local reward = getenvirvar(id, REWARD)
  182. --if reward == nil or reward then
  183. -- return
  184. --end
  185. local dupInfo = getduplicate(id)
  186. local players = table.getValue(dupInfo, "players")
  187. if table.isNullOrEmpty(players) then
  188. return
  189. end
  190. for _, actor in ipairs(players) do
  191. ComboTest.rewardByLevel(actor, configId)
  192. end
  193. end
  194. end
  195. -- @description 响应给客户端当前阶段
  196. -- @param 玩家对象;地图id
  197. -- @return
  198. function ComboTest.resCurrencyStateInfo(state, mapId, actor)
  199. local dupInfo = getduplicate(mapId)
  200. local players = table.getValue(dupInfo, "players")
  201. local configId = table.getValue(dupInfo, "dupcfgid")
  202. local nextStateStartTime = table.getValue(dupInfo, "nextstatetime")
  203. local ok = false
  204. local taskInfo = getenvirvar(mapId, DuplicateVarConst.COMBO_TEST_TASK_INFO)
  205. if taskInfo[3] == taskInfo[4] and state == DuplicateState.FINISH then
  206. ok = true
  207. end
  208. local res = { state, tostring(nextStateStartTime), configId, ok }
  209. if actor ~= nil then
  210. sendluamsg(actor, LuaMessageIdToClient.COMBO_TEST_STATE, res)
  211. else
  212. for _, actor in ipairs(players) do
  213. sendluamsg(actor, LuaMessageIdToClient.COMBO_TEST_STATE, res)
  214. end
  215. end
  216. end
  217. -- 进入连击试炼后
  218. function ComboTest.AfterEnterComboTest(actor, mapId, state, nextStateStartTime, configId)
  219. ComboTest.resCurrencyStateInfo(state, mapId, actor)
  220. ComboTest.ResTaskPhaseUpdate(actor, mapId)
  221. end
  222. -- @description 刷怪
  223. -- @param 地图唯一id;刷怪表id
  224. -- @return
  225. function ComboTest.GenMonsterComboTest(mapId, genMonCfgId)
  226. --战斗阶段才可以刷怪
  227. local dupInfo = getduplicate(mapId)
  228. if dupInfo["state"] ~= DuplicateState.FIGHT then
  229. return
  230. end
  231. --储存当前刷怪配置
  232. setenvirvar(mapId, MONSTER_ID_KEY, genMonCfgId)
  233. DuplicateCommon.DupGenMonsterCommon(mapId, genMonCfgId)
  234. end
  235. -- 连击试炼怪物死亡
  236. function ComboTest.ComboTestMonsterDie(mapId, killer, monCfgId, monActor)
  237. -- 更新任务信息
  238. local taskInfo = getenvirvar(mapId, DuplicateVarConst.COMBO_TEST_TASK_INFO)
  239. local killTotal = taskInfo[4]
  240. local newKillTotal = killTotal + 1
  241. taskInfo[4] = newKillTotal
  242. local kill = taskInfo[5]
  243. taskInfo[5] = kill + 1
  244. -- setenvirvar(mapId, DuplicateVarConst.COMBO_TEST_TASK_INFO,taskInfo)
  245. -- 判断是否需要刷下一波怪物
  246. local monsterCfgId = getenvirvar(mapId, MONSTER_ID_KEY)
  247. if monsterCfgId == nil then
  248. return
  249. end
  250. local killCount = ConfigDataManager.getTableValue("cfg_repMonster", "kill", "id", monsterCfgId)
  251. if not string.isNullOrEmpty(killCount) and taskInfo[5] == tonumber(killCount) then
  252. -- 刷新下一波怪物
  253. local nextId = ConfigDataManager.getTableValue("cfg_repMonster", "nextID", "id", monsterCfgId)
  254. if not string.isNullOrEmpty(nextId) then
  255. ComboTest.GenMonsterComboTest(mapId, tonumber(nextId))
  256. end
  257. taskInfo[5] = 0
  258. end
  259. setenvirvar(mapId, DuplicateVarConst.COMBO_TEST_TASK_INFO, taskInfo)
  260. if newKillTotal == taskInfo[3] then
  261. -- 设置最大关卡
  262. local cfgId = getenvirvar(mapId, REP_ID_KEY)
  263. --记录下当前的关卡层级
  264. local level = ComboTest.config2Level(cfgId)
  265. local maxLevel = getplaydef(killer, MAX_LEVEL)
  266. if maxLevel == nil or maxLevel < level then
  267. -- 判断是否需要增加副本挑战次数
  268. this.addCount(killer, cfgId)
  269. setplaydef(killer, MAX_LEVEL, level)
  270. end
  271. setduplicatestate(mapId, SetDuplicateStateConst.TO_FINISH)
  272. end
  273. ComboTest.ResAllTaskPhaseUpdate(mapId)
  274. end
  275. -- 扣除门票
  276. function this.deleteTicket(actor, configId, count)
  277. local itemId = ConfigDataManager.getTableValue("cfg_rep", "itemId", "id", configId)
  278. if not string.isNullOrEmpty(itemId) then
  279. local costItem = string.toIntIntMap(itemId, "#", "|")
  280. for itemId, needCount in pairs(costItem) do
  281. removeitemfrombag(actor, tonumber(itemId), tonumber(needCount) * count, 0, 9999, '连击试练')
  282. end
  283. end
  284. end
  285. -- 领取领奖
  286. function ComboTest.rewardByLevel(actor, cfgId)
  287. local mapId = getbaseinfo(actor, "unimapid")
  288. local activityId = ConfigDataManager.getTableValue("cfg_rep", "type", "id", cfgId)
  289. reduceactivitytimes(actor, activityId, 1)
  290. --local cfgId = BraveTest.level2ConfigId(currLevel)
  291. if string.isNullOrEmpty(cfgId) then
  292. noticeTip.noticeinfo(actor, StringIdConst.TEXT387)
  293. return
  294. end
  295. local reward = ConfigDataManager.getTableValue("cfg_rep", "reward", "id", cfgId)
  296. if string.isNullOrEmpty(reward) then
  297. noticeTip.noticeinfo(actor, StringIdConst.TEXT388)
  298. return
  299. end
  300. local rewardMap = string.toIntIntMap(reward, "#", "|")
  301. if table.isNullOrEmpty(rewardMap) then
  302. noticeTip.noticeinfo(actor, StringIdConst.TEXT389)
  303. return
  304. end
  305. this.sendRewards4String(actor, rewardMap)
  306. DuplicateCommon.FinishDupActivity(actor, cfgId)
  307. this.deleteTicket(actor, cfgId, 1)
  308. DuplicateCommon.ReqQuitDuplicate(actor)
  309. ComboTest.refreshRedDot(actor)
  310. end
  311. function this.sendRewards4String(actor, rewardsString)
  312. -- local rewardsMap = string.toIntIntMap(rewardsString, "#", "|")
  313. -- 添加奖励到背包
  314. additemmaptobag(actor, rewardsString, 0, 9999, '连击技能')
  315. --奖励面板通知
  316. sendluamsg(actor, LuaMessageIdToClient.COMBO_REWARD_PANEL, rewardsString)
  317. end
  318. function ComboTest.quitDuplicate(actor, cfgId)
  319. this.lowestRewardByLevel(actor, cfgId)
  320. this.deleteTicket(actor, cfgId, 1)
  321. end
  322. -- 发送保底奖励
  323. function this.lowestRewardByLevel(actor, cfgId)
  324. -- 通关失败不扣除次数
  325. -- local cfgId = BraveTest.level2ConfigId(currLevel)
  326. if string.isNullOrEmpty(cfgId) then
  327. noticeTip.noticeinfo(actor, StringIdConst.TEXT387)
  328. return
  329. end
  330. local reward = ConfigDataManager.getTableValue("cfg_rep", "lowestReward", "id", cfgId)
  331. if string.isNullOrEmpty(reward) then
  332. noticeTip.noticeinfo(actor, StringIdConst.TEXT388)
  333. return
  334. end
  335. local rewardMap = string.toIntIntMap(reward, "#", "|")
  336. if table.isNullOrEmpty(rewardMap) then
  337. noticeTip.noticeinfo(actor, StringIdConst.TEXT389)
  338. return
  339. end
  340. this.sendRewards4String(actor, rewardMap)
  341. ComboTest.refreshRedDot(actor)
  342. -- DuplicateCommon.FinishDupActivity(actor, cfgId)
  343. -- setenvirvar(mapId, REWARD, true)
  344. end
  345. -- 连击试炼人物死亡
  346. function ComboTest.playerDie(actor)
  347. local mapId = getbaseinfo(actor, "unimapid")
  348. --print("mapid", mapId)
  349. local dupInfo = getduplicate(mapId)
  350. if dupInfo == nil then
  351. return
  352. end
  353. local type = dupInfo["type"]
  354. if type ~= DuplicateType.COMBO_TEST then
  355. return
  356. end
  357. -- 立即复活
  358. playrevive(actor, actor:toString(), 6)
  359. end
  360. -- 连击试炼扫荡
  361. function ComboTest.sweepThroughDungeons(actor, configId, count)
  362. local isOpen, _ = PrivilegeMonth.hasPrivilege(actor, PrivilegeMonth.PrivilegeType.COMBO_SWEEP_IS_OPEN)
  363. if not isOpen then
  364. tipinfo(actor, "请先开始扫荡特权")
  365. return
  366. end
  367. -- 判断是否可以参加本关连击试炼
  368. if not ComboTest.CheckEnterCondition(actor, configId) then
  369. return
  370. end
  371. local activityId = ConfigDataManager.getTableValue("cfg_rep", "type", "id", configId)
  372. reduceactivitytimes(actor, activityId, count)
  373. --local cfgId = BraveTest.level2ConfigId(currLevel)
  374. if string.isNullOrEmpty(configId) then
  375. noticeTip.noticeinfo(actor, StringIdConst.TEXT387)
  376. return
  377. end
  378. local reward = ConfigDataManager.getTableValue("cfg_rep", "reward", "id", configId)
  379. if string.isNullOrEmpty(reward) then
  380. noticeTip.noticeinfo(actor, StringIdConst.TEXT388)
  381. return
  382. end
  383. local rewardMap = string.toIntIntMap(reward, "#", "|")
  384. if table.isNullOrEmpty(rewardMap) then
  385. noticeTip.noticeinfo(actor, StringIdConst.TEXT389)
  386. return
  387. end
  388. local recordInfo = {}
  389. for itemId, itemCount in pairs(rewardMap) do
  390. recordInfo[itemId] = itemCount * count
  391. end
  392. this.sendRewards4String(actor, recordInfo)
  393. DuplicateCommon.FinishDupActivity(actor, configId)
  394. this.deleteTicket(actor, configId, count)
  395. DuplicateCommon.ReqGetActivityLeftCount(actor, tonumber(activityId))
  396. ComboTest.refreshRedDot(actor)
  397. end
  398. ---@class ComboTest.AddCount 增加副本次数
  399. ---@field addTime number 上次刷新时间
  400. ---@field addCount number 上次增加次数
  401. function this.addCount(actor, configId)
  402. local level = ComboTest.config2Level(configId)
  403. local maxLevel = getplaydef(actor, MAX_LEVEL)
  404. if string.isNullOrEmpty(maxLevel) then
  405. setplaydef(actor, MAX_LEVEL, level)
  406. local addCount = ConfigDataManager.getTableValue("cfg_rep", "numGrowth", "id", configId)
  407. if string.isNullOrEmpty(addCount) then
  408. addCount = 0
  409. end
  410. addleftcountofactivity(actor, DuplicateType.COMBO_TEST, tonumber(addCount))
  411. local addCountInfo = {
  412. addTime = tonumber(getbaseinfo(actor, "nowsec")),
  413. addCount = tonumber(addCount)
  414. }
  415. setplaydef(actor, COMBO_ADD_COUNT, addCountInfo)
  416. elseif level <= maxLevel then
  417. return
  418. else
  419. local addCount = ConfigDataManager.getTableValue("cfg_rep", "numGrowth", "id", configId)
  420. if string.isNullOrEmpty(addCount) then
  421. addCount = 0
  422. end
  423. local addCountInfo = getplaydef(actor, COMBO_ADD_COUNT)
  424. local needAddCount = tonumber(addCount) - addCountInfo.addCount
  425. addleftcountofactivity(actor, DuplicateType.COMBO_TEST, tonumber(needAddCount))
  426. local addCountInfo = {
  427. addTime = tonumber(getbaseinfo(actor, "nowsec")),
  428. addCount = tonumber(addCount)
  429. }
  430. setplaydef(actor, COMBO_ADD_COUNT, addCountInfo)
  431. end
  432. end
  433. function addleftcountest(actor)
  434. addleftcountofactivity(actor, DuplicateType.COMBO_TEST, 10)
  435. end
  436. -- 增加特权的时候,检查有没有增加过次数
  437. function ComboTest.setComboTestAddCount(actor)
  438. ComboTest.refreshRedDot(actor)
  439. local addCountInfo = getplaydef(actor, COMBO_ADD_COUNT)
  440. if table.isNullOrEmpty(addCountInfo) then
  441. local addCountInfo = {
  442. addTime = tonumber(getbaseinfo(actor, "nowsec")),
  443. addCount = 0
  444. }
  445. setplaydef(actor, COMBO_ADD_COUNT, addCountInfo)
  446. end
  447. end
  448. -- 登录时检查是否需要增加副本挑战次数
  449. function ComboTest.login(actor)
  450. local addCountInfo = getplaydef(actor, COMBO_ADD_COUNT)
  451. if table.isNullOrEmpty(addCountInfo) then
  452. return
  453. end
  454. -- 校验时间
  455. local numberTime = ConfigDataManager.getTableValue("cfg_activity_rule", "numberTime", "id", DuplicateType.COMBO_TEST)
  456. if string.isNullOrEmpty(numberTime) then
  457. return
  458. end
  459. local flushTime = string.split(numberTime, "#")
  460. if tonumber(flushTime[1]) == FlushType.WEEK then
  461. -- 暂时不做处理
  462. return
  463. end
  464. if TimeUtil.dayFlush(getbaseinfo(actor, "nowsec"), addCountInfo.addTime, tonumber(flushTime[2])) then
  465. -- 判断是否可以加成
  466. ComboTest.flushCount(actor)
  467. end
  468. end
  469. -- 连击试炼刷新可以挑战次数
  470. function ComboTest.flushCount(actor)
  471. local addCountInfo = getplaydef(actor, COMBO_ADD_COUNT)
  472. if table.isNullOrEmpty(addCountInfo) then
  473. return
  474. end
  475. addleftcountofactivity(actor, DuplicateType.COMBO_TEST, tonumber(addCountInfo.addCount))
  476. addCountInfo.addTime = getbaseinfo(actor, "nowsec")
  477. setplaydef(actor, COMBO_ADD_COUNT, addCountInfo)
  478. -- 增加特权加成
  479. local privilegeOpen, comboNum = PrivilegeMonth.hasPrivilege(actor, PrivilegeMonth.PrivilegeType.COMBO_NUM)
  480. if privilegeOpen then
  481. -- 累加连击加成
  482. addleftcountofactivity(actor, DuplicateType.COMBO_TEST, tonumber(comboNum))
  483. end
  484. end
  485. -- 每个小时检查增加副本次数
  486. function ComboTest.roleHourHeart(actor)
  487. local nowSec = getbaseinfo(actor, "nowsec")
  488. local time = TimeUtil.timeToDate(nowSec)
  489. local numberTime = ConfigDataManager.getTableValue("cfg_activity_rule", "numberTime", "id", DuplicateType.COMBO_TEST)
  490. if string.isNullOrEmpty(numberTime) then
  491. return
  492. end
  493. local flushTime = string.split(numberTime, "#")
  494. if time.hour ~= tonumber(flushTime[2]) then
  495. return
  496. end
  497. ComboTest.flushCount(actor)
  498. end
  499. -- 根据等级获取配置id
  500. function ComboTest.level2ConfigId(level)
  501. local cfgId = ConfigDataManager.getTableValue("cfg_rep", "id", "type", DuplicateType.COMBO_TEST, "replevel", level)
  502. return cfgId
  503. end
  504. -- 根据副本配置获取副本等级
  505. function ComboTest.config2Level(configId)
  506. local level = ConfigDataManager.getTableValue("cfg_rep", "replevel", "id", configId)
  507. if level == nil then
  508. return nil
  509. end
  510. return tonumber(level)
  511. end
  512. RedPointEventListerTable:eventLister("0", "连接技能", ComboTest.loginRedDot)