PageRenderTime 719ms CodeModel.GetById 703ms RepoModel.GetById 1ms app.codeStats 0ms

/Tukui/developer/commands.lua

http://github.com/Asphyxia/Tukui
Lua | 73 lines | 70 code | 2 blank | 1 comment | 6 complexity | 346205a0185ad1b9f360205419fcadd1 MD5 | raw file
  1. -- a command to show frame you currently have mouseovered
  2. SLASH_FRAME1 = "/frame"
  3. SlashCmdList["FRAME"] = function(arg)
  4. if arg ~= "" then
  5. arg = _G[arg]
  6. else
  7. arg = GetMouseFocus()
  8. end
  9. if arg ~= nil and arg:GetName() ~= nil then
  10. local point, relativeTo, relativePoint, xOfs, yOfs = arg:GetPoint()
  11. ChatFrame1:AddMessage("|cffCC0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
  12. ChatFrame1:AddMessage("Name: |cffFFD100"..arg:GetName())
  13. if arg:GetParent() then
  14. ChatFrame1:AddMessage("Parent: |cffFFD100"..arg:GetParent():GetName())
  15. end
  16. ChatFrame1:AddMessage("Width: |cffFFD100"..format("%.2f",arg:GetWidth()))
  17. ChatFrame1:AddMessage("Height: |cffFFD100"..format("%.2f",arg:GetHeight()))
  18. ChatFrame1:AddMessage("Strata: |cffFFD100"..arg:GetFrameStrata())
  19. ChatFrame1:AddMessage("Level: |cffFFD100"..arg:GetFrameLevel())
  20. if xOfs then
  21. ChatFrame1:AddMessage("X: |cffFFD100"..format("%.2f",xOfs))
  22. end
  23. if yOfs then
  24. ChatFrame1:AddMessage("Y: |cffFFD100"..format("%.2f",yOfs))
  25. end
  26. if relativeTo then
  27. ChatFrame1:AddMessage("Point: |cffFFD100"..point.."|r anchored to "..relativeTo:GetName().."'s |cffFFD100"..relativePoint)
  28. end
  29. ChatFrame1:AddMessage("|cffCC0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
  30. elseif arg == nil then
  31. ChatFrame1:AddMessage("Invalid frame name")
  32. else
  33. ChatFrame1:AddMessage("Could not find frame info")
  34. end
  35. end
  36. -- enable lua error by command
  37. function SlashCmdList.LUAERROR(msg, editbox)
  38. if (msg == 'on') then
  39. SetCVar("scriptErrors", 1)
  40. -- because sometime we need to /rl to show an error on login.
  41. ReloadUI()
  42. elseif (msg == 'off') then
  43. SetCVar("scriptErrors", 0)
  44. else
  45. print("/luaerror on - /luaerror off")
  46. end
  47. end
  48. SLASH_LUAERROR1 = '/luaerror'
  49. SLASH_TEST1 = "/test"
  50. SlashCmdList["TEST"] = function()
  51. for _, frames in pairs({"TukuiPet", "TukuiFocus", "TukuiFocusTarget", "TukuiBoss1", "TukuiBoss2", "TukuiBoss3", "TukuiBoss4"}) do
  52. _G[frames].Hide = function() end
  53. _G[frames]:Show()
  54. _G[frames].unit = "player"
  55. end
  56. end
  57. SLASH_TESTARENA1 = "/testarena"
  58. SlashCmdList["TESTARENA"] = function()
  59. for _, frames in pairs({"TukuiArena1", "TukuiArena2", "TukuiArena3", "TukuiArena4"}) do
  60. _G[frames].Hide = function() end
  61. _G[frames]:Show()
  62. _G[frames].unit = "player"
  63. end
  64. end
  65. local mes = function(msg)
  66. print("|cffFF6347-|r", tostring(msg))
  67. end