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@8
|
9
|
a4blank@8
|
10 local RTTIcon = LibStub("LibDataBroker-1.1"):NewDataObject("RTTIcon", {
|
a4blank@8
|
11 type = "data source",
|
a4blank@8
|
12 text = "Raid Target Tactics",
|
a4blank@8
|
13 icon = "Interface\\TARGETINGFRAME\\UI-RaidTargetingIcon_8",
|
a4blank@8
|
14 OnClick = function() RTT:OnIconClick() end,
|
a4blank@8
|
15 OnTooltipShow = function(tooltip)
|
a4blank@8
|
16 tooltip:AddLine("Raid Target Tactics")
|
a4blank@8
|
17 tooltip:AddLine(L.Minimap_Icon_Tooltip)
|
a4blank@8
|
18 end,
|
a4blank@8
|
19 })
|
a4blank@8
|
20
|
a4blank@8
|
21 local defaults = {
|
a4blank@8
|
22 profile = {
|
a4blank@8
|
23 visible = true,
|
a4blank@8
|
24 minimap = {
|
a4blank@8
|
25 hide = false,
|
a4blank@8
|
26 },
|
a4blank@8
|
27 },
|
a4blank@8
|
28 }
|
a4blank@8
|
29
|
a4blank@8
|
30 function RTT:OnInitialize()
|
a4blank@8
|
31 self.db = LibStub("AceDB-3.0"):New("TacticsSettings", defaults, true)
|
a4blank@8
|
32
|
a4blank@8
|
33 LDBIcon:Register("RTTIcon", RTTIcon, self.db.profile.minimap)
|
a4blank@8
|
34 self:InitFrame()
|
a4blank@8
|
35 if self.f:IsShown() != self.db.profile.visible then
|
a4blank@8
|
36 if self.db.profile.visible then
|
a4blank@8
|
37 self:ShowFrame()
|
a4blank@8
|
38 else
|
a4blank@8
|
39 self:HideFrame()
|
a4blank@8
|
40 end
|
a4blank@8
|
41 end
|
a4blank@8
|
42 end
|
a4blank@8
|
43
|
a4blank@8
|
44 function RTT:InitFrame()
|
a4blank@8
|
45 self.f = CreateFrame("Frame", nil, UIParent)
|
a4blank@8
|
46 self.f:SetWidth(100)
|
a4blank@8
|
47 self.f:SetHeight(200)
|
a4blank@8
|
48 self.f:SetPoint("LEFT", UIParent, "LEFT", 10, 0)
|
a4blank@8
|
49 end
|
a4blank@8
|
50
|
a4blank@8
|
51 function RTT:OnIconClick()
|
a4blank@8
|
52 if self.db.profile.visible then
|
a4blank@8
|
53 self:HideFrame()
|
a4blank@8
|
54 else
|
a4blank@8
|
55 self:ShowFrame()
|
a4blank@8
|
56 end
|
a4blank@8
|
57 self.db.profile.visible = !self.db.profile.visible
|
a4blank@8
|
58 end
|
a4blank@8
|
59
|
a4blank@8
|
60 function RTT:HideFrame()
|
a4blank@8
|
61 self.f:Hide()
|
a4blank@8
|
62 end
|
a4blank@8
|
63
|
a4blank@8
|
64 function RTT:ShowFrame()
|
a4blank@8
|
65 self.f:Show()
|
a4blank@8
|
66 end
|
a4blank@8
|
67
|
a4blank@8
|
68
|
a4blank@8
|
69
|
a4blank@8
|
70
|