Advertisement
IHATEMICROWAVEOVEN

moves distribution checker

Oct 19th, 2023 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. local movesAndMons = {}
  2. --[[ dictionary: {move, mon, mon, mon, …} ]]
  3. local movesToIndex = {}
  4. --[[ table: move = isAtThisIndex ]]
  5. local movesPathway = game.StarterGui.SkillsGui.WeaponsController
  6.  
  7.  
  8. local function registerWeapons(monName, weaponsFolder)
  9. for i, Weapon in ipairs(weaponsFolder:GetChildren()) do
  10. local name = Weapon.Value
  11. if movesToIndex[name] then
  12. table.insert(movesAndMons[movesToIndex[name]], monName)
  13. else
  14. print("Unknown move: "..name.." found on "..monName)
  15. end
  16. end
  17. end
  18.  
  19. local function iterateThroughMons(target)
  20. for i, Child in ipairs(target:GetChildren()) do
  21. if Child.Name == "Weapons" then
  22. registerWeapons(target.Name, Child)
  23. elseif Child:IsA("Folder") and Child.Name~="SetStatsOnSpawn" then
  24. iterateThroughMons(Child)
  25. end
  26. end
  27. end
  28.  
  29.  
  30. for i, Move in ipairs(movesPathway.ClientModules:GetChildren()) do
  31. local name = Move.Name
  32. table.insert(movesAndMons, {name})
  33. movesToIndex[name] = #movesAndMons
  34. print("Indexed "..name.." to "..#movesAndMons)
  35. end
  36.  
  37. for i, Move in ipairs(movesPathway.ServerModules:GetChildren()) do
  38. local name = Move.Name
  39. if not movesToIndex[name] then
  40. table.insert(movesAndMons, {name.." (Server Only?)"})
  41. movesToIndex[name] = #movesAndMons
  42. end
  43. end
  44.  
  45.  
  46. for i, Region in ipairs(game.StarterGui.GameGui.LocalScript.Pokemon:GetChildren()) do
  47. for j, EvoLine in ipairs(Region:GetChildren()) do
  48. iterateThroughMons(EvoLine)
  49. end
  50. end
  51.  
  52.  
  53. table.sort(movesAndMons, function(a,b) if #a==#b then return a[1]<b[1] else return #a>#b end end)
  54.  
  55. local bigStringToPrint = ""
  56. local lastMoveAmount = math.huge
  57. for i, Table in ipairs(movesAndMons) do
  58. if lastMoveAmount ~= #Table-1 then
  59. lastMoveAmount = #Table-1
  60. bigStringToPrint = bigStringToPrint.."\nMOVES ON "..lastMoveAmount.." MONS\n"
  61. end
  62. local listString = Table[1].." ("
  63. table.remove(Table, 1)
  64. for i, Mon in ipairs(Table) do listString = listString..Mon..", " end
  65. bigStringToPrint = bigStringToPrint..string.sub(listString, 1, string.len(listString)-2)..")\n"
  66. end
  67. print(bigStringToPrint)
  68. print("All done!!!")
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement