SkinLogic.lua 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. local Msg = require("core.Msg")
  2. local Grid = require("bag.Grid")
  3. local BagLogic = require("bag.BagLogic")
  4. local Broadcast = require("broadcast.Broadcast")
  5. local Lang = require("common.Lang")
  6. local Util = require("common.Util")
  7. local ItemDefine = require("bag.ItemDefine")
  8. local BeSkill = require("combat.BeSkill")
  9. local HeroLogic = require("hero.HeroLogic")
  10. local RoleHeadLogic = require("role.RoleHeadLogic")
  11. local SkinExcel = require("excel.skin").skin
  12. local HeroExcel = require("excel.hero").hero
  13. local SkillExcel = require("excel.skin").skill
  14. local OutExcel = require("excel.skin").out
  15. local ItemExcel = require("excel.item").item
  16. function initAfterHot()
  17. for _,outConf in pairs(OutExcel) do
  18. outConf.totalWeight = 0
  19. for _,v in ipairs(outConf.out) do
  20. outConf.totalWeight = outConf.totalWeight + v[2]
  21. end
  22. end
  23. end
  24. local function getBag(human)
  25. if not (human.skinBag and human.heroSkin) then
  26. human.skinBag = {}
  27. human.heroSkin = {}
  28. human.hasSkin = {}
  29. for i = 1,human.db.skinBag[0] do
  30. local data = human.db.skinBag[i]
  31. if data then
  32. if data.heroInd then
  33. local skinSkillID
  34. local heroGrid = human.db.heroBag[data.heroInd]
  35. if not heroGrid then
  36. data.heroInd = nil
  37. else
  38. local heroID = heroGrid.id
  39. local heroConf = HeroExcel[heroID]
  40. for _,v in ipairs(heroConf.skin) do
  41. if v[1] == data.id then
  42. human.heroSkin[data.heroInd] = {i,tonumber(v[2])}
  43. end
  44. end
  45. end
  46. end
  47. human.skinBag[i] = data.id
  48. human.hasSkin[data.id] = human.hasSkin[data.id] or {}
  49. human.hasSkin[data.id][i] = 1
  50. end
  51. end
  52. end
  53. return human.db.skinBag
  54. end
  55. local function fontSkinNet(data,id)
  56. if not id or id == 0 then
  57. data.id = 0
  58. data.name = ""
  59. data.desc = ""
  60. data.head = 0
  61. data.body = ""
  62. data.icon = 0
  63. data.camp = 0
  64. data.order = 0
  65. data.type = 0
  66. data.upID = 0
  67. data.attrs[0] = 0
  68. data.fenjie[0] = 0
  69. data.upAddExp = 0
  70. data.upNeedExp = 0
  71. data.ronghe = 0
  72. data.heroName = ""
  73. data.quality = 0
  74. else
  75. local conf = SkinExcel[id]
  76. data.id = id
  77. data.name = conf.name
  78. data.desc = conf.desc
  79. data.head = conf.head
  80. data.body = conf.body
  81. data.icon = conf.icon
  82. data.camp = conf.camp
  83. data.order = conf.order
  84. data.type = conf.type
  85. data.upID = conf.upID
  86. local len = 0
  87. for k,v in ipairs(conf.attrs) do
  88. len = len + 1
  89. data.attrs[len].key = v[1]
  90. data.attrs[len].value = v[2]
  91. end
  92. data.attrs[0] = len
  93. len = 0
  94. for k,v in ipairs(conf.fenjie) do
  95. len = len + 1
  96. Grid.makeItem(data.fenjie[len],v[1],v[2])
  97. end
  98. data.fenjie[0] = len
  99. data.upAddExp = conf.upAddExp
  100. data.upNeedExp = conf.upNeedExp
  101. data.ronghe = conf.ronghe
  102. data.heroName = HeroExcel[conf.id] and HeroExcel[conf.id].name or ""
  103. data.quality = conf.quality
  104. end
  105. end
  106. local function fontBagNet(net,human,ind)
  107. net.ind = ind or 0
  108. if human.db.skinBag[ind] then
  109. net.isOn = human.db.skinBag[ind].heroInd and 1 or 0
  110. fontSkinNet(net.data,human.db.skinBag[ind].id)
  111. else
  112. net.isOn = 0
  113. fontSkinNet(net.data)
  114. end
  115. end
  116. function bag(human)
  117. local bagDB = getBag(human)
  118. local msgRet = Msg.gc.GC_SKIN_BAG
  119. local len = 0
  120. msgRet.isEnd = 1
  121. for k in pairs(human.skinBag) do
  122. len = len + 1
  123. local net = msgRet.list[len]
  124. fontBagNet(net,human,k)
  125. if len >=30 then
  126. msgRet.list[0] = 30
  127. Msg.send(msgRet,human.fd)
  128. len = 0
  129. msgRet.isEnd = 2
  130. end
  131. end
  132. msgRet.isEnd = 3
  133. msgRet.list[0] = len
  134. Msg.send(msgRet,human.fd)
  135. end
  136. OP_ADD = 1
  137. OP_UPDATE = 2
  138. OP_DEL = 3
  139. function sendChange(human,changeList)
  140. if #changeList == 0 then
  141. return
  142. end
  143. table.sort(changeList,function(a,b)
  144. return a[2] > b[2]
  145. end)
  146. local msgRet = Msg.gc.GC_SKIN_UPDATE
  147. local len = 0
  148. for _,v in ipairs(changeList) do
  149. len = len + 1
  150. local net = msgRet.list[len]
  151. net.op = v[2]
  152. fontBagNet(net.data,human,v[1])
  153. if len >= 30 then
  154. break
  155. end
  156. end
  157. msgRet.list[0] = len
  158. Msg.send(msgRet,human.fd)
  159. end
  160. function onAddSkin(human,id,list)
  161. local ind
  162. for i = 1,human.db.skinBag[0] do
  163. if not human.db.skinBag[i] then
  164. ind = i
  165. break
  166. end
  167. end
  168. local skinConf = SkinExcel[id]
  169. if ind and skinConf then
  170. human.db.skinBag[ind] = {id = id}
  171. human.skinBag = nil
  172. list[#list + 1] = {ind,OP_ADD}
  173. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_1, skinConf.head)
  174. return ind
  175. end
  176. end
  177. function onDelSkin(human,ind,list)
  178. if human.db.skinBag[ind] then
  179. human.db.skinBag[ind] = nil
  180. human.skinBag = nil
  181. list[#list + 1] = {ind,OP_DEL}
  182. return ind
  183. end
  184. end
  185. function checkDel(human,list)
  186. if #list == 0 then
  187. return Broadcast.sendErr(human, "empty checkDel:"..Lang.SKIN_PARAM_ERR)
  188. end
  189. local bagDB = getBag(human)
  190. for _,v in ipairs(list) do
  191. if not bagDB[v] then
  192. return Broadcast.sendErr(human, Lang.SKIN_NO_HAS)
  193. elseif bagDB[v].heroInd then
  194. return Broadcast.sendErr(human, Lang.SKIN_IS_ON)
  195. end
  196. end
  197. return true
  198. end
  199. function delSkin(human,delList,changeList)
  200. if checkDel(human,delList) then
  201. for _,v in ipairs(delList) do
  202. onDelSkin(human,v,changeList)
  203. end
  204. return true
  205. end
  206. end
  207. function addSkin(human,id,cnt)
  208. if not SkinExcel[id] then
  209. return
  210. end
  211. cnt = cnt or 1
  212. local changeList = {}
  213. for i = 1,cnt do
  214. onAddSkin(human,id,changeList)
  215. end
  216. sendChange(human,changeList)
  217. human.db.skinLog[id] = 1
  218. end
  219. function fenjie(human,ind)
  220. local bagDB = getBag(human)
  221. if not bagDB[ind] then
  222. return
  223. end
  224. local id = bagDB[ind].id
  225. local conf = SkinExcel[id]
  226. if not conf.fenjie[1] then
  227. return
  228. end
  229. local changeList = {}
  230. if not delSkin(human,{ind},changeList) then
  231. return
  232. end
  233. for k,v in ipairs(conf.fenjie) do
  234. BagLogic.addItem(human, v[1], v[2], "skin")
  235. end
  236. sendChange(human,changeList)
  237. local msgRet = Msg.gc.GC_SKIN_FENJIE
  238. msgRet.ind = ind
  239. Msg.send(msgRet,human.fd)
  240. end
  241. function upQuery(human,ind,nosend)
  242. local bagDB = getBag(human)
  243. if not bagDB[ind] then
  244. return
  245. end
  246. if type(bagDB[ind]) == "number" then
  247. if nosend then
  248. Broadcast.sendErr(human, ind..":upQuery:"..Lang.SKIN_PARAM_ERR)
  249. end
  250. return
  251. end
  252. local id = bagDB[ind].id
  253. local conf = SkinExcel[id]
  254. local upConf = SkinExcel[conf.upID]
  255. if not (upConf and conf.upNeedExp > 0) then
  256. if not nosend then
  257. Broadcast.sendErr(human, id..":upQuery:"..Lang.SKIN_CONF_ERR)
  258. end
  259. return
  260. end
  261. local msgRet = Msg.gc.GC_SKIN_UP_QUERY
  262. msgRet.ind = ind
  263. fontSkinNet(msgRet.nowData,id)
  264. fontSkinNet(msgRet.upData,conf.upID)
  265. msgRet.maxExp = conf.upNeedExp
  266. msgRet.nowExp = bagDB[ind].exp or 0
  267. Msg.send(msgRet,human.fd)
  268. end
  269. function up(human,ind,list)
  270. local bagDB = getBag(human)
  271. if not bagDB[ind] then
  272. return
  273. end
  274. local id = bagDB[ind].id
  275. local conf = SkinExcel[id]
  276. local upConf = SkinExcel[conf.upID]
  277. if not (upConf and conf.upNeedExp > 0) then
  278. return Broadcast.sendErr(human, id..":up:"..Lang.SKIN_CONF_ERR)
  279. end
  280. local addExp = 0
  281. for _,v in ipairs(list) do
  282. if not bagDB[v] then--皮肤不存在
  283. return Broadcast.sendErr(human, v..":up1:"..Lang.SKIN_PARAM_ERR)
  284. elseif bagDB[v].heroInd then--被使用
  285. return Broadcast.sendErr(human, v..":up2:"..Lang.SKIN_PARAM_ERR)
  286. elseif v == ind then--升级目标和升级皮肤一样
  287. return Broadcast.sendErr(human, v..":up3:"..Lang.SKIN_PARAM_ERR)
  288. end
  289. local costID = bagDB[v].id
  290. local costConf = SkinExcel[costID]
  291. if not (costConf and costConf.upAddExp > 0) then
  292. return Broadcast.sendErr(human, costID..":up3:"..Lang.SKIN_PARAM_ERR)
  293. else
  294. addExp = addExp + costConf.upAddExp
  295. end
  296. end
  297. if addExp == 0 then
  298. return Broadcast.sendErr(human, #list..":up3:"..Lang.SKIN_PARAM_ERR)
  299. end
  300. local nowExp = bagDB[ind].exp or 0
  301. nowExp = nowExp + addExp
  302. if nowExp > conf.upNeedExp then
  303. return
  304. end
  305. local heroInd = bagDB[ind].heroInd
  306. local isUp = false
  307. local changeList = {}
  308. for _,v in ipairs(list) do
  309. onDelSkin(human,v,changeList)
  310. end
  311. if nowExp == conf.upNeedExp then
  312. onDelSkin(human,ind,changeList)
  313. ind = onAddSkin(human,conf.upID,changeList)
  314. bagDB[ind].exp = nowExp - conf.upNeedExp
  315. id = conf.upID
  316. conf = SkinExcel[id]
  317. upConf = conf.upID and SkinExcel[conf.upID]
  318. isUp = true
  319. else
  320. bagDB[ind].exp = nowExp
  321. end
  322. sendChange(human,changeList)
  323. local msgRet = Msg.gc.GC_SKIN_UP
  324. msgRet.ind = ind
  325. fontSkinNet(msgRet.nowData,id)
  326. fontSkinNet(msgRet.upData,conf.upID)
  327. msgRet.maxExp = conf.upNeedExp
  328. msgRet.nowExp = bagDB[ind].exp or 0
  329. Msg.send(msgRet,human.fd)
  330. upQuery(human,ind,true)
  331. if isUp and heroInd then
  332. skinOn(human,heroInd,ind)
  333. end
  334. end
  335. function fontPreviewNet(net,id,weight)
  336. net.weight = weight
  337. fontSkinNet(net.data,id)
  338. end
  339. function suipianPreview(human,id)
  340. local itemConf = ItemExcel[id]
  341. if not (itemConf and itemConf.type == ItemDefine.ITEM_SUBTYPE_SUIPIAN_SKIN) then
  342. return Broadcast.sendErr(human, id..":suipianPreview:"..Lang.SKIN_PARAM_ERR)
  343. end
  344. local msgRet = Msg.gc.GC_SKIN_SUIPIAN_PREVIEW
  345. msgRet.id = id
  346. local len = 0
  347. if itemConf.get[1] == 1 then
  348. len = len + 1
  349. fontPreviewNet(msgRet.list[len],itemConf.get[3],10000)
  350. else
  351. for _,v in ipairs(OutExcel[itemConf.get[3]].out) do
  352. len = len + 1
  353. local weight = math.floor(10000*v[2]/OutExcel[itemConf.get[3]].totalWeight)
  354. fontPreviewNet(msgRet.list[len],v[1],v[2])
  355. end
  356. end
  357. msgRet.list[0] = len
  358. Msg.send(msgRet,human.fd)
  359. end
  360. SUIPIAN_CNT = 10
  361. function suipian(human,id,cnt)
  362. local itemConf = ItemExcel[id]
  363. if cnt > SUIPIAN_CNT then
  364. return Broadcast.sendErr(human, Util.format(Lang.SKIN_SUIPIAN_LIMIT,SUIPIAN_CNT))
  365. end
  366. if not (itemConf and itemConf.type == ItemDefine.ITEM_SUBTYPE_SUIPIAN_SKIN) then
  367. return Broadcast.sendErr(human, id..":suipian:"..Lang.SKIN_PARAM_ERR)
  368. end
  369. if BagLogic.getItemCnt(human,id) < itemConf.fullCnt * cnt then
  370. return Broadcast.sendErr(human, Util.format(Lang.COMMON_NO_ITEM,itemConf.name))
  371. end
  372. local skinIDList = {}
  373. for i = 1,cnt do
  374. if itemConf.get[1] == 1 then
  375. skinIDList[#skinIDList + 1] = itemConf.get[3]
  376. else
  377. local outConf = OutExcel[itemConf.get[3]]
  378. local r = math.random(1,outConf.totalWeight)
  379. for _,v in ipairs(outConf.out) do
  380. if r <= v[2] then
  381. skinIDList[#skinIDList + 1] = v[1]
  382. break
  383. else
  384. r = r - v[2]
  385. end
  386. end
  387. end
  388. end
  389. if #skinIDList == 0 then
  390. return Broadcast.sendErr(human, id..":suipian:"..Lang.SKIN_CONF_ERR)
  391. end
  392. BagLogic.delItem(human, id, itemConf.fullCnt * cnt, "skin")
  393. local msgRet = Msg.gc.GC_SKIN_SUIPIAN
  394. msgRet.id = id
  395. local len = 0
  396. local changeList = {}
  397. for _,skinID in ipairs(skinIDList) do
  398. len = len + 1
  399. onAddSkin(human,skinID,changeList)
  400. fontSkinNet(msgRet.out[len],skinID)
  401. end
  402. msgRet.out[0] = len
  403. sendChange(human,changeList)
  404. Msg.send(msgRet,human.fd)
  405. end
  406. RONGHE_ID = 1
  407. RONGHE_CNT = 5
  408. function ronghePreview(human)
  409. local outConf = OutExcel[RONGHE_ID]
  410. local msgRet = Msg.gc.GC_SKIN_RONGHE_PREVIEW
  411. local len = 0
  412. for _,v in ipairs(outConf.out) do
  413. len = len + 1
  414. local weight = math.floor(10000*v[2]/outConf.totalWeight)
  415. fontPreviewNet(msgRet.list[len],v[1],weight)
  416. end
  417. msgRet.list[0] = len
  418. Msg.send(msgRet,human.fd)
  419. end
  420. function ronghe(human,list)
  421. if #list ~= RONGHE_CNT then
  422. return Broadcast.sendErr(human, #list..":ronghe1:"..Lang.SKIN_PARAM_ERR)
  423. end
  424. local bagDB = getBag(human)
  425. for k,v in ipairs(list) do
  426. local costID = bagDB[v] and bagDB[v].id or 0
  427. local costConf = SkinExcel[costID]
  428. if not (costConf and costConf.ronghe == 1) then
  429. return Broadcast.sendErr(human, v..":"..costID..":ronghe2:"..Lang.SKIN_PARAM_ERR)
  430. end
  431. end
  432. local outConf = OutExcel[RONGHE_ID]
  433. local r = math.random(1,outConf.totalWeight)
  434. local skinID = outConf.out[1][1]
  435. for _,v in ipairs(outConf.out) do
  436. if r <= v[2] then
  437. skinID = v[1]
  438. break
  439. else
  440. r = r - v[2]
  441. end
  442. end
  443. local changeList = {}
  444. if not delSkin(human,list,changeList) then
  445. return
  446. end
  447. onAddSkin(human,skinID,changeList)
  448. sendChange(human,changeList)
  449. local msgRet = Msg.gc.GC_SKIN_RONGHE
  450. msgRet.id = id
  451. fontSkinNet(msgRet.out,skinID)
  452. Msg.send(msgRet,human.fd)
  453. end
  454. function heroSkin(human,heroInd)
  455. local bagDB = getBag(human)
  456. local heroGrid = human.db.heroBag[heroInd]
  457. local heroID = heroGrid.id
  458. local heroConf = HeroExcel[heroID]
  459. local heroSkinInd = human.heroSkin[heroInd] and human.heroSkin[heroInd][1]
  460. local heroSkinID = heroSkinInd and bagDB[heroSkinInd].id
  461. local msgRet = Msg.gc.GC_SKIN_HERO
  462. local len = 0
  463. for _,v in ipairs(heroConf.skin) do
  464. len = len + 1
  465. local net = msgRet.list[len]
  466. fontSkinNet(net.data,v[1])
  467. if heroSkinID == v[1] then
  468. net.ind = heroSkinInd
  469. net.isOn = 1
  470. elseif human.hasSkin[v[1]] then
  471. net.isOn = 1
  472. net.ind = 0
  473. for v1 in pairs(human.hasSkin[v[1]]) do
  474. if not bagDB[v1].heroInd then
  475. net.ind = v1
  476. net.isOn = 0
  477. break
  478. end
  479. end
  480. else
  481. net.ind = 0
  482. net.isOn = 0
  483. end
  484. end
  485. msgRet.list[0] = len
  486. Msg.send(msgRet,human.fd)
  487. end
  488. function skinOn(human,heroInd,skinInd)
  489. local bagDB = getBag(human)
  490. if not (skinInd == 0 or bagDB[skinInd]) then
  491. return Broadcast.sendErr(human, skinInd..":skinOn:"..Lang.SKIN_PARAM_ERR)
  492. end
  493. local heroGrid = human.db.heroBag[heroInd]
  494. local heroID = heroGrid.id
  495. local heroConf = HeroExcel[heroID]
  496. if skinInd > 0 then
  497. local skinID = skinInd > 0 and bagDB[skinInd].id
  498. if bagDB[skinInd].heroInd then
  499. return Broadcast.sendErr(human, Lang.SKIN_DOUBLE_ON)
  500. end
  501. if bagDB[skinInd].heroInd == heroInd then
  502. return
  503. end
  504. isHeroSkin = false
  505. for k,v in ipairs(heroConf.skin) do
  506. if v[1] == skinID then
  507. isHeroSkin = true
  508. break
  509. end
  510. end
  511. if not isHeroSkin then
  512. return Broadcast.sendErr(human, Lang.SKIN_NO_HERO)
  513. end
  514. end
  515. local changeInd
  516. for k in pairs(human.skinBag) do
  517. if bagDB[k].heroInd == heroInd then
  518. bagDB[k].heroInd = nil
  519. changeInd = k
  520. end
  521. end
  522. if skinInd > 0 then
  523. bagDB[skinInd].heroInd = heroInd
  524. changeInd = skinInd
  525. end
  526. human.heroSkin = nil
  527. heroSkin(human,heroInd)
  528. local msgRet = Msg.gc.GC_SKIN_ON
  529. msgRet.heroInd = heroInd
  530. msgRet.skinInd = skinInd
  531. Msg.send(msgRet,human.fd)
  532. HeroLogic.sendHeroBagDynamic(human,heroID,heroInd)
  533. if changeInd then
  534. sendChange(human,{{changeInd,OP_UPDATE}})
  535. end
  536. end
  537. function book(human)
  538. local msgRet = Msg.gc.GC_SKIN_BOOK
  539. local len = 0
  540. msgRet.isEnd = 1
  541. for k,v in pairs(SkinExcel) do
  542. if v.tujian == 1 then
  543. len = len + 1
  544. local net = msgRet.list[len]
  545. net.ind = human.db.skinLog[k] and 1 or 0
  546. net.isOn = 0
  547. fontSkinNet(net.data,k)
  548. if len >=30 then
  549. msgRet.list[0] = 30
  550. Msg.send(msgRet,human.fd)
  551. len = 0
  552. msgRet.isEnd = 2
  553. end
  554. end
  555. end
  556. msgRet.isEnd = 3
  557. msgRet.list[0] = len
  558. Msg.send(msgRet,human.fd)
  559. end
  560. function setSkill(human,heroInd,heroConf,obj)
  561. if not human then return end
  562. if not human.db.skinBag then
  563. --假人
  564. return
  565. end
  566. local bagDB = getBag(human)
  567. local skinSkillID = human.heroSkin[heroInd] and human.heroSkin[heroInd][2]
  568. if not skinSkillID then
  569. return
  570. end
  571. local skillConf = SkillExcel[skinSkillID]
  572. Skill.setSkill(obj, heroConfig,skillConf)
  573. BeSkill.setBeSkill(obj,heroConf,skillConf)
  574. return true
  575. end
  576. function checkHeroSkin(human, heroInd)
  577. if not heroInd then return end
  578. if not human or not human.db then return end
  579. if not human.db.skinBag then
  580. return
  581. end
  582. local bagDB = getBag(human)
  583. if human.heroSkin[heroInd] then
  584. local skinInd = human.heroSkin[heroInd][1]
  585. local skinID = bagDB[skinInd].id
  586. local skillID = human.heroSkin[heroInd][2]
  587. return skinID,skillID
  588. else
  589. return
  590. end
  591. end
  592. function getBody(human,heroInd)
  593. if not human.db.skinBag then
  594. return
  595. end
  596. local bagDB = getBag(human)
  597. if human.heroSkin[heroInd] then
  598. local skinInd = human.heroSkin[heroInd][1]
  599. local skinID = bagDB[skinInd].id
  600. return SkinExcel[skinID].body,SkinExcel[skinID].head
  601. end
  602. end
  603. function getHeroSkin(human,heroInd)
  604. if not human or not human.db.skinBag then
  605. return
  606. end
  607. local bagDB = getBag(human)
  608. if human.heroSkin[heroInd] then
  609. local skinInd = human.heroSkin[heroInd][1]
  610. local skinID = bagDB[skinInd].id
  611. local skinConf = SkinExcel[skinID]
  612. local skillConf = SkillExcel[human.heroSkin[heroInd][2]]
  613. return skinConf,skillConf
  614. end
  615. end
  616. function onDelHero(human,heroInd)
  617. local bagDB = getBag(human)
  618. if human.heroSkin[heroInd] then
  619. skinOn(human,heroInd,0)
  620. end
  621. end