SkinLogic.lua 16 KB

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