lostTempleLogic.lua 41 KB

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