Check.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. local HeroExcel = require("excel.hero")
  2. local RoleExcel = require("excel.role")
  3. local MonsterExcel = require("excel.monster")
  4. function checkHead()
  5. for heroID, heroConfig in pairs(HeroExcel.hero) do
  6. local headID = heroConfig.head
  7. local configTemp = RoleExcel.head[headID]
  8. if configTemp == nil then
  9. --assert(nil, "hero ".. heroID .. " has not head config:" .. headID)
  10. end
  11. end
  12. end
  13. function getHeroHeadFile()
  14. local heroHead = {}
  15. local heroHeadTemp = {}
  16. for heroID, heroConfig in pairs(HeroExcel.hero) do
  17. local headID = heroConfig.head
  18. if heroHeadTemp[headID] == nil then
  19. heroHeadTemp[headID] = true
  20. heroHead[#heroHead + 1] = heroID
  21. end
  22. end
  23. table.sort(heroHead)
  24. local str = ""
  25. for k, v in pairs(heroHead) do
  26. str = str .. v .. "\n"
  27. end
  28. str2file(str, ".//heroHead.txt")
  29. end
  30. function getMonsterHeadFile()
  31. local heroHead = {}
  32. local heroHeadTemp = {}
  33. for heroID, heroConfig in pairs(MonsterExcel.monster) do
  34. local headID = heroConfig.head
  35. if heroHeadTemp[headID] == nil then
  36. heroHeadTemp[headID] = true
  37. heroHead[#heroHead + 1] = heroID
  38. end
  39. end
  40. table.sort(heroHead)
  41. local str = ""
  42. for k, v in pairs(heroHead) do
  43. str = str .. v .. "\n"
  44. end
  45. str2file(str, ".//monsterHead.txt")
  46. end
  47. function check()
  48. checkHead()
  49. --getHeroHeadFile()
  50. --getMonsterHeadFile()
  51. end
  52. function str2file(str, filename)
  53. local f = io.open(filename, "wb")
  54. f:write(str)
  55. assert(io.close(f))
  56. end
  57. function is_file_exist(filename)
  58. local f = io.open(filename, "rb")
  59. if not f then
  60. return
  61. end
  62. assert(io.close(f))
  63. return true
  64. end