HeroGrid.lua 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. -----------------------------------------------------------
  2. -- 英雄格子相关
  3. -- createHeroGrid 创建英雄对象
  4. -- getCacheHeroGrid 获取通用缓存英雄对象
  5. -- getHeroGridCalcCache 临时计算用的英雄格子
  6. -- createOthers 有时候要给HeroSimple额外附上一些特殊值,如等级血量等,会用到
  7. -- makeHeroSimple 根据英雄对象封装英雄信息HeroSimple
  8. -- makeHeroSimpleByID 根据英雄id封装英雄信息HeroSimple
  9. -- makeHeroSimpleByMonsterID 根据怪物id封装英雄信息HeroSimple
  10. -- makeHeroStatic 根据英雄id封装英雄静态信息HeroStatic
  11. -- makeHeroDynamic 根据英雄对象封装英雄动态信息HeroDynamic
  12. -- makeHeroDynamicByID 根据英雄id封装英雄动态信息HeroDynamic
  13. -- makeHeroInfo 根据英雄id封装英雄基础信息
  14. -- makeMonsterSimpleData 根据怪物id封装
  15. -- makeHeroNice 封装特殊英雄信息
  16. -- getMaxQuality 根据星级获取英雄最高品阶
  17. -- getMaxLv 根据星级和品阶获取英雄最大等级
  18. -- getHeroBodyById 根据英雄id获取英雄形象body
  19. -----------------------------------------------------------
  20. local lua_mongo = _G.lua_mongo
  21. local Util = require("common.Util")
  22. local UpNeedExcel = require("excel.upNeed")
  23. local HeroExcel = require("excel.hero")
  24. local MonsterExcel = require("excel.monster")
  25. local ObjHuman = require("core.ObjHuman")
  26. local RoleDefine = require("role.RoleDefine")
  27. local HeroDefine = require("hero.HeroDefine")
  28. local HeroLogic = require("hero.HeroLogic")
  29. local RoleAttr = require("role.RoleAttr")
  30. local EquipExcel = require("excel.equip")
  31. local ItemDefine = require("bag.ItemDefine")
  32. local BagLogic = require("bag.BagLogic")
  33. local Grid = require("bag.Grid")
  34. local SkinLogic = require("skin.SkinLogic")
  35. local PaomaExcel = require("excel.paoma")
  36. local UnionTecLogic = require("union.UnionTecLogic")
  37. local HeroBook = require("hero.HeroBook")
  38. local XingYaoGongMing = require("xingYaoMen.XingYaoGongMing")
  39. local FuwenExcel = require("excel.fuwen").fuwen
  40. local HeroGem = require("hero.HeroGem")
  41. HERO_GRID_CACHE = HERO_GRID_CACHE or {} -- 为静态英雄数据使用
  42. HERO_GRID_CACHE_TUJIAN = HERO_GRID_CACHE_TUJIAN or {}
  43. HERO_LEVELUP_MAXCNT = 5 -- 最多连升x次
  44. HERO_LEVELUP_MAXLEVEL = 60 -- 从x级开始不能连续升多级
  45. -- 创建一个英雄grid
  46. function createHeroGrid(id,star)
  47. local cf = HeroExcel.hero[id]
  48. if not cf then
  49. assert(nil, "not hero id "..id)
  50. return
  51. end
  52. local grid = {}
  53. grid.uuid = lua_mongo.id() --唯一标识
  54. grid.id = id
  55. grid.lv = 1 --等级
  56. -- 星级调整成动态值 dxzeng
  57. grid.star = star or cf.star --星级 起始星级
  58. grid.quality = 0 --品质
  59. grid.zhandouli = 0 --战斗力
  60. grid.equip = nil --装备 1-6对应6个部位
  61. grid.shuijingAttrID = nil --水晶随机属性ID
  62. grid.fuwen = nil --符文 1-2对应2个符文 因为只凭一个id或一个索引无法的到所上符文的详细信息
  63. grid.bingshu = nil --兵书 [index] = bingshuGrid
  64. grid.oldLV = nil --星耀共鸣记录旧等级
  65. grid.oldQuality = nil --星耀共鸣记录旧品质
  66. return grid
  67. end
  68. -- 初始化的英雄 无添加
  69. function getCacheHeroGrid(id, star, others)
  70. if not id then return end
  71. local cf = HeroExcel.hero[id]
  72. if not cf then return end
  73. star = star or cf.star
  74. local grid = HERO_GRID_CACHE[id] and HERO_GRID_CACHE[id][star] or nil
  75. if not grid or others then
  76. if not cf then return end
  77. local grid = createHeroGrid(id, star)
  78. if others then
  79. grid.lv = others.lv and others.lv or grid.lv
  80. grid.quality = others.quality and others.quality or grid.quality
  81. grid.star = others.star and others.star or grid.star
  82. end
  83. grid.attrs = Util.copyTable(RoleAttr.calcHeroGrid(grid))
  84. grid.zhandouli = grid.attrs[RoleDefine.ZHANDOULI] or 0
  85. HERO_GRID_CACHE[id] = HERO_GRID_CACHE[id] or {}
  86. HERO_GRID_CACHE[id][star] = grid
  87. end
  88. return HERO_GRID_CACHE[id][star]
  89. end
  90. -- 图鉴的英雄,经过美化
  91. function getCacheHeroGridTujian(id)
  92. if not id then return end
  93. local grid = HERO_GRID_CACHE_TUJIAN[id]
  94. if not grid then
  95. local cf = HeroExcel.hero[id]
  96. if not cf then return end
  97. local grid = createHeroGrid(id,cf.star)
  98. local maxQuality = getMaxQuality(cf.star)
  99. grid.lv = getMaxLv(cf.star, maxQuality)
  100. grid.quality = maxQuality
  101. -- 星级调整成动态值 dxzeng
  102. grid.star = cf.star
  103. grid.attrs = Util.copyTable(RoleAttr.calcHeroGrid(grid))
  104. grid.zhandouli = grid.attrs[RoleDefine.ZHANDOULI] or 0
  105. -- 英雄如果有推荐,用推荐
  106. local scf = HeroExcel.strategy[cf.id]
  107. local equipLen = scf and #scf.equips or 0
  108. for i = 1, equipLen do
  109. grid.equip = grid.equip or {}
  110. grid.equip[i] = scf.equips[i]
  111. if i == ItemDefine.EQUIP_SUBTYPE_SHUIJIN then
  112. grid.shuijingAttrID = scf.shuijing
  113. end
  114. end
  115. HERO_GRID_CACHE_TUJIAN[id] = grid
  116. end
  117. return HERO_GRID_CACHE_TUJIAN[id]
  118. end
  119. -- 临时用的英雄
  120. local HERO_GRID_CALC_CACHE = {}
  121. function getHeroGridCalcCache(grid)
  122. Util.cleanTable(HERO_GRID_CALC_CACHE)
  123. Util.copyTableSimple(grid, HERO_GRID_CALC_CACHE)
  124. return HERO_GRID_CALC_CACHE
  125. end
  126. -- 根据id取形象
  127. function getHeroBodyById(id)
  128. local cf = HeroExcel.hero[id]
  129. if not cf then
  130. return 0
  131. end
  132. return cf.body
  133. end
  134. -- 获取英雄最高品阶
  135. function getMaxQuality(star)
  136. local starConfig = HeroExcel.star[star]
  137. if not starConfig then return 0 end
  138. local maxQuality = starConfig.maxQuality
  139. return maxQuality
  140. end
  141. -- 获取英雄最高等级
  142. function getMaxLv(star, quality)
  143. local starConfig = HeroExcel.star[star]
  144. if not starConfig then return 0 end
  145. if not starConfig.maxLv[quality+1] then
  146. return starConfig.maxLv[#starConfig.maxLv][2]
  147. end
  148. local maxLv = starConfig.maxLv[quality+1][2]
  149. return maxLv
  150. end
  151. -- 获取英雄等级 能达到的最高品阶
  152. function getMaxQualityByLv(star, lv)
  153. local maxQuality = getMaxQuality(star)
  154. local starConfig = HeroExcel.star[star]
  155. if not starConfig then return 0 end
  156. local quality = 0
  157. for i = 1, maxQuality do
  158. local maxLv = getMaxLv(star, quality)
  159. if lv >= maxLv then
  160. quality = i
  161. else
  162. break
  163. end
  164. end
  165. return quality <= maxQuality and quality or maxQuality
  166. end
  167. -- 额外数据
  168. local TEMP_OTHERS = {}
  169. function createOthers(lv, hp, hpMax, star)
  170. TEMP_OTHERS.lv = lv
  171. TEMP_OTHERS.hp = hp
  172. TEMP_OTHERS.hpMax = hpMax
  173. TEMP_OTHERS.star = star
  174. TEMP_OTHERS.quality = getMaxQuality(star)
  175. return TEMP_OTHERS
  176. end
  177. -- 封装英雄信息
  178. function makeHeroSimple(net, grid, index, human, others, tuJian)
  179. local id = grid and (grid.id or grid.heroID)
  180. local cf = id and HeroExcel.hero[id]
  181. local star = grid and grid.star or (cf and cf.star or 1)
  182. local upStarConfig = HeroDefine.getNextAttrConfig(id, star)
  183. local jobConfig = cf and cf.job and HeroExcel.job[cf.job]
  184. local isGongMing = XingYaoGongMing.isGongMing(human, index)
  185. net.id = id or 0
  186. net.index = index or 0
  187. net.uuid = grid and grid.uuid or ""
  188. net.gl = cf and cf.gl or 0
  189. net.camp = cf and cf.camp or 0
  190. net.job = cf and cf.job or 0
  191. net.star = others and others.star or star --cf and cf.star or 0 星级调整 dxzeng
  192. net.icon = grid and grid.head or (cf and cf.head or 0)
  193. net.body = grid and grid.body or (cf and cf.body or 0)
  194. if grid and human and index then -- todo 皮肤这个以后可能还是需要继续整理
  195. local skinConf = SkinLogic.getHeroSkin(human, index)
  196. if skinConf then
  197. net.icon = skinConf.head
  198. net.body = skinConf.body
  199. end
  200. end
  201. net.up = upStarConfig == nil and 0 or 1 --是否能够升星
  202. net.lv = others and others.lv or (grid and grid.lv or 1)
  203. net.zhandouli = grid and grid.zhandouli or 0
  204. net.quality = grid and grid.quality or 0
  205. net.isLock = (grid and grid.isLock) and 1 or 0
  206. net.hp = others and others.hp or 0
  207. net.hpMax = others and others.hpMax or 0
  208. net.cnt = others and others.cnt or 1
  209. net.isget = HeroBook.isGetHero(human, id) or 0
  210. net.weightLv = cf and cf.grade or 0
  211. net.name = cf and cf.name or ""
  212. net.grade = cf and cf.grade or 0
  213. net.jobDesc = jobConfig and jobConfig.desc or ""
  214. net.label = cf and cf.label or ""
  215. net.order = cf and cf.order or 0
  216. net.isGongMing = isGongMing or 0
  217. --是否发送图鉴信息
  218. net.general[0] = 0
  219. if tuJian then
  220. local tj = HeroExcel.tujian[id]
  221. if tj ~= nil then
  222. net.general[0] = 1
  223. net.general[1].cm = tj.cm or 0
  224. net.general[1].kg = tj.kg or 0
  225. net.general[1].age = tj.age or 0
  226. net.general[1].cup = tj.cup or ""
  227. net.general[1].character = tj.character or ""
  228. net.general[1].interest = tj.interest or ""
  229. net.general[1].desc = tj.desc or ""
  230. end
  231. end
  232. --宝石
  233. --根据客户端要求,如果没有宝石数据,就拼接一份默认数据下发
  234. net.gemData[0] = 0
  235. if net.id and net.id ~= 0 then
  236. net.gemData[0] = HeroDefine.HEROGEMMAX
  237. HeroGem.assembleData(grid and grid.gem, net.gemData, net.job)
  238. end
  239. end
  240. -- 封装英雄信息装备符文
  241. function fontHeroDetailInfo(net, grid, index, human, others, tuJian)
  242. makeHeroSimple(net,grid, index, human, others, tuJian)
  243. net.equips = grid.equip or {}
  244. for k,v in pairs(net.equips) do
  245. if next(v) then
  246. v.name = EquipExcel.equip[v.id].name
  247. end
  248. end
  249. net.fuWens = grid.fuwen or {}
  250. for k,v in pairs(net.fuWens) do
  251. if next(v) then
  252. v.name = FuwenExcel[v.id].name
  253. end
  254. end
  255. end
  256. -- 根据英雄id封装英雄信息heroSimple
  257. function makeHeroOrMonster(net, id, index, others, human,tujian)
  258. local grid = getCacheHeroGrid(id)
  259. if not grid then
  260. makeHeroSimpleByMonsterID(net, id, others)
  261. else
  262. makeHeroSimple(net, grid, index, human, others,tujian)
  263. end
  264. end
  265. -- 根据英雄id封装英雄信息heroSimple
  266. function makeHeroSimpleByID(net, id, index, others, human, tujian)
  267. local star = others and others.star or nil
  268. local grid = getCacheHeroGrid(id, star, others)
  269. makeHeroSimple(net, grid, index, human, others,tujian)
  270. end
  271. -- 根据怪物id封装英雄信息
  272. function makeHeroSimpleByMonsterID(net, id, others)
  273. makeHeroSimpleByID(net, nil, nil, others)
  274. local mcf = MonsterExcel.monster[id]
  275. if not mcf then return end
  276. net.id = id
  277. net.camp = mcf.camp
  278. net.job = mcf.job
  279. net.star = mcf.star
  280. net.icon = mcf.head
  281. net.body = mcf.body
  282. net.lv = others and others.lv or 1
  283. net.hp = others and others.hp or 0
  284. net.hpMax = others and others.hpMax or 0
  285. end
  286. function makeHeroSimpleByGeneral(net, id)
  287. local tj = HeroExcel.tujian[id]
  288. if tj ~= nil then
  289. net.general[0] = 1
  290. net.general[1].cm = tj.cm or 0
  291. net.general[1].kg = tj.kg or 0
  292. net.general[1].age = tj.age or 0
  293. net.general[1].cup = tj.cup or ""
  294. net.general[1].character = tj.character or ""
  295. net.general[1].interest = tj.interest or ""
  296. net.general[1].desc = tj.desc or ""
  297. end
  298. end
  299. function makeHeroNice(net, id, cnt, isNew, index, human)
  300. net.itemData[0] = 0
  301. net.heroSimple[0] = 0
  302. net.heroStatic[0] = 0
  303. if cnt then
  304. net.itemData[0] = 1
  305. Grid.makeItem(net.itemData[1], id, cnt)
  306. end
  307. local heroConfig = HeroExcel.hero[id]
  308. local specialConfig = HeroExcel.specialHero[id]
  309. if heroConfig then
  310. net.heroSimple[0] = 1
  311. makeHeroSimpleByID(net.heroSimple[1], id, index)
  312. if human then
  313. local skinbody = SkinLogic.getBodyByHeroId(human, id)
  314. if skinbody then
  315. net.heroSimple[1].body = skinbody
  316. end
  317. end
  318. net.heroStatic[0] = 1
  319. makeHeroStatic(net.heroStatic[1], id)
  320. end
  321. net.body = specialConfig and (heroConfig and heroConfig.body or 0) or 0
  322. net.isNew = isNew and 1 or 0
  323. net.weightLv = heroConfig and heroConfig.grade or 0
  324. net.attrs[0] = 0
  325. net.attrsMax[0] = 0
  326. net.bubble = ""
  327. if heroConfig then
  328. local bubble = PaomaExcel.bubble[heroConfig.id]
  329. net.bubble = bubble and bubble.drawCard or ""
  330. local heroGrid = getCacheHeroGridTujian(id)
  331. for key = RoleDefine.ATK, RoleDefine.SPEED do
  332. local value = heroGrid.attrs[key]
  333. net.attrs[0] = net.attrs[0] + 1
  334. net.attrs[net.attrs[0]].key = key
  335. net.attrs[net.attrs[0]].value = value
  336. net.attrsMax[0] = net.attrsMax[0] + 1
  337. net.attrsMax[net.attrsMax[0]].key = key
  338. net.attrsMax[net.attrsMax[0]].value = HeroDefine.getTujianMaxValue(key)
  339. end
  340. end
  341. end
  342. -- 填充英雄详细信息:静态
  343. function makeHeroStatic(net, id, tuJian)
  344. local cf = id and HeroExcel.hero[id]
  345. if not cf then
  346. net.id=0
  347. net.name =""
  348. net.body =0
  349. net.job = 0
  350. net.weightLv=0
  351. net.normalAtkID=0
  352. net.skillList[0]=0
  353. net.beSkill[0]=0
  354. net.skin=0
  355. return
  356. end
  357. local star = cf.star
  358. if tuJian and tuJian == 1 then
  359. local tuJianConfig = HeroExcel.tujian[id]
  360. if tuJianConfig then
  361. local maxStarIndex = #tuJianConfig.star
  362. star = tuJianConfig.star[maxStarIndex]
  363. end
  364. end
  365. net.id = id
  366. net.name = cf.name
  367. net.body = cf.body
  368. net.job = cf.job
  369. net.weightLv = cf.grade
  370. local attrConfig = HeroDefine.getAttrConfig(id, star)
  371. net.normalAtkID = attrConfig.normalAtkID
  372. net.skillList[0] = #attrConfig.skillList
  373. for i = 1, net.skillList[0] do
  374. HeroLogic.makeSkillNet(net.skillList[i], attrConfig.skillList[i])
  375. end
  376. net.beSkill[0] = #attrConfig.beSkillList
  377. for i = 1, net.beSkill[0] do
  378. HeroLogic.makeSkillNet(net.beSkill[i], attrConfig.beSkillList[i])
  379. end
  380. net.skin = #cf.skin > 0 and 1 or 0
  381. end
  382. -- 最多连续升x级
  383. function getLevelUpCnt(human, nowLv, maxLv)
  384. local cnt = 0
  385. local needJinbi = 0
  386. local needItemCnt = 0
  387. if human and human.db and human.db.bag then
  388. local bagItemCnt = BagLogic.getItemCnt(human, ItemDefine.ITEM_GREEN_EXP_ID)
  389. local bagJinbi = human.db.jinbi
  390. for i = 1, HERO_LEVELUP_MAXCNT do
  391. local nextLv = nowLv + i
  392. local upcf = UpNeedExcel.upLv[nextLv]
  393. if not upcf then break end
  394. if nextLv > maxLv then break end
  395. if i > 1 then
  396. if (needJinbi + upcf.money > bagJinbi) or
  397. (needItemCnt + upcf.soul > bagItemCnt) then
  398. break
  399. end
  400. end
  401. cnt = cnt + 1
  402. needJinbi = needJinbi + upcf.money
  403. needItemCnt = needItemCnt + upcf.soul
  404. if nowLv >= HERO_LEVELUP_MAXLEVEL then
  405. break -- 小于一定等级不能连升
  406. end
  407. end
  408. end
  409. return cnt, needJinbi, needItemCnt
  410. end
  411. -- 填充英雄详细信息:动态
  412. function makeHeroDynamic(net, grid, index, human)
  413. local id = grid and grid.id
  414. local cf = id and HeroExcel.hero[id]
  415. local lv = grid and grid.lv or 1
  416. local star = grid and grid.star or 1 -- 星级调整成动态值 dxzeng --cf and cf.star or 0
  417. local quality = grid and grid.quality or 0
  418. local maxLv = getMaxLv(star, quality)
  419. -- 最大品阶
  420. net.maxQuality = getMaxQuality(star)
  421. net.id = id or 0
  422. net.lv = lv
  423. net.uuid = grid and grid.uuid or ""
  424. net.head = cf and cf.head or 0
  425. net.quality = quality
  426. net.maxLv = maxLv
  427. net.techLv = human and UnionTecLogic.getTechLvByJob(human, cf.job) or 0
  428. net.star = star
  429. net.upLv = 0
  430. if lv >= maxLv then -- 升阶
  431. local upcf = quality < getMaxQuality(star) and UpNeedExcel.upQuality[quality + 1]
  432. net.upLvJinbi = upcf and upcf.money or 0
  433. net.upLvSoul = upcf and upcf.jinjieshi or 0
  434. else -- 升级
  435. if grid and human and index then
  436. net.upLv, net.upLvJinbi, net.upLvSoul = getLevelUpCnt(human, lv, maxLv)
  437. else
  438. local upcf = UpNeedExcel.upLv[lv + 1]
  439. net.upLvJinbi = upcf and upcf.money or 0
  440. net.upLvSoul = upcf and upcf.soul or 0
  441. end
  442. end
  443. net.skin[0] = 0
  444. if grid and human and index then -- todo 皮肤这个以后可能还是需要继续整理
  445. local skinConf, skinSkillConf = SkinLogic.getHeroSkin(human, index)
  446. if skinConf then
  447. net.head = skinConf.head
  448. net.skin[0] = 1 -- 皮肤技能相关
  449. local skinNet = net.skin[1]
  450. skinNet.name = skinConf.name
  451. skinNet.body = skinConf.body
  452. skinNet.normalAtkID = skinSkillConf.normalAtkID
  453. skinNet.skillList[0] = #skinSkillConf.skillList
  454. for i = 1, skinNet.skillList[0] do
  455. HeroLogic.makeSkillNet(skinNet.skillList[i], skinSkillConf.skillList[i])
  456. end
  457. skinNet.beSkill[0] = #skinSkillConf.beSkillID
  458. for i = 1, skinNet.beSkill[0] do
  459. HeroLogic.makeSkillNet(skinNet.beSkill[i], skinSkillConf.beSkillID[i])
  460. end
  461. end
  462. end
  463. -- 技能变更
  464. net.skillList[0] = 0
  465. net.beSkill[0] = 0
  466. if grid and grid.star ~= cf.star then
  467. local attrConfig = HeroDefine.getAttrConfig(id, grid.star)
  468. net.skillList[0] = #attrConfig.skillList
  469. for i = 1, net.skillList[0] do
  470. HeroLogic.makeSkillNet(net.skillList[i], attrConfig.skillList[i])
  471. end
  472. net.beSkill[0] = #attrConfig.beSkillList
  473. for i = 1, net.beSkill[0] do
  474. HeroLogic.makeSkillNet(net.beSkill[i], attrConfig.beSkillList[i])
  475. end
  476. end
  477. local attrs = nil
  478. if human and index then
  479. attrs = ObjHuman.getHeroAttrs(human, index)
  480. elseif grid and grid.attrs then
  481. attrs = grid.attrs
  482. end
  483. net.attrs[0] = 0
  484. if attrs then
  485. for key, value in pairs(attrs)do
  486. -- print(" net.attrs[0] ", net.attrs[0], key)
  487. if RoleDefine.isPanelAttr(key) or RoleDefine.isPingFenAttr(key) then
  488. net.attrs[0] = net.attrs[0] + 1
  489. net.attrs[net.attrs[0]].key = key
  490. net.attrs[net.attrs[0]].value = value
  491. end
  492. end
  493. end
  494. net.zhandouli = grid and grid.zhandouli or 0
  495. end
  496. -- 根据英雄id填充动态信息
  497. function makeHeroDynamicByID(net, id,star)
  498. local grid = getCacheHeroGrid(id,star)
  499. makeHeroDynamic(net, grid)
  500. end
  501. --
  502. function makeHeroInfo(net, grid)
  503. local id = grid and grid.id
  504. local cf = id and HeroExcel.hero[id]
  505. net.id = id or 0
  506. net.camp = cf and cf.camp or 0
  507. net.icon = cf and cf.head or 0
  508. net.lv = grid and grid.lv or 0
  509. net.star = grid and grid.star or 0
  510. net.label = cf and cf.label or ""
  511. end
  512. function makeMonsterSimpleData(net, id, lv)
  513. local mcf = MonsterExcel.monster[id]
  514. if not mcf then return end
  515. net.id = id or 0
  516. net.icon = mcf.head
  517. net.lv = lv or 1
  518. net.camp = mcf.camp
  519. net.star = mcf.star
  520. net.label = mcf and mcf.label or ""
  521. return true
  522. end
  523. function getMonsterOutIDBody(id)
  524. local monsterOutConfig = MonsterExcel.monsterOut[id]
  525. if not monsterOutConfig then return 0 end
  526. local monsterID = monsterOutConfig.member[1][1]
  527. local monsterConfig = MonsterExcel.monster[monsterID]
  528. if not monsterConfig then return 0 end
  529. return monsterConfig.body
  530. end