SkinLogic.lua 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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. local RoleAttr = require("role.RoleAttr")
  17. local CombatDefine = require("combat.CombatDefine")
  18. local CombatImpl = require("combat.CombatImpl")
  19. local RoleDefine = require("role.RoleDefine")
  20. local ObjHuman = require("core.ObjHuman")
  21. local function getBag(human)
  22. if not (human.skinBag and human.heroSkin) then
  23. human.skinBag = {}
  24. human.heroSkin = {}
  25. human.hasSkin = {}
  26. for i = 1,human.db.skinBag[0] do
  27. local data = human.db.skinBag[i]
  28. if data then
  29. if data.heroInd then
  30. local skinSkillID
  31. local heroGrid = human.db.heroBag[data.heroInd]
  32. if not heroGrid then
  33. data.heroInd = nil
  34. else
  35. local heroID = heroGrid.id
  36. local heroConf = HeroExcel[heroID]
  37. for _,v in ipairs(heroConf.skin) do
  38. if v[1] == data.id then
  39. human.heroSkin[data.heroInd] = {i,tonumber(v[2])}
  40. end
  41. end
  42. end
  43. end
  44. human.skinBag[i] = data.id
  45. human.hasSkin[data.id] = human.hasSkin[data.id] or {}
  46. human.hasSkin[data.id][i] = 1
  47. end
  48. end
  49. end
  50. return human.db.skinBag
  51. end
  52. --[[
  53. skin = {
  54. ttl = number -- 有效时长 -1表示永久
  55. state = number -- 0表示未穿戴 1 表示穿戴
  56. } -- skin 拥有唯一性
  57. ]]
  58. -- 获取所有皮肤信息
  59. local function skinListQuery(human)
  60. local skinBag = human.db.skinBag
  61. local ret = {}
  62. for i = 1,#skinBag do
  63. local data = skinBag[i]
  64. ret[data.id] = {
  65. idx = i,
  66. id = data.id,
  67. ttl = data.ttl,
  68. state = data.state,
  69. }
  70. end
  71. return ret
  72. end
  73. -- 获取皮肤为skinId的皮肤
  74. local function skinQueryById(human,skinId)
  75. local skin = human.db.skinBag[skinId]
  76. if skin then
  77. return {
  78. id = skinId,
  79. ttl = skin.ttl,
  80. state = skin.state,
  81. }
  82. end
  83. end
  84. local function skinQueryIdxById(human,skinId)
  85. local skinBag = human.db.skinBag
  86. for i = 1,#skinBag do
  87. local data = skinBag[i]
  88. if data.id == skinId then
  89. return i
  90. end
  91. end
  92. end
  93. -- 生成发送给客户端的皮肤数据
  94. local function skinNetGen(human,net,id)
  95. local skinCfg = assert(SkinExcel[id],"invalid skinId is ",id)
  96. net.id = id
  97. net.heroId = skinCfg.heroId or 0
  98. net.name = skinCfg.name
  99. net.desc = skinCfg.desc
  100. net.head = skinCfg.head
  101. net.body = skinCfg.body
  102. net.icon = skinCfg.icon
  103. net.camp = skinCfg.camp
  104. net.order = skinCfg.order
  105. net.type = skinCfg.type
  106. net.body1 = skinCfg.body1 or 0
  107. local attrLen = 0
  108. for k,v in ipairs(skinCfg.attrs) do
  109. attrLen = attrLen + 1
  110. net.attrs[attrLen].key = v[1]
  111. net.attrs[attrLen].value = v[2]
  112. end
  113. net.attrs[0] = attrLen
  114. net.heroName = HeroExcel[skinCfg.heroId] and HeroExcel[skinCfg.heroId].name or ""
  115. end
  116. -- 皮肤脱下
  117. --[[
  118. @param2 = heroIdx -- 对应英雄存档的idx
  119. ]]
  120. local function skinOff(human,heroIdx)
  121. local heroId = HeroLogic.getHeroIdByIndex(human,heroIdx)
  122. local heroGrid = HeroLogic.getHeroGrid(human,heroId,heroIdx)
  123. local skinId = heroGrid.skinOn
  124. -- 英雄不存在 或者 英雄未穿戴皮肤
  125. if not heroGrid or not skinId then
  126. return Broadcast.sendErr(human, heroIdx..":heroIdx:"..Lang.SKIN_PARAM_ERR)
  127. end
  128. local skinIdx = nil
  129. for idx,skin in pairs(human.db.skinBag) do
  130. if idx > 0 and skin.id == skinId then
  131. skinIdx = idx
  132. human.db.skinBag[idx].state = 0
  133. break
  134. end
  135. end
  136. assert(skinIdx,"param error")
  137. -- 对所有heroId相同的英雄操作
  138. local heroIdxList = HeroLogic.getHeroListById(human,heroId)
  139. local heroCfg = HeroExcel[heroId]
  140. for _,idx in ipairs(heroIdxList) do
  141. -- 脱下皮肤 并且还原默认身体 icon和head
  142. human.db.heroBag[idx].skinOn = nil
  143. --local defaultHead = RoleHeadLogic.getDefaultHead(human)
  144. RoleHeadLogic.setHead(human,heroCfg.head,RoleHeadLogic.HEAD_TYPE_1)
  145. RoleHeadLogic.setHead(human,heroCfg.body,RoleHeadLogic.HEAD_TYPE_3)
  146. end
  147. -- 回复给客户端
  148. local msgRet = Msg.gc.GC_SKIN_UPDATE
  149. local data = msgRet.list[1].data
  150. data.ind = skinIdx
  151. data.isOn = 0
  152. skinNetGen(human,data.data,skinId)
  153. msgRet.list[1].op = 3
  154. msgRet.list[0] = 1
  155. Msg.send(msgRet,human.fd)
  156. end
  157. -- 皮肤穿戴
  158. --[[
  159. @param2 = id -- 皮肤Id
  160. @param3 = heroIdx -- 对应英雄存档的idx
  161. ]]
  162. local function skinOn(human,skinIdx,heroIdx)
  163. --local idx = skinQueryIdxById(human,skinIdx)
  164. local skin = human.db.skinBag[skinIdx]
  165. -- 当前skin不存在 或者 皮肤已经穿戴
  166. if not skin or skin.state == 1 then
  167. return Broadcast.sendErr(human, skinIdx..":skinOn:"..Lang.SKIN_PARAM_ERR)
  168. end
  169. local heroId = HeroLogic.getHeroIdByIndex(human,heroIdx)
  170. local heroGrid = HeroLogic.getHeroGrid(human,heroId,heroIdx)
  171. -- 英雄不存在 或者 英雄已经装备当前皮肤
  172. if not heroGrid then
  173. return Broadcast.sendErr(human, heroIdx..":heroIdx:"..Lang.SKIN_PARAM_ERR)
  174. end
  175. if heroGrid.skinOn == skin.id then
  176. return Broadcast.sendErr(human, Lang.SKIN_DOUBLE_ON)
  177. end
  178. if heroGrid.skinOn then
  179. skinOff(human,heroIdx)
  180. end
  181. local skinCfg = SkinExcel[skin.id]
  182. human.db.skinBag[skinIdx].state = 1
  183. -- 对所有heroId相同的英雄操作
  184. local heroIdxList = HeroLogic.getHeroListById(human,heroId)
  185. for _,idx in ipairs(heroIdxList) do
  186. human.db.heroBag[idx].skinOn = skin.id
  187. RoleHeadLogic.setHead(human,skinCfg.head,RoleHeadLogic.HEAD_TYPE_1)
  188. if skinCfg.body ~= 0 then
  189. RoleHeadLogic.setHead(human,skinCfg.body,RoleHeadLogic.HEAD_TYPE_3)
  190. end
  191. end
  192. -- 回复给客户端
  193. local msgRet = Msg.gc.GC_SKIN_UPDATE
  194. local data = msgRet.list[1].data
  195. data.ind = skinIdx
  196. data.isOn = 1
  197. skinNetGen(human,data.data,skin.id)
  198. msgRet.list[1].op = 3
  199. msgRet.list[0] = 1
  200. Msg.send(msgRet,human.fd)
  201. end
  202. --------------------------------------------------------------
  203. function initAfterHot()
  204. for _,outConf in pairs(OutExcel) do
  205. outConf.totalWeight = 0
  206. for _,v in ipairs(outConf.out) do
  207. outConf.totalWeight = outConf.totalWeight + v[2]
  208. end
  209. end
  210. SkinExcel = require("excel.skin").skin
  211. HeroExcel = require("excel.hero").hero
  212. SkillExcel = require("excel.skin").skill
  213. ItemExcel = require("excel.item").item
  214. end
  215. -- 优先使用皮肤的技能,新版本没有默认返回false
  216. function setSkill(human,heroInd,heroConf,obj)
  217. return false
  218. --[[if not human then return end
  219. if not human.db.skinBag then
  220. --假人
  221. return
  222. end
  223. local bagDB = getBag(human)
  224. local skinSkillID = human.heroSkin[heroInd] and human.heroSkin[heroInd][2]
  225. if not skinSkillID then
  226. return
  227. end
  228. local skillConf = SkillExcel[skinSkillID]
  229. Skill.setSkill(obj, heroConfig,skillConf)
  230. BeSkill.setBeSkill(obj,heroConf,skillConf)
  231. return true]]
  232. end
  233. function checkHeroSkinById(human,heroId)
  234. if not human then
  235. return
  236. end
  237. local heroIdxList = HeroLogic.getHeroListById(human,heroId)
  238. if not next(heroIdxList) then
  239. return
  240. end
  241. local idx = heroIdxList[1]
  242. return human.db.heroBag[idx].skinOn
  243. end
  244. function checkHeroSkin(human, heroInd)
  245. if not heroInd then return end
  246. if not human or not human.db or not human.db.heroBag then return end
  247. local heroId = HeroLogic.getHeroIdByIndex(human,heroInd)
  248. local heroGrid = HeroLogic.getHeroGrid(human,heroId,heroInd)
  249. if heroGrid.skinOn then
  250. return heroGrid.skinOn,true
  251. end
  252. --[[if not human.db.skinBag then
  253. return
  254. end
  255. local bagDB = getBag(human)
  256. if human.heroSkin[heroInd] then
  257. local skinInd = human.heroSkin[heroInd][1]
  258. local skinID = bagDB[skinInd].id
  259. --local skillID = human.heroSkin[heroInd][2]
  260. return skinID,true
  261. else
  262. return
  263. end]]
  264. end
  265. -- 检查是否有皮肤body
  266. function getBody(human,heroInd)
  267. if not heroInd then
  268. return
  269. end
  270. local heroId = HeroLogic.getHeroIdByIndex(human,heroInd)
  271. local heroGrid = HeroLogic.getHeroGrid(human,heroId,heroInd)
  272. if not heroGrid then
  273. return
  274. end
  275. local skinId = heroGrid.skinOn
  276. if not skinId then
  277. return
  278. end
  279. if SkinExcel[skinId].heroId == heroId then
  280. return SkinExcel[skinId].body,SkinExcel[skinId].head
  281. else
  282. print("[getBody] 英雄装备的身体ID不正确 heroId = "..heroId)
  283. local tHeroCof = HeroExcel[heroId]
  284. if tHeroCof then
  285. print("[getBody] 英雄装备的身体ID不正确,返回基础配置 heroId = "..heroId.." body = "..tHeroCof.body.." head = "..tHeroCof.head)
  286. return tHeroCof.body, tHeroCof.head
  287. end
  288. end
  289. --[[if not human.db.skinBag then
  290. return
  291. end
  292. local bagDB = getBag(human)
  293. if human.heroSkin[heroInd] then
  294. local skinInd = human.heroSkin[heroInd][1]
  295. local skinID = bagDB[skinInd].id
  296. return SkinExcel[skinID].body,SkinExcel[skinID].head
  297. end]]
  298. end
  299. function getHeroSkin(human,heroInd)
  300. local heroId = HeroLogic.getHeroIdByIndex(human,heroInd)
  301. if not heroId then
  302. return
  303. end
  304. local heroGrid = HeroLogic.getHeroGrid(human,heroId,heroInd)
  305. local skinId = heroGrid.skinOn
  306. if not skinId then
  307. return
  308. end
  309. return SkillExcel[skinId]
  310. --[=[if not human or not human.db.skinBag then
  311. return
  312. end
  313. local bagDB = getBag(human)
  314. if human.heroSkin[heroInd] then
  315. local skinInd = human.heroSkin[heroInd][1]
  316. local skinID = bagDB[skinInd].id
  317. local skinConf = SkinExcel[skinID]
  318. local skillConf = SkillExcel[human.heroSkin[heroInd][2]]
  319. return skinConf,skillConf
  320. end]=]
  321. end
  322. function getBodyByHeroId(human, heroid)
  323. if not human then return end
  324. local list = HeroLogic.getHeroListById(human, heroid)
  325. if #list > 0 then
  326. local heroIdx = list[1]
  327. return getBody(human, heroIdx)
  328. end
  329. end
  330. local function calcSkinAttr(human)
  331. local skinBag = human.db.skinBag
  332. if not skinBag then
  333. return
  334. end
  335. local attrMap = {}
  336. for i = 1,#skinBag do
  337. local data = skinBag[i]
  338. local skinCfg = SkinExcel[data.id]
  339. for _,attr in pairs(skinCfg.attrs) do
  340. attrMap[attr[1]] = attrMap[attr[1]] or 0
  341. attrMap[attr[1]] = attrMap[attr[1]] + attr[2]
  342. end
  343. end
  344. return attrMap
  345. end
  346. -------------------------- protocol --------------------------
  347. -- 皮肤信息查询
  348. function skinQuery(human)
  349. local msgRet = Msg.gc.GC_SKIN_BAG
  350. local data = skinListQuery(human)
  351. local cnt = 0
  352. for _,info in pairs(data) do
  353. cnt = cnt + 1
  354. msgRet.data[cnt].ind = info.idx
  355. msgRet.data[cnt].id = info.id
  356. msgRet.data[cnt].isOn = info.state
  357. end
  358. msgRet.data[0] = cnt
  359. msgRet.isEnd = 1
  360. local bSend = false
  361. local maxLen = #msgRet.list -- 每次最多只能传30个
  362. cnt = 0
  363. for id in pairs(SkinExcel) do
  364. cnt = cnt + 1
  365. skinNetGen(human,msgRet.list[cnt],id)
  366. if cnt >= maxLen then
  367. msgRet.list[0] = maxLen
  368. cnt = 0
  369. Msg.send(msgRet,human.fd)
  370. msgRet.isEnd = 2
  371. bSend = true
  372. end
  373. end
  374. msgRet.list[0] = cnt
  375. if bSend then
  376. msgRet.isEnd = 3
  377. end
  378. Msg.send(msgRet,human.fd)
  379. end
  380. -- 皮肤穿戴功能
  381. function skinOp(human,heroIdx,skinIdx)
  382. if skinIdx == 0 then
  383. skinOff(human,heroIdx)
  384. else
  385. skinOn(human,skinIdx,heroIdx)
  386. end
  387. local retMsg = Msg.gc.GC_SKIN_ON
  388. retMsg.heroId = heroIdx
  389. retMsg.skinInd = skinIdx
  390. Msg.send(retMsg,human.fd)
  391. end
  392. -- 皮肤解锁
  393. function skinUnlock(human,id)
  394. local skinCfg = assert(SkinExcel[id],"invalid skinId is ",id)
  395. local isUnlock = false
  396. for i = 1,#human.db.skinBag do
  397. local skin = human.db.skinBag[i]
  398. if skin.id == id then
  399. isUnlock =true
  400. break
  401. end
  402. end
  403. --[[for _,skin in pairs(human.db.skinBag) do
  404. if skin.id == id then
  405. isUnlock =true
  406. break
  407. end
  408. end]]
  409. -- 皮肤已经解锁
  410. if isUnlock then
  411. -- 发放皮肤重复物品
  412. local itemList = {}
  413. for _,item in pairs(skinCfg.repeated) do
  414. itemList[#itemList+1] = {
  415. item[1],item[2]
  416. }
  417. end
  418. return BagLogic.addItemList(human,itemList,"skin")
  419. --Broadcast.sendErr(human, ":skin repeat:"..Lang.SKIN_REPEAT)
  420. --return
  421. end
  422. local now = os.time()
  423. human.db.skinBag[#human.db.skinBag + 1] = {
  424. id = id,
  425. ttl = -1,
  426. state = 0,
  427. getTime = now,
  428. }
  429. -- 解锁头像
  430. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_1, skinCfg.head)
  431. -- 解锁身体
  432. if skinCfg.body ~= 0 then
  433. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_3, skinCfg.body)
  434. RoleHeadLogic.active(human, RoleHeadLogic.HEAD_TYPE_5, skinCfg.body)
  435. end
  436. -- 所有角色属性提升
  437. -- 回复给客户端
  438. local msgRet = Msg.gc.GC_SKIN_UPDATE
  439. local data = msgRet.list[1].data
  440. data.ind = #human.db.skinBag
  441. data.isOn = 0
  442. skinNetGen(human,data.data,id)
  443. msgRet.list[1].op = 1
  444. msgRet.list[0] = 1
  445. Msg.send(msgRet,human.fd)
  446. --更新数据
  447. RoleAttr.cleanHeroAttrCache(human)
  448. -- RoleAttr.doCalc(human)
  449. ObjHuman.doCalcHero(human)
  450. ObjHuman.sendAttr(human, RoleDefine.ZHANDOULI)
  451. skinQuery(human)
  452. end
  453. -- 计算皮肤属性
  454. function doCalcSkinHero(human,attrs)
  455. local skinBag = human.db.skinBag
  456. local attrMap = {}
  457. for i = 1,#skinBag do
  458. local data = skinBag[i]
  459. local skinCfg = SkinExcel[data.id]
  460. for _,attr in pairs(skinCfg.attrs) do
  461. attrMap[attr[1]] = attrMap[attr[1]] or 0
  462. attrMap[attr[1]] = attrMap[attr[1]] + attr[2]
  463. end
  464. end
  465. --[=[for id in pairs(skinBag) do
  466. local skinCfg = SkinExcel[id]
  467. for _,attr in pairs(skinCfg.attrs) do
  468. attrMap[attr[1]] = attrMap[attr[1]] or 0
  469. attrMap[attr[1]] = attrMap[attr[1]] + attr[2]
  470. end
  471. end]=]
  472. for attr,cnt in pairs(attrMap) do
  473. RoleAttr.updateValue(attr,cnt, attrs)
  474. end
  475. end
  476. function onFightBegin(human)
  477. local skinAttrMap = calcSkinAttr(human)
  478. if not skinAttrMap or not next(skinAttrMap) then
  479. return
  480. end
  481. for pos = 1,CombatDefine.COMBAT_HERO_ALL_CNT do
  482. local obj = CombatImpl.objList[pos]
  483. if obj then
  484. for attr,cnt in ipairs(skinAttrMap) do
  485. obj.sysAttr[attr] = obj.sysAttr[attr] or 0
  486. obj.sysAttr[attr] = obj.sysAttr[attr] +cnt
  487. end
  488. obj.isSysAttrChange = true
  489. end
  490. end
  491. end
  492. -- 登录检测英雄皮肤装备数据
  493. function OnLoginCheckEquipSkin(human, bSyncClient)
  494. if not human then
  495. return
  496. end
  497. local skinBag = human.db.skinBag
  498. if not skinBag then
  499. return
  500. end
  501. -- 检测的英雄
  502. local tCheckHero = {}
  503. for i = 1,#skinBag do
  504. local data = skinBag[i]
  505. local nSkinID = data.id
  506. local tConfig = SkinExcel[nSkinID]
  507. if not tConfig then
  508. print("[OnLoginCheckEquipSkin] 严重问题, 找不到对应皮肤的配置 nSkinID = "..nSkinID)
  509. break
  510. end
  511. local nHeroID = tConfig.heroId
  512. tCheckHero[nHeroID] = tCheckHero[nHeroID] or {}
  513. -- 找所有皮肤中是否有装备着的
  514. local bEquip, nNowSkinID = false, 0
  515. for nHaveSkinID, v in pairs(tCheckHero[nHeroID]) do
  516. if v == 1 then
  517. bEquip = true
  518. nNowSkinID = nHaveSkinID
  519. break
  520. end
  521. end
  522. if data.state == 1 then
  523. if false == bEquip then
  524. tCheckHero[nHeroID][nSkinID] = 1 -- 装备标识
  525. -- 所有英雄进行装备皮肤
  526. local heroIdxList = HeroLogic.getHeroListById(human, nHeroID)
  527. local headID = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_1)
  528. local bodyID = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_3)
  529. for _,idx in ipairs(heroIdxList) do
  530. human.db.heroBag[idx].skinOn = nSkinID
  531. -- RoleHeadLogic.setHead(human,tConfig.head,RoleHeadLogic.HEAD_TYPE_1)
  532. -- if tConfig.body ~= 0 then
  533. -- RoleHeadLogic.setHead(human,tConfig.body,RoleHeadLogic.HEAD_TYPE_3)
  534. -- end
  535. end
  536. if headID <= 0 then
  537. RoleHeadLogic.setHead(human,tConfig.head,RoleHeadLogic.HEAD_TYPE_1)
  538. end
  539. if bodyID <= 0 and tConfig.body ~= 0 then
  540. RoleHeadLogic.setHead(human,tConfig.body,RoleHeadLogic.HEAD_TYPE_3)
  541. end
  542. print("[OnLoginCheckEquipSkin] 对玩家英雄设置了皮肤 nSkinID = "..nSkinID.." nHeroID = "..nHeroID)
  543. else
  544. tCheckHero[nHeroID][nSkinID] = 0 -- 未装备标识
  545. data.state = 0
  546. print("[OnLoginCheckEquipSkin] 同一个英雄穿上了两个皮肤!! 进行修正 nHeroID = "
  547. .. nHeroID.." nNowSkinID = "..nNowSkinID .. " nSkinID = "..nSkinID)
  548. end
  549. else
  550. tCheckHero[nHeroID][nSkinID] = 0 -- 未装备标识
  551. if false == bEquip then
  552. local heroIdxList = HeroLogic.getHeroListById(human, nHeroID)
  553. local heroCfg = HeroExcel[nHeroID]
  554. for _,idx in ipairs(heroIdxList) do
  555. -- 脱下皮肤 并且还原默认身体 icon和head
  556. human.db.heroBag[idx].skinOn = nil
  557. --local defaultHead = RoleHeadLogic.getDefaultHead(human)
  558. -- RoleHeadLogic.setHead(human,heroCfg.head,RoleHeadLogic.HEAD_TYPE_1)
  559. -- RoleHeadLogic.setHead(human,heroCfg.body,RoleHeadLogic.HEAD_TYPE_3)
  560. end
  561. local headID = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_1)
  562. local bodyID = RoleHeadLogic.getRoleAppearance(human, RoleHeadLogic.HEAD_TYPE_3)
  563. if headID <= 0 then
  564. RoleHeadLogic.setHead(human,tConfig.head,RoleHeadLogic.HEAD_TYPE_1)
  565. end
  566. if bodyID <= 0 then
  567. RoleHeadLogic.setHead(human,tConfig.body,RoleHeadLogic.HEAD_TYPE_3)
  568. end
  569. print("[OnLoginCheckEquipSkin] 对玩家英雄设置取消了皮肤 nHeroID = "..nHeroID.." nSkinID = "..nSkinID)
  570. end
  571. end
  572. end
  573. if bSyncClient then
  574. skinQuery(human)
  575. print("[OnLoginCheckEquipSkin] 同步数据结束")
  576. end
  577. end