PageRenderTime 27ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/Tukui/modules/skins/inspect.lua

http://github.com/Asphyxia/Tukui
Lua | 138 lines | 117 code | 17 blank | 4 comment | 10 complexity | 74fd83e71c36ec3cd1110fd2c56e81d1 MD5 | raw file
  1. local T, C, L = unpack(select(2, ...))
  2. local function LoadSkin()
  3. InspectFrame:StripTextures(true)
  4. InspectFrameInset:StripTextures(true)
  5. InspectTalentFramePointsBar:StripTextures()
  6. InspectFrame:CreateBackdrop("Transparent")
  7. InspectFrame.backdrop:SetAllPoints()
  8. T.SkinCloseButton(InspectFrameCloseButton)
  9. for i=1, 4 do
  10. T.SkinTab(_G["InspectFrameTab"..i])
  11. end
  12. InspectModelFrameBorderTopLeft:Kill()
  13. InspectModelFrameBorderTopRight:Kill()
  14. InspectModelFrameBorderTop:Kill()
  15. InspectModelFrameBorderLeft:Kill()
  16. InspectModelFrameBorderRight:Kill()
  17. InspectModelFrameBorderBottomLeft:Kill()
  18. InspectModelFrameBorderBottomRight:Kill()
  19. InspectModelFrameBorderBottom:Kill()
  20. InspectModelFrameBorderBottom2:Kill()
  21. InspectModelFrameBackgroundOverlay:Kill()
  22. InspectModelFrame:CreateBackdrop("Transparent")
  23. local slots = {
  24. "HeadSlot",
  25. "NeckSlot",
  26. "ShoulderSlot",
  27. "BackSlot",
  28. "ChestSlot",
  29. "ShirtSlot",
  30. "TabardSlot",
  31. "WristSlot",
  32. "HandsSlot",
  33. "WaistSlot",
  34. "LegsSlot",
  35. "FeetSlot",
  36. "Finger0Slot",
  37. "Finger1Slot",
  38. "Trinket0Slot",
  39. "Trinket1Slot",
  40. "MainHandSlot",
  41. "SecondaryHandSlot",
  42. "RangedSlot",
  43. }
  44. for _, slot in pairs(slots) do
  45. local icon = _G["Inspect"..slot.."IconTexture"]
  46. local slot = _G["Inspect"..slot]
  47. slot:StripTextures()
  48. slot:StyleButton(false)
  49. icon:SetTexCoord(.08, .92, .08, .92)
  50. icon:ClearAllPoints()
  51. icon:Point("TOPLEFT", 2, -2)
  52. icon:Point("BOTTOMRIGHT", -2, 2)
  53. slot:SetFrameLevel(slot:GetFrameLevel() + 2)
  54. slot:CreateBackdrop("Transparent")
  55. slot.backdrop:SetAllPoints()
  56. end
  57. T.SkinRotateButton(InspectModelFrameRotateLeftButton)
  58. T.SkinRotateButton(InspectModelFrameRotateRightButton)
  59. InspectModelFrameRotateRightButton:Point("TOPLEFT", InspectModelFrameRotateLeftButton, "TOPRIGHT", 3, 0)
  60. InspectPVPFrameBottom:Kill()
  61. InspectGuildFrameBG:Kill()
  62. InspectPVPFrame:HookScript("OnShow", function() InspectPVPFrameBG:Kill() end)
  63. for i=1, 3 do
  64. _G["InspectPVPTeam"..i]:StripTextures()
  65. _G["InspectTalentFrameTab"..i]:StripTextures()
  66. end
  67. InspectTalentFrame.bg = CreateFrame("Frame", nil, InspectTalentFrame)
  68. InspectTalentFrame.bg:SetTemplate("Transparent")
  69. InspectTalentFrame.bg:Point("TOPLEFT", InspectTalentFrameBackgroundTopLeft, "TOPLEFT", -2, 2)
  70. InspectTalentFrame.bg:Point("BOTTOMRIGHT", InspectTalentFrameBackgroundBottomRight, "BOTTOMRIGHT", -20, 52)
  71. InspectTalentFrame.bg:SetFrameLevel(InspectTalentFrame.bg:GetFrameLevel() - 2)
  72. for i = 1, MAX_NUM_TALENTS do
  73. local button = _G["InspectTalentFrameTalent"..i]
  74. local icon = _G["InspectTalentFrameTalent"..i.."IconTexture"]
  75. if button then
  76. button:StripTextures()
  77. button:StyleButton()
  78. button:SetTemplate("Transparent")
  79. button.SetHighlightTexture = T.dummy
  80. button.SetPushedTexture = T.dummy
  81. button:GetNormalTexture():SetTexCoord(.08, .92, .08, .92)
  82. button:GetPushedTexture():SetTexCoord(.08, .92, .08, .92)
  83. button:GetHighlightTexture():SetAllPoints(icon)
  84. button:GetPushedTexture():SetAllPoints(icon)
  85. if button.Rank then
  86. button.Rank:SetFont(C.media.font, 12, "THINOUTLINE")
  87. button.Rank:ClearAllPoints()
  88. button.Rank:SetPoint("BOTTOMRIGHT")
  89. end
  90. icon:ClearAllPoints()
  91. icon:Point("TOPLEFT", 2, -2)
  92. icon:Point("BOTTOMRIGHT", -2, 2)
  93. icon:SetTexCoord(.08, .92, .08, .92)
  94. end
  95. end
  96. -- color item by rarity on inspect frame.
  97. local function ColorItemBorder()
  98. if(not InspectFrame:IsShown()) then return end
  99. for _, slot in pairs(slots) do
  100. -- Color the equipment slots by rarity
  101. local target = _G["Inspect"..slot]
  102. local slotId, _, _ = GetInventorySlotInfo(slot)
  103. local itemId = GetInventoryItemID("target", slotId)
  104. if itemId then
  105. local _, _, rarity, _, _, _, _, _, _, _, _ = GetItemInfo(itemId)
  106. if rarity then
  107. target.backdrop:SetBackdropBorderColor(GetItemQualityColor(rarity))
  108. end
  109. else
  110. target.backdrop:SetBackdropBorderColor(unpack(C.media.bordercolor))
  111. end
  112. end
  113. end
  114. -- execute item coloring everytime we open character frame
  115. InspectFrame:HookScript("OnShow", ColorItemBorder)
  116. -- execute item coloring everytime an item is changed
  117. local CheckItemBorderColor = CreateFrame("Frame")
  118. CheckItemBorderColor:RegisterEvent("PLAYER_TARGET_CHANGED")
  119. CheckItemBorderColor:SetScript("OnEvent", ColorItemBorder)
  120. end
  121. T.SkinFuncs["Blizzard_InspectUI"] = LoadSkin