DragonNestLogic.lua 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. ---- 冰龙巢穴 版本2
  2. --[[
  3. db.dragonCopy = {
  4. time = 1
  5. hurt = 1
  6. dayHurt = 1
  7. maxHurt = 1
  8. }
  9. ]]
  10. local Lang = require("common.Lang")
  11. local Msg = require("core.Msg")
  12. local ObjHuman = require("core.ObjHuman")
  13. local Util = require("common.Util")
  14. local CopyExcel = require("excel.copy")
  15. local Grid = require("bag.Grid")
  16. local BagLogic = require("bag.BagLogic")
  17. local CombatDefine = require("combat.CombatDefine")
  18. local CombatLogic = require("combat.CombatLogic")
  19. local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
  20. local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
  21. local Broadcast = require("broadcast.Broadcast")
  22. local MonsterExcel = require("excel.monster")
  23. local HeroLogic = require("hero.HeroLogic")
  24. local BRoleLogic = require("billboard.BRoleLogic")
  25. local BillboardDB = require("billboard.BillboardDB")
  26. local BillboardDefine = require("billboard.BillboardDefine")
  27. local RoleLogic = require("role.RoleLogic")
  28. local CommonDB = require("common.CommonDB")
  29. local ChengjiuLogic = require("chengjiu.ChengjiuLogic")
  30. local ChengjiuDefine = require("chengjiu.ChengjiuDefine")
  31. local CombatImpl = require("combat.CombatImpl")
  32. local BeSkill = require("combat.BeSkill")
  33. local SkillExcel = require("excel.skill").skill
  34. local HeroGrowUp = require("absAct.HeroGrowUp")
  35. local MengxinLogic = require("present.MengxinLogic")
  36. local RoleDBLogic = require("role.RoleDBLogic")
  37. local YunYingLogic = require("yunying.YunYingLogic")
  38. local WeekTaskLogic = require("dailyTask.WeekTaskLogic")
  39. local TriggerLogic = require("trigger.TriggerLogic")
  40. local TriggerDefine = require("trigger.TriggerDefine")
  41. CITIAO_BY_ATTACK = 1 -- 词条对玩家生效
  42. CITIAO_BY_DEFEND = 2 -- 词条对BOSS生效
  43. function updateDaily(human)
  44. if human.db.dragonCopy and not Util.isSameDay(human.db.dragonCopy.time) then
  45. human.db.dragonCopy.time = os.time()
  46. human.db.dragonCopy.hurt = 0
  47. human.db.dragonCopy.dayHurt = 0
  48. human.db.dragonCopy.dayGet = nil
  49. human.db.dragonCopy.read = nil
  50. human.db.dragonCopy.getDay = nil
  51. human.db.dragonCopy.maxCombatInfo = nil
  52. end
  53. end
  54. function init(human)
  55. if not human.db.dragonCopy then
  56. human.db.dragonCopy = {}
  57. human.db.dragonCopy.time = os.time()
  58. human.db.dragonCopy.hurt = 0
  59. human.db.dragonCopy.dayHurt = 0
  60. human.db.dragonCopy.historyGet = {}
  61. end
  62. end
  63. DRAGON_CITIAO_RARE_MAX = nil
  64. function randomCiTiao()
  65. if not DRAGON_CITIAO_RARE_MAX then
  66. -- 防止策划删减 词条
  67. DRAGON_CITIAO_RARE_MAX = 0
  68. for k, v in pairs(CopyExcel.dragoncitiao) do
  69. if v then
  70. DRAGON_CITIAO_RARE_MAX = DRAGON_CITIAO_RARE_MAX + v.quanzhong
  71. end
  72. end
  73. end
  74. local list = {}
  75. local getRare = 0
  76. for i = 1 , 3 do
  77. local random = math.random(1, DRAGON_CITIAO_RARE_MAX - getRare)
  78. for k, v in pairs(CopyExcel.dragoncitiao) do
  79. if not list[k] and random <= v.quanzhong then
  80. list[k] = i
  81. getRare = getRare + v.quanzhong
  82. break
  83. elseif not list[k] then
  84. -- 防止循环最后一个是 已经随机过的 导致 随机不出来
  85. random = random - v.quanzhong
  86. end
  87. end
  88. end
  89. return list
  90. end
  91. function getSvrCiTiao()
  92. local list = CommonDB.getDragonNestCitiao()
  93. local weekTime = Util.getWeekStartTime(os.time())
  94. if not list or not list.time or list.time ~= weekTime then
  95. local list = randomCiTiao()
  96. CommonDB.setDragonNestCitiao(list, weekTime)
  97. return CommonDB.getDragonNestCitiao()
  98. else
  99. return list
  100. end
  101. end
  102. function getNextCiTiaoTime()
  103. local now = os.time()
  104. local weekTime = Util.getWeekStartTime(now + 7 * 24 * 60 * 60)
  105. return weekTime - now
  106. end
  107. local function fontRank(msgRet, human)
  108. local board = BillboardDB.getBoard(BillboardDefine.TYPE_DRAGON)
  109. if board then
  110. for i = 1 , 3 do
  111. local rankData = board.rank2data[i]
  112. if rankData then
  113. msgRet.topRank[0] = msgRet.topRank[0] + 1
  114. local net = msgRet.topRank[msgRet.topRank[0]]
  115. net.rank = i
  116. if rankData and rankData.roleBase then
  117. RoleLogic.makeRoleBase(rankData.roleBase, net.roleBase)
  118. else
  119. local roleUuid = rankData and rankData.uuid or ""
  120. RoleLogic.getRoleBaseByUuid(roleUuid, net.roleBase)
  121. end
  122. net.hurt = rankData and rankData.value1 or 0
  123. end
  124. end
  125. end
  126. local myRank = BillboardDB.getRank(BillboardDefine.TYPE_DRAGON, human.db._id)
  127. if myRank then
  128. local rankData = BillboardDB.getRankData(BillboardDefine.TYPE_DRAGON, myRank)
  129. if rankData then
  130. msgRet.myRank[0] = msgRet.myRank[0] + 1
  131. local net = msgRet.myRank[msgRet.myRank[0]]
  132. net.rank = myRank
  133. if rankData and rankData.roleBase then
  134. RoleLogic.makeRoleBase(rankData.roleBase, net.roleBase)
  135. else
  136. local roleUuid = rankData and rankData.uuid or ""
  137. RoleLogic.getRoleBaseByUuid(roleUuid, net.roleBase)
  138. end
  139. net.hurt = rankData and rankData.value1 or 0
  140. end
  141. -- 自己在前四名 不显示 自己的前一名
  142. if myRank and myRank > 4 then
  143. local lastData = BillboardDB.getRankData(BillboardDefine.TYPE_DRAGON, myRank - 1)
  144. if lastData then
  145. msgRet.myRank[0] = msgRet.myRank[0] + 1
  146. local net = msgRet.myRank[msgRet.myRank[0]]
  147. net.rank = myRank - 1
  148. if lastData and lastData.roleBase then
  149. RoleLogic.makeRoleBase(lastData.roleBase, net.roleBase)
  150. else
  151. local roleUuid = lastData and lastData.uuid or ""
  152. RoleLogic.getRoleBaseByUuid(roleUuid, net.roleBase)
  153. end
  154. net.hurt = lastData and lastData.value1 or 0
  155. end
  156. end
  157. end
  158. end
  159. function fontNextItem(msgRet, human)
  160. local list = {}
  161. local get
  162. msgRet.nextSanbei = 1
  163. for k, v in ipairs(CopyExcel.dragonReward) do
  164. if msgRet.dayHurt < v.need and not get then
  165. get = 1
  166. msgRet.nextHurt = v.need
  167. for j, h in ipairs(v.reward) do
  168. local net = msgRet.items[j]
  169. Grid.makeItem(net, h[1], h[2])
  170. end
  171. msgRet.items[0] = #v.reward
  172. if human.db.dragonCopy.historyGet and human.db.dragonCopy.historyGet[k] then
  173. msgRet.nextSanbei = 0
  174. end
  175. elseif msgRet.dayHurt >= v.need then
  176. local beiShu = human.db.dragonCopy.getDay and human.db.dragonCopy.getDay[k] or nil
  177. if not beiShu then
  178. if human.db.dragonCopy.historyGet and human.db.dragonCopy.historyGet[k] then
  179. beiShu = 1
  180. else
  181. beiShu = 3
  182. end
  183. end
  184. beiShu = beiShu or 1
  185. for j, h in ipairs(v.reward) do
  186. list[h[1]] = list[h[1]] or 0
  187. list[h[1]] = list[h[1]] + (h[2] * beiShu)
  188. end
  189. end
  190. end
  191. local len = 0
  192. for k, v in pairs(list) do
  193. len = len + 1
  194. local net = msgRet.dayReward[len]
  195. Grid.makeItem(net, k, v)
  196. end
  197. msgRet.dayReward[0] = len
  198. end
  199. -- 封装 BOSS 技能详情
  200. function fontDragonSkill(msgRet, monsterOutID)
  201. local monsterID = MonsterExcel.monsterOut[monsterOutID].member[1][1]
  202. local monsterConfig = MonsterExcel.monster[monsterID]
  203. local len = 0
  204. for k, v in ipairs(monsterConfig.skillList) do
  205. len = len + 1
  206. HeroLogic.makeSkillNet(msgRet.skillList[len], v)
  207. end
  208. for k , v in ipairs(monsterConfig.beSkillList) do
  209. if len < 4 then
  210. len = len + 1
  211. HeroLogic.makeSkillNet(msgRet.skillList[len], v)
  212. end
  213. end
  214. msgRet.skillList[0] = len
  215. end
  216. function fontCiTiao(msgRet, human)
  217. local list = getSvrCiTiao()
  218. for k, index in pairs(list.citiao) do
  219. local config = CopyExcel.dragoncitiao[k]
  220. if index == 1 then
  221. msgRet.ciTiaoA = config.citiao
  222. elseif index == 2 then
  223. msgRet.ciTiaoB = config.citiao
  224. else
  225. msgRet.ciTiaoC = config.citiao
  226. end
  227. end
  228. end
  229. function ciTiaoQuery(human)
  230. init(human)
  231. local list = getSvrCiTiao()
  232. local dragon = human.db.dragonCopy
  233. local msgRet = Msg.gc.GC_COPY_DRAGON_BOSS_CITIAO
  234. msgRet.time = dragon.time
  235. msgRet.read = dragon.read and 1 or 0
  236. msgRet.isGuide = human.db.dragonCopy and human.db.dragonCopy.isGuide or 1
  237. msgRet.ctEndTime = getNextCiTiaoTime()
  238. human.db.dragonCopy.isGuide = 0
  239. local len = 0
  240. for id in pairs(list.citiao) do
  241. len = len + 1
  242. local config = CopyExcel.dragoncitiao[id]
  243. local net = msgRet.list[len]
  244. net.id = id
  245. net.name = config.citiao
  246. net.desc = config.miaoshu
  247. end
  248. msgRet.list[0] = len
  249. Msg.send(msgRet, human.fd)
  250. dragon.read = 1
  251. end
  252. function query(human, isFight)
  253. init(human)
  254. if not human.db.dragonCopy.read then
  255. ciTiaoQuery(human)
  256. return
  257. end
  258. local msgRet = Msg.gc.GC_COPY_DRAGON_QUERY
  259. msgRet.dayGet = 0
  260. msgRet.topRank[0] = 0
  261. msgRet.myRank[0] = 0
  262. msgRet.dayHurt = 0
  263. msgRet.nextHurt = 0
  264. msgRet.items[0] = 0
  265. msgRet.ciTiaoA = ""
  266. msgRet.ciTiaoB = ""
  267. msgRet.ciTiaoC = ""
  268. msgRet.dayReward[0] = 0
  269. msgRet.ctEndTime = getNextCiTiaoTime()
  270. msgRet.isFight = isFight and 1 or 0
  271. if human.db.dragonCopy then
  272. msgRet.dayHurt = human.db.dragonCopy.dayHurt
  273. msgRet.dayGet = human.db.dragonCopy.dayGet and 1 or 0
  274. end
  275. fontCiTiao(msgRet)
  276. fontNextItem(msgRet, human)
  277. fontRank(msgRet, human)
  278. human.dragonfirstLogin = 1
  279. RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1202)
  280. RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1209)
  281. -- Msg.trace(msgRet)
  282. Msg.send(msgRet, human.fd)
  283. end
  284. -- BOSS查询
  285. function bossQuery(human)
  286. local msgRet = Msg.gc.GC_COPY_DRAGON_BOSS_QUERY
  287. local config = CopyExcel.dragon[1]
  288. msgRet.id = 1
  289. msgRet.desc = config.desc
  290. fontDragonSkill(msgRet, config.monsterOutID)
  291. Msg.send(msgRet, human.fd)
  292. end
  293. -- 伤害排名 查询
  294. function rankQuery(human)
  295. local msgRet = Msg.gc.GC_COPY_DRAGON_RANK_QUERY
  296. msgRet.rankList[0] = 0
  297. local board = BillboardDB.getBoard(BillboardDefine.TYPE_DRAGON)
  298. if board then
  299. for i = 1, #board.rank2data do
  300. local rankData = board.rank2data[i]
  301. if rankData then
  302. msgRet.rankList[0] = msgRet.rankList[0] + 1
  303. local net = msgRet.rankList[msgRet.rankList[0]]
  304. net.rank = i
  305. if rankData and rankData.roleBase then
  306. RoleLogic.makeRoleBase(rankData.roleBase, net.roleBase)
  307. else
  308. local roleUuid = rankData and rankData.uuid or ""
  309. RoleLogic.getRoleBaseByUuid(roleUuid, net.roleBase)
  310. end
  311. net.hurt = rankData and rankData.value1 or 0
  312. end
  313. end
  314. end
  315. -- 获取排行区间 奖励 给予前端处理 放到各个名词后面 显示排名奖励
  316. for k, v in ipairs(CopyExcel.dragonRank) do
  317. local net = msgRet.rankItem[k]
  318. net.minRank = v.minRank
  319. net.maxRank = v.maxRank
  320. for j, h in ipairs(v.reward) do
  321. Grid.makeItem(net.item[j], h[1], h[2])
  322. end
  323. net.item[0] = #v.reward
  324. end
  325. msgRet.rankItem[0] = #CopyExcel.dragonRank
  326. Msg.send(msgRet, human.fd)
  327. end
  328. function hurtRewardQuery(human)
  329. local msgRet = Msg.gc.GC_COPY_DRAGON_HURT_QUERY
  330. msgRet.isEnd = 0
  331. msgRet.maxHurt = human.db.dragonCopy and human.db.dragonCopy.maxHurt or 0
  332. local len = 0
  333. for k, v in ipairs(CopyExcel.dragonReward) do
  334. len = len + 1
  335. local net = msgRet.list[len]
  336. net.id = k
  337. net.need = v.need
  338. net.sanbei = 1
  339. net.isGet = 0
  340. if human.db.dragonCopy.historyGet and human.db.dragonCopy.historyGet[k] then
  341. net.sanbei = 0
  342. end
  343. if human.db.dragonCopy.getDay and human.db.dragonCopy.getDay[k] then
  344. net.isGet = 1
  345. end
  346. for j, h in ipairs(v.reward) do
  347. Grid.makeItem(net.reward[j], h[1], h[2])
  348. end
  349. net.reward[0] = #v.reward
  350. if len >= 30 then
  351. msgRet.list[0] = len
  352. Msg.send(msgRet, human.fd)
  353. len = 0
  354. end
  355. end
  356. msgRet.isEnd = 1
  357. msgRet.list[0] = len
  358. Msg.send(msgRet, human.fd)
  359. end
  360. ------------------------------------ combat ----------------
  361. function getCombatMonsterOutID(human, side, args)
  362. if side ~= CombatDefine.DEFEND_SIDE then return end
  363. local config = CopyExcel.dragon[1]
  364. return config.monsterOutID
  365. end
  366. function getCombatObjList(human, side, args)
  367. if side ~= CombatDefine.DEFEND_SIDE then return end
  368. local monsterOutID = getCombatMonsterOutID(human, side)
  369. return CombatLogic.getMonsterObjList(monsterOutID, CombatDefine.COMBAT_OBJ_TYPE3 , args)
  370. end
  371. function getMapID()
  372. local config = CopyExcel.dragon[1]
  373. return config.mapID
  374. end
  375. function fight(human)
  376. -- 今日已经领取 不让继续挑战 前端已做置灰处理
  377. --if human.db.dragonCopy and human.db.dragonCopy.dayGet then
  378. --return
  379. --end
  380. local config = CopyExcel.dragon[1]
  381. CombatLogic.combatBegin(human, config.mapID, 1 , CombatDefine.COMBAT_TYPE20)
  382. HeroGrowUp.onCallback(human, HeroGrowUp.TASKTYPE9, 1)
  383. YunYingLogic.onCallBack(human, "onBinglong",1)
  384. end
  385. function setSkillAndBeskill(human,combatInfo)
  386. local list = getSvrCiTiao()
  387. local myList = {}
  388. local bossList = {}
  389. for k, v in pairs(list.citiao) do
  390. local config = CopyExcel.dragoncitiao[k]
  391. if config.shengxiao == CITIAO_BY_ATTACK then
  392. myList[#myList+1] = config.skillID
  393. elseif config.shengxiao == CITIAO_BY_DEFEND then
  394. bossList[#bossList+1] = config.skillID
  395. end
  396. end
  397. if #myList > 0 then
  398. for _,pos in ipairs(CombatDefine.SIDE2POS[CombatDefine.ATTACK_SIDE]) do
  399. local obj = CombatImpl.objList[pos]
  400. if obj then
  401. for _, skillID in ipairs(myList) do
  402. local skillConfig = SkillExcel[skillID]
  403. if skillConfig.beSkillType == BeSkill.BESKILL_TYPE24 then
  404. for _,skillID in ipairs(skillConfig.args) do
  405. local skillConfig = SkillExcel[skillID]
  406. obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
  407. obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {
  408. skillID,
  409. skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
  410. skillConfig.cd[2] or 0, 0}
  411. end
  412. else
  413. obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
  414. obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {
  415. skillID,
  416. skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
  417. skillConfig.cd[2] or 0, 0}
  418. end
  419. end
  420. end
  421. end
  422. end
  423. if #bossList > 0 then
  424. for _,pos in ipairs(CombatDefine.SIDE2POS[CombatDefine.DEFEND_SIDE]) do
  425. local obj = CombatImpl.objList[pos]
  426. if obj then
  427. for _, skillID in ipairs(bossList) do
  428. local skillConfig = SkillExcel[skillID]
  429. if skillConfig.beSkillType == BeSkill.BESKILL_TYPE24 then
  430. for _,skillID in ipairs(skillConfig.args) do
  431. local skillConfig = SkillExcel[skillID]
  432. obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
  433. obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {
  434. skillID,
  435. skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
  436. skillConfig.cd[2] or 0, 0}
  437. end
  438. else
  439. obj.beSkillList[skillConfig.beSkillType] = obj.beSkillList[skillConfig.beSkillType] or {}
  440. obj.beSkillList[skillConfig.beSkillType][#obj.beSkillList[skillConfig.beSkillType] + 1] = {
  441. skillID,
  442. skillConfig.beSkillLimit > 0 and skillConfig.beSkillLimit,skillConfig.cd[1] or 0,
  443. skillConfig.cd[2] or 0, 0}
  444. end
  445. end
  446. end
  447. end
  448. end
  449. end
  450. function onFightEnd(human, result, combatType, cbParam, combatInfo)
  451. local atkHurt = 0
  452. for pos = 1, CombatDefine.COMBAT_HERO_CNT do
  453. local obj = combatInfo.objList and combatInfo.objList[pos]
  454. if obj then
  455. atkHurt = atkHurt + obj.result[1]
  456. end
  457. end
  458. -- 魔兽 造成伤害
  459. for _,pos in ipairs(CombatDefine.SIDE2HELPPOS[CombatDefine.ATTACK_SIDE]) do
  460. local pet = combatInfo.helpList and combatInfo.helpList[pos]
  461. if pet and pet.isPet then
  462. atkHurt = atkHurt + pet.result[1]
  463. end
  464. end
  465. human.db.dragonCopy = human.db.dragonCopy or {}
  466. local dragon = human.db.dragonCopy
  467. dragon.time = dragon.time or os.time()
  468. dragon.hurt = atkHurt
  469. dragon.dayHurt = dragon.dayHurt or 0
  470. local oldHurt = dragon.dayHurt
  471. local breakOk
  472. if atkHurt > dragon.dayHurt then
  473. dragon.dayHurt = atkHurt
  474. dragon.maxHurt = dragon.maxHurt or 0
  475. dragon.maxHurt = dragon.maxHurt < atkHurt and atkHurt or dragon.maxHurt
  476. BRoleLogic.updateData(BillboardDefine.TYPE_DRAGON, human.db)
  477. breakOk = true
  478. end
  479. local dayHurt = human.db.dragonCopy.dayHurt
  480. local msgRet = Msg.gc.GC_COPY_DRAGON_FIGHT_END
  481. msgRet.rank = BillboardDB.getRank(BillboardDefine.TYPE_DRAGON, human.db._id) or 0
  482. msgRet.hurt = atkHurt
  483. msgRet.dayHurt = dragon.dayHurt
  484. msgRet.nextHurt = 0
  485. for k, v in ipairs(CopyExcel.dragonReward) do
  486. if dayHurt < v.need then
  487. msgRet.nextHurt = v.need
  488. break
  489. end
  490. end
  491. if atkHurt> oldHurt then
  492. if human.db.dragonCopy.dayGet then return end
  493. human.db.dragonCopy.historyGet = human.db.dragonCopy.historyGet or {}
  494. human.db.dragonCopy.getDay = human.db.dragonCopy.getDay or {}
  495. local getCnt = 0
  496. local getList = {}
  497. for k, v in ipairs(CopyExcel.dragonReward) do
  498. if dayHurt >= v.need and not human.db.dragonCopy.getDay[k] then
  499. getCnt = getCnt + 1
  500. local cnt = 1
  501. if not human.db.dragonCopy.historyGet[k] then
  502. cnt = 3
  503. human.db.dragonCopy.historyGet[k] = 1
  504. end
  505. if cnt == 3 then
  506. combatInfo.double = 3
  507. end
  508. human.db.dragonCopy.getDay[k] = cnt
  509. for _, h in ipairs(v.reward) do
  510. getList[h[1]] = getList[h[1]] or 0
  511. getList[h[1]] = getList[h[1]] + h[2] * cnt
  512. end
  513. end
  514. end
  515. -- 没有奖励可以领取
  516. if getCnt > 0 then
  517. local itemList = {}
  518. local len = 0
  519. for itemID, itemCnt in pairs(getList) do
  520. len = len + 1
  521. itemList[len] = {}
  522. itemList[len][1] = itemID
  523. itemList[len][2] = itemCnt
  524. BagLogic.addItem(human, itemID, itemCnt, "dragonCopy")
  525. end
  526. combatInfo.rewardItem = Util.copyTable(itemList)
  527. end
  528. end
  529. CombatLogic.fontCombatFinish(msgRet.data, combatInfo)
  530. Msg.send(msgRet, human.fd)
  531. ChengjiuLogic.onCallback(human,ChengjiuDefine.CJ_TASK_TYPE_26,atkHurt)
  532. MengxinLogic.onCallBack(human,MengxinLogic.MX_TASK_TYPE_5,atkHurt)
  533. query(human, true)
  534. if breakOk then
  535. human.db.dragonCopy.maxCombatInfo = Util.copyTable(combatInfo)
  536. end
  537. --周任务 -9
  538. WeekTaskLogic.recordWeekTaskFinishCnt(human, WeekTaskLogic.WEEK_TASK_ID_9, 1)
  539. TriggerLogic.PublishEvent(TriggerDefine.DRAGONNEST_CHALLENGE, human.db._id, 1)
  540. end
  541. function isDot(human)
  542. if human.dragonfirstLogin == nil then
  543. return true
  544. end
  545. return false
  546. end
  547. FieldDragonBase = {dragonCopy=1}
  548. function lookVido(human, uuid)
  549. if not uuid or uuid == "" then return end
  550. local db = RoleDBLogic.getDb(uuid, FieldDragonBase)
  551. if db and db.dragonCopy and db.dragonCopy.maxCombatInfo then
  552. CombatLogic.repeatCombat(human, db.dragonCopy.maxCombatInfo)
  553. else
  554. return Broadcast.sendErr(human, Lang.COMBAT_ERR_NOT_VIDEO)
  555. end
  556. end