lostTempleLogic.lua 41 KB

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