a4blank@8
|
1
|
a4blank@8
|
2
|
a4blank@8
|
3 RTT = LibStub("AceAddon-3.0"):NewAddon("RaidTargetTactics", "AceConsole-3.0")
|
a4blank@8
|
4 local L = LibStub("AceLocale-3.0"):GetLocale("RaidTargetTactics")
|
a4blank@8
|
5
|
a4blank@8
|
6
|
a4blank@8
|
7 local LDB = LibStub("LibDataBroker-1.1", true)
|
a4blank@8
|
8 local LDBIcon = LibStub("LibDBIcon-1.0", true)
|
a4blank@10
|
9 local AceGUI = LibStub("AceGUI-3.0")
|
a4blank@8
|
10
|
a4blank@8
|
11 local RTTIcon = LibStub("LibDataBroker-1.1"):NewDataObject("RTTIcon", {
|
a4blank@8
|
12 type = "data source",
|
a4blank@8
|
13 text = "Raid Target Tactics",
|
a4blank@8
|
14 icon = "Interface\\TARGETINGFRAME\\UI-RaidTargetingIcon_8",
|
a4blank@8
|
15 OnClick = function() RTT:OnIconClick() end,
|
a4blank@8
|
16 OnTooltipShow = function(tooltip)
|
a4blank@8
|
17 tooltip:AddLine("Raid Target Tactics")
|
a4blank@8
|
18 tooltip:AddLine(L.Minimap_Icon_Tooltip)
|
a4blank@8
|
19 end,
|
a4blank@8
|
20 })
|
a4blank@8
|
21
|
a4blank@8
|
22 local defaults = {
|
a4blank@8
|
23 profile = {
|
a4blank@8
|
24 visible = true,
|
a4blank@8
|
25 minimap = {
|
a4blank@8
|
26 hide = false,
|
a4blank@8
|
27 },
|
a4blank@8
|
28 },
|
a4blank@8
|
29 }
|
a4blank@8
|
30
|
a4blank@8
|
31 function RTT:OnInitialize()
|
a4blank@8
|
32 self.db = LibStub("AceDB-3.0"):New("TacticsSettings", defaults, true)
|
a4blank@8
|
33
|
a4blank@8
|
34 LDBIcon:Register("RTTIcon", RTTIcon, self.db.profile.minimap)
|
a4blank@8
|
35 self:InitFrame()
|
a4blank@10
|
36 if self.f:IsShown() ~= self.db.profile.visible then
|
a4blank@8
|
37 if self.db.profile.visible then
|
a4blank@8
|
38 self:ShowFrame()
|
a4blank@8
|
39 else
|
a4blank@8
|
40 self:HideFrame()
|
a4blank@8
|
41 end
|
a4blank@8
|
42 end
|
a4blank@8
|
43 end
|
a4blank@8
|
44
|
a4blank@8
|
45 function RTT:InitFrame()
|
a4blank@8
|
46 self.f = CreateFrame("Frame", nil, UIParent)
|
a4blank@10
|
47 self.f:SetWidth(300)
|
a4blank@8
|
48 self.f:SetHeight(200)
|
a4blank@10
|
49 self.f:SetAlpha(0.8)
|
a4blank@8
|
50 self.f:SetPoint("LEFT", UIParent, "LEFT", 10, 0)
|
a4blank@10
|
51 --[[self.f:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
a4blank@10
|
52 edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
a4blank@10
|
53 tile = true, tileSize = 16, edgeSize = 16,
|
a4blank@10
|
54 insets = { left = 4, right = 4, top = 4, bottom = 4 }})
|
a4blank@10
|
55 ]]
|
a4blank@10
|
56 local backdrop = {
|
a4blank@10
|
57 -- path to the background texture
|
a4blank@10
|
58 bgFile = "Interface\\FrameGeneral\\UI-Background-Marble",
|
a4blank@10
|
59 -- path to the border texture
|
a4blank@10
|
60 edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Gold-Border",
|
a4blank@10
|
61 -- true to repeat the background texture to fill the frame, false to scale it
|
a4blank@10
|
62 tile = true,
|
a4blank@10
|
63 -- size (width or height) of the square repeating background tiles (in pixels)
|
a4blank@10
|
64 tileSize = 256,
|
a4blank@10
|
65 -- thickness of edge segments and square size of edge corners (in pixels)
|
a4blank@10
|
66 edgeSize = 32,
|
a4blank@10
|
67 -- distance from the edges of the frame to those of the background texture (in pixels)
|
a4blank@10
|
68 insets = {
|
a4blank@10
|
69 left = 11,
|
a4blank@10
|
70 right = 12,
|
a4blank@10
|
71 top = 12,
|
a4blank@10
|
72 bottom = 11
|
a4blank@10
|
73 }
|
a4blank@10
|
74 }
|
a4blank@10
|
75 self.f:SetBackdrop(backdrop)
|
a4blank@10
|
76 self.f:SetFrameStrata("HIGH")
|
a4blank@10
|
77 --self.f:SetBackdropColor(0, 0, 0, 0.5)
|
a4blank@10
|
78
|
a4blank@10
|
79 self.fields = {}
|
a4blank@10
|
80 self.selects = {}
|
a4blank@10
|
81 for num, icon in ipairs(RaidIcons) do
|
a4blank@10
|
82 icon:draw(self.f, 20, num * -20)
|
a4blank@10
|
83
|
a4blank@10
|
84 local field = CreateFrame("EditBox", "__RTT_EditBox_" .. tostring(num), self.f, "InputBoxTemplate")
|
a4blank@10
|
85 field:SetAutoFocus(false)
|
a4blank@10
|
86 field:SetFontObject(ChatFontNormal)
|
a4blank@10
|
87 field:SetWidth(100)
|
a4blank@10
|
88 field:SetHeight(16)
|
a4blank@10
|
89 field:SetTextInsets(0, 0, 3, 3)
|
a4blank@10
|
90 field:SetPoint("TOPLEFT", 40, num * -20)
|
a4blank@10
|
91 table.insert(self.fields, field)
|
a4blank@10
|
92 field:Show()
|
a4blank@10
|
93
|
a4blank@10
|
94 local userSelect = AceGUI:Create("Dropdown")
|
a4blank@10
|
95 userSelect.frame:SetParent(self.f)
|
a4blank@10
|
96 local raid = {}
|
a4blank@10
|
97 for i=1, GetNumRaidMembers() do
|
a4blank@10
|
98 raid[i] = UnitName("raid" .. i)
|
a4blank@10
|
99 end
|
a4blank@10
|
100 userSelect:SetList(raid)
|
a4blank@10
|
101 userSelect:SetWidth(100)
|
a4blank@10
|
102 userSelect:SetHeight(16)
|
a4blank@10
|
103 userSelect:SetPoint("TOPLEFT", 160, num * -20)
|
a4blank@10
|
104 table.insert(self.selects, userSelect)
|
a4blank@10
|
105 userSelect.frame:Show()
|
a4blank@10
|
106 end
|
a4blank@8
|
107 end
|
a4blank@8
|
108
|
a4blank@8
|
109 function RTT:OnIconClick()
|
a4blank@8
|
110 if self.db.profile.visible then
|
a4blank@8
|
111 self:HideFrame()
|
a4blank@8
|
112 else
|
a4blank@8
|
113 self:ShowFrame()
|
a4blank@8
|
114 end
|
a4blank@10
|
115 self.db.profile.visible = not self.db.profile.visible
|
a4blank@8
|
116 end
|
a4blank@8
|
117
|
a4blank@8
|
118 function RTT:HideFrame()
|
a4blank@8
|
119 self.f:Hide()
|
a4blank@8
|
120 end
|
a4blank@8
|
121
|
a4blank@8
|
122 function RTT:ShowFrame()
|
a4blank@8
|
123 self.f:Show()
|
a4blank@8
|
124 end
|
a4blank@8
|
125
|
a4blank@8
|
126
|
a4blank@8
|
127
|
a4blank@8
|
128
|