SkinLogic.lua 19 KB

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