Hamar

asd

Jun 29th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.20 KB | None | 0 0
  1. -- Hamham
  2. Hamar = {Frames = {}, Inputs = {}}
  3.  
  4. local Options = {
  5.     x = 30,
  6.     width = 300,
  7.     height = 250,
  8.     anchor = { "CENTER", UIParent, "CENTER", -100, -200},
  9.     colors = {0.69, 0.31, 0.31, 1},
  10. }
  11.  
  12. local Frame = CreateFrame("Frame", "sHamar", UIParent)
  13. Frame:SetMovable(true)
  14. Frame:EnableMouse(true)
  15. Frame:RegisterForDrag("LeftButton")
  16. Frame:SetScript("OnDragStart", Frame.StartMoving)
  17. Frame:SetScript("OnDragStop", Frame.StopMovingOrSizing)
  18. Frame:SetScript("OnHide", Frame.StopMovingOrSizing)
  19. Frame:SetSize(Options.width, Options.height)
  20. Frame:SetPoint("CENTER")
  21. Frame:SetBackdrop({
  22.         bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", tile = true, tileSize = 16,
  23.         edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16,
  24.         insets = { left = 4, right = 4, top = 4, bottom = 4 },
  25.     })
  26. Hamar.Frame = Frame
  27. local name = "Hamar BattleGround"
  28.  
  29. local NameFrame = CreateFrame("Frame", "sHamar_Name", Frame)
  30. NameFrame:SetHeight(16)
  31. NameFrame:SetWidth(Options.width-16)
  32. NameFrame.text = NameFrame:CreateFontString()
  33. NameFrame.text:SetFont("Fonts\\MORPHEUS.ttf", 14)
  34. NameFrame.text:SetTextColor(0.8, 0.2, 0.2)
  35. NameFrame.text:SetJustifyH("LEFT")
  36. NameFrame.text:SetAllPoints()
  37. NameFrame.text:SetText(name:gsub("_", " "))
  38. NameFrame:SetPoint("TOPLEFT", Frame, "TOPLEFT", 8, -8)
  39. NameFrame:Show()
  40. Frame.NameFrame = NameFrame
  41.  
  42. local Btn = CreateFrame("Button", "sHamar_Button", Frame)
  43. Btn:SetSize(25, 25)
  44. Btn:SetSize(25, 25)
  45. Btn:SetNormalTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Up")
  46. Btn:SetPushedTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Down")
  47. Btn:SetHighlightTexture("Interface\\Buttons\\UI-Panel-MinimizeButton-Highlight")
  48. Btn:SetPoint("TOPRIGHT", Frame, "TOPRIGHT", 0, 0)
  49. Btn:SetScript("OnClick", function() Frame:Hide() end)
  50. Btn:Show()
  51.  
  52. function Hamar:SendMessage(text)
  53.     SendAddonMessage( "hamar", text, "WHISPER", UnitName("player"))
  54.     print("|cffCE9000Sending message|r")
  55. end
  56.  
  57. local SendBtn = CreateFrame("Button", "sHamar_SendButton", Frame, "UIPanelButtonTemplate")
  58. SendBtn:SetSize(150, 50)
  59. SendBtn:SetText("Send Message")
  60. SendBtn:SetPoint("CENTER", Frame, "CENTER", 0, 0)
  61. SendBtn:SetScript("OnClick", function() Hamar:SendMessage("moi") end)
  62. SendBtn:Show()
Advertisement
Add Comment
Please, Sign In to add comment