Guest User

Untitled

a guest
Apr 22nd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. main = function()
  2. iiFiles = {
  3. "System/itemInfo_Translation.lua", -- 1st priority
  4. "System/itemInfo_kRO.lua", -- 2nd
  5. "System/itemInfo_idRO.lua", -- 3rd
  6. "System/itemInfo_iRO.lua", -- 4th
  7. "System/itemInfo_misc.lua", -- 5th
  8. "System/itemInfo_ItemDB.lua", -- Fixes!
  9. }
  10.  
  11. _TempItems = {}
  12.  
  13. -- check existing item
  14. function CheckItem(ItemID, DESC, flag)
  15. if not (DESC.costume) then
  16. DESC.costume = false
  17. end
  18. if not (_TempItems[ItemID]) then
  19. _TempItems[ItemID] = DESC
  20. else
  21. myTbl = {}
  22. -- remap
  23. for pos,val in pairs(_TempItems[ItemID]) do
  24. myTbl[pos] = val
  25. end
  26. -- add data if not exists yet
  27. for pos,val in pairs(DESC) do
  28. if not (myTbl[pos]) or myTbl[pos] == "" then
  29. myTbl[pos] = val
  30. end
  31. end
  32. -- use ClassNum from this itemInfo to fix attack sprite animation
  33. if flag == true and DESC.ClassNum then
  34. if not (_TempItems[ItemID].ClassNum) or _TempItems[ItemID].ClassNum == 0 then
  35. myTbl["ClassNum"] = DESC.ClassNum
  36. end
  37. end
  38. _TempItems[ItemID] = myTbl
  39. end
  40. end
  41. -- end check
  42.  
  43. -- Set some fixes
  44. function setDESC(ItemID,DESC)
  45. if _TempItems[ItemID] then
  46. if DESC.costume then
  47. _TempItems[ItemID].costume = DESC.costume
  48. end
  49. if DESC.slotCount then
  50. _TempItems[ItemID].slotCount = DESC.slotCount
  51. end
  52. if DESC.identifiedDisplayName then
  53. _TempItems[ItemID].identifiedDisplayName = DESC.identifiedDisplayName
  54. end
  55. end
  56. end
  57. -- Set some fixes
  58.  
  59. -- Read all files
  60. for i,iiFile in pairs(iiFiles) do
  61. d = dofile(iiFile)
  62. end
  63. -- Read all files
  64.  
  65. -- process _TempItems
  66. for ItemID,DESC in pairs(_TempItems) do
  67. result, msg = AddItem(ItemID, DESC.unidentifiedDisplayName, DESC.unidentifiedResourceName, DESC.identifiedDisplayName, DESC.identifiedResourceName, DESC.slotCount, DESC.ClassNum)
  68. if not result then
  69. return false, msg
  70. end
  71. for k,v in pairs(DESC.unidentifiedDescriptionName) do
  72. result, msg = AddItemUnidentifiedDesc(ItemID, v)
  73. if not result then
  74. return false, msg
  75. end
  76. end
  77. for k,v in pairs(DESC.identifiedDescriptionName) do
  78. result, msg = AddItemIdentifiedDesc(ItemID, v)
  79. if not result then
  80. return false, msg
  81. end
  82. end
  83. if DESC.costume == nil then
  84. result = AddItemIsCostume(ItemID, DESC.costume)
  85. end
  86. if not result then
  87. return false, msg
  88. end
  89. end
  90. -- process _TempItems
  91.  
  92. _TempItems = nil
  93.  
  94. return true, "good"
  95. end
Add Comment
Please, Sign In to add comment