HeroGrid.lua 20 KB

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