lostTempleLogic.lua 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411
  1. --[[
  2. 失落神庙
  3. ]]
  4. local Msg = require("core.Msg")
  5. local LuaMongo = _G.lua_mongo
  6. local DB = require("common.DB")
  7. local LostTempleExcel = require("excel.lostTemple")
  8. local ElementExcel = require("excel.lostTemple").Element
  9. local CombatPosLogic = require("combat.CombatPosLogic")
  10. local CombatDefine = require("combat.CombatDefine")
  11. local MonsterOutExcel = require("excel.monster").monsterOut
  12. local HeroLogic = require("hero.HeroLogic")
  13. local MonsterExcel = require("excel.monster")
  14. local CombatLogic = require("combat.CombatLogic")
  15. local Grid = require("bag.Grid")
  16. local HeroGrid = require("hero.HeroGrid")
  17. local CombatPosExcel = require("excel.combatPos")
  18. local RoleSystemLogic = require("roleSystem.RoleSystemLogic")
  19. local RoleSystemDefine = require("roleSystem.RoleSystemDefine")
  20. local Util = require("common.Util")
  21. local LostTempleCombatLogic = require("lostTemple.lostTempleCombatLogic")
  22. local HeroDefine = require("hero.HeroDefine")
  23. local BagLogic = require("bag.BagLogic")
  24. local Broadcast = require("broadcast.Broadcast")
  25. local Lang = require("common.Lang")
  26. local CommonDB = require("common.CommonDB")
  27. local TriggerDefine = require("trigger.TriggerDefine")
  28. local TriggerLogic = require("trigger.TriggerLogic")
  29. local HeroGrowUp = require("absAct.HeroGrowUp")
  30. local YunYingLogic = require("yunying.YunYingLogic")
  31. local Lost_Handle_Func = { }
  32. QUEUE_LEN = 3 -- 每次推送的横向队列数
  33. START_X = 1 -- 起始横向位置
  34. START_LAYER = 1 -- 起始层数
  35. OP_QUERY = 0
  36. OP_CONFIRM = 1
  37. INIT_HP_MAX = 100
  38. DAY_7s = 604800
  39. DAY_2s = 172800
  40. DAY_1s = 86400
  41. --跳过战斗需要的战力
  42. local SHOWQUICKPOWER = 0 --2000000
  43. function initAfterHot()
  44. end
  45. function getLeftTime()
  46. local openDay = CommonDB.getServerOpenDay()
  47. if not openDay then
  48. return 0
  49. end
  50. local curTime = os.time()
  51. local tNowDate = os.date("*t", curTime)
  52. tNowDate.hour = 0
  53. tNowDate.min = 0
  54. tNowDate.sec = 0
  55. if openDay % 2 == 1 then
  56. tNowDate.day = tNowDate.day + 2
  57. else
  58. tNowDate.day = tNowDate.day + 1
  59. end
  60. local nEndTime = os.time(tNowDate)
  61. return nEndTime - curTime
  62. end
  63. --
  64. local function isOpen(human)
  65. --[[
  66. local openDay = CommonDB.getServerOpenDay()
  67. if not openDay then
  68. return
  69. end
  70. if openDay < 7 then
  71. return
  72. end
  73. ---- 已经开启
  74. if (openDay - 7 + 1) % 2 ~= 1 then
  75. return
  76. end
  77. ]]
  78. if not RoleSystemLogic.isOpen(human, RoleSystemDefine.ROLE_SYS_ID_1208) then
  79. return
  80. end
  81. return true
  82. end
  83. function onZero()
  84. local openDay = CommonDB.getServerOpenDay()
  85. if not openDay then
  86. return
  87. end
  88. print("[lostTempleLogic - onZero] 失落神庙零点刷新开始 openDay = "..openDay)
  89. -- 奇数天刷新
  90. if openDay % 2 == 1 then
  91. print("[lostTempleLogic - onZero] 失落神庙零点, 当前为奇数天移除DB数据\n")
  92. LuaMongo.remove(DB.db_lost_temple)
  93. end
  94. -- 已经关闭
  95. -- if (openDay - 7 + 1) % 2 ~= 0 then
  96. -- return
  97. -- end
  98. end
  99. function updateDaily(human)
  100. if not isOpen(human) then
  101. return
  102. end
  103. print("[lostTempleLogic - updateDaily] 天数刷新 玩家移除lostTemple数据 name = "..human.db.name)
  104. human.lostTemple = nil
  105. local msgRet = Msg.gc.GC_LOST_TEMPLE_CLOSE
  106. Msg.send(msgRet, human.fd)
  107. end
  108. -- db
  109. local QueryByUuid = { _id = nil }
  110. -- 插入新的数据
  111. function dbRead(human)
  112. if not isOpen(human) then return end
  113. human.lostTemple = { }
  114. QueryByUuid._id = human.db._id
  115. LuaMongo.find(DB.db_lost_temple, QueryByUuid)
  116. if not LuaMongo.next(human.lostTemple) then
  117. human.lostTemple = nil
  118. end
  119. end
  120. --
  121. local DB_DATA = { }
  122. function dbSave(human)
  123. if not human.lostTemple then return end
  124. if not human.db then return end
  125. DB_DATA = { }
  126. LuaMongo.find(DB.db_lost_temple, QueryByUuid)
  127. -- if not LuaMongo.next(DB_DATA) then
  128. -- human.lostTemple._id = human.db._id
  129. -- LuaMongo.insert(DB.db_lost_temple, human.lostTemple)
  130. -- return
  131. -- end
  132. if not LuaMongo.next(DB_DATA) then
  133. -- 检查 human.db._id 是否已经存在
  134. local exists = false
  135. local tempQuery = { _id = human.db._id }
  136. LuaMongo.find(DB.db_lost_temple, tempQuery)
  137. if LuaMongo.next(DB_DATA) then
  138. exists = true
  139. end
  140. if exists then
  141. -- 如果存在,更新文档
  142. LuaMongo.update(DB.db_lost_temple, tempQuery, human.lostTemple)
  143. else
  144. -- 如果不存在,插入新文档
  145. human.lostTemple._id = human.db._id
  146. LuaMongo.insert(DB.db_lost_temple, human.lostTemple)
  147. end
  148. return
  149. end
  150. QueryByUuid._id = human.db._id
  151. LuaMongo.update(DB.db_lost_temple, QueryByUuid, human.lostTemple)
  152. end
  153. -- db
  154. function onLogin(human)
  155. if not isOpen(human) then return end
  156. dbRead(human)
  157. end
  158. -- 初始化玩家当前格子
  159. local function printGrid(human)
  160. if not human.lostTemple then return end
  161. local startX = human.lostTemple.x + 1
  162. local endX = human.lostTemple.x + QUEUE_LEN
  163. local layer = human.lostTemple.layer
  164. local random = human.lostTemple.random
  165. local LostTempleConfig = LostTempleExcel[layer]
  166. if not LostTempleConfig then return end
  167. local LostTemple = LostTempleConfig[random]
  168. if not LostTemple then return end
  169. print("layler=", human.lostTemple.layer, "random=", human.lostTemple.random, "playerX=", human.lostTemple.x, "playerY=", human.lostTemple.y)
  170. for x = startX, endX do
  171. human.lostTemple.grid[x] = human.lostTemple.grid[x] or { }
  172. local LostTempleX = LostTemple[x]
  173. if LostTempleX then
  174. for y = 1, LostTemple.vertical do
  175. if LostTempleX[y] then
  176. print("x=", x, "y=", y, "id=", human.lostTemple.grid[x][y].id)
  177. end
  178. end
  179. end
  180. end
  181. return true
  182. end
  183. --
  184. local function makeMonsterGrid(human, cmd)
  185. if not human.lostTemple then return end
  186. local x = human.lostTemple.x
  187. local layer = human.lostTemple.layer
  188. local LostTempleMonster = LostTempleExcel.Lost[x]
  189. if not LostTempleMonster then return end
  190. -- 取共鸣英雄的等级
  191. local totalLv = 0
  192. local equally = 0
  193. local equallyLv = 0
  194. local db = human.db.xingYaoGongMing
  195. if db and db.defList then
  196. for heroIndex in pairs(db.defList) do
  197. local heroGrid = human.db.heroBag[heroIndex]
  198. if heroGrid then
  199. totalLv = totalLv + heroGrid.lv
  200. equally = equally + 1
  201. end
  202. end
  203. end
  204. local randomId = 0
  205. if cmd == "nomalMonster" then
  206. randomId = math.random(LostTempleMonster.nomal[layer][1], LostTempleMonster.nomal[layer][2])
  207. elseif cmd == "eliteMonster" then
  208. randomId = math.random(LostTempleMonster.elite[layer][1], LostTempleMonster.elite[layer][2])
  209. elseif cmd == "eliteBoss" then
  210. randomId = math.random(LostTempleMonster.elite[layer][1], LostTempleMonster.elite[layer][2])
  211. end
  212. equallyLv = math.ceil(totalLv / equally * randomId / 10000)
  213. local monsterOutID = 0
  214. for i = 1, #LostTempleExcel.Monster do
  215. if equallyLv >= LostTempleExcel.Monster[i].lvminmax[1] and equallyLv <= LostTempleExcel.Monster[i].lvminmax[2] then
  216. local randomIndex = math.random(1, #LostTempleExcel.Monster[i].monsteroutid)
  217. monsterOutID = LostTempleExcel.Monster[i].monsteroutid[randomIndex]
  218. break
  219. end
  220. end
  221. if monsterOutID == 0 then
  222. assert(nil, "monsterOutID is error equallyLv=" .. equallyLv .. "-randomId=" .. randomId)
  223. end
  224. return monsterOutID
  225. end
  226. -- 制造一个召唤祭坛
  227. local function makeSummonHeroGrid(human)
  228. -- 取共鸣英雄的等级
  229. local totalLv = 0
  230. local equally = 0
  231. local equallyLv = 0
  232. local db = human.db.xingYaoGongMing
  233. if db and db.defList then
  234. for heroIndex in pairs(db.defList) do
  235. local heroGrid = human.db.heroBag[heroIndex]
  236. if heroGrid then
  237. totalLv = totalLv + heroGrid.lv
  238. equally = equally + 1
  239. end
  240. end
  241. end
  242. equallyLv = math.ceil(totalLv / equally)
  243. local heroIndex = nil
  244. for i = 1, #LostTempleExcel.Hero do
  245. if equallyLv >= LostTempleExcel.Hero[i].lvminmax[1] and equallyLv <= LostTempleExcel.Hero[i].lvminmax[2] then
  246. heroIndex = i
  247. break
  248. end
  249. end
  250. if heroIndex == nil then
  251. assert(nil, "heroid is error equallyLv=" .. equallyLv)
  252. end
  253. --
  254. local summonHero = { }
  255. local weightHeroTb = Util.copyTable(LostTempleExcel.Hero[heroIndex].heroid)
  256. -- 根据权重取出4英雄
  257. local totalWeight = 0
  258. for i = 1, #weightHeroTb do
  259. totalWeight = totalWeight + weightHeroTb[i][4]
  260. end
  261. -- 取4次
  262. local len = 0
  263. for k = 1, 4 do
  264. local random = math.random(1, totalWeight)
  265. for i = 1, #weightHeroTb do
  266. if random <= weightHeroTb[i][4] then
  267. len = len + 1
  268. summonHero[len] = { }
  269. summonHero[len].id = weightHeroTb[i][1]
  270. summonHero[len].lv = weightHeroTb[i][2]
  271. local maxStar = HeroDefine.getMaxHeroStar(weightHeroTb[i][1])
  272. summonHero[len].star = maxStar > weightHeroTb[i][3] and weightHeroTb[i][3] or maxStar
  273. -- 最后一个放入到 这一个里面 删掉最后一个
  274. totalWeight = totalWeight - weightHeroTb[i][4]
  275. weightHeroTb[i] = weightHeroTb[#weightHeroTb]
  276. weightHeroTb[#weightHeroTb] = nil
  277. break
  278. end
  279. random = random - weightHeroTb[i][4]
  280. end
  281. end
  282. if #summonHero == 0 then
  283. assert(nil, "summonHero is error equallyLv=" .. equallyLv)
  284. end
  285. return summonHero
  286. end
  287. -- 制造一个智慧树
  288. local function makeSummonTreeGrid(human)
  289. --
  290. local summonTree = { }
  291. local weightTreeTb = Util.copyTable(LostTempleExcel.Tree)
  292. -- 根据权重取出4英雄
  293. local totalWeight = 0
  294. for i = 1, #weightTreeTb do
  295. totalWeight = totalWeight + weightTreeTb[i].weight
  296. end
  297. -- 取3次
  298. local len = 0
  299. for k = 1, 3 do
  300. local random = math.random(1, totalWeight)
  301. for i = 1, #weightTreeTb do
  302. if random <= weightTreeTb[i].weight then
  303. len = len + 1
  304. summonTree[len] = i
  305. -- 最后一个放入到 这一个里面 删掉最后一个
  306. totalWeight = totalWeight - weightTreeTb[i].weight
  307. weightTreeTb[i] = weightTreeTb[#weightTreeTb]
  308. weightTreeTb[#weightTreeTb] = nil
  309. break
  310. end
  311. random = random - weightTreeTb[i].weight
  312. end
  313. end
  314. if #summonTree == 0 then
  315. assert(nil, "summonTree is error")
  316. end
  317. return summonTree
  318. end
  319. -- 神界商店
  320. local function makeSummonShopGrid(human)
  321. --
  322. local summonShop = { }
  323. local weightShopTb = Util.copyTable(LostTempleExcel.LostShop)
  324. -- 根据权重取出4英雄
  325. local totalWeight = 0
  326. for i = 1, #weightShopTb do
  327. totalWeight = totalWeight + weightShopTb[i].weight
  328. end
  329. -- 取3次
  330. local len = 0
  331. for k = 1, 4 do
  332. local random = math.random(1, totalWeight)
  333. for i = 1, #weightShopTb do
  334. if random <= weightShopTb[i].weight then
  335. len = len + 1
  336. summonShop[len] = i
  337. -- 最后一个放入到 这一个里面 删掉最后一个
  338. totalWeight = totalWeight - weightShopTb[i].weight
  339. weightShopTb[i] = weightShopTb[#weightShopTb]
  340. weightShopTb[#weightShopTb] = nil
  341. break
  342. end
  343. random = random - weightShopTb[i].weight
  344. end
  345. end
  346. if #summonShop == 0 then
  347. assert(nil, "summonShop is error")
  348. end
  349. return summonShop
  350. end
  351. -- 制造一个宝箱
  352. local function makeBoxGrid(human)
  353. for i = 1, #ElementExcel do
  354. local element = ElementExcel[i]
  355. if element.cmd == "summonBox" then
  356. return i
  357. end
  358. end
  359. end
  360. -- 制造一个传送门
  361. local function makeConverDoorGrid(human)
  362. for i = 1, #ElementExcel do
  363. local element = ElementExcel[i]
  364. if element.cmd == "conveyDoor" then
  365. return i
  366. end
  367. end
  368. end
  369. -- 初始化玩家当前格子
  370. local function makeGrid(human)
  371. if not human.lostTemple then return end
  372. local layer = human.lostTemple.layer
  373. local random = human.lostTemple.random
  374. local LostTempleConfig = LostTempleExcel[layer]
  375. if not LostTempleConfig then return end
  376. local LostTemple = LostTempleConfig[random]
  377. if not LostTemple then return end
  378. -- 清除玩家当前位置的数据
  379. human.lostTemple.grid = human.lostTemple.grid or { }
  380. human.lostTemple.grid[human.lostTemple.x] = nil
  381. local startX = human.lostTemple.x + 1
  382. local endX = human.lostTemple.x + QUEUE_LEN
  383. for x = startX, endX do
  384. local LostTempleX = LostTemple[x]
  385. if LostTempleX then
  386. human.lostTemple.grid[x] = human.lostTemple.grid[x] or { }
  387. for y = 1, LostTemple.vertical do
  388. if LostTempleX[y] then
  389. if not human.lostTemple.grid[x][y] then
  390. human.lostTemple.grid[x][y] = { id = LostTempleX[y][1] }
  391. end
  392. local element = ElementExcel[LostTempleX[y][1]]
  393. -- 召唤神坛
  394. if element.cmd == "summonHero" then
  395. human.lostTemple.grid[x][y].summonHero = makeSummonHeroGrid(human)
  396. end
  397. -- 智慧树
  398. if element.cmd == "summonTree" then
  399. human.lostTemple.grid[x][y].summonTree = makeSummonTreeGrid(human)
  400. end
  401. -- 神界商店
  402. if element.cmd == "summonShop" then
  403. human.lostTemple.grid[x][y].summonShop = makeSummonShopGrid(human)
  404. end
  405. --只生成 第一层的怪物
  406. if x == startX then
  407. if element.cmd == "nomalMonster" or element.cmd == "eliteMonster" or element.cmd == "eliteBoss" then
  408. human.lostTemple.grid[x][y].monsterOutID = makeMonsterGrid(human, element.cmd)
  409. end
  410. end
  411. end
  412. end
  413. end
  414. end
  415. return true
  416. end
  417. -- 制造一个默认的位置数据
  418. local function makeLostTempLe(layer)
  419. -- 第一层
  420. local LostTempleConfig = LostTempleExcel[layer]
  421. if not LostTempleConfig then
  422. assert(nil, "lostTemple startLayer error = " .. layer)
  423. end
  424. -- 随机一张地图
  425. local startRandom = math.random(1, #LostTempleConfig)
  426. local LostTemple = LostTempleConfig[startRandom]
  427. if not LostTemple then return end
  428. -- 起始位置
  429. local LostTempleX = LostTemple[START_X]
  430. if not LostTempleX then
  431. assert(nil, "lostTemple startX error = " .. START_LAYER)
  432. end
  433. -- 找到纵向可以站立的位置
  434. local startY = 1
  435. for y = 1, LostTemple.vertical do
  436. if LostTempleX[y] and LostTempleX[y][1] == 0 then
  437. startY = y
  438. break
  439. end
  440. end
  441. return layer, START_X, startY, startRandom
  442. end
  443. -- 初始化
  444. local function initDB(human)
  445. if human.lostTemple then return end
  446. local lostLayer, lostX, lostY, lostRandom = makeLostTempLe(START_LAYER)
  447. if not lostLayer then return end
  448. human.lostTemple = { layer = lostLayer, x = lostX, y = lostY, random = lostRandom, box = nil, grid = nil }
  449. makeGrid(human)
  450. dbSave(human)
  451. end
  452. -- 重置之后的Y值
  453. local function getStartYVal(mapIdx)
  454. local LostTempleConfig = LostTempleExcel[START_LAYER]
  455. if not LostTempleConfig then
  456. return -1
  457. end
  458. local LostTemple = LostTempleConfig[mapIdx]
  459. if not LostTemple then
  460. return -1
  461. end
  462. local LostTempleX = LostTemple[START_X]
  463. if not LostTempleX then
  464. return -1
  465. end
  466. local startY = -1
  467. for y = 1, LostTemple.vertical do
  468. if LostTempleX[y] and LostTempleX[y][1] == 0 then
  469. startY = y
  470. break
  471. end
  472. end
  473. return startY
  474. end
  475. -- 是否已经挑战过
  476. local function isChallenge(human)
  477. if not human.lostTemple then
  478. return false
  479. end
  480. -- 层数判断
  481. local layer = human.lostTemple.layer or 0
  482. if layer > 1 then
  483. return true
  484. end
  485. -- X 值判断
  486. local start_X_Val = human.lostTemple.x or 0
  487. if start_X_Val ~= START_X then
  488. return true
  489. end
  490. local y_Val = human.lostTemple.y or 0
  491. local mapIdx = human.lostTemple.random or 0
  492. local start_Y_Val = getStartYVal(mapIdx)
  493. if start_Y_Val == -1 then
  494. assert(false, "失落神庙数据异常")
  495. end
  496. -- Y 值判断
  497. if y_Val ~= start_Y_Val then
  498. return true
  499. end
  500. return false
  501. end
  502. -- human = { }
  503. -- initDB(human)
  504. -- printGrid(human)
  505. -- print("-----------------------------")
  506. -- 下一格
  507. function nextGrid(human, y)
  508. if not human.lostTemple then return end
  509. local layer = human.lostTemple.layer
  510. local LostTempleConfig = LostTempleExcel[layer]
  511. if not LostTempleConfig then
  512. assert(nil, "lostTemple startLayer error = " .. layer)
  513. end
  514. local random = human.lostTemple.random
  515. local LostTemple = LostTempleConfig[random]
  516. if not LostTemple then return end
  517. local x = human.lostTemple.x + 1
  518. local LostTempleX = LostTemple[x]
  519. if not LostTempleX then return end
  520. local LostTempleY = LostTempleX[y]
  521. if not LostTempleY then return end
  522. human.lostTemple.x = x
  523. human.lostTemple.y = y
  524. makeGrid(human)
  525. end
  526. -- 下一层
  527. local function nextDB(human)
  528. if not human.lostTemple then return end
  529. local nextLayer = human.lostTemple.layer + 1
  530. local LostTempleConfig = LostTempleExcel[nextLayer]
  531. if not LostTempleConfig then return end
  532. local lostLayer, lostX, lostY, lostRandom = makeLostTempLe(nextLayer)
  533. if not lostLayer then return end
  534. -- TriggerLogic.PublishEvent(TriggerDefine.LOSTTEMPLE_PASS_LAYER, human.db._id, 1)
  535. human.lostTemple.layer = lostLayer
  536. human.lostTemple.x = lostX
  537. human.lostTemple.y = lostY
  538. human.lostTemple.random = lostRandom
  539. human.lostTemple.grid = nil
  540. makeGrid(human)
  541. end
  542. --
  543. local function makeGridNet(human, net)
  544. if not human.lostTemple then return end
  545. local startX = human.lostTemple.x + 1
  546. local endX = human.lostTemple.x + QUEUE_LEN
  547. local layer = human.lostTemple.layer
  548. local random = human.lostTemple.random
  549. local LostTempleConfig = LostTempleExcel[layer]
  550. if not LostTempleConfig then return end
  551. local LostTemple = LostTempleConfig[random]
  552. if not LostTemple then return end
  553. net[0] = 0
  554. local len = 0
  555. for x = startX, endX do
  556. if human.lostTemple.grid[x] then
  557. for y = 1, LostTemple.vertical do
  558. if human.lostTemple.grid[x][y] then
  559. len = len + 1
  560. local grid = human.lostTemple.grid[x][y]
  561. local element = ElementExcel[grid.id]
  562. if not element then
  563. assert(nil, "lostTemple element error = " .. grid.id)
  564. end
  565. net[len].id = grid.id
  566. net[len].name = element.name
  567. net[len].type = element.type
  568. net[len].desc = element.desc
  569. net[len].x = x
  570. net[len].y = y
  571. net[len].body = 0
  572. if grid.monsterOutID then
  573. if not MonsterOutExcel[grid.monsterOutID] then
  574. assert(nil, "lostTemple monsterOutID error = " .. grid.monsterOutID)
  575. end
  576. local monsterConfig = MonsterExcel.monster[MonsterOutExcel[grid.monsterOutID].member[1][1]]
  577. if not monsterConfig then
  578. assert(nil, "lostTemple monsterOutID error = " .. MonsterOutExcel[grid.monsterOutID].member[1][1])
  579. end
  580. net[len].body = monsterConfig.body
  581. end
  582. end
  583. end
  584. end
  585. end
  586. net[0] = len
  587. return true
  588. end
  589. --通关
  590. function IsPass(human)
  591. -- initDB(human)
  592. if not human.lostTemple then return false end
  593. if human.lostTemple.oneClickSweep then
  594. return true
  595. end
  596. local startX = human.lostTemple.x + 1
  597. local endX = human.lostTemple.x + QUEUE_LEN
  598. local layer = human.lostTemple.layer
  599. local random = human.lostTemple.random
  600. local LostTempleConfig = LostTempleExcel[layer]
  601. if not LostTempleConfig then return end
  602. local LostTemple = LostTempleConfig[random]
  603. if not LostTemple then return end
  604. local type = 0
  605. local len = 0
  606. for x = startX, endX do
  607. if human.lostTemple.grid[x] then
  608. for y = 1, LostTemple.vertical do
  609. if human.lostTemple.grid[x][y] then
  610. len = len + 1
  611. local grid = human.lostTemple.grid[x][y]
  612. local element = ElementExcel[grid.id]
  613. if not element then
  614. return false
  615. end
  616. type = element.type
  617. end
  618. end
  619. end
  620. end
  621. if len == 1 and type == 6 and layer >= 3 then
  622. return true
  623. end
  624. return false
  625. end
  626. -- 查询
  627. function query(human)
  628. if not isOpen(human) then
  629. return
  630. end
  631. -- 没有共鸣
  632. local db = human.db.xingYaoGongMing
  633. if not db or not db.defList then
  634. return
  635. end
  636. initDB(human)
  637. local leftTime = getLeftTime()
  638. local msgRet = Msg.gc.GC_LOST_TEMPLE_QUERY
  639. msgRet.leftTime = leftTime
  640. if not makeGridNet(human, msgRet.list) then return end
  641. msgRet.playerX = human.lostTemple.x
  642. msgRet.playerY = human.lostTemple.y
  643. msgRet.layer = human.lostTemple.layer
  644. msgRet.leftTime = leftTime
  645. Msg.send(msgRet, human.fd)
  646. sendHeroStatus(human)
  647. end
  648. -- 更新
  649. function update(human)
  650. if not human.lostTemple then
  651. return
  652. end
  653. local msgRet = Msg.gc.GC_LOST_TEMPLE_UPDATE
  654. if not makeGridNet(human, msgRet.list) then
  655. return
  656. end
  657. local leftTime = getLeftTime()
  658. msgRet.leftTime = leftTime
  659. msgRet.playerX = human.lostTemple.x
  660. msgRet.playerY = human.lostTemple.y
  661. msgRet.layer = human.lostTemple.layer
  662. Msg.send(msgRet, human.fd)
  663. end
  664. -- 检测点击格子是否合法
  665. function checkPutByY(human, y)
  666. local startX = human.lostTemple.x + 1
  667. if not human.lostTemple.grid or not human.lostTemple.grid[startX] or not human.lostTemple.grid[startX][y] then return end
  668. local grid = human.lostTemple.grid[startX][y]
  669. -- 检测点击位置是否合法
  670. return grid
  671. end
  672. -- 检测点击格子是否合法
  673. function checkPut(human, x, y)
  674. local startX = x
  675. if not human.lostTemple.grid or not human.lostTemple.grid[startX] or not human.lostTemple.grid[startX][y] then return end
  676. local grid = human.lostTemple.grid[startX][y]
  677. local nNowX = human.lostTemple.x
  678. local nNowY = human.lostTemple.y
  679. if nNowX + 1 ~= x then
  680. print("[checkPut] x ="..x.." nNowX="..nNowX.." y="..y.." nNowY="..nNowY)
  681. return
  682. end
  683. -- 检测点击位置是否合法
  684. return grid
  685. end
  686. -- 设置格子
  687. function putSet(human, y, cmd)
  688. local startX = human.lostTemple.x + 1
  689. if not human.lostTemple.grid or not human.lostTemple.grid[startX] or not human.lostTemple.grid[startX][y] then return end
  690. if cmd == "eliteBoss" then
  691. human.lostTemple.grid[startX][y] = { id = makeBoxGrid(human) }
  692. return true
  693. end
  694. if cmd == "summonBox" then
  695. human.lostTemple.grid[startX][y] = { id = makeConverDoorGrid(human) }
  696. return true
  697. end
  698. end
  699. -- 走到下一步
  700. function put(human, op, x, y, arg)
  701. if not isOpen(human) then return end
  702. if not human.lostTemple then return end
  703. if op ~= OP_QUERY and op ~= OP_CONFIRM then return end
  704. local grid = checkPut(human, x, y)
  705. if not grid then return end
  706. local elementConfig = ElementExcel[grid.id]
  707. if not elementConfig then return end
  708. local ret = nil
  709. if Lost_Handle_Func[elementConfig.cmd] then
  710. ret = Lost_Handle_Func[elementConfig.cmd](human, op, y, grid, arg, elementConfig)
  711. end
  712. if ret then
  713. nextGrid(human, y)
  714. dbSave(human)
  715. update(human)
  716. end
  717. end
  718. -- 怪物面板
  719. local function monsterQuery(human, grid, elementConfig)
  720. if not human.lostTemple then return end
  721. if not grid.monsterOutID then return end
  722. local rewardConfig = LostTempleExcel.Drop[elementConfig.arg[1]]
  723. if not rewardConfig then return end
  724. local msgRet = Msg.gc.GC_LOST_TEMPLE_MONSTER
  725. msgRet.gdReward[0] = 0
  726. for _, item in ipairs(rewardConfig.drop) do
  727. msgRet.gdReward[0] = msgRet.gdReward[0] + 1
  728. Grid.makeItem(msgRet.gdReward[msgRet.gdReward[0]], item[1], item[2])
  729. end
  730. msgRet.randomReward[0] = 0
  731. for _, item in ipairs(rewardConfig.randomdrop) do
  732. if type(item) == "table" then
  733. msgRet.randomReward[0] = msgRet.randomReward[0] + 1
  734. Grid.makeItem(msgRet.randomReward[msgRet.randomReward[0]], item[1], item[2])
  735. end
  736. end
  737. local monsterOutConfig = MonsterOutExcel[grid.monsterOutID]
  738. if not monsterOutConfig then return end
  739. local formation = monsterOutConfig.formation
  740. formation = formation == 0 and 1 or formation
  741. local mationConfig = CombatPosExcel.formation[formation]
  742. local posList = mationConfig.pos
  743. if not posList then return end
  744. msgRet.list[0] = 0
  745. for i, member in ipairs(monsterOutConfig.member) do
  746. local monsterID = member[1]
  747. local monsterConfig = MonsterExcel.monster[monsterID]
  748. if posList[i] then
  749. local defPos = CombatLogic.getPos(CombatDefine.DEFEND_SIDE, posList[i])
  750. local monsterLv = member[2]
  751. local obj = grid.objStatus and grid.objStatus[defPos] or nil
  752. local hpRate = obj and obj.hpRate or 1
  753. local hp = math.ceil(INIT_HP_MAX * hpRate)
  754. local hpMax = INIT_HP_MAX
  755. local others = HeroGrid.createOthers(monsterLv, hp, hpMax, monsterConfig.star)
  756. msgRet.list[0] = msgRet.list[0] + 1
  757. HeroGrid.makeHeroSimpleByMonsterID(msgRet.list[msgRet.list[0]], monsterID, others)
  758. end
  759. end
  760. msgRet.showNext = 0
  761. if human.db.zhandouli >= SHOWQUICKPOWER then
  762. msgRet.showNext = 1
  763. end
  764. msgRet.quick = 0
  765. if human.db.combatQuick[CombatDefine.COMBAT_TYPE24] == 1 then
  766. msgRet.quick = 1
  767. end
  768. Msg.send(msgRet, human.fd)
  769. end
  770. -- 英雄列表
  771. function sendHeroStatus(human)
  772. if not human.lostTemple then return end
  773. local msgRet = Msg.gc.GC_LOST_TEMPLE_HERO_STATUS
  774. msgRet.list[0] = 0
  775. msgRet.isEnd = 0
  776. local len = 0
  777. if human.lostTemple.heroStatus then
  778. for k, hpRate in pairs(human.lostTemple.heroStatus) do
  779. local hp = math.ceil(INIT_HP_MAX * hpRate)
  780. local hpMax = INIT_HP_MAX
  781. len = len + 1
  782. local net = msgRet.list[len]
  783. net.hp = hp
  784. net.hpMax = hpMax
  785. net.uuid = k
  786. if len >= 30 then
  787. msgRet.isEnd = 0
  788. msgRet.list[0] = len
  789. Msg.send(msgRet, human.fd)
  790. len = 0
  791. end
  792. end
  793. end
  794. msgRet.isEnd = 1
  795. msgRet.list[0] = len
  796. Msg.send(msgRet, human.fd)
  797. end
  798. -- 推送召唤祭坛英雄列表
  799. function sendSummonHeroList(human)
  800. if not human.lostTemple then return end
  801. if not human.lostTemple.summonHero then return end
  802. local msgRet = Msg.gc.GC_LOST_TEMPLE_SUMMON_LIST
  803. msgRet.list[0] = 0
  804. for index = 1, human.lostTemple.summonHero[0] do
  805. msgRet.list[0] = msgRet.list[0] + 1
  806. HeroGrid.makeHeroSimple(msgRet.list[msgRet.list[0]], human.lostTemple.summonHero[index], index)
  807. end
  808. Msg.send(msgRet, human.fd)
  809. end
  810. -- 推送buff属性
  811. function sendSummonTreeList(human)
  812. if not human.lostTemple then return end
  813. if not human.lostTemple.summonTree then return end
  814. local msgRet = Msg.gc.GC_LOST_TEMPLE_BUFF_LIST
  815. msgRet.list[0] = 0
  816. for k, v in pairs(human.lostTemple.summonTree) do
  817. msgRet.list[0] = msgRet.list[0] + 1
  818. local net = msgRet.list[msgRet.list[0]]
  819. net.attr.key = k
  820. net.attr.value = v
  821. net.name = ""
  822. for i = 1, #LostTempleExcel.Tree do
  823. if LostTempleExcel.Tree[i].icon == k then
  824. net.name = LostTempleExcel.Tree[i].buffname
  825. break
  826. end
  827. end
  828. end
  829. Msg.send(msgRet, human.fd)
  830. end
  831. -- 随机奖励宝箱
  832. function sendRandomBox(human)
  833. if not human.lostTemple then return end
  834. local msgRet = Msg.gc.GC_LOGT_TEMPLE_RANDOM_BOX
  835. local len = 0
  836. if human.lostTemple.randomReward then
  837. for k, v in pairs(human.lostTemple.randomReward) do
  838. len = len + 1
  839. Grid.makeItem(msgRet.randomReward[len], k, v)
  840. end
  841. end
  842. msgRet.randomReward[0] = len
  843. Msg.send(msgRet, human.fd)
  844. end
  845. --
  846. function Lost_Handle_Func.nomalMonster(human, op, y, grid, arg, elementConfig)
  847. if op == OP_QUERY then
  848. monsterQuery(human, grid, elementConfig)
  849. end
  850. end
  851. --
  852. function Lost_Handle_Func.eliteMonster(human, op, y, grid, arg, elementConfig)
  853. if op == OP_QUERY then
  854. monsterQuery(human, grid, elementConfig)
  855. end
  856. end
  857. --
  858. function Lost_Handle_Func.eliteBoss(human, op, y, grid, arg, elementConfig)
  859. if op == OP_QUERY then
  860. monsterQuery(human, grid, elementConfig)
  861. end
  862. end
  863. --
  864. function Lost_Handle_Func.summonHero(human, op, y, grid, arg, elementConfig)
  865. -- 召唤神坛查询
  866. if op == OP_QUERY then
  867. if not grid.summonHero then return end
  868. local msgRet = Msg.gc.GC_LOST_TEMPLE_SUMMON
  869. msgRet.list[0] = 0
  870. for i = 1, #grid.summonHero do
  871. local hero = grid.summonHero[i]
  872. msgRet.list[0] = msgRet.list[0] + 1
  873. local others = HeroGrid.createOthers(hero.lv, INIT_HP_MAX, INIT_HP_MAX, hero.star)
  874. HeroGrid.makeHeroSimpleByID(msgRet.list[msgRet.list[0]], hero.id, i, others)
  875. end
  876. Msg.send(msgRet, human.fd)
  877. return
  878. end
  879. -- 添加召唤英雄
  880. if op == OP_CONFIRM then
  881. local index = tonumber(arg)
  882. if not grid.summonHero then return end
  883. local hero = grid.summonHero[index]
  884. if not hero then return end
  885. local heroGrid = HeroGrid.createHeroGrid(hero.id, hero.star)
  886. if not heroGrid then return end
  887. heroGrid.isLostTemple = 1
  888. -- 初始化属性
  889. local attrConfig = HeroDefine.getAttrConfig(hero.id, heroGrid.star)
  890. if not attrConfig then return end
  891. local quality = HeroGrid.getMaxQualityByLv(heroGrid.star, hero.lv)
  892. local maxLv = HeroGrid.getMaxLv(heroGrid.star, quality)
  893. heroGrid.lv = math.min(maxLv, hero.lv or 0)
  894. heroGrid.quality = math.max(heroGrid.quality, quality or 0)
  895. -- 加入装备
  896. -- 加入到英雄队列
  897. human.lostTemple.summonHero = human.lostTemple.summonHero or { }
  898. human.lostTemple.summonHero[0] = human.lostTemple.summonHero[0] or 0
  899. human.lostTemple.summonHero[0] = human.lostTemple.summonHero[0] + 1
  900. local addIndex = human.lostTemple.summonHero[0]
  901. human.lostTemple.summonHero[addIndex] = heroGrid
  902. heroGrid.bagIndex = addIndex
  903. -- 计算属性
  904. LostTempleCombatLogic.getHeroAttrs(human, addIndex)
  905. -- 通知客户端
  906. sendSummonHeroList(human)
  907. return true
  908. end
  909. end
  910. -- 智慧树
  911. function Lost_Handle_Func.summonTree(human, op, y, grid, arg, elementConfig)
  912. -- 召唤神坛查询
  913. if op == OP_QUERY then
  914. if not grid.summonTree then return end
  915. local msgRet = Msg.gc.GC_LOST_TEMPLE_BUFF
  916. msgRet.list[0] = 0
  917. for i = 1, #grid.summonTree do
  918. local hero = grid.summonTree[i]
  919. msgRet.list[0] = msgRet.list[0] + 1
  920. local config = LostTempleExcel.Tree[grid.summonTree[i]]
  921. local net = msgRet.list[msgRet.list[0]]
  922. net.id = i
  923. net.icon = config.icon
  924. net.name = config.buffname
  925. net.attr[0] = #config.Buffid
  926. for i = 1, #config.Buffid do
  927. net.attr[i].key = config.Buffid[i][1]
  928. net.attr[i].value = config.Buffid[i][2]
  929. end
  930. end
  931. Msg.send(msgRet, human.fd)
  932. return
  933. end
  934. -- 添加召唤英雄
  935. if op == OP_CONFIRM then
  936. local index = tonumber(arg)
  937. if not grid.summonTree then return end
  938. local buffID = grid.summonTree[index]
  939. if not buffID then return end
  940. local config = LostTempleExcel.Tree[buffID]
  941. if not config then return end
  942. human.lostTemple.summonTree = human.lostTemple.summonTree or { }
  943. for i = 1, #config.Buffid do
  944. local key = config.Buffid[i][1]
  945. local value = config.Buffid[i][2]
  946. human.lostTemple.summonTree[key] = human.lostTemple.summonTree[key] or 0
  947. human.lostTemple.summonTree[key] = human.lostTemple.summonTree[key] + value
  948. end
  949. sendSummonTreeList(human)
  950. return true
  951. end
  952. end
  953. -- 炽天使
  954. function Lost_Handle_Func.treatRevive(human, op, y, grid, arg, elementConfig)
  955. if op == OP_QUERY then
  956. return
  957. end
  958. -- 复活治疗
  959. if op == OP_CONFIRM then
  960. local opType = tonumber(arg)
  961. local heroStatus = human.lostTemple.heroStatus
  962. if not heroStatus then return true end
  963. -- 复活
  964. if opType == 1 then
  965. local len = 0
  966. local cnt = 0
  967. local revice = {}
  968. local hpList = {}
  969. for k, hpRate in pairs(heroStatus) do
  970. if hpRate <= 0.0 then
  971. len = len + 1
  972. revice[len]=k
  973. else
  974. if hpRate < 1.0 then
  975. cnt = cnt + 1
  976. hpList[cnt] = k
  977. end
  978. end
  979. end
  980. if #revice > 0 then
  981. local random = math.random(1, #revice)
  982. heroStatus[revice[random]] = nil
  983. elseif #hpList > 0 then
  984. local random = math.random(1, #hpList)
  985. heroStatus[hpList[random]] = nil
  986. end
  987. end
  988. -- 治疗
  989. if opType == 2 then
  990. for k, hpRate in pairs(heroStatus) do
  991. if heroStatus[k] > 0.0 then
  992. heroStatus[k] = hpRate + 0.5
  993. if heroStatus[k] >= 1.0 then
  994. heroStatus[k] = nil
  995. end
  996. end
  997. end
  998. end
  999. sendHeroStatus(human)
  1000. return true
  1001. end
  1002. end
  1003. -- 神界商店
  1004. function Lost_Handle_Func.summonShop(human, op, y, grid, arg, elementConfig)
  1005. if op == OP_QUERY then
  1006. if not grid.summonShop then return end
  1007. local msgRet = Msg.gc.GC_LOST_TEMPLE_SHOP
  1008. msgRet.list[0] = 0
  1009. for i = 1, #grid.summonShop do
  1010. msgRet.list[0] = msgRet.list[0] + 1
  1011. local config = LostTempleExcel.LostShop[grid.summonShop[i]]
  1012. local net = msgRet.list[msgRet.list[0]]
  1013. Grid.makeItem(net.item, config.itemid, config.itemnum)
  1014. Grid.makeItem(net.needItem, config.spenditem, config.spendnum)
  1015. net.discount = config.discount
  1016. net.id = i
  1017. end
  1018. Msg.send(msgRet, human.fd)
  1019. return
  1020. end
  1021. -- 购买东西
  1022. if op == OP_CONFIRM then
  1023. local index = tonumber(arg)
  1024. if not grid.summonShop then return end
  1025. local shopID = grid.summonShop[index]
  1026. if not shopID then return end
  1027. local config = LostTempleExcel.LostShop[shopID]
  1028. if not config then return end
  1029. if not BagLogic.checkItemCnt(human, config.spenditem, config.spendnum) then
  1030. return
  1031. end
  1032. BagLogic.delItem(human, config.spenditem, config.spendnum, "lostTemple")
  1033. BagLogic.addItem(human, config.itemid, config.itemnum, "lostTemple")
  1034. return true
  1035. end
  1036. end
  1037. -- -- 宝箱
  1038. function Lost_Handle_Func.summonBox(human, op, y, grid, arg, elementConfig)
  1039. if op == OP_QUERY then
  1040. sendRandomBox(human)
  1041. return
  1042. end
  1043. --
  1044. if op == OP_CONFIRM then
  1045. if human.lostTemple.randomReward then
  1046. local item = { }
  1047. local len = 0
  1048. for k, v in pairs(human.lostTemple.randomReward) do
  1049. len = len + 1
  1050. item[len] = { k, v }
  1051. end
  1052. BagLogic.addItemList(human, item, "lostTemple")
  1053. human.lostTemple.randomReward = nil
  1054. TriggerLogic.PublishEvent(TriggerDefine.LOSTTEMPLE_PASS_LAYER, human.db._id, 1)
  1055. end
  1056. -- 判定有没有下一程
  1057. local nextLayer = human.lostTemple.layer + 1
  1058. local LostTempleConfig = LostTempleExcel[nextLayer]
  1059. if LostTempleConfig then
  1060. -- 变成传送门
  1061. putSet(human, y, elementConfig.cmd)
  1062. end
  1063. dbSave(human)
  1064. update(human)
  1065. RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1208)
  1066. end
  1067. end
  1068. -- 传送门
  1069. function Lost_Handle_Func.conveyDoor(human, op, y, grid, arg, elementConfig)
  1070. if op == OP_QUERY then
  1071. return
  1072. end
  1073. -- 进入下一层
  1074. if op == OP_CONFIRM then
  1075. nextDB(human)
  1076. dbSave(human)
  1077. update(human)
  1078. end
  1079. end
  1080. function lostTempleRevice(human)
  1081. if not human.lostTemple then return end
  1082. human.lostTemple.heroStatus = nil
  1083. sendHeroStatus(human)
  1084. end
  1085. -- 查询一键扫荡状态
  1086. function LostTemple_OneClickSweep_Query(human)
  1087. local msgRet = Msg.gc.GC_LOGT_TEMPLE_ONECLICK_SWEEP_QUERY
  1088. msgRet.state = 0
  1089. if human.lostTemple and human.lostTemple.oneClickSweep then
  1090. msgRet.state = 2
  1091. else
  1092. local isBuyKing = HeroGrowUp.isBuyKing(human)
  1093. if isBuyKing and isBuyKing == 1 then
  1094. msgRet.state = 1
  1095. end
  1096. end
  1097. Msg.send(msgRet, human.fd)
  1098. end
  1099. -- 查询一键扫荡奖励
  1100. function LostTemple_OneClickSweep_Award(human)
  1101. local msgRet = Msg.gc.GC_LOGT_TEMPLE_ONECLICK_SWEEP_AWARD
  1102. msgRet.awardArr[0] = 0
  1103. local awardCfg = LostTempleExcel.Saodang[1].reward
  1104. msgRet.awardArr[0] = #awardCfg
  1105. for idx, itemTb in ipairs(awardCfg) do
  1106. Grid.makeItem(msgRet.awardArr[idx], itemTb[1], itemTb[2])
  1107. end
  1108. Msg.send(msgRet, human.fd)
  1109. end
  1110. -- 进行一键扫荡
  1111. function LostTemple_OneClickSweep_Do(human)
  1112. local isBuyKing = HeroGrowUp.isBuyKing(human)
  1113. if not isBuyKing or isBuyKing ~= 1 then
  1114. return Broadcast.sendErr(human, Lang.LOST_NO_BUY)
  1115. end
  1116. local lostTempleData = human.lostTemple
  1117. if lostTempleData and lostTempleData.oneClickSweep then
  1118. return Broadcast.sendErr(human, Lang.LOST_HAS_ONECLICKSWEEP)
  1119. end
  1120. if isChallenge(human) then
  1121. return Broadcast.sendErr(human, Lang.LOST_HAS_CHALLENGE)
  1122. end
  1123. -- 更新数据
  1124. --human.lostTemple = { layer = lostLayer, x = lostX, y = lostY, random = lostRandom, box = nil, grid = nil }
  1125. initDB(human)
  1126. -- lostTempleData = human.lostTemple
  1127. -- lostTempleData.layer = 3
  1128. -- lostTempleData.x = 10
  1129. -- lostTempleData.y = 4
  1130. for i=1, 2 do
  1131. nextDB(human)
  1132. end
  1133. human.lostTemple.oneClickSweep = true
  1134. dbSave(human)
  1135. update(human)
  1136. local awardArr = {}
  1137. local awardCfg = LostTempleExcel.Saodang[1].reward
  1138. for idx, itemTb in ipairs(awardCfg) do
  1139. awardArr[idx] = {itemTb[1], itemTb[2]}
  1140. end
  1141. BagLogic.addItemList(human, awardArr, "lostTemple")
  1142. YunYingLogic.onCallBack(human, "lostTempleCombat", 1)
  1143. LostTemple_OneClickSweep_Query(human)
  1144. RoleSystemLogic.onDot(human, RoleSystemDefine.ROLE_SYS_ID_1208)
  1145. end